commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnue/designer/src Instance.py ToolSupport.py fo...


From: Jason Cater
Subject: gnue/designer/src Instance.py ToolSupport.py fo...
Date: Tue, 22 Jan 2002 01:17:04 -0500

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    02/01/22 01:17:04

Modified files:
        designer/src   : Instance.py ToolSupport.py 
        designer/src/forms: Instance.py 
        designer/src/navigator: Instance.py 
Added files:
        designer/src/forms: LayoutEditor.py 
Removed files:
        designer/src   : LayoutEditor.py 

Log message:
        separated Form logic from Base logic in the LayoutEditors and the main 
Instances; designer appears to work normally, but may none-the-less be unstable 
(this was a lot of code-shifting

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/Instance.py.diff?cvsroot=OldCVS&tr1=1.42&tr2=1.43&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/ToolSupport.py.diff?cvsroot=OldCVS&tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/forms/LayoutEditor.py?cvsroot=OldCVS&rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/forms/Instance.py.diff?cvsroot=OldCVS&tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/navigator/Instance.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: gnue/designer/src/Instance.py
diff -c gnue/designer/src/Instance.py:1.42 gnue/designer/src/Instance.py:1.43
*** gnue/designer/src/Instance.py:1.42  Mon Jan 21 15:33:48 2002
--- gnue/designer/src/Instance.py       Tue Jan 22 01:17:03 2002
***************
*** 30,61 ****
  from wxPython.wx import *
  from gnue.common import GDebug, GConfig
  from MenuBar import MainMenuBar
- from PopupMenu import ObjectMenu
- from LayoutEditor import LayoutEditor
- from TreeView import TreeView
- from PropertyEditor import PropertyToolFrame
- from TriggerEditor import TriggerEditor
- from DataSourceEditor import DataSourceEditor
- from SchemaViewer import SchemaViewer
  import RuntimeSettings
  from ToolFrame import ToolFrame
  from gnue.designer import VERSION, PACKAGE
  
- # TODO: Must go!!
- from gnue.forms import GFForm, GFParser, GFObjects, GFTrigger, GFLibrary, 
UIwxpython
  
  
  TITLE=PACKAGE
  
  class BaseInstance(wxFrame):
!   def __init__(self, app, location=None, deferInit=0, buffer=None):
      wxFrame.__init__(self, NULL, -1, "")
  
      # Register ourself with RuntimeSettings
      RuntimeSettings.registerInstance(self)
  
      # Tell RuntimeSettings that we have information to save
!     self.runtime_section = 'FormLayout'
      RuntimeSettings.registerRuntimeSettingHandler(self, self)
  
      # And the MRU
--- 30,95 ----
  from wxPython.wx import *
  from gnue.common import GDebug, GConfig
  from MenuBar import MainMenuBar
  import RuntimeSettings
  from ToolFrame import ToolFrame
  from gnue.designer import VERSION, PACKAGE
  
  
  
  TITLE=PACKAGE
  
  class BaseInstance(wxFrame):
! 
!   ########################################################################
!   #
!   # Virtual functions...
!   #
!   # Override these functions in your Instance
!   #
! 
!   # Called to load the object from a file buffer/handle
!   def loadFile(self, buffer):
!     return None
! 
!   # Called to load an "empty" object.  Create the root object
!   # and any initial child objects (if appropriate)
!   def loadEmpty(self):
!     return None
! 
!   # Called in a tree-like fashion for every object
!   # whether loaded in the beginning or later added.
!   def inventoryObject(self, object):
!     pass
! 
!   # Called just before saving the file using GObject's dumpTree
!   # You might do some sanity checks, etc.
!   def preSave(self):
!     return
! 
!   # Return an instance of the "primary" visual editor/layout panel
!   def createVisualEditor(self):
!     return None
! 
!   #
!   def createTools(self):
!     pass
! 
! 
!   ########################################################################
!   #
!   # BaseInstance-specific stuff
!   # If you need to overwrite something here,
!   # then odds are we really need to provide
!   # a hook of some sorts.
!   #
!   def __init__(self, app, location=None, buffer=None):
      wxFrame.__init__(self, NULL, -1, "")
  
      # Register ourself with RuntimeSettings
      RuntimeSettings.registerInstance(self)
  
      # Tell RuntimeSettings that we have information to save
!     self.runtime_section = self.properties.nickname + 'Layout'
      RuntimeSettings.registerRuntimeSettingHandler(self, self)
  
      # And the MRU
***************
*** 66,71 ****
--- 100,106 ----
      self._isNew = 1
  
      self._app = app
+     self.connections = app.connections
      self._lastGenericNameSeq = {}
      self.nameMappings = {}
  
***************
*** 76,85 ****
      if location == None:
  
        if buffer != None:
!         self.__loadFormFromBuffer(buffer)
          self.makeDirty()
        else:
!         self.__createEmptyForm()
  
      else:
  
--- 111,120 ----
      if location == None:
  
        if buffer != None:
!         self.__loadFromBuffer(buffer)
          self.makeDirty()
        else:
!         self.__createEmptyInstance()
  
      else:
  
***************
*** 92,98 ****
              % location, "File Not Found", wxYES_NO|wxICON_QUESTION 
).ShowModal() == wxID_NO:
            sys.exit()
          self.Show(0)
!         self.__createEmptyForm()
          self._path = location
          self.makeDirty()
  
--- 127,133 ----
              % location, "File Not Found", wxYES_NO|wxICON_QUESTION 
).ShowModal() == wxID_NO:
            sys.exit()
          self.Show(0)
!         self.__createEmptyInstance()
          self._path = location
          self.makeDirty()
  
***************
*** 105,115 ****
              % location, "Read Only Warning", wxOK|wxCANCEL|wxICON_EXCLAMATION 
).ShowModal() == wxID_CANCEL:
            sys.exit()
          self.Show(0)
!         self.__loadForm(location)
        else:
!         self.__loadForm(location)
! 
!     self.rootObject.name = "Form"
  
      self.CreateStatusBar()
      self.SetStatusText('Waddaya mean "Baa! B-Baa! ! Baa!"?...."Sheep ya dern 
fool!"')
--- 140,148 ----
              % location, "Read Only Warning", wxOK|wxCANCEL|wxICON_EXCLAMATION 
).ShowModal() == wxID_CANCEL:
            sys.exit()
          self.Show(0)
!         self.__loadFromFile(location)
        else:
!         self.__loadFromFile(location)
  
      self.CreateStatusBar()
      self.SetStatusText('Waddaya mean "Baa! B-Baa! ! Baa!"?...."Sheep ya dern 
fool!"')
***************
*** 117,191 ****
      self.SetMenuBar(self._menubar)
      self.Show(true)
  
-     # Split Plane
- #    vsplitter = wxSplitterWindow (self, -1, style=wxSP_3D|wxNO_3D)
- #    vsplitter.SetMinimumPaneSize (100)
  
!     self.rootObject.walk(self.inventoryLoadedItems)
  
      # Create our tools
-     self.objectListeners = ()
  
! #    self.tree = TreeView(self, self.rootObject, vsplitter)
  
! #    self.layoutEditorWindow = ToolFrame(self, "Layout Editor")
!     self.layoutEditorWindow = self
!     self.layoutEditorWindow.default_visible = 1
!     self.layoutEditorWindow.default_width = 450
!     self.layoutEditorWindow.default_height = 400
!     self.layoutEditor = LayoutEditor(self, self.layoutEditorWindow)
! #    self.layoutEditorWindow.finalize()
! 
!     self.treeEditorWindow = ToolFrame(self, "Object Navigator")
!     self.treeEditor = TreeView(self, self.rootObject, self.treeEditorWindow)
!     self.treeEditorWindow.finalize()
!     self.tree = self.treeEditor # TODO: This needs to be removed
! 
!     self.triggerEditorWindow = ToolFrame(self, "Event Editor")
!     self.triggerEditor = TriggerEditor(self.triggerEditorWindow, self,
!                                        self.rootObject)
!     self.triggerEditorWindow.finalize()
! 
!     self.datasourceEditorWindow = ToolFrame(self, "Data Source Editor")
!     self.datasourceEditor = DataSourceEditor(self.datasourceEditorWindow,
!                                              self, self.rootObject)
!     self.datasourceEditorWindow.finalize()
! 
!     self.schemaViewerWindow = ToolFrame(self, "Schema Navigator")
!     self.schemaViewer = SchemaViewer(self.schemaViewerWindow,
!                                      self, self.rootObject)
!     self.schemaViewerWindow.finalize()
! 
!     self.propertyEditorWindow = PropertyToolFrame(self, "Property Inspector")
!     self.propertyEditor = self.propertyEditorWindow.propertyEditor
!     self.propertyEditorWindow.finalize()
! 
!     self.eventEditor = self.propertyEditorWindow.eventEditor
! 
!     # Store all
!     self.objectListeners = ( self.tree,
!                              self.layoutEditor,
!                              self.triggerEditor,
!                              self.propertyEditorWindow,
!                              self.propertyEditor,
!                              self.eventEditor,
!                              self.datasourceEditor )
! 
!     self._currentPage = self._pages[0]
! #    vsplitter.SplitVertically(self.tree, self.layoutEditor)
! #    vsplitter.SplitVertically(self.tree, self.triggerEditor)
! #    vsplitter.SetSashPosition (
! #        RuntimeSettings.getint(self.runtime_section, 'vsash', 170), true)
! #    self.vsplitter = vsplitter
!     self.tree.Expand(self.rootObject._treeItem)
  
      self._menubar.lastToolAdded()
  
      self._app.addInstance(self)
  
      # Fit the widgets to the screen
! #    vsplitter.Fit()
!     self.layoutEditor.Fit()
      self.Fit()
  
      self.SetSize((
--- 150,208 ----
      self.SetMenuBar(self._menubar)
      self.Show(true)
  
  
!     self.rootObject.walk(self.__inventory)
! 
  
      # Create our tools
  
!     self.visualEditorWindow = self
!     self.visualEditor = self.createVisualEditor()
! 
! 
!     self.__objectListeners = [self.visualEditor]
! 
! 
!     self.createTools()
  
! 
! ##    self.treeEditorWindow = ToolFrame(self, "Object Navigator")
! ##    self.treeEditor = TreeView(self, self.rootObject, self.treeEditorWindow)
! ##    self.treeEditorWindow.finalize()
! ##    self.tree = self.treeEditor # TODO: This needs to be removed
! ##
! ##    self.triggerEditorWindow = ToolFrame(self, "Trigger Editor")
! ##    self.triggerEditor = TriggerEditor(self.triggerEditorWindow, self,
! ##                                       self.rootObject)
! ##    self.triggerEditorWindow.finalize()
! ##
! ##    self.datasourceEditorWindow = ToolFrame(self, "Data Source Editor")
! ##    self.datasourceEditor = DataSourceEditor(self.datasourceEditorWindow,
! ##                                             self, self.rootObject)
! ##    self.datasourceEditorWindow.finalize()
! ##
! ##    self.schemaViewerWindow = ToolFrame(self, "Schema Navigator")
! ##    self.schemaViewer = SchemaViewer(self.schemaViewerWindow,
! ##                                     self, self.rootObject)
! ##    self.schemaViewerWindow.finalize()
! ##
! ##    self.propertyEditorWindow = PropertyToolFrame(self, "Property 
Inspector")
! ##    self.propertyEditor = self.propertyEditorWindow.propertyEditor
! ##    self.propertyEditorWindow.finalize()
! ##
! ##    self.eventEditor = self.propertyEditorWindow.eventEditor
! ##
! 
! ##    self._currentPage = self._pages[0]
! 
! ##    self.tree.Expand(self.rootObject._treeItem)
  
      self._menubar.lastToolAdded()
  
      self._app.addInstance(self)
  
      # Fit the widgets to the screen
!     self.visualEditor.Fit()
      self.Fit()
  
      self.SetSize((
***************
*** 203,213 ****
      EVT_CLOSE(self, self.OnClose)
  
  
!   def __loadForm(self, location):
      try:
        self._path = location
        fileHandle = open(location,'r')
!       self.__loadFormFromBuffer(fileHandle)
        fileHandle.close()
        self.makeClean()
        self._isNew = 0
--- 220,240 ----
      EVT_CLOSE(self, self.OnClose)
  
  
! 
!   def addTool(id, title, baseclass):
!     window = ToolFrame(self, title)
!     control = baseclass(self, self.rootObject, window)
!     window.finalize()
!     self.__dict__["%sWindow" % id] = window
!     self.__dict__[id] = control
!     self.__objectListeners.append(control)
! 
! 
!   def __loadFromFile(self, location):
      try:
        self._path = location
        fileHandle = open(location,'r')
!       self.__loadFromBuffer(fileHandle)
        fileHandle.close()
        self.makeClean()
        self._isNew = 0
***************
*** 216,232 ****
        sys.exit()
      self._app.mru.addLocation(location)
  
-   def __loadFormFromBuffer(self, fileHandle):
-     self.rootObject = GFParser.loadForm (fileHandle, self, initialize=0)
  
!   def __createEmptyForm(self):
!     self.rootObject = GFForm.GFForm()
!     options = GFObjects.GFOptions(self.rootObject)
!     self.rootObject.title = "Untitled Form"
!     self.rootObject.height = 12
!     self.rootObject.width = 40
!     page = GFObjects.GFPage(self.rootObject)
! ##    GFObjects.GFBlock(page)
      self.makeClean()
      self._isNew = 1
  
--- 243,255 ----
        sys.exit()
      self._app.mru.addLocation(location)
  
  
!   def __loadFromBuffer(self, fileHandle):
!     self.rootObject = self.loadBuffer(fileHandle)
! 
! 
!   def __createEmptyInstance(self):
!     self.rootObject = self.loadEmpty()
      self.makeClean()
      self._isNew = 1
  
***************
*** 243,252 ****
                 'height': height,
                 'width': width  } )
  
-   # Hack having to do with UIwxpython import
-   def uiEventTrap(self, event):
-     pass
- 
    # Do we need to be saved?
    def isDirty(self):
      return self._isdirty
--- 266,271 ----
***************
*** 256,262 ****
      if not self._isdirty:
        self._isdirty = 1
        if self._path == "":
!         self.SetTitle( TITLE + " - <New Form> *")
        else:
          self.SetTitle( TITLE + " - " + self._path + " *")
  
--- 275,281 ----
      if not self._isdirty:
        self._isdirty = 1
        if self._path == "":
!         self.SetTitle( TITLE + " - <New %s> *" % self.properties.nickname)
        else:
          self.SetTitle( TITLE + " - " + self._path + " *")
  
***************
*** 264,277 ****
      self._isdirty = 0
      self._isnew = 0
      if self._path == "":
!       self.SetTitle( TITLE + " - <New Form>")
      else:
        self.SetTitle( TITLE + " - " + self._path)
  
  
    # Take an object and mangle it all up
    # until it is useful to us
!   def inventoryLoadedItems (self, object):
  
      if object != self.rootObject:
        if hasattr(object, 'name'):
--- 283,296 ----
      self._isdirty = 0
      self._isnew = 0
      if self._path == "":
!       self.SetTitle( TITLE + " - <New %s>" % self.properties.nickname)
      else:
        self.SetTitle( TITLE + " - " + self._path)
  
  
    # Take an object and mangle it all up
    # until it is useful to us
!   def __inventory (self, object):
  
      if object != self.rootObject:
        if hasattr(object, 'name'):
***************
*** 281,313 ****
            object.name = self.getNextGenericName(object.getObjectType()[2:])
          self.nameMappings[string.lower(object.name)] = object
  
!     if isinstance(object, GFObjects.GFPage) and \
!         object._parent == self.rootObject:
!       self._pages.append(object)
! 
!     object._popupMenu = ObjectMenu(self, object)
  
  
    def onSetCurrentObject (self, object, handler):
      self._currentObject = object
!     for listener in self.objectListeners:
        listener.onSetCurrentObject(object, handler)
  
    def onCreateObject (self, object, handler):
!     self.inventoryLoadedItems(object)
!     for listener in self.objectListeners:
        listener.onCreateObject(object, handler)
      self.makeDirty()
  
    def onModifyObject (self, object, handler, modifications):
!     for listener in self.objectListeners:
        listener.onModifyObject(object, handler, modifications)
      self.makeDirty()
  
    def onDeleteObject (self, object, handler):
  
      # Notify all listeners
!     for listener in self.objectListeners:
        listener.onDeleteObject(object, handler)
  
      # Delete the actual object from its parent
--- 300,329 ----
            object.name = self.getNextGenericName(object.getObjectType()[2:])
          self.nameMappings[string.lower(object.name)] = object
  
!     # Now, give the tool-specific instances a chance
!     self.inventoryObject(object)
  
  
    def onSetCurrentObject (self, object, handler):
      self._currentObject = object
!     for listener in self.__objectListeners:
        listener.onSetCurrentObject(object, handler)
  
    def onCreateObject (self, object, handler):
!     self.__inventory(object)
!     for listener in self.__objectListeners:
        listener.onCreateObject(object, handler)
      self.makeDirty()
  
    def onModifyObject (self, object, handler, modifications):
!     for listener in self.__objectListeners:
        listener.onModifyObject(object, handler, modifications)
      self.makeDirty()
  
    def onDeleteObject (self, object, handler):
  
      # Notify all listeners
!     for listener in self.__objectListeners:
        listener.onDeleteObject(object, handler)
  
      # Delete the actual object from its parent
***************
*** 335,340 ****
--- 351,357 ----
  
      return name
  
+ 
    def getUniqueName(self, n):
      name = string.lower(n)
      while self.nameMappings.has_key(name):
***************
*** 350,356 ****
      return name
  
  
!   def saveForm(self):
      location = self._path
      fileHandle = None
      fileHandle2 = None
--- 367,376 ----
      return name
  
  
!   def save(self):
! 
!     self.preSave()
! 
      location = self._path
      fileHandle = None
      fileHandle2 = None
***************
*** 369,417 ****
  
      self._makeBackup = 0
  
-     options = []
-     imports = []
-     datasources = []
-     triggers = []
-     pages = []
-     other = []
- 
-     for child in self.rootObject._children:
-       if isinstance(child, GFObjects.GFOptions):
-         options.append(child)
-       elif isinstance(child, GFLibrary.GFImport):
-         imports.append(child)
-       elif isinstance(child, GFObjects.GFDataSource) or \
-         (isinstance(child, GFLibrary.GFImportItem) and
-          child._type == 'GFimport-datasource'):
-         datasources.append(child)
-       elif isinstance(child, GFTrigger.GFTrigger) or \
-         (isinstance(child, GFLibrary.GFImportItem) and
-          child._type == 'GFimport-trigger'):
-         triggers.append(child)
-       elif isinstance(child, GFObjects.GFPage) or \
-         (isinstance(child, GFLibrary.GFImportItem) and
-          child._type == 'GFimport-page'):
-         pages.append(child)
-       else:
-         other.append(child)
- 
- 
-     # Reorder the children so items of same class are grouped
-     self.rootObject._children = []
-     for child in options:
-       self.rootObject._children.append(child)
-     for child in imports:
-       self.rootObject._children.append(child)
-     for child in datasources:
-       self.rootObject._children.append(child)
-     for child in triggers:
-       self.rootObject._children.append(child)
-     for child in pages:
-       self.rootObject._children.append(child)
-     for child in other:
-       self.rootObject._children.append(child)
- 
      fileHandle = open(location,'w')
      if sys.getdefaultencoding() == 'ascii':
        fileHandle.write('<?xml version="1.0"?>\n\n')
--- 389,394 ----
***************
*** 428,433 ****
--- 405,411 ----
      self.makeClean()
  
  
+ 
    def OnConnectTo(self, event):
      # connectionMap is built by MenuBar
      conn = self.connectionMap[event.GetId()]
***************
*** 445,451 ****
      if not len(self._path):
        self.OnSaveAs(event)
      else:
!       self.saveForm()
  
  
    def OnSaveAs(self, event):
--- 423,429 ----
      if not len(self._path):
        self.OnSaveAs(event)
      else:
!       self.save()
  
  
    def OnSaveAs(self, event):
***************
*** 461,467 ****
          else:
            self._path = self._path + '.gfd'
        self.SetTitle (TITLE + " - " + self._path)
!       self.saveForm()
      dlg.Destroy()
  
  
--- 439,445 ----
          else:
            self._path = self._path + '.gfd'
        self.SetTitle (TITLE + " - " + self._path)
!       self.save()
      dlg.Destroy()
  
  
Index: gnue/designer/src/ToolSupport.py
diff -c gnue/designer/src/ToolSupport.py:1.2 
gnue/designer/src/ToolSupport.py:1.3
*** gnue/designer/src/ToolSupport.py:1.2        Sat Jan 19 00:33:57 2002
--- gnue/designer/src/ToolSupport.py    Tue Jan 22 01:17:03 2002
***************
*** 33,39 ****
  UnsupportedTools = []
  Tools = (  'forms',
  #           'reports',
! #           'navigator'
  )
  
  for tool in Tools:
--- 33,39 ----
  UnsupportedTools = []
  Tools = (  'forms',
  #           'reports',
!            'navigator'
  )
  
  for tool in Tools:
Index: gnue/designer/src/forms/Instance.py
diff -c gnue/designer/src/forms/Instance.py:1.2 
gnue/designer/src/forms/Instance.py:1.3
*** gnue/designer/src/forms/Instance.py:1.2     Fri Jan 11 10:49:09 2002
--- gnue/designer/src/forms/Instance.py Tue Jan 22 01:17:03 2002
***************
*** 27,53 ****
  # NOTES:
  #
  
  from gnue.designer.Instance import BaseInstance
! from gnue.designer.forms import properties
  
  from gnue.forms import GFInstance
  
  
  class Instance(BaseInstance, GFInstance.GFInstance):
  
    def __init__(self, app, *args, **params):
  
      # TODO: Can we make it so the GFInstance is not
      # TODO: part of the main Instance class, but an
      # TODO: attribute such as Instance.formInstance?
  
-     self.properties = properties
- 
      GFInstance.GFInstance.__init__(self, app, -1,
                                     app.connections,
                                     None, disableSplash=1)
  
      BaseInstance.__init__(self, app, *args, **params)
  
  
  
--- 27,158 ----
  # NOTES:
  #
  
+ from gnue.designer.forms import properties as formProperties
  from gnue.designer.Instance import BaseInstance
! from gnue.designer import PopupMenu
! 
! # Tool support...
! from LayoutEditor import LayoutEditor
! from gnue.designer.TreeView import TreeView
! from gnue.designer.PropertyEditor import PropertyToolFrame
! from gnue.designer.TriggerEditor import TriggerEditor
! from gnue.designer.DataSourceEditor import DataSourceEditor
! from gnue.designer.SchemaViewer import SchemaViewer
! 
! from PopupMenu import ObjectMenu
  
  from gnue.forms import GFInstance
+ from gnue.forms import GFForm, GFParser, GFObjects, GFTrigger, GFLibrary, 
UIwxpython
  
  
  class Instance(BaseInstance, GFInstance.GFInstance):
  
    def __init__(self, app, *args, **params):
  
+     self.properties = formProperties
+ 
      # TODO: Can we make it so the GFInstance is not
      # TODO: part of the main Instance class, but an
      # TODO: attribute such as Instance.formInstance?
  
      GFInstance.GFInstance.__init__(self, app, -1,
                                     app.connections,
                                     None, disableSplash=1)
  
+     # For GFInstance support, iirc
+     self._pages = []
+ 
      BaseInstance.__init__(self, app, *args, **params)
+ 
+ 
+   def loadBuffer(self, buffer):
+     form = GFParser.loadForm (buffer, self, initialize=0)
+     form.name = 'form'
+     return form
+ 
+ 
+   def loadEmpty(self):
+     form = GFForm.GFForm()
+     options = GFObjects.GFOptions(form)
+     form.title = "Untitled Form"
+     form.height = 12
+     form.name = 'form'
+     form.width = 40
+     GFObjects.GFPage(form)
+     return form
+ 
+ 
+   def inventoryObject(self, object):
+     if isinstance(object, GFObjects.GFPage) and \
+         object._parent == self.rootObject:
+       self._pages.append(object)
+ 
+     object._popupMenu = ObjectMenu(self, object)
+ 
+ 
+   def createVisualEditor(self):
+     return LayoutEditor(self, self)
+ 
+ 
+   def addTools(self):
+     self.addTool('propertyEditor','Property Inspector', PropertyEditor)
+     self.addTool('treeEditor','Object Navigator', TreeView)
+     self.addTool('triggerEditor','Event Editor', TriggerEditor)
+     self.addTool('datasourceEditor','Data Source Editor', DataSourceEditor)
+     self.addTool('schemaViewer','Schema Navigator', SchemaViewer)
+ 
+ 
+   def preSave(self):
+ 
+     # Do a little rearranging of objects
+ 
+     options = []
+     imports = []
+     datasources = []
+     triggers = []
+     pages = []
+     other = []
+ 
+     for child in self.rootObject._children:
+       if isinstance(child, GFObjects.GFOptions):
+         options.append(child)
+       elif isinstance(child, GFLibrary.GFImport):
+         imports.append(child)
+       elif isinstance(child, GFObjects.GFDataSource) or \
+         (isinstance(child, GFLibrary.GFImportItem) and
+          child._type == 'GFimport-datasource'):
+         datasources.append(child)
+       elif isinstance(child, GFTrigger.GFTrigger) or \
+         (isinstance(child, GFLibrary.GFImportItem) and
+          child._type == 'GFimport-trigger'):
+         triggers.append(child)
+       elif isinstance(child, GFObjects.GFPage) or \
+         (isinstance(child, GFLibrary.GFImportItem) and
+          child._type == 'GFimport-page'):
+         pages.append(child)
+       else:
+         other.append(child)
+ 
+ 
+     # Reorder the children so items of same class are grouped
+     self.rootObject._children = []
+     for child in options:
+       self.rootObject._children.append(child)
+     for child in imports:
+       self.rootObject._children.append(child)
+     for child in datasources:
+       self.rootObject._children.append(child)
+     for child in triggers:
+       self.rootObject._children.append(child)
+     for child in pages:
+       self.rootObject._children.append(child)
+     for child in other:
+       self.rootObject._children.append(child)
+ 
+ 
+   # Hack having to do with UIwxpython import
+   def uiEventTrap(self, event):
+     pass
  
  
  
Index: gnue/designer/src/navigator/Instance.py
diff -c gnue/designer/src/navigator/Instance.py:1.1 
gnue/designer/src/navigator/Instance.py:1.2
*** gnue/designer/src/navigator/Instance.py:1.1 Fri Jan 11 10:32:45 2002
--- gnue/designer/src/navigator/Instance.py     Tue Jan 22 01:17:04 2002
***************
*** 27,40 ****
  # NOTES:
  #
  
! from gnue.designer import Instance
! from gnue.designer.navigator import properties
  
  
! class Instance(Instance.BaseInstance):
  
-   def __init__(self, *args, **params):
-     Instance.BaseInstance.__init__(self, *args, **params)
-     properties = properties
  
  
--- 27,88 ----
  # NOTES:
  #
  
! from gnue.designer.navigator import properties as navProperties
! from gnue.designer.Instance import BaseInstance
  
+ # Tool support...
+ from LayoutEditor import LayoutEditor
+ ##from gnue.designer.TreeView import TreeView
+ ##from gnue.designer.PropertyEditor import PropertyToolFrame
+ ##from gnue.designer.TriggerEditor import TriggerEditor
+ ##from gnue.designer.DataSourceEditor import DataSourceEditor
+ ##from gnue.designer.SchemaViewer import SchemaViewer
  
! ##from PopupMenu import ObjectMenu
! 
! from gnue.navigator import GNParser, GNObjects
! 
! 
! class Instance(BaseInstance):
! 
!   def __init__(self, app, *args, **params):
! 
!     self.properties = navProperties
!     BaseInstance.__init__(self, app, *args, **params)
! 
! 
!   def loadBuffer(self, buffer):
!     object = GNParser.loadProcesses (buffer, initialize=0)
! ##    object.name = 'processes'
!     return object
! 
! 
!   def loadEmpty(self):
!     object = GNObjects.GNProcesses()
!     object.title = "Untitled Process"
!     GFObjects.GFPage(object)
!     return object
! 
! 
!   def inventoryObject(self, object):
!     pass
! 
! 
!   def createVisualEditor(self):
!     return LayoutEditor(self, self)
! 
! 
!   def addTools(self):
!     pass
! ##    self.addTool('propertyEditor','Property Inspector', PropertyEditor)
! ##    self.addTool('treeEditor','Object Navigator', TreeView)
! ##    self.addTool('triggerEditor','Event Editor', TriggerEditor)
! ##    self.addTool('datasourceEditor','Data Source Editor', DataSourceEditor)
! ##    self.addTool('schemaViewer','Schema Navigator', SchemaViewer)
! 
! 
!   def preSave(self):
!     pass
  
  
  



reply via email to

[Prev in Thread] Current Thread [Next in Thread]