/[ascend]/trunk/pygtk/interface/incidencematrix.py
ViewVC logotype

Diff of /trunk/pygtk/interface/incidencematrix.py

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

revision 254 by johnpye, Thu Feb 2 06:27:17 2006 UTC revision 463 by johnpye, Sun Apr 16 10:18:16 2006 UTC
# Line 1  Line 1 
1  import pylab;  import config
2    import matplotlib
3    import numarray
4    matplotlib.rcParams['numerix'] = 'numarray'  
5    
6    import pylab
7    import platform
8  from matplotlib.colors import LinearSegmentedColormap  from matplotlib.colors import LinearSegmentedColormap
9    
10  class IncidenceMatrixWindow:  class IncidenceMatrixWindow:
# Line 40  class IncidenceMatrixWindow: Line 46  class IncidenceMatrixWindow:
46          pylab.ylabel("Relations")          pylab.ylabel("Relations")
47          pylab.connect('motion_notify_event',self.on_sparsity_motion_notify)          pylab.connect('motion_notify_event',self.on_sparsity_motion_notify)
48          pylab.ion()          pylab.ion()
49          pylab.show(False)          if platform.system()=="Windows":
50                pylab.show()
51            else:
52                pylab.show(False)
53    
54      def on_sparsity_motion_notify(self, event):      def on_sparsity_motion_notify(self, event):
55          if event.xdata != None and event.ydata != None:          if event.xdata != None and event.ydata != None:
56              _col = int(event.xdata)              _col = int(event.xdata)
57              _row = (self.im.getNumRows()-1) - int(event.ydata)              _row = (self.im.getNumRows()-1) - int(event.ydata)
             if self.data[_row, _col] == 0:  
                 return  
58    
59              if self.lastrow != None and self.lastcol != None:              try:
60                  if self.lastrow == _row and self.lastcol == _col:                  if self.data[_row, _col] == 0:
61                      return                      return
62              _var = self.im.getVariable(_col);      
63              _rel = self.im.getRelation(_row);                  if self.lastrow != None and self.lastcol != None:
64              _blk = self.im.getBlockRow(_row);                      if self.lastrow == _row and self.lastcol == _col:
65                            return
66    
67                    _var = self.im.getVariable(_col);
68                    _rel = self.im.getRelation(_row);
69                    _blk = self.im.getBlockRow(_row);
70                except IndexError:
71                    return
72    
73              print "rel:",_rel,"  var:", _var,"  block:",_blk              print "rel:",_rel,"  var:", _var,"  block:",_blk
74              self.lastrow = _row;              self.lastrow = _row;
75              self.lastcol = _col;              self.lastcol = _col;

Legend:
Removed from v.254  
changed lines
  Added in v.463

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