[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/designer/src/projects Parser.py Project.py
From: |
Jason Cater |
Subject: |
gnue/designer/src/projects Parser.py Project.py |
Date: |
Mon, 04 Nov 2002 00:24:08 -0500 |
CVSROOT: /home/cvs
Module name: gnue
Changes by: Jason Cater <address@hidden> 02/11/04 00:24:08
Modified files:
designer/src/projects: Parser.py Project.py
Log message:
start of project support
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/projects/Parser.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/projects/Project.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
Patches:
Index: gnue/designer/src/projects/Parser.py
diff -c gnue/designer/src/projects/Parser.py:1.1
gnue/designer/src/projects/Parser.py:1.2
*** gnue/designer/src/projects/Parser.py:1.1 Sat Nov 2 01:02:01 2002
--- gnue/designer/src/projects/Parser.py Mon Nov 4 00:24:07 2002
***************
*** 22,28 ****
--- 22,154 ----
# Project.py
#
# DESCRIPTION:
+ # Class that contains a sax based xml processor for GNUe project support
#
# NOTES:
#
+
+ from gnue.common import GParser
+
+ import copy, types
+ from gnue.common import GTypecast
+
+
+
+
+
+
+ ########
+ ######## Please keep this file neat !!!
+ ########
+
+
+
+
+
+
+ #######################################################
+ # This method loads a form from an XML file and returns
+ # a GDProject object. If initialize is 1 (default),
+ # then the process def is initialized and ready to go.
+ #######################################################
+
+ def loadProject(buffer, initialize=1):
+ return GParser.loadXMLObject (buffer, xmlProcessHandler, 'GNProcesses',
'processes',
+ initialize, attributes={})
+
+
+ xmlElements = None
+
+
+ def getXMLelements():
+
+ global xmlElements
+
+ if xmlElements == None:
+ import Objects
+
+ xmlElements = {
+ 'project': {
+ 'BaseClass': Objects.GPProject,
+ # 'Required': 1,
+ 'SingleInstance': 1,
+ 'Attributes': {
+ 'title': {
+ 'Typecast': GTypecast.text,
+ 'Default': 'Untitled Menu' } },
+ 'ParentTags': None },
+
+ 'files': {
+ 'BaseClass': Objects.GNProcess,
+ 'Attributes': {
+ 'id': {
+ # 'Required': 1,
+ 'Unique': 1,
+ 'Typecast': GTypecast.name },
+ 'title': {
+ 'Typecast': GTypecast.text } },
+ 'ParentTags': ('processes','process') },
+
+ 'file': {
+ 'BaseClass': Objects.GPFile,
+ 'Attributes': {
+ 'name': {
+ 'Unique': 1,
+ 'Typecast': GTypecast.name },
+ 'type': {
+ 'Required': 1,
+ 'ValueSet': {
+ 'app': {},
+ 'form': {},
+ 'report': {} },
+ 'Typecast': GTypecast.name },
+ 'location': {
+ 'Typecast': GTypecast.text },
+ 'title': {
+ 'Typecast': GTypecast.text } },
+ 'ParentTags': ('process',) },
+
+ 'parameter': {
+ 'BaseClass': Objects.GNParameter,
+ 'Required': 1,
+ 'Attributes': {
+ 'name': {
+ 'Required': 1,
+ 'Typecast': GTypecast.name },
+ 'value': {
+ 'Unique': 1,
+ 'Typecast': GTypecast.text } },
+ 'ParentTags': ('parameter',) },
+
+ 'description': {
+ 'BaseClass': Objects.GNDescription,
+ 'Attributes': {},
+ 'MixedContent': 1,
+ 'KeepWhitespace': 1,
+ 'UsableBySiblings': 1,
+ 'SingleInstance': 1,
+ 'ParentTags': ('process') },
+
+ }
+
+
+ return xmlElements
+
+
+ #######################################################
+ #
+ # xmlFormsHandler
+ #
+ # This class is called by the XML parser to
+ # process the xml file.
+ #
+ #######################################################
+
+ class xmlProcessHandler (GParser.xmlHandler):
+ def __init__(self):
+
+ GParser.xmlHandler.__init__(self)
+
+ self.xmlElements = getXMLelements()
+
Index: gnue/designer/src/projects/Project.py
diff -c gnue/designer/src/projects/Project.py:1.1
gnue/designer/src/projects/Project.py:1.2
*** gnue/designer/src/projects/Project.py:1.1 Sat Nov 2 01:02:01 2002
--- gnue/designer/src/projects/Project.py Mon Nov 4 00:24:07 2002
***************
*** 26,28 ****
--- 26,51 ----
# NOTES:
#
+ from Parser import loadProject
+ import Objects
+
+ class Project:
+
+ def __init__(self, location=None):
+ if location:
+ self.project = loadProject(self)
+ else:
+ self.project = Objects.GDProject()
+ self.location = location
+
+ def saveProject(self):
+ if not self.location:
+ raise "Location not set in Project.saveProject"
+
+ # TODO: 1) check for file io errors
+ # TODO: 2) make backup copy of a project file
+ file = open(self.location,'w')
+ file.write(self.project.dumpXML())
+ file.close()
+
+ ##def getProperty(self, property):
\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue/designer/src/projects Parser.py Project.py,
Jason Cater <=