Mercurial > traipse_dev
annotate upmana/manifest.py @ 171:ff48c2741fe7 beta
Traipse Beta 'OpenRPG' {091210-00}
Traipse is a distribution of OpenRPG that is designed to be easy to
setup and go. Traipse also makes it easy for developers to work on code
without fear of sacrifice. 'Ornery-Orc' continues the trend of 'Grumpy'
and adds fixes to the code. 'Ornery-Orc's main goal is to offer more
advanced features and enhance the productivity of the user.
Update Summary (Beta)
New Features:
Added Bookmarks
Added 'boot' command to remote admin
Added confirmation window for sent nodes
Minor changes to allow for portability to an OpenSUSE linux OS
Miniatures Layer pop up box allows users to turn off Mini labels, from
FlexiRPG
Zoom Mouse plugin added
Images added to Plugin UI
Switching to Element Tree
Map efficiency, from FlexiRPG
Added Status Bar to Update Manager
New TrueDebug Class in orpg_log (See documentation for usage)
Portable Mercurial
Tip of the Day added, from Core and community
New Reference Syntax added for custom PC sheets
New Child Reference for gametree
New Gametree Recursion method, mapping, context sensitivity, and
effeciency..
New Features node with bonus nodes and Node Referencing help added
Added 7th Sea die roller method; ie [7k3] =
[7d10.takeHighest(3).open(10)]
New 'Mythos' System die roller added
Added new vs. die roller method for WoD; ie [3v3] = [3d10.vs(3)].
Includes support for Mythos roller.
Fixes:
Fix to Text based Server
Fix to Remote Admin Commands
Fix to Pretty Print, from Core
Fix to Splitter Nodes not being created
Fix to massive amounts of images loading, from Core
Fix to Map from gametree not showing to all clients
Fix to gametree about menus
Fix to Password Manager check on startup
Fix to PC Sheets from tool nodes. They now use the tabber_panel
Fixed Whiteboard ID to prevent random line or text deleting.
Modified ID's to prevent non updated clients from ruining the fix.
default_manifest.xml renamed to default_upmana.xml
Fix to Update Manager; cleaner clode for saved repositories
Fixes made to Settings Panel and no reactive settings when Ok is
pressed.
author | sirebral |
---|---|
date | Thu, 10 Dec 2009 22:30:40 -0600 |
parents | e842a5f1b775 |
children |
rev | line source |
---|---|
135 | 1 from __future__ import with_statement |
2 | |
66 | 3 from orpg.dirpath import dir_struct |
135 | 4 from upmana.validate import validate |
5 from orpg.tools.orpg_log import logger | |
6 from os import sep, getcwd | |
33
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
7 from types import * |
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
8 |
135 | 9 from xml.etree.ElementTree import ElementTree, Element, parse, fromstring |
10 from xml.etree.ElementPath import find | |
11 | |
12 class ManifestChanges(object): | |
13 etree = ElementTree() | |
14 filename = dir_struct['home'] + 'upmana' + sep + 'upmana.xml' | |
33
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
15 |
135 | 16 def __new__(cls, *args, **kwargs): |
17 it = cls.__dict__.get("__it__") | |
18 if it is not None: | |
19 return it | |
20 cls.__it__ = it = object.__new__(cls) | |
21 it._init() | |
22 return it | |
23 | |
24 def _init(self): | |
25 validate.config_file('upmana.xml', "default_upmana.xml") | |
26 self.LoadDoc() | |
27 | |
28 def PluginChildren(self, plugname): | |
29 plugin = self.etree.find(plugname) | |
30 children = plugin.getchildren() | |
31 nodes = [] | |
32 for child in children: | |
33 nodes.append(child.tag) | |
34 return nodes | |
35 | |
36 def GetString(self, plugname, strname, defaultval="", verbose=False): | |
33
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
37 strname = self.safe(strname) |
135 | 38 plugin = self.etree.find(plugname) |
39 if plugin is None or plugin.find(strname) is None: | |
40 msg = ["plugindb: no value has been stored for", strname, "in", | |
41 plugname, "so the default has been returned"] | |
33
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
42 return defaultval |
135 | 43 return self.normal(plugin.find(strname).text or '') |
44 | |
45 def DelString(self, plugname, strname): | |
46 strname = self.safe(strname) | |
47 plugin = self.etree.find(plugname) | |
48 plugin.remove(plugin.find(strname)) | |
49 self.SaveDoc() | |
33
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
50 |
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
51 def SetString(self, plugname, strname, val): |
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
52 val = self.safe(val) |
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
53 strname = self.safe(strname) |
135 | 54 plugin = self.etree.find(plugname) |
55 if plugin is None: | |
56 plugin = Element(plugname) | |
57 self.etree.getroot().append(plugin) | |
58 str_el = plugin.find(strname) | |
59 if str_el is None: | |
60 str_el = Element(strname) | |
61 str_el.set('type', 'str') | |
62 plugin.append(str_el) | |
63 str_el.text = val | |
64 self.SaveDoc() | |
34
8b630fc8a343
Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents:
33
diff
changeset
|
65 |
33
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
66 def FetchList(self, parent): |
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
67 retlist = [] |
140 | 68 for litem in parent.find('list').findall('lobject'): |
135 | 69 if litem.get('type') == 'int': retlist.append(int(litem.text)) |
70 if litem.get('type') == 'bool': retlist.append(litem.text == 'True') | |
71 elif litem.get('type') == 'float': retlist.append(float(litem.text)) | |
72 elif litem.get('type') == 'list': retlist.append(self.FetchList(litem)) | |
73 elif litem.get('type') == 'dict': retlist.append(self.FetchDict(litem)) | |
74 else: retlist.append(str(self.normal(litem.text))) | |
75 return retlist | |
76 | |
77 def GetList(self, plugname, listname, defaultval=list(), verbose=False): | |
78 listname = self.safe(listname) | |
79 plugin = self.etree.find(plugname) | |
80 if plugin is None or plugin.find(listname) is None: | |
81 msg = ["plugindb: no value has been stored for", listname, "in", | |
82 plugname, "so the default has been returned"] | |
83 return defaultval | |
84 retlist = self.FetchList(plugin.find(listname)) | |
33
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
85 return retlist |
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
86 |
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
87 def BuildList(self, val): |
135 | 88 list_el = Element('list') |
33
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
89 for item in val: |
135 | 90 i = Element('lobject') |
91 if isinstance(item, bool): | |
92 i.set('type', 'bool') | |
93 i.text = str(item) | |
94 elif isinstance(item, int):#it's an int | |
95 i.set('type', 'int') | |
96 i.text = str(item) | |
97 elif isinstance(item, float):#it's a float | |
98 i.set('type', 'float') | |
99 i.text = str(item) | |
100 elif isinstance(item, (list, tuple)):#it's a list | |
101 i.set('type', 'list') | |
102 i.append(self.BuildList(item)) | |
103 elif isinstance(item, dict):#it's a dictionary | |
104 i.set('type', 'dict') | |
105 i.append(self.BuildDict(item)) | |
106 else: | |
107 i.set('type', 'str') | |
108 i.text = self.safe(item) | |
109 list_el.append(i) | |
110 return list_el | |
33
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
111 |
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
112 def SetList(self, plugname, listname, val): |
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
113 listname = self.safe(listname) |
135 | 114 plugin = self.etree.find(plugname) |
115 if plugin is None: | |
116 plugin = Element(plugname) | |
117 self.etree.getroot().append(plugin) | |
118 list_el = plugin.find(listname) | |
119 if list_el is None: | |
120 list_el = Element(listname) | |
121 list_el.set('type', 'list') | |
122 plugin.append(list_el) | |
33
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
123 else: |
135 | 124 list_el.remove(list_el.find('list')) |
125 list_el.append(self.BuildList(val)) | |
126 self.SaveDoc() | |
33
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
127 |
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
128 def BuildDict(self, val): |
135 | 129 dict_el = Element('dict') |
130 for key, item in val.items(): | |
131 i = Element('dobject') | |
132 if isinstance(item, bool): | |
133 i.set('type', 'bool') | |
134 i.set('name', self.safe(key)) | |
135 i.text = str(item) | |
136 elif isinstance(item, int):#it's an int | |
137 i.set('type', 'int') | |
138 i.set('name', self.safe(key)) | |
139 i.text = str(item) | |
140 elif isinstance(item, float):#it's a float | |
141 i.set('type', 'float') | |
142 i.set('name', self.safe(key)) | |
143 i.text = str(item) | |
144 elif isinstance(item, (list, tuple)):#it's a list | |
145 i.set('type', 'list') | |
146 i.set('name', self.safe(key)) | |
147 i.append(self.BuildList(item)) | |
148 elif isinstance(item, dict):#it's a dictionary | |
149 i.set('type', 'dict') | |
150 i.set('name', self.safe(key)) | |
151 i.append(self.BuildDict(item)) | |
152 else: | |
153 i.set('type', 'str') | |
154 i.set('name', self.safe(key)) | |
155 i.text = self.safe(item) | |
156 dict_el.append(i) | |
157 return dict_el | |
33
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
158 |
135 | 159 def SetDict(self, plugname, dictname, val): |
33
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
160 dictname = self.safe(dictname) |
135 | 161 plugin = self.etree.find(plugname) |
162 if plugin is None: | |
163 plugin = Element(plugname) | |
164 self.etree.getroot().append(plugin) | |
165 dict_el = plugin.find(dictname) | |
166 if dict_el is None: | |
167 dict_el = Element(dictname) | |
168 dict_el.set('type', 'dict') | |
169 plugin.append(dict_el) | |
33
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
170 else: |
135 | 171 dict_el.remove(list_el.find('dict')) |
172 dict_el.append(self.BuildDict(val)) | |
173 self.SaveDoc() | |
33
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
174 |
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
175 def FetchDict(self, parent): |
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
176 retdict = {} |
135 | 177 for ditem in parent.findall('dobject'): |
178 key = self.normal(ditem.get('name')) | |
179 if ditem.get('type') == 'int': value = int(ditem.text) | |
180 elif ditem.get('type') == 'bool': value = ditem.text == 'True' | |
181 elif ditem.get('type') == 'float': value = float(ditem.text) | |
182 elif ditem.get('type') == 'list': value = self.FetchList(ditem) | |
183 elif ditem.get('type') == 'dict': value = self.FetchDict(ditem) | |
184 else: value = str(self.normal(ditem[0])) | |
185 retdict[key] = value | |
33
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
186 return retdict |
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
187 |
135 | 188 def GetDict(self, plugname, dictname, defaultval=dict(), verbose=False): |
33
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
189 dictname = self.safe(dictname) |
135 | 190 plugin = self.etree.find(plugname) |
191 if plugin is None or plugin.find(dictname) is None: | |
192 msg = ["plugindb: no value has been stored for", dictname, "in", | |
193 plugname, "so the default has been returned"] | |
33
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
194 return defaultval |
135 | 195 retdict = self.FetchDict(plugin.find(dictname)) |
196 return retdict | |
33
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
197 |
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
198 def safe(self, string): |
135 | 199 return string.replace("<", "$$lt$$").replace(">", "$$gt$$")\ |
200 .replace("&","$$amp$$").replace('"',"$$quote$$") | |
33
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
201 |
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
202 def normal(self, string): |
135 | 203 return string.replace("$$lt$$", "<").replace("$$gt$$", ">")\ |
204 .replace("$$amp$$","&").replace("$$quote$$",'"') | |
33
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
205 |
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
206 def SaveDoc(self): |
135 | 207 with open(self.filename, "w") as f: |
208 self.etree.write(f) | |
33
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
209 |
3687514e0218
I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff
changeset
|
210 def LoadDoc(self): |
135 | 211 with open(self.filename) as f: |
212 self.etree.parse(f) | |
213 | |
214 manifest = ManifestChanges() |