[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/designer/src/forms LayoutEditor.py
From: |
Jason Cater |
Subject: |
gnue/designer/src/forms LayoutEditor.py |
Date: |
Sat, 26 Jan 2002 19:53:23 -0500 |
CVSROOT: /home/cvs
Module name: gnue
Changes by: Jason Cater <address@hidden> 02/01/26 19:53:23
Modified files:
designer/src/forms: LayoutEditor.py
Log message:
implemented in-place label editing on the layout editor screen
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/forms/LayoutEditor.py.diff?cvsroot=OldCVS&tr1=1.9&tr2=1.10&r1=text&r2=text
Patches:
Index: gnue/designer/src/forms/LayoutEditor.py
diff -c gnue/designer/src/forms/LayoutEditor.py:1.9
gnue/designer/src/forms/LayoutEditor.py:1.10
*** gnue/designer/src/forms/LayoutEditor.py:1.9 Sat Jan 26 00:38:48 2002
--- gnue/designer/src/forms/LayoutEditor.py Sat Jan 26 19:53:23 2002
***************
*** 222,230 ****
self.page.__panel = self.panel
self.panelColor = self.panel.GetBackgroundColour()
! self.panelGridColor = wxColour(self.panelColor.Red()+16,
! self.panelColor.Green()+16,
! self.panelColor.Blue()+16)
UIwxpython.initFont(self.panel)
--- 222,230 ----
self.page.__panel = self.panel
self.panelColor = self.panel.GetBackgroundColour()
! self.panelGridColor = wxColour(order(255,self.panelColor.Red()+16)[0],
! order(255,self.panelColor.Green()+16)[0],
! order(255,self.panelColor.Blue()+16)[0])
UIwxpython.initFont(self.panel)
***************
*** 474,479 ****
--- 474,485 ----
self.panel.PopupMenu(menu, event.GetPosition())
+ def clearSelections(self):
+ for widget in self._currentSelection.keys():
+ widget.setSelected(0)
+ self._currentSelection = {}
+
+
def keyTrap(self, event):
if event.KeyCode() in (WXK_LEFT, WXK_RIGHT, WXK_UP, WXK_DOWN) and \
len(self._currentSelection.keys()):
***************
*** 521,526 ****
--- 527,533 ----
def initialize(self, widget):
self.widget = widget.widgets[0]
self.mainWidget = widget
+ self.selected = 0
self.recalcBoundaries()
***************
*** 569,574 ****
--- 576,582 ----
def setSelected(self, selected):
+ self.selected = selected
self.highlightBox.setSelected(selected)
***************
*** 671,680 ****
.PopupMenu(self.object._popupMenu, pt)
event.Skip()
def OnEditProperties(self, event):
! self.instance._instance.propertyEditorWindow.Show(1)
! self.instance._instance.propertyEditorWindow.Raise()
! self.instance._instance.propertyEditorWindow.SetFocus()
#
# Resize the current widget. dx and dy are incremental
--- 679,728 ----
.PopupMenu(self.object._popupMenu, pt)
event.Skip()
+
+ def _endPopupEditor(self, success, value=""):
+ if success:
+ self.object.__dict__[self.__popupAttr] = value
+ self.instance._instance.onModifyObject(self.object,
+ __name__, ((self.__popupAttr, value),))
+ 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.width - 2) * self.instance.gridWidth
! else:
! self.__popupAttr = 'text'
! x = self.widget.GetPosition().x
! width = self.widget.GetSize().width + self.instance.gridWidth
!
! self.instance.clearSelections()
! self.__editor = PopupEditor(self.instance.workspace,
! x + self.instance.panel.GetPosition().x,
! self.widget.GetPosition().y + self.instance.panel.GetPosition().y,
! width,
! self.instance.gridHeight,
! self._endPopupEditor,
! self.object.__dict__[self.__popupAttr],
! wxColour(255,239,176))
! self.__editor.SetFocus()
!
! else:
! # Signal the Properties dialog
! self.instance._instance.propertyEditorWindow.Show(1)
! self.instance._instance.propertyEditorWindow.Raise()
! self.instance._instance.propertyEditorWindow.SetFocus()
#
# Resize the current widget. dx and dy are incremental
***************
*** 1258,1263 ****
--- 1306,1346 ----
return d # what is returned signals the source what to do
# with the original data (move, copy, etc.) In this
# case we just return the suggested value given to us.
+
+
+ #
+ # Our text handler
+ #
+ # When we are completed, we will call a method passed to us
+ # (via complete) along with a success code and the final result
+ # (if success = 1)
+ #
+ class PopupEditor(wxTextCtrl):
+ def __init__(self, panel, x, y, width, height, complete, value, color):
+ wxTextCtrl.__init__(self, panel, -1, pos=wxPoint(x,y),
+ size=wxSize(width, height),
+ style=wxTE_PROCESS_TAB|wxTE_PROCESS_ENTER|wxSIMPLE_BORDER)
+ self.SetBackgroundColour(color)
+ self.__complete = complete
+ self.SetValue(value)
+ EVT_CHAR(self, self.OnChar)
+ EVT_KILL_FOCUS(self, self.OnFocusOut)
+
+ def OnChar(self, event):
+ if event.GetKeyCode() in (WXK_RETURN, WXK_TAB):
+ self.__complete(1, self.GetValue())
+ self.Destroy()
+
+ elif event.GetKeyCode() == WXK_ESCAPE:
+ self.__complete(0)
+ self.Destroy()
+ else:
+ event.Skip()
+
+ def OnFocusOut(self, event):
+ self.__complete(1, self.GetValue())
+ self.Destroy()
+
#
- gnue/designer/src/forms LayoutEditor.py, Jason Cater, 2002/01/22
- gnue/designer/src/forms LayoutEditor.py, James Thompson, 2002/01/25
- gnue/designer/src/forms LayoutEditor.py, Jason Cater, 2002/01/25
- gnue/designer/src/forms LayoutEditor.py, Jason Cater, 2002/01/25
- gnue/designer/src/forms LayoutEditor.py, Jason Cater, 2002/01/25
- gnue/designer/src/forms LayoutEditor.py, Jason Cater, 2002/01/26
- gnue/designer/src/forms LayoutEditor.py,
Jason Cater <=