comparison upmana/updatemana.py @ 121:496dbf12a6cb alpha

Traipse Alpha 'OpenRPG' {091030-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 (Cleaning up for Beta): Adds Bookmarks (Alpha) with cool Smiley Star and Plus Symbol images! Changes made to the map for increased portability. SnowDog has changes planned in Core, though. Added an initial push to the BCG. Not much to see, just shows off how it is re-writing Main code. Fix to remote admin commands Minor fix to texted based server, works in /System/ folder Some Core changes to gametree to correctly disply Pretty Print, thanks David! Fix to Splitter Nodes not being created. Added images to Plugin Control panel for Autostart feature Fix to massive amounts of images loading; from Core fix to gsclient so with_statement imports Added 'boot' command to remote admin Prep work in Pass tool for remote admin rankings and different passwords, ei, Server, Admin, Moderator, etc. Remote Admin Commands more organized, more prep work. Added Confirmation window for sent nodes. Minor changes to allow for portability to an OpenSUSE linux OS (hopefully without breaking) {091028} Made changes to gametree to start working with Element Tree, mostly from Core Minor changes to Map to start working with Element Tree, from Core Preliminary changes to map efficiency, from FlexiRPG Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG Changes to main.py to start working with Element Tree {091029} Changes made to server to start working with Element Tree. Changes made to Meta Server Lib. Prepping test work for a multi meta network page. Minor bug fixed with mini to gametree Zoom Mouse plugin added. {091030} Getting ready for Beta. Server needs debugging so Alpha remains bugged. Plugin UI code cleaned. Auto start works with a graphic, pop-up asks to enable or disable plugin. Update Manager now has a partially working Status Bar. Status Bar captures terminal text, so Merc out put is visible. Manifest.xml file, will be renamed, is now much cleaner. Debug Console has a clear button and a Report Bug button. Prep work for a Term2Win class in Debug Console. Known: Current Alpha fails in Windows.
author sirebral
date Fri, 30 Oct 2009 22:21:40 -0500
parents 0f18d16f3fe7
children 82c47d583493
comparison
equal deleted inserted replaced
120:d86e762a994f 121:496dbf12a6cb
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)
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, '')
295 self.url[self.id] = wx.TextCtrl(self.repopanel, -1, self.uri[self.id]) 306 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) 307 self.pull[self.id] = wx.Button(self.repopanel, wx.ID_REFRESH)
297 self.delete[self.id] = wx.Button(self.repopanel, wx.ID_DELETE) 308 self.delete[self.id] = wx.Button(self.repopanel, wx.ID_DELETE)
298 self.delete_list[self.delete[self.id]] = self.id 309 self.delete_list[self.delete[self.id]] = self.id
299 self.defaultcheck[self.id] = wx.CheckBox(self.repopanel, -1) 310 self.defaultcheck[self.id] = wx.CheckBox(self.repopanel, -1)
301 #Build Retraceables 312 #Build Retraceables
302 self.box_name[self.id] = str(repo) 313 self.box_name[self.id] = str(repo)
303 self.pull_list[self.pull[self.id]] = self.id 314 self.pull_list[self.pull[self.id]] = self.id
304 self.defchecklist[self.defaultcheck[self.id]] = self.id 315 self.defchecklist[self.defaultcheck[self.id]] = self.id
305 #Build Layout 316 #Build Layout
306 self.layout[self.id].Add(self.name[self.id], -1, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL) 317 self.layout[self.id].Add(self.name[self.id],
307 self.layout[self.id].Add(self.url[self.id], -1, wx.EXPAND) 318 -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) 319 self.layout[self.id].Add(self.url[self.id],
320 -1, wx.EXPAND)
321 self.layout[self.id].Add(self.pull[self.id],
322 -1, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
309 self.layout[self.id].Add(self.delete[self.id], -1, wx.EXPAND) 323 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) 324 self.layout[self.id].Add(self.defaultcheck[self.id],
325 -1, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
311 self.layout[self.id].Add(self.default[self.id], -1, wx.EXPAND) 326 self.layout[self.id].Add(self.default[self.id], -1, wx.EXPAND)
312 self.layout[self.id].AddGrowableCol(1) 327 self.layout[self.id].AddGrowableCol(1)
313 self.container[self.id].Add(self.layout[self.id], -1, wx.EXPAND) 328 self.container[self.id].Add(self.layout[self.id], -1, wx.EXPAND)
314 #Button Events 329 #Button Events
315 self.Bind(wx.EVT_BUTTON, self.RefreshRepo, self.pull[self.id]) 330 self.Bind(wx.EVT_BUTTON, self.RefreshRepo, self.pull[self.id])
316 self.Bind(wx.EVT_BUTTON, self.DelRepo, self.delete[self.id]) 331 self.Bind(wx.EVT_BUTTON, self.DelRepo, self.delete[self.id])
317 self.Bind(wx.EVT_CHECKBOX, self.SetDefault, self.defaultcheck[self.id]) 332 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) 333 self.sizers["repolist_layout"].Insert(0, self.container[self.id], -1, wx.EXPAND)
319 self.sizers['repolist_layout'].Layout() 334 self.sizers['repolist_layout'].Layout()
335 self.Layout()
320 336
321 #Set Default Repo Button 337 #Set Default Repo Button
322 capture = self.manifest.GetString('updaterepo', 'default', '') 338 capture = manifest.GetString('default', 'repo', '')
323 if capture != '': 339 if capture != '':
324 for caught in self.uri: 340 for caught in self.uri:
325 if capture == self.uri[caught]: self.id = caught; pass 341 if capture == self.uri[caught]: self.id = caught; pass
326 else: continue 342 else: continue
327 self.defaultcheck[self.id].SetValue(True) 343 self.defaultcheck[self.id].SetValue(True)
328 344
329 def AddRepo(self, event): 345 def AddRepo(self, event):
330 repo = self.texts['reponame'].GetValue(); repo = repo.replace(' ', '_'); repo = 'repo-' + repo 346 repo = self.texts['reponame'].GetValue(); repo = repo.replace(' ', '_'); repo = 'repo-' + repo
331 self.manifest.SetString('updaterepo', repo, ''); self.repo = repo.split(',') 347 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) 348 self.BuildRepoList(None)
337 349
338 def DelRepo(self, event): 350 def DelRepo(self, event):
339 self.id = self.delete_list[event.GetEventObject()] 351 self.id = self.delete_list[event.GetEventObject()]
340 self.sizers["repolist_layout"].Hide(self.container[self.id]) 352 self.sizers["repolist_layout"].Hide(self.container[self.id])
353 manifest.DelString('updaterepo', self.box_name[self.id])
341 try: del self.box_name[self.id] 354 try: del self.box_name[self.id]
342 except: pass 355 except: pass
343 self.manifest.SetList('UpdateManifest', 'repolist', list(self.box_name.values()))
344 self.sizers['repolist_layout'].Layout() 356 self.sizers['repolist_layout'].Layout()
357 self.repolist = manifest.PluginChildren('updaterepo')
345 358
346 def RefreshRepo(self, event): 359 def RefreshRepo(self, event):
347 self.id = self.pull_list[event.GetEventObject()] 360 self.id = self.pull_list[event.GetEventObject()]
348 self.manifest.SetString('updaterepo', str(self.box_name[self.id]), self.url[self.id].GetValue()) 361 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) 362 try: commands.pull(self.ui, self.r, self.url[self.id].GetValue(), rev='', update=False, force=True)
350 except: pass 363 except: pass
351 364
352 def SetDefault(self, event): 365 def SetDefault(self, event):
353 self.id = self.defchecklist[event.GetEventObject()] 366 self.id = self.defchecklist[event.GetEventObject()]
354 self.manifest.SetString('updaterepo', 'default', self.uri[self.id]) 367 manifest.SetString('default', 'repo', self.uri[self.id])
355 for all in self.defaultcheck: 368 for all in self.defaultcheck:
356 self.defaultcheck[all].SetValue(False) 369 self.defaultcheck[all].SetValue(False)
357 self.defaultcheck[self.id].SetValue(True) 370 self.defaultcheck[self.id].SetValue(True)
358 371
359 class Manifest(wx.Panel): 372 class Manifest(wx.Panel):
360 def __init__(self, parent): 373 def __init__(self, parent):
361 wx.Panel.__init__(self, parent) 374 wx.Panel.__init__(self, parent)
375 ### Status Bar ###
376 #statbar.SetStatusText('Create an Ignore List')
377 statbar.SetStatusText('New Status Bar')
362 self.ui = ui.ui() 378 self.ui = ui.ui()
363 self.repo = hg.repository(self.ui, ".") 379 self.repo = hg.repository(self.ui, ".")
364 self.c = self.repo.changectx('tip') 380 self.c = self.repo.changectx('tip')
365 self.manifestlist = [] 381 self.manifestlist = []
366 self.manifestlist = self.c.manifest().keys() 382 self.manifestlist = self.c.manifest().keys()
405 ignore.close() 421 ignore.close()
406 422
407 class Control(wx.Panel): 423 class Control(wx.Panel):
408 def __init__(self, parent): 424 def __init__(self, parent):
409 wx.Panel.__init__(self, parent) 425 wx.Panel.__init__(self, parent)
410 426 ### Status Bar ###
427 #statbar.SetStatusText('Advanced Controls & Rollback')
428 statbar.SetStatusText('New Status Bar')
411 ### Control Panel 429 ### Control Panel
412 self.ui = ui.ui() 430 self.ui = ui.ui()
413 self.repo = hg.repository(self.ui, ".") 431 self.repo = hg.repository(self.ui, ".")
414 self.c = self.repo.changectx('tip') 432 self.c = self.repo.changectx('tip')
415 self.manifest = manifest
416 self.parent = parent 433 self.parent = parent
417 #logger.debug("Enter updaterFrame") #Need to set logging level 434 #logger.debug("Enter updaterFrame") #Need to set logging level
418 435
419 self.get_packages() 436 self.get_packages()
420 self.SetBackgroundColour(wx.WHITE) 437 self.SetBackgroundColour(wx.WHITE)
582 return None 599 return None
583 600
584 class updaterFrame(wx.Frame): 601 class updaterFrame(wx.Frame):
585 def __init__(self, parent, title, openrpg, manifest, main): 602 def __init__(self, parent, title, openrpg, manifest, main):
586 603
587 wx.Frame.__init__(self, None, wx.ID_ANY, title, size=(600,480), style=wx.DEFAULT_FRAME_STYLE) 604 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) 605 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 ) 606 else: icon = wx.Icon(dir_struct["icon"]+"d20.xpm", wx.BITMAP_TYPE_XPM )
590 607
591 self.SetIcon(icon) 608 self.SetIcon(icon)
592 self.CenterOnScreen()
593 self.main = main 609 self.main = main
594 ####### Panel Stuff ###### 610 ####### Panel Stuff ######
595 p = wx.Panel(self) 611 p = wx.Panel(self)
596 nb = wx.Notebook(p) 612 nb = wx.Notebook(p)
597 613
614 global statbar
615 statbar = self.CreateStatusBar()
616 self.Centre()
617
598 # create the page windows as children of the notebook 618 # create the page windows as children of the notebook
599 page1 = Updater(nb, openrpg, manifest) 619 page1 = Updater(nb, openrpg)
600 page2 = Repos(nb, openrpg, manifest) 620 page2 = Repos(nb, openrpg)
601 page3 = Manifest(nb) 621 page3 = Manifest(nb)
602 page4 = Control(nb) 622 page4 = Control(nb)
603 623
604 # add the pages to the notebook with the label to show on the tab 624 # add the pages to the notebook with the label to show on the tab
605 nb.AddPage(page1, "Updater") 625 nb.AddPage(page1, "Updater")
619 if self.main == True: self.Hide() 639 if self.main == True: self.Hide()
620 640
621 class updateApp(wx.App): 641 class updateApp(wx.App):
622 def OnInit(self): 642 def OnInit(self):
623 self.main = False 643 self.main = False
644 sys.stdout = Term2Win()
624 logger._set_log_to_console(False) 645 logger._set_log_to_console(False)
625 logger.note("Updater Start") 646 logger.note("Updater Start")
626 self.manifest = manifest.ManifestChanges()
627 component.add('validate', validate) 647 component.add('validate', validate)
628 self.updater = updaterFrame(self, "OpenRPG Update Manager 0.8 (open beta)", 648 self.updater = updaterFrame(self, "OpenRPG Update Manager 0.8 (open beta)",
629 component, self.manifest, self.main) 649 component, manifest, self.main)
630 if self.manifest.GetString("updatemana", "auto_update", "") == 'on' and self.main == False: 650 if manifest.GetString("updatemana", "auto_update", "") == 'on' and self.main == False:
631 self.AutoUpdate(); self.OnExit() 651 self.AutoUpdate(); self.OnExit()
632 else: pass 652 else: pass
633 if self.manifest.GetString('updatemana', 'no_update', '') == 'on' and self.main == False: 653 if manifest.GetString('updatemana', 'no_update', '') == 'on' and self.main == False:
634 self.OnExit() 654 self.OnExit()
635 else: pass 655 else: pass
636 try: 656 try:
637 self.updater.Show() 657 self.updater.Show()
638 self.updater.Fit() 658 self.updater.Fit()
643 self.ui = ui.ui() 663 self.ui = ui.ui()
644 self.repo = hg.repository(self.ui, ".") 664 self.repo = hg.repository(self.ui, ".")
645 self.c = self.repo.changectx('tip') 665 self.c = self.repo.changectx('tip')
646 self.current = self.repo.dirstate.branch() 666 self.current = self.repo.dirstate.branch()
647 667
648 capture = self.manifest.GetString('updaterepo', 'default', '') 668 capture = manifest.GetString('updaterepo', 'default', '')
649 if capture != '': 669 if capture != '':
650 commands.pull(self.ui, self.repo, capture, rev='', update=False, force=True) 670 commands.pull(self.ui, self.repo, capture, rev='', update=False, force=True)
651 filename = 'ignorelist.txt' 671 filename = 'ignorelist.txt'
652 self.filename = dir_struct["home"] + 'upmana' + os.sep + filename 672 self.filename = dir_struct["home"] + 'upmana' + os.sep + filename
653 component.get('validate').config_file(filename, "default_ignorelist.txt") 673 component.get('validate').config_file(filename, "default_ignorelist.txt")