Changeset 4316
- Timestamp:
- 07/23/08 16:20:31 (1 month ago)
- Files:
-
- trunk/dabo/dPref.py (modified) (1 diff)
- trunk/dabo/ui/uiwx/dDateTextBox.py (modified) (1 diff)
- trunk/dabo/ui/uiwx/dDialog.py (modified) (3 diffs)
- trunk/dabo/ui/uiwx/dForm.py (modified) (5 diffs)
- trunk/dabo/ui/uiwx/dFormMixin.py (modified) (4 diffs)
- trunk/dabo/ui/uiwx/dKeys.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/dabo/dPref.py
r4314 r4316 425 425 else: 426 426 param = "%" 427 crs.execute(sql, param)427 crs.execute(sql, (param,)) 428 428 rs = crs.getDataSet() 429 429 vs = [itm.values()[0] for itm in rs] trunk/dabo/ui/uiwx/dDateTextBox.py
r4232 r4316 151 151 else: 152 152 key = {8: "h", 13: "m", 19: "s"}[evt.keyCode] 153 except KeyError:153 except (KeyError, AttributeError): 154 154 # spurious key event; ignore 155 155 return trunk/dabo/ui/uiwx/dDialog.py
r4294 r4316 9 9 from dabo.dLocalize import _ 10 10 import dFormMixin as fm 11 import dPemMixin as pm 11 12 from dabo.ui import makeDynamicProperty 12 13 … … 519 520 self._baseClass = dOkCancelDialog 520 521 522 523 521 524 class dYesNoDialog(dStandardButtonDialog): 522 525 def __init__(self, parent=None, properties=None, *args, **kwargs): … … 527 530 528 531 532 533 class _FloatDialog(dDialog): 534 def __init__(self, owner, *args, **kwargs): 535 self._above = None 536 self._owner = None 537 kwargs["Borderless"] = True 538 kwargs["FloatOnParent"] = True 539 super(_FloatDialog, self).__init__(*args, **kwargs) 540 541 542 def clear(self): 543 """Releases any controls remaining from a previous usage.""" 544 self.Sizer.clear(True) 545 546 547 def show(self): 548 # position by owner 549 if self.Owner is None: 550 self.Centered = True 551 else: 552 self.Centered = None 553 left, top = self.Owner.absoluteCoordinates() 554 self.Left = left 555 if self.Above: 556 self.Bottom = top 557 else: 558 self.Top = top + self.Owner.Height 559 # Make sure that we're within the display limits 560 maxW, maxH = dabo.ui.getDisplaySize() 561 self.Left = max(5, self.Left) 562 self.Top = max(5, self.Top) 563 self.Right = min(self.Right, maxW-5) 564 self.Bottom = min(self.Bottom, maxH-5) 565 super(_FloatDialog, self).show() 566 567 568 def _getAbove(self): 569 return self._above 570 571 def _setAbove(self, val): 572 if self._constructed(): 573 self._above = val 574 else: 575 self._properties["Above"] = val 576 577 578 def _getOwner(self): 579 return self._owner 580 581 def _setOwner(self, val): 582 if self._constructed(): 583 self._owner = val 584 else: 585 self._properties["Owner"] = val 586 587 588 Above = property(_getAbove, _setAbove, None, 589 _("Is this dialog positioned above its owner? Default=False (bool)")) 590 591 Owner = property(_getOwner, _setOwner, None, 592 _("Control which is currently managing this window. (varies)")) 593 594 595 596 597 598 599 600 529 601 if __name__ == "__main__": 530 602 import test trunk/dabo/ui/uiwx/dForm.py
r4230 r4316 14 14 15 15 16 class _FloatDialog(dDialog):17 def __init__(self, owner, *args, **kwargs):18 self._above = None19 self._owner = None20 kwargs["Borderless"] = True21 kwargs["FloatOnParent"] = True22 super(_FloatDialog, self).__init__(*args, **kwargs)23 24 25 def clear(self):26 """Releases any controls remaining from a previous usage."""27 self.Sizer.clear(True)28 29 30 def show(self):31 # position by owner32 if self.Owner is None:33 self.Centered = True34 else:35 self.Centered = None36 left, top = self.Owner.absoluteCoordinates()37 self.Left = left38 if self.Above:39 self.Bottom = top40 else:41 self.Top = top + self.Owner.Height42 # Make sure that we're within the display limits43 maxW, maxH = dabo.ui.getDisplaySize()44 self.Left = max(5, self.Left)45 self.Top = max(5, self.Top)46 self.Right = min(self.Right, maxW-5)47 self.Bottom = min(self.Bottom, maxH-5)48 super(_FloatDialog, self).show()49 50 51 def _getAbove(self):52 return self._above53 54 def _setAbove(self, val):55 if self._constructed():56 self._above = val57 else:58 self._properties["Above"] = val59 60 61 def _getOwner(self):62 return self._owner63 64 def _setOwner(self, val):65 if self._constructed():66 self._owner = val67 else:68 self._properties["Owner"] = val69 70 71 Above = property(_getAbove, _setAbove, None,72 _("Is this dialog positioned above its owner? Default=False (bool)"))73 74 Owner = property(_getOwner, _setOwner, None,75 _("Control which is currently managing this window. (varies)"))76 77 78 79 16 class BaseForm(fm.dFormMixin): 80 17 """Creates a bizobj-aware form. … … 86 23 self.bizobjs = {} 87 24 self._primaryBizobj = None 88 self._floatingPanel = None89 25 90 26 # If this is True, a panel will be automatically added to the … … 146 82 self.activeControlValid() 147 83 ret = self.confirmChanges() 148 if self._floatingPanel:149 self._floatingPanel.release()150 84 if ret: 151 85 ret = super(BaseForm, self)._beforeClose(evt) … … 863 797 864 798 865 def _getFloatingPanel(self):866 if not self._floatingPanel:867 self._floatingPanel = _FloatDialog(self)868 return self._floatingPanel869 870 871 799 def _getPrimaryBizobj(self): 872 800 """The attribute '_primaryBizobj' should be a bizobj, but due … … 928 856 box asking whether to save changes, discard changes, or cancel the 929 857 operation that led to the dialog being presented.""") ) 930 931 FloatingPanel = property(_getFloatingPanel, None, None,932 _("""Small modal dialog that is designed to be used for temporary displays,933 similar to context menus, but which can contain any controls.934 (read-only) (dDialog)"""))935 858 936 859 PrimaryBizobj = property(_getPrimaryBizobj, _setPrimaryBizobj, None, trunk/dabo/ui/uiwx/dFormMixin.py
r4213 r4316 23 23 # double-activation is no longer an issue. 24 24 self._skipActivate = (wx.VERSION < (2,7) and self.Application.Platform == "Win") 25 26 25 self._cxnFile = "" 27 26 self._cxnName = "" 28 27 self._connection = None 28 self._floatingPanel = None 29 29 30 # Extract the menu definition file, if any 30 31 self._menuBarFile = self._extractKey((properties, attProperties, kwargs), … … 363 364 hook method. 364 365 """ 366 if self._floatingPanel: 367 self._floatingPanel.release() 365 368 ret = self.beforeClose(evt) 366 369 return ret … … 659 662 def _setCxnName(self, val): 660 663 self._cxnName = val 664 665 666 def _getFloatingPanel(self): 667 if not self._floatingPanel: 668 # Have to import it here, as it requires that dFormMixin be defined. 669 from dDialog import _FloatDialog 670 self._floatingPanel = _FloatDialog(self) 671 return self._floatingPanel 661 672 662 673 … … 1022 1033 _("Name of the connection used for data access (str)")) 1023 1034 1035 FloatingPanel = property(_getFloatingPanel, None, None, 1036 _("""Small modal dialog that is designed to be used for temporary displays, 1037 similar to context menus, but which can contain any controls. 1038 (read-only) (dDialog)""")) 1039 1024 1040 FloatOnParent = property(_getFloatOnParent, _setFloatOnParent, None, 1025 1041 _("Specifies whether the form stays on top of the parent or not.")) trunk/dabo/ui/uiwx/dKeys.py
r4186 r4316 150 150 "cmd": mod_Cmd, 151 151 } 152 153 arrows = (key_Up, key_Down, key_Left, key_Right) 154 whitespace = (key_Tab, key_Space, key_Numpad_space, key_Numpad_tab) 152 155 153 156 ## pkm: I didn't include all the keycodes below - I want to see what is
