forked from chriskiehl/Gooey
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added custom imports for wx 3/4 compatibility
- Loading branch information
1 parent
dc6386c
commit 2289abf
Showing
6 changed files
with
118 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
''' | ||
Util for supporting WxPython 3 & 4 | ||
''' | ||
|
||
import wx | ||
try: | ||
import wx.adv | ||
except ImportError: | ||
pass | ||
|
||
isLatestVersion = wx.version().startswith('4') | ||
|
||
|
||
class Constants: | ||
if isLatestVersion: | ||
WX_FONTSTYLE_NORMAL = wx.FONTSTYLE_NORMAL | ||
WX_DP_DROPDOWN = wx.adv.DP_DROPDOWN | ||
else: | ||
WX_FONTSTYLE_NORMAL = wx.FONTWEIGHT_NORMAL | ||
WX_DP_DROPDOWN = wx.DP_DROPDOWN | ||
|
||
|
||
class Classes: | ||
if isLatestVersion: | ||
DatePickerCtrl = wx.adv.DatePickerCtrl | ||
else: | ||
DatePickerCtrl = wx.DatePickerCtrl | ||
|
||
|
||
|
||
|
||
def imageFromBitmap(bitmap): | ||
if isLatestVersion: | ||
return bitmap.ConvertToImage() | ||
else: | ||
return wx.ImageFromBitmap(bitmap) | ||
|
||
|
||
def bitmapFromImage(image): | ||
if isLatestVersion: | ||
return wx.Bitmap(image) | ||
else: | ||
return wx.BitmapFromImage(image) | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters