]> rtime.felk.cvut.cz Git - CanFestival-3.git/blobdiff - objdictgen/subindextable.py
fixed : deprecation warning with the module "sets" when using python 2.6
[CanFestival-3.git] / objdictgen / subindextable.py
index 2f25550e2dfe095bc83f4433203d39d240bf4266..3e0bac9426120dfe8dbcb0f74072042cd09439ae 100644 (file)
@@ -176,11 +176,9 @@ class SubindexTable(wx.grid.PyGridTableBase):
                         renderer = wx.grid.GridCellNumberRenderer()
                         if colname == "value" and "min" in editors and "max" in editors:
                             editor.SetParameters("%s,%s"%(editors["min"],editors["max"]))
-                    elif editortype == "real":
-                        editor = wx.grid.GridCellFloatEditor()
-                        renderer = wx.grid.GridCellFloatRenderer()
-                        if colname == "value" and "min" in editors and "max" in editors:
-                            editor.SetParameters("%s,%s"%(editors["min"],editors["max"]))
+                    elif editortype == "float":
+                        editor = wx.grid.GridCellTextEditor()
+                        renderer = wx.grid.GridCellStringRenderer()
                     elif editortype == "bool":
                         editor = wx.grid.GridCellChoiceEditor()
                         editor.SetParameters(BoolList)
@@ -451,7 +449,23 @@ class EditingPanel(wx.SplitterWindow):
     def OnSubindexGridCellLeftClick(self, event):
         if not self.ParentWindow.ModeSolo:
             col = event.GetCol()
-            if not self.Editable and col == 0:
+            if self.Editable and col == 0:
+                selected = self.IndexList.GetSelection()
+                if selected != wx.NOT_FOUND:
+                    index = self.ListIndex[selected]
+                    subindex = event.GetRow()
+                    entry_infos = self.Manager.GetEntryInfos(index)
+                    if not entry_infos["struct"] & OD_MultipleSubindexes or subindex != 0:
+                        subentry_infos = self.Manager.GetSubentryInfos(index, subindex)
+                        typeinfos = self.Manager.GetEntryInfos(subentry_infos["type"])
+                        if typeinfos:
+                            bus_id = '.'.join(map(str, self.ParentWindow.GetBusId()))
+                            size = typeinfos["size"]
+                            data = wx.TextDataObject(str(("%s%s.%d.%d"%(SizeConversion[size], bus_id, index, subindex), "location")))
+                            dragSource = wx.DropSource(self.SubindexGrid)
+                            dragSource.SetData(data)
+                            dragSource.DoDragDrop()
+            elif col == 0:
                 selected = self.IndexList.GetSelection()
                 if selected != wx.NOT_FOUND:
                     index = self.ListIndex[selected]
@@ -497,17 +511,20 @@ class EditingPanel(wx.SplitterWindow):
         event.Skip()
 
     def OnPartListBoxClick(self, event):
-        self.SubindexGrid.SetGridCursor(0, 0)
-        self.RefreshIndexList()
+        if not self.ParentWindow.IsClosing():
+            self.SubindexGrid.SetGridCursor(0, 0)
+            self.RefreshIndexList()
         event.Skip()
 
     def OnIndexListClick(self, event):
-        self.SubindexGrid.SetGridCursor(0, 0)
-        self.RefreshTable()
+        if not self.ParentWindow.IsClosing():
+            self.SubindexGrid.SetGridCursor(0, 0)
+            self.RefreshTable()
         event.Skip()
 
     def OnSubindexGridSelectCell(self, event):
-        wx.CallAfter(self.ParentWindow.RefreshStatusBar)
+        if not self.ParentWindow.IsClosing():
+            wx.CallAfter(self.ParentWindow.RefreshStatusBar)
         event.Skip()
 
 #-------------------------------------------------------------------------------
@@ -715,9 +732,9 @@ class EditingPanel(wx.SplitterWindow):
                         node_id = self.ParentWindow.GetCurrentNodeId()
                         value = self.Table.GetValueByName(subindex, "value")
                         if value == "True":
-                            value = 0
-                        elif value == "False":
                             value = 1
+                        elif value == "False":
+                            value = 0
                         elif value.isdigit():
                             value = int(value)
                         elif value.startswith("0x"):