[POS-commit] r1915 - in stoqlib/trunk/stoqlib/gui: . glade

Bruno Rafael Garcia brg at async.com.br
Thu Dec 15 11:40:19 BRST 2005


Author: brg
Date: Thu Dec 15 11:40:19 2005
New Revision: 1915

Modified:
   stoqlib/trunk/stoqlib/gui/editors.py
   stoqlib/trunk/stoqlib/gui/glade/NoteSlave.glade
Log:
Added a option to change the label text.

r=evandro


Modified: stoqlib/trunk/stoqlib/gui/editors.py
==============================================================================
--- stoqlib/trunk/stoqlib/gui/editors.py	(original)
+++ stoqlib/trunk/stoqlib/gui/editors.py	Thu Dec 15 11:40:19 2005
@@ -197,17 +197,23 @@
 class NoteEditor(BaseEditor):
     """ Simple editor that offers a label and a textview. """
     gladefile = "NoteSlave"
-    widgets = ('notes', )
+    proxy_widgets = ('notes',)
     size = (500, 200)
 
-    def __init__(self, conn, model, attr_name, title=''):
+    def __init__(self, conn, model, attr_name, title='', label_text=None):
         assert model, ("You must supply a valid model to this editor "
                        "(%r)" % self)
         self.model_type = type(model)
         self.title = title
+        self.label_text = label_text
         self.attr_name = attr_name
 
         BaseEditor.__init__(self, conn, model)
+        self._setup_widgets()
+        
+    def _setup_widgets(self):
+        if self.label_text:
+            self.notes_label.set_text(self.label_text)
         self.notes.set_accepts_tab(False)
 
     # 
@@ -216,7 +222,7 @@
 
     def setup_proxies(self):
         self.notes.set_property('model-attribute', self.attr_name)
-        proxy = self.add_proxy(model=self.model, widgets=self.widgets)
+        proxy = self.add_proxy(self.model, NoteEditor.proxy_widgets)
 
 
     def get_title(self, *args):

Modified: stoqlib/trunk/stoqlib/gui/glade/NoteSlave.glade
==============================================================================
--- stoqlib/trunk/stoqlib/gui/glade/NoteSlave.glade	(original)
+++ stoqlib/trunk/stoqlib/gui/glade/NoteSlave.glade	Thu Dec 15 11:40:19 2005
@@ -12,7 +12,7 @@
                 <property name="border_width">5</property>
                 <property name="visible">True</property>
                 <child>
-                    <widget class="GtkLabel" id="label1">
+                    <widget class="GtkLabel" id="notes_label">
                         <property name="label" context="True" translatable="yes">Notes:</property>
                         <property name="xalign">0.0</property>
                         <property name="visible">True</property>


More information about the POS-commit mailing list