controls/VariablePanel.py
changeset 684 f10449b18dbe
parent 681 c141dad94ff4
child 714 131ea7f237b9
equal deleted inserted replaced
683:37882f34f9cb 684:f10449b18dbe
    41         parent.Append(help=help, id=id, kind=kind, text=text)
    41         parent.Append(help=help, id=id, kind=kind, text=text)
    42     else:
    42     else:
    43         parent.Append(helpString=help, id=id, kind=kind, item=text)
    43         parent.Append(helpString=help, id=id, kind=kind, item=text)
    44 
    44 
    45 [TITLE, TOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU, TYPESTREE, 
    45 [TITLE, TOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU, TYPESTREE, 
    46  INSTANCESTREE, LIBRARYTREE, SCALING
    46  POUINSTANCEVARIABLESPANEL, LIBRARYTREE, SCALING
    47 ] = range(9)
    47 ] = range(9)
    48 
    48 
    49 #-------------------------------------------------------------------------------
    49 #-------------------------------------------------------------------------------
    50 #                            Variables Editor Panel
    50 #                            Variables Editor Panel
    51 #-------------------------------------------------------------------------------
    51 #-------------------------------------------------------------------------------
   642     def OnReturnTypeChanged(self, event):
   642     def OnReturnTypeChanged(self, event):
   643         words = self.TagName.split("::")
   643         words = self.TagName.split("::")
   644         self.Controler.SetPouInterfaceReturnType(words[1], self.ReturnType.GetStringSelection())
   644         self.Controler.SetPouInterfaceReturnType(words[1], self.ReturnType.GetStringSelection())
   645         self.Controler.BufferProject()
   645         self.Controler.BufferProject()
   646         self.ParentWindow.RefreshView(variablepanel = False)
   646         self.ParentWindow.RefreshView(variablepanel = False)
   647         self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, INSTANCESTREE, LIBRARYTREE)
   647         self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, POUINSTANCEVARIABLESPANEL, LIBRARYTREE)
   648         event.Skip()
   648         event.Skip()
   649     
   649     
   650     def OnDescriptionChanged(self, event):
   650     def OnDescriptionChanged(self, event):
   651         words = self.TagName.split("::")
   651         words = self.TagName.split("::")
   652         old_description = self.Controler.GetPouDescription(words[1])
   652         old_description = self.Controler.GetPouDescription(words[1])
   653         new_description = self.Description.GetValue()
   653         new_description = self.Description.GetValue()
   654         if new_description != old_description:
   654         if new_description != old_description:
   655             self.Controler.SetPouDescription(words[1], new_description)
   655             self.Controler.SetPouDescription(words[1], new_description)
   656             self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, INSTANCESTREE, LIBRARYTREE)
   656             self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, POUINSTANCEVARIABLESPANEL, LIBRARYTREE)
   657         event.Skip()
   657         event.Skip()
   658     
   658     
   659     def OnClassFilter(self, event):
   659     def OnClassFilter(self, event):
   660         self.Filter = self.FilterChoiceTransfer[VARIABLE_CHOICES_DICT[self.ClassFilter.GetStringSelection()]]
   660         self.Filter = self.FilterChoiceTransfer[VARIABLE_CHOICES_DICT[self.ClassFilter.GetStringSelection()]]
   661         self.RefreshTypeList()
   661         self.RefreshTypeList()
   693                 old_value = self.Table.GetOldValue()
   693                 old_value = self.Table.GetOldValue()
   694                 if old_value != "":
   694                 if old_value != "":
   695                     self.Controler.UpdateEditedElementUsedVariable(self.TagName, old_value, value)
   695                     self.Controler.UpdateEditedElementUsedVariable(self.TagName, old_value, value)
   696                 self.Controler.BufferProject()
   696                 self.Controler.BufferProject()
   697                 self.ParentWindow.RefreshView(variablepanel = False)
   697                 self.ParentWindow.RefreshView(variablepanel = False)
   698                 self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, INSTANCESTREE, LIBRARYTREE)
   698                 self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, POUINSTANCEVARIABLESPANEL, LIBRARYTREE)
   699                 event.Skip()
   699                 event.Skip()
   700         else:
   700         else:
   701             self.SaveValues()
   701             self.SaveValues()
   702             if colname == "Class":
   702             if colname == "Class":
   703                 self.ParentWindow.RefreshView(variablepanel = False)
   703                 self.ParentWindow.RefreshView(variablepanel = False)
   787             self.Table.SetValueByName(row, "Type", base_type)
   787             self.Table.SetValueByName(row, "Type", base_type)
   788             self.Table.ResetView(self.VariablesGrid)
   788             self.Table.ResetView(self.VariablesGrid)
   789             self.SaveValues(False)
   789             self.SaveValues(False)
   790             self.ParentWindow.RefreshView(variablepanel = False)
   790             self.ParentWindow.RefreshView(variablepanel = False)
   791             self.Controler.BufferProject()
   791             self.Controler.BufferProject()
   792             self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, INSTANCESTREE, LIBRARYTREE)
   792             self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, POUINSTANCEVARIABLESPANEL, LIBRARYTREE)
   793         return VariableTypeFunction
   793         return VariableTypeFunction
   794     
   794     
   795     def VariableArrayTypeFunction(self, event):
   795     def VariableArrayTypeFunction(self, event):
   796         row = self.VariablesGrid.GetGridCursorRow()
   796         row = self.VariablesGrid.GetGridCursorRow()
   797         dialog = ArrayTypeDialog(self, 
   797         dialog = ArrayTypeDialog(self, 
   801             self.Table.SetValueByName(row, "Type", dialog.GetValue())
   801             self.Table.SetValueByName(row, "Type", dialog.GetValue())
   802             self.Table.ResetView(self.VariablesGrid)
   802             self.Table.ResetView(self.VariablesGrid)
   803             self.SaveValues(False)
   803             self.SaveValues(False)
   804             self.ParentWindow.RefreshView(variablepanel = False)
   804             self.ParentWindow.RefreshView(variablepanel = False)
   805             self.Controler.BufferProject()
   805             self.Controler.BufferProject()
   806             self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, INSTANCESTREE, LIBRARYTREE)
   806             self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, POUINSTANCEVARIABLESPANEL, LIBRARYTREE)
   807         dialog.Destroy()
   807         dialog.Destroy()
   808     
   808     
   809     def OnVariablesGridCellLeftClick(self, event):
   809     def OnVariablesGridCellLeftClick(self, event):
   810         row = event.GetRow()
   810         row = event.GetRow()
   811         if not self.Debug and (event.GetCol() == 0 and self.Table.GetValueByName(row, "Edit")):
   811         if not self.Debug and (event.GetCol() == 0 and self.Table.GetValueByName(row, "Edit")):
   838             if self.ReturnType.IsEnabled():
   838             if self.ReturnType.IsEnabled():
   839                 self.Controler.SetPouInterfaceReturnType(words[1], self.ReturnType.GetStringSelection())
   839                 self.Controler.SetPouInterfaceReturnType(words[1], self.ReturnType.GetStringSelection())
   840             self.Controler.SetPouInterfaceVars(words[1], self.Values)
   840             self.Controler.SetPouInterfaceVars(words[1], self.Values)
   841         if buffer:
   841         if buffer:
   842             self.Controler.BufferProject()
   842             self.Controler.BufferProject()
   843             self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, INSTANCESTREE, LIBRARYTREE)            
   843             self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, POUINSTANCEVARIABLESPANEL, LIBRARYTREE)            
   844 
   844 
   845 #-------------------------------------------------------------------------------
   845 #-------------------------------------------------------------------------------
   846 #                        Highlights showing functions
   846 #                        Highlights showing functions
   847 #-------------------------------------------------------------------------------
   847 #-------------------------------------------------------------------------------
   848 
   848