--- a/Beremiz.py Fri Jul 26 14:04:29 2013 +0900
+++ b/Beremiz.py Fri Aug 02 08:55:45 2013 +0900
@@ -155,29 +155,6 @@
-class GenStaticBitmap(wx.lib.statbmp.GenStaticBitmap):
- """ Customized GenStaticBitmap, fix transparency redraw bug on wx2.8/win32,
- and accept image name as __init__ parameter, fail silently if file do not exist"""
- def __init__(self, parent, ID, bitmapname,
- pos = wx.DefaultPosition, size = wx.DefaultSize,
- wx.lib.statbmp.GenStaticBitmap.__init__(self, parent, ID,
- def OnPaint(self, event):
- colour = self.GetParent().GetBackgroundColour()
- dc.SetPen(wx.Pen(colour))
- dc.SetBrush(wx.Brush(colour ))
- dc.DrawRectangle(0, 0, *dc.GetSizeTuple())
- dc.DrawBitmap(self._bitmap, 0, 0, True)
if wx.Platform == '__WXMSW__':
@@ -300,14 +277,7 @@
-[ID_BEREMIZ, ID_BEREMIZMAINSPLITTER,
- ID_BEREMIZPLCCONFIG, ID_BEREMIZLOGCONSOLE,
- ID_BEREMIZINSPECTOR] = [wx.NewId() for _init_ctrls in range(5)]
-[ID_FILEMENURECENTPROJECTS,
-] = [wx.NewId() for _init_ctrls in range(1)]
-CONFNODEMENU_POSITION = 3
+ID_FILEMENURECENTPROJECTS = wx.NewId() @@ -394,8 +364,9 @@
self.EditMenuSize = self.EditMenu.GetMenuItemCount()
- self.Bind(wx.EVT_MENU, self.OnOpenWidgetInspector, id=ID_BEREMIZINSPECTOR)
- accels = [wx.AcceleratorEntry(wx.ACCEL_CTRL|wx.ACCEL_ALT, ord('I'), ID_BEREMIZINSPECTOR)]
+ inspectorID = wx.NewId() + self.Bind(wx.EVT_MENU, self.OnOpenWidgetInspector, id=inspectorID) + accels = [wx.AcceleratorEntry(wx.ACCEL_CTRL|wx.ACCEL_ALT, ord('I'), inspectorID)] for method,shortcut in [("Stop", wx.WXK_F4),
@@ -413,7 +384,7 @@
self.SetAcceleratorTable(wx.AcceleratorTable(accels))
- self.LogConsole = CustomStyledTextCtrl(id=ID_BEREMIZLOGCONSOLE,
+ self.LogConsole = CustomStyledTextCtrl( name='LogConsole', parent=self.BottomNoteBook, pos=wx.Point(0, 0),
self.LogConsole.Bind(wx.EVT_SET_FOCUS, self.OnLogConsoleFocusChanged)
--- a/controls/PouInstanceVariablesPanel.py Fri Jul 26 14:04:29 2013 +0900
+++ b/controls/PouInstanceVariablesPanel.py Fri Aug 02 08:55:45 2013 +0900
@@ -23,8 +23,29 @@
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+import wx.lib.agw.customtreectrl as CT +import wx.lib.imageutils -import wx.lib.agw.customtreectrl as CT
+def SetBitmapLabel(self, bitmap, createOthers=True): + Set the bitmap to display normally. + This is the only one that is required. If + createOthers is True, then the other bitmaps + will be generated on the fly. Currently, + only the disabled bitmap is generated. + if bitmap is not None and createOthers: + GrayBitmap=GrayedBitmapCache.get(bitmap,None) + image = wx.ImageFromBitmap(bitmap) + wx.lib.imageutils.grayOut(image) + GrayBitmap = wx.BitmapFromImage(image) + GrayedBitmapCache[bitmap] = GrayBitmap + self.SetBitmapDisabled(GrayBitmap) +wx.lib.buttons.GenBitmapButton.SetBitmapLabel = SetBitmapLabel --- a/editors/ConfTreeNodeEditor.py Fri Jul 26 14:04:29 2013 +0900
+++ b/editors/ConfTreeNodeEditor.py Fri Aug 02 08:55:45 2013 +0900
@@ -3,7 +3,6 @@
from EditorPanel import EditorPanel
@@ -35,22 +34,6 @@
return os.path.join(CWD,*args)
-# Patch wx.lib.imageutils so that gray is supported on alpha images
-import wx.lib.imageutils
-from wx.lib.imageutils import grayOut as old_grayOut
- AlphaData = anImage.GetAlphaData()
- if AlphaData is not None:
- anImage.SetAlphaData(AlphaData)
-wx.lib.imageutils.grayOut = grayOut
class GenBitmapTextButton(wx.lib.buttons.GenBitmapTextButton):
--- a/plcopen/plcopen.py Fri Jul 26 14:04:29 2013 +0900
+++ b/plcopen/plcopen.py Fri Aug 02 08:55:45 2013 +0900
@@ -502,10 +502,8 @@
def AddElementUsingTreeInstance(self, name, type_infos):
typename = type_infos.getname()
- if not self.ElementUsingTree.has_key(typename):
- self.ElementUsingTree[typename] = [name]
- elif name not in self.ElementUsingTree[typename]:
- self.ElementUsingTree[typename].append(name)
+ elements = self.ElementUsingTree.setdefault(typename, set()) setattr(cls, "AddElementUsingTreeInstance", AddElementUsingTreeInstance)
def RefreshElementUsingTree(self):
@@ -518,9 +516,8 @@
name = datatype.getname()
basetype_content = datatype.baseType.getcontent()
if basetype_content["name"] == "derived":
- typename = basetype_content["value"].getname()
- if name in self.ElementUsingTree[typename]:
- self.ElementUsingTree[typename].append(name)
+ self.AddElementUsingTreeInstance(name, + basetype_content["value"]) elif basetype_content["name"] in ["subrangeSigned", "subrangeUnsigned", "array"]:
base_type = basetype_content["value"].baseType.getcontent()
if base_type["name"] == "derived":
@@ -540,9 +537,6 @@
vartype_content = var.gettype().getcontent()
if vartype_content["name"] == "derived":
self.AddElementUsingTreeInstance(name, vartype_content["value"])
- for typename in self.ElementUsingTree.iterkeys():
- if typename != name and pou.hasblock(block_type=typename) and name not in self.ElementUsingTree[typename]:
- self.ElementUsingTree[typename].append(name)
setattr(cls, "RefreshElementUsingTree", RefreshElementUsingTree)
@@ -591,9 +585,8 @@
# Return if pou given by name is used by another pou
def ElementIsUsed(self, name):
- if self.ElementUsingTree.has_key(name):
- return len(self.ElementUsingTree[name]) > 0
+ elements = self.ElementUsingTree.get(name, None) + return elements is not None setattr(cls, "ElementIsUsed", ElementIsUsed)
def DataTypeIsDerived(self, name):
@@ -602,18 +595,17 @@
# Return if pou given by name is directly or undirectly used by the reference pou
def ElementIsUsedBy(self, name, reference):
- if self.ElementUsingTree.has_key(name):
- list = self.ElementUsingTree[name]
- # Test if pou is directly used by reference
- # Test if pou is undirectly used by reference, by testing if pous
- # that directly use pou is directly or undirectly used by reference
- used |= self.ElementIsUsedBy(element, reference)
+ elements = self.ElementUsingTree.get(name, set()) + # Test if pou is directly used by reference + if reference in elements: + # Test if pou is undirectly used by reference, by testing if pous + # that directly use pou is directly or undirectly used by reference + selffn = self.ElementIsUsedBy + for element in elements: + if selffn(element, reference): setattr(cls, "ElementIsUsedBy", ElementIsUsedBy)
@@ -654,17 +646,16 @@
setattr(cls, "GetCustomBlockType", GetCustomBlockType)
# Return Block types checking for recursion
- def GetCustomBlockTypes(self, exclude = "", onlyfunctions = False):
- pou = self.getpou(exclude)
- type = pou.getpouType()
- for customblocktype in self.CustomBlockTypes:
- if customblocktype["type"] != "program" and customblocktype["name"] != exclude and not self.ElementIsUsedBy(exclude, customblocktype["name"]) and not (onlyfunctions and customblocktype["type"] != "function"):
- customblocktypes.append(customblocktype)
- return customblocktypes
+ def GetCustomBlockTypes(self, exclude = None, onlyfunctions = False): + if exclude is not None: + return [customblocktype for customblocktype in self.CustomBlockTypes + if (customblocktype["type"] != "program" + and customblocktype["name"] != exclude + and not self.ElementIsUsedBy(exclude, customblocktype["name"]) + and not (onlyfunctions and customblocktype["type"] != "function"))] + return [customblocktype for customblocktype in self.CustomBlockTypes + if (customblocktype["type"] != "program" + and not (onlyfunctions and customblocktype["type"] != "function"))] setattr(cls, "GetCustomBlockTypes", GetCustomBlockTypes)
# Return Function Block types checking for recursion