changeset 33:3687514e0218 traipse_dev

I actally forgot the Update Manager's new package. Sorry. Here it is!
author sirebral
date Sun, 02 Aug 2009 17:13:45 -0500
parents c223c1051f4a
children 8b630fc8a343
files upmana/__init__.py upmana/manifest.py upmana/updatemana.py upmana/xmltramp.py
diffstat 4 files changed, 908 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upmana/__init__.py	Sun Aug 02 17:13:45 2009 -0500
@@ -0,0 +1,1 @@
+__all__ = ['upmana']
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upmana/manifest.py	Sun Aug 02 17:13:45 2009 -0500
@@ -0,0 +1,183 @@
+import xmltramp
+import orpg.dirpath
+import orpg.tools.validate
+from types import *
+
+class PluginDB:
+    def __init__(self, filename="updatemana.xml"):
+        self.filename = orpg.dirpath.dir_struct["user"] + filename
+        #orpg.tools.validate.Validate().config_file(filename,"default_plugindb.xml")
+        self.xml_dom = self.LoadDoc()
+
+    def GetString(self, plugname, strname, defaultval, verbose=0):
+        strname = self.safe(strname)
+        for plugin in self.xml_dom:
+            if plugname == plugin._name:
+                for child in plugin._dir:
+                    if child._name == strname:
+                        #str() on this to make sure it's ASCII, not unicode, since orpg can't handle unicode.
+                        if verbose: print "successfully found the value"
+                        if len(child): return str( self.normal(child[0]) )
+                        else: return ""
+        else:
+            if verbose:
+                print "plugindb: no value has been stored for " + strname + " in " + plugname + " so the default has been returned"
+            return defaultval
+
+    def SetString(self, plugname, strname, val):
+        #Set Node, <repo, name, description, value>
+        #Set Setting, <setting, value>
+        val = self.safe(val)
+        strname = self.safe(strname)
+        for plugin in self.xml_dom:
+        ##this isn't absolutely necessary, but it saves the trouble of sending a parsed object instead of a simple string.
+            if plugname == plugin._name:
+                plugin[strname] = val
+                plugin[strname]._attrs["type"] = "string"
+                self.SaveDoc()
+                return "found plugin"
+        else:
+            self.xml_dom[plugname] = xmltramp.parse("<" + strname + " type=\"string\">" + val + "</" + strname + ">")
+            self.SaveDoc()
+            return "added plugin"
+
+    def FetchList(self, parent):
+        retlist = []
+        if not len(parent): return []
+        for litem in parent[0]._dir:
+            if len(litem):
+                if litem._attrs["type"] == "int": retlist += [int(litem[0])]
+                elif litem._attrs["type"] == "long": retlist += [long(litem[0])]
+                elif litem._attrs["type"] == "float": retlist += [float(litem[0])]
+                elif litem._attrs["type"] == "list": retlist += [self.FetchList(litem)]
+                elif litem._attrs["type"] == "dict": retlist += [self.FetchDict(litem)]
+                else: retlist += [str( self.normal(litem[0]) )]
+            else: retlist += [""]
+        return retlist
+
+    def GetList(self, plugname, listname, defaultval, verbose=0):
+        listname = self.safe(listname)
+        for plugin in self.xml_dom:
+            if plugname == plugin._name:
+                for child in plugin._dir:
+                    if child._name == listname and child._attrs["type"] == "list":
+                        retlist = self.FetchList(child)
+                        if verbose: print "successfully found the value"
+                        return retlist
+        else:
+            if verbose:
+                print "plugindb: no value has been stored for " + listname + " in " + plugname + " so the default has been returned"
+            return defaultval
+
+    def BuildList(self, val):
+        listerine = "<list>"
+        for item in val:
+            if isinstance(item, basestring):#it's a string
+                listerine += "<lobject type=\"str\">" + self.safe(item) + "</lobject>"
+            elif isinstance(item, IntType):#it's an int
+                listerine += "<lobject type=\"int\">" + str(item) + "</lobject>"
+            elif isinstance(item, FloatType):#it's a float
+                listerine += "<lobject type=\"float\">" + str(item) + "</lobject>"
+            elif isinstance(item, LongType):#it's a long
+                listerine += "<lobject type=\"long\">" + str(item) + "</lobject>"
+            elif isinstance(item, ListType):#it's a list
+                listerine += "<lobject type=\"list\">" + self.BuildList(item) + "</lobject>"
+            elif isinstance(item, DictType):#it's a dictionary
+                listerine += "<lobject type=\"dict\">" + self.BuildDict(item) + "</lobject>"
+            else: return "type unknown"
+        listerine += "</list>"
+        return listerine
+
+    def SetList(self, plugname, listname, val):
+        listname = self.safe(listname)
+        list = xmltramp.parse(self.BuildList(val))
+        for plugin in self.xml_dom:
+            if plugname == plugin._name:
+                plugin[listname] = list
+                plugin[listname]._attrs["type"] = "list"
+                self.SaveDoc()
+                return "found plugin"
+        else:
+            self.xml_dom[plugname] = xmltramp.parse("<" + listname + "></" + listname + ">")
+            self.xml_dom[plugname][listname] = list
+            self.xml_dom[plugname][listname]._attrs["type"] = "list"
+            self.SaveDoc()
+            return "added plugin"
+
+    def BuildDict(self, val):
+        dictator = "<dict>"
+        for item in val.keys():
+            if isinstance(val[item], basestring):
+                dictator += "<dobject name=\"" + self.safe(item) + "\" type=\"str\">" + self.safe(val[item]) + "</dobject>"
+            elif isinstance(val[item], IntType):#it's an int
+                dictator += "<dobject name=\"" + self.safe(item) + "\" type=\"int\">" + str(val[item]) + "</dobject>"
+            elif isinstance(val[item], FloatType):#it's a float
+                dictator += "<dobject name=\"" + self.safe(item) + "\" type=\"float\">" + str(val[item]) + "</dobject>"
+            elif isinstance(val[item], LongType):#it's a long
+                dictator += "<dobject name=\"" + self.safe(item) + "\" type=\"long\">" + str(val[item]) + "</dobject>"
+            elif isinstance(val[item], DictType):#it's a dictionary
+                dictator += "<dobject name=\"" + self.safe(item) + "\" type=\"dict\">" + self.BuildDict(val[item]) + "</dobject>"
+            elif isinstance(val[item], ListType):#it's a list
+                dictator += "<dobject name=\"" + self.safe(item) + "\" type=\"list\">" + self.BuildList(val[item]) + "</dobject>"
+            else: return str(val[item]) + ": type unknown"
+        dictator += "</dict>"
+        return dictator
+
+    def SetDict(self, plugname, dictname, val, file="plugindb.xml"):
+        dictname = self.safe(dictname)
+        dict = xmltramp.parse(self.BuildDict(val))
+        for plugin in self.xml_dom:
+            if plugname == plugin._name:
+                plugin[dictname] = dict
+                plugin[dictname]._attrs["type"] = "dict"
+                self.SaveDoc()
+                return "found plugin"
+        else:
+            self.xml_dom[plugname] = xmltramp.parse("<" + dictname + "></" + dictname + ">")
+            self.xml_dom[plugname][dictname] = dict
+            self.xml_dom[plugname][dictname]._attrs["type"] = "dict"
+            self.SaveDoc()
+            return "added plugin"
+
+    def FetchDict(self, parent):
+        retdict = {}
+        if not len(parent): return {}
+        for ditem in parent[0]._dir:
+            if len(ditem):
+                ditem._attrs["name"] = self.normal(ditem._attrs["name"])
+                if ditem._attrs["type"] == "int": retdict[ditem._attrs["name"]] = int(ditem[0])
+                elif ditem._attrs["type"] == "long": retdict[ditem._attrs["name"]] = long(ditem[0])
+                elif ditem._attrs["type"] == "float": retdict[ditem._attrs["name"]] = float(ditem[0])
+                elif ditem._attrs["type"] == "list": retdict[ditem._attrs["name"]] = self.FetchList(ditem)
+                elif ditem._attrs["type"] == "dict": retdict[ditem._attrs["name"]] = self.FetchDict(ditem)
+                else: retdict[ditem._attrs["name"]] = str( self.normal(ditem[0]) )
+            else: retdict[ditem._attrs["name"]] = ""
+        return retdict
+
+    def GetDict(self, plugname, dictname, defaultval, verbose=0):
+        dictname = self.safe(dictname)
+        for plugin in self.xml_dom:
+            if plugname == plugin._name:
+                for child in plugin._dir:
+                    if child._name == dictname and child._attrs["type"] == "dict": return self.FetchDict(child)
+        else:
+            if verbose:
+                print "plugindb: no value has been stored for " + dictname + " in " + plugname + " so the default has been returned"
+            return defaultval
+
+    def safe(self, string):
+        return string.replace("<", "$$lt$$").replace(">", "$$gt$$").replace("&","$$amp$$").replace('"',"$$quote$$")
+
+    def normal(self, string):
+        return string.replace("$$lt$$", "<").replace("$$gt$$", ">").replace("$$amp$$","&").replace("$$quote$$",'"')
+
+    def SaveDoc(self):
+        f = open(self.filename, "w")
+        f.write(self.xml_dom.__repr__(1, 1))
+        f.close()
+
+    def LoadDoc(self):
+        xml_file = open(self.filename)
+        manifest = xml_file.read()
+        xml_file.close()
+        return xmltramp.parse(manifest)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upmana/updatemana.py	Sun Aug 02 17:13:45 2009 -0500
@@ -0,0 +1,412 @@
+import wx
+#import wx.html
+#import webbrowser
+#import urllib
+#import zipfile
+#import traceback
+import manifest
+#import hashlib
+import orpg.dirpath
+from orpg.orpgCore import *
+import orpg.orpg_version
+import orpg.tools.orpg_log
+import orpg.orpg_xml
+import orpg.dirpath
+#import orpg.tools.orpg_settings
+import orpg.tools.validate
+from mercurial import ui, hg, commands, repo, revlog, cmdutil
+
+class Updater(wx.Panel):
+    def __init__(self, parent, openrpg):
+        wx.Panel.__init__(self, parent)
+
+        ### Update Manager
+        self.ui = ui.ui()
+        self.repo = hg.repository(self.ui, ".")
+        self.c = self.repo.changectx('tip')
+        self.manifest = []
+        self.manifest = self.c.manifest().keys()
+        self.openrpg = openrpg
+        #self.settings = openrpg.get_component('settings')
+        self.xml = openrpg.get_component('xml')
+        self.dir_struct = self.openrpg.get_component("dir_struct")
+        self.parent = parent
+        self.log = self.openrpg.get_component("log")
+        self.log.log("Enter updaterFrame", ORPG_DEBUG)
+        self.SetBackgroundColour(wx.WHITE)
+        self.sizer = wx.GridBagSizer(hgap=1, vgap=1)
+        self.changelog = wx.TextCtrl(self, wx.ID_ANY, size=(400, -1), style=wx.TE_MULTILINE | wx.TE_READONLY)
+        self.filelist = wx.TextCtrl(self, wx.ID_ANY, size=(250, 300), style=wx.TE_MULTILINE | wx.TE_READONLY)
+        self.buttons = {}
+        self.buttons['progress_bar'] = wx.Gauge(self, wx.ID_ANY, 100)
+        self.buttons['auto_text'] = wx.StaticText(self, wx.ID_ANY, "Auto Update")
+        self.buttons['auto_check'] = wx.CheckBox(self, wx.ID_ANY)
+        self.buttons['no_text'] = wx.StaticText(self, wx.ID_ANY, "No Update")
+        self.buttons['no_check'] = wx.CheckBox(self, wx.ID_ANY)
+        self.buttons['advanced'] = wx.Button(self, wx.ID_ANY, "Package Select")
+        self.buttons['update'] = wx.Button(self, wx.ID_ANY, "Update Now")
+        self.buttons['finish'] = wx.Button(self, wx.ID_ANY, "Finish")
+
+        self.sizer.Add(self.changelog, (0,0), span=(4,1), flag=wx.EXPAND)
+        self.sizer.Add(self.filelist, (0,1), span=(1,3), flag=wx.EXPAND)
+
+        self.sizer.Add(self.buttons['progress_bar'], (1,1), span=(1,3), flag=wx.EXPAND)
+        self.sizer.Add(self.buttons['auto_text'], (2,1))
+        self.sizer.Add(self.buttons['auto_check'], (2,2), flag=wx.EXPAND)
+        self.sizer.Add(self.buttons['no_text'], (3,1))
+        self.sizer.Add(self.buttons['no_check'], (3,2), flag=wx.EXPAND)
+        self.sizer.Add(self.buttons['advanced'], (2,3), flag=wx.EXPAND)
+        self.sizer.Add(self.buttons['update'], (3,3), flag=wx.EXPAND)
+        self.sizer.Add(self.buttons['finish'], (4,3), flag=wx.EXPAND)
+        self.sizer.AddGrowableCol(0)
+        self.sizer.AddGrowableRow(0)
+        self.SetSizer(self.sizer)
+        self.SetAutoLayout(True)
+        self.initPrefs()
+
+        self.current = self.c.branch()
+        self.BranchInfo(self.current)
+        #if self.autoupdate == "On": self.buttons['auto_check'].SetValue(True)
+
+        ## Event Handlers
+        self.Bind(wx.EVT_BUTTON, self.Update, self.buttons['update'])
+        self.Bind(wx.EVT_BUTTON, self.Finish, self.buttons['finish'])
+        self.Bind(wx.EVT_BUTTON, self.Advanced, self.buttons['advanced'])
+        #self.Bind(wx.EVT_CHECKBOX, self.ToggleAutoUpdate, self.buttons['auto_check'])
+
+    def showFinish(self):
+        if self.Updated: self.filelist.SetValue(self.filelist.GetValue() + "Finished ... \n")
+        self.buttons['finish'].Show()
+        self.buttons['advanced'].Show()
+
+    def initPrefs(self):
+        #self.list_url = self.settings.get_setting("PackagesURL")
+        #self.package_type = self.settings.get_setting("PackagesType")
+        #self.package_name = self.settings.get_setting("PackagesName")
+        self.SelectPackage = False
+        #self.autoupdate = self.settings.get_setting("AutoUpdate")
+        self.packages = None
+        self.package = self.get_package()
+        self.Updated = False
+        self.Finished = False
+
+    def isFinished(self):
+        return self.Finished
+
+    def ToggleAutoUpdate(self, event):
+        if self.buttons['auto_check'].GetValue():
+            self.autoupdate = "On"
+            #self.settings.set_setting("AutoUpdate", "On")
+            #self.Update(None)
+        else:
+            self.autoupdate = "Off"
+            #self.settings.set_setting("AutoUpdate", "Off")
+
+    def Update(self, evt=None):
+        hg.clean(self.repo, self.current)
+
+    def Finish(self, evt=None):
+        #self.settings.updateIni()
+        self.Finished = True
+        self.Destroy() #destroys tab, pretty useless.
+
+    def Advanced(self, evt=None):
+
+        ## This part sucks.  Do they need to see the Branch List everytime?  No!! Press the button.
+        dlg = wx.Dialog(self, wx.ID_ANY, "Package Selector", style=wx.DEFAULT_DIALOG_STYLE)
+        if wx.Platform == '__WXMSW__': icon = wx.Icon(self.dir_struct["icon"]+'d20.ico', wx.BITMAP_TYPE_ICO)
+        else: icon = wx.Icon(self.dir_struct["icon"]+"d20.xpm", wx.BITMAP_TYPE_XPM )
+        dlg.SetIcon(icon)
+
+        dlgsizer = wx.GridBagSizer(hgap=1, vgap=1)
+        Yes = wx.Button( dlg, wx.ID_OK, "Ok" )
+        Yes.SetDefault()
+        rgroup = wx.RadioButton(dlg, wx.ID_ANY, "group_start", style=wx.RB_GROUP)
+        rgroup.Hide()
+
+        if self.packages == None: self.get_packages()
+        if self.package_list == None: return
+        types = self.package_list
+        row=0; col=0
+        self.current = self.c.branch()
+        self.package_type = self.current
+        self.btnlist = {}; self.btn = {}
+        self.id = 1
+
+        for t in types:
+            self.btnName = str(t)
+            self.btn[self.id] = wx.RadioButton(dlg, wx.ID_ANY, str(t), name=self.btnName)
+            if self.btnName == self.current:
+                self.btn[self.id].SetValue(True)
+            self.btnlist[self.id] = self.btnName
+            dlgsizer.Add(self.btn[self.id], (row, col))
+            row += 1; self.id += 1
+
+        dlgsizer.Add(Yes, (row+1,0))
+        dlg.SetAutoLayout( True )
+        dlg.SetSizer( dlgsizer )
+        dlgsizer.Fit( dlg )
+        dlg.Centre()
+        dlg.Bind(wx.EVT_RADIOBUTTON, self.PackageSet)
+
+        if dlg.ShowModal():
+            dlg.Destroy()
+            if self.Updated:
+                self.Updated = False
+                self.filelist.SetValue('')
+                wx.CallAfter(self.check)
+
+    def PackageSet(self, event):
+        for btn in self.btn:
+            if self.btn[btn].GetValue() == True: self.current = self.btnlist[btn]
+
+        branches = self.repo.branchtags()
+        heads = dict.fromkeys(self.repo.heads(), 1)
+        l = [((n in heads), self.repo.changelog.rev(n), n, t) for t, n in branches.items()]
+
+        #l.sort()
+        #l.reverse()
+        #for ishead, r, n, t in l: self.package_list.append(t)
+
+        if self.current != type:
+            #r = hg.islocal()
+            files = self.c.files()
+            #print commands.log(u, r, c)
+            #print r.changelog
+
+            ### Cleaning up for dev build 0.1
+            ### The below material is for the Rev Log.  You can run hg log to see what data it will pull.
+            #cs = r.changectx(c.rev()).changeset()
+            #get = util.cachefunc(lambda r: repo.changectx(r).changeset())
+            #changeiter, matchfn = cmdutil.walkchangerevs(u, r, 1, cs, 1)
+            #for st, rev, fns in changeiter:
+            #    revbranch = get(rev)[5]['branch']; print revbranch
+
+            heads = dict.fromkeys(self.repo.heads(), self.repo.branchtags())
+            branches = dict.copy(self.repo.branchtags())
+
+            self.BranchInfo(self.current)
+
+
+    def BranchInfo(self, branch):
+        self.filelist.SetValue('')
+        self.filelist.AppendText("Files that will change\n\n")
+        self.changelog.SetValue('')
+        changelog = "This is Dev Build 0.1 of the Update Manager. It has limited functionality.\n\nThe full release will search your Revision log and show the contents here."
+        self.changelog.AppendText(changelog + '\n')
+        self.filelist.AppendText("Update to " + branch + "\n\n The full release will show the files to be changed here.")
+
+        #### Files works but not fully without the change log information, pulled for Dev 0.1
+        #for f in files:
+        #    fc = c[f]
+        #    self.filelist.AppendText(str(f + '\n'))
+
+
+    def verify_file(self, abs_path):
+        """Returns True if file or directory exists"""
+        try:
+            os.stat(abs_path)
+            return True
+        except OSError:
+            self.log.log("Invalid File or Directory: " + abs_path, ORPG_GENERAL)
+            return False
+
+    def get_packages(self, type=None):
+        #Fixed and ready for Test. Can be cleaner
+        self.package_list = []
+        b = self.repo.branchtags()
+        heads = dict.fromkeys(self.repo.heads(), 1)
+        l = [((n in heads), self.repo.changelog.rev(n), n, t) for t, n in b.items()]
+        l.sort()
+        l.reverse()
+        for ishead, r, n, t in l: self.package_list.append(t)
+
+    def get_package(self):
+        #Fixed and ready for test.
+        if self.packages == None: self.get_packages()
+        if self.package_list == None: return None
+        return None
+
+class Repos(wx.Panel):
+    def __init__(self, parent, openrpg):
+        wx.Panel.__init__(self, parent)
+        self.openrpg = openrpg
+        self.settings = openrpg.get_component('settings')
+        self.xml = openrpg.get_component('xml')
+
+        self.buttons = {}
+        self.texts = {}
+
+        ## Section Sizers (with frame edges and text captions)
+        self.box_sizers = {}
+        self.box_sizers["newrepo"] = wx.StaticBox(self, -1, "Add New Repo")
+        self.box_sizers["repolist"] = wx.StaticBox(self, -1, "Current Repo List")
+
+        ## Layout Sizers
+        self.sizers = {}
+        self.sizers["main"] = wx.GridBagSizer(hgap=2, vgap=2)
+        self.sizers["newrepo"] = wx.StaticBoxSizer(self.box_sizers["newrepo"], wx.VERTICAL)
+        self.sizers["repolist"] = wx.StaticBoxSizer(self.box_sizers["repolist"], wx.VERTICAL)
+
+        #Build Server Sizer Layout
+        self.sizers["newrepo_layout"] = wx.FlexGridSizer(rows=1, cols=2, hgap=2, vgap=1)
+        reponame = wx.StaticText(self, -1, "Name:")
+        self.texts["reponame"] = wx.TextCtrl(self, -1)
+        repodesc = wx.StaticText(self, -1, "Description:")
+        self.texts["repodesc"] = wx.TextCtrl(self, -1)
+        repoadd = wx.StaticText(self, -1, "Address:")
+        self.texts["repoadd"] = wx.TextCtrl(self, -1)
+        addrepo = wx.Button(self, wx.ID_ADD)
+
+        ##Put GUI Together.
+        self.sizers["newrepo_layout"].Add(reponame, -1, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
+        self.sizers["newrepo_layout"].Add(self.texts["reponame"], -1, wx.EXPAND)
+        self.sizers["newrepo_layout"].Add(repodesc, -1, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
+        self.sizers["newrepo_layout"].Add(self.texts["repodesc"], -1, wx.EXPAND)
+        self.sizers["newrepo_layout"].Add(repoadd, -1, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
+        self.sizers["newrepo_layout"].Add(self.texts["repoadd"], -1, wx.EXPAND)
+        self.sizers["newrepo_layout"].Add(addrepo, -1)
+        self.sizers["newrepo_layout"].AddGrowableCol(1)
+        self.sizers["newrepo"].Add(self.sizers["newrepo_layout"], -1, wx.EXPAND)
+
+        #Repo List Layout
+        self.sizers["repolist_layout"] = wx.FlexGridSizer(rows=1, cols=2, hgap=2, vgap=1)
+        #addrepo = wx.Button(self, wx.ID_ADD) ## Looks bad inside the Sizer, move out!
+        #self.sizers["repolist_layout"].Add(addrepo, -1)
+        self.sizers["repolist_layout"].AddGrowableCol(1)
+        self.sizers["repolist"].Add(self.sizers["repolist_layout"], -1, wx.EXPAND)
+
+        """
+        grid = wx.GridSizer(3, 2)
+
+        grid.AddMany([(wx.Button(self, wx.ID_CANCEL), 0, wx.TOP | wx.LEFT, 9),
+            (wx.Button(self, wx.ID_DELETE), 0, wx.TOP, 9),
+            (wx.Button(self, wx.ID_SAVE), 0, wx.LEFT, 9),
+            (wx.Button(self, wx.ID_EXIT)),
+            (wx.Button(self, wx.ID_STOP), 0, wx.LEFT, 9),
+            (wx.Button(self, wx.ID_NEW))])
+
+        self.Bind(wx.EVT_BUTTON, self.OnQuit, id=wx.ID_EXIT)
+        self.SetSizer(grid)
+        self.Centre()
+        self.Show(True)
+
+
+    def OnQuit(self, event):
+        self.Close()
+        """
+
+        #Build Main Sizer
+        self.sizers["main"].Add(self.sizers["newrepo"], (0,0), flag=wx.EXPAND)
+        self.sizers["main"].Add(self.sizers["repolist"], (1,0), flag=wx.EXPAND)
+        self.sizers["main"].AddGrowableCol(0)
+        self.sizers["main"].AddGrowableCol(1)
+        #self.sizers["main"].AddGrowableRow(1)
+        self.SetSizer(self.sizers["main"])
+        self.SetAutoLayout(True)
+        self.Fit()
+
+class Manifest(wx.Panel):
+    def __init__(self, parent):
+        wx.Panel.__init__(self, parent)
+        self.ui = ui.ui()
+        self.repo = hg.repository(self.ui, ".")
+        self.c = self.repo.changectx('tip')
+        self.manifest = []
+        self.manifest = self.c.manifest().keys()
+        self.manifest.sort()
+        self.SetBackgroundColour(wx.WHITE)
+        self.sizer = wx.GridBagSizer(hgap=1, vgap=1)
+
+        self.manifestlog = wx.TextCtrl(self, wx.ID_ANY, size=(400, -1), style=wx.TE_MULTILINE | wx.TE_READONLY)
+
+        self.sizer.Add(self.manifestlog, (0,0), flag=wx.EXPAND)
+
+        self.sizer.AddGrowableCol(0)
+        self.sizer.AddGrowableRow(0)
+        self.SetSizer(self.sizer)
+        self.SetAutoLayout(True)
+        self.BuildManifest()
+
+
+    def BuildManifest(self):
+        self.manifestlog.SetValue('')
+        self.manifestlog.AppendText('Currently the Manifest Log shows your files only, later you will be able to select files to ingore on update\n')
+        for i in self.manifest:
+            self.manifestlog.AppendText(i + '\n')
+
+class Control(wx.Panel):
+    def __init__(self, parent):
+        wx.Panel.__init__(self, parent)
+        t = wx.StaticText(self, -1, "Here you will be able to control your branches, delete branches, \nupdate to a sepcific revision, and that type of control.", (10,60))
+
+
+class updaterFrame(wx.Frame):
+    def __init__(self, parent, title, openrpg):
+        wx.Frame.__init__(self, None, wx.ID_ANY, title, size=(640,480), 
+            style=wx.FRAME_NO_TASKBAR | wx.STAY_ON_TOP | wx.DEFAULT_FRAME_STYLE)
+
+        self.CenterOnScreen()
+
+        ####### Panel Stuff ######
+        p = wx.Panel(self)
+        nb = wx.Notebook(p)
+
+        # create the page windows as children of the notebook
+        page1 = Updater(nb, openrpg)
+        page2 = Repos(nb, openrpg)
+        page3 = Manifest(nb)
+        page4 = Control(nb)
+
+        # add the pages to the notebook with the label to show on the tab
+        nb.AddPage(page1, "Updater")
+        nb.AddPage(page2, "Repos")
+        nb.AddPage(page3, "Manifest")
+        nb.AddPage(page4, "Control")
+
+        # finally, put the notebook in a sizer for the panel to manage
+        # the layout
+        sizer = wx.BoxSizer()
+        sizer.Add(nb, 1, wx.EXPAND)
+        p.SetSizer(sizer)
+
+
+
+class updateApp(wx.App):
+    def OnInit(self):
+        self.open_rpg = open_rpg
+        self.log = orpg.tools.orpg_log.orpgLog(orpg.dirpath.dir_struct["user"] + "runlogs/")
+        self.log.setLogToConsol(False)
+        self.log.log("Updater Start", ORPG_NOTE)
+
+        #Add the initial global components of the openrpg class
+        #Every class should be passed openrpg
+        self.open_rpg.add_component("log", self.log)
+        self.open_rpg.add_component("xml", orpg.orpg_xml)
+        self.open_rpg.add_component("dir_struct", orpg.dirpath.dir_struct)
+        self.validate = orpg.tools.validate.Validate()
+        self.open_rpg.add_component("validate", self.validate)
+        #self.settings = orpg.tools.orpg_settings.orpgSettings(self.open_rpg)
+        #self.open_rpg.add_component("settings", self.settings)
+        #self.settings.updateIni()
+        self.updater = updaterFrame(self, "OpenRPG Update Manager Beta 0.3", self.open_rpg)
+        self.updated = False
+        try:
+            self.updater.Show()
+            self.SetTopWindow(self.updater)
+            self.updater.Fit()
+        except: pass
+
+        return True
+
+    def OnExit(self):
+        #self.settings.save()
+        """
+        imported = ['orpg.orpgCore', 'orpg.orpg_wx', 'orpg.orpg_version', 'orpg.tools.orpg_log', 'orpg.orpg_xml', 'orpg.dirpath', 'orpg.tools.orpg_settings', 'orpg.tools.validate', 'orpg.pulldom', 'orpg.tools.NotebookCtrl', 'orpg.tools.config_update', 'orpg.systempath', 'orpg.minidom', 'orpg.dirpath.dirpath_tools', 'orpg.tools.rgbhex', 'orpg.orpg_windows']
+
+        for name in imported:
+            if name in sys.modules:
+                self.log.log("Unimported " + name, ORPG_DEBUG)
+                del sys.modules[name]
+        """
+        self.log.log("Updater Exit\n\n", ORPG_NOTE)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upmana/xmltramp.py	Sun Aug 02 17:13:45 2009 -0500
@@ -0,0 +1,312 @@
+"""xmltramp: Make XML documents easily accessible."""
+
+__version__ = "2.16"
+__author__ = "Aaron Swartz"
+__credits__ = "Many thanks to pjz, bitsko, and DanC."
+__copyright__ = "(C) 2003 Aaron Swartz. GNU GPL 2."
+
+if not hasattr(__builtins__, 'True'): True, False = 1, 0
+def isstr(f): return isinstance(f, type('')) or isinstance(f, type(u''))
+def islst(f): return isinstance(f, type(())) or isinstance(f, type([]))
+
+empty = {'http://www.w3.org/1999/xhtml': ['img', 'br', 'hr', 'meta', 'link', 'base', 'param', 'input', 'col', 'area']}
+
+def quote(x, elt=True):
+    if elt and '<' in x and len(x) > 24 and x.find(']]>') == -1: return "<![CDATA["+x+"]]>"
+    else: x = x.replace('&', '&amp;').replace('<', '&lt;').replace(']]>', ']]&gt;')
+    if not elt: x = x.replace('"', '&quot;')
+    return x
+
+class Element:
+    def __init__(self, name, attrs=None, children=None, prefixes=None):
+        if islst(name) and name[0] == None: name = name[1]
+        if attrs:
+            na = {}
+            for k in attrs.keys():
+                if islst(k) and k[0] == None: na[k[1]] = attrs[k]
+                else: na[k] = attrs[k]
+            attrs = na
+        self._name = name
+        self._attrs = attrs or {}
+        self._dir = children or []
+        prefixes = prefixes or {}
+        self._prefixes = dict(zip(prefixes.values(), prefixes.keys()))
+        if prefixes: self._dNS = prefixes.get(None, None)
+        else: self._dNS = None
+
+    def __repr__(self, recursive=0, multiline=0, inprefixes=None):
+        def qname(name, inprefixes):
+            if islst(name):
+                if inprefixes[name[0]] is not None: return inprefixes[name[0]]+':'+name[1]
+                else: return name[1]
+            else: return name
+
+        def arep(a, inprefixes, addns=1):
+            out = ''
+            for p in self._prefixes.keys():
+                if not p in inprefixes.keys():
+                    if addns: out += ' xmlns'
+                    if addns and self._prefixes[p]: out += ':'+self._prefixes[p]
+                    if addns: out += '="'+quote(p, False)+'"'
+                    inprefixes[p] = self._prefixes[p]
+            for k in a.keys():
+                out += ' ' + qname(k, inprefixes)+ '="' + quote(a[k], False) + '"'
+            return out
+        inprefixes = inprefixes or {u'http://www.w3.org/XML/1998/namespace':'xml'}
+
+        # need to call first to set inprefixes:
+        attributes = arep(self._attrs, inprefixes, recursive)
+        out = '<' + qname(self._name, inprefixes)  + attributes
+        if not self._dir and (self._name[0] in empty.keys()
+          and self._name[1] in empty[self._name[0]]):
+            out += ' />'
+            return out
+        out += '>'
+        if recursive:
+            content = 0
+            for x in self._dir: 
+                if isinstance(x, Element): content = 1
+            pad = '\n' + ('\t' * recursive)
+            for x in self._dir:
+                if multiline and content: out +=  pad
+                if isstr(x): out += quote(x)
+                elif isinstance(x, Element): out += x.__repr__(recursive+1, multiline, inprefixes.copy())
+                else: raise TypeError, "I wasn't expecting "+`x`+"."
+            if multiline and content: out += '\n' + ('\t' * (recursive-1))
+        else: 
+            if self._dir: out += '...'
+        out += '</'+qname(self._name, inprefixes)+'>'
+        return out
+
+    def __unicode__(self):
+        text = ''
+        for x in self._dir: text += unicode(x)
+        return ' '.join(text.split())
+
+    def __str__(self):
+        return self.__unicode__().encode('utf-8')
+
+    def __getattr__(self, n):
+        if n[0] == '_': raise AttributeError, "Use foo['"+n+"'] to access the child element."
+        if self._dNS: n = (self._dNS, n)
+        for x in self._dir:
+            if isinstance(x, Element) and x._name == n: return x
+        raise AttributeError, 'No child element named \''+n+"'"
+
+    def __hasattr__(self, n):
+        for x in self._dir:
+            if isinstance(x, Element) and x._name == n: return True
+        return False
+
+    def __setattr__(self, n, v):
+        if n[0] == '_': self.__dict__[n] = v
+        else: self[n] = v
+
+    def __getitem__(self, n):
+        if isinstance(n, type(0)): # d[1] == d._dir[1]
+            return self._dir[n]
+        elif isinstance(n, slice(0).__class__):
+            # numerical slices
+            if isinstance(n.start, type(0)): return self._dir[n.start:n.stop]
+            # d['foo':] == all <foo>s
+            n = n.start
+            if self._dNS and not islst(n): n = (self._dNS, n)
+            out = []
+            for x in self._dir:
+                if isinstance(x, Element) and x._name == n: out.append(x)
+            return out
+        else: # d['foo'] == first <foo>
+            if self._dNS and not islst(n): n = (self._dNS, n)
+            for x in self._dir:
+                if isinstance(x, Element) and x._name == n: return x
+            raise KeyError
+
+    def __setitem__(self, n, v):
+        if isinstance(n, type(0)): # d[1]
+            self._dir[n] = v
+        elif isinstance(n, slice(0).__class__):
+            # d['foo':] adds a new foo
+            n = n.start
+            if self._dNS and not islst(n): n = (self._dNS, n)
+            nv = Element(n)
+            self._dir.append(nv)
+
+        else: # d["foo"] replaces first <foo> and dels rest
+            if self._dNS and not islst(n): n = (self._dNS, n)
+            nv = Element(n); nv._dir.append(v)
+            replaced = False
+            todel = []
+            for i in range(len(self)):
+                if self[i]._name == n:
+                    if replaced:
+                        todel.append(i)
+                    else:
+                        self[i] = nv
+                        replaced = True
+            if not replaced: self._dir.append(nv)
+            for i in todel: del self[i]
+
+    def __delitem__(self, n):
+        if isinstance(n, type(0)): del self._dir[n]
+        elif isinstance(n, slice(0).__class__):
+            # delete all <foo>s
+            n = n.start
+            if self._dNS and not islst(n): n = (self._dNS, n)
+            for i in range(len(self)):
+                if self[i]._name == n: del self[i]
+        else:
+            # delete first foo
+            for i in range(len(self)):
+                if self[i]._name == n: del self[i]
+                break
+
+    def __call__(self, *_pos, **_set):
+        if _set:
+            for k in _set.keys(): self._attrs[k] = _set[k]
+        if len(_pos) > 1:
+            for i in range(0, len(_pos), 2): self._attrs[_pos[i]] = _pos[i+1]
+        if len(_pos) == 1 is not None: return self._attrs[_pos[0]]
+        if len(_pos) == 0: return self._attrs
+
+    def __len__(self): return len(self._dir)
+
+class Namespace:
+    def __init__(self, uri): self.__uri = uri
+    def __getattr__(self, n): return (self.__uri, n)
+    def __getitem__(self, n): return (self.__uri, n)
+
+from xml.sax.handler import EntityResolver, DTDHandler, ContentHandler, ErrorHandler
+
+class Seeder(EntityResolver, DTDHandler, ContentHandler, ErrorHandler):
+    def __init__(self):
+        self.stack = []
+        self.ch = ''
+        self.prefixes = {}
+        ContentHandler.__init__(self)
+
+    def startPrefixMapping(self, prefix, uri):
+        if not self.prefixes.has_key(prefix): self.prefixes[prefix] = []
+        self.prefixes[prefix].append(uri)
+    def endPrefixMapping(self, prefix):
+        self.prefixes[prefix].pop()
+
+    def startElementNS(self, name, qname, attrs):
+        ch = self.ch; self.ch = ''
+        if ch and not ch.isspace(): self.stack[-1]._dir.append(ch)
+        attrs = dict(attrs)
+        newprefixes = {}
+        for k in self.prefixes.keys(): newprefixes[k] = self.prefixes[k][-1]
+        self.stack.append(Element(name, attrs, prefixes=newprefixes.copy()))
+
+    def characters(self, ch):
+        self.ch += ch
+
+    def endElementNS(self, name, qname):
+        ch = self.ch; self.ch = ''
+        if ch and not ch.isspace(): self.stack[-1]._dir.append(ch)
+        element = self.stack.pop()
+        if self.stack: self.stack[-1]._dir.append(element)
+        else: self.result = element
+
+from xml.sax import make_parser
+from xml.sax.handler import feature_namespaces
+
+def seed(fileobj):
+    seeder = Seeder()
+    parser = make_parser()
+    parser.setFeature(feature_namespaces, 1)
+    parser.setContentHandler(seeder)
+    parser.parse(fileobj)
+    return seeder.result
+
+def parse(text):
+    from StringIO import StringIO
+    return seed(StringIO(text))
+
+def load(url):
+    import urllib
+    return seed(urllib.urlopen(url))
+
+def unittest():
+    parse('<doc>a<baz>f<b>o</b>ob<b>a</b>r</baz>a</doc>').__repr__(1,1) == \
+      '<doc>\n\ta<baz>\n\t\tf<b>o</b>ob<b>a</b>r\n\t</baz>a\n</doc>'
+    assert str(parse("<doc />")) == ""
+    assert str(parse("<doc>I <b>love</b> you.</doc>")) == "I love you."
+    assert parse("<doc>\nmom\nwow\n</doc>")[0].strip() == "mom\nwow"
+    assert str(parse('<bing>  <bang> <bong>center</bong> </bang>  </bing>')) == "center"
+    assert str(parse('<doc>\xcf\x80</doc>')) == '\xcf\x80'
+    d = Element('foo', attrs={'foo':'bar'}, children=['hit with a', Element('bar'), Element('bar')])
+
+    try:
+        d._doesnotexist
+        raise "ExpectedError", "but found success. Damn."
+    except AttributeError: pass
+    assert d.bar._name == 'bar'
+    try:
+        d.doesnotexist
+        raise "ExpectedError", "but found success. Damn."
+    except AttributeError: pass
+    assert hasattr(d, 'bar') == True
+    assert d('foo') == 'bar'
+    d(silly='yes')
+    assert d('silly') == 'yes'
+    assert d() == d._attrs
+    assert d[0] == 'hit with a'
+    d[0] = 'ice cream'
+    assert d[0] == 'ice cream'
+    del d[0]
+    assert d[0]._name == "bar"
+    assert len(d[:]) == len(d._dir)
+    assert len(d[1:]) == len(d._dir) - 1
+    assert len(d['bar':]) == 2
+    d['bar':] = 'baz'
+    assert len(d['bar':]) == 3
+    assert d['bar']._name == 'bar'
+    d = Element('foo')
+    doc = Namespace("http://example.org/bar")
+    bbc = Namespace("http://example.org/bbc")
+    dc = Namespace("http://purl.org/dc/elements/1.1/")
+    d = parse("""<doc version="2.7182818284590451"
+      xmlns="http://example.org/bar"
+      xmlns:dc="http://purl.org/dc/elements/1.1/"
+      xmlns:bbc="http://example.org/bbc">
+            <author>John Polk and John Palfrey</author>
+            <dc:creator>John Polk</dc:creator>
+            <dc:creator>John Palfrey</dc:creator>
+            <bbc:show bbc:station="4">Buffy</bbc:show>
+    </doc>""")
+    assert repr(d) == '<doc version="2.7182818284590451">...</doc>'
+    assert d.__repr__(1) == '<doc xmlns:bbc="http://example.org/bbc" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns="http://example.org/bar" version="2.7182818284590451"><author>John Polk and John Palfrey</author><dc:creator>John Polk</dc:creator><dc:creator>John Palfrey</dc:creator><bbc:show bbc:station="4">Buffy</bbc:show></doc>'
+    assert d.__repr__(1,1) == '<doc xmlns:bbc="http://example.org/bbc" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns="http://example.org/bar" version="2.7182818284590451">\n\t<author>John Polk and John Palfrey</author>\n\t<dc:creator>John Polk</dc:creator>\n\t<dc:creator>John Palfrey</dc:creator>\n\t<bbc:show bbc:station="4">Buffy</bbc:show>\n</doc>'
+    assert repr(parse("<doc xml:lang='en' />")) == '<doc xml:lang="en"></doc>'
+    assert str(d.author) == str(d['author']) == "John Polk and John Palfrey"
+    assert d.author._name == doc.author
+    assert str(d[dc.creator]) == "John Polk"
+    assert d[dc.creator]._name == dc.creator
+    assert str(d[dc.creator:][1]) == "John Palfrey"
+    d[dc.creator] = "Me!!!"
+    assert str(d[dc.creator]) == "Me!!!"
+    assert len(d[dc.creator:]) == 1
+    d[dc.creator:] = "You!!!"
+    assert len(d[dc.creator:]) == 2
+    assert d[bbc.show](bbc.station) == "4"
+    d[bbc.show](bbc.station, "5")
+    assert d[bbc.show](bbc.station) == "5"
+    e = Element('e')
+    e.c = '<img src="foo">'
+    assert e.__repr__(1) == '<e><c>&lt;img src="foo"></c></e>'
+    e.c = '2 > 4'
+    assert e.__repr__(1) == '<e><c>2 > 4</c></e>'
+    e.c = 'CDATA sections are <em>closed</em> with ]]>.'
+    assert e.__repr__(1) == '<e><c>CDATA sections are &lt;em>closed&lt;/em> with ]]&gt;.</c></e>'
+    e.c = parse('<div xmlns="http://www.w3.org/1999/xhtml">i<br /><span></span>love<br />you</div>')
+    assert e.__repr__(1) == '<e><c><div xmlns="http://www.w3.org/1999/xhtml">i<br /><span></span>love<br />you</div></c></e>'
+    e = Element('e')
+    e('c', 'that "sucks"')
+    assert e.__repr__(1) == '<e c="that &quot;sucks&quot;"></e>'
+    assert quote("]]>") == "]]&gt;"
+    assert quote('< dkdkdsd dkd sksdksdfsd fsdfdsf]]> kfdfkg >') == '&lt; dkdkdsd dkd sksdksdfsd fsdfdsf]]&gt; kfdfkg >'
+    assert parse('<x a="&lt;"></x>').__repr__(1) == '<x a="&lt;"></x>'
+    assert parse('<a xmlns="http://a"><b xmlns="http://b"/></a>').__repr__(1) == '<a xmlns="http://a"><b xmlns="http://b"></b></a>'
+
+if __name__ == '__main__': unittest()