PLCOpenEditor.py
changeset 97 28337cd092fd
parent 95 ee66a9a1748b
child 98 ec5d7af033d8
equal deleted inserted replaced
96:d178cfa9e77f 97:28337cd092fd
   792         selected = event.GetSelection()
   792         selected = event.GetSelection()
   793         if selected >= 0:
   793         if selected >= 0:
   794             self.Controler.RefreshCurrentElementEditing(selected)
   794             self.Controler.RefreshCurrentElementEditing(selected)
   795             found = False
   795             found = False
   796             name = self.TabsOpened.GetPageText(selected)
   796             name = self.TabsOpened.GetPageText(selected)
   797             root = self.ProjectTree.GetRootItem()
   797             if self.ProjectTree:
   798             item, root_cookie = self.ProjectTree.GetFirstChild(root)
   798                 root = self.ProjectTree.GetRootItem()
   799             while item.IsOk() and not found:
   799                 item, root_cookie = self.ProjectTree.GetFirstChild(root)
   800                 if self.ProjectTree.GetItemText(item) == name:
   800                 while item.IsOk() and not found:
   801                     self.ProjectTree.SelectItem(item)
   801                     if self.ProjectTree.GetItemText(item) == name:
   802                 item, root_cookie = self.ProjectTree.GetNextChild(root, root_cookie)
   802                         self.ProjectTree.SelectItem(item)
       
   803                     item, root_cookie = self.ProjectTree.GetNextChild(root, root_cookie)
   803             self.TabsOpened.GetPage(selected).RefreshView()
   804             self.TabsOpened.GetPage(selected).RefreshView()
   804             self.RefreshFileMenu()
   805             self.RefreshFileMenu()
   805             self.RefreshEditMenu()
   806             self.RefreshEditMenu()
   806             self.RefreshToolBar()
   807             self.RefreshToolBar()
   807         event.Skip()
   808         event.Skip()
  2196         wx.TextDropTarget.__init__(self)
  2197         wx.TextDropTarget.__init__(self)
  2197         self.ParentWindow = parent
  2198         self.ParentWindow = parent
  2198     
  2199     
  2199     def OnDropText(self, x, y, data):
  2200     def OnDropText(self, x, y, data):
  2200         col = self.ParentWindow.VariablesGrid.XToCol(x)
  2201         col = self.ParentWindow.VariablesGrid.XToCol(x)
  2201         row = self.ParentWindow.VariablesGrid.YToRow(y)
  2202         row = self.ParentWindow.VariablesGrid.YToRow(y - self.ParentWindow.VariablesGrid.GetColLabelSize())
  2202         if col != wx.NOT_FOUND and row != wx.NOT_FOUND:
  2203         if col != wx.NOT_FOUND and row != wx.NOT_FOUND:
  2203             if self.ParentWindow.Table.GetColLabelValue(col) != "Location":
  2204             if self.ParentWindow.Table.GetColLabelValue(col) != "Location":
  2204                 return
  2205                 return
  2205             try:
  2206             try:
  2206                 values = eval(data)    
  2207                 values = eval(data)    
  2214                         location = "%I" + values[0]
  2215                         location = "%I" + values[0]
  2215                     elif selected == 1:
  2216                     elif selected == 1:
  2216                         location = "%Q" + values[0]
  2217                         location = "%Q" + values[0]
  2217                     else:
  2218                     else:
  2218                         location = "%M" + values[0]
  2219                         location = "%M" + values[0]
  2219                     self.ParentWindow.Table.SetValue(row - 1, col, location)
  2220                     self.ParentWindow.Table.SetValue(row, col, location)
  2220                     self.ParentWindow.Table.ResetView(self.ParentWindow.VariablesGrid)
  2221                     self.ParentWindow.Table.ResetView(self.ParentWindow.VariablesGrid)
  2221                     self.ParentWindow.SaveValues()
  2222                     self.ParentWindow.SaveValues()
  2222                 dialog.Destroy()    
  2223                 dialog.Destroy()    
  2223 
  2224 
  2224 [ID_POUEDITORPANEL, ID_POUEDITORPANELVIEWER, 
  2225 [ID_POUEDITORPANEL, ID_POUEDITORPANELVIEWER,