* libglade eingefuegt

* ./images als Standarddownloadverz.
 * GTK_WIDGET_CAN_DEFAULT gefixt
 * 5 versch. Zeiten
This commit is contained in:
age 2006-06-15 21:04:18 +00:00
parent 27d662c45b
commit f598cb33e4
3 changed files with 63 additions and 12 deletions

33
WKNcharts/libglade.py Normal file
View file

@ -0,0 +1,33 @@
#This requires pygtk2
import gettext
import gtk
import gtk.glade
class GladeWrapper:
"""
Superclass for glade based applications. Just derive from this
and your subclass should create methods whose names correspond to
the signal handlers defined in the glade file. Any other attributes
in your class will be safely ignored.
This class will give you the ability to do:
subclass_instance.GtkWindow.method(...)
subclass_instance.widget_name...
"""
def __init__(self, Filename, WindowName):
#load glade file.
self.widgets = gtk.glade.XML(Filename, WindowName, gettext.textdomain())
self.GtkWindow = getattr(self, WindowName)
instance_attributes = {}
for attribute in dir(self.__class__):
instance_attributes[attribute] = getattr(self, attribute)
self.widgets.signal_autoconnect(instance_attributes)
def __getattr__(self, attribute): #Called when no attribute in __dict__
widget = self.widgets.get_widget(attribute)
if widget is None:
raise AttributeError("Widget [" + attribute + "] not found")
self.__dict__[attribute] = widget #add reference to cache
return widget

View file

@ -57,12 +57,11 @@ class WknGUI:
self.textbuffer = self.outputfield.get_buffer()
configs[name] = self.textbuffer.get_text(*self.textbuffer.get_bounds ())
## checkboxes are also stored in 'configs'
checkboxnames = {"cb_time1":30,"cb_time2":300,"cb_time3":30000,"cb_time4":100000}
checkboxnames = {"cb_time1":30,"cb_time2":300,"cb_time3":10000,"cb_time4":30000,"cb_time5":100000}
configs["times"] = []
for name in checkboxnames.keys():
if self.wkngui.get_widget(name).get_active():
configs["times"].append(checkboxnames[name])
print configs["times"]
self.add_log(("configs: %s %s" % (configs.keys(), configs.values())), 3)
self.read_wknlist()
self.check_dstdir()

View file

@ -451,8 +451,8 @@
<child>
<widget class="GtkTextView" id="tf_srcfile">
<property name="visible">True</property>
<property name="has_default">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="extension_events">GDK_EXTENSION_EVENTS_ALL</property>
<property name="editable">True</property>
<property name="overwrite">False</property>
@ -491,8 +491,6 @@
<child>
<widget class="GtkTextView" id="tf_dstdir">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="overwrite">False</property>
@ -685,10 +683,10 @@
<child>
<widget class="GtkTable" id="table1">
<property name="border_width">5</property>
<property name="border_width">17</property>
<property name="visible">True</property>
<property name="n_rows">1</property>
<property name="n_columns">4</property>
<property name="n_columns">5</property>
<property name="homogeneous">False</property>
<property name="row_spacing">0</property>
<property name="column_spacing">0</property>
@ -718,7 +716,7 @@
<widget class="GtkCheckButton" id="cb_time2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">30 Tage</property>
<property name="label" translatable="yes">3 Monate</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
@ -739,7 +737,7 @@
<widget class="GtkCheckButton" id="cb_time3">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">300 Tage</property>
<property name="label" translatable="yes">1 Jahr</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
@ -776,9 +774,31 @@
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="cb_time5">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">7 Jahre</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="padding">8</property>
<property name="left_attach">4</property>
<property name="right_attach">5</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
@ -805,7 +825,6 @@
<child>
<widget class="GtkButton" id="cancel_settings">
<property name="visible">True</property>
<property name="has_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
@ -962,7 +981,7 @@
</widget>
<packing>
<property name="tab_expand">False</property>
<property name="tab_fill">True</property>
<property name="tab_fill">False</property>
</packing>
</child>