123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688 |
- """
- @package gui_core.wrap
- @brief Core wrapped wxpython widgets
- Classes:
- - wrap::GSpinCtrl
- (C) 2016 by the GRASS Development Team
- This program is free software under the GNU General Public License
- (>=v2). Read the file COPYING that comes with GRASS for details.
- @author Anna Petrasova <kratochanna gmail.com>
- """
- import wx
- import wx.lib.agw.floatspin as fs
- import wx.lib.colourselect as csel
- import wx.lib.filebrowsebutton as filebrowse
- import wx.lib.scrolledpanel as scrolled
- from wx.lib import expando
- from wx.lib import buttons
- try:
- import wx.lib.agw.customtreectrl as CT
- except ImportError:
- import wx.lib.customtreectrl as CT
- from core.globalvar import CheckWxVersion, gtk3, wxPythonPhoenix
- if wxPythonPhoenix:
- import wx.adv
- from wx.adv import OwnerDrawnComboBox as OwnerDrawnComboBox_
- from wx.adv import ODCB_PAINTING_CONTROL, ODCB_PAINTING_SELECTED
- from wx.adv import BitmapComboBox as BitmapComboBox_
- from wx.adv import HyperlinkCtrl as HyperlinkCtrl_
- from wx.adv import HL_ALIGN_LEFT, HL_CONTEXTMENU
- ComboPopup = wx.ComboPopup
- wxComboCtrl = wx.ComboCtrl
- else:
- import wx.combo
- from wx.combo import OwnerDrawnComboBox as OwnerDrawnComboBox_
- from wx.combo import ODCB_PAINTING_CONTROL, ODCB_PAINTING_SELECTED
- from wx.combo import BitmapComboBox as BitmapComboBox_
- from wx import HyperlinkCtrl as HyperlinkCtrl_
- from wx import HL_ALIGN_LEFT, HL_CONTEXTMENU
- ComboPopup = wx.combo.ComboPopup
- wxComboCtrl = wx.combo.ComboCtrl
- if wxPythonPhoenix and CheckWxVersion([4, 0, 3, 0]):
- from wx import NewIdRef as NewId
- else:
- from wx import NewId
- def BitmapFromImage(image, depth=-1):
- if wxPythonPhoenix:
- return wx.Bitmap(img=image, depth=depth)
- else:
- return wx.BitmapFromImage(image, depth=depth)
- def ImageFromBitmap(bitmap):
- if wxPythonPhoenix:
- return bitmap.ConvertToImage()
- else:
- return wx.ImageFromBitmap(bitmap)
- def EmptyBitmap(width, height, depth=-1):
- if wxPythonPhoenix:
- return wx.Bitmap(width=width, height=height, depth=depth)
- else:
- return wx.EmptyBitmap(width=width, height=height, depth=depth)
- def EmptyImage(width, height, clear=True):
- if wxPythonPhoenix:
- return wx.Image(width=width, height=height, clear=clear)
- else:
- return wx.EmptyImage(width=width, height=height, clear=clear)
- def StockCursor(cursorId):
- if wxPythonPhoenix:
- return wx.Cursor(cursorId=cursorId)
- else:
- return wx.StockCursor(cursorId)
- class Window(wx.Window):
- """Wrapper around wx.Window to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- wx.Window.__init__(self, *args, **kwargs)
- def SetToolTip(self, tip):
- if wxPythonPhoenix:
- if tip is None:
- wx.Window.UnsetToolTip(self)
- else:
- wx.Window.SetToolTip(self, tipString=tip)
- else:
- if tip is None:
- wx.Window.SetToolTip(self, tip)
- else:
- wx.Window.SetToolTipString(self, tip)
- class Panel(wx.Panel):
- """Wrapper around wx.Panel to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- wx.Panel.__init__(self, *args, **kwargs)
- def SetToolTip(self, tip):
- if wxPythonPhoenix:
- wx.Panel.SetToolTip(self, tipString=tip)
- else:
- wx.Panel.SetToolTipString(self, tip)
- class SpinCtrl(wx.SpinCtrl):
- """Wrapper around wx.SpinCtrl to have more control
- over the widget on different platforms"""
- gtk3MinSize = 130
- def __init__(self, *args, **kwargs):
- if gtk3:
- if 'size' in kwargs:
- kwargs['size'] = wx.Size(max(self.gtk3MinSize, kwargs['size'][0]), kwargs['size'][1])
- else:
- kwargs['size'] = wx.Size(self.gtk3MinSize, -1)
- wx.SpinCtrl.__init__(self, *args, **kwargs)
- def SetToolTip(self, tip):
- if wxPythonPhoenix:
- wx.SpinCtrl.SetToolTip(self, tipString=tip)
- else:
- wx.SpinCtrl.SetToolTipString(self, tip)
- class FloatSpin(fs.FloatSpin):
- """Wrapper around fs.FloatSpin to have more control
- over the widget on different platforms"""
- gtk3MinSize = 130
- def __init__(self, *args, **kwargs):
- if gtk3:
- if 'size' in kwargs:
- kwargs['size'] = wx.Size(max(self.gtk3MinSize, kwargs['size'][0]), kwargs['size'][1])
- else:
- kwargs['size'] = wx.Size(self.gtk3MinSize, -1)
- fs.FloatSpin.__init__(self, *args, **kwargs)
- def SetToolTip(self, tip):
- if wxPythonPhoenix:
- fs.FloatSpin.SetToolTip(self, tipString=tip)
- else:
- fs.FloatSpin.SetToolTipString(self, tip)
- class Button(wx.Button):
- """Wrapper around wx.Button to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- wx.Button.__init__(self, *args, **kwargs)
- def SetToolTip(self, tip):
- if wxPythonPhoenix:
- wx.Button.SetToolTip(self, tipString=tip)
- else:
- wx.Button.SetToolTipString(self, tip)
- class RadioButton(wx.RadioButton):
- """Wrapper around wx.RadioButton to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- wx.RadioButton.__init__(self, *args, **kwargs)
- def SetToolTip(self, tip):
- if wxPythonPhoenix:
- wx.RadioButton.SetToolTip(self, tipString=tip)
- else:
- wx.RadioButton.SetToolTipString(self, tip)
- class BitmapButton(wx.BitmapButton):
- """Wrapper around wx.BitmapButton to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- wx.BitmapButton.__init__(self, *args, **kwargs)
- def SetToolTip(self, tip):
- if wxPythonPhoenix:
- wx.BitmapButton.SetToolTip(self, tipString=tip)
- else:
- wx.BitmapButton.SetToolTipString(self, tip)
- class GenBitmapButton(buttons.GenBitmapButton):
- """Wrapper around GenBitmapButton to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- buttons.GenBitmapButton.__init__(self, *args, **kwargs)
- def SetToolTip(self, tip):
- if wxPythonPhoenix:
- buttons.GenBitmapButton.SetToolTip(self, tipString=tip)
- else:
- buttons.GenBitmapButton.SetToolTipString(self, tip)
- class ToggleButton(wx.ToggleButton):
- """Wrapper around wx.ToggleButton to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- wx.ToggleButton.__init__(self, *args, **kwargs)
- def SetToolTip(self, tip):
- if wxPythonPhoenix:
- wx.ToggleButton.SetToolTip(self, tipString=tip)
- else:
- wx.ToggleButton.SetToolTipString(self, tip)
- class StaticText(wx.StaticText):
- """Wrapper around wx.StaticText to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- wx.StaticText.__init__(self, *args, **kwargs)
- def SetToolTip(self, tip):
- if wxPythonPhoenix:
- wx.StaticText.SetToolTip(self, tipString=tip)
- else:
- wx.StaticText.SetToolTipString(self, tip)
- class StaticBox(wx.StaticBox):
- """Wrapper around wx.StaticBox to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- wx.StaticBox.__init__(self, *args, **kwargs)
- def SetToolTip(self, tip):
- if wxPythonPhoenix:
- wx.StaticBox.SetToolTip(self, tipString=tip)
- else:
- wx.StaticBox.SetToolTipString(self, tip)
- class CheckListBox(wx.CheckListBox):
- """Wrapper around wx.CheckListBox to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- wx.CheckListBox.__init__(self, *args, **kwargs)
- def SetToolTip(self, tip):
- if wxPythonPhoenix:
- wx.CheckListBox.SetToolTip(self, tipString=tip)
- else:
- wx.CheckListBox.SetToolTipString(self, tip)
- class TextCtrl(wx.TextCtrl):
- """Wrapper around wx.TextCtrl to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- wx.TextCtrl.__init__(self, *args, **kwargs)
- def SetToolTip(self, tip):
- if wxPythonPhoenix:
- wx.TextCtrl.SetToolTip(self, tipString=tip)
- else:
- wx.TextCtrl.SetToolTipString(self, tip)
- class SearchCtrl(wx.SearchCtrl):
- """Wrapper around wx.SearchCtrl to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- wx.SearchCtrl.__init__(self, *args, **kwargs)
- def SetToolTip(self, tip):
- if wxPythonPhoenix:
- wx.SearchCtrl.SetToolTip(self, tipString=tip)
- else:
- wx.SearchCtrl.SetToolTipString(self, tip)
- class ListCtrl(wx.ListCtrl):
- """Wrapper around wx.ListCtrl to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- wx.ListCtrl.__init__(self, *args, **kwargs)
- def InsertItem(self, index, label, imageIndex=-1):
- if wxPythonPhoenix:
- return wx.ListCtrl.InsertItem(self, index=index, label=label, imageIndex=imageIndex)
- else:
- return wx.ListCtrl.InsertStringItem(self, index=index, label=label, imageIndex=imageIndex)
- def SetItem(self, index, column, label, imageId=-1):
- if wxPythonPhoenix:
- return wx.ListCtrl.SetItem(self, index=index, column=column, label=label, imageId=imageId)
- else:
- return wx.ListCtrl.SetStringItem(self, index=index, col=column, label=label, imageId=imageId)
- def CheckItem(self, item, check=True):
- """Uses either deprecated listmix.CheckListCtrlMixin
- or new checkbox implementation in wx.ListCtrl since 4.1.0"""
- if hasattr(self, 'HasCheckBoxes'):
- wx.ListCtrl.CheckItem(self, item, check)
- else:
- super(ListCtrl, self).CheckItem(item, check)
- def IsItemChecked(self, item):
- if hasattr(self, 'HasCheckBoxes'):
- return wx.ListCtrl.IsItemChecked(self, item)
- else:
- return super(ListCtrl, self).IsChecked(item)
-
- if CheckWxVersion([4, 1, 0]):
- class CheckListCtrlMixin():
- """This class pretends to be deprecated CheckListCtrlMixin mixin and
- only enables checkboxes in new versions of ListCtrl"""
- def __init__(self):
- self.EnableCheckBoxes(True)
- self.AssignImageList(wx.ImageList(16, 16), wx.IMAGE_LIST_SMALL)
- else:
- import wx.lib.mixins.listctrl as listmix
- class CheckListCtrlMixin(listmix.CheckListCtrlMixin):
- """Wrapper for deprecated mixin"""
- def __init__(self):
- listmix.CheckListCtrlMixin.__init__(self)
- class TreeCtrl(wx.TreeCtrl):
- """Wrapper around wx.TreeCtrl to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- wx.TreeCtrl.__init__(self, *args, **kwargs)
- def AppendItem(self, parent, text, image=-1, selImage=-1, data=None):
- if wxPythonPhoenix:
- return wx.TreeCtrl.AppendItem(self, parent, text, image, selImage, data)
- else:
- return wx.TreeCtrl.AppendItem(self, parent, text, image, selImage, wx.TreeItemData(data))
- def GetItemData(self, item):
- if wxPythonPhoenix:
- return wx.TreeCtrl.GetItemData(self, item)
- else:
- return wx.TreeCtrl.GetPyData(self, item)
- class CustomTreeCtrl(CT.CustomTreeCtrl):
- """Wrapper around wx.lib.agw.customtreectrl to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- CT.CustomTreeCtrl.__init__(self, *args, **kwargs)
- def SetToolTip(self, tip):
- if wxPythonPhoenix:
- CT.CustomTreeCtrl.SetToolTip(self, tipString=tip)
- else:
- CT.CustomTreeCtrl.SetToolTipString(self, tip)
- class ToolBar(wx.ToolBar):
- """Wrapper around wx.ToolBar to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- wx.ToolBar.__init__(self, *args, **kwargs)
- def AddLabelTool(self, toolId, label, bitmap, bmpDisabled=wx.NullBitmap, kind=0,
- shortHelpString='', longHelpString='', clientData=None):
- if wxPythonPhoenix:
- return wx.ToolBar.AddTool(self, toolId=toolId, label=label, bitmap=bitmap, bmpDisabled=bmpDisabled,
- kind=kind, shortHelp=shortHelpString, longHelp=longHelpString,
- clientData=clientData)
- else:
- return wx.ToolBar.AddLabelTool(self, toolId, label, bitmap, bmpDisabled, kind,
- shortHelpString, longHelpString, clientData)
- def InsertLabelTool(self, pos, toolId, label, bitmap, bmpDisabled=wx.NullBitmap, kind=0,
- shortHelpString='', longHelpString='', clientData=None):
- if wxPythonPhoenix:
- return wx.ToolBar.InsertTool(self, pos, toolId=toolId, label=label, bitmap=bitmap, bmpDisabled=bmpDisabled,
- kind=kind, shortHelp=shortHelpString, longHelp=longHelpString,
- clientData=clientData)
- else:
- return wx.ToolBar.InsertLabelTool(self, pos, toolId, label, bitmap, bmpDisabled, kind,
- shortHelpString, longHelpString, clientData)
- class Menu(wx.Menu):
- """Wrapper around wx.Menu to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- wx.Menu.__init__(self, *args, **kwargs)
- def AppendItem(self, menuItem):
- if wxPythonPhoenix:
- wx.Menu.Append(self, menuItem=menuItem)
- else:
- wx.Menu.AppendItem(self, menuItem)
- def AppendMenu(self, id, text, submenu, help=""):
- if wxPythonPhoenix:
- wx.Menu.Append(self, id=id, item=text, subMenu=submenu, helpString=help)
- else:
- wx.Menu.AppendMenu(self, id=id, text=text, submenu=submenu, help=help)
- class DragImage(wx.GenericDragImage if wxPythonPhoenix else wx.DragImage):
- """Wrapper around wx.DragImage to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- super(DragImage, self).__init__(*args, **kwargs)
- class PseudoDC(wx.adv.PseudoDC if wxPythonPhoenix else wx.PseudoDC):
- """Wrapper around wx.PseudoDC to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- super(PseudoDC, self).__init__(*args, **kwargs)
- def DrawLinePoint(self, pt1, pt2):
- if wxPythonPhoenix:
- super(PseudoDC, self).DrawLine(pt1, pt2)
- else:
- super(PseudoDC, self).DrawLinePoint(pt1, pt2)
- def DrawRectangleRect(self, rect):
- if wxPythonPhoenix:
- super(PseudoDC, self).DrawRectangle(rect=rect)
- else:
- super(PseudoDC, self).DrawRectangleRect(rect)
- def BeginDrawing(self):
- if not wxPythonPhoenix:
- super(PseudoDC, self).BeginDrawing()
- def EndDrawing(self):
- if not wxPythonPhoenix:
- super(PseudoDC, self).EndDrawing()
- class ClientDC(wx.ClientDC):
- """Wrapper around wx.ClientDC to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- super(ClientDC, self).__init__(*args, **kwargs)
- def GetFullMultiLineTextExtent(self, string, font=None):
- if wxPythonPhoenix:
- return super(ClientDC, self).GetFullMultiLineTextExtent(string, font)
- else:
- return super(ClientDC, self).GetMultiLineTextExtent(string, font)
- class Rect(wx.Rect):
- """Wrapper around wx.Rect to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- wx.Rect.__init__(self, *args, **kwargs)
- def ContainsXY(self, x, y):
- if wxPythonPhoenix:
- return wx.Rect.Contains(self, x=x, y=y)
- else:
- return wx.Rect.ContainsXY(self, x, y)
- def ContainsRect(self, rect):
- if wxPythonPhoenix:
- return wx.Rect.Contains(self, rect=rect)
- else:
- return wx.Rect.ContainsRect(self, rect)
- def OffsetXY(self, dx, dy):
- if wxPythonPhoenix:
- return wx.Rect.Offset(self, dx, dy)
- else:
- return wx.Rect.OffsetXY(self, dx, dy)
- class CheckBox(wx.CheckBox):
- """Wrapper around wx.CheckBox to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- wx.CheckBox.__init__(self, *args, **kwargs)
- def SetToolTip(self, tip):
- if wxPythonPhoenix:
- wx.CheckBox.SetToolTip(self, tipString=tip)
- else:
- wx.CheckBox.SetToolTipString(self, tip)
- class Choice(wx.Choice):
- """Wrapper around wx.Choice to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- wx.Choice.__init__(self, *args, **kwargs)
- def SetToolTip(self, tip):
- if wxPythonPhoenix:
- wx.Choice.SetToolTip(self, tipString=tip)
- else:
- wx.Choice.SetToolTipString(self, tip)
- class TextEntryDialog(wx.TextEntryDialog):
- """Wrapper around wx.TextEntryDialog to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, parent, message, caption="Please enter text", value="",
- style=wx.OK | wx.CANCEL | wx.CENTRE, pos=wx.DefaultPosition):
- if wxPythonPhoenix:
- super(TextEntryDialog, self).__init__(parent=parent, message=message, caption=caption,
- value=value, style=style, pos=pos)
- else:
- super(TextEntryDialog, self).__init__(parent=parent, message=message, caption=caption,
- defaultValue=value, style=style, pos=pos)
- class ColourSelect(csel.ColourSelect):
- """Wrapper around wx.lib.colourselect.ColourSelect to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- csel.ColourSelect.__init__(self, *args, **kwargs)
- def SetToolTip(self, tip):
- if wxPythonPhoenix:
- csel.ColourSelect.SetToolTip(self, tipString=tip)
- else:
- csel.ColourSelect.SetToolTipString(self, tip)
- class ComboCtrl(wxComboCtrl):
- def __init__(self, *args, **kwargs):
- wxComboCtrl.__init__(self, *args, **kwargs)
- def SetToolTip(self, tip):
- if wxPythonPhoenix:
- wxComboCtrl.SetToolTip(self, tipString=tip)
- else:
- wxComboCtrl.SetToolTipString(self, tip)
- class Dialog(wx.Dialog):
- """Wrapper around wx.Dialog to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- wx.Dialog.__init__(self, *args, **kwargs)
- class Notebook(wx.Notebook):
- """Wrapper around NoteBook to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- wx.Notebook.__init__(self, *args, **kwargs)
- class OwnerDrawnComboBox(OwnerDrawnComboBox_):
- """Wrapper around OwnerDrawnComboBox to have more control
- over the widget on different platforms/wxpython versions"""
- ODCB_PAINTING_CONTROL = ODCB_PAINTING_CONTROL
- ODCB_PAINTING_SELECTED = ODCB_PAINTING_SELECTED
- def __init__(self, *args, **kwargs):
- OwnerDrawnComboBox_.__init__(self, *args, **kwargs)
- def SetToolTip(self, tip):
- if wxPythonPhoenix:
- OwnerDrawnComboBox_.SetToolTip(self, tipString=tip)
- else:
- OwnerDrawnComboBox_.SetToolTipString(self, tip)
- class BitmapComboBox(BitmapComboBox_):
- """Wrapper around BitmapComboBox to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- BitmapComboBox_.__init__(self, *args, **kwargs)
- def SetToolTip(self, tip):
- if wxPythonPhoenix:
- BitmapComboBox_.SetToolTip(self, tipString=tip)
- else:
- BitmapComboBox_.SetToolTipString(self, tip)
- class ScrolledPanel(scrolled.ScrolledPanel):
- """Wrapper around scrolled.ScrolledPanel to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- scrolled.ScrolledPanel.__init__(self, *args, **kwargs)
- def SetToolTip(self, tip):
- if wxPythonPhoenix:
- scrolled.ScrolledPanel.SetToolTip(self, tipString=tip)
- else:
- scrolled.ScrolledPanel.SetToolTipString(self, tip)
- class FileBrowseButton(filebrowse.FileBrowseButton):
- """Wrapper around filebrowse.FileBrowseButton to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- filebrowse.FileBrowseButton.__init__(self, *args, **kwargs)
- class DirBrowseButton(filebrowse.DirBrowseButton):
- """Wrapper around filebrowse.DirBrowseButton to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- filebrowse.DirBrowseButton.__init__(self, *args, **kwargs)
- class ExpandoTextCtrl(expando.ExpandoTextCtrl):
- """Wrapper around expando.ExpandoTextCtrl to have more control
- over the widget on different platforms/wxpython versions"""
- EVT_ETC_LAYOUT_NEEDED = expando.EVT_ETC_LAYOUT_NEEDED
- def __init__(self, *args, **kwargs):
- expando.ExpandoTextCtrl.__init__(self, *args, **kwargs)
- class ColourPickerCtrl(wx.ColourPickerCtrl):
- """Wrapper around wx.ColourPickerCtrl to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- wx.ColourPickerCtrl.__init__(self, *args, **kwargs)
- class ListBox(wx.ListBox):
- """Wrapper around wx.ListBox to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- wx.ListBox.__init__(self, *args, **kwargs)
- def SetToolTip(self, tip):
- if wxPythonPhoenix:
- wx.ListBox.SetToolTip(self, tipString=tip)
- else:
- wx.ListBox.SetToolTipString(self, tip)
- class HyperlinkCtrl(HyperlinkCtrl_):
- """Wrapper around HyperlinkCtrl to have more control
- over the widget on different platforms/wxpython versions"""
- HL_ALIGN_LEFT = HL_ALIGN_LEFT
- HL_CONTEXTMENU = HL_CONTEXTMENU
- def __init__(self, *args, **kwargs):
- HyperlinkCtrl_.__init__(self, *args, **kwargs)
- def SetToolTip(self, tip):
- if wxPythonPhoenix:
- HyperlinkCtrl_.SetToolTip(self, tipString=tip)
- else:
- HyperlinkCtrl_.SetToolTipString(self, tip)
- class ComboBox(wx.ComboBox):
- """Wrapper around wx.ComboBox to have more control
- over the widget on different platforms/wxpython versions"""
- def __init__(self, *args, **kwargs):
- wx.ComboBox.__init__(self, *args, **kwargs)
- def SetToolTip(self, tip):
- if wxPythonPhoenix:
- wx.ComboBox.SetToolTip(self, tipString=tip)
- else:
- wx.ComboBox.SetToolTipString(self, tip)
|