daboide Commit
Revision 401
Date: 2006-01-27 15:34:29 -0800 (Fri, 27 Jan 2006)
Author: paul
Changed:
U trunk/ReportDesigner.py
Log:
This fixes up the report designer to behave pretty much the same on Mac as on
Windows and Linux. Because of focus issues (nothing is getting the keyboard
focus because there aren't any text controls) I needed to add back the code in
dApp that intercepts the KeyDown.
Diff:
Modified: trunk/ReportDesigner.py
===================================================================
--- trunk/ReportDesigner.py 2006-01-27 21:58:02 UTC (rev 400)
+++ trunk/ReportDesigner.py 2006-01-27 23:34:29 UTC (rev 401)
@@ -21,7 +21,14 @@
def beforeInit(self):
self._inSelection = False
+ def afterInit(self):
+ if sys.platform == "darwin":
+ self.bindEvent(dEvents.KeyDown, self._onKeyDown)
+ def _onKeyDown(self, evt):
+ # Mac-specific behavior
+ self.ActiveEditor.onKeyDown(evt)
+
def newObject(self, typ):
"""Add a new object of the passed type to the selected
band."""
rf = self.ReportForm
@@ -842,15 +849,13 @@
self.updateSelected(evt)
- def onMouseRightDown(self, evt):
- # Need to use MouseRightDown instead of ContextMenu so that we
know if the
- # modifier keys are pressed in updateSelected().
- self.updateSelected(evt)
+ def onContextMenu(self, evt):
+ self.updateSelected()
self.showContextMenu(rdc.getContextMenu())
def onMouseLeftDoubleClick(self, evt):
- mouseObj = self.getMouseObject(evt.EventData["mousePosition"])
+ mouseObj = self.getMouseObject()
propName = None
for prop in ("expr",):
if prop in mouseObj.AvailableProps:
@@ -859,12 +864,13 @@
self._rd.editProperty(propName)
- def getMouseObject(self, mousePos):
- """Returns the topmost object underneath the passed mouse
position."""
+ def getMouseObject(self):
+ """Returns the topmost object underneath the mouse."""
rw = self.Parent._rw
objs = copy.copy(self.ReportObject.get("Objects", []))
objs.reverse() ## top of z order to bottom
mouseObj = self.ReportObject ## the band
+ mousePos = self.getMousePosition()
for obj in objs:
size, position = self.getObjSizeAndPosition(obj)
@@ -875,13 +881,12 @@
return mouseObj
- def updateSelected(self, evt):
- mousePos = evt.EventData["mousePosition"]
- mouseObj = self.getMouseObject(mousePos)
+ def updateSelected(self, evt=None):
+ mouseObj = self.getMouseObject()
selectedObjs = rdc.SelectedObjects
- if evt.EventData["controlDown"] or evt.EventData["shiftDown"]:
+ if evt and (evt.EventData["controlDown"] or
evt.EventData["shiftDown"]):
# toggle selection of the selObj
if mouseObj in selectedObjs:
selectedObjs.remove(mouseObj)
@@ -1301,20 +1306,6 @@
metaDown = evt.EventData["metaDown"]
key = keys[keyCode]
- # Mac: wants metaDown (or the scrollbar will scroll)
- ## --> actually, the scrollbar still scrolls, even though we
evt.stop()
- mac = metaDown
- win = True
- lin = True
-
- if "linux" in sys.platform:
- cond = lin
- elif "darwin" in sys.platform:
- cond = mac
- else:
- cond = win
-
-
if key == "tab" and (not ctrlDown and not altDown):
evt.stop()
selObj = []
@@ -1381,7 +1372,7 @@
break
self.editProperty(propName)
- elif cond and key != "enter":
+ elif key != "enter":
evt.stop() ## don't let the arrow key scroll the
window.
size, turbo = False, False
if shiftDown:
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev