comparison upmana/updatemana.py @ 135:dcf4fbe09b70 beta

Traipse Beta 'OpenRPG' {091010-00} Traipse is a distribution of OpenRPG that is designed to be easy to setup and go. Traipse also makes it easy for developers to work on code without fear of sacrifice. 'Ornery-Orc' continues the trend of 'Grumpy' and adds fixes to the code. 'Ornery-Orc's main goal is to offer more advanced features and enhance the productivity of the user. Update Summary (Beta) Added Bookmarks Fix to Remote Admin Commands Minor fix to text based Server Fix to Pretty Print, from Core Fix to Splitter Nodes not being created Fix to massive amounts of images loading, from Core Added 'boot' command to remote admin Added confirmation window for sent nodes Minor changes to allow for portability to an OpenSUSE linux OS Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG Zoom Mouse plugin added Images added to Plugin UI Switching to Element Tree Map efficiency, from FlexiRPG Added Status Bar to Update Manager default_manifest.xml renamed to default_upmana.xml Cleaner clode for saved repositories New TrueDebug Class in orpg_log (See documentation for usage) Mercurial's hgweb folder is ported to upmana **Pretty important update that can help remove thousands of dead children from your gametree. **Children, <forms />, <group_atts />, <horizontal />, <cols />, <rows />, <height />, etc... are all tags now. Check your gametree and look for dead children!! **New Gamtree Recusion method, mapping, and context sensitivity. !!Alpha - Watch out for infinite loops!!
author sirebral
date Tue, 10 Nov 2009 14:11:28 -0600
parents 68c7bd272f27
children 2345c12d93a7
comparison
equal deleted inserted replaced
101:394ebb3b6a0f 135:dcf4fbe09b70
1 import wx 1 import wx, sys, os #just .sep maybe
2 import sys 2 from manifest import manifest
3 import os #just .sep maybe
4 import manifest
5 import shutil 3 import shutil
6 4
7 from orpg.orpgCore import component 5 from orpg.orpgCore import component
8 from orpg.dirpath import dir_struct 6 from orpg.dirpath import dir_struct
9 from orpg.tools.orpg_log import logger, crash 7 from orpg.tools.orpg_log import logger, crash
10 from orpg.tools.decorators import debugging 8 from orpg.tools.decorators import debugging
11 from upmana.validate import validate 9 from upmana.validate import validate
12 from orpg.dirpath import dir_struct 10 from orpg.dirpath import dir_struct
13 from mercurial import ui, hg, commands, repo, revlog, cmdutil, util 11 from mercurial import ui, hg, commands, repo, revlog, cmdutil, util
14 12
13 class Term2Win(object):
14 # A stdout redirector. Allows the messages from Mercurial to be seen in the Install Window
15 def write(self, text):
16 statbar.SetStatusText(text)
17 wx.Yield()
18 sys.__stdout__.write(text)
15 19
16 class Updater(wx.Panel): 20 class Updater(wx.Panel):
17 @debugging 21 @debugging
18 def __init__(self, parent, component, manifest): 22 def __init__(self, parent, component):
19 wx.Panel.__init__(self, parent) 23 wx.Panel.__init__(self, parent)
24 ### Status Bar ###
25 #statbar.SetStatusText('Select a Package and Update')
26 statbar.SetStatusText('New Status Bar')
20 27
21 ### Update Manager 28 ### Update Manager
22 self.ui = ui.ui() 29 self.ui = ui.ui()
23 self.repo = hg.repository(self.ui, ".") 30 self.repo = hg.repository(self.ui, ".")
24 self.c = self.repo.changectx('tip') 31 self.c = self.repo.changectx('tip')
25 self.manifest = manifest
26 self.parent = parent 32 self.parent = parent
27 self.SetBackgroundColour(wx.WHITE) 33 self.SetBackgroundColour(wx.WHITE)
28 self.sizer = wx.GridBagSizer(hgap=1, vgap=1) 34 self.sizer = wx.GridBagSizer(hgap=1, vgap=1)
29 self.changelog = wx.TextCtrl(self, wx.ID_ANY, size=(300, -1), style=wx.TE_MULTILINE | wx.TE_READONLY) 35 self.changelog = wx.TextCtrl(self, wx.ID_ANY, size=(300, -1),
30 self.filelist = wx.TextCtrl(self, wx.ID_ANY, size=(275, 300), style=wx.TE_MULTILINE | wx.TE_READONLY) 36 style=wx.TE_MULTILINE | wx.TE_READONLY)
37 self.filelist = wx.TextCtrl(self, wx.ID_ANY, size=(275, 300),
38 style=wx.TE_MULTILINE | wx.TE_READONLY)
31 self.buttons = {} 39 self.buttons = {}
32 self.buttons['progress_bar'] = wx.Gauge(self, wx.ID_ANY, 100) 40 self.buttons['progress_bar'] = wx.Gauge(self, wx.ID_ANY, 100)
33 self.buttons['auto_text'] = wx.StaticText(self, wx.ID_ANY, "Auto Update") 41 self.buttons['auto_text'] = wx.StaticText(self, wx.ID_ANY, "Auto Update")
34 self.buttons['auto_check'] = wx.CheckBox(self, wx.ID_ANY) 42 self.buttons['auto_check'] = wx.CheckBox(self, wx.ID_ANY)
35 self.buttons['no_text'] = wx.StaticText(self, wx.ID_ANY, "No Update") 43 self.buttons['no_text'] = wx.StaticText(self, wx.ID_ANY, "No Update")
57 self.get_package 65 self.get_package
58 66
59 self.current = self.repo.dirstate.branch() 67 self.current = self.repo.dirstate.branch()
60 self.BranchInfo(self.current) 68 self.BranchInfo(self.current)
61 69
62 if self.manifest.GetString("updatemana", "no_update", "") == 'on': self.buttons['no_check'].SetValue(True) 70 if manifest.GetString("updatemana", "no_update", "") == 'on': self.buttons['no_check'].SetValue(True)
63 else: self.buttons['no_check'].SetValue(False) 71 else: self.buttons['no_check'].SetValue(False)
64 if self.manifest.GetString("updatemana", "auto_update", "") == 'on': self.buttons['auto_check'].SetValue(True) 72 if manifest.GetString("updatemana", "auto_update", "") == 'on': self.buttons['auto_check'].SetValue(True)
65 else: self.buttons['auto_check'].SetValue(False) 73 else: self.buttons['auto_check'].SetValue(False)
66 74
67 ## Event Handlers 75 ## Event Handlers
68 self.Bind(wx.EVT_BUTTON, self.Update, self.buttons['update']) 76 self.Bind(wx.EVT_BUTTON, self.Update, self.buttons['update'])
69 self.Bind(wx.EVT_BUTTON, self.Finish, self.buttons['finish']) 77 self.Bind(wx.EVT_BUTTON, self.Finish, self.buttons['finish'])
73 81
74 def ToggleAutoUpdate(self, event): 82 def ToggleAutoUpdate(self, event):
75 if self.buttons['auto_check'].GetValue() == True: 83 if self.buttons['auto_check'].GetValue() == True:
76 if self.buttons['no_check'].GetValue() == True: 84 if self.buttons['no_check'].GetValue() == True:
77 self.buttons['no_check'].SetValue(False) 85 self.buttons['no_check'].SetValue(False)
78 self.manifest.SetString("updatemana", "no_update", "off") 86 manifest.SetString("updatemana", "no_update", "off")
79 self.manifest.SetString("updatemana", "auto_update", "on") 87 manifest.SetString("updatemana", "auto_update", "on")
80 else: self.manifest.SetString("updatemana", "auto_update", "off") 88 else: manifest.SetString("updatemana", "auto_update", "off")
81 89
82 def ToggleNoUpdate(self, event): 90 def ToggleNoUpdate(self, event):
83 if self.buttons['no_check'].GetValue() == True: 91 if self.buttons['no_check'].GetValue() == True:
84 if self.buttons['auto_check'].GetValue() == True: 92 if self.buttons['auto_check'].GetValue() == True:
85 self.buttons['auto_check'].SetValue(False) 93 self.buttons['auto_check'].SetValue(False)
86 self.manifest.SetString("updatemana", "auto_update", "off") 94 manifest.SetString("updatemana", "auto_update", "off")
87 self.manifest.SetString("updatemana", "no_update", "on") 95 manifest.SetString("updatemana", "no_update", "on")
88 else: self.manifest.SetString("updatemana", "no_update", "off") 96 else: manifest.SetString("updatemana", "no_update", "off")
89 97
90 def Update(self, evt=None): 98 def Update(self, evt=None):
91 self.ui = ui.ui() 99 self.ui = ui.ui()
92 self.repo = hg.repository(self.ui, ".") 100 self.repo = hg.repository(self.ui, ".")
93 self.c = self.repo.changectx('tip') 101 self.c = self.repo.changectx('tip')
196 self.get_packages() 204 self.get_packages()
197 if self.package_list == None: return None 205 if self.package_list == None: return None
198 return None 206 return None
199 207
200 class Repos(wx.Panel): 208 class Repos(wx.Panel):
201 def __init__(self, parent, openrpg, manifest): 209 def __init__(self, parent, openrpg):
202 wx.Panel.__init__(self, parent) 210 wx.Panel.__init__(self, parent)
203 211 ### Status Bar ###
212 #statbar.SetStatusText('Add, Delete, or Refresh your source Tracs')
213 statbar.SetStatusText('New Status Bar')
204 ### Update Manager 214 ### Update Manager
205 self.ui = ui.ui() 215 self.ui = ui.ui()
206 self.r = hg.repository(self.ui, ".") 216 self.r = hg.repository(self.ui, ".")
207 self.c = self.r.changectx('tip') 217 self.c = self.r.changectx('tip')
208 218
209 #mainpanel = self 219 #mainpanel = self
210 self.openrpg = openrpg 220 self.openrpg = openrpg
211 self.manifest = manifest
212 self.buttons = {} 221 self.buttons = {}
213 self.texts = {} 222 self.texts = {}
214 223
215 ## Section Sizers (with frame edges and text captions) 224 ## Section Sizers (with frame edges and text captions)
216 self.box_sizers = {} 225 self.box_sizers = {}
243 self.repopanel.Scroll(50,10) 252 self.repopanel.Scroll(50,10)
244 self.box_sizers["repolist"] = wx.StaticBox(self.repopanel, -1, "Current Repo List") 253 self.box_sizers["repolist"] = wx.StaticBox(self.repopanel, -1, "Current Repo List")
245 self.sizers["repolist"] = wx.StaticBoxSizer(self.box_sizers["repolist"], wx.VERTICAL) 254 self.sizers["repolist"] = wx.StaticBoxSizer(self.box_sizers["repolist"], wx.VERTICAL)
246 self.sizers["repo"] = wx.GridBagSizer(hgap=2, vgap=2) 255 self.sizers["repo"] = wx.GridBagSizer(hgap=2, vgap=2)
247 self.sizers["repolist_layout"] = wx.FlexGridSizer(rows=1, cols=1, hgap=2, vgap=5) 256 self.sizers["repolist_layout"] = wx.FlexGridSizer(rows=1, cols=1, hgap=2, vgap=5)
248 self.manifest = manifest
249 257
250 self.NewRepoList(None) 258 self.NewRepoList(None)
251 self.BuildRepoList(None) 259 self.BuildRepoList(None)
252 260
253 self.sizers["repolist_layout"].AddGrowableCol(0) 261 self.sizers["repolist_layout"].AddGrowableCol(0)
265 self.sizers["main"].AddGrowableCol(0) 273 self.sizers["main"].AddGrowableCol(0)
266 self.sizers["main"].AddGrowableCol(1) 274 self.sizers["main"].AddGrowableCol(1)
267 self.sizers["main"].AddGrowableRow(1) 275 self.sizers["main"].AddGrowableRow(1)
268 self.SetSizer(self.sizers["main"]) 276 self.SetSizer(self.sizers["main"])
269 self.SetAutoLayout(True) 277 self.SetAutoLayout(True)
270 self.Fit() 278 #self.Fit()
271 self.Bind(wx.EVT_BUTTON, self.AddRepo, self.buttons['addrepo']) 279 self.Bind(wx.EVT_BUTTON, self.AddRepo, self.buttons['addrepo'])
272 280
273 def NewRepoList(self, event): 281 def NewRepoList(self, event):
274 self.id = -1; self.box = {}; self.box_name= {}; self.main = {}; self.container = {}; self.layout = {} 282 self.id = -1
283 self.box = {}; self.box_name= {}; self.main = {}; self.container = {}; self.layout = {}
275 self.name = {}; self.url = {}; self.url_list = {}; self.pull = {}; self.uri = {}; self.delete = {} 284 self.name = {}; self.url = {}; self.url_list = {}; self.pull = {}; self.uri = {}; self.delete = {}
276 self.defaultcheck = {}; self.default = {}; self.repotrac = {} 285 self.defaultcheck = {}; self.default = {}; self.repotrac = {}
277 self.pull_list = {}; self.delete_list = {}; self.defchecklist = {} 286 self.pull_list = {}; self.delete_list = {}; self.defchecklist = {}; self.repolist = []
278 287
279 def BuildRepoList(self, event): 288 def BuildRepoList(self, event):
280 self.repolist = self.manifest.GetList('UpdateManifest', 'repolist', '') 289 repolist = manifest.PluginChildren('updaterepo')
281 try: self.repolist = self.repo 290 appendlist = []
282 except: pass 291 for repo in repolist:
292 if repo not in self.repolist: appendlist.append(repo)
293 self.repolist = repolist
283 294
284 #wx.Yeild() For future refrence. 295 #wx.Yeild() For future refrence.
285 296
286 for repo in self.repolist: 297 for repo in appendlist:
287 self.id += 1 298 self.id += 1
288 #Build Constructs 299 #Build Constructs
289 self.box[self.id] = wx.StaticBox(self.repopanel, -1, str(repo)) 300 self.box[self.id] = wx.StaticBox(self.repopanel, -1, str(repo))
290 self.main[self.id] = wx.GridBagSizer(hgap=2, vgap=2) 301 self.main[self.id] = wx.GridBagSizer(hgap=2, vgap=2)
291 self.container[self.id] = wx.StaticBoxSizer(self.box[self.id], wx.VERTICAL) 302 self.container[self.id] = wx.StaticBoxSizer(self.box[self.id], wx.VERTICAL)
292 self.layout[self.id] = wx.FlexGridSizer(rows=1, cols=4, hgap=2, vgap=5) 303 self.layout[self.id] = wx.FlexGridSizer(rows=1, cols=4, hgap=2, vgap=5)
293 self.name[self.id] = wx.StaticText(self.repopanel, -1, 'URL') 304 self.name[self.id] = wx.StaticText(self.repopanel, -1, 'URL')
294 self.uri[self.id] = self.manifest.GetString('updaterepo', repo, '') 305 self.uri[self.id] = manifest.GetString('updaterepo', repo, '')
306 #except: self.uri[self.id] = ''
295 self.url[self.id] = wx.TextCtrl(self.repopanel, -1, self.uri[self.id]) 307 self.url[self.id] = wx.TextCtrl(self.repopanel, -1, self.uri[self.id])
296 self.pull[self.id] = wx.Button(self.repopanel, wx.ID_REFRESH) 308 self.pull[self.id] = wx.Button(self.repopanel, wx.ID_REFRESH)
297 self.delete[self.id] = wx.Button(self.repopanel, wx.ID_DELETE) 309 self.delete[self.id] = wx.Button(self.repopanel, wx.ID_DELETE)
298 self.delete_list[self.delete[self.id]] = self.id 310 self.delete_list[self.delete[self.id]] = self.id
299 self.defaultcheck[self.id] = wx.CheckBox(self.repopanel, -1) 311 self.defaultcheck[self.id] = wx.CheckBox(self.repopanel, -1)
301 #Build Retraceables 313 #Build Retraceables
302 self.box_name[self.id] = str(repo) 314 self.box_name[self.id] = str(repo)
303 self.pull_list[self.pull[self.id]] = self.id 315 self.pull_list[self.pull[self.id]] = self.id
304 self.defchecklist[self.defaultcheck[self.id]] = self.id 316 self.defchecklist[self.defaultcheck[self.id]] = self.id
305 #Build Layout 317 #Build Layout
306 self.layout[self.id].Add(self.name[self.id], -1, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL) 318 self.layout[self.id].Add(self.name[self.id],
307 self.layout[self.id].Add(self.url[self.id], -1, wx.EXPAND) 319 -1, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
308 self.layout[self.id].Add(self.pull[self.id], -1, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALL) 320 self.layout[self.id].Add(self.url[self.id],
321 -1, wx.EXPAND)
322 self.layout[self.id].Add(self.pull[self.id],
323 -1, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
309 self.layout[self.id].Add(self.delete[self.id], -1, wx.EXPAND) 324 self.layout[self.id].Add(self.delete[self.id], -1, wx.EXPAND)
310 self.layout[self.id].Add(self.defaultcheck[self.id], -1, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALL) 325 self.layout[self.id].Add(self.defaultcheck[self.id],
326 -1, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
311 self.layout[self.id].Add(self.default[self.id], -1, wx.EXPAND) 327 self.layout[self.id].Add(self.default[self.id], -1, wx.EXPAND)
312 self.layout[self.id].AddGrowableCol(1) 328 self.layout[self.id].AddGrowableCol(1)
313 self.container[self.id].Add(self.layout[self.id], -1, wx.EXPAND) 329 self.container[self.id].Add(self.layout[self.id], -1, wx.EXPAND)
314 #Button Events 330 #Button Events
315 self.Bind(wx.EVT_BUTTON, self.RefreshRepo, self.pull[self.id]) 331 self.Bind(wx.EVT_BUTTON, self.RefreshRepo, self.pull[self.id])
316 self.Bind(wx.EVT_BUTTON, self.DelRepo, self.delete[self.id]) 332 self.Bind(wx.EVT_BUTTON, self.DelRepo, self.delete[self.id])
317 self.Bind(wx.EVT_CHECKBOX, self.SetDefault, self.defaultcheck[self.id]) 333 self.Bind(wx.EVT_CHECKBOX, self.SetDefault, self.defaultcheck[self.id])
318 self.sizers["repolist_layout"].Insert(0, self.container[self.id], -1, wx.EXPAND) 334 self.sizers["repolist_layout"].Insert(0, self.container[self.id], -1, wx.EXPAND)
319 self.sizers['repolist_layout'].Layout() 335 self.sizers['repolist_layout'].Layout()
336 self.Layout()
320 337
321 #Set Default Repo Button 338 #Set Default Repo Button
322 capture = self.manifest.GetString('updaterepo', 'default', '') 339 capture = manifest.GetString('default', 'repo', '')
323 if capture != '': 340 if capture != '':
324 for caught in self.uri: 341 for caught in self.uri:
325 if capture == self.uri[caught]: self.id = caught; pass 342 if capture == self.uri[caught]: self.id = caught; pass
326 else: continue 343 else: continue
327 self.defaultcheck[self.id].SetValue(True) 344 self.defaultcheck[self.id].SetValue(True)
328 345
329 def AddRepo(self, event): 346 def AddRepo(self, event):
330 repo = self.texts['reponame'].GetValue(); repo = repo.replace(' ', '_'); repo = 'repo-' + repo 347 repo = self.texts['reponame'].GetValue(); repo = repo.replace(' ', '_'); repo = 'repo-' + repo
331 self.manifest.SetString('updaterepo', repo, ''); self.repo = repo.split(',') 348 manifest.SetString('updaterepo', repo, '') #; self.repo = repo.split(',')
332 repolist = self.manifest.GetList('UpdateManifest', 'repolist', '')
333 if repolist == '': pass
334 else: repolist = repolist + self.repo
335 self.manifest.SetList('UpdateManifest', 'repolist', repolist)
336 self.BuildRepoList(None) 349 self.BuildRepoList(None)
337 350
338 def DelRepo(self, event): 351 def DelRepo(self, event):
339 self.id = self.delete_list[event.GetEventObject()] 352 self.id = self.delete_list[event.GetEventObject()]
340 self.sizers["repolist_layout"].Hide(self.container[self.id]) 353 self.sizers["repolist_layout"].Hide(self.container[self.id])
354 manifest.DelString('updaterepo', self.box_name[self.id])
341 try: del self.box_name[self.id] 355 try: del self.box_name[self.id]
342 except: pass 356 except: pass
343 self.manifest.SetList('UpdateManifest', 'repolist', list(self.box_name.values()))
344 self.sizers['repolist_layout'].Layout() 357 self.sizers['repolist_layout'].Layout()
358 self.repolist = manifest.PluginChildren('updaterepo')
345 359
346 def RefreshRepo(self, event): 360 def RefreshRepo(self, event):
347 self.id = self.pull_list[event.GetEventObject()] 361 self.id = self.pull_list[event.GetEventObject()]
348 self.manifest.SetString('updaterepo', str(self.box_name[self.id]), self.url[self.id].GetValue()) 362 manifest.SetString('updaterepo', str(self.box_name[self.id]), self.url[self.id].GetValue())
349 try: commands.pull(self.ui, self.r, self.url[self.id].GetValue(), rev='', update=False, force=True) 363 try: commands.pull(self.ui, self.r, self.url[self.id].GetValue(), rev='', update=False, force=True)
350 except: pass 364 except: pass
351 365
352 def SetDefault(self, event): 366 def SetDefault(self, event):
353 self.id = self.defchecklist[event.GetEventObject()] 367 self.id = self.defchecklist[event.GetEventObject()]
354 self.manifest.SetString('updaterepo', 'default', self.uri[self.id]) 368 manifest.SetString('default', 'repo', self.uri[self.id])
355 for all in self.defaultcheck: 369 for all in self.defaultcheck:
356 self.defaultcheck[all].SetValue(False) 370 self.defaultcheck[all].SetValue(False)
357 self.defaultcheck[self.id].SetValue(True) 371 self.defaultcheck[self.id].SetValue(True)
358 372
359 class Manifest(wx.Panel): 373 class Manifest(wx.Panel):
360 def __init__(self, parent): 374 def __init__(self, parent):
361 wx.Panel.__init__(self, parent) 375 wx.Panel.__init__(self, parent)
376 ### Status Bar ###
377 #statbar.SetStatusText('Create an Ignore List')
378 statbar.SetStatusText('New Status Bar')
362 self.ui = ui.ui() 379 self.ui = ui.ui()
363 self.repo = hg.repository(self.ui, ".") 380 self.repo = hg.repository(self.ui, ".")
364 self.c = self.repo.changectx('tip') 381 self.c = self.repo.changectx('tip')
365 self.manifestlist = [] 382 self.manifestlist = []
366 self.manifestlist = self.c.manifest().keys() 383 self.manifestlist = self.c.manifest().keys()
405 ignore.close() 422 ignore.close()
406 423
407 class Control(wx.Panel): 424 class Control(wx.Panel):
408 def __init__(self, parent): 425 def __init__(self, parent):
409 wx.Panel.__init__(self, parent) 426 wx.Panel.__init__(self, parent)
410 427 ### Status Bar ###
428 #statbar.SetStatusText('Advanced Controls & Rollback')
429 statbar.SetStatusText('New Status Bar')
411 ### Control Panel 430 ### Control Panel
412 self.ui = ui.ui() 431 self.ui = ui.ui()
413 self.repo = hg.repository(self.ui, ".") 432 self.repo = hg.repository(self.ui, ".")
414 self.c = self.repo.changectx('tip') 433 self.c = self.repo.changectx('tip')
415 self.manifest = manifest
416 self.parent = parent 434 self.parent = parent
417 #logger.debug("Enter updaterFrame") #Need to set logging level 435 #logger.debug("Enter updaterFrame") #Need to set logging level
418 436
419 self.get_packages() 437 self.get_packages()
420 self.SetBackgroundColour(wx.WHITE) 438 self.SetBackgroundColour(wx.WHITE)
582 return None 600 return None
583 601
584 class updaterFrame(wx.Frame): 602 class updaterFrame(wx.Frame):
585 def __init__(self, parent, title, openrpg, manifest, main): 603 def __init__(self, parent, title, openrpg, manifest, main):
586 604
587 wx.Frame.__init__(self, None, wx.ID_ANY, title, size=(600,480), style=wx.DEFAULT_FRAME_STYLE) 605 wx.Frame.__init__(self, None, wx.ID_ANY, title, size=(600,500), style=wx.DEFAULT_FRAME_STYLE)
588 if wx.Platform == '__WXMSW__': icon = wx.Icon(dir_struct["icon"]+'d20.ico', wx.BITMAP_TYPE_ICO) 606 if wx.Platform == '__WXMSW__': icon = wx.Icon(dir_struct["icon"]+'d20.ico', wx.BITMAP_TYPE_ICO)
589 else: icon = wx.Icon(dir_struct["icon"]+"d20.xpm", wx.BITMAP_TYPE_XPM ) 607 else: icon = wx.Icon(dir_struct["icon"]+"d20.xpm", wx.BITMAP_TYPE_XPM )
590 608
591 self.SetIcon(icon) 609 self.SetIcon(icon)
592 self.CenterOnScreen()
593 self.main = main 610 self.main = main
594 ####### Panel Stuff ###### 611 ####### Panel Stuff ######
595 p = wx.Panel(self) 612 p = wx.Panel(self)
596 nb = wx.Notebook(p) 613 nb = wx.Notebook(p)
597 614
615 global statbar
616 statbar = self.CreateStatusBar()
617 self.Centre()
618
598 # create the page windows as children of the notebook 619 # create the page windows as children of the notebook
599 page1 = Updater(nb, openrpg, manifest) 620 page1 = Updater(nb, openrpg)
600 page2 = Repos(nb, openrpg, manifest) 621 page2 = Repos(nb, openrpg)
601 page3 = Manifest(nb) 622 page3 = Manifest(nb)
602 page4 = Control(nb) 623 page4 = Control(nb)
603 624
604 # add the pages to the notebook with the label to show on the tab 625 # add the pages to the notebook with the label to show on the tab
605 nb.AddPage(page1, "Updater") 626 nb.AddPage(page1, "Updater")
610 # finally, put the notebook in a sizer for the panel to manage 631 # finally, put the notebook in a sizer for the panel to manage
611 # the layout 632 # the layout
612 sizer = wx.BoxSizer() 633 sizer = wx.BoxSizer()
613 sizer.Add(nb, 1, wx.EXPAND) 634 sizer.Add(nb, 1, wx.EXPAND)
614 p.SetSizer(sizer) 635 p.SetSizer(sizer)
636 p.Layout()
637 self.Refresh()
615 self.Bind(wx.EVT_CLOSE, self.OnClose) 638 self.Bind(wx.EVT_CLOSE, self.OnClose)
616 639
617 def OnClose(self, event): 640 def OnClose(self, event):
618 if self.main == False: self.Destroy() 641 if self.main == False: self.Destroy()
619 if self.main == True: self.Hide() 642 if self.main == True: self.Hide()
620 643
621 class updateApp(wx.App): 644 class updateApp(wx.App):
622 def OnInit(self): 645 def OnInit(self):
623 self.main = False 646 self.main = False
647 sys.stdout = Term2Win()
624 logger._set_log_to_console(False) 648 logger._set_log_to_console(False)
625 logger.note("Updater Start") 649 logger.note("Updater Start")
626 self.manifest = manifest.ManifestChanges()
627 component.add('validate', validate) 650 component.add('validate', validate)
628 self.updater = updaterFrame(self, "OpenRPG Update Manager 0.8 (open beta)", 651 self.updater = updaterFrame(self, "OpenRPG Update Manager 0.8 (open beta)",
629 component, self.manifest, self.main) 652 component, manifest, self.main)
630 if self.manifest.GetString("updatemana", "auto_update", "") == 'on' and self.main == False: 653 if manifest.GetString("updatemana", "auto_update", "") == 'on' and self.main == False:
631 self.AutoUpdate(); self.OnExit() 654 self.AutoUpdate(); self.OnExit()
632 else: pass 655 else: pass
633 if self.manifest.GetString('updatemana', 'no_update', '') == 'on' and self.main == False: 656 if manifest.GetString('updatemana', 'no_update', '') == 'on' and self.main == False:
634 self.OnExit() 657 self.OnExit()
635 else: pass 658 else: pass
636 try: 659 try:
637 self.updater.Show() 660 self.updater.Show()
638 self.updater.Fit() 661 self.updater.Fit()
643 self.ui = ui.ui() 666 self.ui = ui.ui()
644 self.repo = hg.repository(self.ui, ".") 667 self.repo = hg.repository(self.ui, ".")
645 self.c = self.repo.changectx('tip') 668 self.c = self.repo.changectx('tip')
646 self.current = self.repo.dirstate.branch() 669 self.current = self.repo.dirstate.branch()
647 670
648 capture = self.manifest.GetString('updaterepo', 'default', '') 671 capture = manifest.GetString('updaterepo', 'default', '')
649 if capture != '': 672 if capture != '':
650 commands.pull(self.ui, self.repo, capture, rev='', update=False, force=True) 673 commands.pull(self.ui, self.repo, capture, rev='', update=False, force=True)
651 filename = 'ignorelist.txt' 674 filename = 'ignorelist.txt'
652 self.filename = dir_struct["home"] + 'upmana' + os.sep + filename 675 self.filename = dir_struct["home"] + 'upmana' + os.sep + filename
653 component.get('validate').config_file(filename, "default_ignorelist.txt") 676 component.get('validate').config_file(filename, "default_ignorelist.txt")