dabo Commit
Revision 6536
Date: 2011-04-05 15:45:41 -0700 (Tue, 05 Apr 2011)
Author: Paul
Trac: http://trac.dabodev.com/changeset/6536

Changed:
U   trunk/ide/ReportDesigner.py

Log:
Enhanced the ReportDesigner by making Shift+Enter on an object activate the
propsheet editor for the currently selected property in the propsheet.

(Plain Enter has always activated the propsheet editor for the object's
MajorProperty - this makes it so I can edit a bunch of x values, for example,
without the propsheet jumping off the property every time.)

This would work for shift+double-click if the shift+click hadn't already 
deselected the object. We need to somehow fix the double-click event to have
a chance to fire *before* deciding it is just a single click, but that is
at the Dabo level.


Diff:
Modified: trunk/ide/ReportDesigner.py
===================================================================
--- trunk/ide/ReportDesigner.py 2011-04-05 22:18:02 UTC (rev 6535)
+++ trunk/ide/ReportDesigner.py 2011-04-05 22:45:41 UTC (rev 6536)
@@ -105,11 +105,12 @@
                        return expr
 
 
-               def objectDoubleClicked(self, obj):
+               def objectDoubleClicked(self, obj, evt=None):
                        """A report object was double-clicked: edit its major 
property in the propsheet."""
-                       prop = getattr(obj, "MajorProperty", None)
-                       if prop is not None:
-                               self.editProperty(obj.MajorProperty)
+                       editProp = obj.MajorProperty
+                       if evt.EventData["shiftDown"]:
+                               editProp = None
+                       rdc.editProperty(editProp)
 
 
                def editProperty(self, prop=None):
@@ -333,23 +334,24 @@
                        if refresh:
                                ps.refreshSelection()
 
-                       if prop:
-                               pg = ps.propGrid
-                               ds = pg.DataSet
+                       pg = ps.propGrid
+                       ds = pg.DataSet
 
-                               if enableEditor:
-                                       # Select the value column and enable 
the editor for the prop. Note:
-                                       # This needs to be done before changing 
rows, for some reason, or the
-                                       # editor column isn't activated.
-                                       pg.CurrentColumn = 1
+                       if enableEditor:
+                               # Select the value column and enable the editor 
for the prop. Note:
+                               # This needs to be done before changing rows, 
for some reason, or the
+                               # editor column isn't activated.
+                               pg.CurrentColumn = 1
 
+                       pg._focusBack = focusBack
+                       if prop:
                                # Put the propsheet on the row for the passed 
prop.
                                for idx, record in enumerate(ds):
                                        if record["prop"].lower() == 
prop.lower():
                                                pg.CurrentRow = idx
-                                               pg._focusBack = focusBack
                                                break
-
+                       else:
+                               pg.CurrentRow = pg.CurrentRow
                        if bringToTop:
                                ps.Form.Raise()
 
@@ -774,7 +776,7 @@
 
        def onMouseLeftDoubleClick(self, evt):
                node = evt.EventData["selectedNode"][0]
-               rdc.objectDoubleClicked(node.Object)
+               rdc.objectDoubleClicked(node.Object, evt)
 
        def onContextMenu(self, evt):
                evt.stop()
@@ -1073,7 +1075,7 @@
 
 
        def onMouseLeftDoubleClick(self, evt):
-               rdc.objectDoubleClicked(self.Parent.ReportObject)
+               rdc.objectDoubleClicked(self.Parent.ReportObject, evt)
 
 
        def onPaint(self, evt):
@@ -1164,7 +1166,7 @@
 
 
        def onMouseLeftDoubleClick(self, evt):
-               rdc.objectDoubleClicked(self.getMouseObject())
+               rdc.objectDoubleClicked(self.getMouseObject(), evt)
 
 
        def onMouseMove(self, evt):
@@ -1778,14 +1780,11 @@
 
                if key == "enter":
                        # Bring the prop sheet to top and activate the editor 
for the
-                       # most appropriate property for the selected object(s).
+                       # most appropriate property for the selected object(s), 
or if 
+                       # shift is down, activate the editor for the current 
row in the
+                       # prop sheet.
                        evt.stop()
-                       propName = None
-                       for prop in ("expr",):
-                               if prop in selectedDrawables[0].AvailableProps:
-                                       propName = prop
-                                       break
-                       rdc.editProperty(propName)
+                       rdc.objectDoubleClicked(selectedDrawables[0], evt)
 
                else:
                        ## arrow key



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to