Mercurial > traipse_dev
diff upmana/updatemana.py @ 135:dcf4fbe09b70 beta
Traipse Beta 'OpenRPG' {091010-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)
Added Bookmarks
Fix to Remote Admin Commands
Minor fix to text based Server
Fix to Pretty Print, from Core
Fix to Splitter Nodes not being created
Fix to massive amounts of images loading, from Core
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
default_manifest.xml renamed to default_upmana.xml
Cleaner clode for saved repositories
New TrueDebug Class in orpg_log (See documentation for usage)
Mercurial's hgweb folder is ported to upmana
**Pretty important update that can help remove thousands of dead children from your gametree.
**Children, <forms />, <group_atts />, <horizontal />, <cols />, <rows />, <height />, etc... are all tags now. Check your gametree and
look for dead children!!
**New Gamtree Recusion method, mapping, and context sensitivity. !!Alpha - Watch out for infinite loops!!
author | sirebral |
---|---|
date | Tue, 10 Nov 2009 14:11:28 -0600 |
parents | 68c7bd272f27 |
children | 2345c12d93a7 |
line wrap: on
line diff
--- a/upmana/updatemana.py Fri Sep 25 20:47:16 2009 -0500 +++ b/upmana/updatemana.py Tue Nov 10 14:11:28 2009 -0600 @@ -1,92 +1,100 @@ -import wx -import sys -import os #just .sep maybe -import manifest +import wx, sys, os #just .sep maybe +from manifest import manifest import shutil from orpg.orpgCore import component -from orpg.dirpath import dir_struct +from orpg.dirpath import dir_struct from orpg.tools.orpg_log import logger, crash from orpg.tools.decorators import debugging -from upmana.validate import validate -from orpg.dirpath import dir_struct +from upmana.validate import validate +from orpg.dirpath import dir_struct from mercurial import ui, hg, commands, repo, revlog, cmdutil, util +class Term2Win(object): + # A stdout redirector. Allows the messages from Mercurial to be seen in the Install Window + def write(self, text): + statbar.SetStatusText(text) + wx.Yield() + sys.__stdout__.write(text) class Updater(wx.Panel): @debugging - def __init__(self, parent, component, manifest): + def __init__(self, parent, component): wx.Panel.__init__(self, parent) + ### Status Bar ### + #statbar.SetStatusText('Select a Package and Update') + statbar.SetStatusText('New Status Bar') ### Update Manager self.ui = ui.ui() self.repo = hg.repository(self.ui, ".") self.c = self.repo.changectx('tip') - self.manifest = manifest self.parent = parent - self.SetBackgroundColour(wx.WHITE) + self.SetBackgroundColour(wx.WHITE) self.sizer = wx.GridBagSizer(hgap=1, vgap=1) - self.changelog = wx.TextCtrl(self, wx.ID_ANY, size=(300, -1), style=wx.TE_MULTILINE | wx.TE_READONLY) - self.filelist = wx.TextCtrl(self, wx.ID_ANY, size=(275, 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.changelog = wx.TextCtrl(self, wx.ID_ANY, size=(300, -1), + style=wx.TE_MULTILINE | wx.TE_READONLY) + self.filelist = wx.TextCtrl(self, wx.ID_ANY, size=(275, 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_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['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.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_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_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['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.buttons['finish'].Disable() - self.sizer.AddGrowableCol(0) - self.sizer.AddGrowableRow(0) - self.SetSizer(self.sizer) + self.buttons['finish'].Disable() + self.sizer.AddGrowableCol(0) + self.sizer.AddGrowableRow(0) + self.SetSizer(self.sizer) self.SetAutoLayout(True) self.get_package self.current = self.repo.dirstate.branch() self.BranchInfo(self.current) - if self.manifest.GetString("updatemana", "no_update", "") == 'on': self.buttons['no_check'].SetValue(True) - else: self.buttons['no_check'].SetValue(False) - if self.manifest.GetString("updatemana", "auto_update", "") == 'on': self.buttons['auto_check'].SetValue(True) - else: self.buttons['auto_check'].SetValue(False) - - ## 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.ChooseBranch, self.buttons['advanced']) + if manifest.GetString("updatemana", "no_update", "") == 'on': self.buttons['no_check'].SetValue(True) + else: self.buttons['no_check'].SetValue(False) + if manifest.GetString("updatemana", "auto_update", "") == 'on': self.buttons['auto_check'].SetValue(True) + else: self.buttons['auto_check'].SetValue(False) + + ## 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.ChooseBranch, self.buttons['advanced']) self.Bind(wx.EVT_CHECKBOX, self.ToggleAutoUpdate, self.buttons['auto_check']) self.Bind(wx.EVT_CHECKBOX, self.ToggleNoUpdate, self.buttons['no_check']) - def ToggleAutoUpdate(self, event): + def ToggleAutoUpdate(self, event): if self.buttons['auto_check'].GetValue() == True: if self.buttons['no_check'].GetValue() == True: self.buttons['no_check'].SetValue(False) - self.manifest.SetString("updatemana", "no_update", "off") - self.manifest.SetString("updatemana", "auto_update", "on") - else: self.manifest.SetString("updatemana", "auto_update", "off") + manifest.SetString("updatemana", "no_update", "off") + manifest.SetString("updatemana", "auto_update", "on") + else: manifest.SetString("updatemana", "auto_update", "off") - def ToggleNoUpdate(self, event): + def ToggleNoUpdate(self, event): if self.buttons['no_check'].GetValue() == True: if self.buttons['auto_check'].GetValue() == True: self.buttons['auto_check'].SetValue(False) - self.manifest.SetString("updatemana", "auto_update", "off") - self.manifest.SetString("updatemana", "no_update", "on") - else: self.manifest.SetString("updatemana", "no_update", "off") - + manifest.SetString("updatemana", "auto_update", "off") + manifest.SetString("updatemana", "no_update", "on") + else: manifest.SetString("updatemana", "no_update", "off") + def Update(self, evt=None): self.ui = ui.ui() self.repo = hg.repository(self.ui, ".") @@ -109,56 +117,56 @@ for i in ignore: self.ignorelist.append(str(i [:len(i)-1])) manifest = ignore.readlines() ignore.close() - - def Finish(self, evt=None): + + def Finish(self, evt=None): try: self.parent.Destroy() except: - print 'Fail'; exit() - + print 'Fail'; exit() + def ChooseBranch(self, evt=None): - dlg = wx.Dialog(self, wx.ID_ANY, "Package Selector", style=wx.DEFAULT_DIALOG_STYLE) - if wx.Platform == '__WXMSW__': icon = wx.Icon(dir_struct["icon"]+'d20.ico', wx.BITMAP_TYPE_ICO) - else: icon = wx.Icon(dir_struct["icon"]+"d20.xpm", wx.BITMAP_TYPE_XPM ) + dlg = wx.Dialog(self, wx.ID_ANY, "Package Selector", style=wx.DEFAULT_DIALOG_STYLE) + if wx.Platform == '__WXMSW__': icon = wx.Icon(dir_struct["icon"]+'d20.ico', wx.BITMAP_TYPE_ICO) + else: icon = wx.Icon(dir_struct["icon"]+"d20.xpm", wx.BITMAP_TYPE_XPM ) dlg.SetIcon(icon) self.ui = ui.ui() self.repo = hg.repository(self.ui, ".") - self.c = self.repo.changectx('tip') - + self.c = self.repo.changectx('tip') + 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() - + 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() + self.get_packages() if self.package_list == None: return - types = self.package_list - row=0; col=0 + types = self.package_list + row=0; col=0 self.current = self.repo.dirstate.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) + 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)) + dlgsizer.Add(self.btn[self.id], (row, col)) col += 1; self.id += 1 if col == 3: row += 1; col = 0 - + dlgsizer.Add(Yes, (row+1,col/2)) dlgsizer.AddGrowableCol(0) dlgsizer.AddGrowableRow(0) - dlg.SetAutoLayout( True ) + dlg.SetAutoLayout( True ) dlg.SetSizer( dlgsizer ) - dlgsizer.Fit( dlg ) - dlg.Centre() - dlg.Bind(wx.EVT_RADIOBUTTON, self.PackageSet) - if dlg.ShowModal(): dlg.Destroy() - + dlgsizer.Fit( dlg ) + dlg.Centre() + dlg.Bind(wx.EVT_RADIOBUTTON, self.PackageSet) + if dlg.ShowModal(): dlg.Destroy() + def PackageSet(self, event): for btn in self.btn: if self.btn[btn].GetValue() == True: self.current = self.btnlist[btn] @@ -181,7 +189,7 @@ self.filelist.AppendText("Currently selected branch: " + branch + "\n\nAuthor: "+cs[1]+"\n\n") self.filelist.AppendText("Files Modified (in update): \n") for f in cs[3]: self.filelist.AppendText(f+"\n") - + def get_packages(self, type=None): #Fixed and ready for Test. Can be cleaner self.package_list = [] @@ -191,16 +199,18 @@ l.sort() l.reverse() for ishead, r, n, t in l: self.package_list.append(t) - + def get_package(self): - self.get_packages() + self.get_packages() if self.package_list == None: return None - return None + return None class Repos(wx.Panel): - def __init__(self, parent, openrpg, manifest): + def __init__(self, parent, openrpg): wx.Panel.__init__(self, parent) - + ### Status Bar ### + #statbar.SetStatusText('Add, Delete, or Refresh your source Tracs') + statbar.SetStatusText('New Status Bar') ### Update Manager self.ui = ui.ui() self.r = hg.repository(self.ui, ".") @@ -208,7 +218,6 @@ #mainpanel = self self.openrpg = openrpg - self.manifest = manifest self.buttons = {} self.texts = {} @@ -245,7 +254,6 @@ self.sizers["repolist"] = wx.StaticBoxSizer(self.box_sizers["repolist"], wx.VERTICAL) self.sizers["repo"] = wx.GridBagSizer(hgap=2, vgap=2) self.sizers["repolist_layout"] = wx.FlexGridSizer(rows=1, cols=1, hgap=2, vgap=5) - self.manifest = manifest self.NewRepoList(None) self.BuildRepoList(None) @@ -267,23 +275,26 @@ self.sizers["main"].AddGrowableRow(1) self.SetSizer(self.sizers["main"]) self.SetAutoLayout(True) - self.Fit() + #self.Fit() self.Bind(wx.EVT_BUTTON, self.AddRepo, self.buttons['addrepo']) def NewRepoList(self, event): - self.id = -1; self.box = {}; self.box_name= {}; self.main = {}; self.container = {}; self.layout = {} + self.id = -1 + self.box = {}; self.box_name= {}; self.main = {}; self.container = {}; self.layout = {} self.name = {}; self.url = {}; self.url_list = {}; self.pull = {}; self.uri = {}; self.delete = {} self.defaultcheck = {}; self.default = {}; self.repotrac = {} - self.pull_list = {}; self.delete_list = {}; self.defchecklist = {} + self.pull_list = {}; self.delete_list = {}; self.defchecklist = {}; self.repolist = [] def BuildRepoList(self, event): - self.repolist = self.manifest.GetList('UpdateManifest', 'repolist', '') - try: self.repolist = self.repo - except: pass + repolist = manifest.PluginChildren('updaterepo') + appendlist = [] + for repo in repolist: + if repo not in self.repolist: appendlist.append(repo) + self.repolist = repolist #wx.Yeild() For future refrence. - for repo in self.repolist: + for repo in appendlist: self.id += 1 #Build Constructs self.box[self.id] = wx.StaticBox(self.repopanel, -1, str(repo)) @@ -291,7 +302,8 @@ self.container[self.id] = wx.StaticBoxSizer(self.box[self.id], wx.VERTICAL) self.layout[self.id] = wx.FlexGridSizer(rows=1, cols=4, hgap=2, vgap=5) self.name[self.id] = wx.StaticText(self.repopanel, -1, 'URL') - self.uri[self.id] = self.manifest.GetString('updaterepo', repo, '') + self.uri[self.id] = manifest.GetString('updaterepo', repo, '') + #except: self.uri[self.id] = '' self.url[self.id] = wx.TextCtrl(self.repopanel, -1, self.uri[self.id]) self.pull[self.id] = wx.Button(self.repopanel, wx.ID_REFRESH) self.delete[self.id] = wx.Button(self.repopanel, wx.ID_DELETE) @@ -303,11 +315,15 @@ self.pull_list[self.pull[self.id]] = self.id self.defchecklist[self.defaultcheck[self.id]] = self.id #Build Layout - self.layout[self.id].Add(self.name[self.id], -1, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL) - self.layout[self.id].Add(self.url[self.id], -1, wx.EXPAND) - self.layout[self.id].Add(self.pull[self.id], -1, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALL) + self.layout[self.id].Add(self.name[self.id], + -1, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL) + self.layout[self.id].Add(self.url[self.id], + -1, wx.EXPAND) + self.layout[self.id].Add(self.pull[self.id], + -1, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALL) self.layout[self.id].Add(self.delete[self.id], -1, wx.EXPAND) - self.layout[self.id].Add(self.defaultcheck[self.id], -1, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALL) + self.layout[self.id].Add(self.defaultcheck[self.id], + -1, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALL) self.layout[self.id].Add(self.default[self.id], -1, wx.EXPAND) self.layout[self.id].AddGrowableCol(1) self.container[self.id].Add(self.layout[self.id], -1, wx.EXPAND) @@ -317,9 +333,10 @@ self.Bind(wx.EVT_CHECKBOX, self.SetDefault, self.defaultcheck[self.id]) self.sizers["repolist_layout"].Insert(0, self.container[self.id], -1, wx.EXPAND) self.sizers['repolist_layout'].Layout() + self.Layout() #Set Default Repo Button - capture = self.manifest.GetString('updaterepo', 'default', '') + capture = manifest.GetString('default', 'repo', '') if capture != '': for caught in self.uri: if capture == self.uri[caught]: self.id = caught; pass @@ -328,30 +345,27 @@ def AddRepo(self, event): repo = self.texts['reponame'].GetValue(); repo = repo.replace(' ', '_'); repo = 'repo-' + repo - self.manifest.SetString('updaterepo', repo, ''); self.repo = repo.split(',') - repolist = self.manifest.GetList('UpdateManifest', 'repolist', '') - if repolist == '': pass - else: repolist = repolist + self.repo - self.manifest.SetList('UpdateManifest', 'repolist', repolist) + manifest.SetString('updaterepo', repo, '') #; self.repo = repo.split(',') self.BuildRepoList(None) def DelRepo(self, event): self.id = self.delete_list[event.GetEventObject()] self.sizers["repolist_layout"].Hide(self.container[self.id]) + manifest.DelString('updaterepo', self.box_name[self.id]) try: del self.box_name[self.id] except: pass - self.manifest.SetList('UpdateManifest', 'repolist', list(self.box_name.values())) self.sizers['repolist_layout'].Layout() + self.repolist = manifest.PluginChildren('updaterepo') def RefreshRepo(self, event): self.id = self.pull_list[event.GetEventObject()] - self.manifest.SetString('updaterepo', str(self.box_name[self.id]), self.url[self.id].GetValue()) + manifest.SetString('updaterepo', str(self.box_name[self.id]), self.url[self.id].GetValue()) try: commands.pull(self.ui, self.r, self.url[self.id].GetValue(), rev='', update=False, force=True) except: pass def SetDefault(self, event): self.id = self.defchecklist[event.GetEventObject()] - self.manifest.SetString('updaterepo', 'default', self.uri[self.id]) + manifest.SetString('default', 'repo', self.uri[self.id]) for all in self.defaultcheck: self.defaultcheck[all].SetValue(False) self.defaultcheck[self.id].SetValue(True) @@ -359,6 +373,9 @@ class Manifest(wx.Panel): def __init__(self, parent): wx.Panel.__init__(self, parent) + ### Status Bar ### + #statbar.SetStatusText('Create an Ignore List') + statbar.SetStatusText('New Status Bar') self.ui = ui.ui() self.repo = hg.repository(self.ui, ".") self.c = self.repo.changectx('tip') @@ -366,7 +383,7 @@ self.manifestlist = self.c.manifest().keys() for mana in self.manifestlist: mana = os.sep + 'orpg' + os.sep + mana self.manifestlist.sort() - self.SetBackgroundColour(wx.WHITE) + self.SetBackgroundColour(wx.WHITE) self.sizer = wx.GridBagSizer(hgap=1, vgap=1) self.manifestlog = wx.CheckListBox( self, -1, wx.DefaultPosition, wx.DefaultSize, self.manifestlist, wx.LC_REPORT|wx.SUNKEN_BORDER|wx.EXPAND|wx.LC_HRULES) @@ -376,9 +393,9 @@ self.mana = self.LoadDoc() self.manifestlog.Bind(wx.EVT_CHECKLISTBOX, self.GetChecked) self.sizer.Add(self.manifestlog, (0,0), flag=wx.EXPAND) - self.sizer.AddGrowableCol(0) + self.sizer.AddGrowableCol(0) self.sizer.AddGrowableRow(0) - self.SetSizer(self.sizer) + self.SetSizer(self.sizer) self.SetAutoLayout(True) def GetChecked(self, event): @@ -407,20 +424,21 @@ class Control(wx.Panel): def __init__(self, parent): wx.Panel.__init__(self, parent) - + ### Status Bar ### + #statbar.SetStatusText('Advanced Controls & Rollback') + statbar.SetStatusText('New Status Bar') ### Control Panel self.ui = ui.ui() self.repo = hg.repository(self.ui, ".") self.c = self.repo.changectx('tip') - self.manifest = manifest - self.parent = parent + self.parent = parent #logger.debug("Enter updaterFrame") #Need to set logging level self.get_packages() - self.SetBackgroundColour(wx.WHITE) + self.SetBackgroundColour(wx.WHITE) self.sizer = wx.GridBagSizer(hgap=1, vgap=1) self.buttons = {} - + ## Changelog / File List changelogcp = wx.Panel(self) self.changelogcp = wx.GridBagSizer(hgap=1, vgap=1) @@ -467,21 +485,21 @@ self.cp = wx.GridBagSizer(hgap=1, vgap=1) self.buttons['update'] = wx.Button(cp, wx.ID_ANY, "Revision Update") self.buttons['delete'] = wx.Button(cp, wx.ID_ANY, "Delete Branch") - self.cp.Add(self.buttons['update'], (0,0)) + self.cp.Add(self.buttons['update'], (0,0)) self.cp.Add(self.buttons['delete'], (0,1)) cp.SetSizer(self.cp) cp.SetAutoLayout(True) - + self.sizer.Add(changelogcp, (0,0), span=(3,1), flag=wx.EXPAND) self.sizer.Add(branchcp, (0,1), span=(1,1)) self.sizer.Add(revlistcp, (2,1), span=(1,1), flag=wx.EXPAND) - self.sizer.Add(cp, (1,1), span=(1,1)) + self.sizer.Add(cp, (1,1), span=(1,1)) - self.buttons['delete'].Disable() + self.buttons['delete'].Disable() self.sizer.AddGrowableCol(0) - self.sizer.AddGrowableCol(1) - self.sizer.AddGrowableRow(2) - self.SetSizer(self.sizer) + self.sizer.AddGrowableCol(1) + self.sizer.AddGrowableRow(2) + self.SetSizer(self.sizer) self.SetAutoLayout(True) self.currev = self.repo.changelog.rev(self.repo.branchtags()[self.current]) @@ -491,8 +509,8 @@ self.Bind(wx.EVT_CHOICE, self.PackageSet) self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.RevSet) self.Bind(wx.EVT_BUTTON, self.RevUpdate, self.buttons['update']) - - + + def PackageSet(self, event): self.current = self.branches.GetStringSelection() branches = self.repo.branchtags() @@ -575,29 +593,32 @@ l.sort() l.reverse() for ishead, r, n, t in l: self.package_list.append(t) - + def get_package(self): - self.get_packages() + self.get_packages() if self.package_list == None: return None - return None - -class updaterFrame(wx.Frame): + return None + +class updaterFrame(wx.Frame): def __init__(self, parent, title, openrpg, manifest, main): - wx.Frame.__init__(self, None, wx.ID_ANY, title, size=(600,480), style=wx.DEFAULT_FRAME_STYLE) - if wx.Platform == '__WXMSW__': icon = wx.Icon(dir_struct["icon"]+'d20.ico', wx.BITMAP_TYPE_ICO) + wx.Frame.__init__(self, None, wx.ID_ANY, title, size=(600,500), style=wx.DEFAULT_FRAME_STYLE) + if wx.Platform == '__WXMSW__': icon = wx.Icon(dir_struct["icon"]+'d20.ico', wx.BITMAP_TYPE_ICO) else: icon = wx.Icon(dir_struct["icon"]+"d20.xpm", wx.BITMAP_TYPE_XPM ) self.SetIcon(icon) - self.CenterOnScreen() self.main = main ####### Panel Stuff ###### p = wx.Panel(self) nb = wx.Notebook(p) + global statbar + statbar = self.CreateStatusBar() + self.Centre() + # create the page windows as children of the notebook - page1 = Updater(nb, openrpg, manifest) - page2 = Repos(nb, openrpg, manifest) + page1 = Updater(nb, openrpg) + page2 = Repos(nb, openrpg) page3 = Manifest(nb) page4 = Control(nb) @@ -612,31 +633,33 @@ sizer = wx.BoxSizer() sizer.Add(nb, 1, wx.EXPAND) p.SetSizer(sizer) + p.Layout() + self.Refresh() self.Bind(wx.EVT_CLOSE, self.OnClose) def OnClose(self, event): if self.main == False: self.Destroy() if self.main == True: self.Hide() - + class updateApp(wx.App): def OnInit(self): - self.main = False - logger._set_log_to_console(False) - logger.note("Updater Start") - self.manifest = manifest.ManifestChanges() - component.add('validate', validate) + self.main = False + sys.stdout = Term2Win() + logger._set_log_to_console(False) + logger.note("Updater Start") + component.add('validate', validate) self.updater = updaterFrame(self, "OpenRPG Update Manager 0.8 (open beta)", - component, self.manifest, self.main) - if self.manifest.GetString("updatemana", "auto_update", "") == 'on' and self.main == False: + component, manifest, self.main) + if manifest.GetString("updatemana", "auto_update", "") == 'on' and self.main == False: self.AutoUpdate(); self.OnExit() else: pass - if self.manifest.GetString('updatemana', 'no_update', '') == 'on' and self.main == False: + if manifest.GetString('updatemana', 'no_update', '') == 'on' and self.main == False: self.OnExit() else: pass - try: - self.updater.Show() - self.updater.Fit() - except: pass + try: + self.updater.Show() + self.updater.Fit() + except: pass return True def AutoUpdate(self): @@ -645,7 +668,7 @@ self.c = self.repo.changectx('tip') self.current = self.repo.dirstate.branch() - capture = self.manifest.GetString('updaterepo', 'default', '') + capture = manifest.GetString('updaterepo', 'default', '') if capture != '': commands.pull(self.ui, self.repo, capture, rev='', update=False, force=True) filename = 'ignorelist.txt' @@ -667,13 +690,13 @@ for i in ignore: self.ignorelist.append(str(i [:len(i)-1])) manifest = ignore.readlines() ignore.close() - + def OnExit(self): imported = ['manifest', 'orpg.dirpath', 'orpg.orpgCore', 'orpg.orpg_version', 'orpg.tools.orpg_log', 'orpg.tools.orpg_log', 'orpg.orpg_xml', 'orpg.dirpath', 'orpg.dirpath', 'upmana.validate', 'mercurial.ui', 'mercurial.hg', - 'mercurial.commands', 'mercurial.repo', 'mercurial.revlog', 'mercurial.cmdutil', 'shutil'] - for name in imported: + 'mercurial.commands', 'mercurial.repo', 'mercurial.revlog', 'mercurial.cmdutil', 'shutil'] + for name in imported: if name in sys.modules: del sys.modules[name] try: self.updater.Destroy()