Exemplo n.º 1
0
    def __init__(self,defaultfont=None):
        xmlstore.util.referencedobject.__init__(self)
        
        reportschema = os.path.join(common.getDataRoot(),'schemas/report/gotmgui.schema')
        self.store = xmlstore.xmlstore.TypedStore(reportschema)

        self.defaultstore = xmlstore.xmlstore.TypedStore(reportschema)

        # Set some default properties.
        self.defaultstore['Figures/Width'      ].setValue(10)
        self.defaultstore['Figures/Height'     ].setValue(8)
        self.defaultstore['Figures/Resolution' ].setValue(96)
        self.defaultstore['Figures/FontScaling'].setValue(100)
        self.defaultstore['Figures/FontName'   ].setValue(defaultfont)

        self.store.setDefaultStore(self.defaultstore)
Exemplo n.º 2
0
guiscenarioversion = 'gotmgui-0.5.0'
savedscenarioversion = 'gotm-4.0.0'

# Import modules from standard Python library
import os, shutil, re, datetime, sys

# Import our own custom modules
import xmlstore.xmlstore, xmlstore.util, xmlstore.datatypes
import common, namelist

# Some parts of the schemas will be loaded from the GOTM source directory.
# For the developer's version, the source directory can be found one level below the GUI.
# For the frozen version (py2exe build), the required files are present in the gotmsrc
# subdirectory directly below the GUI directory.
if hasattr(sys,'frozen'):
    srcdir = os.path.abspath(os.path.join(common.getDataRoot(),'gotmsrc'))
else:
    srcdir = os.path.abspath(os.path.join(common.getDataRoot(),'../src'))
if os.path.isdir(srcdir): xmlstore.xmlstore.Schema.knownpaths['gotmsrc'] = srcdir

schemadir = None

class NamelistStore(xmlstore.xmlstore.TypedStore):

    def __init__(self,*args,**kwargs):
        super(NamelistStore,self).__init__(*args,**kwargs)

        self.namelistextension = self.root.templatenode.getAttribute('namelistextension')

    @classmethod
    def fromNamelists(cls,path,prototypepath=None,targetversion=None,strict = False,requireplatform=None,root=None):
Exemplo n.º 3
0
 def getSchemaInfo(cls):
     global schemadir
     if schemadir is None: schemadir = os.path.join(common.getDataRoot(),'schemas/scenario')
     return xmlstore.xmlstore.schemainfocache[schemadir]
Exemplo n.º 4
0
 def __init__(self, schema=None):
     if schema is None:
         schema = os.path.join(common.getDataRoot(), "schemas/settings/gotmgui.schema")
     xmlstore.xmlstore.TypedStore.__init__(self, schema)