--- a/Beremiz.py Fri Aug 02 08:55:45 2013 +0900
+++ b/Beremiz.py Fri Aug 02 08:58:09 2013 +0900
@@ -150,7 +150,7 @@
from controls.CustomStyledTextCtrl import CustomStyledTextCtrl
from PLCControler import LOCATION_CONFNODE, LOCATION_MODULE, LOCATION_GROUP, LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT, LOCATION_VAR_MEMORY, ITEM_PROJECT, ITEM_RESOURCE
-from ProjectController import ProjectController, MATIEC_ERROR_MODEL, ITEM_CONFNODE
+from ProjectController import ProjectController, GetAddMenuItems, MATIEC_ERROR_MODEL, ITEM_CONFNODE @@ -330,6 +330,19 @@
(wx.ID_SAVEAS, "saveas", _(u'Save As...'), None),
(wx.ID_PRINT, "print", _(u'Print'), None)])
+ def _RecursiveAddMenuItems(self, menu, items): + for name, text, help, children in items: + new_menu = wx.Menu(title='') + menu.AppendMenu(new_id, text, new_menu) + self._RecursiveAddMenuItems(new_menu, children) + AppendMenu(menu, help=help, id=new_id, + kind=wx.ITEM_NORMAL, text=text) + self.Bind(wx.EVT_MENU, self.GetAddConfNodeFunction(name), def _init_coll_AddMenu_Items(self, parent):
IDEFrame._init_coll_AddMenu_Items(self, parent, False)
@@ -339,11 +352,7 @@
# kind=wx.ITEM_NORMAL, text=_(u'&Resource'))
#self.Bind(wx.EVT_MENU, self.AddResourceMenu, id=new_id)
- for name, XSDClass, help in ProjectController.CTNChildrenTypes:
- AppendMenu(parent, help='', id=new_id,
- kind=wx.ITEM_NORMAL, text=help)
- self.Bind(wx.EVT_MENU, self.GetAddConfNodeFunction(name), id=new_id)
+ self._RecursiveAddMenuItems(parent, GetAddMenuItems()) def _init_coll_HelpMenu_Items(self, parent):
parent.Append(help='', id=wx.ID_ABOUT,
--- a/ProjectController.py Fri Aug 02 08:55:45 2013 +0900
+++ b/ProjectController.py Fri Aug 02 08:58:09 2013 +0900
@@ -7,6 +7,7 @@
+from types import ListType from threading import Timer, Lock, Thread
from time import localtime
from datetime import datetime
@@ -37,6 +38,28 @@
+def ExtractChildrenTypesFromCatalog(catalog): + for n,d,h,c in catalog: + if isinstance(c, ListType): + children_types.extend(ExtractChildrenTypesFromCatalog(c)) + children_types.append((n, GetClassImporter(c), d)) +def ExtractMenuItemsFromCatalog(catalog): + for n,d,h,c in catalog: + if isinstance(c, ListType): + children = ExtractMenuItemsFromCatalog(c) + menu_items.append((n, d, h, children)) + return ExtractMenuItemsFromCatalog(features.catalog) class ProjectController(ConfigTreeNode, PLCControler):
This class define Root object of the confnode tree.
@@ -50,7 +73,7 @@
# For root object, available Children Types are modules of the confnode packages.
- CTNChildrenTypes = [(n, GetClassImporter(c), d) for n,d,h,c in features.catalog]
+ CTNChildrenTypes = ExtractChildrenTypesFromCatalog(features.catalog) XSD = """<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
@@ -116,6 +139,11 @@
# copy ConfNodeMethods so that it can be later customized
self.StatusMethods = [dic.copy() for dic in self.StatusMethods]
+ self.DebugTimer.cancel() @@ -124,11 +152,6 @@
Lib = GetClassImporter(clsname)()(self, libname, TypeStack)
TypeStack.append(Lib.GetTypes())
self.Libraries.append(Lib)
- self.DebugTimer.cancel()
def SetAppFrame(self, frame, logger):
--- a/editors/ConfTreeNodeEditor.py Fri Aug 02 08:55:45 2013 +0900
+++ b/editors/ConfTreeNodeEditor.py Fri Aug 02 08:58:09 2013 +0900
@@ -316,7 +316,11 @@
element_path = element_infos["name"]
if element_infos["type"] == "element":
- label = element_infos["name"]
+ name = element_infos["name"] + value = element_infos["value"] + label += " - %s" % _(value) staticbox = wx.StaticBox(self.ParamsEditor,
label=_(label), size=wx.Size(10, 0))
staticboxsizer = wx.StaticBoxSizer(staticbox, wx.VERTICAL)