]> 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 9da33490273d782c2a6fe96a8efd7558f374f88f..3e0bac9426120dfe8dbcb0f74072042cd09439ae 100644 (file)
@@ -449,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]
@@ -495,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()
 
 #-------------------------------------------------------------------------------