Bug on Copy, Cut, Paste fixed
authorlbessard
Fri, 20 Jul 2007 23:04:50 +0200
changeset 51 47c72c77590a
parent 50 4610aafc884e
child 52 35b54852c533
Bug on Copy, Cut, Paste fixed
PLCOpenEditor.py
--- a/PLCOpenEditor.py	Fri Jul 20 22:24:39 2007 +0200
+++ b/PLCOpenEditor.py	Fri Jul 20 23:04:50 2007 +0200
@@ -1202,19 +1202,28 @@
     def OnCutMenu(self, event):
         selected = self.TabsOpened.GetSelection()
         if selected != -1:
-            self.TabsOpened.GetPage(selected).Cut()
+            try:
+                self.TabsOpened.GetPage(selected).Viewer.Cut()
+            except:
+                pass
         event.Skip()
     
     def OnCopyMenu(self, event):
         selected = self.TabsOpened.GetSelection()
         if selected != -1:
-            self.TabsOpened.GetPage(selected).Copy()
+            try:
+                self.TabsOpened.GetPage(selected).Viewer.Copy()
+            except:
+                pass
         event.Skip()
     
     def OnPasteMenu(self, event):
         selected = self.TabsOpened.GetSelection()
         if selected != -1:
-            self.TabsOpened.GetPage(selected).Paste()
+            try:
+                self.TabsOpened.GetPage(selected).Viewer.Paste()
+            except:
+                pass
         event.Skip()
     
     def OnAddPouMenu(self, event):
@@ -1900,7 +1909,7 @@
     def GetValue(self, row, col):
         if row < self.GetNumberRows():
             if col == 0:
-                return self.Parent.Values.index(self.data[row]) + 1
+                return "d"
             name = str(self.data[row].get(self.GetColLabelValue(col), ""))
             return name
     
@@ -1967,7 +1976,7 @@
                 renderer = None
                 colname = self.GetColLabelValue(col)
                 grid.SetReadOnly(row, col, False)
-                if col == 0:
+                if colname == "Drag":
                     grid.SetReadOnly(row, col, True)
                 elif colname == "Name":
                     if self.Parent.PouIsUsed and self.GetValueByName(row, "Class") in ["Input", "Output", "InOut"]:
@@ -2077,18 +2086,18 @@
         # generated method, don't edit
 
         parent.AddWindow(self.staticText1, 0, border=0, flag=wxALIGN_BOTTOM)
+        parent.AddWindow(self.staticText2, 0, border=0, flag=wxALIGN_BOTTOM)
         parent.AddWindow(self.ReturnType, 0, border=0, flag=0)
-        parent.AddWindow(self.staticText2, 0, border=0, flag=wxALIGN_BOTTOM)
         parent.AddWindow(self.ClassFilter, 0, border=0, flag=0)
 
     def _init_coll_ButtonPanelSizer_Items(self, parent):
         # generated method, don't edit
 
+        parent.AddWindow(self.AddButton, 0, border=0, flag=0)
+        parent.AddWindow(self.DeleteButton, 0, border=0, flag=0)
         parent.AddWindow(self.UpButton, 0, border=0, flag=0)
-        parent.AddWindow(self.AddButton, 0, border=0, flag=0)
         parent.AddWindow(self.DownButton, 0, border=0, flag=0)
-        parent.AddWindow(self.DeleteButton, 0, border=0, flag=0)
-        
+
     def _init_coll_ButtonPanelSizer_Growables(self, parent):
         # generated method, don't edit
 
@@ -2104,11 +2113,11 @@
         
         self.VariablePanelSizer = wx.FlexGridSizer(cols=2, hgap=10, rows=1, vgap=0)
         
-        self.ControlPanelSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
-        
-        self.ChoicePanelSizer = wx.GridSizer(cols=1, hgap=5, rows=4, vgap=5)
-        
-        self.ButtonPanelSizer = wx.FlexGridSizer(cols=2, hgap=5, rows=2, vgap=0)
+        self.ControlPanelSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
+        
+        self.ChoicePanelSizer = wx.GridSizer(cols=2, hgap=5, rows=2, vgap=5)
+        
+        self.ButtonPanelSizer = wx.FlexGridSizer(cols=4, hgap=5, rows=1, vgap=0)
         
         self._init_coll_MainPanelSizer_Items(self.MainPanelSizer)
         self._init_coll_MainPanelSizer_Growables(self.MainPanelSizer)
@@ -2154,7 +2163,7 @@
 
         self.ReturnType = wx.Choice(id=wxID_POUEDITORPANELRETURNTYPE,
               name='ReturnType', parent=self, pos=wx.Point(0, 0),
-              size=wx.Size(145, 24), style=0)
+              size=wx.Size(95, 24), style=0)
 
         self.staticText2 = wx.StaticText(id=wxID_POUEDITORPANELSTATICTEXT2,
               label='Class Filter:', name='staticText2', parent=self,
@@ -2162,12 +2171,12 @@
 
         self.ClassFilter = wx.Choice(id=wxID_POUEDITORPANELCLASSFILTER,
               name='ClassFilter', parent=self, pos=wx.Point(0, 0),
-              size=wx.Size(145, 24), style=0)
+              size=wx.Size(95, 24), style=0)
         EVT_CHOICE(self, wxID_POUEDITORPANELCLASSFILTER, self.OnClassFilter)
 
         self.VariablesGrid = wx.grid.Grid(id=wxID_POUEDITORPANELVARIABLESGRID,
               name='VariablesGrid', parent=self, pos=wx.Point(0, 0), 
-              size=wx.Size(0, 150), style=wxVSCROLL)
+              size=wx.Size(-1, 150), style=wxVSCROLL|wxHSCROLL)
         self.VariablesGrid.SetFont(wx.Font(12, 77, wx.NORMAL, wx.NORMAL, False,
               'Sans'))
         self.VariablesGrid.SetLabelFont(wx.Font(10, 77, wx.NORMAL, wx.NORMAL,
@@ -2237,7 +2246,7 @@
             self.DefaultTypes = {"All" : "Local", "Interface" : "Input", "Variables" : "Local"}
             self.DefaultValue = {"Name" : "", "Class" : "", "Type" : "INT", "Location" : "", "Initial Value" : "", "Retain" : "No", "Constant" : "No"}
         if pou_type in ["config", "resource"] or pou_type == "program":
-            self.Table = VariableTable(self, [], ["#", "Name", "Class", "Type", "Location", "Initial Value", "Retain", "Constant"])
+            self.Table = VariableTable(self, [], ["Drag", "Name", "Class", "Type", "Location", "Initial Value", "Retain", "Constant"])
             if pou_type not in ["config", "resource"]:
                 self.FilterChoices = ["All","Interface","   Input","   Output","   InOut","   External","Variables","   Local","   Temp","Global","Access"]
             else:
@@ -2245,7 +2254,7 @@
             self.ColSizes = [40, 80, 70, 80, 80, 80, 60, 70]
             self.ColAlignements = [wxALIGN_CENTER, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_CENTER, wxALIGN_CENTER]
         else:
-            self.Table = VariableTable(self, [], ["#", "Name", "Class", "Type", "Initial Value", "Retain", "Constant"])
+            self.Table = VariableTable(self, [], ["Drag", "Name", "Class", "Type", "Initial Value", "Retain", "Constant"])
             self.FilterChoices = ["All","Interface","   Input","   Output","   InOut","   External","Variables","   Local","   Temp"]
             self.ColSizes = [40, 120, 70, 80, 120, 60, 70]
             self.ColAlignements = [wxALIGN_CENTER, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_CENTER, wxALIGN_CENTER]