comparison upmana/manifest.py @ 34:8b630fc8a343 traipse_dev

Updated the Update Manager to 0.3. Settings are being created with a clone of the PulginDB. Repos can be added, GUI does not update, Repo list needs a scrollbar. Repo tab buttons will not work except for New.
author sirebral
date Mon, 03 Aug 2009 11:56:17 -0500
parents 3687514e0218
children 52f6a38f8885
comparison
equal deleted inserted replaced
33:3687514e0218 34:8b630fc8a343
1 import xmltramp 1 import xmltramp
2 import orpg.dirpath 2 import orpg.dirpath
3 import orpg.tools.validate 3 import orpg.tools.validate
4 from types import * 4 from types import *
5 5
6 class PluginDB: 6 class ManifestChanges:
7 def __init__(self, filename="updatemana.xml"): 7 def __init__(self, filename="updatemana.xml"):
8 self.filename = orpg.dirpath.dir_struct["user"] + filename 8 self.filename = orpg.dirpath.dir_struct["user"] + filename
9 #orpg.tools.validate.Validate().config_file(filename,"default_plugindb.xml") 9 orpg.tools.validate.Validate().config_file(filename,"default_manifest.xml")
10 self.xml_dom = self.LoadDoc() 10 self.xml_dom = self.LoadDoc()
11 11
12 def GetString(self, plugname, strname, defaultval, verbose=0): 12 def GetString(self, plugname, strname, defaultval, verbose=0):
13 strname = self.safe(strname) 13 strname = self.safe(strname)
14 for plugin in self.xml_dom: 14 for plugin in self.xml_dom:
19 if verbose: print "successfully found the value" 19 if verbose: print "successfully found the value"
20 if len(child): return str( self.normal(child[0]) ) 20 if len(child): return str( self.normal(child[0]) )
21 else: return "" 21 else: return ""
22 else: 22 else:
23 if verbose: 23 if verbose:
24 print "plugindb: no value has been stored for " + strname + " in " + plugname + " so the default has been returned" 24 print "manifest: no value has been stored for " + strname + " in " + plugname + " so the default has been returned"
25 return defaultval 25 return defaultval
26 26
27 def SetString(self, plugname, strname, val): 27 def SetString(self, plugname, strname, val):
28 #Set Node, <repo, name, description, value> 28 #Set Node, <repo, name, description, value>
29 #Set Setting, <setting, value> 29 #Set Setting, <setting, value>
38 return "found plugin" 38 return "found plugin"
39 else: 39 else:
40 self.xml_dom[plugname] = xmltramp.parse("<" + strname + " type=\"string\">" + val + "</" + strname + ">") 40 self.xml_dom[plugname] = xmltramp.parse("<" + strname + " type=\"string\">" + val + "</" + strname + ">")
41 self.SaveDoc() 41 self.SaveDoc()
42 return "added plugin" 42 return "added plugin"
43
43 44
44 def FetchList(self, parent): 45 def FetchList(self, parent):
45 retlist = [] 46 retlist = []
46 if not len(parent): return [] 47 if not len(parent): return []
47 for litem in parent[0]._dir: 48 for litem in parent[0]._dir: