--- a/PLCOpenEditor.py Thu Aug 20 09:03:31 2009 -0600
+++ b/PLCOpenEditor.py Wed Sep 02 08:30:34 2009 -0600
@@ -283,6 +283,7 @@
self.ShowErrorMessage(_("\"%s\" is used by one or more POUs. It can't be removed!")%name)
return DeleteElementFunction
+
#-------------------------------------------------------------------------------
# PLCOpenEditor Main Class
#-------------------------------------------------------------------------------
@@ -372,6 +373,8 @@
kind=wx.ITEM_NORMAL, text=_(u'Undo\tCTRL+Z'))
AppendMenu(parent, help='', id=wx.ID_REDO,
kind=wx.ITEM_NORMAL, text=_(u'Redo\tCTRL+Y'))
+ AppendMenu(parent, help='', id=ID_PLCOPENEDITOREDITMENUENABLEUNDOREDO,
+ kind=wx.ITEM_CHECK, text=_(u'Enable Undo/Redo'))
parent.AppendSeparator()
AppendMenu(parent, help='', id=wx.ID_CUT,
kind=wx.ITEM_NORMAL, text=_(u'Cut\tCTRL+X'))
@@ -543,7 +546,7 @@
pos=wx.Point(0, 0), size=wx.Size(0, 0),
style=wx.TR_HAS_BUTTONS|wx.TR_SINGLE|wx.SUNKEN_BORDER)
- self.TabsImageList = wx.ImageList(16, 31)
+ self.TabsImageList = wx.ImageList(31, 16)
self.TabsImageListIndexes = {}
if self.Debug:
@@ -815,19 +818,21 @@
def GetCopyBuffer(self):
data = None
- if wx.TheClipboard.Open():
+ if wx.TheClipboard.IsOpened() or wx.TheClipboard.Open():
dataobj = wx.TextDataObject()
if wx.TheClipboard.GetData(dataobj):
data = dataobj.GetText()
+ if wx.TheClipboard.IsOpened():
wx.TheClipboard.Close()
return data
def SetCopyBuffer(self, text):
- if wx.TheClipboard.Open():
+ if wx.TheClipboard.IsOpened() or wx.TheClipboard.Open():
data = wx.TextDataObject()
data.SetText(text)
wx.TheClipboard.SetData(data)
wx.TheClipboard.Flush()
+ if wx.TheClipboard.IsOpened():
wx.TheClipboard.Close()
self.RefreshEditMenu()
@@ -890,27 +895,30 @@
return index
if icon2_name is None:
# Bitmap with only one icon
- tmp_bitmap = wx.Bitmap(os.path.join(CWD, 'Images', '%s.png'%icon1_name))
+ bitmap = wx.Bitmap(os.path.join(CWD, 'Images', '%s.png'%icon1_name))
else:
# Bitmap with two icon
icon1 = wx.Bitmap(os.path.join(CWD, 'Images', '%s.png'%icon1_name))
icon2 = wx.Bitmap(os.path.join(CWD, 'Images', '%s.png'%icon2_name))
+
# Calculate bitmap size
width = icon1.GetWidth() + icon2.GetWidth() - 1
height = max(icon1.GetHeight(), icon2.GetHeight())
# Create bitmap with both icons
- tmp_bitmap = wx.EmptyBitmap(width, height)
+ bitmap = wx.EmptyBitmap(width, height)
dc = wx.MemoryDC()
- dc.SelectObject(tmp_bitmap)
+ dc.SelectObject(bitmap)
dc.Clear()
dc.DrawBitmap(icon1, 0, 0)
dc.DrawBitmap(icon2, icon1.GetWidth() - 1, 0)
- # Store bitmap in ImageList
- index = self.TabsImageList.Add(tmp_bitmap)
- # Save bitmap index in ImageList in dictionary
- self.TabsImageListIndexes[(icon1_name, icon2_name)] = index
+ dc.Destroy()
+
+ # Store bitmap in ImageList
+ index = self.TabsImageList.Add(bitmap)
+ # Save bitmap index in ImageList in dictionary
+ self.TabsImageListIndexes[(icon1_name, icon2_name)] = index
if USE_AUI:
- return tmp_bitmap
+ return bitmap
else:
return index