--- a/Beremiz.py Wed Mar 06 10:58:15 2013 +0100
+++ b/Beremiz.py Wed Mar 06 19:23:58 2013 +0100
@@ -110,7 +110,7 @@
splash.SetText(text=updateinfo)
wx.Yield()
-from util.TranslationCatalogs import AddCatalog, locale
+from util.TranslationCatalogs import AddCatalog
from util.BitmapLibrary import AddBitmapFolder, GetBitmap
AddCatalog(os.path.join(CWD, "locale"))
@@ -120,7 +120,6 @@
# Import module for internationalization
import gettext
- __builtin__.__dict__['loc'] = locale
__builtin__.__dict__['_'] = wx.GetTranslation
# Load extensions
@@ -942,11 +941,18 @@
confnode_menu = wx.Menu(title='')
confnode = item_infos["confnode"]
- if confnode is not None and len(confnode.CTNChildrenTypes) > 0:
- for name, XSDClass, help in confnode.CTNChildrenTypes:
- new_id = wx.NewId()
- confnode_menu.Append(help=help, id=new_id, kind=wx.ITEM_NORMAL, text=_("Add") + " " + name)
- self.Bind(wx.EVT_MENU, self.GetAddConfNodeFunction(name, confnode), id=new_id)
+ if confnode is not None:
+ menu_items = confnode.GetContextualMenuItems()
+ if menu_items is not None:
+ for text, help, callback in menu_items:
+ new_id = wx.NewId()
+ confnode_menu.Append(help=help, id=new_id, kind=wx.ITEM_NORMAL, text=text)
+ self.Bind(wx.EVT_MENU, callback, id=new_id)
+ else:
+ for name, XSDClass, help in confnode.CTNChildrenTypes:
+ new_id = wx.NewId()
+ confnode_menu.Append(help=help, id=new_id, kind=wx.ITEM_NORMAL, text=_("Add") + " " + name)
+ self.Bind(wx.EVT_MENU, self.GetAddConfNodeFunction(name, confnode), id=new_id)
new_id = wx.NewId()
AppendMenu(confnode_menu, help='', id=new_id, kind=wx.ITEM_NORMAL, text=_("Delete"))
--- a/ConfigTreeNode.py Wed Mar 06 10:58:15 2013 +0100
+++ b/ConfigTreeNode.py Wed Mar 06 19:23:58 2013 +0100
@@ -422,6 +422,9 @@
self.BaseParams.setIEC_Channel(res)
return res
+ def GetContextualMenuItems(self):
+ return None
+
def _OpenView(self, name=None, onlyopened=False):
if self.EditorType is not None:
app_frame = self.GetCTRoot().AppFrame
--- a/PLCOpenEditor.py Wed Mar 06 10:58:15 2013 +0100
+++ b/PLCOpenEditor.py Wed Mar 06 19:23:58 2013 +0100
@@ -64,7 +64,7 @@
from docutil import *
-from util.TranslationCatalogs import AddCatalog, locale
+from util.TranslationCatalogs import AddCatalog
from util.BitmapLibrary import AddBitmapFolder, GetBitmap
AddCatalog(os.path.join(CWD, "locale"))
@@ -75,7 +75,6 @@
import gettext
import __builtin__
- __builtin__.__dict__['loc'] = locale
__builtin__.__dict__['_'] = wx.GetTranslation
from IDEFrame import IDEFrame, AppendMenu