--- a/BeremizIDE.py Sun Feb 19 11:14:14 2023 +0800
+++ b/BeremizIDE.py Mon Feb 20 08:56:25 2023 +0800
@@ -990,14 +990,14 @@
def OnProjectTreeItemBeginEdit(self, event):
selected = event.GetItem()
- if self.ProjectTree.GetPyData(selected)["type"] == ITEM_CONFNODE:
+ if self.ProjectTree.GetItemData(selected)["type"] == ITEM_CONFNODE:
event.Veto()
else:
IDEFrame.OnProjectTreeItemBeginEdit(self, event)
def OnProjectTreeRightUp(self, event):
item = event.GetItem()
- item_infos = self.ProjectTree.GetPyData(item)
+ item_infos = self.ProjectTree.GetItemData(item)
if item_infos["type"] == ITEM_CONFNODE:
confnode_menu = wx.Menu(title='')
@@ -1033,7 +1033,7 @@
def OnProjectTreeItemActivated(self, event):
selected = event.GetItem()
- item_infos = self.ProjectTree.GetPyData(selected)
+ item_infos = self.ProjectTree.GetItemData(selected)
if item_infos["type"] == ITEM_CONFNODE:
item_infos["confnode"]._OpenView()
event.Skip()
@@ -1044,7 +1044,7 @@
def ProjectTreeItemSelect(self, select_item):
if select_item is not None and select_item.IsOk():
- item_infos = self.ProjectTree.GetPyData(select_item)
+ item_infos = self.ProjectTree.GetItemData(select_item)
if item_infos["type"] == ITEM_CONFNODE:
item_infos["confnode"]._OpenView(onlyopened=True)
elif item_infos["type"] == ITEM_PROJECT:
--- a/IDEFrame.py Sun Feb 19 11:14:14 2023 +0800
+++ b/IDEFrame.py Mon Feb 20 08:56:25 2023 +0800
@@ -137,7 +137,7 @@
name = self.ProjectTree.GetItemText(selected)
if check_function is None or check_function(name):
if parent_type is not None:
- item_infos = self.ProjectTree.GetPyData(selected)
+ item_infos = self.ProjectTree.GetItemData(selected)
parent_name = item_infos["tagname"].split("::")[1]
remove_function(self.Controler, parent_name, name)
else:
@@ -1293,7 +1293,7 @@
if window == self.ProjectTree or window is None:
selected = self.ProjectTree.GetSelection()
if selected is not None and selected.IsOk():
- function = self.DeleteFunctions.get(self.ProjectTree.GetPyData(selected)["type"], None)
+ function = self.DeleteFunctions.get(self.ProjectTree.GetItemData(selected)["type"], None)
if function is not None:
function(self, selected)
self.CloseTabsWithoutModel()
@@ -1523,7 +1523,7 @@
# Extract current selected item tagname
selected = self.ProjectTree.GetSelection()
if selected is not None and selected.IsOk():
- item_infos = self.ProjectTree.GetPyData(selected)
+ item_infos = self.ProjectTree.GetItemData(selected)
tagname = item_infos.get("tagname", None)
else:
tagname = None
@@ -1603,7 +1603,7 @@
found = False
item, root_cookie = self.ProjectTree.GetFirstChild(root)
while item is not None and item.IsOk() and not found:
- item_infos = self.ProjectTree.GetPyData(item)
+ item_infos = self.ProjectTree.GetItemData(item)
if (item_infos["name"].split(":")[-1].strip(), item_infos["type"]) == items[0]:
if len(items) == 1:
self.SelectedItem = item
@@ -1624,7 +1624,7 @@
selected_item = (self.SelectedItem
if self.SelectedItem is not None
else event.GetItem())
- if selected_item.IsOk() and self.ProjectTree.GetPyData(selected_item)["type"] == ITEM_POU:
+ if selected_item.IsOk() and self.ProjectTree.GetItemData(selected_item)["type"] == ITEM_POU:
block_name = self.ProjectTree.GetItemText(selected_item)
block_type = self.Controler.GetPouType(block_name)
if block_type != "program":
@@ -1636,7 +1636,7 @@
def OnProjectTreeItemBeginEdit(self, event):
selected = event.GetItem()
- if self.ProjectTree.GetPyData(selected)["type"] in ITEMS_UNEDITABLE:
+ if self.ProjectTree.GetItemData(selected)["type"] in ITEMS_UNEDITABLE:
event.Veto()
else:
event.Skip()
@@ -1653,7 +1653,7 @@
else:
item = event.GetItem()
old_name = self.ProjectTree.GetItemText(item)
- item_infos = self.ProjectTree.GetPyData(item)
+ item_infos = self.ProjectTree.GetItemData(item)
if item_infos["type"] == ITEM_PROJECT:
self.Controler.SetProjectProperties(name=new_name)
elif item_infos["type"] == ITEM_DATATYPE:
@@ -1757,7 +1757,7 @@
def OnProjectTreeItemActivated(self, event):
selected = event.GetItem()
- item_infos = self.ProjectTree.GetPyData(selected)
+ item_infos = self.ProjectTree.GetItemData(selected)
if item_infos["type"] == ITEM_PROJECT:
self.EditProjectSettings()
else:
@@ -1769,7 +1769,7 @@
def ProjectTreeItemSelect(self, select_item):
if select_item is not None and select_item.IsOk():
- item_infos = self.ProjectTree.GetPyData(select_item)
+ item_infos = self.ProjectTree.GetItemData(select_item)
if item_infos["type"] in [ITEM_DATATYPE, ITEM_POU,
ITEM_CONFIGURATION, ITEM_RESOURCE,
ITEM_TRANSITION, ITEM_ACTION]:
@@ -1788,7 +1788,7 @@
pt = wx.Point(event.GetX(), event.GetY())
item, flags = self.ProjectTree.HitTest(pt)
if item is not None and item.IsOk() and flags & wx.TREE_HITTEST_ONITEMLABEL:
- item_infos = self.ProjectTree.GetPyData(item)
+ item_infos = self.ProjectTree.GetItemData(item)
if item != self.LastToolTipItem and self.LastToolTipItem is not None:
self.ProjectTree.SetToolTip(None)
self.LastToolTipItem = None
@@ -1816,7 +1816,7 @@
event.Skip()
def OnProjectTreeItemChanging(self, event):
- if self.ProjectTree.GetPyData(event.GetItem())["type"] not in ITEMS_UNEDITABLE and self.SelectedItem is None:
+ if self.ProjectTree.GetItemData(event.GetItem())["type"] not in ITEMS_UNEDITABLE and self.SelectedItem is None:
self.SelectedItem = event.GetItem()
event.Veto()
else:
@@ -1898,7 +1898,7 @@
self.ProjectTree.SelectItem(item)
self.ProjectTreeItemSelect(item)
name = self.ProjectTree.GetItemText(item)
- item_infos = self.ProjectTree.GetPyData(item)
+ item_infos = self.ProjectTree.GetItemData(item)
menu = None
if item_infos["type"] in ITEMS_UNEDITABLE + [ITEM_PROJECT]:
@@ -1933,30 +1933,30 @@
menu = wx.Menu(title='')
new_item = AppendMenu(menu, help='', kind=wx.ITEM_NORMAL, text=_("Add Transition"))
parent = self.ProjectTree.GetItemParent(item)
- parent_type = self.ProjectTree.GetPyData(parent)["type"]
+ parent_type = self.ProjectTree.GetItemData(parent)["type"]
while parent_type != ITEM_POU:
parent = self.ProjectTree.GetItemParent(parent)
- parent_type = self.ProjectTree.GetPyData(parent)["type"]
+ parent_type = self.ProjectTree.GetItemData(parent)["type"]
self.Bind(wx.EVT_MENU, self.GenerateAddTransitionFunction(self.ProjectTree.GetItemText(parent)), new_item)
elif name == "Actions":
menu = wx.Menu(title='')
new_item = AppendMenu(menu, help='', kind=wx.ITEM_NORMAL, text=_("Add Action"))
parent = self.ProjectTree.GetItemParent(item)
- parent_type = self.ProjectTree.GetPyData(parent)["type"]
+ parent_type = self.ProjectTree.GetItemData(parent)["type"]
while parent_type != ITEM_POU:
parent = self.ProjectTree.GetItemParent(parent)
- parent_type = self.ProjectTree.GetPyData(parent)["type"]
+ parent_type = self.ProjectTree.GetItemData(parent)["type"]
self.Bind(wx.EVT_MENU, self.GenerateAddActionFunction(self.ProjectTree.GetItemText(parent)), new_item)
elif name == "Resources":
menu = wx.Menu(title='')
new_item = AppendMenu(menu, help='', kind=wx.ITEM_NORMAL, text=_("Add Resource"))
parent = self.ProjectTree.GetItemParent(item)
- parent_type = self.ProjectTree.GetPyData(parent)["type"]
+ parent_type = self.ProjectTree.GetItemData(parent)["type"]
while parent_type not in [ITEM_CONFIGURATION, ITEM_PROJECT]:
parent = self.ProjectTree.GetItemParent(parent)
- parent_type = self.ProjectTree.GetPyData(parent)["type"]
+ parent_type = self.ProjectTree.GetItemData(parent)["type"]
parent_name = None
if parent_type == ITEM_PROJECT:
config_names = self.Controler.GetProjectConfigNames()
@@ -2401,7 +2401,7 @@
def GenerateChangePouTypeFunction(self, name, new_type):
def OnChangePouTypeMenu(event):
selected = self.ProjectTree.GetSelection()
- if self.ProjectTree.GetPyData(selected)["type"] == ITEM_POU:
+ if self.ProjectTree.GetItemData(selected)["type"] == ITEM_POU:
self.Controler.ProjectChangePouType(name, new_type)
self._Refresh(TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU, PROJECTTREE, LIBRARYTREE)
return OnChangePouTypeMenu
@@ -2418,7 +2418,7 @@
def OnPastePou(self, event):
selected = self.ProjectTree.GetSelection()
- if self.ProjectTree.GetPyData(selected)["type"] != ITEM_PROJECT:
+ if self.ProjectTree.GetItemData(selected)["type"] != ITEM_PROJECT:
pou_type = self.ProjectTree.GetItemText(selected)
pou_type = self.UNEDITABLE_NAMES_DICT[pou_type] # one of 'Functions', 'Function Blocks' or 'Programs'
pou_type = {'Functions': 'function', 'Function Blocks': 'functionBlock', 'Programs': 'program'}[pou_type]
@@ -2463,7 +2463,7 @@
def OnRemoveDataTypeMenu(self, event):
selected = self.ProjectTree.GetSelection()
- if self.ProjectTree.GetPyData(selected)["type"] == ITEM_DATATYPE:
+ if self.ProjectTree.GetItemData(selected)["type"] == ITEM_DATATYPE:
name = self.ProjectTree.GetItemText(selected)
if self.CheckDataTypeIsUsedBeforeDeletion(name):
self.Controler.ProjectRemoveDataType(name)
@@ -2475,12 +2475,12 @@
def OnRenamePouMenu(self, event):
selected = self.ProjectTree.GetSelection()
- if self.ProjectTree.GetPyData(selected)["type"] == ITEM_POU:
+ if self.ProjectTree.GetItemData(selected)["type"] == ITEM_POU:
wx.CallAfter(self.ProjectTree.EditLabel, selected)
def OnRemovePouMenu(self, event):
selected = self.ProjectTree.GetSelection()
- if self.ProjectTree.GetPyData(selected)["type"] == ITEM_POU:
+ if self.ProjectTree.GetItemData(selected)["type"] == ITEM_POU:
name = self.ProjectTree.GetItemText(selected)
if self.CheckPouIsUsedBeforeDeletion(name):
self.Controler.ProjectRemovePou(name)
@@ -2492,7 +2492,7 @@
def OnRemoveTransitionMenu(self, event):
selected = self.ProjectTree.GetSelection()
- item_infos = self.ProjectTree.GetPyData(selected)
+ item_infos = self.ProjectTree.GetItemData(selected)
if item_infos["type"] == ITEM_TRANSITION:
transition = self.ProjectTree.GetItemText(selected)
pou_name = item_infos["tagname"].split("::")[1]
@@ -2505,7 +2505,7 @@
def OnRemoveActionMenu(self, event):
selected = self.ProjectTree.GetSelection()
- item_infos = self.ProjectTree.GetPyData(selected)
+ item_infos = self.ProjectTree.GetItemData(selected)
if item_infos["type"] == ITEM_ACTION:
action = self.ProjectTree.GetItemText(selected)
pou_name = item_infos["tagname"].split("::")[1]
@@ -2518,7 +2518,7 @@
def OnRemoveConfigurationMenu(self, event):
selected = self.ProjectTree.GetSelection()
- if self.ProjectTree.GetPyData(selected)["type"] == ITEM_CONFIGURATION:
+ if self.ProjectTree.GetItemData(selected)["type"] == ITEM_CONFIGURATION:
name = self.ProjectTree.GetItemText(selected)
self.Controler.ProjectRemoveConfiguration(name)
tagname = ComputeConfigurationName(name)
@@ -2529,7 +2529,7 @@
def OnRemoveResourceMenu(self, event):
selected = self.ProjectTree.GetSelection()
- item_infos = self.ProjectTree.GetPyData(selected)
+ item_infos = self.ProjectTree.GetItemData(selected)
if item_infos["type"] == ITEM_RESOURCE:
resource = self.ProjectTree.GetItemText(selected)
config_name = item_infos["tagname"].split("::")[1]
--- a/controls/LibraryPanel.py Sun Feb 19 11:14:14 2023 +0800
+++ b/controls/LibraryPanel.py Mon Feb 20 08:56:25 2023 +0800
@@ -166,7 +166,7 @@
# Get current selected item for selected it when values refreshed
selected_item = self.Tree.GetSelection()
- selected_pydata = (self.Tree.GetPyData(selected_item)
+ selected_pydata = (self.Tree.GetItemData(selected_item)
if (selected_item.IsOk() and
selected_item != self.Tree.GetRootItem())
else None)
@@ -291,7 +291,7 @@
"""
# Get selected item associated data in tree
selected_item = self.Tree.GetSelection()
- selected_pydata = (self.Tree.GetPyData(selected_item)
+ selected_pydata = (self.Tree.GetItemData(selected_item)
if (selected_item.IsOk() and
selected_item != self.Tree.GetRootItem())
else None)
@@ -329,7 +329,7 @@
return None
# Get data associated to item to test
- item_pydata = self.Tree.GetPyData(item)
+ item_pydata = self.Tree.GetItemData(item)
if item_pydata is not None and item_pydata["type"] == BLOCK:
# Only test item corresponding to block
@@ -393,7 +393,7 @@
while item.IsOk():
# Get item data to get item type
- item_pydata = self.Tree.GetPyData(item)
+ item_pydata = self.Tree.GetItemData(item)
# Item is a block category
if (item == root) or item_pydata["type"] == CATEGORY:
@@ -458,7 +458,7 @@
@param event: wx.TreeEvent
"""
# Update TextCtrl value with block selected usage
- item_pydata = self.Tree.GetPyData(event.GetItem())
+ item_pydata = self.Tree.GetItemData(event.GetItem())
self.Comment.SetValue(
item_pydata["comment"]
if item_pydata is not None and item_pydata["type"] == BLOCK
@@ -476,7 +476,7 @@
@param event: wx.TreeEvent
"""
selected_item = event.GetItem()
- item_pydata = self.Tree.GetPyData(selected_item)
+ item_pydata = self.Tree.GetItemData(selected_item)
# Item dragged is a block
if item_pydata is not None and item_pydata["type"] == BLOCK:
--- a/controls/LocationCellEditor.py Sun Feb 19 11:14:14 2023 +0800
+++ b/controls/LocationCellEditor.py Mon Feb 20 08:56:25 2023 +0800
@@ -29,14 +29,14 @@
from dialogs.BrowseLocationsDialog import BrowseLocationsDialog
-class LocationCellControl(wx.PyControl):
+class LocationCellControl(wx.Control):
'''
Custom cell editor control with a text box and a button that launches
the BrowseLocationsDialog.
'''
def __init__(self, parent):
- wx.PyControl.__init__(self, parent)
+ wx.Control.__init__(self, parent)
main_sizer = wx.FlexGridSizer(cols=2, hgap=0, rows=1, vgap=0)
main_sizer.AddGrowableCol(0)
@@ -198,9 +198,9 @@
pass
def SetSize(self, rect):
- self.CellControl.SetDimensions(rect.x + 1, rect.y,
- rect.width, rect.height,
- wx.SIZE_ALLOW_MINUS_ONE)
+ self.CellControl.SetSize(rect.x + 1, rect.y,
+ rect.width, rect.height,
+ wx.SIZE_ALLOW_MINUS_ONE)
def Clone(self):
return LocationCellEditor(self.Table, self.Controller)
--- a/controls/PouInstanceVariablesPanel.py Sun Feb 19 11:14:14 2023 +0800
+++ b/controls/PouInstanceVariablesPanel.py Mon Feb 20 08:56:25 2023 +0800
@@ -440,7 +440,7 @@
def OnVariablesListItemActivated(self, event):
selected_item = event.GetItem()
if selected_item is not None and selected_item.IsOk():
- item_infos = self.VariablesList.GetPyData(selected_item)
+ item_infos = self.VariablesList.GetItemData(selected_item)
if item_infos is not None:
item_button = self.VariablesList.IsOverItemRightImage(
@@ -460,7 +460,7 @@
else:
tagname = None
else:
- parent_infos = self.VariablesList.GetPyData(selected_item.GetParent())
+ parent_infos = self.VariablesList.GetItemData(selected_item.GetParent())
if item_infos.var_class == ITEM_ACTION:
tagname = ComputePouActionName(parent_infos.type, item_infos.name)
elif item_infos.var_class == ITEM_TRANSITION:
@@ -483,7 +483,7 @@
instance_path = self.InstanceChoice.GetStringSelection()
item, flags = self.VariablesList.HitTest(event.GetPosition())
if item is not None:
- item_infos = self.VariablesList.GetPyData(item)
+ item_infos = self.VariablesList.GetItemData(item)
if item_infos is not None:
item_button = self.VariablesList.IsOverItemRightImage(
--- a/controls/SearchResultPanel.py Sun Feb 19 11:14:14 2023 +0800
+++ b/controls/SearchResultPanel.py Mon Feb 20 08:56:25 2023 +0800
@@ -320,7 +320,7 @@
item, root_cookie = self.SearchResultsTree.GetNextChild(root, root_cookie)
def ShowSearchResults(self, item):
- data = self.SearchResultsTree.GetPyData(item)
+ data = self.SearchResultsTree.GetItemData(item)
if isinstance(data, tuple):
search_results = [data]
else:
--- a/controls/VariablePanel.py Sun Feb 19 11:14:14 2023 +0800
+++ b/controls/VariablePanel.py Mon Feb 20 08:56:25 2023 +0800
@@ -843,7 +843,7 @@
item = base_menu.Append(wx.ID_ANY, helpString='', kind=wx.ITEM_NORMAL, item=base_type)
self.Bind(wx.EVT_MENU, self.GetVariableTypeFunction(base_type), item)
- type_menu.AppendMenu(wx.ID_ANY, _("Base Types"), base_menu)
+ type_menu.Append(wx.ID_ANY, _("Base Types"), base_menu)
def BuildUserTypesMenu(self, type_menu):
# build a submenu containing user-defined types
@@ -853,7 +853,7 @@
item = datatype_menu.Append(wx.ID_ANY, helpString='', kind=wx.ITEM_NORMAL, item=datatype)
self.Bind(wx.EVT_MENU, self.GetVariableTypeFunction(datatype), item)
- type_menu.AppendMenu(wx.ID_ANY, _("User Data Types"), datatype_menu)
+ type_menu.Append(wx.ID_ANY, _("User Data Types"), datatype_menu)
def BuildLibsTypesMenu(self, type_menu):
for category in self.Controler.GetConfNodeDataTypes():
@@ -864,7 +864,7 @@
item = confnode_datatype_menu.Append(wx.ID_ANY, helpString='', kind=wx.ITEM_NORMAL, item=datatype)
self.Bind(wx.EVT_MENU, self.GetVariableTypeFunction(datatype), item)
- type_menu.AppendMenu(wx.ID_ANY, category["name"], confnode_datatype_menu)
+ type_menu.Append(wx.ID_ANY, category["name"], confnode_datatype_menu)
def BuildProjectTypesMenu(self, type_menu, classtype):
# build a submenu containing function block types
@@ -878,7 +878,7 @@
item = functionblock_menu.Append(wx.ID_ANY, helpString='', kind=wx.ITEM_NORMAL, item=functionblock_type)
self.Bind(wx.EVT_MENU, self.GetVariableTypeFunction(functionblock_type), item)
- type_menu.AppendMenu(wx.ID_ANY, _("Function Block Types"), functionblock_menu)
+ type_menu.Append(wx.ID_ANY, _("Function Block Types"), functionblock_menu)
def BuildArrayTypesMenu(self, type_menu):
item = type_menu.Append(wx.ID_ANY, helpString='', kind=wx.ITEM_NORMAL, item=_("Array"))
--- a/dialogs/BrowseLocationsDialog.py Sun Feb 19 11:14:14 2023 +0800
+++ b/dialogs/BrowseLocationsDialog.py Mon Feb 20 08:56:25 2023 +0800
@@ -204,7 +204,7 @@
item, root_cookie = self.LocationsTree.GetNextChild(root, root_cookie)
else:
self.LocationsTree.SetItemText(item, infos["name"])
- self.LocationsTree.SetPyData(item, infos)
+ self.LocationsTree.SetItemData(item, infos)
self.LocationsTree.SetItemImage(item, self.TreeImageDict[infos["type"]])
self.GenerateLocationsTreeBranch(item, children)
item, root_cookie = self.LocationsTree.GetNextChild(root, root_cookie)
@@ -215,7 +215,7 @@
self.LocationsTree.Delete(item)
def OnLocationsTreeItemActivated(self, event):
- infos = self.LocationsTree.GetPyData(event.GetItem())
+ infos = self.LocationsTree.GetItemData(event.GetItem())
if infos["type"] not in [LOCATION_CONFNODE, LOCATION_MODULE, LOCATION_GROUP]:
wx.CallAfter(self.EndModal, wx.ID_OK)
event.Skip()
@@ -226,7 +226,7 @@
def GetValues(self):
selected = self.LocationsTree.GetSelection()
- infos = self.LocationsTree.GetPyData(selected)
+ infos = self.LocationsTree.GetItemData(selected)
if not self.do_rename:
infos["var_name"] = None
return infos
@@ -237,7 +237,7 @@
selected = self.LocationsTree.GetSelection()
var_infos = None
if selected.IsOk():
- var_infos = self.LocationsTree.GetPyData(selected)
+ var_infos = self.LocationsTree.GetItemData(selected)
if var_infos is None or var_infos["type"] in [LOCATION_CONFNODE, LOCATION_MODULE, LOCATION_GROUP]:
dialog = wx.MessageDialog(self, _("A location must be selected!"), _("Error"), wx.OK | wx.ICON_ERROR)
dialog.ShowModal()
--- a/dialogs/BrowseValuesLibraryDialog.py Sun Feb 19 11:14:14 2023 +0800
+++ b/dialogs/BrowseValuesLibraryDialog.py Mon Feb 20 08:56:25 2023 +0800
@@ -79,11 +79,11 @@
def GetValueInfos(self):
selected = self.ValuesLibrary.GetSelection()
- return self.ValuesLibrary.GetPyData(selected)
+ return self.ValuesLibrary.GetItemData(selected)
def OnOK(self, event):
selected = self.ValuesLibrary.GetSelection()
- if not selected.IsOk() or self.ValuesLibrary.GetPyData(selected) is None:
+ if not selected.IsOk() or self.ValuesLibrary.GetItemData(selected) is None:
message = wx.MessageDialog(self, _("No valid value selected!"), _("Error"), wx.OK | wx.ICON_ERROR)
message.ShowModal()
message.Destroy()