* src/TipOfDay.py (TipOfDay.__init__): switch to ManagedWindow

svn: r6471
This commit is contained in:
Don Allingham 2006-04-27 20:36:32 +00:00
parent d4b2d21e0a
commit 801a3841e2
2 changed files with 17 additions and 10 deletions

View File

@ -1,4 +1,5 @@
2006-04-27 Don Allingham <don@gramps-project.org>
* src/TipOfDay.py (TipOfDay.__init__): switch to ManagedWindow
* src/Editors/_EditFamily.py: provide add new parent option
* src/Editors/_EditEvent.py: used set_window
* src/glade/gramps.glade: add new buttons for add new parent

View File

@ -46,25 +46,30 @@ import gtk.glade
import const
import Config
import Utils
import ManagedWindow
#-------------------------------------------------------------------------
#
# Tip Display class
#
#-------------------------------------------------------------------------
class TipOfDay:
class TipOfDay(ManagedWindow.ManagedWindow):
def __init__(self,uistate):
ManagedWindow.ManagedWindow.__init__(self, uistate, [], self)
xml = gtk.glade.XML(const.gladeFile, "tod", "gramps")
top = xml.get_widget("tod")
self.set_window(xml.get_widget("tod"),
xml.get_widget("title"),
_("Tip of the Day"),
_("Tip of the Day"))
tip = xml.get_widget("tip")
use = xml.get_widget('usetips')
image = xml.get_widget('image')
image.set_from_file(os.path.join(const.image_dir,'splash.jpg'))
alt_title = xml.get_widget("title")
tmsg = _("GRAMPS' Tip of the Day")
Utils.set_titles(top, alt_title, tmsg, _("Tip of the Day"))
tp = TipParser()
tip_list = tp.get()
use.set_active(Config.get(Config.USE_TIPS))
@ -72,21 +77,22 @@ class TipOfDay:
new_index = range(len(tip_list))
Random().shuffle(new_index)
top.set_transient_for(uistate.window)
index = 0
rval = 0
while rval == 0:
tip.set_text(_(tip_list[new_index[index]]))
tip.set_use_markup(1)
rval = top.run()
rval = self.window.run()
if index >= len(tip_list)-1:
index = 0
else:
index += 1
Config.set(Config.USE_TIPS,use.get_active())
top.destroy()
self.close()
def build_menu_names(self,obj):
return (_("Tip of the Day"), None)
#-------------------------------------------------------------------------
#