37 from CustomTable import CustomTable |
37 from CustomTable import CustomTable |
38 from LocationCellEditor import LocationCellEditor |
38 from LocationCellEditor import LocationCellEditor |
39 from util.BitmapLibrary import GetBitmap |
39 from util.BitmapLibrary import GetBitmap |
40 from PLCControler import _VariableInfos |
40 from PLCControler import _VariableInfos |
41 from util.TranslationCatalogs import NoTranslate |
41 from util.TranslationCatalogs import NoTranslate |
42 #------------------------------------------------------------------------------- |
42 |
|
43 |
|
44 # ------------------------------------------------------------------------------- |
43 # Helpers |
45 # Helpers |
44 #------------------------------------------------------------------------------- |
46 # ------------------------------------------------------------------------------- |
|
47 |
45 |
48 |
46 [ |
49 [ |
47 TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU, PROJECTTREE, |
50 TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU, PROJECTTREE, |
48 POUINSTANCEVARIABLESPANEL, LIBRARYTREE, SCALING, PAGETITLES |
51 POUINSTANCEVARIABLESPANEL, LIBRARYTREE, SCALING, PAGETITLES |
49 ] = range(10) |
52 ] = range(10) |
101 } |
104 } |
102 |
105 |
103 LOCATION_MODEL = re.compile("((?:%[IQM](?:\*|(?:[XBWLD]?[0-9]+(?:\.[0-9]+)*)))?)$") |
106 LOCATION_MODEL = re.compile("((?:%[IQM](?:\*|(?:[XBWLD]?[0-9]+(?:\.[0-9]+)*)))?)$") |
104 VARIABLE_NAME_SUFFIX_MODEL = re.compile("([0-9]*)$") |
107 VARIABLE_NAME_SUFFIX_MODEL = re.compile("([0-9]*)$") |
105 |
108 |
106 #------------------------------------------------------------------------------- |
109 |
|
110 # ------------------------------------------------------------------------------- |
107 # Variables Panel Table |
111 # Variables Panel Table |
108 #------------------------------------------------------------------------------- |
112 # ------------------------------------------------------------------------------- |
109 |
113 |
110 |
114 |
111 class VariableTable(CustomTable): |
115 class VariableTable(CustomTable): |
112 |
116 |
113 """ |
117 """ |
239 highlight_colours = row_highlights.get(colname.lower(), [(wx.WHITE, wx.BLACK)])[-1] |
243 highlight_colours = row_highlights.get(colname.lower(), [(wx.WHITE, wx.BLACK)])[-1] |
240 grid.SetCellBackgroundColour(row, col, highlight_colours[0]) |
244 grid.SetCellBackgroundColour(row, col, highlight_colours[0]) |
241 grid.SetCellTextColour(row, col, highlight_colours[1]) |
245 grid.SetCellTextColour(row, col, highlight_colours[1]) |
242 self.ResizeRow(grid, row) |
246 self.ResizeRow(grid, row) |
243 |
247 |
244 #------------------------------------------------------------------------------- |
248 |
|
249 # ------------------------------------------------------------------------------- |
245 # Variable Panel Drop Target |
250 # Variable Panel Drop Target |
246 #------------------------------------------------------------------------------- |
251 # ------------------------------------------------------------------------------- |
247 |
252 |
248 |
253 |
249 class VariableDropTarget(wx.TextDropTarget): |
254 class VariableDropTarget(wx.TextDropTarget): |
250 ''' |
255 ''' |
251 This allows dragging a variable location from somewhere to the Location |
256 This allows dragging a variable location from somewhere to the Location |
425 def ShowMessage(self, message): |
430 def ShowMessage(self, message): |
426 message = wx.MessageDialog(self.ParentWindow, message, _("Error"), wx.OK | wx.ICON_ERROR) |
431 message = wx.MessageDialog(self.ParentWindow, message, _("Error"), wx.OK | wx.ICON_ERROR) |
427 message.ShowModal() |
432 message.ShowModal() |
428 message.Destroy() |
433 message.Destroy() |
429 |
434 |
430 #------------------------------------------------------------------------------- |
435 |
|
436 # ------------------------------------------------------------------------------- |
431 # Variable Panel |
437 # Variable Panel |
432 #------------------------------------------------------------------------------- |
438 # ------------------------------------------------------------------------------- |
433 |
439 |
434 |
440 |
435 class VariablePanel(wx.Panel): |
441 class VariablePanel(wx.Panel): |
436 |
442 |
437 def __init__(self, parent, window, controler, element_type, debug=False): |
443 def __init__(self, parent, window, controler, element_type, debug=False): |
978 self.Controler.SetPouInterfaceVars(words[1], self.Values) |
984 self.Controler.SetPouInterfaceVars(words[1], self.Values) |
979 if buffer: |
985 if buffer: |
980 self.Controler.BufferProject() |
986 self.Controler.BufferProject() |
981 self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, PAGETITLES, POUINSTANCEVARIABLESPANEL, LIBRARYTREE) |
987 self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, PAGETITLES, POUINSTANCEVARIABLESPANEL, LIBRARYTREE) |
982 |
988 |
983 #------------------------------------------------------------------------------- |
989 # ------------------------------------------------------------------------------- |
984 # Highlights showing functions |
990 # Highlights showing functions |
985 #------------------------------------------------------------------------------- |
991 # ------------------------------------------------------------------------------- |
986 |
992 |
987 def OnRefreshHighlightsTimer(self, event): |
993 def OnRefreshHighlightsTimer(self, event): |
988 self.Table.ResetView(self.VariablesGrid) |
994 self.Table.ResetView(self.VariablesGrid) |
989 event.Skip() |
995 event.Skip() |
990 |
996 |