[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue-designer src/base/TemplateParser.py src/ba...
From: |
Jason Cater |
Subject: |
gnue-designer src/base/TemplateParser.py src/ba... |
Date: |
Tue, 12 Aug 2003 18:45:13 -0400 |
CVSROOT: /cvsroot/gnue
Module name: gnue-designer
Branch:
Changes by: Jason Cater <address@hidden> 03/08/12 18:45:13
Modified files:
src/base : TemplateParser.py ToolBar.py
src/forms : WizardRunner.py
src/forms/LayoutEditor: LayoutEditor.py LayoutEditorTools.py
WidgetHandler.py
Added files:
images : tb_reorder-24x24.png tb_select-24x24.png
src/forms/LayoutEditor: ReorderFocus.py WidgetFocusTab.py
Log message:
* Added support for layouteditor "modes" (i.e., Reorder Focus Order,
Select/Modify , Add Widget mode, etc) with corresponding icons
* Started on support for reordering focus order/tab stops.
* Mouse clicks on a widget that it doesn't understand are passed
through to the grid's mouse handler
* lots of cleanup
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-designer/images/tb_reorder-24x24.png?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-designer/images/tb_select-24x24.png?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-designer/src/base/TemplateParser.py.diff?tr1=1.34&tr2=1.35&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-designer/src/base/ToolBar.py.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-designer/src/forms/WizardRunner.py.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-designer/src/forms/LayoutEditor/ReorderFocus.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-designer/src/forms/LayoutEditor/WidgetFocusTab.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-designer/src/forms/LayoutEditor/LayoutEditor.py.diff?tr1=1.93&tr2=1.94&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-designer/src/forms/LayoutEditor/LayoutEditorTools.py.diff?tr1=1.28&tr2=1.29&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-designer/src/forms/LayoutEditor/WidgetHandler.py.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
Patches:
Index: gnue-designer/src/base/TemplateParser.py
diff -c gnue-designer/src/base/TemplateParser.py:1.34
gnue-designer/src/base/TemplateParser.py:1.35
*** gnue-designer/src/base/TemplateParser.py:1.34 Mon Jun 9 20:40:13 2003
--- gnue-designer/src/base/TemplateParser.py Tue Aug 12 18:45:13 2003
***************
*** 149,154 ****
--- 149,157 ----
return completed
+ def cancel(self):
+ self.wizard.EndModal(0)
+
class WizardPage(wxPanel):
def __init__(self, parser, parent):
***************
*** 307,313 ****
if self.parser.template.variables.has_key(object.variable):
o.set(self.parser.template.variables[object.variable])
!
# Add our buttons to the focus list
if self.prevStep:
self.textctrlList.append(self.parser.prevButton)
--- 310,316 ----
if self.parser.template.variables.has_key(object.variable):
o.set(self.parser.template.variables[object.variable])
!
# Add our buttons to the focus list
if self.prevStep:
self.textctrlList.append(self.parser.prevButton)
***************
*** 574,580 ****
self.OnSelectRight(None)
!
def OnRemove(self, event):
sel = list(self.list2.GetSelections())
sel.sort(lambda a,b : cmp (b,a))
--- 577,583 ----
self.OnSelectRight(None)
!
def OnRemove(self, event):
sel = list(self.list2.GetSelections())
sel.sort(lambda a,b : cmp (b,a))
***************
*** 632,650 ****
self.template = template
self.instance = instance
instance.registerEventListeners(
! { 'Wizard:%s' % template['BaseID']: self.run } )
! def run(self, event):
self.instance.dispatchEvent('BeginWizard', template=self.template)
self.instance.dispatchEvent('BeginUndoGroup')
! TemplateParser(self.instance, self.instance.rootObject,
! self.instance, self.template).run()
self.instance.dispatchEvent('EndUndoGroup')
! self.instance.dispatchEvent(Event('EndWizard', template=self.template))
def finalize(self):
pass
-
class WrappedStaticText(wxStaticText):
def __init__(self, parent, id, label, width, *args, **params):
--- 635,657 ----
self.template = template
self.instance = instance
instance.registerEventListeners(
! { 'Wizard:%s' % template['BaseID']: self.run,
! 'Cancel:Wizard:%s' % template['BaseID']: self.cancel } )
! def run(self, event, *args, **parms):
self.instance.dispatchEvent('BeginWizard', template=self.template)
self.instance.dispatchEvent('BeginUndoGroup')
! self.parser = TemplateParser(self.instance, self.instance.rootObject,
! self.instance, self.template)
! self.parser.run(*args, **parms)
self.instance.dispatchEvent('EndUndoGroup')
! self.instance.dispatchEvent('EndWizard', template=self.template)
!
! def cancel(self, event=None):
! self.parser.cancel()
def finalize(self):
pass
class WrappedStaticText(wxStaticText):
def __init__(self, parent, id, label, width, *args, **params):
Index: gnue-designer/src/base/ToolBar.py
diff -c gnue-designer/src/base/ToolBar.py:1.6
gnue-designer/src/base/ToolBar.py:1.7
*** gnue-designer/src/base/ToolBar.py:1.6 Mon Jun 16 23:13:51 2003
--- gnue-designer/src/base/ToolBar.py Tue Aug 12 18:45:13 2003
***************
*** 61,67 ****
if not len(type):
self.AddSeparator()
else:
! handle, image = string.split(type,',',1)
help=""
## help = self.instance.menubar.getEventHelp(handle)
--- 61,69 ----
if not len(type):
self.AddSeparator()
else:
! handle, image = string.split(type,',',1)
!
!
help=""
## help = self.instance.menubar.getEventHelp(handle)
***************
*** 93,104 ****
#
# Cheer up any previously depressed toolbuttons
#
! for key in self.mapping.keys():
! try:
! self.ToggleTool(int(key),0)
! except ValueError:
! pass
- self.ToggleTool(event.GetId(),0)
handle = self.mapping[event.GetId()]
! self.instance.dispatchEvent(handle)
--- 95,113 ----
#
# Cheer up any previously depressed toolbuttons
#
! # for key in self.mapping.keys():
! # try:
! # self.ToggleTool(int(key),0)
! # except ValueError:
! # pass
!
handle = self.mapping[event.GetId()]
! state = self.GetToolState(event.GetId())
! self.ToggleTool(event.GetId(),0)
! if not state:
! evt = 'Cancel:%s' % handle
! else:
! evt = handle
!
! self.instance.dispatchEvent(evt)
Index: gnue-designer/src/forms/LayoutEditor/LayoutEditor.py
diff -c gnue-designer/src/forms/LayoutEditor/LayoutEditor.py:1.93
gnue-designer/src/forms/LayoutEditor/LayoutEditor.py:1.94
*** gnue-designer/src/forms/LayoutEditor/LayoutEditor.py:1.93 Tue Jul 15
18:21:15 2003
--- gnue-designer/src/forms/LayoutEditor/LayoutEditor.py Tue Aug 12
18:45:13 2003
***************
*** 44,50 ****
from WidgetHandler import WidgetHandler
from PropertyBar import PropertyBar
from DisplayDropTarget import DisplayDropTarget
!
class LayoutEditor (ToolBase):
--- 44,50 ----
from WidgetHandler import WidgetHandler
from PropertyBar import PropertyBar
from DisplayDropTarget import DisplayDropTarget
! from ReorderFocus import ReorderFocus
class LayoutEditor (ToolBase):
***************
*** 91,96 ****
--- 91,97 ----
self._currentObject = None
self.mode = 'move'
+ self.reorderfocus = ReorderFocus(self.instance)
# Internal mouse states... used by OnMotion, etc
self.__drawing = 0
***************
*** 107,112 ****
--- 108,120 ----
'ObjectDeleted' : self.onDeleteObject,
'LayoutEditor:ZoomIn' : self.zoomIn,
'LayoutEditor:ZoomOut': self.zoomOut,
+ 'LayoutEditor:FocusOrder': self.beginFocusOrder,
+ 'Cancel:LayoutEditor:FocusOrder': self.endFocusOrder,
+ 'LayoutEditor:Prepositioning':
self.beginPrePositioningTemplate,
+ 'Cancel:LayoutEditor:Prepositioning':
self.cancelPrePositioningTemplate,
+ 'LayoutEditor:Select': self.beginSelectMode,
+ 'Cancel:LayoutEditor:Select': self.cancelSelectMode,
+ 'EndWizard': self.endWizard,
})
self.instance.rootObject.walk (self.inventoryObject)
***************
*** 115,121 ****
except KeyError:
pass
-
## Stuff needed by UIwxpython
self._pageList = [] # Needed by UIwxpython
--- 123,128 ----
***************
*** 502,512 ****
self.__OnGridSize(None)
def OnLeftDown(self, event):
- # Save starting coordinates for cross-selection box
x, y = event.GetPositionTuple()
self.__drawing = 1
self.__cx = cx = int(x / self.gridWidth)
self.__cy = cy = int(y / self.gridHeight)
--- 509,523 ----
self.__OnGridSize(None)
def OnLeftDown(self, event):
x, y = event.GetPositionTuple()
+ self.handleLeftDown(x,y)
+ event.Skip()
+
+ def handleLeftDown(self, x, y):
self.__drawing = 1
+ # Save starting coordinates for cross-selection box
self.__cx = cx = int(x / self.gridWidth)
self.__cy = cy = int(y / self.gridHeight)
***************
*** 518,524 ****
self.__y = y
self.__ox = None
self.__oy = None
- event.Skip()
# Used by the dragging routines to draw a selection box
--- 529,534 ----
***************
*** 562,568 ****
--- 572,583 ----
def OnLeftUp(self, event):
+ x, y = event.GetPositionTuple()
+ self.handleLeftUp(x,y)
+ event.Skip()
+
+ def handleLeftUp(self, x, y):
selection = []
self.setFeedback('')
***************
*** 576,582 ****
self.__drawing = 0
# Set x1,y1 to be smaller coordinates, and x2,y2 to be larger
- x, y = event.GetPositionTuple()
x1, x2 = order(int(self.__x / self.gridWidth), int(x / self.gridWidth))
y1, y2 = order(int(self.__y / self.gridHeight),int(y / self.gridHeight))
--- 591,596 ----
***************
*** 587,594 ****
areaSelected = (x1 <> x2 or y1 <> y2)
- event.Skip()
-
if self.mode == 'move':
if areaSelected:
# We are selecting an area
--- 601,606 ----
***************
*** 633,638 ****
--- 645,651 ----
def OnRightUp(self, event):
## self.toolbar.resetTool(self.mode)
self.mode = 'move'
+ self.dispatchEvent('LayoutEditor:Select')
x, y = event.GetPositionTuple()
***************
*** 731,753 ****
break
-
- def startPrePositioningTemplate(self, template):
- self.mode = 'positioning'
- ##self.panel.SetCursor(wxCROSS_CURSOR)
- wxSetCursor(wxCROSS_CURSOR)
- self.__template = template
-
-
- def endPrePositioningTemplate(self, x, y, width=None, height=None):
- self.mode = 'move'
- TemplateParser(self.instance, self.instance.rootObject,
- self.instance, self.__template, currentObject=self.block or
self.page).run(x=x, y=y,
- width=width,
- height=height)
- self.instance.dispatchEvent(Event('EndWizard', template=self.__template))
-
-
def zoomIn(self, event):
size = UIwxpython.getPointSize()
if size < 72:
--- 744,749 ----
***************
*** 772,777 ****
--- 768,840 ----
self.setFeedback(_('Cannot adjust point size to less than 6pt'))
+ def beginPrePositioningTemplate(self, event):
+ mode = self.mode
+ self.mode = 'positioning'
+ if mode == 'move':
+ self.dispatchEvent('Cancel:LayoutEditor:Select')
+ elif mode == 'refocus':
+ self.dispatchEvent('Cancel:LayoutEditor:FocusOrder')
+
+ ##self.panel.SetCursor(wxCROSS_CURSOR)
+ wxSetCursor(wxCROSS_CURSOR)
+ self.__wizardrunner = event.wizardrunner
+
+ def cancelPrePositioningTemplate(self, event=None):
+ if self.mode == 'prepositioning':
+ self.__wizardrunner.cancel()
+ wxSetCursor(wxSTANDARD_CURSOR)
+
+ def endPrePositioningTemplate(self, x, y, width=None, height=None):
+ self.mode = 'move'
+ self.dispatchEvent('Cancel:LayoutEditor:Prepositioning')
+ self.dispatchEvent('LayoutEditor:Select')
+ self.__wizardrunner.positioned_run(x=x, y=y, width=width, height=height)
+
+
+ def beginFocusOrder(self, event):
+ mode = self.mode
+ self.mode = 'refocus'
+ if mode == 'move':
+ event.dispatchAfter('Cancel:LayoutEditor:Select')
+ elif mode == 'positioning':
+ self.__wizardrunner.cancel()
+ # Yes, you are reading this right...
+ # I'm triggering the exact event that
+ # triggered this method. Blame it on
+ # the Tuesday night atmospheric crack
+ # levels.
+ self.dispatchEvent('LayoutEditor:FocusOrder')
+ return
+
+ self.reorderfocus.start(self.page)
+
+ def endFocusOrder(self, event):
+ self.reorderfocus.end()
+ if self.mode == 'refocus':
+ self.mode = 'move'
+ self.dispatchEvent('LayoutEditor:Select')
+
+ def beginSelectMode(self, event=None):
+ mode = self.mode
+ self.mode = 'move'
+ if mode == 'refocus':
+ self.dispatchEvent('Cancel:LayoutEditor:FocusOrder')
+ elif mode == 'positioning':
+ self.dispatchEvent('Cancel:LayoutEditor:Prepositioning')
+
+ def cancelSelectMode(self, event=None):
+ if self.mode == 'move':
+ event.dispatchAfter('LayoutEditor:Select')
+
+ def endWizard(self, event=None):
+ mode = self.mode
+ self.mode = 'move'
+ if mode == 'refocus':
+ self.dispatchEvent('Cancel:LayoutEditor:FocusOrder')
+ elif mode == 'positioning':
+ self.dispatchEvent('Cancel:LayoutEditor:Prepositioning')
+ self.dispatchEvent('LayoutEditor:Select')
class PrepositioningTimer(wxTimer):
def __init__(self, method, *args, **params):
Index: gnue-designer/src/forms/LayoutEditor/LayoutEditorTools.py
diff -c gnue-designer/src/forms/LayoutEditor/LayoutEditorTools.py:1.28
gnue-designer/src/forms/LayoutEditor/LayoutEditorTools.py:1.29
*** gnue-designer/src/forms/LayoutEditor/LayoutEditorTools.py:1.28 Thu Jul
10 19:44:03 2003
--- gnue-designer/src/forms/LayoutEditor/LayoutEditorTools.py Tue Aug 12
18:45:13 2003
***************
*** 29,35 ****
from gnue.designer.base.ToolBar import BaseToolBar
! ToolbarMapping = 'Wizard:AddBlock,wizard_block;' \
+ 'Wizard:AddPage,wizard_page;' \
+ ';' \
+ 'Wizard:AddLabel,wizard_label;' \
--- 29,38 ----
from gnue.designer.base.ToolBar import BaseToolBar
! ToolbarMapping = 'LayoutEditor:Select,tb_select;' \
! + 'LayoutEditor:FocusOrder,tb_reorder;' \
! + ';' \
! + 'Wizard:AddBlock,wizard_block;' \
+ 'Wizard:AddPage,wizard_page;' \
+ ';' \
+ 'Wizard:AddLabel,wizard_label;' \
***************
*** 41,54 ****
ToolbarMapping2 = 'LayoutEditor:ZoomIn,tb_zoom_in;' \
+ 'LayoutEditor:ZoomOut,tb_zoom_out;;' \
! + 'Forms:AutoResizePage,tb_resize;'
class LayoutEditorTools(BaseToolBar):
def init(self):
self.registerEventListeners( {'BeginWizard' : self.onBeginWizard,
! 'EndWizard' : self.onEndWizard } )
self.addToolbarMapping(ToolbarMapping)
self.AddSeparator()
--- 44,61 ----
ToolbarMapping2 = 'LayoutEditor:ZoomIn,tb_zoom_in;' \
+ 'LayoutEditor:ZoomOut,tb_zoom_out;;' \
! + 'Forms:AutoResizePage,tb_resize;' \
class LayoutEditorTools(BaseToolBar):
def init(self):
self.registerEventListeners( {'BeginWizard' : self.onBeginWizard,
! 'EndWizard' : self.onEndWizard,
! 'LayoutEditor:Select': self.onSelect,
! 'LayoutEditor:FocusOrder':self.onFocusOrder,
! 'Cancel:LayoutEditor:Select':
self.onEndSelect,
!
'Cancel:LayoutEditor:FocusOrder':self.onEndFocusOrder })
self.addToolbarMapping(ToolbarMapping)
self.AddSeparator()
***************
*** 61,77 ****
self.AddControl(self.blockCombo)
def onBeginWizard(self, event):
try:
! self.ToggleTool(self.mapping[event.template['Location']],1)
except KeyError:
pass
def onEndWizard(self, event):
try:
! self.ToggleTool(self.mapping[event.template['Location']],0)
except KeyError:
pass
--- 68,110 ----
self.AddControl(self.blockCombo)
+ self.onSelect(None)
def onBeginWizard(self, event):
try:
! self.ToggleTool(self.mapping['Wizard:%s' % event.template['BaseID']],1)
except KeyError:
pass
def onEndWizard(self, event):
try:
! self.ToggleTool(self.mapping['Wizard:%s' % event.template['BaseID']],0)
! except KeyError:
! pass
!
!
! def onSelect(self, event):
! try:
! self.ToggleTool(self.mapping['LayoutEditor:Select'],1)
! except KeyError:
! pass
!
! def onFocusOrder(self, event):
! try:
! self.ToggleTool(self.mapping['LayoutEditor:FocusOrder'],1)
! except KeyError:
! pass
!
! def onEndSelect(self, event):
! try:
! self.ToggleTool(self.mapping['LayoutEditor:Select'],0)
! except KeyError:
! pass
!
! def onEndFocusOrder(self, event):
! try:
! self.ToggleTool(self.mapping['LayoutEditor:FocusOrder'],0)
except KeyError:
pass
Index: gnue-designer/src/forms/LayoutEditor/WidgetHandler.py
diff -c gnue-designer/src/forms/LayoutEditor/WidgetHandler.py:1.14
gnue-designer/src/forms/LayoutEditor/WidgetHandler.py:1.15
*** gnue-designer/src/forms/LayoutEditor/WidgetHandler.py:1.14 Mon Jun 9
20:40:14 2003
--- gnue-designer/src/forms/LayoutEditor/WidgetHandler.py Tue Aug 12
18:45:13 2003
***************
*** 41,50 ****
class WidgetHandler(wxEvtHandler):
def __init__(self, instance, object):
wxEvtHandler.__init__(self)
! self.instance = instance
self.object = object
self.hasFocus = 0
! self.highlightBox = WidgetHighlighter(self.instance.panel)
self._iMoved = 0
self._alreadySelected = 0
self._popup_editor = None
--- 41,50 ----
class WidgetHandler(wxEvtHandler):
def __init__(self, instance, object):
wxEvtHandler.__init__(self)
! self.editor = instance
self.object = object
self.hasFocus = 0
! self.highlightBox = WidgetHighlighter(self.editor.panel)
self._iMoved = 0
self._alreadySelected = 0
self._popup_editor = None
***************
*** 69,75 ****
except:
pass
! self.setAllChildren(EVT_KEY_UP, widget, self.instance.keyTrap)
self.setAllChildren(EVT_SET_FOCUS, widget, self.focusGainedTrap)
self.setAllChildren(EVT_KILL_FOCUS, widget, self.focusLostTrap)
self.setAllChildren(EVT_LEFT_UP, widget, self.OnLeftUp)
--- 69,75 ----
except:
pass
! self.setAllChildren(EVT_KEY_UP, widget, self.editor.keyTrap)
self.setAllChildren(EVT_SET_FOCUS, widget, self.focusGainedTrap)
self.setAllChildren(EVT_KILL_FOCUS, widget, self.focusLostTrap)
self.setAllChildren(EVT_LEFT_UP, widget, self.OnLeftUp)
***************
*** 77,84 ****
self.setAllChildren(EVT_RIGHT_DOWN, widget, self.OnRightDown)
self.setAllChildren(EVT_RIGHT_UP, widget, self.OnRightUp)
self.setAllChildren(EVT_MOTION, widget, self.OnMotion)
! self.setAllChildren(EVT_LEFT_DCLICK, widget, self.OnEditProperties)
! self.setAllChildren(EVT_KEY_UP, self.highlightBox, self.instance.keyTrap)
self.setAllChildren(EVT_SET_FOCUS, self.highlightBox,
self.focusGainedTrap)
self.setAllChildren(EVT_KILL_FOCUS, self.highlightBox, self.focusLostTrap)
self.setAllChildren(EVT_LEFT_UP, self.highlightBox, self.OnLeftUp)
--- 77,84 ----
self.setAllChildren(EVT_RIGHT_DOWN, widget, self.OnRightDown)
self.setAllChildren(EVT_RIGHT_UP, widget, self.OnRightUp)
self.setAllChildren(EVT_MOTION, widget, self.OnMotion)
! self.setAllChildren(EVT_LEFT_DCLICK, widget, self.onLeftDClick)
! self.setAllChildren(EVT_KEY_UP, self.highlightBox, self.editor.keyTrap)
self.setAllChildren(EVT_SET_FOCUS, self.highlightBox,
self.focusGainedTrap)
self.setAllChildren(EVT_KILL_FOCUS, self.highlightBox, self.focusLostTrap)
self.setAllChildren(EVT_LEFT_UP, self.highlightBox, self.OnLeftUp)
***************
*** 94,100 ****
for widget in self.mainWidget.widgets:
tx, ty = widget.GetPositionTuple()
tw, th = widget.GetSizeTuple()
! self.instance.positionMappings[widget] = [tx,ty,tx+tw-1,ty+tw-1,self]
if tx < x1:
x1 = tx
if ty < y1:
--- 94,100 ----
for widget in self.mainWidget.widgets:
tx, ty = widget.GetPositionTuple()
tw, th = widget.GetSizeTuple()
! self.editor.positionMappings[widget] = [tx,ty,tx+tw-1,ty+tw-1,self]
if tx < x1:
x1 = tx
if ty < y1:
***************
*** 124,130 ****
self.setAllChildren(event, child, trap)
def focusGainedTrap(self, event):
! self.instance.panel.SetFocus()
pass
# event.Skip()
--- 124,130 ----
self.setAllChildren(event, child, trap)
def focusGainedTrap(self, event):
! self.editor.panel.SetFocus()
pass
# event.Skip()
***************
*** 142,149 ****
data = [ { "Type" : "selectedWidgets",
"Attributes": {
! 'startingX': object.Char__x +
int(x/self.instance.gridWidth),
! 'startingY': object.Char__y +
int(y/self.instance.gridHeight),
}
}]
# "name": dname,
--- 142,149 ----
data = [ { "Type" : "selectedWidgets",
"Attributes": {
! 'startingX': object.Char__x + int(x/self.editor.gridWidth),
! 'startingY': object.Char__y +
int(y/self.editor.gridHeight),
}
}]
# "name": dname,
***************
*** 155,190 ****
do.SetData(cPickle.dumps(data,1))
## icon = FeedbackBitmap(10,10).icon()
! dropSource = MoveDropSource(self, self.instance)
dropSource.SetData(do)
result = dropSource.DoDragDrop(true)
event.Skip()
def OnLeftDown(self, event):
- self.mouseStartX, self.mouseStartY = event.GetPositionTuple()
- self._iMoved = 0
! if event.ShiftDown():
! selections = self.instance._currentSelection[:]
! else:
! selections = []
- if self.object in selections:
if event.ShiftDown():
! del selections[selections.index(self.object)]
else:
! selections.append(self.object)
- self.instance._instance.dispatchEvent('ObjectSelected',object=self.object,
- originator="Forms::LayoutEditor",
- selection=selections)
event.Skip()
def OnLeftUp(self, event):
! if self._iMoved:
! self._iMoved = 0
event.Skip()
--- 155,203 ----
do.SetData(cPickle.dumps(data,1))
## icon = FeedbackBitmap(10,10).icon()
! dropSource = MoveDropSource(self, self.editor)
dropSource.SetData(do)
result = dropSource.DoDragDrop(true)
event.Skip()
def OnLeftDown(self, event):
! if self.editor.mode == 'move':
!
! self.mouseStartX, self.mouseStartY = event.GetPositionTuple()
! self._iMoved = 0
if event.ShiftDown():
! selections = self.editor._currentSelection[:]
! else:
! selections = []
!
! if self.object in selections:
! if event.ShiftDown():
! del selections[selections.index(self.object)]
! else:
! selections.append(self.object)
!
! self.editor._instance.dispatchEvent('ObjectSelected',object=self.object,
! originator="Forms::LayoutEditor",
! selection=selections)
else:
! xo, yo = self.widget.GetPosition()
! x, y = event.GetPositionTuple()
! self.editor.handleLeftDown(x+xo,y+yo)
event.Skip()
def OnLeftUp(self, event):
! if self.editor.mode == 'move':
! if self._iMoved:
! self._iMoved = 0
! else:
! xo, yo = self.widget.GetPosition()
! x, y = event.GetPositionTuple()
! self.editor.handleLeftUp(x+xo,y+yo)
event.Skip()
***************
*** 203,212 ****
def OnRightUp(self, event):
! pt = event.GetPositionTuple()
! self.instance.dispatchEvent('ObjectSelected',object=self.object,
originator=None)
! wxPyTypeCast(event.GetEventObject(),'wxWindow') \
! .PopupMenu(self.object._popupMenu, pt)
event.Skip()
--- 216,226 ----
def OnRightUp(self, event):
! if self.editor.mode == 'move':
! pt = event.GetPositionTuple()
! self.editor.dispatchEvent('ObjectSelected',object=self.object,
originator=None)
! wxPyTypeCast(event.GetEventObject(),'wxWindow') \
! .PopupMenu(self.object._popupMenu, pt)
event.Skip()
***************
*** 219,225 ****
oldVals = {self.__popupAttr:None}
newVals = {self.__popupAttr: value}
self.object.__dict__.update(newVals)
! self.instance.dispatchEvent('ObjectModified', object=self.object,
originator="Forms::LayoutEditor",
old=oldVals,
new=newVals)
--- 233,239 ----
oldVals = {self.__popupAttr:None}
newVals = {self.__popupAttr: value}
self.object.__dict__.update(newVals)
! self.editor.dispatchEvent('ObjectModified', object=self.object,
originator="Forms::LayoutEditor",
old=oldVals,
new=newVals)
***************
*** 229,266 ****
self.widget.SetLabel(value or "<Unset>")
if self.object._type == 'GFLabel':
width = len(value) or 10
! self.widget.SetSize((width * self.instance.gridWidth,
self.widget.GetSize().height))
self.recalcBoundaries()
self.setSelected(self.selected)
! def OnEditProperties(self, event):
! if self.object._type in ('GFBox','GFLabel'):
! # Create a popup text editor for the labels
! if self.object._type == 'GFBox':
! self.__popupAttr = 'label'
! x = self.widget.GetPosition().x + (self.instance.gridWidth/2)
! width = (self.object.Char__width - 2) * self.instance.gridWidth
! else:
! self.__popupAttr = 'text'
! x = self.widget.GetPosition().x
! width = self.widget.GetSize().width + self.instance.gridWidth
!
! self._popup_editor = PopupEditor(self.instance.workspace,
! self._endPopupEditor,
! x + self.instance.panel.GetPosition().x,
! self.widget.GetPosition().y + self.instance.panel.GetPosition().y,
! width,
! self.instance.gridHeight,
! self.object.__dict__[self.__popupAttr])
! self._popup_editor.SetFocus()
! else:
! # Signal the Properties dialog
! self.instance._instance.dispatchEvent('Show:Tool:objectProperties')
#
--- 243,281 ----
self.widget.SetLabel(value or "<Unset>")
if self.object._type == 'GFLabel':
width = len(value) or 10
! self.widget.SetSize((width * self.editor.gridWidth,
self.widget.GetSize().height))
self.recalcBoundaries()
self.setSelected(self.selected)
! def onLeftDClick(self, event):
! if self.editor.mode == 'move':
! if self.object._type in ('GFBox','GFLabel'):
! # Create a popup text editor for the labels
! if self.object._type == 'GFBox':
! self.__popupAttr = 'label'
! x = self.widget.GetPosition().x + (self.editor.gridWidth/2)
! width = (self.object.Char__width - 2) * self.editor.gridWidth
! else:
! self.__popupAttr = 'text'
! x = self.widget.GetPosition().x
! width = self.widget.GetSize().width + self.editor.gridWidth
!
! self._popup_editor = PopupEditor(self.editor.workspace,
! self._endPopupEditor,
! x + self.editor.panel.GetPosition().x,
! self.widget.GetPosition().y + self.editor.panel.GetPosition().y,
! width,
! self.editor.gridHeight,
! self.object.__dict__[self.__popupAttr])
! self._popup_editor.SetFocus()
! else:
! # Signal the Properties dialog
! self.editor._instance.dispatchEvent('Show:Tool:objectProperties')
#
***************
*** 272,279 ****
if not (dx or dy):
return 0
! nx = dx * self.instance.gridWidth
! ny = dy * self.instance.gridHeight
try:
self.object.Char__height
--- 287,294 ----
if not (dx or dy):
return 0
! nx = dx * self.editor.gridWidth
! ny = dy * self.editor.gridHeight
try:
self.object.Char__height
***************
*** 298,304 ****
self.object.Char__height = self.object.Char__height + dy
newVals['Char:height'] = self.object.Char__height
! self.instance.dispatchEvent('ObjectModified', object=self.object,
originator="Forms::LayoutEditor",
old=oldVals,
new=newVals)
--- 313,319 ----
self.object.Char__height = self.object.Char__height + dy
newVals['Char:height'] = self.object.Char__height
! self.editor.dispatchEvent('ObjectModified', object=self.object,
originator="Forms::LayoutEditor",
old=oldVals,
new=newVals)
***************
*** 315,322 ****
if not (dx or dy):
return 0
! nx = dx * self.instance.gridWidth
! ny = dy * self.instance.gridHeight
if (self.object.Char__x + dx < 0 or self.object.Char__y + dy < 0):
return 0
--- 330,337 ----
if not (dx or dy):
return 0
! nx = dx * self.editor.gridWidth
! ny = dy * self.editor.gridHeight
if (self.object.Char__x + dx < 0 or self.object.Char__y + dy < 0):
return 0
***************
*** 335,341 ****
self.object.Char__y += dy
newVals['Char:y'] = self.object.Char__y
! self.instance.dispatchEvent('ObjectModified', object=self.object,
originator="Forms::LayoutEditor",
old=oldVals,
new=newVals)
--- 350,356 ----
self.object.Char__y += dy
newVals['Char:y'] = self.object.Char__y
! self.editor.dispatchEvent('ObjectModified', object=self.object,
originator="Forms::LayoutEditor",
old=oldVals,
new=newVals)
***************
*** 350,356 ****
# TODO: Why the fsck can't I Destroy() this thing!?!??!?
self.widget.Show(0)
! self.instance = None
self.object = None
self.highlightBox.Destroy()
self.highlightBox = None
--- 365,371 ----
# TODO: Why the fsck can't I Destroy() this thing!?!??!?
self.widget.Show(0)
! self.editor = None
self.object = None
self.highlightBox.Destroy()
self.highlightBox = None
Index: gnue-designer/src/forms/WizardRunner.py
diff -c gnue-designer/src/forms/WizardRunner.py:1.6
gnue-designer/src/forms/WizardRunner.py:1.7
*** gnue-designer/src/forms/WizardRunner.py:1.6 Thu May 29 01:07:22 2003
--- gnue-designer/src/forms/WizardRunner.py Tue Aug 12 18:45:13 2003
***************
*** 32,37 ****
--- 32,40 ----
import TemplateSupport
from gnue.common.events import Event
+ # We subclass the main WizardRunner to add
+ # prepositioning support (i.e., select coordinates
+ # before the wizard begins.)
class WizardRunner(BaseWizardRunner):
def run(self, event):
***************
*** 39,46 ****
# i.e., intercept the run method.
if issubclass( self.template['BaseClass'],
TemplateSupport.FormPrePositioningTemplate ):
! self.instance.dispatchEvent(Event('BeginWizard',
! template=self.template))
! self.instance.visualEditor.startPrePositioningTemplate(self.template)
else:
BaseWizardRunner.run(self, event)
--- 42,62 ----
# i.e., intercept the run method.
if issubclass( self.template['BaseClass'],
TemplateSupport.FormPrePositioningTemplate ):
! self.instance.dispatchEvent('BeginWizard',
! template=self.template)
! self.prepositioning = 1
! event.dispatchAfter('LayoutEditor:Prepositioning', wizardrunner=self)
else:
+ self.prepositioning = 0
BaseWizardRunner.run(self, event)
+
+ def positioned_run(self, *args, **parms):
+ self.prepositioning = 0
+ BaseWizardRunner.run(self, None, *args, **parms)
+
+ def cancel(self, event=None):
+ if hasattr(self,'prepositioning') and self.prepositioning:
+ self.instance.dispatchEvent('Cancel:LayoutEditor:Prepositioning')
+ self.instance.dispatchEvent('EndWizard', template=self.template)
+ else:
+ BaseWizardRunner.cancel(self)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue-designer src/base/TemplateParser.py src/ba...,
Jason Cater <=