/[thuban]/trunk/thuban/Thuban/UI/classifier.py
ViewVC logotype

Diff of /trunk/thuban/Thuban/UI/classifier.py

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

revision 570 by jonathan, Fri Mar 28 17:06:26 2003 UTC revision 576 by jonathan, Mon Mar 31 18:31:17 2003 UTC
# Line 79  class ClassGrid(wxGrid): Line 79  class ClassGrid(wxGrid):
79          EVT_GRID_RANGE_SELECT(self, self._OnSelectedRange)          EVT_GRID_RANGE_SELECT(self, self._OnSelectedRange)
80          EVT_GRID_SELECT_CELL(self, self._OnSelectedCell)          EVT_GRID_SELECT_CELL(self, self._OnSelectedCell)
81    
82          print "123123123: ", ('Show' in dir(self))          #print "123123123: ", ('Show' in dir(self))
83    
84      def Show(self):      #def Show(self):
85          print "SHOW!"          #print "SHOW!"
86    
87      def Refresh(self):      #def Refresh(self):
88          self.Show()          #self.Show()
89      def Update(self):      #def Update(self):
90          self.Show()          #self.Show()
91    
92      def CreateTable(self, clazz, shapeType, group = None):      def CreateTable(self, clazz, shapeType, group = None):
93    
# Line 107  class ClassGrid(wxGrid): Line 107  class ClassGrid(wxGrid):
107          self.SetSelectionMode(wxGrid.wxGridSelectRows)          self.SetSelectionMode(wxGrid.wxGridSelectRows)
108          self.ClearSelection()          self.ClearSelection()
109    
110          print "8------------------"          #print "8------------------"
111          table.Reset(clazz, self.shapeType, group)          table.Reset(clazz, self.shapeType, group)
112          print "9------------------"          #print "9------------------"
113    
114  #   def Show(self, show = True):  #   def Show(self, show = True):
115  #       print "SHOW!"  #       print "SHOW!"
# Line 125  class ClassGrid(wxGrid): Line 125  class ClassGrid(wxGrid):
125      def GetCurrentSelection(self):      def GetCurrentSelection(self):
126          """Return the currently highlighted rows as an increasing list          """Return the currently highlighted rows as an increasing list
127             of row numbers."""             of row numbers."""
128          print "@@ ", self.currentSelection          #print "@@ ", self.currentSelection
129          sel = copy.copy(self.currentSelection)          sel = copy.copy(self.currentSelection)
130          sel.sort()          sel.sort()
131          return sel          return sel
# Line 210  class ClassGrid(wxGrid): Line 210  class ClassGrid(wxGrid):
210          assert(table is not None)          assert(table is not None)
211    
212    
213          print "-- ", group          #print "-- ", group
214          for i in range(table.GetNumberRows()):          for i in range(table.GetNumberRows()):
215              g = table.GetClassGroup(i)              g = table.GetClassGroup(i)
216              print "1", g              #print "1", g
217              if g is group:              if g is group:
218                  print "2"                  #print "2"
219                  self.SelectRow(i)                  self.SelectRow(i)
220                  if makeVisible:                  if makeVisible:
221                      print "3"                      #print "3"
222                      self.MakeCellVisible(i, 0)                      self.MakeCellVisible(i, 0)
223                  break                  break
224    
# Line 263  class ClassGrid(wxGrid): Line 263  class ClassGrid(wxGrid):
263          if event.Selecting():          if event.Selecting():
264              for index in range( event.GetTopRow(), event.GetBottomRow()+1):              for index in range( event.GetTopRow(), event.GetBottomRow()+1):
265                  if index not in self.currentSelection:                  if index not in self.currentSelection:
266                      print "    ", index                      #print "    ", index
267                      self.currentSelection.append( index )                      self.currentSelection.append( index )
268          else:          else:
269              for index in range( event.GetTopRow(), event.GetBottomRow()+1):              for index in range( event.GetTopRow(), event.GetBottomRow()+1):
270                  while index in self.currentSelection:                  while index in self.currentSelection:
271                      print "    ", index                      #print "    ", index
272                      self.currentSelection.remove( index )                      self.currentSelection.remove( index )
273          #self.ConfigureForSelection()          #self.ConfigureForSelection()
274    
275          print self.GetCurrentSelection()          #print self.GetCurrentSelection()
276          event.Skip()          event.Skip()
277    
278      def _OnSelectedCell( self, event ):      def _OnSelectedCell( self, event ):
279          """Internal update to the selection tracking list"""          """Internal update to the selection tracking list"""
280          print "selecting cell: ", event.GetRow()          #print "selecting cell: ", event.GetRow()
281          self.currentSelection = [ event.GetRow() ]          self.currentSelection = [ event.GetRow() ]
282          #self.ConfigureForSelection()          #self.ConfigureForSelection()
283          event.Skip()          event.Skip()
# Line 331  class ClassTable(wxPyGridTableBase): Line 331  class ClassTable(wxPyGridTableBase):
331    
332          self.tdata = []          self.tdata = []
333    
334          print "9------------------"          #print "9------------------"
335          #          #
336          # copy the data out of the classification and into our          # copy the data out of the classification and into our
337          # array          # array
# Line 342  class ClassTable(wxPyGridTableBase): Line 342  class ClassTable(wxPyGridTableBase):
342              self.__SetRow(-1, ng)              self.__SetRow(-1, ng)
343              if g is group:              if g is group:
344                  row = self.GetNumberRows() - 1                  row = self.GetNumberRows() - 1
345                  print "selecting row..."                  #print "selecting row..."
346    
347          print "10------------------"          #print "10------------------"
348    
349          self.__Modified(-1)          self.__Modified(-1)
350    
351          self.__NotifyRowChanges(old_len, len(self.tdata))          self.__NotifyRowChanges(old_len, len(self.tdata))
352          print "11------------------"          #print "11------------------"
353    
354          if row > -1:          if row > -1:
355              self.GetView().ClearSelection()              self.GetView().ClearSelection()
# Line 763  class Classifier(NonModalDialog): Line 763  class Classifier(NonModalDialog):
763    
764          # calling __SelectField after creating the classGrid fills in the          # calling __SelectField after creating the classGrid fills in the
765          # grid with the correct information          # grid with the correct information
766          print "2------------------"          #print "2------------------"
767          self.__SelectField(self.__cur_field, group = group)          self.__SelectField(self.__cur_field, group = group)
768    
769          #self.classGrid.SelectGroup(group)          #self.classGrid.SelectGroup(group)
# Line 810  class Classifier(NonModalDialog): Line 810  class Classifier(NonModalDialog):
810          self.SetAutoLayout(True)          self.SetAutoLayout(True)
811          self.SetSizer(topBox)          self.SetSizer(topBox)
812    
813          print "1------------------"          #print "1------------------"
814          #self.Fit()          #self.Fit()
815          ######################          ######################
816    
# Line 856  class Classifier(NonModalDialog): Line 856  class Classifier(NonModalDialog):
856              fieldType = self.layer.GetFieldType(fieldName)              fieldType = self.layer.GetFieldType(fieldName)
857              clazz.SetFieldType(fieldType)              clazz.SetFieldType(fieldType)
858                                    
859          print "6------------------"          #print "6------------------"
860          self.classGrid.CreateTable(clazz, self.layer.ShapeType(), group)          self.classGrid.CreateTable(clazz, self.layer.ShapeType(), group)
861          print "7------------------"          #print "7------------------"
862    
863    
864    
# Line 879  class Classifier(NonModalDialog): Line 879  class Classifier(NonModalDialog):
879    
880      def __SelectField(self, newIndex, oldIndex = -1, group = None):      def __SelectField(self, newIndex, oldIndex = -1, group = None):
881    
882          print "3------------------"          #print "3------------------"
883    
884          assert(oldIndex >= -1)          assert(oldIndex >= -1)
885    
# Line 889  class Classifier(NonModalDialog): Line 889  class Classifier(NonModalDialog):
889              clazz = self.__BuildClassification(oldIndex)              clazz = self.__BuildClassification(oldIndex)
890              self.fields.SetClientData(oldIndex, clazz)              self.fields.SetClientData(oldIndex, clazz)
891    
892          print "4------------------"          #print "4------------------"
893          self.__SetGridTable(newIndex, group)          self.__SetGridTable(newIndex, group)
894          print "5------------------"          #print "5------------------"
895    
896          enabled = newIndex != 0          enabled = newIndex != 0
897    
# Line 947  class Classifier(NonModalDialog): Line 947  class Classifier(NonModalDialog):
947      def _OnMoveUp(self, event):      def _OnMoveUp(self, event):
948          sel = self.classGrid.GetCurrentSelection()          sel = self.classGrid.GetCurrentSelection()
949    
950          print "sel: ", sel          #print "sel: ", sel
951    
952          if len(sel) == 1:          if len(sel) == 1:
953              i = sel[0]              i = sel[0]
# Line 1187  class ClassDataPreviewer: Line 1187  class ClassDataPreviewer:
1187                             wxPoint(x + w/2, y + h/4*3),                             wxPoint(x + w/2, y + h/4*3),
1188                             wxPoint(x + w, y)])                             wxPoint(x + w, y)])
1189    
1190          elif shapeType == SHAPETYPE_POINT or \          elif shapeType == SHAPETYPE_POINT:
              shapeType == SHAPETYPE_POLYGON:  
1191    
1192              dc.DrawCircle(x + w/2, y + h/2,              dc.DrawCircle(x + w/2, y + h/2,
1193                            (min(w, h) - prop.GetLineWidth())/2)                            (min(w, h) - prop.GetLineWidth())/2)
1194    
1195            elif shapeType == SHAPETYPE_POLYGON:
1196                dc.DrawRectangle(x, y, w, h)
1197    
1198  class ClassRenderer(wxPyGridCellRenderer):  class ClassRenderer(wxPyGridCellRenderer):
1199    
1200      def __init__(self, shapeType):      def __init__(self, shapeType):

Legend:
Removed from v.570  
changed lines
  Added in v.576

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26