comparison upmana/updatemana.py @ 34:8b630fc8a343 traipse_dev

Updated the Update Manager to 0.3. Settings are being created with a clone of the PulginDB. Repos can be added, GUI does not update, Repo list needs a scrollbar. Repo tab buttons will not work except for New.
author sirebral
date Mon, 03 Aug 2009 11:56:17 -0500
parents 3687514e0218
children 0b0c553d50f5
comparison
equal deleted inserted replaced
33:3687514e0218 34:8b630fc8a343
1 import wx 1 import wx
2 #import wx.html
3 #import webbrowser
4 #import urllib
5 #import zipfile
6 #import traceback
7 import manifest 2 import manifest
8 #import hashlib
9 import orpg.dirpath 3 import orpg.dirpath
10 from orpg.orpgCore import * 4 from orpg.orpgCore import *
11 import orpg.orpg_version 5 import orpg.orpg_version
12 import orpg.tools.orpg_log 6 import orpg.tools.orpg_log
13 import orpg.orpg_xml 7 import orpg.orpg_xml
14 import orpg.dirpath 8 import orpg.dirpath
15 #import orpg.tools.orpg_settings
16 import orpg.tools.validate 9 import orpg.tools.validate
17 from mercurial import ui, hg, commands, repo, revlog, cmdutil 10 from mercurial import ui, hg, commands, repo, revlog, cmdutil
18 11
19 class Updater(wx.Panel): 12 class Updater(wx.Panel):
20 def __init__(self, parent, openrpg): 13 def __init__(self, parent, open_rpg, manifest):
21 wx.Panel.__init__(self, parent) 14 wx.Panel.__init__(self, parent)
22 15
23 ### Update Manager 16 ### Update Manager
24 self.ui = ui.ui() 17 self.ui = ui.ui()
25 self.repo = hg.repository(self.ui, ".") 18 self.repo = hg.repository(self.ui, ".")
26 self.c = self.repo.changectx('tip') 19 self.c = self.repo.changectx('tip')
27 self.manifest = [] 20 self.manifest = manifest
28 self.manifest = self.c.manifest().keys() 21
29 self.openrpg = openrpg 22 self.xml = open_rpg.get_component('xml')
30 #self.settings = openrpg.get_component('settings') 23 self.dir_struct = open_rpg.get_component("dir_struct")
31 self.xml = openrpg.get_component('xml')
32 self.dir_struct = self.openrpg.get_component("dir_struct")
33 self.parent = parent 24 self.parent = parent
34 self.log = self.openrpg.get_component("log") 25 self.log = open_rpg.get_component("log")
35 self.log.log("Enter updaterFrame", ORPG_DEBUG) 26 self.log.log("Enter updaterFrame", ORPG_DEBUG)
36 self.SetBackgroundColour(wx.WHITE) 27 self.SetBackgroundColour(wx.WHITE)
37 self.sizer = wx.GridBagSizer(hgap=1, vgap=1) 28 self.sizer = wx.GridBagSizer(hgap=1, vgap=1)
38 self.changelog = wx.TextCtrl(self, wx.ID_ANY, size=(400, -1), style=wx.TE_MULTILINE | wx.TE_READONLY) 29 self.changelog = wx.TextCtrl(self, wx.ID_ANY, size=(400, -1), style=wx.TE_MULTILINE | wx.TE_READONLY)
39 self.filelist = wx.TextCtrl(self, wx.ID_ANY, size=(250, 300), style=wx.TE_MULTILINE | wx.TE_READONLY) 30 self.filelist = wx.TextCtrl(self, wx.ID_ANY, size=(250, 300), style=wx.TE_MULTILINE | wx.TE_READONLY)
60 self.sizer.Add(self.buttons['finish'], (4,3), flag=wx.EXPAND) 51 self.sizer.Add(self.buttons['finish'], (4,3), flag=wx.EXPAND)
61 self.sizer.AddGrowableCol(0) 52 self.sizer.AddGrowableCol(0)
62 self.sizer.AddGrowableRow(0) 53 self.sizer.AddGrowableRow(0)
63 self.SetSizer(self.sizer) 54 self.SetSizer(self.sizer)
64 self.SetAutoLayout(True) 55 self.SetAutoLayout(True)
65 self.initPrefs() 56 self.get_package
66 57
67 self.current = self.c.branch() 58 self.current = self.c.branch()
68 self.BranchInfo(self.current) 59 self.BranchInfo(self.current)
69 #if self.autoupdate == "On": self.buttons['auto_check'].SetValue(True) 60 #if self.autoupdate == "On": self.buttons['auto_check'].SetValue(True)
70 61
71 ## Event Handlers 62 ## Event Handlers
72 self.Bind(wx.EVT_BUTTON, self.Update, self.buttons['update']) 63 self.Bind(wx.EVT_BUTTON, self.Update, self.buttons['update'])
73 self.Bind(wx.EVT_BUTTON, self.Finish, self.buttons['finish']) 64 self.Bind(wx.EVT_BUTTON, self.Finish, self.buttons['finish'])
74 self.Bind(wx.EVT_BUTTON, self.Advanced, self.buttons['advanced']) 65 self.Bind(wx.EVT_BUTTON, self.ChooseBranch, self.buttons['advanced'])
75 #self.Bind(wx.EVT_CHECKBOX, self.ToggleAutoUpdate, self.buttons['auto_check']) 66 self.Bind(wx.EVT_CHECKBOX, self.ToggleAutoUpdate, self.buttons['auto_check'])
76 67 self.Bind(wx.EVT_CHECKBOX, self.ToggleNoUpdate, self.buttons['no_check'])
77 def showFinish(self):
78 if self.Updated: self.filelist.SetValue(self.filelist.GetValue() + "Finished ... \n")
79 self.buttons['finish'].Show()
80 self.buttons['advanced'].Show()
81
82 def initPrefs(self):
83 #self.list_url = self.settings.get_setting("PackagesURL")
84 #self.package_type = self.settings.get_setting("PackagesType")
85 #self.package_name = self.settings.get_setting("PackagesName")
86 self.SelectPackage = False
87 #self.autoupdate = self.settings.get_setting("AutoUpdate")
88 self.packages = None
89 self.package = self.get_package()
90 self.Updated = False
91 self.Finished = False
92
93 def isFinished(self):
94 return self.Finished
95 68
96 def ToggleAutoUpdate(self, event): 69 def ToggleAutoUpdate(self, event):
97 if self.buttons['auto_check'].GetValue(): 70 if self.buttons['auto_check'].GetValue():
71 if self.buttons['no_check'].GetValue():
72 self.buttons['no_check'].SetValue(False)
73 self.manifest.SetString("updatemana", "no_update", "off")
98 self.autoupdate = "On" 74 self.autoupdate = "On"
99 #self.settings.set_setting("AutoUpdate", "On") 75 self.manifest.SetString("updatemana", "auto_update", "on")
100 #self.Update(None)
101 else: 76 else:
102 self.autoupdate = "Off" 77 self.autoupdate = "Off"
103 #self.settings.set_setting("AutoUpdate", "Off") 78 self.manifest.SetString("updatemana", "auto_update", "off")
79
80 def ToggleNoUpdate(self, event):
81 if self.buttons['no_check'].GetValue():
82 if self.buttons['auto_check'].GetValue():
83 self.buttons['auto_check'].SetValue(False)
84 self.manifest.SetString("updatemana", "auto_update", "off")
85 self.autoupdate = "On"
86 self.manifest.SetString("updatemana", "no_update", "on")
87 else:
88 self.autoupdate = "Off"
89 self.manifest.SetString("updatemana", "no_update", "off")
104 90
105 def Update(self, evt=None): 91 def Update(self, evt=None):
106 hg.clean(self.repo, self.current) 92 hg.clean(self.repo, self.current)
107 93
108 def Finish(self, evt=None): 94 def Finish(self, evt=None):
109 #self.settings.updateIni()
110 self.Finished = True 95 self.Finished = True
111 self.Destroy() #destroys tab, pretty useless. 96 self.Destroy() #destroys tab, pretty useless.
112 97
113 def Advanced(self, evt=None): 98 def ChooseBranch(self, evt=None):
114 99
115 ## This part sucks. Do they need to see the Branch List everytime? No!! Press the button.
116 dlg = wx.Dialog(self, wx.ID_ANY, "Package Selector", style=wx.DEFAULT_DIALOG_STYLE) 100 dlg = wx.Dialog(self, wx.ID_ANY, "Package Selector", style=wx.DEFAULT_DIALOG_STYLE)
117 if wx.Platform == '__WXMSW__': icon = wx.Icon(self.dir_struct["icon"]+'d20.ico', wx.BITMAP_TYPE_ICO) 101 if wx.Platform == '__WXMSW__': icon = wx.Icon(self.dir_struct["icon"]+'d20.ico', wx.BITMAP_TYPE_ICO)
118 else: icon = wx.Icon(self.dir_struct["icon"]+"d20.xpm", wx.BITMAP_TYPE_XPM ) 102 else: icon = wx.Icon(self.dir_struct["icon"]+"d20.xpm", wx.BITMAP_TYPE_XPM )
119 dlg.SetIcon(icon) 103 dlg.SetIcon(icon)
120 104
190 174
191 def BranchInfo(self, branch): 175 def BranchInfo(self, branch):
192 self.filelist.SetValue('') 176 self.filelist.SetValue('')
193 self.filelist.AppendText("Files that will change\n\n") 177 self.filelist.AppendText("Files that will change\n\n")
194 self.changelog.SetValue('') 178 self.changelog.SetValue('')
195 changelog = "This is Dev Build 0.1 of the Update Manager. It has limited functionality.\n\nThe full release will search your Revision log and show the contents here." 179 changelog = "This is Dev Build 0.3 of the Update Manager. It has limited functionality.\n\nThe full release will search your Revision log and show the contents here."
196 self.changelog.AppendText(changelog + '\n') 180 self.changelog.AppendText(changelog + '\n')
197 self.filelist.AppendText("Update to " + branch + "\n\n The full release will show the files to be changed here.") 181 self.filelist.AppendText("Update to " + branch + "\n\n The full release will show the files to be changed here.")
198 182
199 #### Files works but not fully without the change log information, pulled for Dev 0.1 183 #### Files works but not fully without the change log information, pulled for Dev 0.1
200 #for f in files: 184 #for f in files:
226 if self.packages == None: self.get_packages() 210 if self.packages == None: self.get_packages()
227 if self.package_list == None: return None 211 if self.package_list == None: return None
228 return None 212 return None
229 213
230 class Repos(wx.Panel): 214 class Repos(wx.Panel):
231 def __init__(self, parent, openrpg): 215 def __init__(self, parent, openrpg, manifest):
232 wx.Panel.__init__(self, parent) 216 wx.Panel.__init__(self, parent)
217
218 mainpanel = self
233 self.openrpg = openrpg 219 self.openrpg = openrpg
234 self.settings = openrpg.get_component('settings') 220 self.manifest = manifest
235 self.xml = openrpg.get_component('xml')
236
237 self.buttons = {} 221 self.buttons = {}
238 self.texts = {} 222 self.texts = {}
239 223
240 ## Section Sizers (with frame edges and text captions) 224 ## Section Sizers (with frame edges and text captions)
241 self.box_sizers = {} 225 self.box_sizers = {}
242 self.box_sizers["newrepo"] = wx.StaticBox(self, -1, "Add New Repo") 226 self.box_sizers["newbutton"] = wx.StaticBox(self, -1)
243 self.box_sizers["repolist"] = wx.StaticBox(self, -1, "Current Repo List") 227 self.box_sizers["repolist"] = wx.StaticBox(self, -1, "Current Repo List")
244 228
245 ## Layout Sizers 229 ## Layout Sizers
246 self.sizers = {} 230 self.sizers = {}
247 self.sizers["main"] = wx.GridBagSizer(hgap=2, vgap=2) 231 self.sizers["main"] = wx.GridBagSizer(hgap=2, vgap=2)
248 self.sizers["newrepo"] = wx.StaticBoxSizer(self.box_sizers["newrepo"], wx.VERTICAL) 232 self.sizers["repo"] = wx.GridBagSizer(hgap=2, vgap=2)
233 self.sizers["button"] = wx.GridBagSizer(hgap=2, vgap=2)
234
235 self.sizers["newbutton"] = wx.StaticBoxSizer(self.box_sizers["newbutton"], wx.VERTICAL)
236
249 self.sizers["repolist"] = wx.StaticBoxSizer(self.box_sizers["repolist"], wx.VERTICAL) 237 self.sizers["repolist"] = wx.StaticBoxSizer(self.box_sizers["repolist"], wx.VERTICAL)
250 238
251 #Build Server Sizer Layout 239 #Button Layout
252 self.sizers["newrepo_layout"] = wx.FlexGridSizer(rows=1, cols=2, hgap=2, vgap=1) 240 #self.buttonpanel = wx.Panel(upmana.updatemana.Repos, -1)
241 self.sizers["newrepo_layout"] = wx.FlexGridSizer(rows=1, cols=2, hgap=2, vgap=5)
242 empty = wx.StaticText(self, -1, "")
253 reponame = wx.StaticText(self, -1, "Name:") 243 reponame = wx.StaticText(self, -1, "Name:")
254 self.texts["reponame"] = wx.TextCtrl(self, -1) 244 self.texts["reponame"] = wx.TextCtrl(self, -1, '')
255 repodesc = wx.StaticText(self, -1, "Description:") 245 self.buttons['addrepo'] = wx.Button(self, wx.ID_NEW)
256 self.texts["repodesc"] = wx.TextCtrl(self, -1) 246 ##Build Button
257 repoadd = wx.StaticText(self, -1, "Address:") 247 self.sizers["newrepo_layout"].Add(self.buttons['addrepo'], -1, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
258 self.texts["repoadd"] = wx.TextCtrl(self, -1) 248 self.sizers["newrepo_layout"].Add(empty, -1)
259 addrepo = wx.Button(self, wx.ID_ADD) 249 self.sizers["newrepo_layout"].Add(reponame, -1, wx.ALIGN_CENTER|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
260
261 ##Put GUI Together.
262 self.sizers["newrepo_layout"].Add(reponame, -1, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
263 self.sizers["newrepo_layout"].Add(self.texts["reponame"], -1, wx.EXPAND) 250 self.sizers["newrepo_layout"].Add(self.texts["reponame"], -1, wx.EXPAND)
264 self.sizers["newrepo_layout"].Add(repodesc, -1, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
265 self.sizers["newrepo_layout"].Add(self.texts["repodesc"], -1, wx.EXPAND)
266 self.sizers["newrepo_layout"].Add(repoadd, -1, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
267 self.sizers["newrepo_layout"].Add(self.texts["repoadd"], -1, wx.EXPAND)
268 self.sizers["newrepo_layout"].Add(addrepo, -1)
269 self.sizers["newrepo_layout"].AddGrowableCol(1) 251 self.sizers["newrepo_layout"].AddGrowableCol(1)
270 self.sizers["newrepo"].Add(self.sizers["newrepo_layout"], -1, wx.EXPAND) 252 self.sizers["newbutton"].Add(self.sizers["newrepo_layout"], -1, wx.EXPAND)
271 253
272 #Repo List Layout 254 #Repo List Layout
273 self.sizers["repolist_layout"] = wx.FlexGridSizer(rows=1, cols=2, hgap=2, vgap=1) 255 ##Needs a new Panel
274 #addrepo = wx.Button(self, wx.ID_ADD) ## Looks bad inside the Sizer, move out! 256
275 #self.sizers["repolist_layout"].Add(addrepo, -1) 257 self.sizers["repolist_layout"] = wx.FlexGridSizer(rows=1, cols=1, hgap=2, vgap=5)
276 self.sizers["repolist_layout"].AddGrowableCol(1) 258 self.manifest = manifest
259
260 self.repolist = []
261 for v in self.manifest.GetList('UpdateManifest', 'repolist', ''): self.repolist.append(v)
262
263 self.id = 1; self.box = {}; self.main = {}; self.container = {}; self.layout = {}
264 self.name = {}; self.url = {}; self.pull = {}; self.uri = {}; self.delete = {}
265 self.defaultcheck = {}; self.default = {}
266
267 #wx.Yeild() For future refrence.
268
269 #Repo Name; Static Text; URL; Button.
270 for repo in self.repolist:
271 self.box[self.id] = wx.StaticBox(self, -1, str(repo))
272 self.main[self.id] = wx.GridBagSizer(hgap=2, vgap=2)
273 self.container[self.id] = wx.StaticBoxSizer(self.box[self.id], wx.VERTICAL)
274
275 self.layout[self.id] = wx.FlexGridSizer(rows=1, cols=4, hgap=2, vgap=5)
276 self.name[self.id] = wx.StaticText(self, -1, 'URL')
277 self.uri[self.id] = self.manifest.GetString('updaterepo', repo, '')
278 self.url[self.id] = wx.TextCtrl(self, -1, self.uri[self.id])
279 self.pull[self.id] = wx.Button(self, wx.ID_REFRESH)
280 self.delete[self.id] = wx.Button(self, wx.ID_DELETE)
281 self.defaultcheck[self.id] = wx.CheckBox(self, -1)
282 self.default[self.id] = wx.StaticText(self, -1, 'Default')
283
284 self.layout[self.id].Add(self.name[self.id], -1, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
285 self.layout[self.id].Add(self.url[self.id], -1, wx.EXPAND)
286 self.layout[self.id].Add(self.pull[self.id], -1, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
287 self.layout[self.id].Add(self.delete[self.id], -1, wx.EXPAND)
288 self.layout[self.id].Add(self.defaultcheck[self.id], -1, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
289 self.layout[self.id].Add(self.default[self.id], -1, wx.EXPAND)
290 self.layout[self.id].AddGrowableCol(1)
291 self.container[self.id].Add(self.layout[self.id], -1, wx.EXPAND)
292 self.sizers["repolist_layout"].Add(self.container[self.id], -1, wx.EXPAND)
293
294 self.sizers["repolist_layout"].AddGrowableCol(0)
277 self.sizers["repolist"].Add(self.sizers["repolist_layout"], -1, wx.EXPAND) 295 self.sizers["repolist"].Add(self.sizers["repolist_layout"], -1, wx.EXPAND)
278 296
279 """
280 grid = wx.GridSizer(3, 2)
281
282 grid.AddMany([(wx.Button(self, wx.ID_CANCEL), 0, wx.TOP | wx.LEFT, 9),
283 (wx.Button(self, wx.ID_DELETE), 0, wx.TOP, 9),
284 (wx.Button(self, wx.ID_SAVE), 0, wx.LEFT, 9),
285 (wx.Button(self, wx.ID_EXIT)),
286 (wx.Button(self, wx.ID_STOP), 0, wx.LEFT, 9),
287 (wx.Button(self, wx.ID_NEW))])
288
289 self.Bind(wx.EVT_BUTTON, self.OnQuit, id=wx.ID_EXIT)
290 self.SetSizer(grid)
291 self.Centre()
292 self.Show(True)
293
294
295 def OnQuit(self, event):
296 self.Close()
297 """
298
299 #Build Main Sizer 297 #Build Main Sizer
300 self.sizers["main"].Add(self.sizers["newrepo"], (0,0), flag=wx.EXPAND) 298 self.sizers["main"].Add(self.sizers["newbutton"], (0,0), flag=wx.EXPAND)
301 self.sizers["main"].Add(self.sizers["repolist"], (1,0), flag=wx.EXPAND) 299 self.sizers["main"].Add(self.sizers["repolist"], (1,0), flag=wx.EXPAND)
300 #self.sizers['main'].Add(self.buttonpanel, (0,0), flag=wx.EXPAND)
301 #self.sizers['main'].Add(self.sizers['repo'], (1,0), flag=wx.EXPAND)
302 self.sizers["main"].AddGrowableCol(0) 302 self.sizers["main"].AddGrowableCol(0)
303 self.sizers["main"].AddGrowableCol(1) 303 self.sizers["main"].AddGrowableCol(1)
304 #self.sizers["main"].AddGrowableRow(1) 304 self.sizers["main"].AddGrowableRow(1)
305 self.SetSizer(self.sizers["main"]) 305 self.SetSizer(self.sizers["main"])
306
306 self.SetAutoLayout(True) 307 self.SetAutoLayout(True)
307 self.Fit() 308 self.Fit()
309
310 self.Bind(wx.EVT_BUTTON, self.AddRepo, self.buttons['addrepo'])
311
312 def AddRepo(self, event):
313 repo = self.texts['reponame'].GetValue(); repo = repo.replace(' ', '_'); repo = 'repo-' + repo
314 #self.manifest.SetString('updaterepo', repo, ''); repo = repo.split(',') #Sets URL
315 repolist = self.manifest.GetList('UpdateManifest', 'repolist', ''); repo = repolist + repo
316 self.manifest.SetList('UpdateManifest', 'repolist', repo)
317
308 318
309 class Manifest(wx.Panel): 319 class Manifest(wx.Panel):
310 def __init__(self, parent): 320 def __init__(self, parent):
311 wx.Panel.__init__(self, parent) 321 wx.Panel.__init__(self, parent)
312 self.ui = ui.ui() 322 self.ui = ui.ui()
313 self.repo = hg.repository(self.ui, ".") 323 self.repo = hg.repository(self.ui, ".")
314 self.c = self.repo.changectx('tip') 324 self.c = self.repo.changectx('tip')
315 self.manifest = [] 325 self.manifestlist = []
316 self.manifest = self.c.manifest().keys() 326 self.manifestlist = self.c.manifest().keys()
317 self.manifest.sort() 327 self.manifestlist.sort()
318 self.SetBackgroundColour(wx.WHITE) 328 self.SetBackgroundColour(wx.WHITE)
319 self.sizer = wx.GridBagSizer(hgap=1, vgap=1) 329 self.sizer = wx.GridBagSizer(hgap=1, vgap=1)
320 330
321 self.manifestlog = wx.TextCtrl(self, wx.ID_ANY, size=(400, -1), style=wx.TE_MULTILINE | wx.TE_READONLY) 331 #self.manifestlog = wx.TextCtrl(self, wx.ID_ANY, size=(400, -1), style=wx.TE_MULTILINE | wx.TE_READONLY)
332 self.manifestlog = wx.ListCtrl( self, -1, size=(400, -1) )
333 self.manifestlog.InsertColumn( 0, "ID" )
334 self.manifestlog.InsertColumn( 1, "Player" )
335 self.manifestlog.SetStringItem(0,1,'dog')
322 336
323 self.sizer.Add(self.manifestlog, (0,0), flag=wx.EXPAND) 337 self.sizer.Add(self.manifestlog, (0,0), flag=wx.EXPAND)
324
325 self.sizer.AddGrowableCol(0) 338 self.sizer.AddGrowableCol(0)
326 self.sizer.AddGrowableRow(0) 339 self.sizer.AddGrowableRow(0)
327 self.SetSizer(self.sizer) 340 self.SetSizer(self.sizer)
328 self.SetAutoLayout(True) 341 self.SetAutoLayout(True)
329 self.BuildManifest() 342 #self.BuildManifest()
330
331 343
332 def BuildManifest(self): 344 def BuildManifest(self):
333 self.manifestlog.SetValue('') 345 self.manifestlog.SetValue('')
334 self.manifestlog.AppendText('Currently the Manifest Log shows your files only, later you will be able to select files to ingore on update\n') 346 self.manifestlog.AppendText('Currently the Manifest Log shows your files only, later you will be able to select files to ingore on update\n')
335 for i in self.manifest: 347 for i in self.manifestlist:
336 self.manifestlog.AppendText(i + '\n') 348 self.manifestlog.AppendText(i + '\n')
337 349
338 class Control(wx.Panel): 350 class Control(wx.Panel):
339 def __init__(self, parent): 351 def __init__(self, parent):
340 wx.Panel.__init__(self, parent) 352 wx.Panel.__init__(self, parent)
341 t = wx.StaticText(self, -1, "Here you will be able to control your branches, delete branches, \nupdate to a sepcific revision, and that type of control.", (10,60)) 353 t = wx.StaticText(self, -1, "Here you will be able to control your branches, delete branches, \nupdate to a sepcific revision, and that type of control.", (10,60))
342 354
343 355
344 class updaterFrame(wx.Frame): 356 class updaterFrame(wx.Frame):
345 def __init__(self, parent, title, openrpg): 357 def __init__(self, parent, title, openrpg, manifest):
346 wx.Frame.__init__(self, None, wx.ID_ANY, title, size=(640,480), 358 wx.Frame.__init__(self, None, wx.ID_ANY, title, size=(640,480),
347 style=wx.FRAME_NO_TASKBAR | wx.STAY_ON_TOP | wx.DEFAULT_FRAME_STYLE) 359 style=wx.FRAME_NO_TASKBAR | wx.STAY_ON_TOP | wx.DEFAULT_FRAME_STYLE)
348 360
349 self.CenterOnScreen() 361 self.CenterOnScreen()
350 362
351 ####### Panel Stuff ###### 363 ####### Panel Stuff ######
352 p = wx.Panel(self) 364 p = wx.Panel(self)
353 nb = wx.Notebook(p) 365 nb = wx.Notebook(p)
354 366
355 # create the page windows as children of the notebook 367 # create the page windows as children of the notebook
356 page1 = Updater(nb, openrpg) 368 page1 = Updater(nb, openrpg, manifest)
357 page2 = Repos(nb, openrpg) 369 page2 = Repos(nb, openrpg, manifest)
358 page3 = Manifest(nb) 370 page3 = Manifest(nb)
359 page4 = Control(nb) 371 page4 = Control(nb)
360 372
361 # add the pages to the notebook with the label to show on the tab 373 # add the pages to the notebook with the label to show on the tab
362 nb.AddPage(page1, "Updater") 374 nb.AddPage(page1, "Updater")
367 # finally, put the notebook in a sizer for the panel to manage 379 # finally, put the notebook in a sizer for the panel to manage
368 # the layout 380 # the layout
369 sizer = wx.BoxSizer() 381 sizer = wx.BoxSizer()
370 sizer.Add(nb, 1, wx.EXPAND) 382 sizer.Add(nb, 1, wx.EXPAND)
371 p.SetSizer(sizer) 383 p.SetSizer(sizer)
372
373
374 384
375 class updateApp(wx.App): 385 class updateApp(wx.App):
376 def OnInit(self): 386 def OnInit(self):
377 self.open_rpg = open_rpg 387 self.open_rpg = open_rpg
378 self.log = orpg.tools.orpg_log.orpgLog(orpg.dirpath.dir_struct["user"] + "runlogs/") 388 self.log = orpg.tools.orpg_log.orpgLog(orpg.dirpath.dir_struct["user"] + "runlogs/")
379 self.log.setLogToConsol(False) 389 self.log.setLogToConsol(False)
380 self.log.log("Updater Start", ORPG_NOTE) 390 self.log.log("Updater Start", ORPG_NOTE)
381 391 self.manifest = manifest.ManifestChanges()
382 #Add the initial global components of the openrpg class
383 #Every class should be passed openrpg
384 self.open_rpg.add_component("log", self.log) 392 self.open_rpg.add_component("log", self.log)
385 self.open_rpg.add_component("xml", orpg.orpg_xml) 393 self.open_rpg.add_component("xml", orpg.orpg_xml)
386 self.open_rpg.add_component("dir_struct", orpg.dirpath.dir_struct) 394 self.open_rpg.add_component("dir_struct", orpg.dirpath.dir_struct)
387 self.validate = orpg.tools.validate.Validate() 395 self.validate = orpg.tools.validate.Validate()
388 self.open_rpg.add_component("validate", self.validate) 396 self.open_rpg.add_component("validate", self.validate)
389 #self.settings = orpg.tools.orpg_settings.orpgSettings(self.open_rpg) 397 self.updater = updaterFrame(self, "OpenRPG Update Manager Beta 0.3", self.open_rpg, self.manifest)
390 #self.open_rpg.add_component("settings", self.settings)
391 #self.settings.updateIni()
392 self.updater = updaterFrame(self, "OpenRPG Update Manager Beta 0.3", self.open_rpg)
393 self.updated = False 398 self.updated = False
394 try: 399 try:
395 self.updater.Show() 400 self.updater.Show()
396 self.SetTopWindow(self.updater) 401 self.SetTopWindow(self.updater)
397 self.updater.Fit() 402 self.updater.Fit()