editors/ResourceEditor.py
changeset 1782 5b6ad7a7fd9d
parent 1773 38fde37c3766
child 1834 cd42b426028b
equal deleted inserted replaced
1781:b112bfdde5cc 1782:5b6ad7a7fd9d
    31 from dialogs.DurationEditorDialog import IEC_TIME_MODEL
    31 from dialogs.DurationEditorDialog import IEC_TIME_MODEL
    32 from EditorPanel import EditorPanel
    32 from EditorPanel import EditorPanel
    33 from util.BitmapLibrary import GetBitmap
    33 from util.BitmapLibrary import GetBitmap
    34 from plcopen.structures import LOCATIONDATATYPES, TestIdentifier, IEC_KEYWORDS, DefaultType
    34 from plcopen.structures import LOCATIONDATATYPES, TestIdentifier, IEC_KEYWORDS, DefaultType
    35 from util.TranslationCatalogs import NoTranslate
    35 from util.TranslationCatalogs import NoTranslate
    36 #-------------------------------------------------------------------------------
    36 
       
    37 
       
    38 # -------------------------------------------------------------------------------
    37 #                          Configuration Editor class
    39 #                          Configuration Editor class
    38 #-------------------------------------------------------------------------------
    40 # -------------------------------------------------------------------------------
       
    41 
    39 
    42 
    40 [
    43 [
    41     ID_CONFIGURATIONEDITOR,
    44     ID_CONFIGURATIONEDITOR,
    42 ] = [wx.NewId() for _init_ctrls in range(1)]
    45 ] = [wx.NewId() for _init_ctrls in range(1)]
    43 
    46 
    60 
    63 
    61     def HasNoModel(self):
    64     def HasNoModel(self):
    62         return self.Controler.GetEditedElement(self.TagName) is None
    65         return self.Controler.GetEditedElement(self.TagName) is None
    63 
    66 
    64 
    67 
    65 #-------------------------------------------------------------------------------
    68 # -------------------------------------------------------------------------------
    66 #                            Resource Editor class
    69 #                            Resource Editor class
    67 #-------------------------------------------------------------------------------
    70 # -------------------------------------------------------------------------------
    68 
    71 
    69 def GetTasksTableColnames():
    72 def GetTasksTableColnames():
    70     _ = NoTranslate
    73     _ = NoTranslate
    71     return [_("Name"), _("Triggering"), _("Single"), _("Interval"), _("Priority")]
    74     return [_("Name"), _("Triggering"), _("Single"), _("Interval"), _("Priority")]
    72 
    75 
   193                     highlight_colours = row_highlights.get(colname.lower(), [(wx.WHITE, wx.BLACK)])[-1]
   196                     highlight_colours = row_highlights.get(colname.lower(), [(wx.WHITE, wx.BLACK)])[-1]
   194                 grid.SetCellBackgroundColour(row, col, highlight_colours[0])
   197                 grid.SetCellBackgroundColour(row, col, highlight_colours[0])
   195                 grid.SetCellTextColour(row, col, highlight_colours[1])
   198                 grid.SetCellTextColour(row, col, highlight_colours[1])
   196             self.ResizeRow(grid, row)
   199             self.ResizeRow(grid, row)
   197 
   200 
   198 
   201     # -------------------------------------------------------------------------------
   199 #-------------------------------------------------------------------------------
   202     #                        Highlights showing functions
   200 #                        Highlights showing functions
   203     # -------------------------------------------------------------------------------
   201 #-------------------------------------------------------------------------------
       
   202 
   204 
   203     def AddHighlight(self, infos, highlight_type):
   205     def AddHighlight(self, infos, highlight_type):
   204         row_highlights = self.Highlights.setdefault(infos[0], {})
   206         row_highlights = self.Highlights.setdefault(infos[0], {})
   205         col_highlights = row_highlights.setdefault(infos[1], [])
   207         col_highlights = row_highlights.setdefault(infos[1], [])
   206         col_highlights.append(highlight_type)
   208         col_highlights.append(highlight_type)
   505         self.RefreshModel()
   507         self.RefreshModel()
   506         self.ParentWindow.RefreshPouInstanceVariablesPanel()
   508         self.ParentWindow.RefreshPouInstanceVariablesPanel()
   507         self.InstancesGrid.RefreshButtons()
   509         self.InstancesGrid.RefreshButtons()
   508         event.Skip()
   510         event.Skip()
   509 
   511 
   510 #-------------------------------------------------------------------------------
   512     # -------------------------------------------------------------------------------
   511 #                        Highlights showing functions
   513     #                        Highlights showing functions
   512 #-------------------------------------------------------------------------------
   514     # -------------------------------------------------------------------------------
   513 
   515 
   514     def OnRefreshHighlightsTimer(self, event):
   516     def OnRefreshHighlightsTimer(self, event):
   515         self.RefreshView()
   517         self.RefreshView()
   516         event.Skip()
   518         event.Skip()
   517 
   519