comparison upmana/updatemana.py @ 212:13054be69834 beta

Traipse Beta 'OpenRPG' {100428-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 (Patch-2) New Features: New Namespace method with two new syntaxes New Namespace Internal is context sensitive, always! New Namespace External is 'as narrow as you make it' New Namespace FutureCheck helps ensure you don't receive an incorrect node New PluginDB access for URL2Link plugin New to Forms, they now show their content in Design Mode New to Update Manager, checks Repo for updates on software start Fixes: Fix to Server GUI startup errors Fix to Server GUI Rooms tab updating Fix to Chat and Settings if non existant die roller is picked Fix to Dieroller and .open() used with .vs(). Successes are correctly calculated Fix to Alias Lib's Export to Tree, Open, Save features Fix to alias node, now works properly Fix to Splitter node, minor GUI cleanup Fix to Backgrounds not loading through remote loader Fix to Node name errors Fix to rolling dice in chat Whispers Fix to Splitters Sizing issues Fix to URL2Link plugin, modified regex compilation should remove memory leak Fix to mapy.py, a roll back due to zoomed grid issues Fix to whiteboard_handler, Circles work by you clicking the center of the circle Fix to Servers parse_incoming_dom which was outdated and did not respect XML Fix to a broken link in the server welcome message Fix to InterParse and logger requiring traceback Fix to Update Manager Status Bar Fix to failed image and erroneous pop up
author sirebral
date Wed, 28 Apr 2010 08:08:09 -0500
parents dcae32e219f1
children bb7b9648792c
comparison
equal deleted inserted replaced
194:44ef45e77880 212:13054be69834
10 from mercurial import ui, hg, commands, repo, revlog, cmdutil, util 10 from mercurial import ui, hg, commands, repo, revlog, cmdutil, util
11 11
12 class Term2Win(object): 12 class Term2Win(object):
13 # A stdout redirector. Allows the messages from Mercurial to be seen in the Install Window 13 # A stdout redirector. Allows the messages from Mercurial to be seen in the Install Window
14 def write(self, text): 14 def write(self, text):
15 statbar.SetStatusText(text) 15 self.closed = sys.__stdout__.closed
16 wx.Yield() 16 self.flush = sys.__stdout__.flush
17 statbar.SetStatusText(text.replace('\n', ''))
17 sys.__stdout__.write(text) 18 sys.__stdout__.write(text)
18 19
19 class Updater(wx.Panel): 20 class Updater(wx.Panel):
20 def __init__(self, parent, component): 21 def __init__(self, parent, component):
21 wx.Panel.__init__(self, parent) 22 wx.Panel.__init__(self, parent)
22 ### Status Bar ### 23 ### Status Bar ###
23 #statbar.SetStatusText('Select a Package and Update') 24 #statbar.SetStatusText('Select a Package and Update')
24 statbar.SetStatusText('New Status Bar') 25 #statbar.SetStatusText('New Status Bar')
26
27 self.timer = wx.Timer(self, 1)
28 self.count = 0
25 29
26 ### Update Manager 30 ### Update Manager
27 self.ui = ui.ui() 31 self.ui = ui.ui()
28 self.repo = hg.repository(self.ui, ".") 32 self.repo = hg.repository(self.ui, ".")
29 self.c = self.repo.changectx('tip') 33 self.c = self.repo.changectx('tip')
42 self.buttons['no_check'] = wx.CheckBox(self, wx.ID_ANY) 46 self.buttons['no_check'] = wx.CheckBox(self, wx.ID_ANY)
43 self.buttons['advanced'] = wx.Button(self, wx.ID_ANY, "Package Select") 47 self.buttons['advanced'] = wx.Button(self, wx.ID_ANY, "Package Select")
44 self.buttons['update'] = wx.Button(self, wx.ID_ANY, "Update Now") 48 self.buttons['update'] = wx.Button(self, wx.ID_ANY, "Update Now")
45 self.buttons['finish'] = wx.Button(self, wx.ID_ANY, "Finish") 49 self.buttons['finish'] = wx.Button(self, wx.ID_ANY, "Finish")
46 50
47 self.sizer.Add(self.changelog, (0,0), span=(4,1), flag=wx.EXPAND) 51 self.sizer.Add(self.changelog, (0,0), span=(5,1), flag=wx.EXPAND)
48 self.sizer.Add(self.filelist, (0,1), span=(1,3), flag=wx.EXPAND) 52 self.sizer.Add(self.filelist, (0,1), span=(1,3), flag=wx.EXPAND)
49 53
50 self.sizer.Add(self.buttons['progress_bar'], (1,1), span=(1,3), flag=wx.EXPAND) 54 self.sizer.Add(self.buttons['progress_bar'], (1,1), span=(1,3), flag=wx.EXPAND)
51 self.sizer.Add(self.buttons['auto_text'], (2,1)) 55 self.sizer.Add(self.buttons['auto_text'], (2,1))
52 self.sizer.Add(self.buttons['auto_check'], (2,2), flag=wx.EXPAND) 56 self.sizer.Add(self.buttons['auto_check'], (2,2), flag=wx.EXPAND)
53 self.sizer.Add(self.buttons['no_text'], (3,1)) 57 self.sizer.Add(self.buttons['no_text'], (3,1))
54 self.sizer.Add(self.buttons['no_check'], (3,2), flag=wx.EXPAND) 58 self.sizer.Add(self.buttons['no_check'], (3,2), flag=wx.EXPAND)
55 self.sizer.Add(self.buttons['advanced'], (2,3), flag=wx.EXPAND) 59 self.sizer.Add(self.buttons['advanced'], (2,3), flag=wx.EXPAND)
56 self.sizer.Add(self.buttons['update'], (3,3), flag=wx.EXPAND) 60 self.sizer.Add(self.buttons['update'], (3,3), flag=wx.EXPAND)
57 self.sizer.Add(self.buttons['finish'], (4,3), flag=wx.EXPAND) 61 self.sizer.Add(self.buttons['finish'], (4,3), flag=wx.EXPAND)
58 #self.buttons['finish'].Disable() 62 self.buttons['progress_bar'].SetValue(100)
59 self.sizer.AddGrowableCol(0) 63 self.sizer.AddGrowableCol(0)
60 self.sizer.AddGrowableRow(0) 64 self.sizer.AddGrowableRow(0)
61 self.SetSizer(self.sizer) 65 self.SetSizer(self.sizer)
62 self.SetAutoLayout(True) 66 self.SetAutoLayout(True)
63 self.get_package 67 self.get_package
74 self.Bind(wx.EVT_BUTTON, self.Update, self.buttons['update']) 78 self.Bind(wx.EVT_BUTTON, self.Update, self.buttons['update'])
75 self.Bind(wx.EVT_BUTTON, self.Finish, self.buttons['finish']) 79 self.Bind(wx.EVT_BUTTON, self.Finish, self.buttons['finish'])
76 self.Bind(wx.EVT_BUTTON, self.ChooseBranch, self.buttons['advanced']) 80 self.Bind(wx.EVT_BUTTON, self.ChooseBranch, self.buttons['advanced'])
77 self.Bind(wx.EVT_CHECKBOX, self.ToggleAutoUpdate, self.buttons['auto_check']) 81 self.Bind(wx.EVT_CHECKBOX, self.ToggleAutoUpdate, self.buttons['auto_check'])
78 self.Bind(wx.EVT_CHECKBOX, self.ToggleNoUpdate, self.buttons['no_check']) 82 self.Bind(wx.EVT_CHECKBOX, self.ToggleNoUpdate, self.buttons['no_check'])
83 self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer)
84
85 def OnTimer(self, event):
86 self.count = self.count + 1
87 self.buttons['progress_bar'].SetValue(self.count)
88 if self.count == 100:
89 self.timer.Stop()
90 statbar.SetStatusText('Checking For Updates')
91
92 def UpdateCheck(self):
93 self.timer.Start(100)
94 self.count = 3
95 self.buttons['progress_bar'].SetValue(3)
96 doUpdate = commands.incoming(self.ui, self.repo,
97 manifest.GetString('default', 'repo', ''), force=True, bundle=False)
98 if doUpdate:
99 statbar.SetStatusText('No Updates Available')
100 self.buttons['progress_bar'].SetValue(100)
101 self.timer.Stop()
102 else:
103 statbar.SetStatusText('Refresh Repo For Updated Source')
104 self.buttons['progress_bar'].SetValue(100)
105 self.timer.Stop()
79 106
80 def ToggleAutoUpdate(self, event): 107 def ToggleAutoUpdate(self, event):
81 if self.buttons['auto_check'].GetValue() == True: 108 if self.buttons['auto_check'].GetValue() == True:
82 if self.buttons['no_check'].GetValue() == True: 109 if self.buttons['no_check'].GetValue() == True:
83 self.buttons['no_check'].SetValue(False) 110 self.buttons['no_check'].SetValue(False)
685 p = wx.Panel(self) 712 p = wx.Panel(self)
686 nb = wx.Notebook(p) 713 nb = wx.Notebook(p)
687 714
688 global statbar 715 global statbar
689 statbar = self.CreateStatusBar() 716 statbar = self.CreateStatusBar()
717 sys.stdout = Term2Win()
690 self.Centre() 718 self.Centre()
691 719
692 # create the page windows as children of the notebook 720 # create the page windows as children of the notebook
693 page1 = Updater(nb, openrpg) 721 self.page1 = Updater(nb, openrpg)
694 page2 = Repos(nb, openrpg) 722 page2 = Repos(nb, openrpg)
695 page3 = Manifest(nb) 723 page3 = Manifest(nb)
696 page4 = Control(nb) 724 page4 = Control(nb)
697 page5 = Help(nb) 725 page5 = Help(nb)
698 726
699 # add the pages to the notebook with the label to show on the tab 727 # add the pages to the notebook with the label to show on the tab
700 nb.AddPage(page1, "Updater") 728 nb.AddPage(self.page1, "Updater")
701 nb.AddPage(page2, "Repos") 729 nb.AddPage(page2, "Repos")
702 nb.AddPage(page3, "Manifest") 730 nb.AddPage(page3, "Manifest")
703 nb.AddPage(page4, "Control") 731 nb.AddPage(page4, "Control")
704 nb.AddPage(page5, 'Help') 732 nb.AddPage(page5, 'Help')
705 733
718 if self.main == True: self.Hide() 746 if self.main == True: self.Hide()
719 747
720 class updateApp(wx.App): 748 class updateApp(wx.App):
721 def OnInit(self): 749 def OnInit(self):
722 self.main = False 750 self.main = False
723 sys.stdout = Term2Win() 751
724 logger._set_log_to_console(False) 752 logger._set_log_to_console(False)
725 logger.note("Updater Start") 753 logger.note("Updater Start")
726 component.add('validate', validate) 754 component.add('validate', validate)
727 self.updater = updaterFrame(self, "OpenRPG Update Manager 1.0", 755 self.updater = updaterFrame(self, "OpenRPG Update Manager 1.2",
728 component, manifest, self.main) 756 component, manifest, self.main)
729 if manifest.GetString("updatemana", "auto_update", "") == 'on' and self.main == False: 757 if manifest.GetString("updatemana", "auto_update", "") == 'on' and self.main == False:
730 self.AutoUpdate(); self.OnExit() 758 self.AutoUpdate(); self.OnExit()
731 else: pass 759 else: pass
732 if manifest.GetString('updatemana', 'no_update', '') == 'on' and self.main == False: 760 if manifest.GetString('updatemana', 'no_update', '') == 'on' and self.main == False:
734 else: pass 762 else: pass
735 try: 763 try:
736 self.updater.Show() 764 self.updater.Show()
737 self.updater.Fit() 765 self.updater.Fit()
738 except: pass 766 except: pass
767 if not self.main: self.updater.page1.UpdateCheck()
739 return True 768 return True
740 769
741 def AutoUpdate(self): 770 def AutoUpdate(self):
742 self.ui = ui.ui() 771 self.ui = ui.ui()
743 self.repo = hg.repository(self.ui, ".") 772 self.repo = hg.repository(self.ui, ".")