[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue common/src/FileUtils.py forms/src/GFClient...
From: |
James Thompson |
Subject: |
gnue common/src/FileUtils.py forms/src/GFClient... |
Date: |
Wed, 12 Feb 2003 22:27:31 -0500 |
CVSROOT: /cvsroot/gnue
Module name: gnue
Changes by: James Thompson <address@hidden> 03/02/12 22:27:31
Modified files:
common/src : FileUtils.py
forms/src : GFClient.py GFForm.py GFInstance.py
forms/src/dialogs: _base.py
forms/src/dialogs/about: __init__.py about.gfd
forms/src/uidrivers/_base: UIdriver.py
Log message:
more <dialog> work
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/FileUtils.py.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFClient.py.diff?tr1=1.61&tr2=1.62&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFForm.py.diff?tr1=1.222&tr2=1.223&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFInstance.py.diff?tr1=1.82&tr2=1.83&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/dialogs/_base.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/dialogs/about/__init__.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/dialogs/about/about.gfd.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/uidrivers/_base/UIdriver.py.diff?tr1=1.86&tr2=1.87&r1=text&r2=text
Patches:
Index: gnue/common/src/FileUtils.py
diff -c gnue/common/src/FileUtils.py:1.4 gnue/common/src/FileUtils.py:1.5
*** gnue/common/src/FileUtils.py:1.4 Wed Jan 1 19:45:41 2003
--- gnue/common/src/FileUtils.py Wed Feb 12 22:27:30 2003
***************
*** 65,70 ****
--- 65,78 ----
############################################################
#
+ # Open a string buffer as a normal file
+ #
+ def openBuffer(buffer):
+ return cStringIO.StringIO(buffer)
+
+
+ ############################################################
+ #
# Open a file or URL resource,
# properly handling drive letters.
#
Index: gnue/forms/src/GFClient.py
diff -c gnue/forms/src/GFClient.py:1.61 gnue/forms/src/GFClient.py:1.62
*** gnue/forms/src/GFClient.py:1.61 Mon Feb 10 21:01:48 2003
--- gnue/forms/src/GFClient.py Wed Feb 12 22:27:30 2003
***************
*** 140,146 ****
disableSplash=self.disableSplash,
parameters=userParameters)
! instance.addFormFromFile(formfile)
instance.activate()
if __name__ == '__main__':
--- 140,147 ----
disableSplash=self.disableSplash,
parameters=userParameters)
! instance.addFormFromFile(formfile)
! instance.addDialogs()
instance.activate()
if __name__ == '__main__':
Index: gnue/forms/src/GFForm.py
diff -c gnue/forms/src/GFForm.py:1.222 gnue/forms/src/GFForm.py:1.223
*** gnue/forms/src/GFForm.py:1.222 Thu Jan 30 21:29:22 2003
--- gnue/forms/src/GFForm.py Wed Feb 12 22:27:30 2003
***************
*** 60,65 ****
--- 60,66 ----
GFObj.__init__(self, parent)
self._type = "GFForm"
self._currentObject = [self]
+ self.name="__main__"
self._databaseDictionary = {}
self._datasourceDictionary = {}
***************
*** 214,219 ****
--- 215,221 ----
self.initTriggerSystem()
self._triggerns.update(self._triggerNamespaceTree._globalNamespace)
+
## TODO: This ain't right! Fix after 0.5.0
self._triggerns['runForm'] = self.triggerRunForm
Index: gnue/forms/src/GFInstance.py
diff -c gnue/forms/src/GFInstance.py:1.82 gnue/forms/src/GFInstance.py:1.83
*** gnue/forms/src/GFInstance.py:1.82 Mon Feb 10 21:01:48 2003
--- gnue/forms/src/GFInstance.py Wed Feb 12 22:27:30 2003
***************
*** 33,45 ****
import os
import sys
from gnue.forms.GFForm import *
from gnue.forms.GFParser import loadFile
from gnue.forms import VERSION
from gnue.forms import GFKeyMapper
from gnue.common import GDebug, GDataObjects, GConnections
from gnue.common import events
! from gnue.common.FileUtils import openResource
from gnue.common.GClientApp import *
--- 33,48 ----
import os
import sys
+ import dircache
+
from gnue.forms.GFForm import *
from gnue.forms.GFParser import loadFile
from gnue.forms import VERSION
from gnue.forms import GFKeyMapper
from gnue.common import GDebug, GDataObjects, GConnections
from gnue.common import events
! from gnue.common.FileUtils import dyn_import
! from gnue.common.FileUtils import openResource, openBuffer
from gnue.common.GClientApp import *
***************
*** 93,98 ****
--- 96,104 ----
'fireTRIGGER' : self.fireTrigger,
'buttonActivated' : self.fireButton,
+ # Dialog Support
+ 'requestDIALOG' : self.activateDialog,
+
# "Entry" events (proxied)
'requestKEYPRESS' : self.proxyEntryEvent,
'requestREPLACEVALUE' : self.proxyEntryEvent,
***************
*** 139,166 ****
mapping[key[4:]] = options[key]
GFKeyMapper.KeyMapper.loadUserKeyMap(mapping)
!
#
# addFormFromFile
#
# Loads a GObj based form tree when passed a valid file name.
# A copy of the instance is passed into the parser so that
# it can work with things like the GConnections stored in
# the base app
#
! def addFormFromFile(self,fileName):
#
# Load the file bypassing the initialization
# We bypass the initialization because <dialog>s are
# really <form>s and they don't like being children
# of another form
#
! try:
! fileHandle=openResource(fileName)
! form = loadFile (fileHandle, self, initialize=0)
! fileHandle.close()
! except IOError, mesg:
! self.manager.handleStartupError(_("Unable to open file\n\n
%s")%mesg)
#
# Extract the child <dialog>s from the main form tree
--- 145,218 ----
mapping[key[4:]] = options[key]
GFKeyMapper.KeyMapper.loadUserKeyMap(mapping)
! #
! # addDialogs
! #
! # Loads the std dialog forms into memory
! #
! def addDialogs(self):
! #
! # Import and register dialogs
! #
! basedir = os.path.dirname(sys.modules[self.__module__].__file__)
! basedir +='/dialogs/'
!
! for dialogName in dircache.listdir(basedir):
! #try:
! if dialogName[0] != '_' and dialogName != 'CVS':
! print "DIALOG : ",basedir+dialogName
!
! if os.path.isfile(basedir+dialogName) and
os.path.splitext(dialogName)[1] == ".py":
! dialogName = os.path.splitext(dialogName)[0]
! print "FILE", dialogName
! dialog = dyn_import('gnue.forms.dialogs.%s' %(dialogName))
! elif os.path.isdir(basedir+dialogName):
! print "DIR", dialogName
! dialog = dyn_import('gnue.forms.dialogs.%s' %(dialogName))
! print "TYPE",type(dialog.buildForm()),dialog.buildForm()
! self.addFormFromBuffer(dialog.buildForm())
!
! #except ImportError, mesg:
! # GDebug.printMesg(2,"dialogs.%s doesn't appear to be a valid dialog"
% (dialogName))
! # GDebug.printMesg(5,' --> %s' % (mesg))
!
!
!
! def addFormFromBuffer(self,buffer):
! try:
! fileHandle=openBuffer(buffer)
! self.addFormFromFilehandle(fileHandle)
! fileHandle.close()
! except IOError, mesg:
! self.manager.handleStartupError(_("Unable to open file\n\n
%s")%mesg)
!
#
# addFormFromFile
#
+ def addFormFromFile(self,fileName):
+ try:
+ fileHandle=openResource(fileName)
+ self.addFormFromFilehandle(fileHandle)
+ fileHandle.close()
+ except IOError, mesg:
+ self.manager.handleStartupError(_("Unable to open file\n\n
%s")%mesg)
+
+ #
+ # addFormFromFilehandle
+ #
# Loads a GObj based form tree when passed a valid file name.
# A copy of the instance is passed into the parser so that
# it can work with things like the GConnections stored in
# the base app
#
! def addFormFromFilehandle(self,fileHandle):
#
# Load the file bypassing the initialization
# We bypass the initialization because <dialog>s are
# really <form>s and they don't like being children
# of another form
#
! form = loadFile (fileHandle, self, initialize=0)
#
# Extract the child <dialog>s from the main form tree
***************
*** 170,188 ****
#
# Add the main form into the dictionary
#
! self._formsDictionary['__main__'] = form
!
! #
! # Initialize all the forms
! #
! for dialog in self._formsDictionary.keys():
! object = self._formsDictionary[dialog]
! print "GFInstance Initializing ", object
! object.showTree()
! object.phaseInit()
- #self._form = form # TODO: temp hack to keep it working
-
#
# removes the subforms from the main tree before
# any UI stuff is constructed
--- 222,230 ----
#
# Add the main form into the dictionary
#
! print "Adding ", form.name
! self._formsDictionary[form.name] = form
#
# removes the subforms from the main tree before
# any UI stuff is constructed
***************
*** 202,207 ****
--- 244,258 ----
#
def activate(self):
#
+ # Initialize all the forms loaded into memory
+ #
+ for dialog in self._formsDictionary.keys():
+ object = self._formsDictionary[dialog]
+ print "GFInstance Initializing ", object
+ object.phaseInit()
+
+
+ #
# Construct an instance of the UI driver
self._uiinstance = self._uimodule.GFUserInterface(self.eventController,
self._disableSplash)
self._uiinstance.initialize()
***************
*** 600,611 ****
#
# Displays the about dialog
#
def executeAbout(self,event):
name = event._form.title or "Unknown"
formversion = event._form.getOption('version') or "Unknown"
author = event._form.getOption('author') or "Unknown"
description = event._form.getOption('description') or "Unknown"
!
self.dispatchEvent('uiABOUT',[VERSION,name,formversion,author,description])
#
# toggleInsertMode(self):
--- 651,665 ----
#
# Displays the about dialog
#
+ # TODO: This will go away once the generic dialog callbacks are working
def executeAbout(self,event):
name = event._form.title or "Unknown"
formversion = event._form.getOption('version') or "Unknown"
author = event._form.getOption('author') or "Unknown"
description = event._form.getOption('description') or "Unknown"
! self.activateForm('_about')
!
!
#self.dispatchEvent('uiABOUT',[VERSION,name,formversion,author,description])
#
# toggleInsertMode(self):
***************
*** 637,642 ****
--- 691,704 ----
def executeRollback(self,event):
event._form.rollback()
self._entryUpdated()
+
+ #
+ # activateDialog
+ #
+ def activateDialog(self,event):
+ print "Fooolz! Phear my mad dialogz! ", event.__dict__
+ #self.activateForm(event.dialogName)
+
#
# changeFocus
Index: gnue/forms/src/dialogs/_base.py
diff -c gnue/forms/src/dialogs/_base.py:1.1 gnue/forms/src/dialogs/_base.py:1.2
*** gnue/forms/src/dialogs/_base.py:1.1 Mon Feb 10 21:01:49 2003
--- gnue/forms/src/dialogs/_base.py Wed Feb 12 22:27:31 2003
***************
*** 1,5 ****
def buildForm():
! formFile = open('about.gfd')
form = formFile.readlines()
formFile.close()
! retun form
--- 1,14 ----
+ import os, sys
+
+ dialogName = ''
+
def buildForm():
! basedir = os.path.dirname(__file__)
! #basedir +='/dialogs/'
!
! print "Da basedir is", basedir+dialogName
!
! formFile = open(basedir+dialogName)
form = formFile.readlines()
formFile.close()
! return form
Index: gnue/forms/src/dialogs/about/__init__.py
diff -c gnue/forms/src/dialogs/about/__init__.py:1.1
gnue/forms/src/dialogs/about/__init__.py:1.2
*** gnue/forms/src/dialogs/about/__init__.py:1.1 Mon Feb 10 21:01:49 2003
--- gnue/forms/src/dialogs/about/__init__.py Wed Feb 12 22:27:31 2003
***************
*** 1 ****
! from gnue.forms.uidriver.dialogs._base import buildForm
--- 1,13 ----
! import os, sys
!
! dialogName = '/about.gfd'
!
! def buildForm():
! basedir = os.path.dirname(__file__)
! print "BASE DIR", basedir
!
! formFile = open(basedir+dialogName)
! form = formFile.read()
! formFile.close()
! return form
!
Index: gnue/forms/src/dialogs/about/about.gfd
diff -c gnue/forms/src/dialogs/about/about.gfd:1.1
gnue/forms/src/dialogs/about/about.gfd:1.2
*** gnue/forms/src/dialogs/about/about.gfd:1.1 Mon Feb 10 21:01:49 2003
--- gnue/forms/src/dialogs/about/about.gfd Wed Feb 12 22:27:31 2003
***************
*** 0 ****
--- 1,38 ----
+ <?xml version="1.0"?>
+
+ <!-- GNUe Forms 0.5.0 Migration Tool
+ Saved on: 2003-02-11 18:56:36 -->
+
+ <form style="dialog" name="_about">
+ <options/>
+ <logic>
+ <block name="Block_1">
+ <field name="app_version"/>
+ <field name="ui_driver"/>
+ <field name="name"/>
+ <field name="form_version"/>
+ <field name="author"/>
+ <field name="description"/>
+ </block>
+ </logic>
+ <layout xmlns:c="GNUe:Layout:Char" c:height="15" c:width="40">
+ <page name="Page_1">
+ <label name="Label_1" text="GNUe Forms:" c:width="11" c:x="1" c:y="1"/>
+ <label name="Label_2" text="Version:" c:width="8" c:x="2" c:y="2"/>
+ <label name="Label_3" text="Driver:" c:width="7" c:x="2" c:y="3"/>
+ <label name="Label_4" text="Name:" c:width="5" c:x="2" c:y="6"/>
+ <label name="Label_5" text="Version:" c:width="8" c:x="2" c:y="7"/>
+ <label name="Label_6" text="Author:" c:width="7" c:x="2" c:y="8"/>
+ <label name="Label_7" text="Description:" c:width="12" c:x="2" c:y="9"/>
+ <box name="Box_1" c:height="11" label="Form Information" c:width="38"
+ c:x="1" c:y="4"/>
+ <entry block="Block_1" field="app_version" c:width="26" c:x="11"
c:y="2" style="label"/>
+ <entry block="Block_1" field="ui_driver" c:width="26" c:x="11" c:y="3"
style="label"/>
+ <entry block="Block_1" field="name" c:width="26" c:x="11" c:y="6"
style="label"/>
+ <entry block="Block_1" field="form_version" c:width="26" c:x="11"
c:y="7" style="label"/>
+ <entry block="Block_1" field="author" c:width="26" c:x="11" c:y="8"
style="label"/>
+ <entry block="Block_1" field="description" c:height="4" c:width="36"
c:x="2"
+ c:y="10"/>
+ </page>
+ </layout>
+ </form>
Index: gnue/forms/src/uidrivers/_base/UIdriver.py
diff -c gnue/forms/src/uidrivers/_base/UIdriver.py:1.86
gnue/forms/src/uidrivers/_base/UIdriver.py:1.87
*** gnue/forms/src/uidrivers/_base/UIdriver.py:1.86 Mon Feb 10 21:01:49 2003
--- gnue/forms/src/uidrivers/_base/UIdriver.py Wed Feb 12 22:27:31 2003
***************
*** 373,381 ****
author = event.data[3]
description = event.data[4]
! about = self._DIALOGS['about'](self.mainWindow, programVersion, formName,
formVersion, author, description)
! about.showModal()
! about.destroy()
--- 373,384 ----
author = event.data[3]
description = event.data[4]
!
! self.dispatchEvent('requestDIALOG', dialogName="_about")# , object,
_form=object._form)
!
! #about = self._DIALOGS['about'](self.mainWindow, programVersion,
formName, formVersion, author, description)
! #about.showModal()
! #about.destroy()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue common/src/FileUtils.py forms/src/GFClient...,
James Thompson <=