From ff1658a1026c043bf5b67177567393d2e42669c1 Mon Sep 17 00:00:00 2001 From: Martin Hawlisch Date: Wed, 17 May 2006 13:50:49 +0000 Subject: [PATCH] * src/glade/gramps.glade, * src/TipOfDay.py: Use a gtk.Window instead of a Dialog to work around the "Button not clickable again" gtk-bug. (closes #0000033) svn: r6691 --- gramps2/ChangeLog | 5 + gramps2/src/TipOfDay.py | 56 ++++++----- gramps2/src/glade/gramps.glade | 175 +++++++++++++++++++++++++++++++++ 3 files changed, 212 insertions(+), 24 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index c1c2cf615..d7febfc4d 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,8 @@ +2006-05-17 Martin Hawlisch + * src/glade/gramps.glade, + * src/TipOfDay.py: Use a gtk.Window instead of a Dialog to work + around the "Button not clickable again" gtk-bug. (closes #0000033) + 2006-05-16 Alex Roitman * src/glade/gramps.glade (select_person): Name the box. * src/DataViews/_MediaView.py (row_change): Collect garbage on the diff --git a/gramps2/src/TipOfDay.py b/gramps2/src/TipOfDay.py index 981a58892..43cf75aaa 100644 --- a/gramps2/src/TipOfDay.py +++ b/gramps2/src/TipOfDay.py @@ -58,39 +58,47 @@ class TipOfDay(ManagedWindow.ManagedWindow): ManagedWindow.ManagedWindow.__init__(self, uistate, [], self) - xml = gtk.glade.XML(const.gladeFile, "tod", "gramps") - - self.set_window(xml.get_widget("tod"), + xml = gtk.glade.XML(const.gladeFile, "tod_window", "gramps") + window = xml.get_widget("tod_window") + self.set_window(window, xml.get_widget("title"), _("Tip of the Day"), _("Tip of the Day")) - tip = xml.get_widget("tip") - use = xml.get_widget('usetips') + self.tip = xml.get_widget("tip") + self.use = xml.get_widget('usetips') + self.use.set_active(Config.get(Config.USE_TIPS)) image = xml.get_widget('image') image.set_from_file(os.path.join(const.image_dir,'splash.jpg')) - tp = TipParser() - tip_list = tp.get() - use.set_active(Config.get(Config.USE_TIPS)) - - new_index = range(len(tip_list)) - Random().shuffle(new_index) - - index = 0 - rval = 0 - while rval == 0: - tip.set_text(_(tip_list[new_index[index]])) - tip.set_use_markup(1) - rval = self.window.run() - if index >= len(tip_list)-1: - index = 0 - else: - index += 1 + next = xml.get_widget('next') + next.connect("clicked",self.next_tip_cb) + close = xml.get_widget('close') + close.connect("clicked",self.close_cb) - Config.set(Config.USE_TIPS,use.get_active()) - self.close() + tp = TipParser() + self.tip_list = tp.get() + self.new_index = range(len(self.tip_list)) + Random().shuffle(self.new_index) + + self.index = 0 + self.next_tip_cb() + + window.show_all() + + def next_tip_cb(self,dummy=None): + self.tip.set_text(_(self.tip_list[self.new_index[self.index]])) + self.tip.set_use_markup(True) + if self.index >= len(self.tip_list)-1: + self.index = 0 + else: + self.index += 1 + + def close_cb(self,dummy=None): + Config.set(Config.USE_TIPS,self.use.get_active()) + self.close() + def build_menu_names(self,obj): return (_("Tip of the Day"), None) diff --git a/gramps2/src/glade/gramps.glade b/gramps2/src/glade/gramps.glade index 1ff47ca6e..756593e45 100644 --- a/gramps2/src/glade/gramps.glade +++ b/gramps2/src/glade/gramps.glade @@ -17151,4 +17151,179 @@ You should select parents before adding any new information. If you select paren + + 8 + True + window1 + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + 500 + 350 + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_NORMAL + GDK_GRAVITY_NORTH_WEST + True + False + + + + True + False + 0 + + + + True + 3 + 3 + False + 0 + 0 + + + + True + + False + False + GTK_JUSTIFY_LEFT + True + False + 0.5 + 0.5 + 6 + 6 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 2 + 3 + 1 + 2 + + + + + + True + + False + True + GTK_JUSTIFY_LEFT + True + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 2 + 3 + 0 + 1 + fill + + + + + + True + True + _Display on startup + True + GTK_RELIEF_NORMAL + True + True + False + True + + + 0 + 3 + 2 + 3 + expand + fill + + + + + + True + 0.5 + 0.5 + 0 + 0 + + + 0 + 1 + 0 + 2 + + + + + + + 0 + True + True + + + + + + True + GTK_BUTTONBOX_END + 0 + + + + True + True + True + gtk-go-forward + True + GTK_RELIEF_NORMAL + True + + + + + + True + True + True + gtk-close + True + GTK_RELIEF_NORMAL + True + + + + + 0 + False + False + GTK_PACK_END + + + + + +