[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue designer/src/MenuBar.py forms/src/GFClient...
From: |
Jason Cater |
Subject: |
gnue designer/src/MenuBar.py forms/src/GFClient... |
Date: |
Tue, 04 Jun 2002 19:20:47 -0400 |
CVSROOT: /cvsroot/gnue
Module name: gnue
Changes by: Jason Cater <address@hidden> 02/06/04 19:20:47
Modified files:
designer/src : MenuBar.py
forms/src : GFClient.py
navigator/src : GNClient.py GNConfig.py GNObjects.py
UIwxpython.py
Log message:
working on getting navigator to do local forms instances
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/designer/src/MenuBar.py.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFClient.py.diff?tr1=1.44&tr2=1.45&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/navigator/src/GNClient.py.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/navigator/src/GNConfig.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/navigator/src/GNObjects.py.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/navigator/src/UIwxpython.py.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
Patches:
Index: gnue/designer/src/MenuBar.py
diff -c gnue/designer/src/MenuBar.py:1.19 gnue/designer/src/MenuBar.py:1.20
*** gnue/designer/src/MenuBar.py:1.19 Sat May 4 12:45:08 2002
--- gnue/designer/src/MenuBar.py Tue Jun 4 19:20:46 2002
***************
*** 176,182 ****
self._window.AppendItem(toolFrame._menu)
EVT_MENU(self._frame, toolFrame._wxMenuID, toolFrame.OnMenuSelected)
!
def lastToolAdded(self):
self._window.AppendSeparator()
--- 176,182 ----
self._window.AppendItem(toolFrame._menu)
EVT_MENU(self._frame, toolFrame._wxMenuID, toolFrame.OnMenuSelected)
!
def lastToolAdded(self):
self._window.AppendSeparator()
Index: gnue/forms/src/GFClient.py
diff -c gnue/forms/src/GFClient.py:1.44 gnue/forms/src/GFClient.py:1.45
*** gnue/forms/src/GFClient.py:1.44 Mon Jun 3 15:31:33 2002
--- gnue/forms/src/GFClient.py Tue Jun 4 19:20:47 2002
***************
*** 64,73 ****
SUMMARY = \
_("GNUe Forms is the primary user interface to the GNU Enterprise
system.")
! #
# Initialize the class
#
! def __init__(self, connections=None):
GClientApp.__init__(self, connections,'forms',ConfigOptions)
self._formInstances = {}
--- 64,73 ----
SUMMARY = \
_("GNUe Forms is the primary user interface to the GNU Enterprise
system.")
! #
# Initialize the class
#
! def __init__(self, connections=None):
GClientApp.__init__(self, connections,'forms',ConfigOptions)
self._formInstances = {}
***************
*** 113,119 ****
uiloaded = 1
except ImportError, err:
GDebug.printMesg(0,'Unable to load UI driver %s' % (self.ui_type))
! GDebug.printMesg(1,err)
if self.ui_type != 'nstti':
self.ui_type = 'nstti'
else:
--- 113,119 ----
uiloaded = 1
except ImportError, err:
GDebug.printMesg(0,'Unable to load UI driver %s' % (self.ui_type))
! GDebug.printMesg(1,err)
if self.ui_type != 'nstti':
self.ui_type = 'nstti'
else:
Index: gnue/navigator/src/GNClient.py
diff -c gnue/navigator/src/GNClient.py:1.7 gnue/navigator/src/GNClient.py:1.8
*** gnue/navigator/src/GNClient.py:1.7 Sun Jun 2 18:21:42 2002
--- gnue/navigator/src/GNClient.py Tue Jun 4 19:20:47 2002
***************
*** 86,97 ****
#
def run(self):
! # assign form file from 1st free argument
try:
processFile = self.ARGUMENTS[0]
except:
try:
! if string.split(string.lower(os.path.basename(sys.argv[0])),'.')[0]
not in ('gnuenav','gncvs','gnclient'):
processFile =
os.environ['INSTALL_PREFIX']+'/'+gConfig('ProcessDir')+"/"+os.path.basename(sys.argv[0])+".gpd"
else:
raise IndexError
--- 86,97 ----
#
def run(self):
! # assign menu file from 1st free argument
try:
processFile = self.ARGUMENTS[0]
except:
try:
! if string.split(string.lower(os.path.basename(sys.argv[0])),'.')[0]
not in ('gnue-navigator','gncvs'):
processFile =
os.environ['INSTALL_PREFIX']+'/'+gConfig('ProcessDir')+"/"+os.path.basename(sys.argv[0])+".gpd"
else:
raise IndexError
***************
*** 135,141 ****
if self.ui_type == 'text' :
import UItext as interface
! interface.Instance(nav).run()
if __name__ == '__main__':
GNClient().run()
--- 135,141 ----
if self.ui_type == 'text' :
import UItext as interface
! interface.Instance(nav).run(self.connections)
if __name__ == '__main__':
GNClient().run()
Index: gnue/navigator/src/GNConfig.py
diff -c gnue/navigator/src/GNConfig.py:1.1 gnue/navigator/src/GNConfig.py:1.2
*** gnue/navigator/src/GNConfig.py:1.1 Sat May 4 12:45:08 2002
--- gnue/navigator/src/GNConfig.py Tue Jun 4 19:20:47 2002
***************
*** 33,60 ****
'Comment' : 'Command to execute on .gfd files.',
'Description': 'Command to execute on .gfd files.',
'Typecast' : GTypecast.text,
! 'Default' : 'gfclient' },
!
{ 'Name' : 'RunReportCommand',
'Type' : 'Setting',
'Comment' : 'Command to execute on .grd files.',
'Description': 'Command to execute on .grd files.',
'Typecast' : GTypecast.text,
! 'Default' : 'grrun' },
{ 'Name' : 'FormDir',
'Type' : 'Setting',
'Comment' : 'Directory to search for .gfd files.',
'Description': 'Directory to search for .gfd files.',
'Typecast' : GTypecast.text,
! 'Default' : 'grrun' },
{ 'Name' : 'ProcessDir',
'Type' : 'Setting',
'Comment' : 'Directory to search for .gpd files.',
'Description': 'Directory to search for .gpd files.',
'Typecast' : GTypecast.text,
! 'Default' : 'grrun' },
{ 'Name' : 'disableSplash',
'Type' : 'Setting',
'Comment' : "Do not display the splashscreen.",
--- 33,61 ----
'Comment' : 'Command to execute on .gfd files.',
'Description': 'Command to execute on .gfd files.',
'Typecast' : GTypecast.text,
! 'Default' : 'gnue-forms' },
!
{ 'Name' : 'RunReportCommand',
'Type' : 'Setting',
'Comment' : 'Command to execute on .grd files.',
'Description': 'Command to execute on .grd files.',
'Typecast' : GTypecast.text,
! 'Default' : 'gnue-reports' },
{ 'Name' : 'FormDir',
'Type' : 'Setting',
'Comment' : 'Directory to search for .gfd files.',
'Description': 'Directory to search for .gfd files.',
'Typecast' : GTypecast.text,
! 'Default' : 'forms' },
{ 'Name' : 'ProcessDir',
'Type' : 'Setting',
'Comment' : 'Directory to search for .gpd files.',
'Description': 'Directory to search for .gpd files.',
'Typecast' : GTypecast.text,
! 'Default' : 'navigator' },
!
{ 'Name' : 'disableSplash',
'Type' : 'Setting',
'Comment' : "Do not display the splashscreen.",
Index: gnue/navigator/src/GNObjects.py
diff -c gnue/navigator/src/GNObjects.py:1.8 gnue/navigator/src/GNObjects.py:1.9
*** gnue/navigator/src/GNObjects.py:1.8 Sat May 4 12:45:08 2002
--- gnue/navigator/src/GNObjects.py Tue Jun 4 19:20:47 2002
***************
*** 1,6 ****
#
- # Copyright 2002 Free Software Foundation
- #
# This file is part of GNU Enterprise.
#
# GNU Enterprise is free software; you can redistribute it
--- 1,4 ----
***************
*** 18,23 ****
--- 16,23 ----
# write to the Free Software Foundation, Inc., 59 Temple Place
# - Suite 330, Boston, MA 02111-1307, USA.
#
+ # Copyright 2002 Free Software Foundation
+ #
# FILE:
# GNObjects.py
#
***************
*** 72,78 ****
else:
command = string.split("%s"%(formCommand))
command.append('"%s"' % formfile)
!
GDebug.printMesg(1,'Running command " %s "'%(command))
os.spawnve(os.P_NOWAIT,command[0],command,os.environ)
--- 72,78 ----
else:
command = string.split("%s"%(formCommand))
command.append('"%s"' % formfile)
!
GDebug.printMesg(1,'Running command " %s "'%(command))
os.spawnve(os.P_NOWAIT,command[0],command,os.environ)
***************
*** 81,93 ****
GDebug.printMesg(1,'Running app "%s"'%(step.location))
command = string.split(step.location)
!
if sys.platform != 'win32':
os.spawnvpe(os.P_NOWAIT,command[0],command,os.environ)
else:
# TODO: Not tested
os.spawnve(os.P_NOWAIT,command[0],command,os.environ)
!
def _runReport(self, step):
GDebug.printMesg(1,'Reports Spawning Not Yet Implemented.')
pass
--- 81,93 ----
GDebug.printMesg(1,'Running app "%s"'%(step.location))
command = string.split(step.location)
!
if sys.platform != 'win32':
os.spawnvpe(os.P_NOWAIT,command[0],command,os.environ)
else:
# TODO: Not tested
os.spawnve(os.P_NOWAIT,command[0],command,os.environ)
!
def _runReport(self, step):
GDebug.printMesg(1,'Reports Spawning Not Yet Implemented.')
pass
Index: gnue/navigator/src/UIwxpython.py
diff -c gnue/navigator/src/UIwxpython.py:1.7
gnue/navigator/src/UIwxpython.py:1.8
*** gnue/navigator/src/UIwxpython.py:1.7 Tue Jun 4 17:59:44 2002
--- gnue/navigator/src/UIwxpython.py Tue Jun 4 19:20:47 2002
***************
*** 31,54 ****
from wxPython.wx import *
from time import sleep
class Instance(wxApp):
def __init__(self, processes):
self.processes = processes
wxApp.__init__(self)
! def run(self):
self.MainLoop()
def OnInit(self):
! self.frame = wxFrame(NULL, -1, "Nothing", size=wxSize(500,250))
self.frame.SetSize(wxSize(300,400))
EVT_CLOSE(self.frame,self.OnClose)
self.menu = MenuBar(self)
self.frame.SetMenuBar(self.menu)
self.tree = wxTreeCtrl(self.frame,-1)
EVT_TREE_SEL_CHANGED(self, self.tree.GetId(), self.OnTreeItemSelected)
EVT_TREE_ITEM_ACTIVATED(self, self.tree.GetId(), self.OnTreeItemActivated)
--- 31,60 ----
from wxPython.wx import *
from time import sleep
+ import os, sys, string
+ from gnue.common import GDataObjects, GConnections, dyn_import, openResource
class Instance(wxApp):
def __init__(self, processes):
self.processes = processes
wxApp.__init__(self)
+ self._formInstances = {}
+ self._lastSerialNumber = 0
! def run(self, connections):
! self.connections = connections
self.MainLoop()
def OnInit(self):
! self.frame = wxFrame(NULL, -1, "GNUe Navigator", size=wxSize(500,250))
self.frame.SetSize(wxSize(300,400))
EVT_CLOSE(self.frame,self.OnClose)
self.menu = MenuBar(self)
self.frame.SetMenuBar(self.menu)
self.tree = wxTreeCtrl(self.frame,-1)
+ self.processes.setClientHandlers({'form':self.runForm})
EVT_TREE_SEL_CHANGED(self, self.tree.GetId(), self.OnTreeItemSelected)
EVT_TREE_ITEM_ACTIVATED(self, self.tree.GetId(), self.OnTreeItemActivated)
***************
*** 58,64 ****
self.tree.Expand(self.processes.__node)
- # self.frame.Fit()
self.frame.Show(true)
return 1
--- 64,69 ----
***************
*** 80,115 ****
self.frame.Destroy()
def buildMenu(self, process):
!
! return
!
! self.selections = []
! self.selection = 0
! self.list.DeleteAllItems()
!
! for child in process._children:
!
! if child._type == 'GNProcess':
! self.list.InsertStringItem(self.list.GetItemCount(),"%s >" %
child.description)
! elif child._type == 'GNStep':
! self.list.InsertStringItem(self.list.GetItemCount(),child.description)
! self.selections.append(child)
!
! if process._parent:
!
! top = process._parent
! while top._parent:
! top = top._parent
!
! if top != process._parent:
! self.list.InsertStringItem(self.list.GetItemCount(),'[Back to %s]'%
process._parent.description)
! self.selections.append(process._parent)
!
! self.list.InsertStringItem(self.list.GetItemCount(),'[Back to Top]')
! self.selections.append(top)
!
! self.frame.SetTitle(process._type == 'GNProcesses' and process.title or \
! process.description)
def OnTreeItemSelected(self, event):
--- 85,92 ----
self.frame.Destroy()
def buildMenu(self, process):
! self.tree.Expand(process.__node)
! return 1
def OnTreeItemSelected(self, event):
***************
*** 145,151 ****
--- 122,197 ----
wxEndBusyCursor()
+ def runForm(self, step):
+ if os.path.basename(step.location) == step.location:
+ try:
+ formdir = gConfig('FormDir')
+ except KeyError:
+ formdir = ""
+ formfile = os.environ['INSTALL_PREFIX']+'/'+formdir+"/"+step.location
+ else:
+ formfile = step.location
+
+ try:
+ from gnue.forms.GFInstance import GFInstance
+ from gnue.forms import GFParser
+ except ImportError:
+ self.handleError('GNUe Forms is not installed on your system')
+ return
+
+ try:
+ #
+ # Create the instance
+ #
+ self._ui = dyn_import("gnue.forms.uidrivers.wx")
+ self._ui.__dict__['__wxApp'] = self
+
+ instance = GFInstance(self, self.getNextSerialNumber(),
+ connections=self.connections, ui=self._ui, disableSplash=1)
+ self._formInstances[instance.getSerialNumber()] = instance
+ #
+ # Assign the proper login handler based upon the user interface choice
+ #
+ self.connections.setLoginHandler(self._ui.UILoginHandler())
+
+ #
+ # Build the form tree
+ #
+ fileHandle = openResource(formfile)
+ form = GFParser.loadForm (fileHandle, instance)
+ fileHandle.close()
+
+ #
+ # Start the instance
+ #
+ instance.setForm(form)
+ instance.activate()
+
+ except GConnections.Error, mesg:
+ self.handleError(mesg)
+
+ except IOError, mesg:
+ self.handleError(_("Unable to open file\n\n %s")%mesg)
+
+ except GDataObjects.ConnectError, mesg:
+ self.handleError(\
+ _("Unable to login to datasource.\n\n %s") %mesg)
+
+ except GDataObjects.ConnectionError, mesg:
+ self.handleError(\
+ _("Error while communicating with datasource.\n\n %s") %mesg)
+
+ except GDataObjects.Error, mesg:
+ self.handleError(mesg)
+
+
+ def getNextSerialNumber (self):
+ self._lastSerialNumber = self._lastSerialNumber + 1
+ return self._lastSerialNumber
+
+ def handleError(self, mesg):
+ print mesg
ID_EXIT = wxNewId()
ID_FAV_ORG = wxNewId()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue designer/src/MenuBar.py forms/src/GFClient...,
Jason Cater <=