wrap.py 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  1. """
  2. @package gui_core.wrap
  3. @brief Core wrapped wxpython widgets
  4. Classes:
  5. - wrap::GSpinCtrl
  6. (C) 2016 by the GRASS Development Team
  7. This program is free software under the GNU General Public License
  8. (>=v2). Read the file COPYING that comes with GRASS for details.
  9. @author Anna Petrasova <kratochanna gmail.com>
  10. """
  11. import wx
  12. import wx.lib.agw.floatspin as fs
  13. import wx.lib.colourselect as csel
  14. import wx.lib.filebrowsebutton as filebrowse
  15. import wx.lib.scrolledpanel as scrolled
  16. from wx.lib import expando
  17. from wx.lib import buttons
  18. try:
  19. import wx.lib.agw.customtreectrl as CT
  20. except ImportError:
  21. import wx.lib.customtreectrl as CT
  22. from core.globalvar import CheckWxVersion, gtk3, wxPythonPhoenix
  23. if wxPythonPhoenix:
  24. import wx.adv
  25. from wx.adv import OwnerDrawnComboBox as OwnerDrawnComboBox_
  26. from wx.adv import ODCB_PAINTING_CONTROL, ODCB_PAINTING_SELECTED
  27. from wx.adv import BitmapComboBox as BitmapComboBox_
  28. from wx.adv import HyperlinkCtrl as HyperlinkCtrl_
  29. from wx.adv import HL_ALIGN_LEFT, HL_CONTEXTMENU
  30. ComboPopup = wx.ComboPopup
  31. wxComboCtrl = wx.ComboCtrl
  32. else:
  33. import wx.combo
  34. from wx.combo import OwnerDrawnComboBox as OwnerDrawnComboBox_
  35. from wx.combo import ODCB_PAINTING_CONTROL, ODCB_PAINTING_SELECTED
  36. from wx.combo import BitmapComboBox as BitmapComboBox_
  37. from wx import HyperlinkCtrl as HyperlinkCtrl_
  38. from wx import HL_ALIGN_LEFT, HL_CONTEXTMENU
  39. ComboPopup = wx.combo.ComboPopup
  40. wxComboCtrl = wx.combo.ComboCtrl
  41. if wxPythonPhoenix and CheckWxVersion([4, 0, 3, 0]):
  42. from wx import NewIdRef as NewId
  43. else:
  44. from wx import NewId
  45. def BitmapFromImage(image, depth=-1):
  46. if wxPythonPhoenix:
  47. return wx.Bitmap(img=image, depth=depth)
  48. else:
  49. return wx.BitmapFromImage(image, depth=depth)
  50. def ImageFromBitmap(bitmap):
  51. if wxPythonPhoenix:
  52. return bitmap.ConvertToImage()
  53. else:
  54. return wx.ImageFromBitmap(bitmap)
  55. def EmptyBitmap(width, height, depth=-1):
  56. if wxPythonPhoenix:
  57. return wx.Bitmap(width=width, height=height, depth=depth)
  58. else:
  59. return wx.EmptyBitmap(width=width, height=height, depth=depth)
  60. def EmptyImage(width, height, clear=True):
  61. if wxPythonPhoenix:
  62. return wx.Image(width=width, height=height, clear=clear)
  63. else:
  64. return wx.EmptyImage(width=width, height=height, clear=clear)
  65. def StockCursor(cursorId):
  66. if wxPythonPhoenix:
  67. return wx.Cursor(cursorId=cursorId)
  68. else:
  69. return wx.StockCursor(cursorId)
  70. class Window(wx.Window):
  71. """Wrapper around wx.Window to have more control
  72. over the widget on different platforms/wxpython versions"""
  73. def __init__(self, *args, **kwargs):
  74. wx.Window.__init__(self, *args, **kwargs)
  75. def SetToolTip(self, tip):
  76. if wxPythonPhoenix:
  77. if tip is None:
  78. wx.Window.UnsetToolTip(self)
  79. else:
  80. wx.Window.SetToolTip(self, tipString=tip)
  81. else:
  82. if tip is None:
  83. wx.Window.SetToolTip(self, tip)
  84. else:
  85. wx.Window.SetToolTipString(self, tip)
  86. class Panel(wx.Panel):
  87. """Wrapper around wx.Panel to have more control
  88. over the widget on different platforms/wxpython versions"""
  89. def __init__(self, *args, **kwargs):
  90. wx.Panel.__init__(self, *args, **kwargs)
  91. def SetToolTip(self, tip):
  92. if wxPythonPhoenix:
  93. wx.Panel.SetToolTip(self, tipString=tip)
  94. else:
  95. wx.Panel.SetToolTipString(self, tip)
  96. class SpinCtrl(wx.SpinCtrl):
  97. """Wrapper around wx.SpinCtrl to have more control
  98. over the widget on different platforms"""
  99. gtk3MinSize = 130
  100. def __init__(self, *args, **kwargs):
  101. if gtk3:
  102. if 'size' in kwargs:
  103. kwargs['size'] = wx.Size(max(self.gtk3MinSize, kwargs['size'][0]), kwargs['size'][1])
  104. else:
  105. kwargs['size'] = wx.Size(self.gtk3MinSize, -1)
  106. wx.SpinCtrl.__init__(self, *args, **kwargs)
  107. def SetToolTip(self, tip):
  108. if wxPythonPhoenix:
  109. wx.SpinCtrl.SetToolTip(self, tipString=tip)
  110. else:
  111. wx.SpinCtrl.SetToolTipString(self, tip)
  112. class FloatSpin(fs.FloatSpin):
  113. """Wrapper around fs.FloatSpin to have more control
  114. over the widget on different platforms"""
  115. gtk3MinSize = 130
  116. def __init__(self, *args, **kwargs):
  117. if gtk3:
  118. if 'size' in kwargs:
  119. kwargs['size'] = wx.Size(max(self.gtk3MinSize, kwargs['size'][0]), kwargs['size'][1])
  120. else:
  121. kwargs['size'] = wx.Size(self.gtk3MinSize, -1)
  122. fs.FloatSpin.__init__(self, *args, **kwargs)
  123. def SetToolTip(self, tip):
  124. if wxPythonPhoenix:
  125. fs.FloatSpin.SetToolTip(self, tipString=tip)
  126. else:
  127. fs.FloatSpin.SetToolTipString(self, tip)
  128. class Button(wx.Button):
  129. """Wrapper around wx.Button to have more control
  130. over the widget on different platforms/wxpython versions"""
  131. def __init__(self, *args, **kwargs):
  132. wx.Button.__init__(self, *args, **kwargs)
  133. def SetToolTip(self, tip):
  134. if wxPythonPhoenix:
  135. wx.Button.SetToolTip(self, tipString=tip)
  136. else:
  137. wx.Button.SetToolTipString(self, tip)
  138. class RadioButton(wx.RadioButton):
  139. """Wrapper around wx.RadioButton to have more control
  140. over the widget on different platforms/wxpython versions"""
  141. def __init__(self, *args, **kwargs):
  142. wx.RadioButton.__init__(self, *args, **kwargs)
  143. def SetToolTip(self, tip):
  144. if wxPythonPhoenix:
  145. wx.RadioButton.SetToolTip(self, tipString=tip)
  146. else:
  147. wx.RadioButton.SetToolTipString(self, tip)
  148. class BitmapButton(wx.BitmapButton):
  149. """Wrapper around wx.BitmapButton to have more control
  150. over the widget on different platforms/wxpython versions"""
  151. def __init__(self, *args, **kwargs):
  152. wx.BitmapButton.__init__(self, *args, **kwargs)
  153. def SetToolTip(self, tip):
  154. if wxPythonPhoenix:
  155. wx.BitmapButton.SetToolTip(self, tipString=tip)
  156. else:
  157. wx.BitmapButton.SetToolTipString(self, tip)
  158. class GenBitmapButton(buttons.GenBitmapButton):
  159. """Wrapper around GenBitmapButton to have more control
  160. over the widget on different platforms/wxpython versions"""
  161. def __init__(self, *args, **kwargs):
  162. buttons.GenBitmapButton.__init__(self, *args, **kwargs)
  163. def SetToolTip(self, tip):
  164. if wxPythonPhoenix:
  165. buttons.GenBitmapButton.SetToolTip(self, tipString=tip)
  166. else:
  167. buttons.GenBitmapButton.SetToolTipString(self, tip)
  168. class ToggleButton(wx.ToggleButton):
  169. """Wrapper around wx.ToggleButton to have more control
  170. over the widget on different platforms/wxpython versions"""
  171. def __init__(self, *args, **kwargs):
  172. wx.ToggleButton.__init__(self, *args, **kwargs)
  173. def SetToolTip(self, tip):
  174. if wxPythonPhoenix:
  175. wx.ToggleButton.SetToolTip(self, tipString=tip)
  176. else:
  177. wx.ToggleButton.SetToolTipString(self, tip)
  178. class StaticText(wx.StaticText):
  179. """Wrapper around wx.StaticText to have more control
  180. over the widget on different platforms/wxpython versions"""
  181. def __init__(self, *args, **kwargs):
  182. wx.StaticText.__init__(self, *args, **kwargs)
  183. def SetToolTip(self, tip):
  184. if wxPythonPhoenix:
  185. wx.StaticText.SetToolTip(self, tipString=tip)
  186. else:
  187. wx.StaticText.SetToolTipString(self, tip)
  188. class StaticBox(wx.StaticBox):
  189. """Wrapper around wx.StaticBox to have more control
  190. over the widget on different platforms/wxpython versions"""
  191. def __init__(self, *args, **kwargs):
  192. wx.StaticBox.__init__(self, *args, **kwargs)
  193. def SetToolTip(self, tip):
  194. if wxPythonPhoenix:
  195. wx.StaticBox.SetToolTip(self, tipString=tip)
  196. else:
  197. wx.StaticBox.SetToolTipString(self, tip)
  198. class CheckListBox(wx.CheckListBox):
  199. """Wrapper around wx.CheckListBox to have more control
  200. over the widget on different platforms/wxpython versions"""
  201. def __init__(self, *args, **kwargs):
  202. wx.CheckListBox.__init__(self, *args, **kwargs)
  203. def SetToolTip(self, tip):
  204. if wxPythonPhoenix:
  205. wx.CheckListBox.SetToolTip(self, tipString=tip)
  206. else:
  207. wx.CheckListBox.SetToolTipString(self, tip)
  208. class TextCtrl(wx.TextCtrl):
  209. """Wrapper around wx.TextCtrl to have more control
  210. over the widget on different platforms/wxpython versions"""
  211. def __init__(self, *args, **kwargs):
  212. wx.TextCtrl.__init__(self, *args, **kwargs)
  213. def SetToolTip(self, tip):
  214. if wxPythonPhoenix:
  215. wx.TextCtrl.SetToolTip(self, tipString=tip)
  216. else:
  217. wx.TextCtrl.SetToolTipString(self, tip)
  218. class SearchCtrl(wx.SearchCtrl):
  219. """Wrapper around wx.SearchCtrl to have more control
  220. over the widget on different platforms/wxpython versions"""
  221. def __init__(self, *args, **kwargs):
  222. wx.SearchCtrl.__init__(self, *args, **kwargs)
  223. def SetToolTip(self, tip):
  224. if wxPythonPhoenix:
  225. wx.SearchCtrl.SetToolTip(self, tipString=tip)
  226. else:
  227. wx.SearchCtrl.SetToolTipString(self, tip)
  228. class ListCtrl(wx.ListCtrl):
  229. """Wrapper around wx.ListCtrl to have more control
  230. over the widget on different platforms/wxpython versions"""
  231. def __init__(self, *args, **kwargs):
  232. wx.ListCtrl.__init__(self, *args, **kwargs)
  233. def InsertItem(self, index, label, imageIndex=-1):
  234. if wxPythonPhoenix:
  235. return wx.ListCtrl.InsertItem(self, index=index, label=label, imageIndex=imageIndex)
  236. else:
  237. return wx.ListCtrl.InsertStringItem(self, index=index, label=label, imageIndex=imageIndex)
  238. def SetItem(self, index, column, label, imageId=-1):
  239. if wxPythonPhoenix:
  240. return wx.ListCtrl.SetItem(self, index=index, column=column, label=label, imageId=imageId)
  241. else:
  242. return wx.ListCtrl.SetStringItem(self, index=index, col=column, label=label, imageId=imageId)
  243. def CheckItem(self, item, check=True):
  244. """Uses either deprecated listmix.CheckListCtrlMixin
  245. or new checkbox implementation in wx.ListCtrl since 4.1.0"""
  246. if hasattr(self, 'HasCheckBoxes'):
  247. wx.ListCtrl.CheckItem(self, item, check)
  248. else:
  249. super(ListCtrl, self).CheckItem(item, check)
  250. def IsItemChecked(self, item):
  251. if hasattr(self, 'HasCheckBoxes'):
  252. return wx.ListCtrl.IsItemChecked(self, item)
  253. else:
  254. return super(ListCtrl, self).IsChecked(item)
  255. if CheckWxVersion([4, 1, 0]):
  256. class CheckListCtrlMixin():
  257. """This class pretends to be deprecated CheckListCtrlMixin mixin and
  258. only enables checkboxes in new versions of ListCtrl"""
  259. def __init__(self):
  260. self.EnableCheckBoxes(True)
  261. self.AssignImageList(wx.ImageList(16, 16), wx.IMAGE_LIST_SMALL)
  262. else:
  263. import wx.lib.mixins.listctrl as listmix
  264. class CheckListCtrlMixin(listmix.CheckListCtrlMixin):
  265. """Wrapper for deprecated mixin"""
  266. def __init__(self):
  267. listmix.CheckListCtrlMixin.__init__(self)
  268. class TreeCtrl(wx.TreeCtrl):
  269. """Wrapper around wx.TreeCtrl to have more control
  270. over the widget on different platforms/wxpython versions"""
  271. def __init__(self, *args, **kwargs):
  272. wx.TreeCtrl.__init__(self, *args, **kwargs)
  273. def AppendItem(self, parent, text, image=-1, selImage=-1, data=None):
  274. if wxPythonPhoenix:
  275. return wx.TreeCtrl.AppendItem(self, parent, text, image, selImage, data)
  276. else:
  277. return wx.TreeCtrl.AppendItem(self, parent, text, image, selImage, wx.TreeItemData(data))
  278. def GetItemData(self, item):
  279. if wxPythonPhoenix:
  280. return wx.TreeCtrl.GetItemData(self, item)
  281. else:
  282. return wx.TreeCtrl.GetPyData(self, item)
  283. class CustomTreeCtrl(CT.CustomTreeCtrl):
  284. """Wrapper around wx.lib.agw.customtreectrl to have more control
  285. over the widget on different platforms/wxpython versions"""
  286. def __init__(self, *args, **kwargs):
  287. CT.CustomTreeCtrl.__init__(self, *args, **kwargs)
  288. def SetToolTip(self, tip):
  289. if wxPythonPhoenix:
  290. CT.CustomTreeCtrl.SetToolTip(self, tipString=tip)
  291. else:
  292. CT.CustomTreeCtrl.SetToolTipString(self, tip)
  293. class ToolBar(wx.ToolBar):
  294. """Wrapper around wx.ToolBar to have more control
  295. over the widget on different platforms/wxpython versions"""
  296. def __init__(self, *args, **kwargs):
  297. wx.ToolBar.__init__(self, *args, **kwargs)
  298. def AddLabelTool(self, toolId, label, bitmap, bmpDisabled=wx.NullBitmap, kind=0,
  299. shortHelpString='', longHelpString='', clientData=None):
  300. if wxPythonPhoenix:
  301. return wx.ToolBar.AddTool(self, toolId=toolId, label=label, bitmap=bitmap, bmpDisabled=bmpDisabled,
  302. kind=kind, shortHelp=shortHelpString, longHelp=longHelpString,
  303. clientData=clientData)
  304. else:
  305. return wx.ToolBar.AddLabelTool(self, toolId, label, bitmap, bmpDisabled, kind,
  306. shortHelpString, longHelpString, clientData)
  307. def InsertLabelTool(self, pos, toolId, label, bitmap, bmpDisabled=wx.NullBitmap, kind=0,
  308. shortHelpString='', longHelpString='', clientData=None):
  309. if wxPythonPhoenix:
  310. return wx.ToolBar.InsertTool(self, pos, toolId=toolId, label=label, bitmap=bitmap, bmpDisabled=bmpDisabled,
  311. kind=kind, shortHelp=shortHelpString, longHelp=longHelpString,
  312. clientData=clientData)
  313. else:
  314. return wx.ToolBar.InsertLabelTool(self, pos, toolId, label, bitmap, bmpDisabled, kind,
  315. shortHelpString, longHelpString, clientData)
  316. class Menu(wx.Menu):
  317. """Wrapper around wx.Menu to have more control
  318. over the widget on different platforms/wxpython versions"""
  319. def __init__(self, *args, **kwargs):
  320. wx.Menu.__init__(self, *args, **kwargs)
  321. def AppendItem(self, menuItem):
  322. if wxPythonPhoenix:
  323. wx.Menu.Append(self, menuItem=menuItem)
  324. else:
  325. wx.Menu.AppendItem(self, menuItem)
  326. def AppendMenu(self, id, text, submenu, help=""):
  327. if wxPythonPhoenix:
  328. wx.Menu.Append(self, id=id, item=text, subMenu=submenu, helpString=help)
  329. else:
  330. wx.Menu.AppendMenu(self, id=id, text=text, submenu=submenu, help=help)
  331. class DragImage(wx.GenericDragImage if wxPythonPhoenix else wx.DragImage):
  332. """Wrapper around wx.DragImage to have more control
  333. over the widget on different platforms/wxpython versions"""
  334. def __init__(self, *args, **kwargs):
  335. super(DragImage, self).__init__(*args, **kwargs)
  336. class PseudoDC(wx.adv.PseudoDC if wxPythonPhoenix else wx.PseudoDC):
  337. """Wrapper around wx.PseudoDC to have more control
  338. over the widget on different platforms/wxpython versions"""
  339. def __init__(self, *args, **kwargs):
  340. super(PseudoDC, self).__init__(*args, **kwargs)
  341. def DrawLinePoint(self, pt1, pt2):
  342. if wxPythonPhoenix:
  343. super(PseudoDC, self).DrawLine(pt1, pt2)
  344. else:
  345. super(PseudoDC, self).DrawLinePoint(pt1, pt2)
  346. def DrawRectangleRect(self, rect):
  347. if wxPythonPhoenix:
  348. super(PseudoDC, self).DrawRectangle(rect=rect)
  349. else:
  350. super(PseudoDC, self).DrawRectangleRect(rect)
  351. def BeginDrawing(self):
  352. if not wxPythonPhoenix:
  353. super(PseudoDC, self).BeginDrawing()
  354. def EndDrawing(self):
  355. if not wxPythonPhoenix:
  356. super(PseudoDC, self).EndDrawing()
  357. class ClientDC(wx.ClientDC):
  358. """Wrapper around wx.ClientDC to have more control
  359. over the widget on different platforms/wxpython versions"""
  360. def __init__(self, *args, **kwargs):
  361. super(ClientDC, self).__init__(*args, **kwargs)
  362. def GetFullMultiLineTextExtent(self, string, font=None):
  363. if wxPythonPhoenix:
  364. return super(ClientDC, self).GetFullMultiLineTextExtent(string, font)
  365. else:
  366. return super(ClientDC, self).GetMultiLineTextExtent(string, font)
  367. class Rect(wx.Rect):
  368. """Wrapper around wx.Rect to have more control
  369. over the widget on different platforms/wxpython versions"""
  370. def __init__(self, *args, **kwargs):
  371. wx.Rect.__init__(self, *args, **kwargs)
  372. def ContainsXY(self, x, y):
  373. if wxPythonPhoenix:
  374. return wx.Rect.Contains(self, x=x, y=y)
  375. else:
  376. return wx.Rect.ContainsXY(self, x, y)
  377. def ContainsRect(self, rect):
  378. if wxPythonPhoenix:
  379. return wx.Rect.Contains(self, rect=rect)
  380. else:
  381. return wx.Rect.ContainsRect(self, rect)
  382. def OffsetXY(self, dx, dy):
  383. if wxPythonPhoenix:
  384. return wx.Rect.Offset(self, dx, dy)
  385. else:
  386. return wx.Rect.OffsetXY(self, dx, dy)
  387. class CheckBox(wx.CheckBox):
  388. """Wrapper around wx.CheckBox to have more control
  389. over the widget on different platforms/wxpython versions"""
  390. def __init__(self, *args, **kwargs):
  391. wx.CheckBox.__init__(self, *args, **kwargs)
  392. def SetToolTip(self, tip):
  393. if wxPythonPhoenix:
  394. wx.CheckBox.SetToolTip(self, tipString=tip)
  395. else:
  396. wx.CheckBox.SetToolTipString(self, tip)
  397. class Choice(wx.Choice):
  398. """Wrapper around wx.Choice to have more control
  399. over the widget on different platforms/wxpython versions"""
  400. def __init__(self, *args, **kwargs):
  401. wx.Choice.__init__(self, *args, **kwargs)
  402. def SetToolTip(self, tip):
  403. if wxPythonPhoenix:
  404. wx.Choice.SetToolTip(self, tipString=tip)
  405. else:
  406. wx.Choice.SetToolTipString(self, tip)
  407. class TextEntryDialog(wx.TextEntryDialog):
  408. """Wrapper around wx.TextEntryDialog to have more control
  409. over the widget on different platforms/wxpython versions"""
  410. def __init__(self, parent, message, caption="Please enter text", value="",
  411. style=wx.OK | wx.CANCEL | wx.CENTRE, pos=wx.DefaultPosition):
  412. if wxPythonPhoenix:
  413. super(TextEntryDialog, self).__init__(parent=parent, message=message, caption=caption,
  414. value=value, style=style, pos=pos)
  415. else:
  416. super(TextEntryDialog, self).__init__(parent=parent, message=message, caption=caption,
  417. defaultValue=value, style=style, pos=pos)
  418. class ColourSelect(csel.ColourSelect):
  419. """Wrapper around wx.lib.colourselect.ColourSelect to have more control
  420. over the widget on different platforms/wxpython versions"""
  421. def __init__(self, *args, **kwargs):
  422. csel.ColourSelect.__init__(self, *args, **kwargs)
  423. def SetToolTip(self, tip):
  424. if wxPythonPhoenix:
  425. csel.ColourSelect.SetToolTip(self, tipString=tip)
  426. else:
  427. csel.ColourSelect.SetToolTipString(self, tip)
  428. class ComboCtrl(wxComboCtrl):
  429. def __init__(self, *args, **kwargs):
  430. wxComboCtrl.__init__(self, *args, **kwargs)
  431. def SetToolTip(self, tip):
  432. if wxPythonPhoenix:
  433. wxComboCtrl.SetToolTip(self, tipString=tip)
  434. else:
  435. wxComboCtrl.SetToolTipString(self, tip)
  436. class Dialog(wx.Dialog):
  437. """Wrapper around wx.Dialog to have more control
  438. over the widget on different platforms/wxpython versions"""
  439. def __init__(self, *args, **kwargs):
  440. wx.Dialog.__init__(self, *args, **kwargs)
  441. class Notebook(wx.Notebook):
  442. """Wrapper around NoteBook to have more control
  443. over the widget on different platforms/wxpython versions"""
  444. def __init__(self, *args, **kwargs):
  445. wx.Notebook.__init__(self, *args, **kwargs)
  446. class OwnerDrawnComboBox(OwnerDrawnComboBox_):
  447. """Wrapper around OwnerDrawnComboBox to have more control
  448. over the widget on different platforms/wxpython versions"""
  449. ODCB_PAINTING_CONTROL = ODCB_PAINTING_CONTROL
  450. ODCB_PAINTING_SELECTED = ODCB_PAINTING_SELECTED
  451. def __init__(self, *args, **kwargs):
  452. OwnerDrawnComboBox_.__init__(self, *args, **kwargs)
  453. def SetToolTip(self, tip):
  454. if wxPythonPhoenix:
  455. OwnerDrawnComboBox_.SetToolTip(self, tipString=tip)
  456. else:
  457. OwnerDrawnComboBox_.SetToolTipString(self, tip)
  458. class BitmapComboBox(BitmapComboBox_):
  459. """Wrapper around BitmapComboBox to have more control
  460. over the widget on different platforms/wxpython versions"""
  461. def __init__(self, *args, **kwargs):
  462. BitmapComboBox_.__init__(self, *args, **kwargs)
  463. def SetToolTip(self, tip):
  464. if wxPythonPhoenix:
  465. BitmapComboBox_.SetToolTip(self, tipString=tip)
  466. else:
  467. BitmapComboBox_.SetToolTipString(self, tip)
  468. class ScrolledPanel(scrolled.ScrolledPanel):
  469. """Wrapper around scrolled.ScrolledPanel to have more control
  470. over the widget on different platforms/wxpython versions"""
  471. def __init__(self, *args, **kwargs):
  472. scrolled.ScrolledPanel.__init__(self, *args, **kwargs)
  473. def SetToolTip(self, tip):
  474. if wxPythonPhoenix:
  475. scrolled.ScrolledPanel.SetToolTip(self, tipString=tip)
  476. else:
  477. scrolled.ScrolledPanel.SetToolTipString(self, tip)
  478. class FileBrowseButton(filebrowse.FileBrowseButton):
  479. """Wrapper around filebrowse.FileBrowseButton to have more control
  480. over the widget on different platforms/wxpython versions"""
  481. def __init__(self, *args, **kwargs):
  482. filebrowse.FileBrowseButton.__init__(self, *args, **kwargs)
  483. class DirBrowseButton(filebrowse.DirBrowseButton):
  484. """Wrapper around filebrowse.DirBrowseButton to have more control
  485. over the widget on different platforms/wxpython versions"""
  486. def __init__(self, *args, **kwargs):
  487. filebrowse.DirBrowseButton.__init__(self, *args, **kwargs)
  488. class ExpandoTextCtrl(expando.ExpandoTextCtrl):
  489. """Wrapper around expando.ExpandoTextCtrl to have more control
  490. over the widget on different platforms/wxpython versions"""
  491. EVT_ETC_LAYOUT_NEEDED = expando.EVT_ETC_LAYOUT_NEEDED
  492. def __init__(self, *args, **kwargs):
  493. expando.ExpandoTextCtrl.__init__(self, *args, **kwargs)
  494. class ColourPickerCtrl(wx.ColourPickerCtrl):
  495. """Wrapper around wx.ColourPickerCtrl to have more control
  496. over the widget on different platforms/wxpython versions"""
  497. def __init__(self, *args, **kwargs):
  498. wx.ColourPickerCtrl.__init__(self, *args, **kwargs)
  499. class ListBox(wx.ListBox):
  500. """Wrapper around wx.ListBox to have more control
  501. over the widget on different platforms/wxpython versions"""
  502. def __init__(self, *args, **kwargs):
  503. wx.ListBox.__init__(self, *args, **kwargs)
  504. def SetToolTip(self, tip):
  505. if wxPythonPhoenix:
  506. wx.ListBox.SetToolTip(self, tipString=tip)
  507. else:
  508. wx.ListBox.SetToolTipString(self, tip)
  509. class HyperlinkCtrl(HyperlinkCtrl_):
  510. """Wrapper around HyperlinkCtrl to have more control
  511. over the widget on different platforms/wxpython versions"""
  512. HL_ALIGN_LEFT = HL_ALIGN_LEFT
  513. HL_CONTEXTMENU = HL_CONTEXTMENU
  514. def __init__(self, *args, **kwargs):
  515. HyperlinkCtrl_.__init__(self, *args, **kwargs)
  516. def SetToolTip(self, tip):
  517. if wxPythonPhoenix:
  518. HyperlinkCtrl_.SetToolTip(self, tipString=tip)
  519. else:
  520. HyperlinkCtrl_.SetToolTipString(self, tip)
  521. class ComboBox(wx.ComboBox):
  522. """Wrapper around wx.ComboBox to have more control
  523. over the widget on different platforms/wxpython versions"""
  524. def __init__(self, *args, **kwargs):
  525. wx.ComboBox.__init__(self, *args, **kwargs)
  526. def SetToolTip(self, tip):
  527. if wxPythonPhoenix:
  528. wx.ComboBox.SetToolTip(self, tipString=tip)
  529. else:
  530. wx.ComboBox.SetToolTipString(self, tip)