/[ascend]/branches/adrian/pygtk/observer.py
ViewVC logotype

Diff of /branches/adrian/pygtk/observer.py

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

revision 3075 by adrian, Wed Aug 19 12:10:14 2015 UTC revision 3076 by adrian, Wed Aug 19 13:34:55 2015 UTC
# Line 141  class ObserverRow: Line 141  class ObserverRow:
141          self.dead = False          self.dead = False
142          self.error_msg = None          self.error_msg = None
143    
144      def make_static(self,table):      def make_static(self, table, values=None):
145          self.active = False          self.active = False
146          #print "TABLE COLS:",table.cols          #print "TABLE COLS:",table.cols
147          #print "ROW VALUES:",self.values          #print "ROW VALUES:",self.values
148          _v = {}          if values is None:
149          for col in table.cols.values():              _v = {}
150              _v[col.index] = col.instance.getRealValue()              for col in table.cols.values():
151          self.values = _v                  _v[col.index] = col.instance.getRealValue()
152                self.values = _v
153            else:
154                self.values = values
155          #print "Made static, values:",self.values          #print "Made static, values:",self.values
156    
157      def get_values(self,table):      def get_values(self,table):
# Line 240  class ObserverTab: Line 243  class ObserverTab:
243          else:          else:
244              cell.set_property('pixbuf',self.keptimg.get_pixbuf())              cell.set_property('pixbuf',self.keptimg.get_pixbuf())
245    
246        def get_values(self):
247            _v = []
248            for col in self.cols.values():
249                _v.append(col.instance.getRealValue())
250            return _v
251    
252      def on_add_clicked(self,*args):      def on_add_clicked(self,*args):
253          self.do_add_row()          self.do_add_row()
254    
# Line 270  class ObserverTab: Line 279  class ObserverTab:
279              if y is None:              if y is None:
280                  y=[self.cols[1]]                  y=[self.cols[1]]
281    
282            ##### CELSIUS TEMPERATURE WORKAROUND
283            size = len(CelsiusUnits.get_celsius_sign())
284            xtit = x.title.find(CelsiusUnits.get_celsius_sign())
285            if xtit != -1:
286                x.title = x.title[:xtit] + "K" + x.title[xtit + size:]
287            for yy in y:
288                ytit = yy.title.find(CelsiusUnits.get_celsius_sign())
289                if ytit != -1:
290                    yy.title = yy.title[:ytit] + "K" + yy.title[ytit + size:]
291            ##### CELSIUS TEMPERATURE WORKAROUND
292    
293          # if column indices are provided instead of columns, convert them          # if column indices are provided instead of columns, convert them
294          if x.__class__ is int and x>=0 and x<len(self.cols):          if x.__class__ is int and x>=0 and x<len(self.cols):
295              x=self.cols[x]              x=self.cols[x]
# Line 424  class ObserverTab: Line 444  class ObserverTab:
444              self.rows.append(_row)              self.rows.append(_row)
445              if self.activeiter is not None:              if self.activeiter is not None:
446                  _oldrow = _store.get_value(self.activeiter, 0)                  _oldrow = _store.get_value(self.activeiter, 0)
447                  _oldrow.make_static(self)                  _oldrow.make_static(self, values)
448              self.activeiter = _store.append(None,[_row])              self.activeiter = _store.append(None,[_row])
449              _path = _store.get_path(self.activeiter)              _path = _store.get_path(self.activeiter)
450              _oldpath,_oldcol = self.view.get_cursor()              _oldpath,_oldcol = self.view.get_cursor()

Legend:
Removed from v.3075  
changed lines
  Added in v.3076

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