/[ascend]/trunk/pygtk/properties.py
ViewVC logotype

Diff of /trunk/pygtk/properties.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2494 by aakash, Tue Aug 16 11:14:13 2011 UTC revision 2495 by aakash, Tue Aug 16 11:35:08 2011 UTC
# Line 120  class VarPropsWin: Line 120  class VarPropsWin:
120          for _k,_v in _arr.iteritems():            for _k,_v in _arr.iteritems():  
121              _t = str(_v / _conversion)+" "+_u              _t = str(_v / _conversion)+" "+_u
122              _k.set_text(_t)              _k.set_text(_t)
123                self.parse_entry(_k)
124    
125          self.varname.set_text(self.browser.sim.getInstanceName(self.instance));          self.varname.set_text(self.browser.sim.getInstanceName(self.instance));
126    
# Line 148  class VarPropsWin: Line 149  class VarPropsWin:
149              i = RealAtomEntry(self.instance, _k.get_text())              i = RealAtomEntry(self.instance, _k.get_text())
150              try:              try:
151                  i.checkEntry()                  i.checkEntry()
152                  self.color_entry(_k,"white");                  self.taint_entry(_k,"white");
153                  _v(i.getValue())                  _v(i.getValue())
154              except InputError, e:              except InputError, e:
155                  print "INPUT ERROR: ",str(e)                  print "INPUT ERROR: ",str(e)
156                  self.color_entry(_k,"#FFBBBB");                  self.taint_entry(_k,"#FFBBBB");
157                  failed = True;                  failed = True;
158                    
159          self.instance.setFixed(self.fixed.get_active())          self.instance.setFixed(self.fixed.get_active())
# Line 162  class VarPropsWin: Line 163  class VarPropsWin:
163    
164          self.browser.do_solve_if_auto()          self.browser.do_solve_if_auto()
165    
166      def color_entry(self,entry,color):      def taint_entry(self, entry, color):
167          entry.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(color))          entry.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(color))
168          entry.modify_bg(gtk.STATE_ACTIVE, gtk.gdk.color_parse(color))          entry.modify_bg(gtk.STATE_ACTIVE, gtk.gdk.color_parse(color))
169          entry.modify_base(gtk.STATE_NORMAL, gtk.gdk.color_parse(color))          entry.modify_base(gtk.STATE_NORMAL, gtk.gdk.color_parse(color))
170          entry.modify_base(gtk.STATE_ACTIVE, gtk.gdk.color_parse(color))          entry.modify_base(gtk.STATE_ACTIVE, gtk.gdk.color_parse(color))
171            if color == "#FFBBBB":
172                entry.set_property("secondary-icon-stock", 'gtk-dialog-error')
173            elif color == "white":
174                entry.set_property("secondary-icon-stock", 'gtk-yes')
175                entry.set_property("secondary-icon-tooltip-text", "")
176    
177        def parse_entry(self, entry):
178            # A simple function to get the real value from the entered text
179            # and taint the entry box accordingly
180            i = RealAtomEntry(self.instance, entry.get_text())
181            try:
182                i.checkEntry()
183                _value = i.getValue()
184            except InputError, e:
185                _value = None
186                _error = re.split('Input Error: ', str(e), 1)
187                entry.set_property("secondary-icon-tooltip-text", _error[1])
188            
189            if _value is not None:
190                self.taint_entry(entry, "white")
191            else:
192                self.taint_entry(entry, "#FFBBBB")
193            return _value
194            
195      def on_varpropswin_close(self,*args):      def on_varpropswin_close(self,*args):
196          self.window.response(gtk.RESPONSE_CANCEL)          self.window.response(gtk.RESPONSE_CANCEL)
197    

Legend:
Removed from v.2494  
changed lines
  Added in v.2495

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22