Mercurial > traipse
comparison upmana/updatemana.py @ 18:97265586402b ornery-orc
Traipse 'OpenRPG' {090827-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:
Update Manager is now in version 0.8. While not every button works, users can now browse the different revisions and their different changesets. The code has been refined some with feature from Core added to it. A Crash report is now created if the users software crashes. Update Manager has been moved to the Traipse Suite menu item, and a Debug Console as been added as well.
author | sirebral |
---|---|
date | Thu, 27 Aug 2009 01:04:43 -0500 |
parents | 265b987cce4f |
children | 8b168989c344 |
comparison
equal
deleted
inserted
replaced
17:265b987cce4f | 18:97265586402b |
---|---|
1 import wx | 1 import wx |
2 import sys | |
3 import os #just .sep maybe | |
2 import manifest | 4 import manifest |
3 import orpg.dirpath | |
4 from orpg.orpgCore import * | |
5 import orpg.orpg_version | |
6 import orpg.tools.orpg_log | |
7 import orpg.orpg_xml | |
8 import orpg.dirpath | |
9 import upmana.validate | |
10 import tempfile | |
11 import shutil | 5 import shutil |
6 | |
7 from orpg.orpgCore import component | |
8 from orpg.dirpath import dir_struct | |
9 from orpg.tools.orpg_log import logger, crash | |
10 from orpg.tools.decorators import debugging | |
11 from upmana.validate import validate | |
12 from orpg.dirpath import dir_struct | |
12 from mercurial import ui, hg, commands, repo, revlog, cmdutil, util | 13 from mercurial import ui, hg, commands, repo, revlog, cmdutil, util |
13 | 14 |
14 | 15 |
15 class Updater(wx.Panel): | 16 class Updater(wx.Panel): |
16 def __init__(self, parent, open_rpg, manifest): | 17 @debugging |
18 def __init__(self, parent, component, manifest): | |
17 wx.Panel.__init__(self, parent) | 19 wx.Panel.__init__(self, parent) |
18 | 20 |
19 ### Update Manager | 21 ### Update Manager |
20 self.ui = ui.ui() | 22 self.ui = ui.ui() |
21 self.repo = hg.repository(self.ui, ".") | 23 self.repo = hg.repository(self.ui, ".") |
22 self.c = self.repo.changectx('tip') | 24 self.c = self.repo.changectx('tip') |
23 self.manifest = manifest | 25 self.manifest = manifest |
24 self.xml = open_rpg.get_component('xml') | |
25 self.dir_struct = open_rpg.get_component("dir_struct") | |
26 self.parent = parent | 26 self.parent = parent |
27 self.log = open_rpg.get_component("log") | |
28 self.log.log("Enter updaterFrame", ORPG_DEBUG) | |
29 self.SetBackgroundColour(wx.WHITE) | 27 self.SetBackgroundColour(wx.WHITE) |
30 self.sizer = wx.GridBagSizer(hgap=1, vgap=1) | 28 self.sizer = wx.GridBagSizer(hgap=1, vgap=1) |
31 self.changelog = wx.TextCtrl(self, wx.ID_ANY, size=(325, -1), style=wx.TE_MULTILINE | wx.TE_READONLY) | 29 self.changelog = wx.TextCtrl(self, wx.ID_ANY, size=(325, -1), style=wx.TE_MULTILINE | wx.TE_READONLY) |
32 self.filelist = wx.TextCtrl(self, wx.ID_ANY, size=(275, 300), style=wx.TE_MULTILINE | wx.TE_READONLY) | 30 self.filelist = wx.TextCtrl(self, wx.ID_ANY, size=(275, 300), style=wx.TE_MULTILINE | wx.TE_READONLY) |
33 self.buttons = {} | 31 self.buttons = {} |
91 | 89 |
92 def Update(self, evt=None): | 90 def Update(self, evt=None): |
93 self.ui = ui.ui() | 91 self.ui = ui.ui() |
94 self.repo = hg.repository(self.ui, ".") | 92 self.repo = hg.repository(self.ui, ".") |
95 self.c = self.repo.changectx('tip') | 93 self.c = self.repo.changectx('tip') |
96 | |
97 filename = 'ignorelist.txt' | 94 filename = 'ignorelist.txt' |
98 self.filename = orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + filename | 95 self.filename = dir_struct["home"] + 'upmana' + os.sep + filename |
99 upmana.validate.Validate(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep).config_file(filename, "default_ignorelist.txt") | 96 component.get('validate').config_file(filename, "default_ignorelist.txt") |
100 self.mana = self.LoadDoc() | 97 self.mana = self.LoadDoc() |
98 temp = dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep | |
101 for ignore in self.ignorelist: | 99 for ignore in self.ignorelist: |
102 shutil.copy(ignore, orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep +ignore.split('/')[len(ignore.split('/')) - 1]) | 100 shutil.copy(ignore, temp + ignore.split('/')[len(ignore.split('/')) - 1]) |
103 hg.clean(self.repo, self.current) | 101 hg.clean(self.repo, self.current) |
104 for ignore in self.ignorelist: | 102 for ignore in self.ignorelist: |
105 shutil.copyfile(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep + ignore.split('/')[len(ignore.split('/')) - 1], ignore) | 103 shutil.copyfile(temp + ignore.split('/')[len(ignore.split('/')) - 1], ignore) |
106 os.remove(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep + ignore.split('/')[len(ignore.split('/')) - 1]) | 104 os.remove(temp + ignore.split('/')[len(ignore.split('/')) - 1]) |
107 | 105 |
108 def LoadDoc(self): | 106 def LoadDoc(self): |
109 ignore = open(self.filename) | 107 ignore = open(self.filename) |
110 self.ignorelist = [] | 108 self.ignorelist = [] |
111 for i in ignore: self.ignorelist.append(str(i [:len(i)-1])) | 109 for i in ignore: self.ignorelist.append(str(i [:len(i)-1])) |
117 except: | 115 except: |
118 print 'Fail'; exit() | 116 print 'Fail'; exit() |
119 | 117 |
120 def ChooseBranch(self, evt=None): | 118 def ChooseBranch(self, evt=None): |
121 dlg = wx.Dialog(self, wx.ID_ANY, "Package Selector", style=wx.DEFAULT_DIALOG_STYLE) | 119 dlg = wx.Dialog(self, wx.ID_ANY, "Package Selector", style=wx.DEFAULT_DIALOG_STYLE) |
122 if wx.Platform == '__WXMSW__': icon = wx.Icon(self.dir_struct["icon"]+'d20.ico', wx.BITMAP_TYPE_ICO) | 120 if wx.Platform == '__WXMSW__': icon = wx.Icon(dir_struct["icon"]+'d20.ico', wx.BITMAP_TYPE_ICO) |
123 else: icon = wx.Icon(self.dir_struct["icon"]+"d20.xpm", wx.BITMAP_TYPE_XPM ) | 121 else: icon = wx.Icon(dir_struct["icon"]+"d20.xpm", wx.BITMAP_TYPE_XPM ) |
124 dlg.SetIcon(icon) | 122 dlg.SetIcon(icon) |
125 | 123 |
126 self.ui = ui.ui() | 124 self.ui = ui.ui() |
127 self.repo = hg.repository(self.ui, ".") | 125 self.repo = hg.repository(self.ui, ".") |
128 self.c = self.repo.changectx('tip') | 126 self.c = self.repo.changectx('tip') |
174 branches = dict.copy(self.repo.branchtags()) | 172 branches = dict.copy(self.repo.branchtags()) |
175 self.BranchInfo(self.current) | 173 self.BranchInfo(self.current) |
176 | 174 |
177 def BranchInfo(self, branch): | 175 def BranchInfo(self, branch): |
178 cs = self.repo.changectx( self.current ).changeset() | 176 cs = self.repo.changectx( self.current ).changeset() |
179 rev = self.repo.changelog.rev(self.repo.branchtags()[self.current]) #Current revision number. Use in Controls | |
180 self.changelog.SetValue('') | 177 self.changelog.SetValue('') |
181 changelog = cs[4] | 178 changelog = cs[4] |
182 self.changelog.AppendText(changelog + '\n') | 179 self.changelog.AppendText(changelog + '\n') |
183 self.filelist.SetValue('') | 180 self.filelist.SetValue('') |
184 self.filelist.AppendText("Currently selected branch: " + branch + "\n\nAuthor: "+cs[1]+"\n\nFiles Modified (in update): \n") | 181 self.filelist.AppendText("Currently selected branch: " + branch + "\n\nAuthor: "+cs[1]+"\n\n") |
182 self.filelist.AppendText("Files Modified (in update): \n") | |
185 for f in cs[3]: self.filelist.AppendText(f+"\n") | 183 for f in cs[3]: self.filelist.AppendText(f+"\n") |
186 | 184 |
187 def get_packages(self, type=None): | 185 def get_packages(self, type=None): |
188 #Fixed and ready for Test. Can be cleaner | 186 #Fixed and ready for Test. Can be cleaner |
189 self.package_list = [] | 187 self.package_list = [] |
368 self.manifestlist = self.c.manifest().keys() | 366 self.manifestlist = self.c.manifest().keys() |
369 for mana in self.manifestlist: mana = os.sep + 'orpg' + os.sep + mana | 367 for mana in self.manifestlist: mana = os.sep + 'orpg' + os.sep + mana |
370 self.manifestlist.sort() | 368 self.manifestlist.sort() |
371 self.SetBackgroundColour(wx.WHITE) | 369 self.SetBackgroundColour(wx.WHITE) |
372 self.sizer = wx.GridBagSizer(hgap=1, vgap=1) | 370 self.sizer = wx.GridBagSizer(hgap=1, vgap=1) |
373 self.manifestlog = wx.CheckListBox( self, -1, wx.DefaultPosition, wx.DefaultSize, self.manifestlist, | 371 self.manifestlog = wx.CheckListBox( self, -1, wx.DefaultPosition, wx.DefaultSize, |
374 wx.LC_REPORT|wx.SUNKEN_BORDER|wx.EXPAND|wx.LC_HRULES) | 372 self.manifestlist, wx.LC_REPORT|wx.SUNKEN_BORDER|wx.EXPAND|wx.LC_HRULES) |
375 filename = 'ignorelist.txt' | 373 filename = 'ignorelist.txt' |
376 self.filename = orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + filename | 374 self.filename = dir_struct["home"] + 'upmana' + os.sep + filename |
377 upmana.validate.Validate(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep).config_file(filename, "default_ignorelist.txt") | 375 component.get('validate').config_file(filename, "default_ignorelist.txt") |
378 self.mana = self.LoadDoc() | 376 self.mana = self.LoadDoc() |
379 self.manifestlog.Bind(wx.EVT_CHECKLISTBOX, self.GetChecked) | 377 self.manifestlog.Bind(wx.EVT_CHECKLISTBOX, self.GetChecked) |
380 self.sizer.Add(self.manifestlog, (0,0), flag=wx.EXPAND) | 378 self.sizer.Add(self.manifestlog, (0,0), flag=wx.EXPAND) |
381 self.sizer.AddGrowableCol(0) | 379 self.sizer.AddGrowableCol(0) |
382 self.sizer.AddGrowableRow(0) | 380 self.sizer.AddGrowableRow(0) |
408 | 406 |
409 class Control(wx.Panel): | 407 class Control(wx.Panel): |
410 def __init__(self, parent): | 408 def __init__(self, parent): |
411 wx.Panel.__init__(self, parent) | 409 wx.Panel.__init__(self, parent) |
412 | 410 |
411 ### Control Panel | |
412 self.ui = ui.ui() | |
413 self.repo = hg.repository(self.ui, ".") | |
414 self.c = self.repo.changectx('tip') | |
415 self.manifest = manifest | |
416 self.parent = parent | |
417 #logger.debug("Enter updaterFrame") #Need to set logging level | |
418 | |
419 self.get_packages() | |
420 self.SetBackgroundColour(wx.WHITE) | |
421 self.sizer = wx.GridBagSizer(hgap=1, vgap=1) | |
422 self.buttons = {} | |
423 | |
424 ## Changelog / File List | |
425 changelogcp = wx.Panel(self) | |
426 self.changelogcp = wx.GridBagSizer(hgap=1, vgap=1) | |
427 self.changelog = wx.TextCtrl(changelogcp, wx.ID_ANY, size=wx.DefaultSize, style=wx.TE_MULTILINE | wx.TE_READONLY) | |
428 self.filelist = wx.TextCtrl(changelogcp, wx.ID_ANY, size=wx.DefaultSize, style=wx.TE_MULTILINE | wx.TE_READONLY) | |
429 self.changelogcp.Add(self.changelog, (0,0), flag=wx.EXPAND) | |
430 self.changelogcp.Add(self.filelist, (1,0), flag=wx.EXPAND) | |
431 changelogcp.SetSizer(self.changelogcp) | |
432 self.changelogcp.AddGrowableCol(0) | |
433 self.changelogcp.AddGrowableRow(0) | |
434 self.changelogcp.AddGrowableRow(1) | |
435 changelogcp.SetAutoLayout(True) | |
436 | |
437 ## Branches / Revisions | |
438 branchcp = wx.Panel(self) | |
439 self.branchcp = wx.GridBagSizer(hgap=1, vgap=1) | |
440 self.branches = wx.Choice(branchcp, wx.ID_ANY, choices=self.package_list) | |
441 self.branch_txt = wx.StaticText(branchcp, wx.ID_ANY, "Branches") | |
442 self.branchcp.Add(self.branches, (0,0)) | |
443 self.branchcp.Add(self.branch_txt, (0,1), flag=wx.ALIGN_CENTER_VERTICAL) | |
444 branchcp.SetSizer(self.branchcp) | |
445 branchcp.SetAutoLayout(True) | |
446 | |
447 revlistcp = wx.Panel(self) | |
448 self.revlistcp = wx.GridBagSizer(hgap=2, vgap=2) | |
449 self.revlist = wx.ListCtrl(revlistcp, -1, wx.DefaultPosition, size=wx.DefaultSize, | |
450 style=wx.LC_REPORT|wx.SUNKEN_BORDER|wx.LC_HRULES) | |
451 self.revlist.InsertColumn(0, 'Revs') | |
452 self.revlist.InsertColumn(1, 'Changeset') | |
453 self.revlist.SetColumnWidth(0, -1) | |
454 self.revlist.SetColumnWidth(1, -1) | |
455 self.revlist.Refresh() | |
456 self.revlistcp.Add(self.revlist, (0,0), flag=wx.EXPAND) | |
457 revlistcp.SetSizer(self.revlistcp) | |
458 self.revlistcp.AddGrowableCol(0) | |
459 self.revlistcp.AddGrowableRow(0) | |
460 self.revlistcp.AddGrowableRow(1) | |
461 revlistcp.SetAutoLayout(True) | |
462 | |
463 ## Control Panel | |
464 cp = wx.Panel(self) | |
465 self.cp = wx.GridBagSizer(hgap=1, vgap=1) | |
466 self.buttons['update'] = wx.Button(cp, wx.ID_ANY, "Revision Update") | |
467 self.buttons['delete'] = wx.Button(cp, wx.ID_ANY, "Delete Branch") | |
468 self.cp.Add(self.buttons['update'], (0,0)) | |
469 self.cp.Add(self.buttons['delete'], (0,1)) | |
470 cp.SetSizer(self.cp) | |
471 cp.SetAutoLayout(True) | |
472 | |
473 self.sizer.Add(changelogcp, (0,0), span=(3,1), flag=wx.EXPAND) | |
474 self.sizer.Add(branchcp, (0,1), span=(1,1)) | |
475 self.sizer.Add(revlistcp, (2,1), span=(1,1), flag=wx.EXPAND) | |
476 self.sizer.Add(cp, (1,1), span=(1,1)) | |
477 | |
478 self.buttons['delete'].Disable() | |
479 self.sizer.AddGrowableCol(0) | |
480 self.sizer.AddGrowableCol(1) | |
481 self.sizer.AddGrowableRow(2) | |
482 self.SetSizer(self.sizer) | |
483 self.SetAutoLayout(True) | |
484 | |
485 self.current = self.repo.dirstate.branch() | |
486 self.currev = self.repo.changelog.rev(self.repo.branchtags()[self.current]) | |
487 self.RevInfo(self.currev) | |
488 self.revlist.Select(self.revlist.FindItem(0, str(self.currev), 1)) | |
489 self.BranchInfo(self.current) | |
490 self.Bind(wx.EVT_CHOICE, self.PackageSet) | |
491 self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.RevSet) | |
492 self.Bind(wx.EVT_BUTTON, self.RevUpdate, self.buttons['update']) | |
493 | |
494 | |
495 def PackageSet(self, event): | |
496 self.current = self.branches.GetStringSelection() | |
497 branches = self.repo.branchtags() | |
498 heads = dict.fromkeys(self.repo.heads(), 1) | |
499 l = [((n in heads), self.repo.changelog.rev(n), n, t) for t, n in branches.items()] | |
500 if self.current != type: | |
501 heads = dict.fromkeys(self.repo.heads(), self.repo.branchtags()) | |
502 branches = dict.copy(self.repo.branchtags()) | |
503 self.BranchInfo(self.current) | |
504 self.RevInfo(self.current) | |
505 | |
506 def RevSet(self, event): | |
507 self.currev = self.revlist.GetItemText( self.revlist.GetFirstSelected() ) | |
508 i = event.GetIndex() | |
509 self.revlist.Select(i, True) | |
510 self.revlist.Focus(i) | |
511 if self.currev != self.revlist.GetItemText( self.revlist.GetFirstSelected() ): | |
512 self.RevInfo(self.currev) | |
513 | |
514 def RevInfo(self, rev): | |
515 self.revlist.DeleteAllItems() | |
516 self.revlist_a = []; self.revlist_b = {} | |
517 for heads in self.repo.changelog.reachable(self.repo.branchtags()[self.current]): | |
518 self.revlist_a.append(str(self.repo.changelog.rev(heads))) | |
519 self.revlist_b[str(self.repo.changelog.rev(heads))] = str(self.repo.changectx(heads)) | |
520 self.revlist_a.sort() | |
521 for i in self.revlist_a: | |
522 self.revlist.InsertStringItem(0, str(i), 0 ) | |
523 self.revlist.SetStringItem(0, 1, self.revlist_b[i]) | |
524 self.revlist.SetColumnWidth(0, -1) | |
525 self.revlist.SetColumnWidth(1, -1) | |
526 self.revlist.Refresh() | |
527 self.BranchInfo(self.current) | |
528 | |
529 def BranchInfo(self, branch): | |
530 rs = self.repo.changectx( self.currev ).changeset() | |
531 self.changelog.SetValue('') | |
532 changelog = rs[4] | |
533 self.changelog.AppendText(changelog + '\n') | |
534 self.filelist.SetValue('') | |
535 self.filelist.AppendText("Currently selected branch: " + branch + "\n\nAuthor: "+rs[1]+"\n\n") | |
536 self.filelist.AppendText("Files Modified (in update): \n") | |
537 for f in rs[3]: self.filelist.AppendText(f+"\n") | |
538 | |
539 def DelBranch(self, event): | |
540 pass | |
541 | |
542 def RevUpdate(self, event): | |
543 filename = 'ignorelist.txt' | |
544 self.filename = dir_struct["home"] + 'upmana' + os.sep + filename | |
545 component.get('validate').config_file(filename, "default_ignorelist.txt") | |
546 self.mana = self.LoadDoc() | |
547 temp = dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep | |
548 for ignore in self.ignorelist: | |
549 shutil.copy(ignore, temp + ignore.split('/')[len(ignore.split('/')) - 1]) | |
550 hg.clean(self.repo, self.currev) | |
551 for ignore in self.ignorelist: | |
552 shutil.copyfile(temp + ignore.split('/')[len(ignore.split('/')) - 1], ignore) | |
553 os.remove(temp + ignore.split('/')[len(ignore.split('/')) - 1]) | |
554 pass | |
555 | |
556 def LoadDoc(self): | |
557 ignore = open(self.filename) | |
558 self.ignorelist = [] | |
559 for i in ignore: self.ignorelist.append(str(i [:len(i)-1])) | |
560 manifest = ignore.readlines() | |
561 ignore.close() | |
562 | |
563 def get_packages(self, type=None): | |
564 #Fixed and ready for Test. Can be cleaner | |
565 self.package_list = [] | |
566 b = self.repo.branchtags() | |
567 heads = dict.fromkeys(self.repo.heads(), 1) #The code below looks superfluous but there is good info inside | |
568 l = [((n in heads), self.repo.changelog.rev(n), n, t) for t, n in b.items()] | |
569 l.sort() | |
570 l.reverse() | |
571 for ishead, r, n, t in l: self.package_list.append(t) | |
572 | |
573 def get_package(self): | |
574 self.get_packages() | |
575 if self.package_list == None: return None | |
576 return None | |
413 | 577 |
414 class updaterFrame(wx.Frame): | 578 class updaterFrame(wx.Frame): |
415 def __init__(self, parent, title, openrpg, manifest, main): | 579 def __init__(self, parent, title, openrpg, manifest, main): |
416 self.dir_struct = open_rpg.get_component("dir_struct") | |
417 | 580 |
418 wx.Frame.__init__(self, None, wx.ID_ANY, title, size=(600,480), style=wx.DEFAULT_FRAME_STYLE) | 581 wx.Frame.__init__(self, None, wx.ID_ANY, title, size=(600,480), style=wx.DEFAULT_FRAME_STYLE) |
419 if wx.Platform == '__WXMSW__': icon = wx.Icon(self.dir_struct["icon"]+'d20.ico', wx.BITMAP_TYPE_ICO) | 582 if wx.Platform == '__WXMSW__': icon = wx.Icon(dir_struct["icon"]+'d20.ico', wx.BITMAP_TYPE_ICO) |
420 else: icon = wx.Icon(self.dir_struct["icon"]+"d20.xpm", wx.BITMAP_TYPE_XPM ) | 583 else: icon = wx.Icon(dir_struct["icon"]+"d20.xpm", wx.BITMAP_TYPE_XPM ) |
584 | |
421 self.SetIcon(icon) | 585 self.SetIcon(icon) |
422 | |
423 self.CenterOnScreen() | 586 self.CenterOnScreen() |
424 self.main = main | 587 self.main = main |
425 ####### Panel Stuff ###### | 588 ####### Panel Stuff ###### |
426 p = wx.Panel(self) | 589 p = wx.Panel(self) |
427 nb = wx.Notebook(p) | 590 nb = wx.Notebook(p) |
449 if self.main == False: self.Destroy() | 612 if self.main == False: self.Destroy() |
450 if self.main == True: self.Hide() | 613 if self.main == True: self.Hide() |
451 | 614 |
452 class updateApp(wx.App): | 615 class updateApp(wx.App): |
453 def OnInit(self): | 616 def OnInit(self): |
454 self.open_rpg = open_rpg | |
455 self.main = False | 617 self.main = False |
456 self.log = orpg.tools.orpg_log.orpgLog(orpg.dirpath.dir_struct["user"] + "runlogs/") | 618 logger._set_log_to_console(False) |
457 self.log.setLogToConsol(False) | 619 logger.note("Updater Start") |
458 self.log.log("Updater Start", ORPG_NOTE) | |
459 self.manifest = manifest.ManifestChanges() | 620 self.manifest = manifest.ManifestChanges() |
460 self.open_rpg.add_component("log", self.log) | 621 component.add('validate', validate) |
461 self.open_rpg.add_component("xml", orpg.orpg_xml) | 622 self.updater = updaterFrame(self, "OpenRPG Update Manager 0.8 (open beta)", |
462 self.open_rpg.add_component("dir_struct", orpg.dirpath.dir_struct) | 623 component, self.manifest, self.main) |
463 self.validate = upmana.validate.Validate() | |
464 self.open_rpg.add_component("validate", self.validate) | |
465 self.updater = updaterFrame(self, "OpenRPG Update Manager 0.7.2 (open beta)", self.open_rpg, self.manifest, self.main) | |
466 if self.manifest.GetString("updatemana", "auto_update", "") == 'on' and self.main == False: | 624 if self.manifest.GetString("updatemana", "auto_update", "") == 'on' and self.main == False: |
467 self.AutoUpdate(); self.OnExit() | 625 self.AutoUpdate(); self.OnExit() |
468 else: pass | 626 else: pass |
469 if self.manifest.GetString('updatemana', 'no_update', '') == 'on' and self.main == False: | 627 if self.manifest.GetString('updatemana', 'no_update', '') == 'on' and self.main == False: |
470 self.OnExit() | 628 self.OnExit() |
483 | 641 |
484 capture = self.manifest.GetString('updaterepo', 'default', '') | 642 capture = self.manifest.GetString('updaterepo', 'default', '') |
485 if capture != '': | 643 if capture != '': |
486 commands.pull(self.ui, self.repo, capture, rev='', update=False, force=True) | 644 commands.pull(self.ui, self.repo, capture, rev='', update=False, force=True) |
487 filename = 'ignorelist.txt' | 645 filename = 'ignorelist.txt' |
488 self.filename = orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + filename | 646 self.filename = dir_struct["home"] + 'upmana' + os.sep + filename |
489 upmana.validate.Validate(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep).config_file(filename, "default_ignorelist.txt") | 647 component.get('validate').config_file(filename, "default_ignorelist.txt") |
490 self.mana = self.LoadDoc() | 648 self.mana = self.LoadDoc() |
649 temp = dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep | |
491 for ignore in self.ignorelist: | 650 for ignore in self.ignorelist: |
492 shutil.copy(ignore, orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep +ignore.split('/')[len(ignore.split('/')) - 1]) | 651 shutil.copy(ignore, temp + ignore.split('/')[len(ignore.split('/')) - 1]) |
493 hg.clean(self.repo, self.current) | 652 hg.clean(self.repo, self.current) |
494 for ignore in self.ignorelist: | 653 for ignore in self.ignorelist: |
495 print ignore.split('/')[len(ignore.split('/')) - 1] | 654 shutil.copyfile(temp + ignore.split('/')[len(ignore.split('/')) - 1], ignore) |
496 shutil.copyfile(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep + ignore.split('/')[len(ignore.split('/')) - 1], ignore) | 655 os.remove(temp + ignore.split('/')[len(ignore.split('/')) - 1]) |
497 os.remove(orpg.dirpath.dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep + ignore.split('/')[len(ignore.split('/')) - 1]) | 656 else: wx.MessageBox('No default Rpository set. Skipping Auto Update!', 'Info') |
498 else: print 'No default repository set, skipping Auto Update!' | |
499 | 657 |
500 def LoadDoc(self): | 658 def LoadDoc(self): |
501 ignore = open(self.filename) | 659 ignore = open(self.filename) |
502 self.ignorelist = [] | 660 self.ignorelist = [] |
503 for i in ignore: self.ignorelist.append(str(i [:len(i)-1])) | 661 for i in ignore: self.ignorelist.append(str(i [:len(i)-1])) |
504 manifest = ignore.readlines() | 662 manifest = ignore.readlines() |
505 ignore.close() | 663 ignore.close() |
506 | 664 |
507 def OnExit(self): | 665 def OnExit(self): |
508 imported = ['manifest', 'orpg.dirpath', 'orpg.orpgCore', 'orpg.orpg_version', 'orpg.tools.orpg_log', 'orpg.tools.orpg_log', 'orpg.orpg_xml', 'orpg.dirpath', 'orpg.dirpath', 'upmana.validate', 'mercurial.ui', 'mercurial.hg', 'mercurial.commands', 'mercurial.repo', 'mercurial.revlog', 'mercurial.cmdutil', 'shutil'] | 666 imported = ['manifest', 'orpg.dirpath', 'orpg.orpgCore', 'orpg.orpg_version', |
667 'orpg.tools.orpg_log', 'orpg.tools.orpg_log', 'orpg.orpg_xml', 'orpg.dirpath', | |
668 'orpg.dirpath', 'upmana.validate', 'mercurial.ui', 'mercurial.hg', | |
669 'mercurial.commands', 'mercurial.repo', 'mercurial.revlog', 'mercurial.cmdutil', 'shutil'] | |
509 for name in imported: | 670 for name in imported: |
510 if name in sys.modules: del sys.modules[name] | 671 if name in sys.modules: del sys.modules[name] |
511 | 672 |
512 try: self.updater.Destroy() | 673 try: self.updater.Destroy() |
513 except: pass | 674 except: pass |