Commits

Chaiwat Suttipongsakul committed e214206

Add backward compatibility with wxPython-2.8.

Comments (0)

Files changed (8)

 
 import os, string, time, warnings
 
-if sys.getdefaultencoding() != 'utf-8':
-    from imp import reload
-    reload(sys)
-    set_default_encoding = getattr(sys, 'setdefaultencoding')
-    if set_default_encoding:
-        set_default_encoding('utf-8')
-
 #sys.stdout = sys.__stdout__#open('stdout.txt', 'w')
 #sys.stderr = sys.__stderr__#open('stderr.txt', 'w')
 

Companions/BaseCompanions.py

 import copy
 
 import wx
+from wxCompat import wxNO_3D
 
 import Preferences, Utils
 from Utils import _
         self.windowStyles = ['wx.CAPTION', 'wx.MINIMIZE_BOX', 'wx.MAXIMIZE_BOX',
             'wx.THICK_FRAME', 'wx.SIMPLE_BORDER', 'wx.DOUBLE_BORDER',
             'wx.SUNKEN_BORDER', 'wx.RAISED_BORDER', 'wx.STATIC_BORDER', 
-            'wx.TRANSPARENT_WINDOW', 'wx.wxNO_3D', 'wx.TAB_TRAVERSAL', 
+            'wx.TRANSPARENT_WINDOW', 'wxNO_3D', 'wx.TAB_TRAVERSAL', 
             'wx.WANTS_CHARS', 'wx.NO_FULL_REPAINT_ON_RESIZE', 'wx.VSCROLL', 
             'wx.HSCROLL', 'wx.CLIP_CHILDREN', 'wx.NO_BORDER', 'wx.ALWAYS_SHOW_SB']
         

Companions/FrameCompanions.py

 print 'importing Companions.FrameCompanions'
 
 import wx
+from wxCompat import wxNO_3D
 
 from BaseCompanions import ContainerDTC
 
         BaseFrameDTC.__init__(self, name, designer, frameCtrl)
         self.windowStyles = ['wx.wxDIALOG_MODAL', 'wx.wxDIALOG_MODELESS',
               'wx.CAPTION', 'wx.DEFAULT_DIALOG_STYLE', 'wx.RESIZE_BORDER',
-              'wx.THICK_FRAME', 'wx.STAY_ON_TOP', 'wx.wxNO_3D', 'wx.DIALOG_NO_PARENT',
+              'wx.THICK_FRAME', 'wx.STAY_ON_TOP', 'wxNO_3D', 'wx.DIALOG_NO_PARENT',
               'wx.SYSTEM_MENU', 'wx.CLOSE_BOX']\
               + self.windowStyles
 
 
 import wx
 import wx.stc
+from wxCompat import wxNO_3D
 
 #-Miscellaneous-----------------------------------------------------------------
 
 # Frame test button on the Palette toolbar
 showFrameTestButton = False
 # Style flags used by most splitters in the IDE
-splitterStyle = wx.SP_LIVE_UPDATE | wx.SP_3DSASH | wx.wxNO_3D
+splitterStyle = wx.SP_LIVE_UPDATE | wx.SP_3DSASH | wxNO_3D
 
 # Alternating background colours used in ListCtrls (pastel blue and yellow)
 pastels = True
 
 import wx
 import wx.lib.stattext
+from wxCompat import wxNO_3D
 
 import PaletteMapping, PaletteStore, Preferences, Help
 from PropEdit import PropertyEditors
           style = Preferences.splitterStyle)
 
         self.categories = wx.SplitterWindow(self, -1,
-              style=wx.wxNO_3D | wx.SP_3D | wx.SP_LIVE_UPDATE)
+              style=wxNO_3D | wx.SP_3D | wx.SP_LIVE_UPDATE)
         self.definitions = InspectorEventScrollWin(self, -1,
               style=wx.SUNKEN_BORDER | wx.TAB_TRAVERSAL)
 

Plug-ins/HelpBook.plug-in.py

 #Boa:Dialog:HelpBookItemDlg
 
 import wx
+from wxCompat import wxNO_3D
 
 from Utils import _
 
     delBmp = 'Images/Shared/DeleteItem.png'
     def __init__(self, parent, model):
         wx.SplitterWindow.__init__(self, parent, -1,
-              style=wx.CLIP_CHILDREN | wx.wxNO_3D | wx.SP_3DSASH)
+              style=wx.CLIP_CHILDREN | wxNO_3D | wx.SP_3DSASH)
 
         self.indexes = HelpBookIndexListView(self, model, self)
         self.files = HelpBookFilesView(self, model, False)
     delBmp = 'Images/Shared/DeleteItem.png'
     def __init__(self, parent, model):
         wx.SplitterWindow.__init__(self, parent, -1,
-              style=wx.CLIP_CHILDREN | wx.wxNO_3D | wx.SP_3DSASH)
+              style=wx.CLIP_CHILDREN | wxNO_3D | wx.SP_3DSASH)
 
         self.contents = HelpBookContentsTreeView(self, model, self)
         self.files = HelpBookFilesView(self, model, False)

PropEdit/Enumerations.py

 # Licence:     GPL
 #----------------------------------------------------------------------
 import wx
+from wxCompat import wxNO_3D
 
 def reverseDict(dict):
     rev = {}
 
 windowStyles =[wx.CAPTION, wx.MINIMIZE_BOX, wx.MAXIMIZE_BOX, wx.THICK_FRAME,
 wx.SIMPLE_BORDER, wx.DOUBLE_BORDER, wx.SUNKEN_BORDER, wx.RAISED_BORDER,
-wx.STATIC_BORDER, wx.TRANSPARENT_WINDOW, wx.wxNO_3D, wx.TAB_TRAVERSAL, wx.VSCROLL,
+wx.STATIC_BORDER, wx.TRANSPARENT_WINDOW, wxNO_3D, wx.TAB_TRAVERSAL, wx.VSCROLL,
 wx.HSCROLL, wx.CLIP_CHILDREN]
 
 windowNameStyles = {'wx.CAPTION':wx.CAPTION, 'wx.MINIMIZE_BOX':wx.MINIMIZE_BOX,
 'wx.SIMPLE_BORDER':wx.SIMPLE_BORDER, 'wx.DOUBLE_BORDER':wx.DOUBLE_BORDER,
 'wx.SUNKEN_BORDER':wx.SUNKEN_BORDER, 'wx.RAISED_BORDER':wx.RAISED_BORDER,
 'wx.STATIC_BORDER':wx.STATIC_BORDER, 'wx.TRANSPARENT_WINDOW':wx.TRANSPARENT_WINDOW,
-'wx.wxNO_3D':wx.wxNO_3D, 'wx.TAB_TRAVERSAL':wx.TAB_TRAVERSAL, 'wx.VSCROLL':wx.VSCROLL,
+'wx.TAB_TRAVERSAL':wx.TAB_TRAVERSAL, 'wx.VSCROLL':wx.VSCROLL,
 'wx.HSCROLL':wx.HSCROLL, 'wx.CLIP_CHILDREN':wx.CLIP_CHILDREN}
 
+if hasattr(wx, 'NO_3D'):
+    windowNameStyles.update({'wx.NO_3D':wxNO_3D})
+elif hasattr(wx, 'wxNO_3D'):
+    windowNameStyles.update({'wx.wxNO_3D':wxNO_3D})
+
 # Fonts
 fontFamily = [wx.DEFAULT, wx.DECORATIVE, wx.ROMAN, wx.SCRIPT, wx.SWISS, wx.MODERN]
 fontFamilyNames = {'wx.DEFAULT':wx.DEFAULT, 'wx.DECORATIVE':wx.DECORATIVE, 'wx.ROMAN':wx.ROMAN,
+# -*- coding: utf-8 -*-
+try:
+    from wx import NO_3D as wxNO_3D
+except ImportError:
+    from wx import wxNO_3D
+