annotate upmana/updatemana.py @ 54:5d89a6eaf492 traipse_dev

WinXP seems to have lost some boxes unless the screen is resized. Weird. Stable (enough) Version. Preparing to stable.
author sirebral
date Thu, 06 Aug 2009 17:22:17 -0500
parents c9694d854a61
children 0b79d5dbbe9e
rev   line source
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
1 import wx
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
2 import manifest
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
3 import orpg.dirpath
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
4 from orpg.orpgCore import *
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
5 import orpg.orpg_version
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
6 import orpg.tools.orpg_log
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
7 import orpg.orpg_xml
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
8 import orpg.dirpath
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
9 import orpg.tools.validate
47
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
10 import tempfile
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
11 import shutil
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
12 from mercurial import ui, hg, commands, repo, revlog, cmdutil
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
13
46
599f727e3833 Getting ready to test!! Main functions seem to be working.
sirebral
parents: 45
diff changeset
14
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
15 class Updater(wx.Panel):
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
16 def __init__(self, parent, open_rpg, manifest):
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
17 wx.Panel.__init__(self, parent)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
18
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
19 ### Update Manager
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
20 self.ui = ui.ui()
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
21 self.repo = hg.repository(self.ui, ".")
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
22 self.c = self.repo.changectx('tip')
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
23 self.manifest = manifest
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
24 self.xml = open_rpg.get_component('xml')
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
25 self.dir_struct = open_rpg.get_component("dir_struct")
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
26 self.parent = parent
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
27 self.log = open_rpg.get_component("log")
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
28 self.log.log("Enter updaterFrame", ORPG_DEBUG)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
29 self.SetBackgroundColour(wx.WHITE)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
30 self.sizer = wx.GridBagSizer(hgap=1, vgap=1)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
31 self.changelog = wx.TextCtrl(self, wx.ID_ANY, size=(400, -1), style=wx.TE_MULTILINE | wx.TE_READONLY)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
32 self.filelist = wx.TextCtrl(self, wx.ID_ANY, size=(250, 300), style=wx.TE_MULTILINE | wx.TE_READONLY)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
33 self.buttons = {}
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
34 self.buttons['progress_bar'] = wx.Gauge(self, wx.ID_ANY, 100)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
35 self.buttons['auto_text'] = wx.StaticText(self, wx.ID_ANY, "Auto Update")
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
36 self.buttons['auto_check'] = wx.CheckBox(self, wx.ID_ANY)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
37 self.buttons['no_text'] = wx.StaticText(self, wx.ID_ANY, "No Update")
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
38 self.buttons['no_check'] = wx.CheckBox(self, wx.ID_ANY)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
39 self.buttons['advanced'] = wx.Button(self, wx.ID_ANY, "Package Select")
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
40 self.buttons['update'] = wx.Button(self, wx.ID_ANY, "Update Now")
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
41 self.buttons['finish'] = wx.Button(self, wx.ID_ANY, "Finish")
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
42
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
43 self.sizer.Add(self.changelog, (0,0), span=(4,1), flag=wx.EXPAND)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
44 self.sizer.Add(self.filelist, (0,1), span=(1,3), flag=wx.EXPAND)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
45
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
46 self.sizer.Add(self.buttons['progress_bar'], (1,1), span=(1,3), flag=wx.EXPAND)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
47 self.sizer.Add(self.buttons['auto_text'], (2,1))
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
48 self.sizer.Add(self.buttons['auto_check'], (2,2), flag=wx.EXPAND)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
49 self.sizer.Add(self.buttons['no_text'], (3,1))
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
50 self.sizer.Add(self.buttons['no_check'], (3,2), flag=wx.EXPAND)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
51 self.sizer.Add(self.buttons['advanced'], (2,3), flag=wx.EXPAND)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
52 self.sizer.Add(self.buttons['update'], (3,3), flag=wx.EXPAND)
49
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
53 self.sizer.Add(self.buttons['finish'], (4,3), flag=wx.EXPAND)
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
54 self.buttons['finish'].Disable()
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
55 self.sizer.AddGrowableCol(0)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
56 self.sizer.AddGrowableRow(0)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
57 self.SetSizer(self.sizer)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
58 self.SetAutoLayout(True)
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
59 self.get_package
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
60
48
0aeee1992423 This updates fixes three things. Branch names are now current to your udpate
sirebral
parents: 47
diff changeset
61 self.current = self.repo.dirstate.branch()
49
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
62 self.BranchInfo(self.current)
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
63
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
64 if self.manifest.GetString("updatemana", "no_update", "") == 'on': self.buttons['no_check'].SetValue(True)
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
65 else: self.buttons['no_check'].SetValue(False)
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
66 if self.manifest.GetString("updatemana", "auto_update", "") == 'on': self.buttons['auto_check'].SetValue(True)
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
67 else: self.buttons['auto_check'].SetValue(False)
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
68
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
69 ## Event Handlers
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
70 self.Bind(wx.EVT_BUTTON, self.Update, self.buttons['update'])
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
71 self.Bind(wx.EVT_BUTTON, self.Finish, self.buttons['finish'])
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
72 self.Bind(wx.EVT_BUTTON, self.ChooseBranch, self.buttons['advanced'])
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
73 self.Bind(wx.EVT_CHECKBOX, self.ToggleAutoUpdate, self.buttons['auto_check'])
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
74 self.Bind(wx.EVT_CHECKBOX, self.ToggleNoUpdate, self.buttons['no_check'])
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
75
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
76 def ToggleAutoUpdate(self, event):
49
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
77 if self.buttons['auto_check'].GetValue() == True:
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
78 if self.buttons['no_check'].GetValue() == True:
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
79 self.buttons['no_check'].SetValue(False)
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
80 self.manifest.SetString("updatemana", "no_update", "off")
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
81 self.manifest.SetString("updatemana", "auto_update", "on")
47
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
82 else: self.manifest.SetString("updatemana", "auto_update", "off")
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
83
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
84 def ToggleNoUpdate(self, event):
49
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
85 if self.buttons['no_check'].GetValue() == True:
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
86 if self.buttons['auto_check'].GetValue() == True:
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
87 self.buttons['auto_check'].SetValue(False)
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
88 self.manifest.SetString("updatemana", "auto_update", "off")
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
89 self.manifest.SetString("updatemana", "no_update", "on")
47
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
90 else: self.manifest.SetString("updatemana", "no_update", "off")
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
91
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
92 def Update(self, evt=None):
47
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
93 self.ui = ui.ui()
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
94 self.repo = hg.repository(self.ui, ".")
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
95 self.c = self.repo.changectx('tip')
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
96
48
0aeee1992423 This updates fixes three things. Branch names are now current to your udpate
sirebral
parents: 47
diff changeset
97 filename = 'ignorelist.txt'
47
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
98 self.filename = orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + filename
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
99 orpg.tools.validate.Validate(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep).config_file(filename, "default_ignorelist.txt")
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
100 self.mana = self.LoadDoc()
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
101 for ignore in self.ignorelist:
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
102 shutil.copy(ignore, orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep)
48
0aeee1992423 This updates fixes three things. Branch names are now current to your udpate
sirebral
parents: 47
diff changeset
103 hg.clean(self.repo, self.current)
47
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
104 for ignore in self.ignorelist:
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
105 shutil.copyfile(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep + ignore.split('/')[len(ignore.split('/')) - 1], ignore)
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
106 os.remove(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep + ignore.split('/')[len(ignore.split('/')) - 1])
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
107
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
108 def LoadDoc(self):
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
109 ignore = open(self.filename)
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
110 self.ignorelist = []
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
111 for i in ignore: self.ignorelist.append(str(i [:len(i)-1]))
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
112 manifest = ignore.readlines()
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
113 ignore.close()
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
114
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
115 def Finish(self, evt=None):
49
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
116 try: self.parent.Destroy()
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
117 except:
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
118 print 'Fail'; exit()
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
119
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
120 def ChooseBranch(self, evt=None):
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
121 dlg = wx.Dialog(self, wx.ID_ANY, "Package Selector", style=wx.DEFAULT_DIALOG_STYLE)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
122 if wx.Platform == '__WXMSW__': icon = wx.Icon(self.dir_struct["icon"]+'d20.ico', wx.BITMAP_TYPE_ICO)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
123 else: icon = wx.Icon(self.dir_struct["icon"]+"d20.xpm", wx.BITMAP_TYPE_XPM )
48
0aeee1992423 This updates fixes three things. Branch names are now current to your udpate
sirebral
parents: 47
diff changeset
124 dlg.SetIcon(icon)
0aeee1992423 This updates fixes three things. Branch names are now current to your udpate
sirebral
parents: 47
diff changeset
125
0aeee1992423 This updates fixes three things. Branch names are now current to your udpate
sirebral
parents: 47
diff changeset
126 self.ui = ui.ui()
0aeee1992423 This updates fixes three things. Branch names are now current to your udpate
sirebral
parents: 47
diff changeset
127 self.repo = hg.repository(self.ui, ".")
0aeee1992423 This updates fixes three things. Branch names are now current to your udpate
sirebral
parents: 47
diff changeset
128 self.c = self.repo.changectx('tip')
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
129
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
130 dlgsizer = wx.GridBagSizer(hgap=1, vgap=1)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
131 Yes = wx.Button( dlg, wx.ID_OK, "Ok" )
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
132 Yes.SetDefault()
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
133 rgroup = wx.RadioButton(dlg, wx.ID_ANY, "group_start", style=wx.RB_GROUP)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
134 rgroup.Hide()
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
135
37
cd8f740a8ffc Whoops! Broke the Package Selecter. Now fixed!! Does anyone evene read these?
sirebral
parents: 36
diff changeset
136 self.get_packages()
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
137 if self.package_list == None: return
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
138 types = self.package_list
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
139 row=0; col=0
48
0aeee1992423 This updates fixes three things. Branch names are now current to your udpate
sirebral
parents: 47
diff changeset
140 self.current = self.repo.dirstate.branch()
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
141 self.package_type = self.current
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
142 self.btnlist = {}; self.btn = {}
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
143 self.id = 1
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
144
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
145 for t in types:
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
146 self.btnName = str(t)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
147 self.btn[self.id] = wx.RadioButton(dlg, wx.ID_ANY, str(t), name=self.btnName)
47
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
148 if self.btnName == self.current: self.btn[self.id].SetValue(True)
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
149 self.btnlist[self.id] = self.btnName
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
150 dlgsizer.Add(self.btn[self.id], (row, col))
47
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
151 col += 1; self.id += 1
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
152 if col == 3: row += 1; col = 0
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
153
47
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
154 dlgsizer.Add(Yes, (row+1,col/2))
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
155 dlgsizer.AddGrowableCol(0)
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
156 dlgsizer.AddGrowableRow(0)
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
157 dlg.SetAutoLayout( True )
47
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
158 dlg.SetSizer( dlgsizer )
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
159 dlgsizer.Fit( dlg )
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
160 dlg.Centre()
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
161 dlg.Bind(wx.EVT_RADIOBUTTON, self.PackageSet)
47
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
162 if dlg.ShowModal(): dlg.Destroy()
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
163
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
164 def PackageSet(self, event):
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
165 for btn in self.btn:
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
166 if self.btn[btn].GetValue() == True: self.current = self.btnlist[btn]
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
167
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
168 branches = self.repo.branchtags()
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
169 heads = dict.fromkeys(self.repo.heads(), 1)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
170 l = [((n in heads), self.repo.changelog.rev(n), n, t) for t, n in branches.items()]
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
171
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
172 #l.sort()
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
173 #l.reverse()
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
174 #for ishead, r, n, t in l: self.package_list.append(t)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
175
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
176 if self.current != type:
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
177 #r = hg.islocal()
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
178 files = self.c.files()
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
179 #print commands.log(u, r, c)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
180 #print r.changelog
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
181
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
182 ### Cleaning up for dev build 0.1
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
183 ### The below material is for the Rev Log. You can run hg log to see what data it will pull.
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
184 #cs = r.changectx(c.rev()).changeset()
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
185 #get = util.cachefunc(lambda r: repo.changectx(r).changeset())
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
186 #changeiter, matchfn = cmdutil.walkchangerevs(u, r, 1, cs, 1)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
187 #for st, rev, fns in changeiter:
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
188 # revbranch = get(rev)[5]['branch']; print revbranch
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
189
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
190 heads = dict.fromkeys(self.repo.heads(), self.repo.branchtags())
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
191 branches = dict.copy(self.repo.branchtags())
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
192 self.BranchInfo(self.current)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
193
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
194 def BranchInfo(self, branch):
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
195 self.filelist.SetValue('')
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
196 self.filelist.AppendText("Files that will change\n\n")
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
197 self.changelog.SetValue('')
54
5d89a6eaf492 WinXP seems to have lost some boxes unless the screen is resized. Weird.
sirebral
parents: 52
diff changeset
198 changelog = "Traipse 'OpenRPG' Update Manager.\n\nThis is Dev Build 0.6.9(stable) of the Update Manager. This version is nearly 100% functional. Users can now add repositories of OpenRPG, choose from different branches available from those repositories, and add files to an ignore list.\n\nThe Update Manager is divided into tabs, Updater, Repos, Manifest, and Control. \n\nThe Updater says it all, choose a branch and update to that branch. Repos is a new feature that I hope users take advantage of. Clone the repo, build your own, and then share it with your friends! The Manifest is the ignore list. Want to make sure a test run doesn't delete important files ... then add them to the Manifest'. Control is not functional yet, but when it is users will be able to update to specific revision dates and delete branches.\n\nThis is a good start. Enjoy the freedom!!"
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
199 self.changelog.AppendText(changelog + '\n')
47
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
200 self.filelist.AppendText("Update to " + branch + "\n\nWhen Update Manager is fully functional this area will show the files that will be affected by the yoru branch selection.")
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 #### Files works but not fully without the change log information, pulled for Dev 0.1
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
203 #for f in files:
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
204 # fc = c[f]
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
205 # self.filelist.AppendText(str(f + '\n'))
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
206
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
207 def get_packages(self, type=None):
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
208 #Fixed and ready for Test. Can be cleaner
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
209 self.package_list = []
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
210 b = self.repo.branchtags()
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
211 heads = dict.fromkeys(self.repo.heads(), 1)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
212 l = [((n in heads), self.repo.changelog.rev(n), n, t) for t, n in b.items()]
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
213 l.sort()
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
214 l.reverse()
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
215 for ishead, r, n, t in l: self.package_list.append(t)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
216
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
217 def get_package(self):
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
218 #Fixed and ready for test.
37
cd8f740a8ffc Whoops! Broke the Package Selecter. Now fixed!! Does anyone evene read these?
sirebral
parents: 36
diff changeset
219 self.get_packages()
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
220 if self.package_list == None: return None
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
221 return None
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
222
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
223 class Repos(wx.Panel):
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
224 def __init__(self, parent, openrpg, manifest):
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
225 wx.Panel.__init__(self, parent)
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
226
42
81254b3935fb Refresh button will now work, repos are set after Refresh is pressed, object
sirebral
parents: 41
diff changeset
227 ### Update Manager
81254b3935fb Refresh button will now work, repos are set after Refresh is pressed, object
sirebral
parents: 41
diff changeset
228 self.ui = ui.ui()
81254b3935fb Refresh button will now work, repos are set after Refresh is pressed, object
sirebral
parents: 41
diff changeset
229 self.r = hg.repository(self.ui, ".")
81254b3935fb Refresh button will now work, repos are set after Refresh is pressed, object
sirebral
parents: 41
diff changeset
230 self.c = self.r.changectx('tip')
81254b3935fb Refresh button will now work, repos are set after Refresh is pressed, object
sirebral
parents: 41
diff changeset
231
48
0aeee1992423 This updates fixes three things. Branch names are now current to your udpate
sirebral
parents: 47
diff changeset
232 #mainpanel = self
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
233 self.openrpg = openrpg
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
234 self.manifest = manifest
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
235 self.buttons = {}
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
236 self.texts = {}
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
237
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
238 ## Section Sizers (with frame edges and text captions)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
239 self.box_sizers = {}
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
240 self.box_sizers["newbutton"] = wx.StaticBox(self, -1)
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
241
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
242 ## Layout Sizers
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
243 self.sizers = {}
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
244 self.sizers["main"] = wx.GridBagSizer(hgap=2, vgap=2)
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
245 self.sizers["button"] = wx.GridBagSizer(hgap=2, vgap=2)
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
246
36
683536732926 Update Manager 0.4. This is lookign really really nice now. OMG!!
sirebral
parents: 35
diff changeset
247 #Button Layout
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
248 self.sizers["newbutton"] = wx.StaticBoxSizer(self.box_sizers["newbutton"], wx.VERTICAL)
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
249 self.sizers["newrepo_layout"] = wx.FlexGridSizer(rows=1, cols=2, hgap=2, vgap=5)
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
250 empty = wx.StaticText(self, -1, "")
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
251 reponame = wx.StaticText(self, -1, "Name:")
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
252 self.texts["reponame"] = wx.TextCtrl(self, -1, '')
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
253 self.buttons['addrepo'] = wx.Button(self, wx.ID_NEW)
36
683536732926 Update Manager 0.4. This is lookign really really nice now. OMG!!
sirebral
parents: 35
diff changeset
254
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
255 ##Build Button
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
256 self.sizers["newrepo_layout"].Add(self.buttons['addrepo'], -1, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
257 self.sizers["newrepo_layout"].Add(empty, -1)
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
258 self.sizers["newrepo_layout"].Add(reponame, -1, wx.ALIGN_CENTER|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
259 self.sizers["newrepo_layout"].Add(self.texts["reponame"], -1, wx.EXPAND)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
260 self.sizers["newrepo_layout"].AddGrowableCol(1)
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
261 self.sizers["newbutton"].Add(self.sizers["newrepo_layout"], -1, wx.EXPAND)
40
95db4430caed If you have nothing in the list, New button works now. Adds duplicates though
sirebral
parents: 39
diff changeset
262 #Repo List Panel
36
683536732926 Update Manager 0.4. This is lookign really really nice now. OMG!!
sirebral
parents: 35
diff changeset
263 self.repopanel = wx.ScrolledWindow(self)
683536732926 Update Manager 0.4. This is lookign really really nice now. OMG!!
sirebral
parents: 35
diff changeset
264 self.repopanel.SetScrollbars(20,20,55,40)
683536732926 Update Manager 0.4. This is lookign really really nice now. OMG!!
sirebral
parents: 35
diff changeset
265 self.repopanel.Scroll(50,10)
683536732926 Update Manager 0.4. This is lookign really really nice now. OMG!!
sirebral
parents: 35
diff changeset
266 self.box_sizers["repolist"] = wx.StaticBox(self.repopanel, -1, "Current Repo List")
683536732926 Update Manager 0.4. This is lookign really really nice now. OMG!!
sirebral
parents: 35
diff changeset
267 self.sizers["repolist"] = wx.StaticBoxSizer(self.box_sizers["repolist"], wx.VERTICAL)
683536732926 Update Manager 0.4. This is lookign really really nice now. OMG!!
sirebral
parents: 35
diff changeset
268 self.sizers["repo"] = wx.GridBagSizer(hgap=2, vgap=2)
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
269 self.sizers["repolist_layout"] = wx.FlexGridSizer(rows=1, cols=1, hgap=2, vgap=5)
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
270 self.manifest = manifest
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
271
44
15a76be834dc Delete button is working ok. Moving on to ignore feature then implementation.
sirebral
parents: 43
diff changeset
272 self.NewRepoList(None)
39
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
273 self.BuildRepoList(None)
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
274
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
275 self.sizers["repolist_layout"].AddGrowableCol(0)
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
276 self.sizers["repolist"].Add(self.sizers["repolist_layout"], -1, wx.EXPAND)
36
683536732926 Update Manager 0.4. This is lookign really really nice now. OMG!!
sirebral
parents: 35
diff changeset
277 self.sizers["repo"].Add(self.sizers["repolist"], (0,0), flag=wx.EXPAND)
683536732926 Update Manager 0.4. This is lookign really really nice now. OMG!!
sirebral
parents: 35
diff changeset
278 self.sizers["repo"].AddGrowableCol(0)
683536732926 Update Manager 0.4. This is lookign really really nice now. OMG!!
sirebral
parents: 35
diff changeset
279 self.sizers['repo'].AddGrowableRow(0)
40
95db4430caed If you have nothing in the list, New button works now. Adds duplicates though
sirebral
parents: 39
diff changeset
280 self.sizers['repo'].AddGrowableRow(1)
36
683536732926 Update Manager 0.4. This is lookign really really nice now. OMG!!
sirebral
parents: 35
diff changeset
281 self.repopanel.SetSizer(self.sizers['repo'])
683536732926 Update Manager 0.4. This is lookign really really nice now. OMG!!
sirebral
parents: 35
diff changeset
282 self.repopanel.SetAutoLayout(True)
683536732926 Update Manager 0.4. This is lookign really really nice now. OMG!!
sirebral
parents: 35
diff changeset
283
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
284 #Build Main Sizer
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
285 self.sizers["main"].Add(self.sizers["newbutton"], (0,0), flag=wx.EXPAND)
36
683536732926 Update Manager 0.4. This is lookign really really nice now. OMG!!
sirebral
parents: 35
diff changeset
286 self.sizers["main"].Add(self.repopanel, (1,0), flag=wx.EXPAND)
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
287 self.sizers["main"].AddGrowableCol(0)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
288 self.sizers["main"].AddGrowableCol(1)
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
289 self.sizers["main"].AddGrowableRow(1)
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
290 self.SetSizer(self.sizers["main"])
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
291 self.SetAutoLayout(True)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
292 self.Fit()
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
293 self.Bind(wx.EVT_BUTTON, self.AddRepo, self.buttons['addrepo'])
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
294
44
15a76be834dc Delete button is working ok. Moving on to ignore feature then implementation.
sirebral
parents: 43
diff changeset
295 def NewRepoList(self, event):
15a76be834dc Delete button is working ok. Moving on to ignore feature then implementation.
sirebral
parents: 43
diff changeset
296 self.id = -1; self.box = {}; self.box_name= {}; self.main = {}; self.container = {}; self.layout = {}
15a76be834dc Delete button is working ok. Moving on to ignore feature then implementation.
sirebral
parents: 43
diff changeset
297 self.name = {}; self.url = {}; self.url_list = {}; self.pull = {}; self.uri = {}; self.delete = {}
15a76be834dc Delete button is working ok. Moving on to ignore feature then implementation.
sirebral
parents: 43
diff changeset
298 self.defaultcheck = {}; self.default = {}; self.repotrac = {}
15a76be834dc Delete button is working ok. Moving on to ignore feature then implementation.
sirebral
parents: 43
diff changeset
299 self.pull_list = {}; self.delete_list = {}; self.defchecklist = {}
15a76be834dc Delete button is working ok. Moving on to ignore feature then implementation.
sirebral
parents: 43
diff changeset
300
39
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
301 def BuildRepoList(self, event):
40
95db4430caed If you have nothing in the list, New button works now. Adds duplicates though
sirebral
parents: 39
diff changeset
302 self.repolist = self.manifest.GetList('UpdateManifest', 'repolist', '')
41
6d18ee109e02 Duplicates removed, refresh button still prints. Moving to Pull command
sirebral
parents: 40
diff changeset
303 try: self.repolist = self.repo
6d18ee109e02 Duplicates removed, refresh button still prints. Moving to Pull command
sirebral
parents: 40
diff changeset
304 except: pass
39
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
305
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
306 #wx.Yeild() For future refrence.
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
307
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
308 for repo in self.repolist:
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
309 self.id += 1
42
81254b3935fb Refresh button will now work, repos are set after Refresh is pressed, object
sirebral
parents: 41
diff changeset
310 #Build Constructs
39
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
311 self.box[self.id] = wx.StaticBox(self.repopanel, -1, str(repo))
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
312 self.main[self.id] = wx.GridBagSizer(hgap=2, vgap=2)
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
313 self.container[self.id] = wx.StaticBoxSizer(self.box[self.id], wx.VERTICAL)
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
314 self.layout[self.id] = wx.FlexGridSizer(rows=1, cols=4, hgap=2, vgap=5)
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
315 self.name[self.id] = wx.StaticText(self.repopanel, -1, 'URL')
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
316 self.uri[self.id] = self.manifest.GetString('updaterepo', repo, '')
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
317 self.url[self.id] = wx.TextCtrl(self.repopanel, -1, self.uri[self.id])
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
318 self.pull[self.id] = wx.Button(self.repopanel, wx.ID_REFRESH)
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
319 self.delete[self.id] = wx.Button(self.repopanel, wx.ID_DELETE)
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
320 self.delete_list[self.delete[self.id]] = self.id
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
321 self.defaultcheck[self.id] = wx.CheckBox(self.repopanel, -1)
42
81254b3935fb Refresh button will now work, repos are set after Refresh is pressed, object
sirebral
parents: 41
diff changeset
322 self.default[self.id] = wx.StaticText(self.repopanel, -1, 'Default')
81254b3935fb Refresh button will now work, repos are set after Refresh is pressed, object
sirebral
parents: 41
diff changeset
323 #Build Retraceables
81254b3935fb Refresh button will now work, repos are set after Refresh is pressed, object
sirebral
parents: 41
diff changeset
324 self.box_name[self.id] = str(repo)
81254b3935fb Refresh button will now work, repos are set after Refresh is pressed, object
sirebral
parents: 41
diff changeset
325 self.pull_list[self.pull[self.id]] = self.id
39
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
326 self.defchecklist[self.defaultcheck[self.id]] = self.id
42
81254b3935fb Refresh button will now work, repos are set after Refresh is pressed, object
sirebral
parents: 41
diff changeset
327 #Build Layout
39
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
328 self.layout[self.id].Add(self.name[self.id], -1, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
329 self.layout[self.id].Add(self.url[self.id], -1, wx.EXPAND)
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
330 self.layout[self.id].Add(self.pull[self.id], -1, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
331 self.layout[self.id].Add(self.delete[self.id], -1, wx.EXPAND)
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
332 self.layout[self.id].Add(self.defaultcheck[self.id], -1, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
333 self.layout[self.id].Add(self.default[self.id], -1, wx.EXPAND)
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
334 self.layout[self.id].AddGrowableCol(1)
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
335 self.container[self.id].Add(self.layout[self.id], -1, wx.EXPAND)
43
f00b02fbf511 Delete works, GUI updates wrong. Refresh now Force pulls.
sirebral
parents: 42
diff changeset
336 #Button Events
39
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
337 self.Bind(wx.EVT_BUTTON, self.RefreshRepo, self.pull[self.id])
43
f00b02fbf511 Delete works, GUI updates wrong. Refresh now Force pulls.
sirebral
parents: 42
diff changeset
338 self.Bind(wx.EVT_BUTTON, self.DelRepo, self.delete[self.id])
52
c9694d854a61 Auto Update and Default repo now work, Ignore list is retained. Made attempts
sirebral
parents: 51
diff changeset
339 self.Bind(wx.EVT_CHECKBOX, self.SetDefault, self.defaultcheck[self.id])
39
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
340 self.sizers["repolist_layout"].Insert(0, self.container[self.id], -1, wx.EXPAND)
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
341 self.sizers['repolist_layout'].Layout()
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
342
52
c9694d854a61 Auto Update and Default repo now work, Ignore list is retained. Made attempts
sirebral
parents: 51
diff changeset
343 #Set Default Repo Button
c9694d854a61 Auto Update and Default repo now work, Ignore list is retained. Made attempts
sirebral
parents: 51
diff changeset
344 capture = self.manifest.GetString('updaterepo', 'default', '')
54
5d89a6eaf492 WinXP seems to have lost some boxes unless the screen is resized. Weird.
sirebral
parents: 52
diff changeset
345 if capture != '':
5d89a6eaf492 WinXP seems to have lost some boxes unless the screen is resized. Weird.
sirebral
parents: 52
diff changeset
346 for caught in self.uri:
5d89a6eaf492 WinXP seems to have lost some boxes unless the screen is resized. Weird.
sirebral
parents: 52
diff changeset
347 if capture == self.uri[caught]: self.id = caught; pass
5d89a6eaf492 WinXP seems to have lost some boxes unless the screen is resized. Weird.
sirebral
parents: 52
diff changeset
348 else: continue
5d89a6eaf492 WinXP seems to have lost some boxes unless the screen is resized. Weird.
sirebral
parents: 52
diff changeset
349 self.defaultcheck[self.id].SetValue(True)
52
c9694d854a61 Auto Update and Default repo now work, Ignore list is retained. Made attempts
sirebral
parents: 51
diff changeset
350
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
351 def AddRepo(self, event):
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
352 repo = self.texts['reponame'].GetValue(); repo = repo.replace(' ', '_'); repo = 'repo-' + repo
41
6d18ee109e02 Duplicates removed, refresh button still prints. Moving to Pull command
sirebral
parents: 40
diff changeset
353 self.manifest.SetString('updaterepo', repo, ''); self.repo = repo.split(',')
40
95db4430caed If you have nothing in the list, New button works now. Adds duplicates though
sirebral
parents: 39
diff changeset
354 repolist = self.manifest.GetList('UpdateManifest', 'repolist', '')
47
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
355 if repolist == '': pass
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
356 else: repolist = repolist + self.repo
41
6d18ee109e02 Duplicates removed, refresh button still prints. Moving to Pull command
sirebral
parents: 40
diff changeset
357 self.manifest.SetList('UpdateManifest', 'repolist', repolist)
39
93a27aea09ce Going to post some daily builds as advancements happen. Repo List now updates.
sirebral
parents: 38
diff changeset
358 self.BuildRepoList(None)
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
359
43
f00b02fbf511 Delete works, GUI updates wrong. Refresh now Force pulls.
sirebral
parents: 42
diff changeset
360 def DelRepo(self, event):
f00b02fbf511 Delete works, GUI updates wrong. Refresh now Force pulls.
sirebral
parents: 42
diff changeset
361 self.id = self.delete_list[event.GetEventObject()]
44
15a76be834dc Delete button is working ok. Moving on to ignore feature then implementation.
sirebral
parents: 43
diff changeset
362 self.sizers["repolist_layout"].Hide(self.container[self.id])
15a76be834dc Delete button is working ok. Moving on to ignore feature then implementation.
sirebral
parents: 43
diff changeset
363 try: del self.box_name[self.id]
15a76be834dc Delete button is working ok. Moving on to ignore feature then implementation.
sirebral
parents: 43
diff changeset
364 except: pass
15a76be834dc Delete button is working ok. Moving on to ignore feature then implementation.
sirebral
parents: 43
diff changeset
365 self.manifest.SetList('UpdateManifest', 'repolist', list(self.box_name.values()))
43
f00b02fbf511 Delete works, GUI updates wrong. Refresh now Force pulls.
sirebral
parents: 42
diff changeset
366 self.sizers['repolist_layout'].Layout()
f00b02fbf511 Delete works, GUI updates wrong. Refresh now Force pulls.
sirebral
parents: 42
diff changeset
367
36
683536732926 Update Manager 0.4. This is lookign really really nice now. OMG!!
sirebral
parents: 35
diff changeset
368 def RefreshRepo(self, event):
42
81254b3935fb Refresh button will now work, repos are set after Refresh is pressed, object
sirebral
parents: 41
diff changeset
369 self.id = self.pull_list[event.GetEventObject()]
81254b3935fb Refresh button will now work, repos are set after Refresh is pressed, object
sirebral
parents: 41
diff changeset
370 self.manifest.SetString('updaterepo', str(self.box_name[self.id]), self.url[self.id].GetValue())
47
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
371 try: commands.pull(self.ui, self.r, self.url[self.id].GetValue(), rev='', update=False, force=True)
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
372 except: pass
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
373
52
c9694d854a61 Auto Update and Default repo now work, Ignore list is retained. Made attempts
sirebral
parents: 51
diff changeset
374 def SetDefault(self, event):
c9694d854a61 Auto Update and Default repo now work, Ignore list is retained. Made attempts
sirebral
parents: 51
diff changeset
375 self.id = self.defchecklist[event.GetEventObject()]
c9694d854a61 Auto Update and Default repo now work, Ignore list is retained. Made attempts
sirebral
parents: 51
diff changeset
376 self.manifest.SetString('updaterepo', 'default', self.uri[self.id])
c9694d854a61 Auto Update and Default repo now work, Ignore list is retained. Made attempts
sirebral
parents: 51
diff changeset
377 for all in self.defaultcheck:
c9694d854a61 Auto Update and Default repo now work, Ignore list is retained. Made attempts
sirebral
parents: 51
diff changeset
378 self.defaultcheck[all].SetValue(False)
c9694d854a61 Auto Update and Default repo now work, Ignore list is retained. Made attempts
sirebral
parents: 51
diff changeset
379 self.defaultcheck[self.id].SetValue(True)
c9694d854a61 Auto Update and Default repo now work, Ignore list is retained. Made attempts
sirebral
parents: 51
diff changeset
380
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
381 class Manifest(wx.Panel):
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
382 def __init__(self, parent):
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
383 wx.Panel.__init__(self, parent)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
384 self.ui = ui.ui()
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
385 self.repo = hg.repository(self.ui, ".")
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
386 self.c = self.repo.changectx('tip')
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
387 self.manifestlist = []
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
388 self.manifestlist = self.c.manifest().keys()
47
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
389 for mana in self.manifestlist: mana = os.sep + 'orpg' + os.sep + mana
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
390 self.manifestlist.sort()
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
391 self.SetBackgroundColour(wx.WHITE)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
392 self.sizer = wx.GridBagSizer(hgap=1, vgap=1)
36
683536732926 Update Manager 0.4. This is lookign really really nice now. OMG!!
sirebral
parents: 35
diff changeset
393 self.manifestlog = wx.CheckListBox( self, -1, wx.DefaultPosition, wx.DefaultSize, self.manifestlist,
683536732926 Update Manager 0.4. This is lookign really really nice now. OMG!!
sirebral
parents: 35
diff changeset
394 wx.LC_REPORT|wx.SUNKEN_BORDER|wx.EXPAND|wx.LC_HRULES)
47
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
395 filename = 'ignorelist.txt'
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
396 self.filename = orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + filename
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
397 orpg.tools.validate.Validate(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep).config_file(filename, "default_ignorelist.txt")
45
50e82d8090cf A few more commits. This gets Manifest working, Refresh should be working on
sirebral
parents: 44
diff changeset
398 self.mana = self.LoadDoc()
50e82d8090cf A few more commits. This gets Manifest working, Refresh should be working on
sirebral
parents: 44
diff changeset
399 self.manifestlog.Bind(wx.EVT_CHECKLISTBOX, self.GetChecked)
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
400 self.sizer.Add(self.manifestlog, (0,0), flag=wx.EXPAND)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
401 self.sizer.AddGrowableCol(0)
36
683536732926 Update Manager 0.4. This is lookign really really nice now. OMG!!
sirebral
parents: 35
diff changeset
402 self.sizer.AddGrowableRow(0)
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
403 self.SetSizer(self.sizer)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
404 self.SetAutoLayout(True)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
405
45
50e82d8090cf A few more commits. This gets Manifest working, Refresh should be working on
sirebral
parents: 44
diff changeset
406 def GetChecked(self, event):
50e82d8090cf A few more commits. This gets Manifest working, Refresh should be working on
sirebral
parents: 44
diff changeset
407 self.mana = []
47
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
408 for manifest in self.manifestlog.GetChecked(): self.mana.append(self.manifestlist[manifest])
45
50e82d8090cf A few more commits. This gets Manifest working, Refresh should be working on
sirebral
parents: 44
diff changeset
409 self.SaveDoc()
50e82d8090cf A few more commits. This gets Manifest working, Refresh should be working on
sirebral
parents: 44
diff changeset
410
50e82d8090cf A few more commits. This gets Manifest working, Refresh should be working on
sirebral
parents: 44
diff changeset
411 def SaveDoc(self):
50e82d8090cf A few more commits. This gets Manifest working, Refresh should be working on
sirebral
parents: 44
diff changeset
412 f = open(self.filename, "w")
47
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
413 for mana in self.mana: f.write(mana+'\n')
45
50e82d8090cf A few more commits. This gets Manifest working, Refresh should be working on
sirebral
parents: 44
diff changeset
414 f.close()
50e82d8090cf A few more commits. This gets Manifest working, Refresh should be working on
sirebral
parents: 44
diff changeset
415
50e82d8090cf A few more commits. This gets Manifest working, Refresh should be working on
sirebral
parents: 44
diff changeset
416 def LoadDoc(self):
50e82d8090cf A few more commits. This gets Manifest working, Refresh should be working on
sirebral
parents: 44
diff changeset
417 ignore = open(self.filename)
50e82d8090cf A few more commits. This gets Manifest working, Refresh should be working on
sirebral
parents: 44
diff changeset
418 ignorelist = []
47
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
419 for i in ignore: ignorelist.append(str(i [:len(i)-1]))
52
c9694d854a61 Auto Update and Default repo now work, Ignore list is retained. Made attempts
sirebral
parents: 51
diff changeset
420 for i in ignorelist: #Adds previously ignored files to manifestlistlog if they are not in changesets.
c9694d854a61 Auto Update and Default repo now work, Ignore list is retained. Made attempts
sirebral
parents: 51
diff changeset
421 if self.c.manifest().has_key(i): continue
49
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
422 else: self.manifestlist.append(i); self.manifestlist.sort()
45
50e82d8090cf A few more commits. This gets Manifest working, Refresh should be working on
sirebral
parents: 44
diff changeset
423 self.manifestlog.SetCheckedStrings(ignorelist)
47
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
424 manifest = ignore.readlines()
45
50e82d8090cf A few more commits. This gets Manifest working, Refresh should be working on
sirebral
parents: 44
diff changeset
425 ignore.close()
50e82d8090cf A few more commits. This gets Manifest working, Refresh should be working on
sirebral
parents: 44
diff changeset
426
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
427 class Control(wx.Panel):
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
428 def __init__(self, parent):
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
429 wx.Panel.__init__(self, parent)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
430
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
431
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
432 class updaterFrame(wx.Frame):
49
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
433 def __init__(self, parent, title, openrpg, manifest, main):
47
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
434 wx.Frame.__init__(self, None, wx.ID_ANY, title, size=(700,480),
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
435 style=wx.FRAME_NO_TASKBAR | wx.STAY_ON_TOP | wx.DEFAULT_FRAME_STYLE)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
436 self.CenterOnScreen()
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
437
49
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
438 self.main = main
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
439 ####### Panel Stuff ######
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
440 p = wx.Panel(self)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
441 nb = wx.Notebook(p)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
442
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
443 # create the page windows as children of the notebook
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
444 page1 = Updater(nb, openrpg, manifest)
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
445 page2 = Repos(nb, openrpg, manifest)
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
446 page3 = Manifest(nb)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
447 page4 = Control(nb)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
448
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
449 # add the pages to the notebook with the label to show on the tab
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
450 nb.AddPage(page1, "Updater")
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
451 nb.AddPage(page2, "Repos")
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
452 nb.AddPage(page3, "Manifest")
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
453 nb.AddPage(page4, "Control")
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
454
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
455 # finally, put the notebook in a sizer for the panel to manage
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
456 # the layout
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
457 sizer = wx.BoxSizer()
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
458 sizer.Add(nb, 1, wx.EXPAND)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
459 p.SetSizer(sizer)
49
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
460 self.Bind(wx.EVT_CLOSE, self.OnClose)
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
461
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
462 def OnClose(self, event):
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
463 if self.main == False: self.Destroy()
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
464 if self.main == True: self.Hide() #self.Hide()
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
465 #continue
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
466
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
467 class updateApp(wx.App):
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
468 def OnInit(self):
49
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
469 self.open_rpg = open_rpg
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
470 self.main = False
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
471 self.log = orpg.tools.orpg_log.orpgLog(orpg.dirpath.dir_struct["user"] + "runlogs/")
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
472 self.log.setLogToConsol(False)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
473 self.log.log("Updater Start", ORPG_NOTE)
34
8b630fc8a343 Updated the Update Manager to 0.3. Settings are being created with a clone
sirebral
parents: 33
diff changeset
474 self.manifest = manifest.ManifestChanges()
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
475 self.open_rpg.add_component("log", self.log)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
476 self.open_rpg.add_component("xml", orpg.orpg_xml)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
477 self.open_rpg.add_component("dir_struct", orpg.dirpath.dir_struct)
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
478 self.validate = orpg.tools.validate.Validate()
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
479 self.open_rpg.add_component("validate", self.validate)
49
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
480 self.updater = updaterFrame(self, "OpenRPG Update Manager Beta 0.6.7", self.open_rpg, self.manifest, self.main)
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
481 if self.manifest.GetString("updatemana", "auto_update", "") == 'on' and self.main == False:
47
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
482 self.AutoUpdate(); self.OnExit()
49
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
483 else: pass
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
484 if self.manifest.GetString('updatemana', 'no_update', '') == 'on' and self.main == False:
51
14d4270d5e5d Fixed Auto Update not finding current branch, no pull associated yet!
sirebral
parents: 49
diff changeset
485 self.OnExit()
49
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
486 else: pass
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
487 try:
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
488 self.updater.Show()
49
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
489 #self.SetTopWindow(self.updater)
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
490 self.updater.Fit()
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
491 except: pass
47
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
492 return True
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
493
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
494 def AutoUpdate(self):
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
495 self.ui = ui.ui()
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
496 self.repo = hg.repository(self.ui, ".")
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
497 self.c = self.repo.changectx('tip')
51
14d4270d5e5d Fixed Auto Update not finding current branch, no pull associated yet!
sirebral
parents: 49
diff changeset
498 self.current = self.repo.dirstate.branch()
54
5d89a6eaf492 WinXP seems to have lost some boxes unless the screen is resized. Weird.
sirebral
parents: 52
diff changeset
499
52
c9694d854a61 Auto Update and Default repo now work, Ignore list is retained. Made attempts
sirebral
parents: 51
diff changeset
500 capture = self.manifest.GetString('updaterepo', 'default', '')
54
5d89a6eaf492 WinXP seems to have lost some boxes unless the screen is resized. Weird.
sirebral
parents: 52
diff changeset
501 if capture != '':
5d89a6eaf492 WinXP seems to have lost some boxes unless the screen is resized. Weird.
sirebral
parents: 52
diff changeset
502 commands.pull(self.ui, self.repo, capture, rev='', update=False, force=True)
5d89a6eaf492 WinXP seems to have lost some boxes unless the screen is resized. Weird.
sirebral
parents: 52
diff changeset
503 filename = 'ignorelist.txt'
5d89a6eaf492 WinXP seems to have lost some boxes unless the screen is resized. Weird.
sirebral
parents: 52
diff changeset
504 self.filename = orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + filename
5d89a6eaf492 WinXP seems to have lost some boxes unless the screen is resized. Weird.
sirebral
parents: 52
diff changeset
505 orpg.tools.validate.Validate(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep).config_file(filename, "default_ignorelist.txt")
5d89a6eaf492 WinXP seems to have lost some boxes unless the screen is resized. Weird.
sirebral
parents: 52
diff changeset
506 self.mana = self.LoadDoc()
5d89a6eaf492 WinXP seems to have lost some boxes unless the screen is resized. Weird.
sirebral
parents: 52
diff changeset
507 for ignore in self.ignorelist: #Checked or not, if it is here, it is ignored.
5d89a6eaf492 WinXP seems to have lost some boxes unless the screen is resized. Weird.
sirebral
parents: 52
diff changeset
508 try: shutil.copy(ignore, orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep)
5d89a6eaf492 WinXP seems to have lost some boxes unless the screen is resized. Weird.
sirebral
parents: 52
diff changeset
509 except: pass
5d89a6eaf492 WinXP seems to have lost some boxes unless the screen is resized. Weird.
sirebral
parents: 52
diff changeset
510 hg.clean(self.repo, self.current)
5d89a6eaf492 WinXP seems to have lost some boxes unless the screen is resized. Weird.
sirebral
parents: 52
diff changeset
511 for ignore in self.ignorelist:
5d89a6eaf492 WinXP seems to have lost some boxes unless the screen is resized. Weird.
sirebral
parents: 52
diff changeset
512 try: shutil.copyfile(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep + ignore.split('/')[len(ignore.split('/')) - 1], ignore)
5d89a6eaf492 WinXP seems to have lost some boxes unless the screen is resized. Weird.
sirebral
parents: 52
diff changeset
513 except: pass
5d89a6eaf492 WinXP seems to have lost some boxes unless the screen is resized. Weird.
sirebral
parents: 52
diff changeset
514 try: os.remove(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep + ignore.split('/')[len(ignore.split('/')) - 1])
5d89a6eaf492 WinXP seems to have lost some boxes unless the screen is resized. Weird.
sirebral
parents: 52
diff changeset
515 except: pass
5d89a6eaf492 WinXP seems to have lost some boxes unless the screen is resized. Weird.
sirebral
parents: 52
diff changeset
516 else: print 'No default repository set, skipping Auto Update!'
47
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
517
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
518 def LoadDoc(self):
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
519 ignore = open(self.filename)
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
520 self.ignorelist = []
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
521 for i in ignore: self.ignorelist.append(str(i [:len(i)-1]))
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
522 manifest = ignore.readlines()
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
523 ignore.close()
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
524
46
599f727e3833 Getting ready to test!! Main functions seem to be working.
sirebral
parents: 45
diff changeset
525 def OnExit(self):
47
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
526 imported = ['manifest', 'orpg.dirpath', 'orpg.orpgCore', 'orpg.orpg_version', 'orpg.tools.orpg_log', 'orpg.tools.orpg_log', 'orpg.orpg_xml', 'orpg.dirpath', 'orpg.dirpath', 'orpg.tools.validate', 'mercurial.ui', 'mercurial.hg', 'mercurial.commands', 'mercurial.repo', 'mercurial.revlog', 'mercurial.cmdutil', 'shutil']
33
3687514e0218 I actally forgot the Update Manager's new package. Sorry.
sirebral
parents:
diff changeset
527 for name in imported:
47
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
528 if name in sys.modules: del sys.modules[name]
49
b41ea7d28a9e Final testing! Moving to a WinXP platform for final testing before stable.
sirebral
parents: 48
diff changeset
529
47
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
530 try: self.updater.Destroy()
52f6a38f8885 Update Manager 0.6.7 (Initial Release). Getting ready to implement it now.
sirebral
parents: 46
diff changeset
531 except: pass