Mercurial > traipse_dev
annotate orpg/tools/updater.py @ 28:6ef4bb8ee8ca traipse_dev
Update Manager Beta 0.1 release!! This new update manager is a boon
for devs and users. This is working code and nothing more, it is 'Beta'.
author | sirebral |
---|---|
date | Sat, 01 Aug 2009 14:38:19 -0500 |
parents | |
children | 3769c8d6431e |
rev | line source |
---|---|
28
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
1 import wx |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
2 import wx.html |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
3 import webbrowser |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
4 import urllib |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
5 import zipfile |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
6 import traceback |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
7 import hashlib |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
8 import orpg.dirpath |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
9 from orpg.orpgCore import * |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
10 import orpg.orpg_version |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
11 import orpg.tools.orpg_log |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
12 import orpg.orpg_xml |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
13 import orpg.dirpath |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
14 import orpg.tools.orpg_settings |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
15 import orpg.tools.validate |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
16 from mercurial import ui, hg, commands, repo, revlog, cmdutil |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
17 dir_struct = open_rpg.get_component("dir_struct") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
18 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
19 u = ui.ui() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
20 r = hg.repository(u, ".") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
21 c = r.changectx('tip') |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
22 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
23 #repo = hg.repository(ui.ui(), 'http://hg.assembla.com/traipse') |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
24 #b = [] |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
25 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
26 #b = commands.branches(u, r, True) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
27 #print b |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
28 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
29 """ |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
30 u = ui.ui() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
31 r = hg.repository(u, ".") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
32 l2 =[] |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
33 b = r.branchtags() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
34 heads = dict.fromkeys(r.heads(), 1) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
35 l = [((n in heads), r.changelog.rev(n), n, t) for t, n in b.items()] |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
36 l.sort() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
37 l.reverse() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
38 for ishead, r, n, t in l: l2.append(t) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
39 print l2 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
40 """ |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
41 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
42 #print heads |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
43 #b = [] |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
44 #b = c.branch() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
45 #print c.branch() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
46 #print c.tags() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
47 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
48 ##Process |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
49 #Pull |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
50 #Gather Changeset Info |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
51 #Display window with Branch + Changesets |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
52 #Update from Branch -Revision. |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
53 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
54 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
55 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
56 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
57 # -------------------- |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
58 # | | | |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
59 # | Change | Download | |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
60 # | Log | List | |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
61 # | |-----------| |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
62 # | | butons | |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
63 # ---------------------- |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
64 # Buttons area includes, []Auto Update, <advanced> |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
65 # |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
66 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
67 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
68 class AboutHTMLWindow(wx.Panel): |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
69 "Window used to display the About dialog box" |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
70 # Init using the derived from class |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
71 def __init__( self, parent, id): |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
72 wx.Panel.__init__( self, parent, id, size=(400, -1)) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
73 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
74 def OnLinkClicked( self, ref ): |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
75 "Open an external browser to resolve our About box links!!!" |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
76 href = ref.GetHref() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
77 webbrowser.open( href ) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
78 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
79 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
80 class updaterFrame(wx.Frame): |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
81 def __init__(self, parent, title, openrpg): |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
82 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
83 ### Update Manager |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
84 self.ui = ui.ui() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
85 self.repo = hg.repository(u, ".") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
86 self.c = self.repo.changectx('tip') |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
87 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
88 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
89 self.openrpg = openrpg |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
90 self.parent = parent |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
91 self.log = self.openrpg.get_component("log") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
92 self.log.log("Enter updaterFrame", ORPG_DEBUG) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
93 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
94 wx.Frame.__init__(self, None, wx.ID_ANY, title, size=(640,480), |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
95 style=wx.FRAME_NO_TASKBAR | wx.STAY_ON_TOP | wx.DEFAULT_FRAME_STYLE) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
96 self.SetBackgroundColour(wx.WHITE) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
97 self.CenterOnScreen() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
98 self.settings = openrpg.get_component('settings') |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
99 self.xml = openrpg.get_component('xml') |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
100 self.dir_struct = self.openrpg.get_component("dir_struct") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
101 self.sizer = wx.GridBagSizer(hgap=1, vgap=1) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
102 self.changelog = wx.TextCtrl(self, wx.ID_ANY, size=(400, -1), style=wx.TE_MULTILINE | wx.TE_READONLY) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
103 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
104 self.filelist = wx.TextCtrl(self, wx.ID_ANY, size=(250, 300), style=wx.TE_MULTILINE | wx.TE_READONLY) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
105 self.buttons = {} |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
106 self.buttons['progress_bar'] = wx.Gauge(self, wx.ID_ANY, 100) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
107 self.buttons['auto_text'] = wx.StaticText(self, wx.ID_ANY, "Auto Update") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
108 self.buttons['auto_check'] = wx.CheckBox(self, wx.ID_ANY) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
109 self.buttons['advanced'] = wx.Button(self, wx.ID_ANY, "Package Select") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
110 self.buttons['update'] = wx.Button(self, wx.ID_ANY, "Update Now") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
111 self.buttons['finish'] = wx.Button(self, wx.ID_ANY, "Finish") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
112 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
113 self.sizer.Add(self.changelog, (0,0), span=(3,1), flag=wx.EXPAND) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
114 self.sizer.Add(self.filelist, (0,1), span=(1,3), flag=wx.EXPAND) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
115 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
116 self.sizer.Add(self.buttons['progress_bar'], (1,1), span=(1,3), flag=wx.EXPAND) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
117 self.sizer.Add(self.buttons['auto_text'], (2,1)) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
118 self.sizer.Add(self.buttons['auto_check'], (2,2), flag=wx.EXPAND) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
119 self.sizer.Add(self.buttons['advanced'], (2,3), flag=wx.EXPAND) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
120 self.sizer.Add(self.buttons['update'], (3,1), flag=wx.EXPAND) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
121 self.sizer.Add(self.buttons['finish'], (3,2), span=(1,2), flag=wx.EXPAND) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
122 self.sizer.AddGrowableCol(0) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
123 self.sizer.AddGrowableRow(0) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
124 self.SetSizer(self.sizer) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
125 self.SetAutoLayout(True) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
126 self.initPrefs() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
127 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
128 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
129 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
130 if self.package == None: wx.CallAfter(self.Advanced) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
131 #if self.autoupdate == "On": self.buttons['auto_check'].SetValue(True) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
132 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
133 ## Event Handlers |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
134 self.Bind(wx.EVT_BUTTON, self.Update, self.buttons['update']) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
135 self.Bind(wx.EVT_BUTTON, self.Finish, self.buttons['finish']) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
136 self.Bind(wx.EVT_BUTTON, self.Advanced, self.buttons['advanced']) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
137 self.Bind(wx.EVT_CHECKBOX, self.ToggleAutoUpdate, self.buttons['auto_check']) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
138 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
139 try: self.check() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
140 except: |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
141 self.buttons['finish'].Show() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
142 self.buttons['update'].Show() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
143 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
144 def showFinish(self): |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
145 if self.Updated: self.filelist.SetValue(self.filelist.GetValue() + "Finished ... \n") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
146 self.buttons['finish'].Show() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
147 self.buttons['advanced'].Show() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
148 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
149 def initPrefs(self): |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
150 #self.list_url = self.settings.get_setting("PackagesURL") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
151 #self.package_type = self.settings.get_setting("PackagesType") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
152 #self.package_name = self.settings.get_setting("PackagesName") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
153 self.SelectPackage = False |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
154 #self.autoupdate = self.settings.get_setting("AutoUpdate") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
155 self.packages = None |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
156 self.package = self.get_package() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
157 self.Updated = False |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
158 self.Finished = False |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
159 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
160 def isFinished(self): |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
161 return self.Finished |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
162 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
163 def ToggleAutoUpdate(self, event): |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
164 if self.buttons['auto_check'].GetValue(): |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
165 self.autoupdate = "On" |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
166 #self.settings.set_setting("AutoUpdate", "On") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
167 #self.Update(None) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
168 else: |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
169 self.autoupdate = "Off" |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
170 #self.settings.set_setting("AutoUpdate", "Off") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
171 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
172 def check(self): |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
173 self.buttons['finish'].Hide() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
174 self.buttons['update'].Hide() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
175 self.updatelist = [] |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
176 wx.CallAfter(self.showFinish) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
177 #Do the MD5 Check & DL |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
178 files = self.package._get_childNodes() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
179 self.buttons['progress_bar'].SetRange(len(files)) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
180 try: |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
181 i = 1 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
182 for file in files: |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
183 checksum = md5.new() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
184 self.buttons['progress_bar'].SetValue(i) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
185 if file._get_tagName() == 'file': |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
186 file_name = file.getAttribute("name") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
187 file_url = file.getAttribute("url").replace(' ', '%20') + '/' + file_name |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
188 file_path = file.getAttribute("path") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
189 read_type = file.getAttribute("read_type") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
190 file_checksum = file.getAttribute("checksum") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
191 full_path = self.dir_struct["home"].replace("\\","/") + file_path + os.sep + file_name |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
192 full_path = full_path.replace("/", os.sep) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
193 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
194 if self.verify_file(full_path): |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
195 if read_type == 'rb': f = open(full_path, "rb") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
196 else: f = open(full_path, "r") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
197 data = f.read() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
198 f.close() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
199 checksum.update(data) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
200 if(checksum.hexdigest() != file_checksum): |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
201 self.log.log("Read Type: " + read_type, ORPG_DEBUG) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
202 self.log.log("Filename: " + file_name + "\n\tLocal Checksum:\t" + checksum.hexdigest() + "\n\tWeb Checksum:\t" + file_checksum, ORPG_DEBUG) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
203 self.updatelist.append((file_url, full_path, file_name, read_type)) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
204 else: self.updatelist.append((file_url, full_path, file_name, read_type)) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
205 elif file._get_tagName() == 'dir': |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
206 dir_path = file.getAttribute("path") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
207 full_path = self.dir_struct['home'] + dir_path |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
208 if not self.verify_file(full_path): |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
209 self.filelist.SetValue(self.filelist.GetValue() + "Creating Directory " + dir_path + " ...\n") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
210 os.makedirs(full_path) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
211 i += 1 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
212 if len(self.updatelist) == 0: |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
213 wx.CallAfter(self.Finish) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
214 return False |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
215 except: #error handing update check. Likely no internet connection. skip update check |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
216 self.log.log("[WARNING] Automatic update check failed.\n" + traceback.format_exc(), ORPG_GENERAL) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
217 self.filelist.SetValue("[WARNING] Automatic update check failed.\n" + traceback.format_exc()) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
218 return False |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
219 dmsg = "A newer version is available.\n" |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
220 for file in self.updatelist: dmsg += file[2] + " is out of date\n" |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
221 dmsg += "Would you like to update Now?" |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
222 self.filelist.SetValue(dmsg) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
223 data = urllib.urlretrieve(self.package.getAttribute("notes").replace(' ', '%20')) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
224 file = open(data[0]) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
225 changelog = file.read() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
226 file.close() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
227 self.changelog.SetPage(changelog) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
228 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
229 if self.autoupdate == "Off": self.buttons['update'].Show() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
230 if self.autoupdate == "On": wx.CallAfter(self.Update) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
231 return True |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
232 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
233 def Update(self, evt=None): |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
234 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
235 hg.clean(self.repo, self.current) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
236 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
237 """old code |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
238 self.buttons['finish'].Hide() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
239 self.buttons['update'].Hide() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
240 self.buttons['advanced'].Hide() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
241 self.buttons['progress_bar'].SetRange(len(self.updatelist)) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
242 self.filelist.SetValue("") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
243 self.log.log("Starting Update Proccess!", ORPG_DEBUG) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
244 i = 1 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
245 for file in self.updatelist: |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
246 self.downloadFile(file[0], file[1], file[2], i, file[3]) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
247 i += 1 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
248 self.Updated = True |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
249 self.parent.updated = True |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
250 wx.CallAfter(self.showFinish) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
251 if self.autoupdate == 'On': wx.CallAfter(self.Finish) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
252 """ |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
253 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
254 def downloadFile(self, file_url, abs_path, file_name, i, read_type): |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
255 self.buttons['progress_bar'].SetValue(i) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
256 self.buttons['finish'].Hide() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
257 self.log.log("Downloading " + file_name, ORPG_DEBUG) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
258 try: |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
259 self.filelist.SetValue(self.filelist.GetValue() + "Downloading " + file_name + " ...\n") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
260 wx.Yield() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
261 checksum = md5.new() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
262 data = urllib.urlretrieve("http://openrpg.digitalxero.net/" + file_url) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
263 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
264 if read_type == 'rb': file = open(data[0], "rb") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
265 else: file = open(data[0], "r") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
266 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
267 file_data = file.read() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
268 file.close() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
269 checksum.update(file_data) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
270 self.log.log("Read Type: " + read_type, ORPG_DEBUG) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
271 self.log.log("Downloaded filename: " + file_name + "\n\tDownloaded Checksum:\t" + checksum.hexdigest(), ORPG_DEBUG) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
272 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
273 if read_type == 'rb': file = open(abs_path, 'wb') |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
274 else: file = open(abs_path, 'w') |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
275 file.write(file_data) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
276 file.close() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
277 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
278 #Debug Stuff |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
279 checksum = md5.new() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
280 f = open(abs_path, read_type) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
281 file_data = f.read() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
282 f.close() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
283 checksum.update(file_data) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
284 self.log.log("Written filename: " + file_name + "\n\tWritten Checksum:\t" + checksum.hexdigest(), ORPG_DEBUG) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
285 except: |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
286 self.log.log("Failed to download file: " + abs_path, ORPG_GENERAL) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
287 self.log.log(traceback.format_exc(), ORPG_GENERAL) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
288 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
289 def Finish(self, evt=None): |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
290 #self.settings.updateIni() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
291 self.Finished = True |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
292 self.Destroy() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
293 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
294 def Advanced(self, evt=None): |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
295 dlg = wx.Dialog(self, wx.ID_ANY, "Package Selector", style=wx.DEFAULT_DIALOG_STYLE) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
296 icon = None |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
297 if wx.Platform == '__WXMSW__': icon = wx.Icon(self.dir_struct["icon"]+'d20.ico', wx.BITMAP_TYPE_ICO) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
298 else: icon = wx.Icon(self.dir_struct["icon"]+"d20.xpm", wx.BITMAP_TYPE_XPM ) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
299 if icon != None: dlg.SetIcon(icon) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
300 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
301 dlgsizer = wx.GridBagSizer(hgap=1, vgap=1) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
302 Yes = wx.Button( dlg, wx.ID_OK, "Ok" ) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
303 Yes.SetDefault() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
304 rgroup = wx.RadioButton(dlg, wx.ID_ANY, "group_start", style=wx.RB_GROUP) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
305 rgroup.Hide() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
306 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
307 if self.packages == None: self.get_packages() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
308 if self.package_list == None: return |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
309 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
310 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
311 types = self.package_list |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
312 row=0 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
313 col=0 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
314 self.current = self.c.branch() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
315 self.package_type = self.current |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
316 self.btnlist = {}; self.btn = {} |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
317 self.id = 1 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
318 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
319 for t in types: |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
320 self.btnName = str(t) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
321 self.btn[self.id] = wx.RadioButton(dlg, wx.ID_ANY, str(t), name=self.btnName) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
322 if self.btnName == self.current: |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
323 self.btn[self.id].SetValue(True) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
324 self.btnlist[self.id] = self.btnName |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
325 dlgsizer.Add(self.btn[self.id], (row, col)) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
326 row += 1; self.id += 1 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
327 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
328 dlgsizer.Add(Yes, (row+1,0)) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
329 dlg.SetAutoLayout( True ) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
330 dlg.SetSizer( dlgsizer ) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
331 dlgsizer.Fit( dlg ) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
332 dlg.Centre() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
333 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
334 dlg.Bind(wx.EVT_RADIOBUTTON, self.PackageSet) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
335 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
336 if dlg.ShowModal(): |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
337 dlg.Destroy() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
338 if self.Updated: |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
339 self.Updated = False |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
340 self.filelist.SetValue('') |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
341 wx.CallAfter(self.check) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
342 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
343 def PackageSet(self, event): |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
344 for btn in self.btn: |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
345 if self.btn[btn].GetValue() == True: self.current = self.btnlist[btn] |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
346 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
347 branches = self.repo.branchtags() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
348 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
349 heads = dict.fromkeys(self.repo.heads(), 1) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
350 l = [((n in heads), self.repo.changelog.rev(n), n, t) for t, n in branches.items()] |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
351 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
352 #l.sort() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
353 #l.reverse() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
354 #for ishead, r, n, t in l: self.package_list.append(t) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
355 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
356 if self.current != type: |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
357 u = ui.ui() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
358 r = hg.repository(u, ".") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
359 #r = hg.islocal() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
360 c = r.changectx('tip') |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
361 files = self.c.files() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
362 #print commands.log(u, r, c) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
363 #print r.changelog |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
364 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
365 ### Cleaning up for dev build 0.1 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
366 ### The below material is for the Rev Log. You can run hg log to see what data it will pull. |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
367 #cs = r.changectx(c.rev()).changeset() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
368 #get = util.cachefunc(lambda r: repo.changectx(r).changeset()) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
369 #changeiter, matchfn = cmdutil.walkchangerevs(u, r, 1, cs, 1) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
370 #for st, rev, fns in changeiter: |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
371 # revbranch = get(rev)[5]['branch']; print revbranch |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
372 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
373 heads = dict.fromkeys(self.repo.heads(), self.repo.branchtags()) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
374 branches = dict.copy(self.repo.branchtags()) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
375 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
376 self.filelist.SetValue('') |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
377 self.filelist.AppendText("Files that will change\n\n") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
378 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
379 self.changelog.SetValue('') |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
380 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." |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
381 self.changelog.AppendText(changelog + '\n') |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
382 self.filelist.AppendText("Update to " + self.current + "\n\n The full release will show the files to be changed here.") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
383 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
384 #### Files works but not fully without the change log information, pulled for Dev 0.1 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
385 #for f in files: |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
386 # fc = c[f] |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
387 # self.filelist.AppendText(str(f + '\n')) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
388 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
389 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
390 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
391 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
392 def verify_file(self, abs_path): |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
393 """Returns True if file or directory exists""" |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
394 try: |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
395 os.stat(abs_path) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
396 return True |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
397 except OSError: |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
398 self.log.log("Invalid File or Directory: " + abs_path, ORPG_GENERAL) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
399 return False |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
400 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
401 def get_packages(self, type=None): |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
402 #Fixed and ready for Test. Can be cleaner |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
403 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
404 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
405 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
406 self.package_list = [] |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
407 b = self.repo.branchtags() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
408 heads = dict.fromkeys(self.repo.heads(), 1) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
409 l = [((n in heads), self.repo.changelog.rev(n), n, t) for t, n in b.items()] |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
410 l.sort() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
411 l.reverse() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
412 for ishead, r, n, t in l: self.package_list.append(t) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
413 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
414 def get_package(self): |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
415 #Fixed and ready for test. |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
416 if self.packages == None: self.get_packages() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
417 if self.package_list == None: return None |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
418 return None |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
419 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
420 def is_up2date(self, version, build): |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
421 if self.package == None: |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
422 self.SelectPackage == True |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
423 return False |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
424 vg = (version > self.package.getAttribute("version")) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
425 ve = (version == self.package.getAttribute("version")) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
426 b = (build >= self.package.getAttribute("build")) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
427 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
428 if vg: return True |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
429 if (not ve) or (not b): return False |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
430 return True |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
431 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
432 class updateApp(wx.App): |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
433 def OnInit(self): |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
434 self.open_rpg = open_rpg |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
435 self.log = orpg.tools.orpg_log.orpgLog(orpg.dirpath.dir_struct["user"] + "runlogs/") |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
436 self.log.setLogToConsol(False) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
437 self.log.log("Updater Start", ORPG_NOTE) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
438 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
439 #Add the initial global components of the openrpg class |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
440 #Every class should be passed openrpg |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
441 self.open_rpg.add_component("log", self.log) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
442 self.open_rpg.add_component("xml", orpg.orpg_xml) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
443 self.open_rpg.add_component("dir_struct", orpg.dirpath.dir_struct) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
444 self.validate = orpg.tools.validate.Validate() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
445 self.open_rpg.add_component("validate", self.validate) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
446 #self.settings = orpg.tools.orpg_settings.orpgSettings(self.open_rpg) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
447 #self.open_rpg.add_component("settings", self.settings) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
448 #self.settings.updateIni() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
449 self.updater = updaterFrame(self, "OpenRPG Update Manager Beta 0.1", self.open_rpg) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
450 self.updated = False |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
451 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
452 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
453 try: |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
454 self.updater.Show() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
455 self.SetTopWindow(self.updater) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
456 self.updater.Fit() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
457 except: pass |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
458 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
459 return True |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
460 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
461 def OnExit(self): |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
462 #self.settings.save() |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
463 """ |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
464 imported = ['orpg.orpgCore', 'orpg.orpg_wx', 'orpg.orpg_version', 'orpg.tools.orpg_log', 'orpg.orpg_xml', 'orpg.dirpath', 'orpg.tools.orpg_settings', 'orpg.tools.validate', 'orpg.pulldom', 'orpg.tools.NotebookCtrl', 'orpg.tools.config_update', 'orpg.systempath', 'orpg.minidom', 'orpg.dirpath.dirpath_tools', 'orpg.tools.rgbhex', 'orpg.orpg_windows'] |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
465 |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
466 for name in imported: |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
467 if name in sys.modules: |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
468 self.log.log("Unimported " + name, ORPG_DEBUG) |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
469 del sys.modules[name] |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
470 """ |
6ef4bb8ee8ca
Update Manager Beta 0.1 release!! This new update manager is a boon
sirebral
parents:
diff
changeset
|
471 self.log.log("Updater Exit\n\n", ORPG_NOTE) |