1""" 2@package gui_core.wrap 3 4@brief Core wrapped wxpython widgets 5 6Classes: 7 - wrap::GSpinCtrl 8 9 10(C) 2016 by the GRASS Development Team 11 12This program is free software under the GNU General Public License 13(>=v2). Read the file COPYING that comes with GRASS for details. 14 15@author Anna Petrasova <kratochanna gmail.com> 16""" 17 18import sys 19import wx 20import wx.lib.agw.floatspin as fs 21import wx.lib.colourselect as csel 22import wx.lib.filebrowsebutton as filebrowse 23import wx.lib.scrolledpanel as scrolled 24from wx.lib import expando 25from wx.lib import buttons 26try: 27 import wx.lib.agw.customtreectrl as CT 28except ImportError: 29 import wx.lib.customtreectrl as CT 30 31from core.globalvar import CheckWxVersion, gtk3, wxPythonPhoenix 32 33if wxPythonPhoenix: 34 import wx.adv 35 from wx.adv import OwnerDrawnComboBox as OwnerDrawnComboBox_ 36 from wx.adv import ODCB_PAINTING_CONTROL, ODCB_PAINTING_SELECTED 37 from wx.adv import BitmapComboBox as BitmapComboBox_ 38 from wx.adv import HyperlinkCtrl as HyperlinkCtrl_ 39 from wx.adv import HL_ALIGN_LEFT, HL_CONTEXTMENU 40 ComboPopup = wx.ComboPopup 41 wxComboCtrl = wx.ComboCtrl 42else: 43 import wx.combo 44 from wx.combo import OwnerDrawnComboBox as OwnerDrawnComboBox_ 45 from wx.combo import ODCB_PAINTING_CONTROL, ODCB_PAINTING_SELECTED 46 from wx.combo import BitmapComboBox as BitmapComboBox_ 47 from wx import HyperlinkCtrl as HyperlinkCtrl_ 48 from wx import HL_ALIGN_LEFT, HL_CONTEXTMENU 49 ComboPopup = wx.combo.ComboPopup 50 wxComboCtrl = wx.combo.ComboCtrl 51 52if wxPythonPhoenix and CheckWxVersion([4, 0, 3, 0]): 53 from wx import NewIdRef as NewId 54else: 55 from wx import NewId 56 57 58def BitmapFromImage(image, depth=-1): 59 if wxPythonPhoenix: 60 return wx.Bitmap(img=image, depth=depth) 61 else: 62 return wx.BitmapFromImage(image, depth=depth) 63 64 65def ImageFromBitmap(bitmap): 66 if wxPythonPhoenix: 67 return bitmap.ConvertToImage() 68 else: 69 return wx.ImageFromBitmap(bitmap) 70 71 72def EmptyBitmap(width, height, depth=-1): 73 if wxPythonPhoenix: 74 return wx.Bitmap(width=width, height=height, depth=depth) 75 else: 76 return wx.EmptyBitmap(width=width, height=height, depth=depth) 77 78 79def EmptyImage(width, height, clear=True): 80 if wxPythonPhoenix: 81 return wx.Image(width=width, height=height, clear=clear) 82 else: 83 return wx.EmptyImage(width=width, height=height, clear=clear) 84 85 86def StockCursor(cursorId): 87 if wxPythonPhoenix: 88 return wx.Cursor(cursorId=cursorId) 89 else: 90 return wx.StockCursor(cursorId) 91 92 93class Window(wx.Window): 94 """Wrapper around wx.Window to have more control 95 over the widget on different platforms/wxpython versions""" 96 def __init__(self, *args, **kwargs): 97 wx.Window.__init__(self, *args, **kwargs) 98 99 def SetToolTip(self, tip): 100 if wxPythonPhoenix: 101 if tip is None: 102 wx.Window.UnsetToolTip(self) 103 else: 104 wx.Window.SetToolTip(self, tipString=tip) 105 else: 106 if tip is None: 107 wx.Window.SetToolTip(self, tip) 108 else: 109 wx.Window.SetToolTipString(self, tip) 110 111 112class Panel(wx.Panel): 113 """Wrapper around wx.Panel to have more control 114 over the widget on different platforms/wxpython versions""" 115 def __init__(self, *args, **kwargs): 116 wx.Panel.__init__(self, *args, **kwargs) 117 118 def SetToolTip(self, tip): 119 if wxPythonPhoenix: 120 wx.Panel.SetToolTip(self, tipString=tip) 121 else: 122 wx.Panel.SetToolTipString(self, tip) 123 124 125class SpinCtrl(wx.SpinCtrl): 126 """Wrapper around wx.SpinCtrl to have more control 127 over the widget on different platforms""" 128 129 gtk3MinSize = 130 130 131 def __init__(self, *args, **kwargs): 132 if gtk3: 133 if 'size' in kwargs: 134 kwargs['size'] = wx.Size(max(self.gtk3MinSize, kwargs['size'][0]), kwargs['size'][1]) 135 else: 136 kwargs['size'] = wx.Size(self.gtk3MinSize, -1) 137 138 wx.SpinCtrl.__init__(self, *args, **kwargs) 139 140 def SetToolTip(self, tip): 141 if wxPythonPhoenix: 142 wx.SpinCtrl.SetToolTip(self, tipString=tip) 143 else: 144 wx.SpinCtrl.SetToolTipString(self, tip) 145 146 147class FloatSpin(fs.FloatSpin): 148 """Wrapper around fs.FloatSpin to have more control 149 over the widget on different platforms""" 150 151 gtk3MinSize = 130 152 153 def __init__(self, *args, **kwargs): 154 if gtk3: 155 if 'size' in kwargs: 156 kwargs['size'] = wx.Size(max(self.gtk3MinSize, kwargs['size'][0]), kwargs['size'][1]) 157 else: 158 kwargs['size'] = wx.Size(self.gtk3MinSize, -1) 159 160 fs.FloatSpin.__init__(self, *args, **kwargs) 161 162 def SetToolTip(self, tip): 163 if wxPythonPhoenix: 164 fs.FloatSpin.SetToolTip(self, tipString=tip) 165 else: 166 fs.FloatSpin.SetToolTipString(self, tip) 167 168 169class Button(wx.Button): 170 """Wrapper around wx.Button to have more control 171 over the widget on different platforms/wxpython versions""" 172 def __init__(self, *args, **kwargs): 173 wx.Button.__init__(self, *args, **kwargs) 174 175 def SetToolTip(self, tip): 176 if wxPythonPhoenix: 177 wx.Button.SetToolTip(self, tipString=tip) 178 else: 179 wx.Button.SetToolTipString(self, tip) 180 181 182class ClearButton(Button): 183 """Wrapper around a Button with stock id wx.ID_CLEAR, 184 to disable default key binding on certain platforms""" 185 def __init__(self, *args, **kwargs): 186 Button.__init__(self, *args, **kwargs) 187 self.SetId(wx.ID_CLEAR) 188 if sys.platform == "darwin": 189 self.SetLabel(_("Clear")) 190 else: 191 self.SetLabel(_("&Clear")) 192 193 194class CancelButton(Button): 195 """Wrapper around a Button with stock id wx.ID_CANCEL, to disable 196 default key binding on certain platforms/wxpython versions""" 197 def __init__(self, *args, **kwargs): 198 Button.__init__(self, *args, **kwargs) 199 self.SetId(wx.ID_CANCEL) 200 if sys.platform == "darwin" and not CheckWxVersion([4, 1, 0]): 201 self.SetLabel(_("Cancel")) 202 else: 203 self.SetLabel(_("&Cancel")) 204 205class CloseButton(Button): 206 """Wrapper around a Close labeled Button with stock id wx.ID_CANCEL 207 to disable default key binding on certain platforms/wxpython versions""" 208 def __init__(self, *args, **kwargs): 209 Button.__init__(self, *args, **kwargs) 210 self.SetId(wx.ID_CANCEL) 211 if sys.platform == "darwin" and not CheckWxVersion([4, 1, 0]): 212 self.SetLabel(_("Close")) 213 else: 214 self.SetLabel(_("&Close")) 215 216class ApplyButton(Button): 217 """Wrapper around a Button with stock id wx.ID_APPLY, 218 to disable default key binding on certain platforms""" 219 def __init__(self, *args, **kwargs): 220 Button.__init__(self, *args, **kwargs) 221 self.SetId(wx.ID_APPLY) 222 if sys.platform == "darwin": 223 self.SetLabel(_("Apply")) 224 else: 225 self.SetLabel(_("&Apply")) 226 227 228class RadioButton(wx.RadioButton): 229 """Wrapper around wx.RadioButton to have more control 230 over the widget on different platforms/wxpython versions""" 231 def __init__(self, *args, **kwargs): 232 wx.RadioButton.__init__(self, *args, **kwargs) 233 234 def SetToolTip(self, tip): 235 if wxPythonPhoenix: 236 wx.RadioButton.SetToolTip(self, tipString=tip) 237 else: 238 wx.RadioButton.SetToolTipString(self, tip) 239 240 241class BitmapButton(wx.BitmapButton): 242 """Wrapper around wx.BitmapButton to have more control 243 over the widget on different platforms/wxpython versions""" 244 def __init__(self, *args, **kwargs): 245 wx.BitmapButton.__init__(self, *args, **kwargs) 246 247 def SetToolTip(self, tip): 248 if wxPythonPhoenix: 249 wx.BitmapButton.SetToolTip(self, tipString=tip) 250 else: 251 wx.BitmapButton.SetToolTipString(self, tip) 252 253 254class GenBitmapButton(buttons.GenBitmapButton): 255 """Wrapper around GenBitmapButton to have more control 256 over the widget on different platforms/wxpython versions""" 257 def __init__(self, *args, **kwargs): 258 buttons.GenBitmapButton.__init__(self, *args, **kwargs) 259 260 def SetToolTip(self, tip): 261 if wxPythonPhoenix: 262 buttons.GenBitmapButton.SetToolTip(self, tipString=tip) 263 else: 264 buttons.GenBitmapButton.SetToolTipString(self, tip) 265 266 267class ToggleButton(wx.ToggleButton): 268 """Wrapper around wx.ToggleButton to have more control 269 over the widget on different platforms/wxpython versions""" 270 def __init__(self, *args, **kwargs): 271 wx.ToggleButton.__init__(self, *args, **kwargs) 272 273 def SetToolTip(self, tip): 274 if wxPythonPhoenix: 275 wx.ToggleButton.SetToolTip(self, tipString=tip) 276 else: 277 wx.ToggleButton.SetToolTipString(self, tip) 278 279 280class StaticText(wx.StaticText): 281 """Wrapper around wx.StaticText to have more control 282 over the widget on different platforms/wxpython versions""" 283 def __init__(self, *args, **kwargs): 284 wx.StaticText.__init__(self, *args, **kwargs) 285 286 def SetToolTip(self, tip): 287 if wxPythonPhoenix: 288 wx.StaticText.SetToolTip(self, tip) 289 else: 290 wx.StaticText.SetToolTipString(self, tip) 291 292 293class StaticBox(wx.StaticBox): 294 """Wrapper around wx.StaticBox to have more control 295 over the widget on different platforms/wxpython versions""" 296 def __init__(self, *args, **kwargs): 297 wx.StaticBox.__init__(self, *args, **kwargs) 298 299 def SetToolTip(self, tip): 300 if wxPythonPhoenix: 301 wx.StaticBox.SetToolTip(self, tipString=tip) 302 else: 303 wx.StaticBox.SetToolTipString(self, tip) 304 305 306class CheckListBox(wx.CheckListBox): 307 """Wrapper around wx.CheckListBox to have more control 308 over the widget on different platforms/wxpython versions""" 309 def __init__(self, *args, **kwargs): 310 wx.CheckListBox.__init__(self, *args, **kwargs) 311 312 def SetToolTip(self, tip): 313 if wxPythonPhoenix: 314 wx.CheckListBox.SetToolTip(self, tipString=tip) 315 else: 316 wx.CheckListBox.SetToolTipString(self, tip) 317 318 319class TextCtrl(wx.TextCtrl): 320 """Wrapper around wx.TextCtrl to have more control 321 over the widget on different platforms/wxpython versions""" 322 def __init__(self, *args, **kwargs): 323 wx.TextCtrl.__init__(self, *args, **kwargs) 324 325 def SetToolTip(self, tip): 326 if wxPythonPhoenix: 327 wx.TextCtrl.SetToolTip(self, tipString=tip) 328 else: 329 wx.TextCtrl.SetToolTipString(self, tip) 330 331 332class SearchCtrl(wx.SearchCtrl): 333 """Wrapper around wx.SearchCtrl to have more control 334 over the widget on different platforms/wxpython versions""" 335 def __init__(self, *args, **kwargs): 336 wx.SearchCtrl.__init__(self, *args, **kwargs) 337 338 def SetToolTip(self, tip): 339 if wxPythonPhoenix: 340 wx.SearchCtrl.SetToolTip(self, tipString=tip) 341 else: 342 wx.SearchCtrl.SetToolTipString(self, tip) 343 344 345class ListCtrl(wx.ListCtrl): 346 """Wrapper around wx.ListCtrl to have more control 347 over the widget on different platforms/wxpython versions""" 348 def __init__(self, *args, **kwargs): 349 wx.ListCtrl.__init__(self, *args, **kwargs) 350 351 def InsertItem(self, index, label, imageIndex=-1): 352 if wxPythonPhoenix: 353 return wx.ListCtrl.InsertItem(self, index=index, label=label, imageIndex=imageIndex) 354 else: 355 return wx.ListCtrl.InsertStringItem(self, index=index, label=label, imageIndex=imageIndex) 356 357 def SetItem(self, index, column, label, imageId=-1): 358 if wxPythonPhoenix: 359 return wx.ListCtrl.SetItem(self, index=index, column=column, label=label, imageId=imageId) 360 else: 361 return wx.ListCtrl.SetStringItem(self, index=index, col=column, label=label, imageId=imageId) 362 363 def CheckItem(self, item, check=True): 364 """Uses either deprecated listmix.CheckListCtrlMixin 365 or new checkbox implementation in wx.ListCtrl since 4.1.0""" 366 if hasattr(self, 'HasCheckBoxes'): 367 wx.ListCtrl.CheckItem(self, item, check) 368 else: 369 super(ListCtrl, self).CheckItem(item, check) 370 371 def IsItemChecked(self, item): 372 if hasattr(self, 'HasCheckBoxes'): 373 return wx.ListCtrl.IsItemChecked(self, item) 374 else: 375 return super(ListCtrl, self).IsChecked(item) 376 377 378if CheckWxVersion([4, 1, 0]): 379 class CheckListCtrlMixin(): 380 """This class pretends to be deprecated CheckListCtrlMixin mixin and 381 only enables checkboxes in new versions of ListCtrl""" 382 def __init__(self): 383 self.EnableCheckBoxes(True) 384 self.AssignImageList(wx.ImageList(16, 16), wx.IMAGE_LIST_SMALL) 385else: 386 import wx.lib.mixins.listctrl as listmix 387 class CheckListCtrlMixin(listmix.CheckListCtrlMixin): 388 """Wrapper for deprecated mixin""" 389 def __init__(self): 390 listmix.CheckListCtrlMixin.__init__(self) 391 392 393class TreeCtrl(wx.TreeCtrl): 394 """Wrapper around wx.TreeCtrl to have more control 395 over the widget on different platforms/wxpython versions""" 396 def __init__(self, *args, **kwargs): 397 wx.TreeCtrl.__init__(self, *args, **kwargs) 398 399 def AppendItem(self, parent, text, image=-1, selImage=-1, data=None): 400 if wxPythonPhoenix: 401 return wx.TreeCtrl.AppendItem(self, parent, text, image, selImage, data) 402 else: 403 return wx.TreeCtrl.AppendItem(self, parent, text, image, selImage, wx.TreeItemData(data)) 404 405 def GetItemData(self, item): 406 if wxPythonPhoenix: 407 return wx.TreeCtrl.GetItemData(self, item) 408 else: 409 return wx.TreeCtrl.GetPyData(self, item) 410 411 412class CustomTreeCtrl(CT.CustomTreeCtrl): 413 """Wrapper around wx.lib.agw.customtreectrl to have more control 414 over the widget on different platforms/wxpython versions""" 415 def __init__(self, *args, **kwargs): 416 CT.CustomTreeCtrl.__init__(self, *args, **kwargs) 417 418 def SetToolTip(self, tip): 419 if wxPythonPhoenix: 420 CT.CustomTreeCtrl.SetToolTip(self, tipString=tip) 421 else: 422 CT.CustomTreeCtrl.SetToolTipString(self, tip) 423 424 425class ToolBar(wx.ToolBar): 426 """Wrapper around wx.ToolBar to have more control 427 over the widget on different platforms/wxpython versions""" 428 def __init__(self, *args, **kwargs): 429 wx.ToolBar.__init__(self, *args, **kwargs) 430 431 def AddLabelTool(self, toolId, label, bitmap, bmpDisabled=wx.NullBitmap, kind=0, 432 shortHelpString='', longHelpString='', clientData=None): 433 if wxPythonPhoenix: 434 return wx.ToolBar.AddTool(self, toolId=toolId, label=label, bitmap=bitmap, bmpDisabled=bmpDisabled, 435 kind=kind, shortHelp=shortHelpString, longHelp=longHelpString, 436 clientData=clientData) 437 else: 438 return wx.ToolBar.AddLabelTool(self, toolId, label, bitmap, bmpDisabled, kind, 439 shortHelpString, longHelpString, clientData) 440 441 def InsertLabelTool(self, pos, toolId, label, bitmap, bmpDisabled=wx.NullBitmap, kind=0, 442 shortHelpString='', longHelpString='', clientData=None): 443 if wxPythonPhoenix: 444 return wx.ToolBar.InsertTool(self, pos, toolId=toolId, label=label, bitmap=bitmap, bmpDisabled=bmpDisabled, 445 kind=kind, shortHelp=shortHelpString, longHelp=longHelpString, 446 clientData=clientData) 447 else: 448 return wx.ToolBar.InsertLabelTool(self, pos, toolId, label, bitmap, bmpDisabled, kind, 449 shortHelpString, longHelpString, clientData) 450 451 452class Menu(wx.Menu): 453 """Wrapper around wx.Menu to have more control 454 over the widget on different platforms/wxpython versions""" 455 def __init__(self, *args, **kwargs): 456 wx.Menu.__init__(self, *args, **kwargs) 457 458 def AppendItem(self, menuItem): 459 if wxPythonPhoenix: 460 wx.Menu.Append(self, menuItem=menuItem) 461 else: 462 wx.Menu.AppendItem(self, menuItem) 463 464 def AppendMenu(self, id, text, submenu, help=""): 465 if wxPythonPhoenix: 466 wx.Menu.Append(self, id=id, item=text, subMenu=submenu, helpString=help) 467 else: 468 wx.Menu.AppendMenu(self, id=id, text=text, submenu=submenu, help=help) 469 470 471class DragImage(wx.GenericDragImage if wxPythonPhoenix else wx.DragImage): 472 """Wrapper around wx.DragImage to have more control 473 over the widget on different platforms/wxpython versions""" 474 def __init__(self, *args, **kwargs): 475 super(DragImage, self).__init__(*args, **kwargs) 476 477 478class PseudoDC(wx.adv.PseudoDC if wxPythonPhoenix else wx.PseudoDC): 479 """Wrapper around wx.PseudoDC to have more control 480 over the widget on different platforms/wxpython versions""" 481 def __init__(self, *args, **kwargs): 482 super(PseudoDC, self).__init__(*args, **kwargs) 483 484 def DrawLinePoint(self, pt1, pt2): 485 if wxPythonPhoenix: 486 super(PseudoDC, self).DrawLine(pt1, pt2) 487 else: 488 super(PseudoDC, self).DrawLinePoint(pt1, pt2) 489 490 def DrawRectangleRect(self, rect): 491 if wxPythonPhoenix: 492 super(PseudoDC, self).DrawRectangle(rect=rect) 493 else: 494 super(PseudoDC, self).DrawRectangleRect(rect) 495 496 def BeginDrawing(self): 497 if not wxPythonPhoenix: 498 super(PseudoDC, self).BeginDrawing() 499 500 def EndDrawing(self): 501 if not wxPythonPhoenix: 502 super(PseudoDC, self).EndDrawing() 503 504 505class ClientDC(wx.ClientDC): 506 """Wrapper around wx.ClientDC to have more control 507 over the widget on different platforms/wxpython versions""" 508 def __init__(self, *args, **kwargs): 509 super(ClientDC, self).__init__(*args, **kwargs) 510 511 def GetFullMultiLineTextExtent(self, string, font=None): 512 if wxPythonPhoenix: 513 return super(ClientDC, self).GetFullMultiLineTextExtent(string, font) 514 else: 515 return super(ClientDC, self).GetMultiLineTextExtent(string, font) 516 517 518class Rect(wx.Rect): 519 """Wrapper around wx.Rect to have more control 520 over the widget on different platforms/wxpython versions""" 521 def __init__(self, *args, **kwargs): 522 wx.Rect.__init__(self, *args, **kwargs) 523 524 def ContainsXY(self, x, y): 525 if wxPythonPhoenix: 526 return wx.Rect.Contains(self, x=x, y=y) 527 else: 528 return wx.Rect.ContainsXY(self, x, y) 529 530 def ContainsRect(self, rect): 531 if wxPythonPhoenix: 532 return wx.Rect.Contains(self, rect=rect) 533 else: 534 return wx.Rect.ContainsRect(self, rect) 535 536 def OffsetXY(self, dx, dy): 537 if wxPythonPhoenix: 538 return wx.Rect.Offset(self, dx, dy) 539 else: 540 return wx.Rect.OffsetXY(self, dx, dy) 541 542 543class CheckBox(wx.CheckBox): 544 """Wrapper around wx.CheckBox to have more control 545 over the widget on different platforms/wxpython versions""" 546 def __init__(self, *args, **kwargs): 547 wx.CheckBox.__init__(self, *args, **kwargs) 548 549 def SetToolTip(self, tip): 550 if wxPythonPhoenix: 551 wx.CheckBox.SetToolTip(self, tipString=tip) 552 else: 553 wx.CheckBox.SetToolTipString(self, tip) 554 555 556class Choice(wx.Choice): 557 """Wrapper around wx.Choice to have more control 558 over the widget on different platforms/wxpython versions""" 559 def __init__(self, *args, **kwargs): 560 wx.Choice.__init__(self, *args, **kwargs) 561 562 def SetToolTip(self, tip): 563 if wxPythonPhoenix: 564 wx.Choice.SetToolTip(self, tipString=tip) 565 else: 566 wx.Choice.SetToolTipString(self, tip) 567 568 569class TextEntryDialog(wx.TextEntryDialog): 570 """Wrapper around wx.TextEntryDialog to have more control 571 over the widget on different platforms/wxpython versions""" 572 def __init__(self, parent, message, caption="Please enter text", value="", 573 style=wx.OK | wx.CANCEL | wx.CENTRE, pos=wx.DefaultPosition): 574 if wxPythonPhoenix: 575 super(TextEntryDialog, self).__init__(parent=parent, message=message, caption=caption, 576 value=value, style=style, pos=pos) 577 else: 578 super(TextEntryDialog, self).__init__(parent=parent, message=message, caption=caption, 579 defaultValue=value, style=style, pos=pos) 580 581 582class ColourSelect(csel.ColourSelect): 583 """Wrapper around wx.lib.colourselect.ColourSelect to have more control 584 over the widget on different platforms/wxpython versions""" 585 def __init__(self, *args, **kwargs): 586 csel.ColourSelect.__init__(self, *args, **kwargs) 587 588 def SetToolTip(self, tip): 589 if wxPythonPhoenix: 590 csel.ColourSelect.SetToolTip(self, tipString=tip) 591 else: 592 csel.ColourSelect.SetToolTipString(self, tip) 593 594 595class ComboCtrl(wxComboCtrl): 596 def __init__(self, *args, **kwargs): 597 wxComboCtrl.__init__(self, *args, **kwargs) 598 599 def SetToolTip(self, tip): 600 if wxPythonPhoenix: 601 wxComboCtrl.SetToolTip(self, tipString=tip) 602 else: 603 wxComboCtrl.SetToolTipString(self, tip) 604 605 606class Dialog(wx.Dialog): 607 """Wrapper around wx.Dialog to have more control 608 over the widget on different platforms/wxpython versions""" 609 def __init__(self, *args, **kwargs): 610 wx.Dialog.__init__(self, *args, **kwargs) 611 612 613class Notebook(wx.Notebook): 614 """Wrapper around NoteBook to have more control 615 over the widget on different platforms/wxpython versions""" 616 def __init__(self, *args, **kwargs): 617 wx.Notebook.__init__(self, *args, **kwargs) 618 619 620class OwnerDrawnComboBox(OwnerDrawnComboBox_): 621 """Wrapper around OwnerDrawnComboBox to have more control 622 over the widget on different platforms/wxpython versions""" 623 ODCB_PAINTING_CONTROL = ODCB_PAINTING_CONTROL 624 ODCB_PAINTING_SELECTED = ODCB_PAINTING_SELECTED 625 626 def __init__(self, *args, **kwargs): 627 OwnerDrawnComboBox_.__init__(self, *args, **kwargs) 628 629 def SetToolTip(self, tip): 630 if wxPythonPhoenix: 631 OwnerDrawnComboBox_.SetToolTip(self, tipString=tip) 632 else: 633 OwnerDrawnComboBox_.SetToolTipString(self, tip) 634 635 636class BitmapComboBox(BitmapComboBox_): 637 """Wrapper around BitmapComboBox to have more control 638 over the widget on different platforms/wxpython versions""" 639 def __init__(self, *args, **kwargs): 640 BitmapComboBox_.__init__(self, *args, **kwargs) 641 642 def SetToolTip(self, tip): 643 if wxPythonPhoenix: 644 BitmapComboBox_.SetToolTip(self, tipString=tip) 645 else: 646 BitmapComboBox_.SetToolTipString(self, tip) 647 648 649class ScrolledPanel(scrolled.ScrolledPanel): 650 """Wrapper around scrolled.ScrolledPanel to have more control 651 over the widget on different platforms/wxpython versions""" 652 def __init__(self, *args, **kwargs): 653 scrolled.ScrolledPanel.__init__(self, *args, **kwargs) 654 655 def SetToolTip(self, tip): 656 if wxPythonPhoenix: 657 scrolled.ScrolledPanel.SetToolTip(self, tipString=tip) 658 else: 659 scrolled.ScrolledPanel.SetToolTipString(self, tip) 660 661 662class FileBrowseButton(filebrowse.FileBrowseButton): 663 """Wrapper around filebrowse.FileBrowseButton to have more control 664 over the widget on different platforms/wxpython versions""" 665 def __init__(self, *args, **kwargs): 666 filebrowse.FileBrowseButton.__init__(self, *args, **kwargs) 667 668 669class DirBrowseButton(filebrowse.DirBrowseButton): 670 """Wrapper around filebrowse.DirBrowseButton to have more control 671 over the widget on different platforms/wxpython versions""" 672 def __init__(self, *args, **kwargs): 673 filebrowse.DirBrowseButton.__init__(self, *args, **kwargs) 674 675 676class ExpandoTextCtrl(expando.ExpandoTextCtrl): 677 """Wrapper around expando.ExpandoTextCtrl to have more control 678 over the widget on different platforms/wxpython versions""" 679 EVT_ETC_LAYOUT_NEEDED = expando.EVT_ETC_LAYOUT_NEEDED 680 681 def __init__(self, *args, **kwargs): 682 expando.ExpandoTextCtrl.__init__(self, *args, **kwargs) 683 684 685class ColourPickerCtrl(wx.ColourPickerCtrl): 686 """Wrapper around wx.ColourPickerCtrl to have more control 687 over the widget on different platforms/wxpython versions""" 688 689 def __init__(self, *args, **kwargs): 690 wx.ColourPickerCtrl.__init__(self, *args, **kwargs) 691 692 693class ListBox(wx.ListBox): 694 """Wrapper around wx.ListBox to have more control 695 over the widget on different platforms/wxpython versions""" 696 697 def __init__(self, *args, **kwargs): 698 wx.ListBox.__init__(self, *args, **kwargs) 699 700 def SetToolTip(self, tip): 701 if wxPythonPhoenix: 702 wx.ListBox.SetToolTip(self, tipString=tip) 703 else: 704 wx.ListBox.SetToolTipString(self, tip) 705 706 707class HyperlinkCtrl(HyperlinkCtrl_): 708 """Wrapper around HyperlinkCtrl to have more control 709 over the widget on different platforms/wxpython versions""" 710 HL_ALIGN_LEFT = HL_ALIGN_LEFT 711 HL_CONTEXTMENU = HL_CONTEXTMENU 712 713 def __init__(self, *args, **kwargs): 714 HyperlinkCtrl_.__init__(self, *args, **kwargs) 715 716 def SetToolTip(self, tip): 717 if wxPythonPhoenix: 718 HyperlinkCtrl_.SetToolTip(self, tipString=tip) 719 else: 720 HyperlinkCtrl_.SetToolTipString(self, tip) 721 722 723class ComboBox(wx.ComboBox): 724 """Wrapper around wx.ComboBox to have more control 725 over the widget on different platforms/wxpython versions""" 726 727 def __init__(self, *args, **kwargs): 728 wx.ComboBox.__init__(self, *args, **kwargs) 729 730 def SetToolTip(self, tip): 731 if wxPythonPhoenix: 732 wx.ComboBox.SetToolTip(self, tipString=tip) 733 else: 734 wx.ComboBox.SetToolTipString(self, tip) 735