* 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
This commit is contained in:
Martin Hawlisch 2006-05-17 13:50:49 +00:00
parent b21da17659
commit 9904f654f3
3 changed files with 212 additions and 24 deletions

View File

@ -1,3 +1,8 @@
2006-05-17 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* 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 <shura@gramps-project.org>
* src/glade/gramps.glade (select_person): Name the box.
* src/DataViews/_MediaView.py (row_change): Collect garbage on the

View File

@ -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)

View File

@ -17151,4 +17151,179 @@ You should select parents before adding any new information. If you select paren
</child>
</widget>
<widget class="GtkWindow" id="tod_window">
<property name="border_width">8</property>
<property name="visible">True</property>
<property name="title" translatable="yes">window1</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="default_width">500</property>
<property name="default_height">350</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<child>
<widget class="GtkVBox" id="vbox126">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkTable" id="table75">
<property name="visible">True</property>
<property name="n_rows">3</property>
<property name="n_columns">3</property>
<property name="homogeneous">False</property>
<property name="row_spacing">0</property>
<property name="column_spacing">0</property>
<child>
<widget class="GtkLabel" id="tip">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">True</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">6</property>
<property name="ypad">6</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="title">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">True</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="usetips">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Display on startup</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">True</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">expand</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkImage" id="image">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">2</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHButtonBox" id="hbuttonbox47">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<property name="spacing">0</property>
<child>
<widget class="GtkButton" id="next">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-go-forward</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="close">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>