15 |
import straw |
import straw |
16 |
from error import log |
from error import log |
17 |
import htmlentitydefs |
import htmlentitydefs |
18 |
|
import time |
19 |
|
|
20 |
class ExceptionView: |
class ExceptionView: |
21 |
def __init__(self, frame, label): |
def __init__(self, frame, label): |
152 |
if item.title is not None: |
if item.title is not None: |
153 |
ret.append('<div class="stitle">%s</div>' % item.title) |
ret.append('<div class="stitle">%s</div>' % item.title) |
154 |
if item.pub_date is not None: |
if item.pub_date is not None: |
155 |
|
format = '%a, %d %b %H:%M:%S' |
156 |
ret.append('<div class="sdate">%s</div>' % |
ret.append('<div class="sdate">%s</div>' % |
157 |
str(item.pub_date.localtime().strftime('%a, %d %b %H:%M:%S'))) |
unicode(item.pub_date.localtime().strftime(format),'latin-1').encode('utf-8')) |
158 |
ret.append('<div class="content">') |
ret.append('<div class="content">') |
159 |
if item.description is not None: |
if item.description is not None: |
160 |
ret.append('%s ' % item.description) |
ret.append('%s ' % item.description) |
185 |
item.publication_starting_page)) |
item.publication_starting_page)) |
186 |
ret.append('</p><p>') |
ret.append('</p><p>') |
187 |
if item.link is not None: |
if item.link is not None: |
188 |
ret.append('<a href="%s">Full Story >></a><br />' % item.link) |
ret.append('<a href="%s">%s >></a><br />' % |
189 |
|
(item.link,_("Full Story"))) |
190 |
if item.guid is not None and is_url(item.guid): |
if item.guid is not None and is_url(item.guid): |
191 |
ret.append('<a href="%s">%s >></a>' % |
ret.append('<a href="%s">%s >></a>' % |
192 |
(item.guid, _("Permanent link"))) |
(item.guid, _("Permanent link"))) |
476 |
def mode_changed(self, signal): |
def mode_changed(self, signal): |
477 |
self.show() |
self.show() |
478 |
|
|
479 |
|
class StatusTime: |
480 |
|
def __init__(self, widget): |
481 |
|
self.time_label = widget |
482 |
|
straw.config.signal_connect(straw.LastPollChangedSignal, self.next_poll) |
483 |
|
|
484 |
|
def next_poll(self, *args): |
485 |
|
format = '%d %b %H:%M:%S' |
486 |
|
npoll = straw.config.last_poll + straw.config.poll_frequency |
487 |
|
npoll_sane = _("Next polling time: <b>%s</b>" % time.strftime(format,time.localtime(npoll))) |
488 |
|
self.time_label.set_text(npoll_sane) |
489 |
|
self.time_label.set_property("use_markup", True) |
490 |
|
self.time_label.show() |
491 |
|
|
492 |
|
def show(self): |
493 |
|
self.next_poll() |
494 |
|
return |
495 |
|
|
496 |
class Toolbar: |
class Toolbar: |
497 |
def __init__(self,widget): |
def __init__(self,widget): |
498 |
# set toolbar tooltips |
# set toolbar tooltips |
681 |
xml.get_widget('offline_toggle')) |
xml.get_widget('offline_toggle')) |
682 |
self._toolbar = Toolbar( |
self._toolbar = Toolbar( |
683 |
xml.get_widget('toolbar_default')) |
xml.get_widget('toolbar_default')) |
684 |
|
self._timestats = StatusTime( |
685 |
|
xml.get_widget('status_next_poll')) |
686 |
self._offline_toggle.show() |
self._offline_toggle.show() |
687 |
self._toolbar.show_tips() |
self._toolbar.show_tips() |
688 |
|
self._timestats.show() |
689 |
self.create_ui(xml) |
self.create_ui(xml) |
690 |
# status messages are queued and displayed with a half a second |
# status messages are queued and displayed with a half a second |
691 |
# timeout, so the user can see what's happening. the timeout is only |
# timeout, so the user can see what's happening. the timeout is only |
751 |
|
|
752 |
def on_menu_about_activate(self, menuitem, *args): |
def on_menu_about_activate(self, menuitem, *args): |
753 |
gnome.ui.About( |
gnome.ui.About( |
754 |
straw.APPNAME, straw.VERSION, "Copyright (c) 2002 Juri Pakaste", "", |
straw.APPNAME, straw.VERSION, "Copyright (c) 2002-2003 Juri Pakaste", "", |
755 |
["Juri Pakaste <juri@iki.fi>", |
["Juri Pakaste <juri@iki.fi>", |
756 |
"Jan Alonzo <jmalonzo@spaceants.org>", |
"Jan Alonzo <jmalonzo@spaceants.org>", |
757 |
"rssparser.py and rssfinder.py by Mark Pilgrim", |
"rssparser.py and rssfinder.py by Mark Pilgrim", |
759 |
[], |
[], |
760 |
"Juri Pakaste <juri@iki.fi>\n" |
"Juri Pakaste <juri@iki.fi>\n" |
761 |
"Martin Steldinger <tribble@hanfplantage.de>\n" |
"Martin Steldinger <tribble@hanfplantage.de>\n" |
762 |
"David Rousseau <boiteaflood@wanadoo.fr>", |
"David Rousseau <boiteaflood@wanadoo.fr>\n" |
763 |
|
"Sergei Vavinov <svv@cmc.msu.ru>\n" |
764 |
|
u"Terje Rosten <terjeros@phys.ntnu.no>", |
765 |
gtk.gdk.pixbuf_new_from_file(straw.main._libdir + |
gtk.gdk.pixbuf_new_from_file(straw.main._libdir + |
766 |
"/straw.png")).show() |
"/straw.png")).show() |
767 |
|
|