daboide Commit
Revision 415
Date: 2006-01-30 17:38:07 -0800 (Mon, 30 Jan 2006)
Author: ed

Changed:
U   trunk/Designer.py
U   trunk/DesignerComponents.py

Log:
Added cut/copy/paste methods to LayoutGridSizer. 

Added a missing call to Tree.select() that was preventing some updates to the 
Designer from updating the currently selected node in the tree.


Diff:
Modified: trunk/Designer.py
===================================================================
--- trunk/Designer.py   2006-01-31 00:56:56 UTC (rev 414)
+++ trunk/Designer.py   2006-01-31 01:38:07 UTC (rev 415)
@@ -351,7 +351,11 @@
                                        szCont.setItemProps(itm, sizerInfoDict)
                                if kids:
                                        for kid in kids:
-                                               row, col = 
eval(kid["attributes"].get("rowColPos"))
+                                               rowCol = 
kid["attributes"].get("rowColPos")
+                                               if isinstance(rowCol, tuple):
+                                                       row, col = rowCol
+                                               else:
+                                                       row, col = 
eval(kid["attributes"].get("rowColPos"))
                                                # Set the LayoutPanel to the 
'source' object
                                                pnl = self._srcObj = 
sz.getItemByRowCol(row, col)
                                                # Pass the 'kid' as a list, 
since that's what 
@@ -363,7 +367,10 @@
                                # An actual control!
                                if szr:
                                        if isinstance(szr, LayoutGridSizer):
-                                               row, col = eval(rowColAtts)
+                                               if isinstance(rowColAtts, 
tuple):
+                                                       row, col = rowColAtts
+                                               else:
+                                                       row, col = 
eval(rowColAtts)
                                                self._srcObj = 
szr.getItemByRowCol(row, col)
                                props = {}
                                newClass = dui.__dict__[cls]
@@ -631,6 +638,7 @@
                        except dabo.ui.deadObjectException:
                                self._selection.remove(ct)              
                self.Tree.updateDisplay(self.currentForm)
+               self.Tree.select(self._selection)
                self.PemForm.select(self._selection)
                self.EditorForm.select(self._selection)
                
@@ -655,6 +663,7 @@
                ff = dui.getFile("cdxml")
                if ff:
                        self.openClass(ff)
+                       dabo.ui.callAfter(self.updateLayout)
 
 
        def onSaveRunnable(self, evt):

Modified: trunk/DesignerComponents.py
===================================================================
--- trunk/DesignerComponents.py 2006-01-31 00:56:56 UTC (rev 414)
+++ trunk/DesignerComponents.py 2006-01-31 01:38:07 UTC (rev 415)
@@ -490,10 +490,7 @@
                szitVals = self.getItemProps(itm)
                self.remove(obj)
                lp = LayoutPanel(prnt, AutoSizer=False)
-               if isinstance(self, dabo.ui.dGridSizer):
-                       self.append(lp, "x", row=pos[0], col=pos[1])
-               else:
-                       self.insert(pos, lp)
+               self.insert(pos, lp)
                newSzit = lp.ControllingSizerItem
                self.setItemProps(newSzit, szitVals)
                if isinstance(obj, (LayoutSizerMixin, LayoutGridSizer)):
@@ -773,6 +770,48 @@
                return ret
 
 
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+       def onCut(self, evt):
+               """Place a copy of this sizer on the app clipboard,
+               and then delete the sizer
+               """
+               self.Application.copyObject(self)
+               if self.ControllingSizer is not None:
+                       self.ControllingSizer.delete(self)
+               else:
+                       self.release(True)
+               dabo.ui.callAfter(self.Application.updateLayout)
+               
+
+       def onCopy(self, evt):
+               """Place a copy of this control on the app clipboard"""
+               self.Application.copyObject(self)
+               
+
+       def onPaste(self, evt):
+               self.Form.app.pasteObject(self)
+               
+               
+       def delete(self, obj):
+               """Delete the specified object."""
+               itm = obj.ControllingSizerItem
+               prnt = obj.Parent
+               pos = obj.getPositionInSizer()
+               # Store all the sizer settings
+               szitVals = self.getItemProps(itm)
+               self.remove(obj)
+               lp = LayoutPanel(prnt, AutoSizer=False)
+               self.append(lp, "x", row=pos[0], col=pos[1])
+               newSzit = lp.ControllingSizerItem
+               self.setItemProps(newSzit, szitVals)
+               if isinstance(obj, (LayoutSizerMixin, LayoutGridSizer)):
+                       dabo.ui.callAfter(obj.release, True)
+               else:
+                       dabo.ui.callAfter(obj.release)
+               dabo.ui.callAfter(self.Application.updateLayout)
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+
        def _getDesEvents(self):
                return []
 




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Reply via email to