28
|
1 import wx, sys, os #just .sep maybe
|
|
2 from manifest import manifest
|
14
|
3 import shutil
|
18
|
4
|
|
5 from orpg.orpgCore import component
|
28
|
6 from orpg.dirpath import dir_struct
|
18
|
7 from orpg.tools.orpg_log import logger, crash
|
28
|
8 from upmana.validate import validate
|
|
9 from orpg.dirpath import dir_struct
|
17
|
10 from mercurial import ui, hg, commands, repo, revlog, cmdutil, util
|
14
|
11
|
28
|
12 class Term2Win(object):
|
|
13 # A stdout redirector. Allows the messages from Mercurial to be seen in the Install Window
|
|
14 def write(self, text):
|
31
|
15 self.closed = sys.__stdout__.closed
|
|
16 self.flush = sys.__stdout__.flush
|
|
17 statbar.SetStatusText(text.replace('\n', ''))
|
28
|
18 sys.__stdout__.write(text)
|
14
|
19
|
|
20 class Updater(wx.Panel):
|
28
|
21 def __init__(self, parent, component):
|
14
|
22 wx.Panel.__init__(self, parent)
|
28
|
23 ### Status Bar ###
|
|
24 #statbar.SetStatusText('Select a Package and Update')
|
31
|
25 #statbar.SetStatusText('New Status Bar')
|
|
26
|
|
27 self.timer = wx.Timer(self, 1)
|
|
28 self.count = 0
|
14
|
29
|
|
30 ### Update Manager
|
|
31 self.ui = ui.ui()
|
|
32 self.repo = hg.repository(self.ui, ".")
|
|
33 self.c = self.repo.changectx('tip')
|
18
|
34 self.parent = parent
|
28
|
35 self.SetBackgroundColour(wx.WHITE)
|
14
|
36 self.sizer = wx.GridBagSizer(hgap=1, vgap=1)
|
28
|
37 self.changelog = wx.TextCtrl(self, wx.ID_ANY, size=(300, -1),
|
|
38 style=wx.TE_MULTILINE | wx.TE_READONLY)
|
|
39 self.filelist = wx.TextCtrl(self, wx.ID_ANY, size=(275, 300),
|
|
40 style=wx.TE_MULTILINE | wx.TE_READONLY)
|
|
41 self.buttons = {}
|
|
42 self.buttons['progress_bar'] = wx.Gauge(self, wx.ID_ANY, 100)
|
|
43 self.buttons['auto_text'] = wx.StaticText(self, wx.ID_ANY, "Auto Update")
|
14
|
44 self.buttons['auto_check'] = wx.CheckBox(self, wx.ID_ANY)
|
28
|
45 self.buttons['no_text'] = wx.StaticText(self, wx.ID_ANY, "No Update")
|
14
|
46 self.buttons['no_check'] = wx.CheckBox(self, wx.ID_ANY)
|
28
|
47 self.buttons['advanced'] = wx.Button(self, wx.ID_ANY, "Package Select")
|
|
48 self.buttons['update'] = wx.Button(self, wx.ID_ANY, "Update Now")
|
14
|
49 self.buttons['finish'] = wx.Button(self, wx.ID_ANY, "Finish")
|
|
50
|
31
|
51 self.sizer.Add(self.changelog, (0,0), span=(5,1), flag=wx.EXPAND)
|
14
|
52 self.sizer.Add(self.filelist, (0,1), span=(1,3), flag=wx.EXPAND)
|
28
|
53
|
14
|
54 self.sizer.Add(self.buttons['progress_bar'], (1,1), span=(1,3), flag=wx.EXPAND)
|
28
|
55 self.sizer.Add(self.buttons['auto_text'], (2,1))
|
14
|
56 self.sizer.Add(self.buttons['auto_check'], (2,2), flag=wx.EXPAND)
|
28
|
57 self.sizer.Add(self.buttons['no_text'], (3,1))
|
14
|
58 self.sizer.Add(self.buttons['no_check'], (3,2), flag=wx.EXPAND)
|
28
|
59 self.sizer.Add(self.buttons['advanced'], (2,3), flag=wx.EXPAND)
|
|
60 self.sizer.Add(self.buttons['update'], (3,3), flag=wx.EXPAND)
|
14
|
61 self.sizer.Add(self.buttons['finish'], (4,3), flag=wx.EXPAND)
|
31
|
62 self.buttons['progress_bar'].SetValue(100)
|
28
|
63 self.sizer.AddGrowableCol(0)
|
|
64 self.sizer.AddGrowableRow(0)
|
|
65 self.SetSizer(self.sizer)
|
14
|
66 self.SetAutoLayout(True)
|
|
67 self.get_package
|
|
68
|
|
69 self.current = self.repo.dirstate.branch()
|
|
70 self.BranchInfo(self.current)
|
|
71
|
28
|
72 if manifest.GetString("updatemana", "no_update", "") == 'on': self.buttons['no_check'].SetValue(True)
|
|
73 else: self.buttons['no_check'].SetValue(False)
|
|
74 if manifest.GetString("updatemana", "auto_update", "") == 'on': self.buttons['auto_check'].SetValue(True)
|
|
75 else: self.buttons['auto_check'].SetValue(False)
|
|
76
|
|
77 ## Event Handlers
|
|
78 self.Bind(wx.EVT_BUTTON, self.Update, self.buttons['update'])
|
|
79 self.Bind(wx.EVT_BUTTON, self.Finish, self.buttons['finish'])
|
|
80 self.Bind(wx.EVT_BUTTON, self.ChooseBranch, self.buttons['advanced'])
|
14
|
81 self.Bind(wx.EVT_CHECKBOX, self.ToggleAutoUpdate, self.buttons['auto_check'])
|
|
82 self.Bind(wx.EVT_CHECKBOX, self.ToggleNoUpdate, self.buttons['no_check'])
|
31
|
83 self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer)
|
|
84
|
|
85 def OnTimer(self, event):
|
|
86 statbar.SetStatusText('Checking For Updates')
|
|
87 self.count = self.count + 1
|
|
88 self.buttons['progress_bar'].SetValue(self.count)
|
|
89 if self.count == 100:
|
|
90 self.timer.Stop()
|
|
91 statbar.SetStatusText('No Updates Available')
|
|
92
|
|
93 def UpdateCheck(self):
|
|
94 self.timer.Start(100)
|
|
95 self.count = 3
|
|
96 self.buttons['progress_bar'].SetValue(3)
|
|
97 try:
|
|
98 doUpdate = commands.incoming(self.ui, self.repo,
|
|
99 manifest.GetString('default', 'repo', ''),
|
|
100 force=True, bundle=False)
|
|
101 if doUpdate:
|
|
102 statbar.SetStatusText('No Updates Available')
|
|
103 self.buttons['progress_bar'].SetValue(100)
|
|
104 self.timer.Stop()
|
|
105 else:
|
|
106 statbar.SetStatusText('Refresh Repo For Updated Source')
|
|
107 self.buttons['progress_bar'].SetValue(100)
|
|
108 self.timer.Stop()
|
|
109 except:
|
|
110 statbar.SetStatusText('No Connection Found')
|
|
111 self.buttons['progress_bar'].SetValue(100)
|
|
112 self.timer.Stop()
|
|
113
|
14
|
114
|
28
|
115 def ToggleAutoUpdate(self, event):
|
14
|
116 if self.buttons['auto_check'].GetValue() == True:
|
|
117 if self.buttons['no_check'].GetValue() == True:
|
|
118 self.buttons['no_check'].SetValue(False)
|
28
|
119 manifest.SetString("updatemana", "no_update", "off")
|
|
120 manifest.SetString("updatemana", "auto_update", "on")
|
|
121 else: manifest.SetString("updatemana", "auto_update", "off")
|
14
|
122
|
28
|
123 def ToggleNoUpdate(self, event):
|
14
|
124 if self.buttons['no_check'].GetValue() == True:
|
|
125 if self.buttons['auto_check'].GetValue() == True:
|
|
126 self.buttons['auto_check'].SetValue(False)
|
28
|
127 manifest.SetString("updatemana", "auto_update", "off")
|
|
128 manifest.SetString("updatemana", "no_update", "on")
|
|
129 else: manifest.SetString("updatemana", "no_update", "off")
|
|
130
|
14
|
131 def Update(self, evt=None):
|
|
132 self.ui = ui.ui()
|
|
133 self.repo = hg.repository(self.ui, ".")
|
|
134 self.c = self.repo.changectx('tip')
|
|
135 filename = 'ignorelist.txt'
|
18
|
136 self.filename = dir_struct["home"] + 'upmana' + os.sep + filename
|
|
137 component.get('validate').config_file(filename, "default_ignorelist.txt")
|
14
|
138 self.mana = self.LoadDoc()
|
18
|
139 temp = dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep
|
14
|
140 for ignore in self.ignorelist:
|
28
|
141 if len(ignore.split('/')) > 1:
|
|
142 gets = 0; dir1 = ''
|
|
143 while gets != len(ignore.split('/'))-1:
|
|
144 dir1 += ignore.split('/')[gets] + os.sep
|
|
145 gets += 1
|
|
146 os.makedirs(temp+dir1)
|
|
147 shutil.copy(ignore, temp + dir1 + ignore.split('/')[len(ignore.split('/')) - 1])
|
14
|
148 hg.clean(self.repo, self.current)
|
|
149 for ignore in self.ignorelist:
|
18
|
150 shutil.copyfile(temp + ignore.split('/')[len(ignore.split('/')) - 1], ignore)
|
|
151 os.remove(temp + ignore.split('/')[len(ignore.split('/')) - 1])
|
28
|
152 if len(ignore.split('/')) > 1:
|
|
153 gets = 0; dir1 = ''
|
|
154 while gets != len(ignore.split('/'))-1:
|
|
155 dir1 += ignore.split('/')[gets] + os.sep
|
|
156 gets += 1
|
|
157 os.removedirs(temp+dir1)
|
14
|
158
|
|
159 def LoadDoc(self):
|
31
|
160 manifest = open(self.filename)
|
14
|
161 self.ignorelist = []
|
31
|
162 ignore = manifest.readlines()
|
|
163 for i in ignore: print i; self.ignorelist.append(str(i[:len(i)-1]))
|
|
164 manifest.close()
|
28
|
165
|
|
166 def Finish(self, evt=None):
|
|
167 component.get('upmana-win').OnClose(None)
|
|
168
|
14
|
169 def ChooseBranch(self, evt=None):
|
28
|
170 dlg = wx.Dialog(self, wx.ID_ANY, "Package Selector", style=wx.DEFAULT_DIALOG_STYLE)
|
|
171 if wx.Platform == '__WXMSW__': icon = wx.Icon(dir_struct["icon"]+'d20.ico', wx.BITMAP_TYPE_ICO)
|
|
172 else: icon = wx.Icon(dir_struct["icon"]+"d20.xpm", wx.BITMAP_TYPE_XPM )
|
14
|
173 dlg.SetIcon(icon)
|
|
174
|
|
175 self.ui = ui.ui()
|
|
176 self.repo = hg.repository(self.ui, ".")
|
28
|
177 self.c = self.repo.changectx('tip')
|
|
178
|
14
|
179 dlgsizer = wx.GridBagSizer(hgap=1, vgap=1)
|
28
|
180 Yes = wx.Button( dlg, wx.ID_OK, "Ok" )
|
|
181 Yes.SetDefault()
|
|
182 rgroup = wx.RadioButton(dlg, wx.ID_ANY, "group_start", style=wx.RB_GROUP)
|
|
183 rgroup.Hide()
|
|
184
|
14
|
185 self.get_packages()
|
|
186 if self.package_list == None: return
|
28
|
187 types = self.package_list
|
|
188 row=0; col=0
|
14
|
189 self.current = self.repo.dirstate.branch()
|
|
190 self.package_type = self.current
|
|
191 self.btnlist = {}; self.btn = {}
|
|
192 self.id = 1
|
|
193
|
28
|
194 for t in types:
|
|
195 self.btnName = str(t)
|
|
196 self.btn[self.id] = wx.RadioButton(dlg, wx.ID_ANY, str(t), name=self.btnName)
|
14
|
197 if self.btnName == self.current: self.btn[self.id].SetValue(True)
|
|
198 self.btnlist[self.id] = self.btnName
|
28
|
199 dlgsizer.Add(self.btn[self.id], (row, col))
|
14
|
200 col += 1; self.id += 1
|
|
201 if col == 3: row += 1; col = 0
|
28
|
202
|
14
|
203 dlgsizer.Add(Yes, (row+1,col/2))
|
|
204 dlgsizer.AddGrowableCol(0)
|
|
205 dlgsizer.AddGrowableRow(0)
|
28
|
206 dlg.SetAutoLayout( True )
|
14
|
207 dlg.SetSizer( dlgsizer )
|
28
|
208 dlgsizer.Fit( dlg )
|
|
209 dlg.Centre()
|
|
210 dlg.Bind(wx.EVT_RADIOBUTTON, self.PackageSet)
|
|
211 if dlg.ShowModal(): dlg.Destroy()
|
|
212
|
14
|
213 def PackageSet(self, event):
|
|
214 for btn in self.btn:
|
|
215 if self.btn[btn].GetValue() == True: self.current = self.btnlist[btn]
|
|
216
|
|
217 branches = self.repo.branchtags()
|
|
218 heads = dict.fromkeys(self.repo.heads(), 1)
|
|
219 l = [((n in heads), self.repo.changelog.rev(n), n, t) for t, n in branches.items()]
|
|
220
|
|
221 if self.current != type:
|
|
222 heads = dict.fromkeys(self.repo.heads(), self.repo.branchtags())
|
|
223 branches = dict.copy(self.repo.branchtags())
|
|
224 self.BranchInfo(self.current)
|
|
225
|
|
226 def BranchInfo(self, branch):
|
17
|
227 cs = self.repo.changectx( self.current ).changeset()
|
14
|
228 self.changelog.SetValue('')
|
17
|
229 changelog = cs[4]
|
14
|
230 self.changelog.AppendText(changelog + '\n')
|
17
|
231 self.filelist.SetValue('')
|
18
|
232 self.filelist.AppendText("Currently selected branch: " + branch + "\n\nAuthor: "+cs[1]+"\n\n")
|
|
233 self.filelist.AppendText("Files Modified (in update): \n")
|
17
|
234 for f in cs[3]: self.filelist.AppendText(f+"\n")
|
28
|
235
|
14
|
236 def get_packages(self, type=None):
|
|
237 #Fixed and ready for Test. Can be cleaner
|
|
238 self.package_list = []
|
|
239 b = self.repo.branchtags()
|
17
|
240 heads = dict.fromkeys(self.repo.heads(), 1) #The code below looks superfluous but there is good info inside
|
14
|
241 l = [((n in heads), self.repo.changelog.rev(n), n, t) for t, n in b.items()]
|
|
242 l.sort()
|
|
243 l.reverse()
|
|
244 for ishead, r, n, t in l: self.package_list.append(t)
|
28
|
245
|
14
|
246 def get_package(self):
|
28
|
247 self.get_packages()
|
14
|
248 if self.package_list == None: return None
|
28
|
249 return None
|
14
|
250
|
|
251 class Repos(wx.Panel):
|
28
|
252 def __init__(self, parent, openrpg):
|
14
|
253 wx.Panel.__init__(self, parent)
|
28
|
254 ### Status Bar ###
|
|
255 #statbar.SetStatusText('Add, Delete, or Refresh your source Tracs')
|
|
256 statbar.SetStatusText('New Status Bar')
|
14
|
257 ### Update Manager
|
|
258 self.ui = ui.ui()
|
|
259 self.r = hg.repository(self.ui, ".")
|
|
260 self.c = self.r.changectx('tip')
|
|
261
|
|
262 #mainpanel = self
|
|
263 self.openrpg = openrpg
|
|
264 self.buttons = {}
|
|
265 self.texts = {}
|
|
266
|
|
267 ## Section Sizers (with frame edges and text captions)
|
|
268 self.box_sizers = {}
|
|
269 self.box_sizers["newbutton"] = wx.StaticBox(self, -1)
|
|
270
|
|
271 ## Layout Sizers
|
|
272 self.sizers = {}
|
|
273 self.sizers["main"] = wx.GridBagSizer(hgap=2, vgap=2)
|
|
274 self.sizers["button"] = wx.GridBagSizer(hgap=2, vgap=2)
|
|
275
|
|
276 #Button Layout
|
|
277 self.sizers["newbutton"] = wx.StaticBoxSizer(self.box_sizers["newbutton"], wx.VERTICAL)
|
|
278 self.sizers["newrepo_layout"] = wx.FlexGridSizer(rows=1, cols=2, hgap=2, vgap=5)
|
|
279 empty = wx.StaticText(self, -1, "")
|
|
280 reponame = wx.StaticText(self, -1, "Name:")
|
|
281 self.texts["reponame"] = wx.TextCtrl(self, -1, '')
|
|
282 self.buttons['addrepo'] = wx.Button(self, wx.ID_NEW)
|
|
283
|
|
284 ##Build Button
|
|
285 self.sizers["newrepo_layout"].Add(self.buttons['addrepo'], -1, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
|
|
286 self.sizers["newrepo_layout"].Add(empty, -1)
|
|
287 self.sizers["newrepo_layout"].Add(reponame, -1, wx.ALIGN_CENTER|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
|
|
288 self.sizers["newrepo_layout"].Add(self.texts["reponame"], -1, wx.EXPAND)
|
|
289 self.sizers["newrepo_layout"].AddGrowableCol(1)
|
|
290 self.sizers["newbutton"].Add(self.sizers["newrepo_layout"], -1, wx.EXPAND)
|
17
|
291
|
14
|
292 #Repo List Panel
|
|
293 self.repopanel = wx.ScrolledWindow(self)
|
|
294 self.repopanel.SetScrollbars(20,20,55,40)
|
|
295 self.repopanel.Scroll(50,10)
|
|
296 self.box_sizers["repolist"] = wx.StaticBox(self.repopanel, -1, "Current Repo List")
|
|
297 self.sizers["repolist"] = wx.StaticBoxSizer(self.box_sizers["repolist"], wx.VERTICAL)
|
|
298 self.sizers["repo"] = wx.GridBagSizer(hgap=2, vgap=2)
|
|
299 self.sizers["repolist_layout"] = wx.FlexGridSizer(rows=1, cols=1, hgap=2, vgap=5)
|
|
300
|
|
301 self.NewRepoList(None)
|
|
302 self.BuildRepoList(None)
|
|
303
|
|
304 self.sizers["repolist_layout"].AddGrowableCol(0)
|
|
305 self.sizers["repolist"].Add(self.sizers["repolist_layout"], -1, wx.EXPAND)
|
|
306 self.sizers["repo"].Add(self.sizers["repolist"], (0,0), flag=wx.EXPAND)
|
|
307 self.sizers["repo"].AddGrowableCol(0)
|
|
308 self.sizers['repo'].AddGrowableRow(0)
|
|
309 self.sizers['repo'].AddGrowableRow(1)
|
|
310 self.repopanel.SetSizer(self.sizers['repo'])
|
|
311 self.repopanel.SetAutoLayout(True)
|
|
312
|
|
313 #Build Main Sizer
|
|
314 self.sizers["main"].Add(self.sizers["newbutton"], (0,0), flag=wx.EXPAND)
|
|
315 self.sizers["main"].Add(self.repopanel, (1,0), flag=wx.EXPAND)
|
|
316 self.sizers["main"].AddGrowableCol(0)
|
|
317 self.sizers["main"].AddGrowableCol(1)
|
|
318 self.sizers["main"].AddGrowableRow(1)
|
|
319 self.SetSizer(self.sizers["main"])
|
|
320 self.SetAutoLayout(True)
|
28
|
321 #self.Fit()
|
14
|
322 self.Bind(wx.EVT_BUTTON, self.AddRepo, self.buttons['addrepo'])
|
|
323
|
|
324 def NewRepoList(self, event):
|
28
|
325 self.id = -1
|
|
326 self.box = {}; self.box_name= {}; self.main = {}; self.container = {}; self.layout = {}
|
14
|
327 self.name = {}; self.url = {}; self.url_list = {}; self.pull = {}; self.uri = {}; self.delete = {}
|
|
328 self.defaultcheck = {}; self.default = {}; self.repotrac = {}
|
28
|
329 self.pull_list = {}; self.delete_list = {}; self.defchecklist = {}; self.repolist = []
|
14
|
330
|
|
331 def BuildRepoList(self, event):
|
28
|
332 repolist = manifest.PluginChildren('updaterepo')
|
|
333 appendlist = []
|
|
334 for repo in repolist:
|
|
335 if repo not in self.repolist: appendlist.append(repo)
|
|
336 self.repolist = repolist
|
14
|
337
|
28
|
338 for repo in appendlist:
|
14
|
339 self.id += 1
|
|
340 #Build Constructs
|
|
341 self.box[self.id] = wx.StaticBox(self.repopanel, -1, str(repo))
|
|
342 self.main[self.id] = wx.GridBagSizer(hgap=2, vgap=2)
|
|
343 self.container[self.id] = wx.StaticBoxSizer(self.box[self.id], wx.VERTICAL)
|
|
344 self.layout[self.id] = wx.FlexGridSizer(rows=1, cols=4, hgap=2, vgap=5)
|
|
345 self.name[self.id] = wx.StaticText(self.repopanel, -1, 'URL')
|
28
|
346 self.uri[self.id] = manifest.GetString('updaterepo', repo, '')
|
|
347 #except: self.uri[self.id] = ''
|
14
|
348 self.url[self.id] = wx.TextCtrl(self.repopanel, -1, self.uri[self.id])
|
|
349 self.pull[self.id] = wx.Button(self.repopanel, wx.ID_REFRESH)
|
|
350 self.delete[self.id] = wx.Button(self.repopanel, wx.ID_DELETE)
|
|
351 self.delete_list[self.delete[self.id]] = self.id
|
|
352 self.defaultcheck[self.id] = wx.CheckBox(self.repopanel, -1)
|
|
353 self.default[self.id] = wx.StaticText(self.repopanel, -1, 'Default')
|
|
354 #Build Retraceables
|
|
355 self.box_name[self.id] = str(repo)
|
|
356 self.pull_list[self.pull[self.id]] = self.id
|
|
357 self.defchecklist[self.defaultcheck[self.id]] = self.id
|
|
358 #Build Layout
|
28
|
359 self.layout[self.id].Add(self.name[self.id],
|
|
360 -1, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
|
|
361 self.layout[self.id].Add(self.url[self.id],
|
|
362 -1, wx.EXPAND)
|
|
363 self.layout[self.id].Add(self.pull[self.id],
|
|
364 -1, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
|
14
|
365 self.layout[self.id].Add(self.delete[self.id], -1, wx.EXPAND)
|
28
|
366 self.layout[self.id].Add(self.defaultcheck[self.id],
|
|
367 -1, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
|
14
|
368 self.layout[self.id].Add(self.default[self.id], -1, wx.EXPAND)
|
|
369 self.layout[self.id].AddGrowableCol(1)
|
|
370 self.container[self.id].Add(self.layout[self.id], -1, wx.EXPAND)
|
|
371 #Button Events
|
|
372 self.Bind(wx.EVT_BUTTON, self.RefreshRepo, self.pull[self.id])
|
|
373 self.Bind(wx.EVT_BUTTON, self.DelRepo, self.delete[self.id])
|
|
374 self.Bind(wx.EVT_CHECKBOX, self.SetDefault, self.defaultcheck[self.id])
|
|
375 self.sizers["repolist_layout"].Insert(0, self.container[self.id], -1, wx.EXPAND)
|
|
376 self.sizers['repolist_layout'].Layout()
|
28
|
377 self.Layout()
|
14
|
378
|
|
379 #Set Default Repo Button
|
28
|
380 capture = manifest.GetString('default', 'repo', '')
|
14
|
381 if capture != '':
|
|
382 for caught in self.uri:
|
|
383 if capture == self.uri[caught]: self.id = caught; pass
|
|
384 else: continue
|
|
385 self.defaultcheck[self.id].SetValue(True)
|
|
386
|
|
387 def AddRepo(self, event):
|
|
388 repo = self.texts['reponame'].GetValue(); repo = repo.replace(' ', '_'); repo = 'repo-' + repo
|
28
|
389 manifest.SetString('updaterepo', repo, '')
|
14
|
390 self.BuildRepoList(None)
|
|
391
|
|
392 def DelRepo(self, event):
|
|
393 self.id = self.delete_list[event.GetEventObject()]
|
|
394 self.sizers["repolist_layout"].Hide(self.container[self.id])
|
28
|
395 manifest.DelString('updaterepo', self.box_name[self.id])
|
14
|
396 try: del self.box_name[self.id]
|
|
397 except: pass
|
|
398 self.sizers['repolist_layout'].Layout()
|
28
|
399 self.repolist = manifest.PluginChildren('updaterepo')
|
14
|
400
|
|
401 def RefreshRepo(self, event):
|
|
402 self.id = self.pull_list[event.GetEventObject()]
|
28
|
403 manifest.SetString('updaterepo', str(self.box_name[self.id]), self.url[self.id].GetValue())
|
14
|
404 try: commands.pull(self.ui, self.r, self.url[self.id].GetValue(), rev='', update=False, force=True)
|
|
405 except: pass
|
|
406
|
|
407 def SetDefault(self, event):
|
|
408 self.id = self.defchecklist[event.GetEventObject()]
|
28
|
409 manifest.SetString('default', 'repo', self.uri[self.id])
|
14
|
410 for all in self.defaultcheck:
|
|
411 self.defaultcheck[all].SetValue(False)
|
|
412 self.defaultcheck[self.id].SetValue(True)
|
|
413
|
|
414 class Manifest(wx.Panel):
|
|
415 def __init__(self, parent):
|
|
416 wx.Panel.__init__(self, parent)
|
28
|
417 ### Status Bar ###
|
|
418 #statbar.SetStatusText('Create an Ignore List')
|
|
419 statbar.SetStatusText('New Status Bar')
|
14
|
420 self.ui = ui.ui()
|
|
421 self.repo = hg.repository(self.ui, ".")
|
|
422 self.c = self.repo.changectx('tip')
|
|
423 self.manifestlist = []
|
|
424 self.manifestlist = self.c.manifest().keys()
|
|
425 for mana in self.manifestlist: mana = os.sep + 'orpg' + os.sep + mana
|
|
426 self.manifestlist.sort()
|
28
|
427 self.SetBackgroundColour(wx.WHITE)
|
14
|
428 self.sizer = wx.GridBagSizer(hgap=1, vgap=1)
|
18
|
429 self.manifestlog = wx.CheckListBox( self, -1, wx.DefaultPosition, wx.DefaultSize,
|
|
430 self.manifestlist, wx.LC_REPORT|wx.SUNKEN_BORDER|wx.EXPAND|wx.LC_HRULES)
|
14
|
431 filename = 'ignorelist.txt'
|
18
|
432 self.filename = dir_struct["home"] + 'upmana' + os.sep + filename
|
|
433 component.get('validate').config_file(filename, "default_ignorelist.txt")
|
14
|
434 self.mana = self.LoadDoc()
|
|
435 self.manifestlog.Bind(wx.EVT_CHECKLISTBOX, self.GetChecked)
|
|
436 self.sizer.Add(self.manifestlog, (0,0), flag=wx.EXPAND)
|
28
|
437 self.sizer.AddGrowableCol(0)
|
14
|
438 self.sizer.AddGrowableRow(0)
|
28
|
439 self.SetSizer(self.sizer)
|
14
|
440 self.SetAutoLayout(True)
|
|
441
|
|
442 def GetChecked(self, event):
|
|
443 self.mana = []
|
|
444 for manifest in self.manifestlog.GetChecked(): self.mana.append(self.manifestlist[manifest])
|
|
445 self.SaveDoc()
|
|
446
|
|
447 def SaveDoc(self):
|
|
448 f = open(self.filename, "w")
|
|
449 for mana in self.mana: f.write(mana+'\n')
|
|
450 f.close()
|
|
451
|
|
452 def LoadDoc(self):
|
|
453 ignore = open(self.filename)
|
|
454 ignorelist = []
|
|
455 for i in ignore: ignorelist.append(str(i [:len(i)-1]))
|
|
456 for i in ignorelist: #Adds previously ignored files to manifestlistlog if they are not in changesets.
|
|
457 if self.c.manifest().has_key(i): continue
|
|
458 else: self.manifestlist.append(i); self.manifestlist.sort()
|
17
|
459 self.manifestlog = wx.CheckListBox( self, -1, wx.DefaultPosition, wx.DefaultSize, self.manifestlist,
|
|
460 wx.LC_REPORT|wx.SUNKEN_BORDER|wx.EXPAND|wx.LC_HRULES)
|
14
|
461 self.manifestlog.SetCheckedStrings(ignorelist)
|
|
462 manifest = ignore.readlines()
|
|
463 ignore.close()
|
|
464
|
|
465 class Control(wx.Panel):
|
|
466 def __init__(self, parent):
|
|
467 wx.Panel.__init__(self, parent)
|
28
|
468 ### Status Bar ###
|
|
469 #statbar.SetStatusText('Advanced Controls & Rollback')
|
|
470 statbar.SetStatusText('New Status Bar')
|
18
|
471 ### Control Panel
|
|
472 self.ui = ui.ui()
|
|
473 self.repo = hg.repository(self.ui, ".")
|
|
474 self.c = self.repo.changectx('tip')
|
28
|
475 self.parent = parent
|
18
|
476 #logger.debug("Enter updaterFrame") #Need to set logging level
|
|
477
|
|
478 self.get_packages()
|
28
|
479 self.SetBackgroundColour(wx.WHITE)
|
18
|
480 self.sizer = wx.GridBagSizer(hgap=1, vgap=1)
|
|
481 self.buttons = {}
|
28
|
482
|
18
|
483 ## Changelog / File List
|
|
484 changelogcp = wx.Panel(self)
|
|
485 self.changelogcp = wx.GridBagSizer(hgap=1, vgap=1)
|
|
486 self.changelog = wx.TextCtrl(changelogcp, wx.ID_ANY, size=wx.DefaultSize, style=wx.TE_MULTILINE | wx.TE_READONLY)
|
|
487 self.filelist = wx.TextCtrl(changelogcp, wx.ID_ANY, size=wx.DefaultSize, style=wx.TE_MULTILINE | wx.TE_READONLY)
|
|
488 self.changelogcp.Add(self.changelog, (0,0), flag=wx.EXPAND)
|
|
489 self.changelogcp.Add(self.filelist, (1,0), flag=wx.EXPAND)
|
|
490 changelogcp.SetSizer(self.changelogcp)
|
|
491 self.changelogcp.AddGrowableCol(0)
|
|
492 self.changelogcp.AddGrowableRow(0)
|
|
493 self.changelogcp.AddGrowableRow(1)
|
|
494 changelogcp.SetAutoLayout(True)
|
|
495
|
|
496 ## Branches / Revisions
|
|
497 branchcp = wx.Panel(self)
|
27
|
498 self.current = self.repo.dirstate.branch()
|
18
|
499 self.branchcp = wx.GridBagSizer(hgap=1, vgap=1)
|
|
500 self.branches = wx.Choice(branchcp, wx.ID_ANY, choices=self.package_list)
|
27
|
501 self.branches.SetSelection(self.package_list.index(self.current))
|
18
|
502 self.branch_txt = wx.StaticText(branchcp, wx.ID_ANY, "Branches")
|
|
503 self.branchcp.Add(self.branches, (0,0))
|
|
504 self.branchcp.Add(self.branch_txt, (0,1), flag=wx.ALIGN_CENTER_VERTICAL)
|
|
505 branchcp.SetSizer(self.branchcp)
|
|
506 branchcp.SetAutoLayout(True)
|
|
507
|
|
508 revlistcp = wx.Panel(self)
|
|
509 self.revlistcp = wx.GridBagSizer(hgap=2, vgap=2)
|
|
510 self.revlist = wx.ListCtrl(revlistcp, -1, wx.DefaultPosition, size=wx.DefaultSize,
|
|
511 style=wx.LC_REPORT|wx.SUNKEN_BORDER|wx.LC_HRULES)
|
|
512 self.revlist.InsertColumn(0, 'Revs')
|
|
513 self.revlist.InsertColumn(1, 'Changeset')
|
|
514 self.revlist.SetColumnWidth(0, -1)
|
|
515 self.revlist.SetColumnWidth(1, -1)
|
|
516 self.revlist.Refresh()
|
|
517 self.revlistcp.Add(self.revlist, (0,0), flag=wx.EXPAND)
|
|
518 revlistcp.SetSizer(self.revlistcp)
|
|
519 self.revlistcp.AddGrowableCol(0)
|
|
520 self.revlistcp.AddGrowableRow(0)
|
|
521 self.revlistcp.AddGrowableRow(1)
|
|
522 revlistcp.SetAutoLayout(True)
|
|
523
|
|
524 ## Control Panel
|
|
525 cp = wx.Panel(self)
|
|
526 self.cp = wx.GridBagSizer(hgap=1, vgap=1)
|
|
527 self.buttons['update'] = wx.Button(cp, wx.ID_ANY, "Revision Update")
|
|
528 self.buttons['delete'] = wx.Button(cp, wx.ID_ANY, "Delete Branch")
|
28
|
529 self.cp.Add(self.buttons['update'], (0,0))
|
18
|
530 self.cp.Add(self.buttons['delete'], (0,1))
|
|
531 cp.SetSizer(self.cp)
|
|
532 cp.SetAutoLayout(True)
|
28
|
533
|
18
|
534 self.sizer.Add(changelogcp, (0,0), span=(3,1), flag=wx.EXPAND)
|
|
535 self.sizer.Add(branchcp, (0,1), span=(1,1))
|
|
536 self.sizer.Add(revlistcp, (2,1), span=(1,1), flag=wx.EXPAND)
|
28
|
537 self.sizer.Add(cp, (1,1), span=(1,1))
|
18
|
538
|
28
|
539 self.buttons['delete'].Disable()
|
18
|
540 self.sizer.AddGrowableCol(0)
|
28
|
541 self.sizer.AddGrowableCol(1)
|
|
542 self.sizer.AddGrowableRow(2)
|
|
543 self.SetSizer(self.sizer)
|
18
|
544 self.SetAutoLayout(True)
|
|
545
|
|
546 self.currev = self.repo.changelog.rev(self.repo.branchtags()[self.current])
|
|
547 self.RevInfo(self.currev)
|
|
548 self.revlist.Select(self.revlist.FindItem(0, str(self.currev), 1))
|
|
549 self.BranchInfo(self.current)
|
|
550 self.Bind(wx.EVT_CHOICE, self.PackageSet)
|
|
551 self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.RevSet)
|
|
552 self.Bind(wx.EVT_BUTTON, self.RevUpdate, self.buttons['update'])
|
28
|
553
|
|
554
|
18
|
555 def PackageSet(self, event):
|
|
556 self.current = self.branches.GetStringSelection()
|
|
557 branches = self.repo.branchtags()
|
|
558 heads = dict.fromkeys(self.repo.heads(), 1)
|
|
559 l = [((n in heads), self.repo.changelog.rev(n), n, t) for t, n in branches.items()]
|
|
560 if self.current != type:
|
|
561 heads = dict.fromkeys(self.repo.heads(), self.repo.branchtags())
|
|
562 branches = dict.copy(self.repo.branchtags())
|
|
563 self.BranchInfo(self.current)
|
|
564 self.RevInfo(self.current)
|
|
565
|
|
566 def RevSet(self, event):
|
|
567 self.currev = self.revlist.GetItemText( self.revlist.GetFirstSelected() )
|
|
568 i = event.GetIndex()
|
|
569 self.revlist.Select(i, True)
|
|
570 self.revlist.Focus(i)
|
22
|
571 self.BranchInfo(self.current)
|
18
|
572 if self.currev != self.revlist.GetItemText( self.revlist.GetFirstSelected() ):
|
|
573 self.RevInfo(self.currev)
|
|
574
|
|
575 def RevInfo(self, rev):
|
|
576 self.revlist.DeleteAllItems()
|
|
577 self.revlist_a = []; self.revlist_b = {}
|
|
578 for heads in self.repo.changelog.reachable(self.repo.branchtags()[self.current]):
|
|
579 self.revlist_a.append(str(self.repo.changelog.rev(heads)))
|
|
580 self.revlist_b[str(self.repo.changelog.rev(heads))] = str(self.repo.changectx(heads))
|
|
581 self.revlist_a.sort()
|
|
582 for i in self.revlist_a:
|
|
583 self.revlist.InsertStringItem(0, str(i), 0 )
|
|
584 self.revlist.SetStringItem(0, 1, self.revlist_b[i])
|
|
585 self.revlist.SetColumnWidth(0, -1)
|
|
586 self.revlist.SetColumnWidth(1, -1)
|
|
587 self.revlist.Refresh()
|
|
588 self.BranchInfo(self.current)
|
|
589
|
|
590 def BranchInfo(self, branch):
|
|
591 rs = self.repo.changectx( self.currev ).changeset()
|
|
592 self.changelog.SetValue('')
|
|
593 changelog = rs[4]
|
|
594 self.changelog.AppendText(changelog + '\n')
|
|
595 self.filelist.SetValue('')
|
|
596 self.filelist.AppendText("Currently selected branch: " + branch + "\n\nAuthor: "+rs[1]+"\n\n")
|
|
597 self.filelist.AppendText("Files Modified (in update): \n")
|
|
598 for f in rs[3]: self.filelist.AppendText(f+"\n")
|
|
599
|
|
600 def DelBranch(self, event):
|
|
601 pass
|
|
602
|
|
603 def RevUpdate(self, event):
|
27
|
604 dlg = wx.MessageDialog(None, 'Revision Updates are recommended for Developers only.\n\nAre you sure to preform a Revision Update?\n\nNewer builds tend to have less bugs while older revisions may no longer function properly.', 'Expert Feature', wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
|
|
605 if dlg.ShowModal() == wx.ID_YES:
|
|
606 dlg.Destroy()
|
|
607 filename = 'ignorelist.txt'
|
|
608 self.filename = dir_struct["home"] + 'upmana' + os.sep + filename
|
|
609 component.get('validate').config_file(filename, "default_ignorelist.txt")
|
|
610 self.mana = self.LoadDoc()
|
|
611 temp = dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep
|
|
612 for ignore in self.ignorelist:
|
|
613 shutil.copy(ignore, temp + ignore.split('/')[len(ignore.split('/')) - 1])
|
|
614 hg.clean(self.repo, self.currev)
|
|
615 for ignore in self.ignorelist:
|
|
616 shutil.copyfile(temp + ignore.split('/')[len(ignore.split('/')) - 1], ignore)
|
|
617 os.remove(temp + ignore.split('/')[len(ignore.split('/')) - 1])
|
|
618 else:
|
|
619 dlg.Destroy(); pass
|
18
|
620
|
|
621 def LoadDoc(self):
|
31
|
622 manifest = open(self.filename)
|
18
|
623 self.ignorelist = []
|
31
|
624 ignore = manifest.readlines()
|
|
625 for i in ignore: print i; self.ignorelist.append(str(i[:len(i)-1]))
|
|
626 manifest.close()
|
18
|
627
|
|
628 def get_packages(self, type=None):
|
28
|
629 #Can be cleaner
|
18
|
630 self.package_list = []
|
|
631 b = self.repo.branchtags()
|
|
632 heads = dict.fromkeys(self.repo.heads(), 1) #The code below looks superfluous but there is good info inside
|
|
633 l = [((n in heads), self.repo.changelog.rev(n), n, t) for t, n in b.items()]
|
|
634 l.sort()
|
|
635 l.reverse()
|
|
636 for ishead, r, n, t in l: self.package_list.append(t)
|
28
|
637
|
18
|
638 def get_package(self):
|
28
|
639 self.get_packages()
|
18
|
640 if self.package_list == None: return None
|
28
|
641 return None
|
|
642
|
|
643 class Help(wx.Panel):
|
|
644 def __init__(self, parent):
|
|
645 wx.Panel.__init__(self, parent)
|
|
646 sizer = wx.BoxSizer(wx.VERTICAL)
|
|
647 self.help = wx.TextCtrl(self, wx.ID_ANY, size=(-1, -1),
|
|
648 style=wx.TE_MULTILINE | wx.TE_READONLY)
|
|
649 sizer.Add(self.help, 1, wx.EXPAND)
|
|
650 self.build_help()
|
|
651 self.SetSizer(sizer)
|
|
652 self.Layout()
|
|
653
|
|
654 def build_help(self):
|
|
655 help = """'Traipse' OpenRPG Update Manager Help:
|
|
656 The Traipse Update Manager can be confusing at first glance. There is alot involved in the new addition so it is easy to by pass the finer details. This small page will help a new user understand how to use the new Update Manager to it's full capability.\n\n"""
|
|
657 self.help.AppendText(help)
|
|
658 help = """The Different Tabs: There are 5 different tabs available to users, and each tab has a different purpose. These five tabs are: Updater, Repos, Manifest, Control and Help.
|
|
659 ---
|
|
660
|
|
661 The Updater Tab:
|
|
662 The Updater tab is divided into three sections. The left section shows a description of the your current or selected version. The right top section shows the files that have been updated in your current or selected version. Underneath is a selection of buttons and check boxes.
|
|
663
|
|
664 Package Select:
|
|
665 When you press this button a small window pops up showing you the available packages to update too. You can select a package and the Updater's detail sections will reflect the change.
|
|
666
|
|
667 Update Now:
|
|
668 Press this button when you want to update to the selected package
|
|
669
|
|
670 Auto Update:
|
|
671 Check this if want to update when you start the software. You need to have a default Repository checked in the Repo tab.
|
|
672
|
|
673 No Update:
|
|
674 Check this if you do not want to see the Update Manager when you start the software.
|
|
675 ---\n\n"""
|
|
676 self.help.AppendText(help)
|
|
677 help = """The Repos Tab:
|
|
678 The Repos tab has two parts to it. The top most part is a section is where you name and create repositories. The second part shows you a list of all your available repositories.
|
|
679
|
|
680 What is a repostiory?
|
|
681 1: a place, room, or container where something is deposited or stored (Merriam-Webster). A repository, or repo for short, is a place to hold source code so others can download it.
|
|
682
|
|
683 Creating new Repos:
|
|
684 Creating a new repos is really easy. First you need to give your repo a name, any name will work, then press the New button. You will see that your named repo shows up in your list immediately.
|
|
685
|
|
686 You will then need to connect the named repo to a URL so you can download source code. Enter a URL (http://hg.assembla.com/traipse) into the new entry and press the Refresh button. This downloads the new source code to your computer only. Refreshing a repo does not update your software.
|
|
687
|
|
688 Default:
|
|
689 You can set any repo as your default repository. This is the repo the software will update from if you Auto Update.
|
|
690 ---\n\n"""
|
|
691 self.help.AppendText(help)
|
|
692 help = """The Manifest Tab:
|
|
693 The Manifest Tab is really easy to understand, it's just named differently. The manifest shows a list of all the files that are being tracked by your current package. Checking files in the list will place them into a list that prevents these files from being changed when you update to a new package.
|
|
694
|
|
695 The manifest can cause problems with compatibility if the newer source does not understand the unchanged files, so it would be smart to test out a new package in a different folder.
|
|
696 ---\n\n"""
|
|
697 self.help.AppendText(help)
|
|
698 help = """The Control Tab:
|
|
699 The control tab is recommended for developers only. The control tab contains the two details elements from the Updater tab and a new section that contains all of the revisions for your selected package.
|
|
700
|
|
701 You can select any of the available packages from the drop down and the list of revisions will change. You can also select any of the revisions in the list and the details on the left side will change to reflect the details of that revision.
|
|
702
|
|
703 You are also allowed to update to any of the selected revisions. Older revisions often times contain bugs and newer methods of coding, so revision updates commonly cause problems with software.
|
|
704
|
|
705 What is the Control Tab for?
|
|
706 The control tab is for developers who want to see how the source code has changed from revision to revision. When a user downloads the software they also download all past revisions made to that software. This tab allows users to roll back if a problem has been created with new source, or for developers they can watch the software evolve.
|
|
707 ---"""
|
|
708 self.help.AppendText(help)
|
|
709
|
|
710 class updaterFrame(wx.Frame):
|
14
|
711 def __init__(self, parent, title, openrpg, manifest, main):
|
17
|
712
|
28
|
713 wx.Frame.__init__(self, None, wx.ID_ANY, title, size=(600,500), style=wx.DEFAULT_FRAME_STYLE)
|
|
714 if wx.Platform == '__WXMSW__': icon = wx.Icon(dir_struct["icon"]+'d20.ico', wx.BITMAP_TYPE_ICO)
|
18
|
715 else: icon = wx.Icon(dir_struct["icon"]+"d20.xpm", wx.BITMAP_TYPE_XPM )
|
|
716
|
17
|
717 self.SetIcon(icon)
|
14
|
718 self.main = main
|
|
719 ####### Panel Stuff ######
|
|
720 p = wx.Panel(self)
|
|
721 nb = wx.Notebook(p)
|
|
722
|
28
|
723 global statbar
|
|
724 statbar = self.CreateStatusBar()
|
31
|
725 sys.stdout = Term2Win()
|
28
|
726 self.Centre()
|
|
727
|
14
|
728 # create the page windows as children of the notebook
|
31
|
729 self.page1 = Updater(nb, openrpg)
|
28
|
730 page2 = Repos(nb, openrpg)
|
14
|
731 page3 = Manifest(nb)
|
|
732 page4 = Control(nb)
|
28
|
733 page5 = Help(nb)
|
14
|
734
|
|
735 # add the pages to the notebook with the label to show on the tab
|
31
|
736 nb.AddPage(self.page1, "Updater")
|
14
|
737 nb.AddPage(page2, "Repos")
|
|
738 nb.AddPage(page3, "Manifest")
|
|
739 nb.AddPage(page4, "Control")
|
28
|
740 nb.AddPage(page5, 'Help')
|
14
|
741
|
|
742 # finally, put the notebook in a sizer for the panel to manage
|
|
743 # the layout
|
|
744 sizer = wx.BoxSizer()
|
|
745 sizer.Add(nb, 1, wx.EXPAND)
|
|
746 p.SetSizer(sizer)
|
28
|
747 p.Layout()
|
|
748 self.Refresh()
|
14
|
749 self.Bind(wx.EVT_CLOSE, self.OnClose)
|
28
|
750 component.add('upmana-win', self)
|
14
|
751
|
|
752 def OnClose(self, event):
|
|
753 if self.main == False: self.Destroy()
|
17
|
754 if self.main == True: self.Hide()
|
28
|
755
|
14
|
756 class updateApp(wx.App):
|
|
757 def OnInit(self):
|
31
|
758 self.main = False; self.autoUpdate = False; self.noUpdate = False
|
28
|
759 logger._set_log_to_console(False)
|
|
760 logger.note("Updater Start")
|
|
761 component.add('validate', validate)
|
31
|
762 self.updater = updaterFrame(self, "OpenRPG Update Manager 1.2",
|
28
|
763 component, manifest, self.main)
|
|
764 if manifest.GetString("updatemana", "auto_update", "") == 'on' and self.main == False:
|
31
|
765 self.AutoUpdate(); self.OnExit(); self.autoUpdate = True
|
14
|
766 else: pass
|
28
|
767 if manifest.GetString('updatemana', 'no_update', '') == 'on' and self.main == False:
|
31
|
768 self.OnExit(); self.noUpdate = True
|
14
|
769 else: pass
|
31
|
770 if not (self.autoUpdate or self.noUpdate):
|
|
771 try:
|
|
772 self.updater.Show()
|
|
773 self.updater.Fit()
|
|
774 if not self.main: self.updater.page1.UpdateCheck()
|
|
775 except: pass
|
14
|
776 return True
|
|
777
|
|
778 def AutoUpdate(self):
|
|
779 self.ui = ui.ui()
|
|
780 self.repo = hg.repository(self.ui, ".")
|
|
781 self.c = self.repo.changectx('tip')
|
|
782 self.current = self.repo.dirstate.branch()
|
|
783
|
31
|
784 capture = manifest.GetString('default', 'repo', '')
|
14
|
785 if capture != '':
|
31
|
786 try: commands.pull(self.ui, self.repo, capture, rev='', update=False, force=True)
|
|
787 except:
|
|
788 wx.MessageBox('No Connection Found. Skipping Auto Update!', 'Info')
|
|
789 return
|
14
|
790 filename = 'ignorelist.txt'
|
18
|
791 self.filename = dir_struct["home"] + 'upmana' + os.sep + filename
|
|
792 component.get('validate').config_file(filename, "default_ignorelist.txt")
|
31
|
793 self.mana = self.LoadDoc(); ignored = []
|
18
|
794 temp = dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep
|
16
|
795 for ignore in self.ignorelist:
|
28
|
796 if len(ignore.split('/')) > 1:
|
|
797 gets = 0; dir1 = ''
|
|
798 while gets != len(ignore.split('/'))-1:
|
|
799 dir1 += ignore.split('/')[gets] + os.sep
|
|
800 gets += 1
|
|
801 os.makedirs(temp+dir1)
|
31
|
802 ignoredfile = temp + dir1 + ignore.split('/')[len(ignore.split('/')) - 1]
|
|
803 ignored.append(ignoredfile)
|
|
804 shutil.copy(ignore, ignoredfile)
|
14
|
805 hg.clean(self.repo, self.current)
|
|
806 for ignore in self.ignorelist:
|
31
|
807 shutil.copyfile(ignored.index(ignore), ignore)
|
|
808 os.remove(ignored.index(ignore))
|
28
|
809 if len(ignore.split('/')) > 1:
|
|
810 gets = 0; dir1 = ''
|
|
811 while gets != len(ignore.split('/'))-1:
|
|
812 dir1 += ignore.split('/')[gets] + os.sep
|
|
813 gets += 1
|
|
814 os.removedirs(temp+dir1)
|
31
|
815 else: wx.MessageBox('Default Repo Not Found. Skipping Auto Update!', 'Info')
|
14
|
816
|
|
817 def LoadDoc(self):
|
31
|
818 manifest = open(self.filename)
|
14
|
819 self.ignorelist = []
|
31
|
820 ignore = manifest.readlines()
|
|
821 for i in ignore: print i; self.ignorelist.append(str(i[:len(i)-1]))
|
|
822 manifest.close()
|
28
|
823
|
14
|
824 def OnExit(self):
|
18
|
825 imported = ['manifest', 'orpg.dirpath', 'orpg.orpgCore', 'orpg.orpg_version',
|
|
826 'orpg.tools.orpg_log', 'orpg.tools.orpg_log', 'orpg.orpg_xml', 'orpg.dirpath',
|
|
827 'orpg.dirpath', 'upmana.validate', 'mercurial.ui', 'mercurial.hg',
|
28
|
828 'mercurial.commands', 'mercurial.repo', 'mercurial.revlog', 'mercurial.cmdutil', 'shutil']
|
|
829 for name in imported:
|
14
|
830 if name in sys.modules: del sys.modules[name]
|
|
831
|
|
832 try: self.updater.Destroy()
|
|
833 except: pass
|