annotate upmana/updatemana.py @ 36:d02e9197c066 ornery-orc

Traipse 'OpenRPG' {101220-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 (Closed) New Features: New to Map, can re-order Grid, Miniatures, and Whiteboard layer draw order New to Server GUI, can now clear log New Earthdawn Dieroller New IronClaw roller, sheet, and image New ShapeShifter PC Sheet Updates: Update to Warhammer PC Sheet. Rollers set as macros. Should work with little maintanence. Update to Browser Server window. Display rooms with ' " & cleaner Update to Server. Handles ' " & cleaner Update to Dieroller. Cleaner, more effecient expression system Update to Hidden Die plugin, allows for non standard dice rolls Update to location.py, allows for more portable references when starting Traipse Update to the Features node Fixes: Fix to InterParse that was causing an Infernal Loop with Namespace Internal Fix to XML data, removed old Minidom and switched to Element Tree Fix to Server that was causing eternal attempt to find a Server ID, in Register Rooms thread Fix to Server, removing wxPython dependencies where not needed Fix to metaservers.xml file not being created Fix to Single and Double quotes in Whiteboard text Fix to Background images not showing when using the Image Server Fix to Duplicate chat names appearing Fix to Server GUI's logging output Fix to FNB.COLORFUL_TABS bug Fix to Gametree for XSLT Sheets Fix to Gametree for locating gametree files Fix to Send to Chat from Gametree Fix to Gametree, renaming and remapping operates correctly Fix to aliaslib, prevents error caused when SafeHTML is sent None
author sirebral
date Sun, 19 Dec 2010 22:44:36 -0600
parents fc48380f0c9f
children a1b3b4494bdb
rev   line source
36
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
1 from __future__ import with_statement
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
2 import wx, sys, os #just .sep maybe
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
3 from manifest import manifest
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
4 import shutil
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
5
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
6 from orpg.orpgCore import component
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
7 from orpg.dirpath import dir_struct
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
8 from orpg.tools.orpg_log import logger, crash
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
9 from upmana.validate import validate
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
10 from orpg.dirpath import dir_struct
17
265b987cce4f Traipse 'OpenRPG' {090813-00}
sirebral
parents: 16
diff changeset
11 from mercurial import ui, hg, commands, repo, revlog, cmdutil, util
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
12
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
13 class Term2Win(object):
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
14 # A stdout redirector. Allows the messages from Mercurial to be seen in the Install Window
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
15 def write(self, text):
31
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
16 self.closed = sys.__stdout__.closed
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
17 self.flush = sys.__stdout__.flush
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
18 statbar.SetStatusText(text.replace('\n', ''))
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
19 sys.__stdout__.write(text)
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
20
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
21 class Updater(wx.Panel):
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
22 def __init__(self, parent, component):
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
23 wx.Panel.__init__(self, parent)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
24 ### Status Bar ###
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
25 #statbar.SetStatusText('Select a Package and Update')
31
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
26 #statbar.SetStatusText('New Status Bar')
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
27
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
28 self.timer = wx.Timer(self, 1)
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
29 self.count = 0
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
30
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
31 ### Update Manager
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
32 self.ui = ui.ui()
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
33 self.repo = hg.repository(self.ui, ".")
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
34 self.c = self.repo.changectx('tip')
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
35 self.parent = parent
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
36 self.SetBackgroundColour(wx.WHITE)
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
37 self.sizer = wx.GridBagSizer(hgap=1, vgap=1)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
38 self.changelog = wx.TextCtrl(self, wx.ID_ANY, size=(300, -1),
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
39 style=wx.TE_MULTILINE | wx.TE_READONLY)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
40 self.filelist = wx.TextCtrl(self, wx.ID_ANY, size=(275, 300),
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
41 style=wx.TE_MULTILINE | wx.TE_READONLY)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
42 self.buttons = {}
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
43 self.buttons['progress_bar'] = wx.Gauge(self, wx.ID_ANY, 100)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
44 self.buttons['auto_text'] = wx.StaticText(self, wx.ID_ANY, "Auto Update")
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
45 self.buttons['auto_check'] = wx.CheckBox(self, wx.ID_ANY)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
46 self.buttons['no_text'] = wx.StaticText(self, wx.ID_ANY, "No Update")
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
47 self.buttons['no_check'] = wx.CheckBox(self, wx.ID_ANY)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
48 self.buttons['advanced'] = wx.Button(self, wx.ID_ANY, "Package Select")
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
49 self.buttons['update'] = wx.Button(self, wx.ID_ANY, "Update Now")
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
50 self.buttons['finish'] = wx.Button(self, wx.ID_ANY, "Finish")
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
51
31
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
52 self.sizer.Add(self.changelog, (0,0), span=(5,1), flag=wx.EXPAND)
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
53 self.sizer.Add(self.filelist, (0,1), span=(1,3), flag=wx.EXPAND)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
54
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
55 self.sizer.Add(self.buttons['progress_bar'], (1,1), span=(1,3), flag=wx.EXPAND)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
56 self.sizer.Add(self.buttons['auto_text'], (2,1))
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
57 self.sizer.Add(self.buttons['auto_check'], (2,2), flag=wx.EXPAND)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
58 self.sizer.Add(self.buttons['no_text'], (3,1))
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
59 self.sizer.Add(self.buttons['no_check'], (3,2), flag=wx.EXPAND)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
60 self.sizer.Add(self.buttons['advanced'], (2,3), flag=wx.EXPAND)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
61 self.sizer.Add(self.buttons['update'], (3,3), flag=wx.EXPAND)
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
62 self.sizer.Add(self.buttons['finish'], (4,3), flag=wx.EXPAND)
31
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
63 self.buttons['progress_bar'].SetValue(100)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
64 self.sizer.AddGrowableCol(0)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
65 self.sizer.AddGrowableRow(0)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
66 self.SetSizer(self.sizer)
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
67 self.SetAutoLayout(True)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
68 self.get_package
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
69
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
70 self.current = self.repo.dirstate.branch()
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
71 self.BranchInfo(self.current)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
72
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
73 if manifest.GetString("updatemana", "no_update", "") == 'on': self.buttons['no_check'].SetValue(True)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
74 else: self.buttons['no_check'].SetValue(False)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
75 if manifest.GetString("updatemana", "auto_update", "") == 'on': self.buttons['auto_check'].SetValue(True)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
76 else: self.buttons['auto_check'].SetValue(False)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
77
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
78 ## Event Handlers
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
79 self.Bind(wx.EVT_BUTTON, self.Update, self.buttons['update'])
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
80 self.Bind(wx.EVT_BUTTON, self.Finish, self.buttons['finish'])
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
81 self.Bind(wx.EVT_BUTTON, self.ChooseBranch, self.buttons['advanced'])
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
82 self.Bind(wx.EVT_CHECKBOX, self.ToggleAutoUpdate, self.buttons['auto_check'])
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
83 self.Bind(wx.EVT_CHECKBOX, self.ToggleNoUpdate, self.buttons['no_check'])
31
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
84 self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer)
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
85
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
86 def OnTimer(self, event):
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
87 statbar.SetStatusText('Checking For Updates')
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
88 self.count = self.count + 1
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
89 self.buttons['progress_bar'].SetValue(self.count)
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
90 if self.count == 100:
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
91 self.timer.Stop()
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
92 statbar.SetStatusText('No Updates Available')
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
93
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
94 def UpdateCheck(self):
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
95 self.timer.Start(100)
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
96 self.count = 3
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
97 self.buttons['progress_bar'].SetValue(3)
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
98 try:
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
99 doUpdate = commands.incoming(self.ui, self.repo,
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
100 manifest.GetString('default', 'repo', ''),
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
101 force=True, bundle=False)
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
102 if doUpdate:
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
103 statbar.SetStatusText('No Updates Available')
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
104 self.buttons['progress_bar'].SetValue(100)
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
105 self.timer.Stop()
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
106 else:
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
107 statbar.SetStatusText('Refresh Repo For Updated Source')
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
108 self.buttons['progress_bar'].SetValue(100)
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
109 self.timer.Stop()
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
110 except:
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
111 statbar.SetStatusText('No Connection Found')
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
112 self.buttons['progress_bar'].SetValue(100)
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
113 self.timer.Stop()
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
114
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
115
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
116 def ToggleAutoUpdate(self, event):
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
117 if self.buttons['auto_check'].GetValue() == True:
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
118 if self.buttons['no_check'].GetValue() == True:
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
119 self.buttons['no_check'].SetValue(False)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
120 manifest.SetString("updatemana", "no_update", "off")
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
121 manifest.SetString("updatemana", "auto_update", "on")
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
122 else: manifest.SetString("updatemana", "auto_update", "off")
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
123
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
124 def ToggleNoUpdate(self, event):
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
125 if self.buttons['no_check'].GetValue() == True:
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
126 if self.buttons['auto_check'].GetValue() == True:
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
127 self.buttons['auto_check'].SetValue(False)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
128 manifest.SetString("updatemana", "auto_update", "off")
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
129 manifest.SetString("updatemana", "no_update", "on")
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
130 else: manifest.SetString("updatemana", "no_update", "off")
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
131
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
132 def Update(self, evt=None):
36
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
133 with open(sys.path[2]+os.sep+'location.py', 'rb') as f: old_location = f.read()
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
134 ## This new location file update allows for a more portable way to start Traipse. It's aimed at Linux users.
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
135 new_location = """import sys
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
136 import os
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
137
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
138 dyn_dir = 'System'
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
139 _home = sys.path[0]
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
140 _userbase_dir = _home + os.sep + dyn_dir
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
141 sys.path.append(_userbase_dir)
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
142 try: os.chdir(_userbase_dir)
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
143 except: print 'Failed to find ' + _userbase_dir + '\\nHopefuly you are running setup.py which would make this error normal.'"""
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
144
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
145 if new_location != old_location:
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
146 with open(sys.path[2]+os.sep+'location.py', 'w') as f: f.write(new_location)
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
147
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
148 self.ui = ui.ui()
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
149 self.repo = hg.repository(self.ui, ".")
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
150 self.c = self.repo.changectx('tip')
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
151 filename = 'ignorelist.txt'
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
152 self.filename = dir_struct["home"] + 'upmana' + os.sep + filename
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
153 component.get('validate').config_file(filename, "default_ignorelist.txt")
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
154 self.mana = self.LoadDoc()
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
155 temp = dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
156 for ignore in self.ignorelist:
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
157 if len(ignore.split('/')) > 1:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
158 gets = 0; dir1 = ''
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
159 while gets != len(ignore.split('/'))-1:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
160 dir1 += ignore.split('/')[gets] + os.sep
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
161 gets += 1
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
162 os.makedirs(temp+dir1)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
163 shutil.copy(ignore, temp + dir1 + ignore.split('/')[len(ignore.split('/')) - 1])
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
164 hg.clean(self.repo, self.current)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
165 for ignore in self.ignorelist:
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
166 shutil.copyfile(temp + ignore.split('/')[len(ignore.split('/')) - 1], ignore)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
167 os.remove(temp + ignore.split('/')[len(ignore.split('/')) - 1])
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
168 if len(ignore.split('/')) > 1:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
169 gets = 0; dir1 = ''
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
170 while gets != len(ignore.split('/'))-1:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
171 dir1 += ignore.split('/')[gets] + os.sep
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
172 gets += 1
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
173 os.removedirs(temp+dir1)
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
174
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
175 def LoadDoc(self):
31
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
176 manifest = open(self.filename)
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
177 self.ignorelist = []
31
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
178 ignore = manifest.readlines()
36
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
179 for i in ignore: self.ignorelist.append(str(i[:len(i)-1]))
31
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
180 manifest.close()
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
181
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
182 def Finish(self, evt=None):
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
183 component.get('upmana-win').OnClose(None)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
184
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
185 def ChooseBranch(self, evt=None):
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
186 dlg = wx.Dialog(self, wx.ID_ANY, "Package Selector", style=wx.DEFAULT_DIALOG_STYLE)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
187 if wx.Platform == '__WXMSW__': icon = wx.Icon(dir_struct["icon"]+'d20.ico', wx.BITMAP_TYPE_ICO)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
188 else: icon = wx.Icon(dir_struct["icon"]+"d20.xpm", wx.BITMAP_TYPE_XPM )
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
189 dlg.SetIcon(icon)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
190
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
191 self.ui = ui.ui()
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
192 self.repo = hg.repository(self.ui, ".")
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
193 self.c = self.repo.changectx('tip')
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
194
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
195 dlgsizer = wx.GridBagSizer(hgap=1, vgap=1)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
196 Yes = wx.Button( dlg, wx.ID_OK, "Ok" )
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
197 Yes.SetDefault()
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
198 rgroup = wx.RadioButton(dlg, wx.ID_ANY, "group_start", style=wx.RB_GROUP)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
199 rgroup.Hide()
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
200
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
201 self.get_packages()
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
202 if self.package_list == None: return
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
203 types = self.package_list
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
204 row=0; col=0
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
205 self.current = self.repo.dirstate.branch()
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
206 self.package_type = self.current
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
207 self.btnlist = {}; self.btn = {}
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
208 self.id = 1
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
209
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
210 for t in types:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
211 self.btnName = str(t)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
212 self.btn[self.id] = wx.RadioButton(dlg, wx.ID_ANY, str(t), name=self.btnName)
36
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
213 if self.btnName == self.current: self.btn[self.id].SetValue(True); self.current_id = self.id
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
214 self.btnlist[self.id] = self.btnName
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
215 dlgsizer.Add(self.btn[self.id], (row, col))
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
216 col += 1; self.id += 1
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
217 if col == 3: row += 1; col = 0
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
218
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
219 dlgsizer.Add(Yes, (row+1,col/2))
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
220 dlgsizer.AddGrowableCol(0)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
221 dlgsizer.AddGrowableRow(0)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
222 dlg.SetAutoLayout( True )
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
223 dlg.SetSizer( dlgsizer )
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
224 dlgsizer.Fit( dlg )
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
225 dlg.Centre()
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
226 dlg.Bind(wx.EVT_RADIOBUTTON, self.PackageSet)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
227 if dlg.ShowModal(): dlg.Destroy()
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
228
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
229 def PackageSet(self, event):
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
230 for btn in self.btn:
36
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
231 if self.btn[btn].GetValue() == True:
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
232 if self.btnlist[btn] == 'pious-paladin':
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
233 try: from PyQt4 import QtCore
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
234 except:
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
235 error = "'Pious Paladin' requires PyQt 4.6. For stability you will not be able to update."
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
236 dlg = wx.MessageDialog(None, error, 'Failed PyQt Test', wx.OK | wx.ICON_ERROR)
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
237 dlg.ShowModal()
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
238 self.btn[self.current_id].SetValue(True)
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
239 self.current = self.btnlist[self.current_id]
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
240 else: self.current = self.btnlist[btn]
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
241
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
242 branches = self.repo.branchtags()
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
243 heads = dict.fromkeys(self.repo.heads(), 1)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
244 l = [((n in heads), self.repo.changelog.rev(n), n, t) for t, n in branches.items()]
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
245
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
246 if self.current != type:
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
247 heads = dict.fromkeys(self.repo.heads(), self.repo.branchtags())
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
248 branches = dict.copy(self.repo.branchtags())
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
249 self.BranchInfo(self.current)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
250
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
251 def BranchInfo(self, branch):
17
265b987cce4f Traipse 'OpenRPG' {090813-00}
sirebral
parents: 16
diff changeset
252 cs = self.repo.changectx( self.current ).changeset()
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
253 self.changelog.SetValue('')
17
265b987cce4f Traipse 'OpenRPG' {090813-00}
sirebral
parents: 16
diff changeset
254 changelog = cs[4]
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
255 self.changelog.AppendText(changelog + '\n')
17
265b987cce4f Traipse 'OpenRPG' {090813-00}
sirebral
parents: 16
diff changeset
256 self.filelist.SetValue('')
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
257 self.filelist.AppendText("Currently selected branch: " + branch + "\n\nAuthor: "+cs[1]+"\n\n")
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
258 self.filelist.AppendText("Files Modified (in update): \n")
17
265b987cce4f Traipse 'OpenRPG' {090813-00}
sirebral
parents: 16
diff changeset
259 for f in cs[3]: self.filelist.AppendText(f+"\n")
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
260
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
261 def get_packages(self, type=None):
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
262 #Fixed and ready for Test. Can be cleaner
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
263 self.package_list = []
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
264 b = self.repo.branchtags()
17
265b987cce4f Traipse 'OpenRPG' {090813-00}
sirebral
parents: 16
diff changeset
265 heads = dict.fromkeys(self.repo.heads(), 1) #The code below looks superfluous but there is good info inside
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
266 l = [((n in heads), self.repo.changelog.rev(n), n, t) for t, n in b.items()]
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
267 l.sort()
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
268 l.reverse()
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
269 for ishead, r, n, t in l: self.package_list.append(t)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
270
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
271 def get_package(self):
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
272 self.get_packages()
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
273 if self.package_list == None: return None
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
274 return None
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
275
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
276 class Repos(wx.Panel):
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
277 def __init__(self, parent, openrpg):
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
278 wx.Panel.__init__(self, parent)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
279 ### Status Bar ###
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
280 #statbar.SetStatusText('Add, Delete, or Refresh your source Tracs')
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
281 statbar.SetStatusText('New Status Bar')
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
282 ### Update Manager
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
283 self.ui = ui.ui()
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
284 self.r = hg.repository(self.ui, ".")
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
285 self.c = self.r.changectx('tip')
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
286
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
287 #mainpanel = self
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
288 self.openrpg = openrpg
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
289 self.buttons = {}
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
290 self.texts = {}
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
291
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
292 ## Section Sizers (with frame edges and text captions)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
293 self.box_sizers = {}
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
294 self.box_sizers["newbutton"] = wx.StaticBox(self, -1)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
295
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
296 ## Layout Sizers
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
297 self.sizers = {}
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
298 self.sizers["main"] = wx.GridBagSizer(hgap=2, vgap=2)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
299 self.sizers["button"] = wx.GridBagSizer(hgap=2, vgap=2)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
300
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
301 #Button Layout
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
302 self.sizers["newbutton"] = wx.StaticBoxSizer(self.box_sizers["newbutton"], wx.VERTICAL)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
303 self.sizers["newrepo_layout"] = wx.FlexGridSizer(rows=1, cols=2, hgap=2, vgap=5)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
304 empty = wx.StaticText(self, -1, "")
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
305 reponame = wx.StaticText(self, -1, "Name:")
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
306 self.texts["reponame"] = wx.TextCtrl(self, -1, '')
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
307 self.buttons['addrepo'] = wx.Button(self, wx.ID_NEW)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
308
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
309 ##Build Button
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
310 self.sizers["newrepo_layout"].Add(self.buttons['addrepo'], -1, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
311 self.sizers["newrepo_layout"].Add(empty, -1)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
312 self.sizers["newrepo_layout"].Add(reponame, -1, wx.ALIGN_CENTER|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
313 self.sizers["newrepo_layout"].Add(self.texts["reponame"], -1, wx.EXPAND)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
314 self.sizers["newrepo_layout"].AddGrowableCol(1)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
315 self.sizers["newbutton"].Add(self.sizers["newrepo_layout"], -1, wx.EXPAND)
17
265b987cce4f Traipse 'OpenRPG' {090813-00}
sirebral
parents: 16
diff changeset
316
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
317 #Repo List Panel
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
318 self.repopanel = wx.ScrolledWindow(self)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
319 self.repopanel.SetScrollbars(20,20,55,40)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
320 self.repopanel.Scroll(50,10)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
321 self.box_sizers["repolist"] = wx.StaticBox(self.repopanel, -1, "Current Repo List")
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
322 self.sizers["repolist"] = wx.StaticBoxSizer(self.box_sizers["repolist"], wx.VERTICAL)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
323 self.sizers["repo"] = wx.GridBagSizer(hgap=2, vgap=2)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
324 self.sizers["repolist_layout"] = wx.FlexGridSizer(rows=1, cols=1, hgap=2, vgap=5)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
325
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
326 self.NewRepoList(None)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
327 self.BuildRepoList(None)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
328
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
329 self.sizers["repolist_layout"].AddGrowableCol(0)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
330 self.sizers["repolist"].Add(self.sizers["repolist_layout"], -1, wx.EXPAND)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
331 self.sizers["repo"].Add(self.sizers["repolist"], (0,0), flag=wx.EXPAND)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
332 self.sizers["repo"].AddGrowableCol(0)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
333 self.sizers['repo'].AddGrowableRow(0)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
334 self.sizers['repo'].AddGrowableRow(1)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
335 self.repopanel.SetSizer(self.sizers['repo'])
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
336 self.repopanel.SetAutoLayout(True)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
337
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
338 #Build Main Sizer
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
339 self.sizers["main"].Add(self.sizers["newbutton"], (0,0), flag=wx.EXPAND)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
340 self.sizers["main"].Add(self.repopanel, (1,0), flag=wx.EXPAND)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
341 self.sizers["main"].AddGrowableCol(0)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
342 self.sizers["main"].AddGrowableCol(1)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
343 self.sizers["main"].AddGrowableRow(1)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
344 self.SetSizer(self.sizers["main"])
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
345 self.SetAutoLayout(True)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
346 #self.Fit()
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
347 self.Bind(wx.EVT_BUTTON, self.AddRepo, self.buttons['addrepo'])
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
348
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
349 def NewRepoList(self, event):
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
350 self.id = -1
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
351 self.box = {}; self.box_name= {}; self.main = {}; self.container = {}; self.layout = {}
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
352 self.name = {}; self.url = {}; self.url_list = {}; self.pull = {}; self.uri = {}; self.delete = {}
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
353 self.defaultcheck = {}; self.default = {}; self.repotrac = {}
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
354 self.pull_list = {}; self.delete_list = {}; self.defchecklist = {}; self.repolist = []
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
355
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
356 def BuildRepoList(self, event):
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
357 repolist = manifest.PluginChildren('updaterepo')
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
358 appendlist = []
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
359 for repo in repolist:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
360 if repo not in self.repolist: appendlist.append(repo)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
361 self.repolist = repolist
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
362
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
363 for repo in appendlist:
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
364 self.id += 1
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
365 #Build Constructs
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
366 self.box[self.id] = wx.StaticBox(self.repopanel, -1, str(repo))
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
367 self.main[self.id] = wx.GridBagSizer(hgap=2, vgap=2)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
368 self.container[self.id] = wx.StaticBoxSizer(self.box[self.id], wx.VERTICAL)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
369 self.layout[self.id] = wx.FlexGridSizer(rows=1, cols=4, hgap=2, vgap=5)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
370 self.name[self.id] = wx.StaticText(self.repopanel, -1, 'URL')
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
371 self.uri[self.id] = manifest.GetString('updaterepo', repo, '')
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
372 #except: self.uri[self.id] = ''
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
373 self.url[self.id] = wx.TextCtrl(self.repopanel, -1, self.uri[self.id])
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
374 self.pull[self.id] = wx.Button(self.repopanel, wx.ID_REFRESH)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
375 self.delete[self.id] = wx.Button(self.repopanel, wx.ID_DELETE)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
376 self.delete_list[self.delete[self.id]] = self.id
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
377 self.defaultcheck[self.id] = wx.CheckBox(self.repopanel, -1)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
378 self.default[self.id] = wx.StaticText(self.repopanel, -1, 'Default')
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
379 #Build Retraceables
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
380 self.box_name[self.id] = str(repo)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
381 self.pull_list[self.pull[self.id]] = self.id
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
382 self.defchecklist[self.defaultcheck[self.id]] = self.id
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
383 #Build Layout
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
384 self.layout[self.id].Add(self.name[self.id],
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
385 -1, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
386 self.layout[self.id].Add(self.url[self.id],
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
387 -1, wx.EXPAND)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
388 self.layout[self.id].Add(self.pull[self.id],
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
389 -1, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
390 self.layout[self.id].Add(self.delete[self.id], -1, wx.EXPAND)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
391 self.layout[self.id].Add(self.defaultcheck[self.id],
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
392 -1, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALL)
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
393 self.layout[self.id].Add(self.default[self.id], -1, wx.EXPAND)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
394 self.layout[self.id].AddGrowableCol(1)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
395 self.container[self.id].Add(self.layout[self.id], -1, wx.EXPAND)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
396 #Button Events
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
397 self.Bind(wx.EVT_BUTTON, self.RefreshRepo, self.pull[self.id])
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
398 self.Bind(wx.EVT_BUTTON, self.DelRepo, self.delete[self.id])
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
399 self.Bind(wx.EVT_CHECKBOX, self.SetDefault, self.defaultcheck[self.id])
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
400 self.sizers["repolist_layout"].Insert(0, self.container[self.id], -1, wx.EXPAND)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
401 self.sizers['repolist_layout'].Layout()
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
402 self.Layout()
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
403
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
404 #Set Default Repo Button
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
405 capture = manifest.GetString('default', 'repo', '')
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
406 if capture != '':
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
407 for caught in self.uri:
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
408 if capture == self.uri[caught]: self.id = caught; pass
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
409 else: continue
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
410 self.defaultcheck[self.id].SetValue(True)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
411
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
412 def AddRepo(self, event):
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
413 repo = self.texts['reponame'].GetValue(); repo = repo.replace(' ', '_'); repo = 'repo-' + repo
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
414 manifest.SetString('updaterepo', repo, '')
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
415 self.BuildRepoList(None)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
416
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
417 def DelRepo(self, event):
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
418 self.id = self.delete_list[event.GetEventObject()]
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
419 self.sizers["repolist_layout"].Hide(self.container[self.id])
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
420 manifest.DelString('updaterepo', self.box_name[self.id])
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
421 try: del self.box_name[self.id]
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
422 except: pass
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
423 self.sizers['repolist_layout'].Layout()
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
424 self.repolist = manifest.PluginChildren('updaterepo')
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
425
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
426 def RefreshRepo(self, event):
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
427 self.id = self.pull_list[event.GetEventObject()]
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
428 manifest.SetString('updaterepo', str(self.box_name[self.id]), self.url[self.id].GetValue())
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
429 try: commands.pull(self.ui, self.r, self.url[self.id].GetValue(), rev='', update=False, force=True)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
430 except: pass
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
431
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
432 def SetDefault(self, event):
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
433 self.id = self.defchecklist[event.GetEventObject()]
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
434 manifest.SetString('default', 'repo', self.uri[self.id])
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
435 for all in self.defaultcheck:
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
436 self.defaultcheck[all].SetValue(False)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
437 self.defaultcheck[self.id].SetValue(True)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
438
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
439 class Manifest(wx.Panel):
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
440 def __init__(self, parent):
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
441 wx.Panel.__init__(self, parent)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
442 ### Status Bar ###
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
443 #statbar.SetStatusText('Create an Ignore List')
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
444 statbar.SetStatusText('New Status Bar')
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
445 self.ui = ui.ui()
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
446 self.repo = hg.repository(self.ui, ".")
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
447 self.c = self.repo.changectx('tip')
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
448 self.manifestlist = []
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
449 self.manifestlist = self.c.manifest().keys()
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
450 for mana in self.manifestlist: mana = os.sep + 'orpg' + os.sep + mana
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
451 self.manifestlist.sort()
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
452 self.SetBackgroundColour(wx.WHITE)
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
453 self.sizer = wx.GridBagSizer(hgap=1, vgap=1)
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
454 self.manifestlog = wx.CheckListBox( self, -1, wx.DefaultPosition, wx.DefaultSize,
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
455 self.manifestlist, wx.LC_REPORT|wx.SUNKEN_BORDER|wx.EXPAND|wx.LC_HRULES)
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
456 filename = 'ignorelist.txt'
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
457 self.filename = dir_struct["home"] + 'upmana' + os.sep + filename
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
458 component.get('validate').config_file(filename, "default_ignorelist.txt")
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
459 self.mana = self.LoadDoc()
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
460 self.manifestlog.Bind(wx.EVT_CHECKLISTBOX, self.GetChecked)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
461 self.sizer.Add(self.manifestlog, (0,0), flag=wx.EXPAND)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
462 self.sizer.AddGrowableCol(0)
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
463 self.sizer.AddGrowableRow(0)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
464 self.SetSizer(self.sizer)
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
465 self.SetAutoLayout(True)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
466
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
467 def GetChecked(self, event):
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
468 self.mana = []
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
469 for manifest in self.manifestlog.GetChecked(): self.mana.append(self.manifestlist[manifest])
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
470 self.SaveDoc()
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
471
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
472 def SaveDoc(self):
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
473 f = open(self.filename, "w")
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
474 for mana in self.mana: f.write(mana+'\n')
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
475 f.close()
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
476
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
477 def LoadDoc(self):
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
478 ignore = open(self.filename)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
479 ignorelist = []
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
480 for i in ignore: ignorelist.append(str(i [:len(i)-1]))
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
481 for i in ignorelist: #Adds previously ignored files to manifestlistlog if they are not in changesets.
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
482 if self.c.manifest().has_key(i): continue
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
483 else: self.manifestlist.append(i); self.manifestlist.sort()
17
265b987cce4f Traipse 'OpenRPG' {090813-00}
sirebral
parents: 16
diff changeset
484 self.manifestlog = wx.CheckListBox( self, -1, wx.DefaultPosition, wx.DefaultSize, self.manifestlist,
265b987cce4f Traipse 'OpenRPG' {090813-00}
sirebral
parents: 16
diff changeset
485 wx.LC_REPORT|wx.SUNKEN_BORDER|wx.EXPAND|wx.LC_HRULES)
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
486 self.manifestlog.SetCheckedStrings(ignorelist)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
487 manifest = ignore.readlines()
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
488 ignore.close()
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
489
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
490 class Control(wx.Panel):
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
491 def __init__(self, parent):
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
492 wx.Panel.__init__(self, parent)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
493 ### Status Bar ###
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
494 #statbar.SetStatusText('Advanced Controls & Rollback')
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
495 statbar.SetStatusText('New Status Bar')
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
496 ### Control Panel
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
497 self.ui = ui.ui()
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
498 self.repo = hg.repository(self.ui, ".")
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
499 self.c = self.repo.changectx('tip')
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
500 self.parent = parent
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
501 #logger.debug("Enter updaterFrame") #Need to set logging level
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
502
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
503 self.get_packages()
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
504 self.SetBackgroundColour(wx.WHITE)
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
505 self.sizer = wx.GridBagSizer(hgap=1, vgap=1)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
506 self.buttons = {}
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
507
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
508 ## Changelog / File List
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
509 changelogcp = wx.Panel(self)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
510 self.changelogcp = wx.GridBagSizer(hgap=1, vgap=1)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
511 self.changelog = wx.TextCtrl(changelogcp, wx.ID_ANY, size=wx.DefaultSize, style=wx.TE_MULTILINE | wx.TE_READONLY)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
512 self.filelist = wx.TextCtrl(changelogcp, wx.ID_ANY, size=wx.DefaultSize, style=wx.TE_MULTILINE | wx.TE_READONLY)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
513 self.changelogcp.Add(self.changelog, (0,0), flag=wx.EXPAND)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
514 self.changelogcp.Add(self.filelist, (1,0), flag=wx.EXPAND)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
515 changelogcp.SetSizer(self.changelogcp)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
516 self.changelogcp.AddGrowableCol(0)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
517 self.changelogcp.AddGrowableRow(0)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
518 self.changelogcp.AddGrowableRow(1)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
519 changelogcp.SetAutoLayout(True)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
520
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
521 ## Branches / Revisions
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
522 branchcp = wx.Panel(self)
27
51428d30c59e Traipse 'OpenRPG' {091003-00}
sirebral
parents: 22
diff changeset
523 self.current = self.repo.dirstate.branch()
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
524 self.branchcp = wx.GridBagSizer(hgap=1, vgap=1)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
525 self.branches = wx.Choice(branchcp, wx.ID_ANY, choices=self.package_list)
27
51428d30c59e Traipse 'OpenRPG' {091003-00}
sirebral
parents: 22
diff changeset
526 self.branches.SetSelection(self.package_list.index(self.current))
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
527 self.branch_txt = wx.StaticText(branchcp, wx.ID_ANY, "Branches")
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
528 self.branchcp.Add(self.branches, (0,0))
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
529 self.branchcp.Add(self.branch_txt, (0,1), flag=wx.ALIGN_CENTER_VERTICAL)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
530 branchcp.SetSizer(self.branchcp)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
531 branchcp.SetAutoLayout(True)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
532
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
533 revlistcp = wx.Panel(self)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
534 self.revlistcp = wx.GridBagSizer(hgap=2, vgap=2)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
535 self.revlist = wx.ListCtrl(revlistcp, -1, wx.DefaultPosition, size=wx.DefaultSize,
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
536 style=wx.LC_REPORT|wx.SUNKEN_BORDER|wx.LC_HRULES)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
537 self.revlist.InsertColumn(0, 'Revs')
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
538 self.revlist.InsertColumn(1, 'Changeset')
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
539 self.revlist.SetColumnWidth(0, -1)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
540 self.revlist.SetColumnWidth(1, -1)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
541 self.revlist.Refresh()
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
542 self.revlistcp.Add(self.revlist, (0,0), flag=wx.EXPAND)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
543 revlistcp.SetSizer(self.revlistcp)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
544 self.revlistcp.AddGrowableCol(0)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
545 self.revlistcp.AddGrowableRow(0)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
546 self.revlistcp.AddGrowableRow(1)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
547 revlistcp.SetAutoLayout(True)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
548
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
549 ## Control Panel
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
550 cp = wx.Panel(self)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
551 self.cp = wx.GridBagSizer(hgap=1, vgap=1)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
552 self.buttons['update'] = wx.Button(cp, wx.ID_ANY, "Revision Update")
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
553 self.buttons['delete'] = wx.Button(cp, wx.ID_ANY, "Delete Branch")
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
554 self.cp.Add(self.buttons['update'], (0,0))
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
555 self.cp.Add(self.buttons['delete'], (0,1))
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
556 cp.SetSizer(self.cp)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
557 cp.SetAutoLayout(True)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
558
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
559 self.sizer.Add(changelogcp, (0,0), span=(3,1), flag=wx.EXPAND)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
560 self.sizer.Add(branchcp, (0,1), span=(1,1))
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
561 self.sizer.Add(revlistcp, (2,1), span=(1,1), flag=wx.EXPAND)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
562 self.sizer.Add(cp, (1,1), span=(1,1))
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
563
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
564 self.buttons['delete'].Disable()
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
565 self.sizer.AddGrowableCol(0)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
566 self.sizer.AddGrowableCol(1)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
567 self.sizer.AddGrowableRow(2)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
568 self.SetSizer(self.sizer)
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
569 self.SetAutoLayout(True)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
570
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
571 self.currev = self.repo.changelog.rev(self.repo.branchtags()[self.current])
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
572 self.RevInfo(self.currev)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
573 self.revlist.Select(self.revlist.FindItem(0, str(self.currev), 1))
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
574 self.BranchInfo(self.current)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
575 self.Bind(wx.EVT_CHOICE, self.PackageSet)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
576 self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.RevSet)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
577 self.Bind(wx.EVT_BUTTON, self.RevUpdate, self.buttons['update'])
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
578
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
579
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
580 def PackageSet(self, event):
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
581 self.current = self.branches.GetStringSelection()
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
582 branches = self.repo.branchtags()
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
583 heads = dict.fromkeys(self.repo.heads(), 1)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
584 l = [((n in heads), self.repo.changelog.rev(n), n, t) for t, n in branches.items()]
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
585 if self.current != type:
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
586 heads = dict.fromkeys(self.repo.heads(), self.repo.branchtags())
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
587 branches = dict.copy(self.repo.branchtags())
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
588 self.BranchInfo(self.current)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
589 self.RevInfo(self.current)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
590
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
591 def RevSet(self, event):
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
592 self.currev = self.revlist.GetItemText( self.revlist.GetFirstSelected() )
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
593 i = event.GetIndex()
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
594 self.revlist.Select(i, True)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
595 self.revlist.Focus(i)
22
8b168989c344 Traipse 'OpenRPG' {090827-04}
sirebral
parents: 18
diff changeset
596 self.BranchInfo(self.current)
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
597 if self.currev != self.revlist.GetItemText( self.revlist.GetFirstSelected() ):
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
598 self.RevInfo(self.currev)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
599
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
600 def RevInfo(self, rev):
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
601 self.revlist.DeleteAllItems()
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
602 self.revlist_a = []; self.revlist_b = {}
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
603 for heads in self.repo.changelog.reachable(self.repo.branchtags()[self.current]):
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
604 self.revlist_a.append(str(self.repo.changelog.rev(heads)))
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
605 self.revlist_b[str(self.repo.changelog.rev(heads))] = str(self.repo.changectx(heads))
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
606 self.revlist_a.sort()
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
607 for i in self.revlist_a:
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
608 self.revlist.InsertStringItem(0, str(i), 0 )
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
609 self.revlist.SetStringItem(0, 1, self.revlist_b[i])
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
610 self.revlist.SetColumnWidth(0, -1)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
611 self.revlist.SetColumnWidth(1, -1)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
612 self.revlist.Refresh()
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
613 self.BranchInfo(self.current)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
614
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
615 def BranchInfo(self, branch):
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
616 rs = self.repo.changectx( self.currev ).changeset()
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
617 self.changelog.SetValue('')
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
618 changelog = rs[4]
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
619 self.changelog.AppendText(changelog + '\n')
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
620 self.filelist.SetValue('')
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
621 self.filelist.AppendText("Currently selected branch: " + branch + "\n\nAuthor: "+rs[1]+"\n\n")
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
622 self.filelist.AppendText("Files Modified (in update): \n")
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
623 for f in rs[3]: self.filelist.AppendText(f+"\n")
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
624
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
625 def DelBranch(self, event):
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
626 pass
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
627
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
628 def RevUpdate(self, event):
27
51428d30c59e Traipse 'OpenRPG' {091003-00}
sirebral
parents: 22
diff changeset
629 dlg = wx.MessageDialog(None, 'Revision Updates are recommended for Developers only.\n\nAre you sure to preform a Revision Update?\n\nNewer builds tend to have less bugs while older revisions may no longer function properly.', 'Expert Feature', wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
51428d30c59e Traipse 'OpenRPG' {091003-00}
sirebral
parents: 22
diff changeset
630 if dlg.ShowModal() == wx.ID_YES:
51428d30c59e Traipse 'OpenRPG' {091003-00}
sirebral
parents: 22
diff changeset
631 dlg.Destroy()
51428d30c59e Traipse 'OpenRPG' {091003-00}
sirebral
parents: 22
diff changeset
632 filename = 'ignorelist.txt'
51428d30c59e Traipse 'OpenRPG' {091003-00}
sirebral
parents: 22
diff changeset
633 self.filename = dir_struct["home"] + 'upmana' + os.sep + filename
51428d30c59e Traipse 'OpenRPG' {091003-00}
sirebral
parents: 22
diff changeset
634 component.get('validate').config_file(filename, "default_ignorelist.txt")
51428d30c59e Traipse 'OpenRPG' {091003-00}
sirebral
parents: 22
diff changeset
635 self.mana = self.LoadDoc()
51428d30c59e Traipse 'OpenRPG' {091003-00}
sirebral
parents: 22
diff changeset
636 temp = dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep
51428d30c59e Traipse 'OpenRPG' {091003-00}
sirebral
parents: 22
diff changeset
637 for ignore in self.ignorelist:
51428d30c59e Traipse 'OpenRPG' {091003-00}
sirebral
parents: 22
diff changeset
638 shutil.copy(ignore, temp + ignore.split('/')[len(ignore.split('/')) - 1])
51428d30c59e Traipse 'OpenRPG' {091003-00}
sirebral
parents: 22
diff changeset
639 hg.clean(self.repo, self.currev)
51428d30c59e Traipse 'OpenRPG' {091003-00}
sirebral
parents: 22
diff changeset
640 for ignore in self.ignorelist:
51428d30c59e Traipse 'OpenRPG' {091003-00}
sirebral
parents: 22
diff changeset
641 shutil.copyfile(temp + ignore.split('/')[len(ignore.split('/')) - 1], ignore)
51428d30c59e Traipse 'OpenRPG' {091003-00}
sirebral
parents: 22
diff changeset
642 os.remove(temp + ignore.split('/')[len(ignore.split('/')) - 1])
51428d30c59e Traipse 'OpenRPG' {091003-00}
sirebral
parents: 22
diff changeset
643 else:
51428d30c59e Traipse 'OpenRPG' {091003-00}
sirebral
parents: 22
diff changeset
644 dlg.Destroy(); pass
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
645
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
646 def LoadDoc(self):
31
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
647 manifest = open(self.filename)
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
648 self.ignorelist = []
31
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
649 ignore = manifest.readlines()
36
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
650 for i in ignore: self.ignorelist.append(str(i[:len(i)-1]))
31
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
651 manifest.close()
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
652
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
653 def get_packages(self, type=None):
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
654 #Can be cleaner
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
655 self.package_list = []
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
656 b = self.repo.branchtags()
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
657 heads = dict.fromkeys(self.repo.heads(), 1) #The code below looks superfluous but there is good info inside
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
658 l = [((n in heads), self.repo.changelog.rev(n), n, t) for t, n in b.items()]
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
659 l.sort()
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
660 l.reverse()
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
661 for ishead, r, n, t in l: self.package_list.append(t)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
662
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
663 def get_package(self):
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
664 self.get_packages()
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
665 if self.package_list == None: return None
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
666 return None
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
667
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
668 class Help(wx.Panel):
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
669 def __init__(self, parent):
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
670 wx.Panel.__init__(self, parent)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
671 sizer = wx.BoxSizer(wx.VERTICAL)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
672 self.help = wx.TextCtrl(self, wx.ID_ANY, size=(-1, -1),
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
673 style=wx.TE_MULTILINE | wx.TE_READONLY)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
674 sizer.Add(self.help, 1, wx.EXPAND)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
675 self.build_help()
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
676 self.SetSizer(sizer)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
677 self.Layout()
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
678
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
679 def build_help(self):
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
680 help = """'Traipse' OpenRPG Update Manager Help:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
681 The Traipse Update Manager can be confusing at first glance. There is alot involved in the new addition so it is easy to by pass the finer details. This small page will help a new user understand how to use the new Update Manager to it's full capability.\n\n"""
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
682 self.help.AppendText(help)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
683 help = """The Different Tabs: There are 5 different tabs available to users, and each tab has a different purpose. These five tabs are: Updater, Repos, Manifest, Control and Help.
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
684 ---
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
685
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
686 The Updater Tab:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
687 The Updater tab is divided into three sections. The left section shows a description of the your current or selected version. The right top section shows the files that have been updated in your current or selected version. Underneath is a selection of buttons and check boxes.
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
688
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
689 Package Select:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
690 When you press this button a small window pops up showing you the available packages to update too. You can select a package and the Updater's detail sections will reflect the change.
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
691
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
692 Update Now:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
693 Press this button when you want to update to the selected package
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
694
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
695 Auto Update:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
696 Check this if want to update when you start the software. You need to have a default Repository checked in the Repo tab.
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
697
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
698 No Update:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
699 Check this if you do not want to see the Update Manager when you start the software.
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
700 ---\n\n"""
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
701 self.help.AppendText(help)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
702 help = """The Repos Tab:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
703 The Repos tab has two parts to it. The top most part is a section is where you name and create repositories. The second part shows you a list of all your available repositories.
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
704
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
705 What is a repostiory?
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
706 1: a place, room, or container where something is deposited or stored (Merriam-Webster). A repository, or repo for short, is a place to hold source code so others can download it.
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
707
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
708 Creating new Repos:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
709 Creating a new repos is really easy. First you need to give your repo a name, any name will work, then press the New button. You will see that your named repo shows up in your list immediately.
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
710
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
711 You will then need to connect the named repo to a URL so you can download source code. Enter a URL (http://hg.assembla.com/traipse) into the new entry and press the Refresh button. This downloads the new source code to your computer only. Refreshing a repo does not update your software.
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
712
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
713 Default:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
714 You can set any repo as your default repository. This is the repo the software will update from if you Auto Update.
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
715 ---\n\n"""
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
716 self.help.AppendText(help)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
717 help = """The Manifest Tab:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
718 The Manifest Tab is really easy to understand, it's just named differently. The manifest shows a list of all the files that are being tracked by your current package. Checking files in the list will place them into a list that prevents these files from being changed when you update to a new package.
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
719
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
720 The manifest can cause problems with compatibility if the newer source does not understand the unchanged files, so it would be smart to test out a new package in a different folder.
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
721 ---\n\n"""
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
722 self.help.AppendText(help)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
723 help = """The Control Tab:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
724 The control tab is recommended for developers only. The control tab contains the two details elements from the Updater tab and a new section that contains all of the revisions for your selected package.
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
725
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
726 You can select any of the available packages from the drop down and the list of revisions will change. You can also select any of the revisions in the list and the details on the left side will change to reflect the details of that revision.
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
727
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
728 You are also allowed to update to any of the selected revisions. Older revisions often times contain bugs and newer methods of coding, so revision updates commonly cause problems with software.
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
729
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
730 What is the Control Tab for?
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
731 The control tab is for developers who want to see how the source code has changed from revision to revision. When a user downloads the software they also download all past revisions made to that software. This tab allows users to roll back if a problem has been created with new source, or for developers they can watch the software evolve.
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
732 ---"""
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
733 self.help.AppendText(help)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
734
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
735 class updaterFrame(wx.Frame):
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
736 def __init__(self, parent, title, openrpg, manifest, main):
17
265b987cce4f Traipse 'OpenRPG' {090813-00}
sirebral
parents: 16
diff changeset
737
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
738 wx.Frame.__init__(self, None, wx.ID_ANY, title, size=(600,500), style=wx.DEFAULT_FRAME_STYLE)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
739 if wx.Platform == '__WXMSW__': icon = wx.Icon(dir_struct["icon"]+'d20.ico', wx.BITMAP_TYPE_ICO)
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
740 else: icon = wx.Icon(dir_struct["icon"]+"d20.xpm", wx.BITMAP_TYPE_XPM )
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
741
17
265b987cce4f Traipse 'OpenRPG' {090813-00}
sirebral
parents: 16
diff changeset
742 self.SetIcon(icon)
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
743 self.main = main
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
744 ####### Panel Stuff ######
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
745 p = wx.Panel(self)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
746 nb = wx.Notebook(p)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
747
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
748 global statbar
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
749 statbar = self.CreateStatusBar()
31
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
750 sys.stdout = Term2Win()
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
751 self.Centre()
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
752
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
753 # create the page windows as children of the notebook
31
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
754 self.page1 = Updater(nb, openrpg)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
755 page2 = Repos(nb, openrpg)
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
756 page3 = Manifest(nb)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
757 page4 = Control(nb)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
758 page5 = Help(nb)
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
759
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
760 # add the pages to the notebook with the label to show on the tab
31
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
761 nb.AddPage(self.page1, "Updater")
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
762 nb.AddPage(page2, "Repos")
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
763 nb.AddPage(page3, "Manifest")
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
764 nb.AddPage(page4, "Control")
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
765 nb.AddPage(page5, 'Help')
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
766
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
767 # finally, put the notebook in a sizer for the panel to manage
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
768 # the layout
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
769 sizer = wx.BoxSizer()
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
770 sizer.Add(nb, 1, wx.EXPAND)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
771 p.SetSizer(sizer)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
772 p.Layout()
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
773 self.Refresh()
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
774 self.Bind(wx.EVT_CLOSE, self.OnClose)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
775 component.add('upmana-win', self)
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
776
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
777 def OnClose(self, event):
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
778 if self.main == False: self.Destroy()
17
265b987cce4f Traipse 'OpenRPG' {090813-00}
sirebral
parents: 16
diff changeset
779 if self.main == True: self.Hide()
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
780
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
781 class updateApp(wx.App):
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
782 def OnInit(self):
31
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
783 self.main = False; self.autoUpdate = False; self.noUpdate = False
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
784 logger._set_log_to_console(False)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
785 logger.note("Updater Start")
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
786 component.add('validate', validate)
31
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
787 self.updater = updaterFrame(self, "OpenRPG Update Manager 1.2",
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
788 component, manifest, self.main)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
789 if manifest.GetString("updatemana", "auto_update", "") == 'on' and self.main == False:
31
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
790 self.AutoUpdate(); self.OnExit(); self.autoUpdate = True
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
791 else: pass
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
792 if manifest.GetString('updatemana', 'no_update', '') == 'on' and self.main == False:
31
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
793 self.OnExit(); self.noUpdate = True
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
794 else: pass
31
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
795 if not (self.autoUpdate or self.noUpdate):
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
796 try:
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
797 self.updater.Show()
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
798 self.updater.Fit()
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
799 if not self.main: self.updater.page1.UpdateCheck()
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
800 except: pass
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
801 return True
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
802
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
803 def AutoUpdate(self):
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
804 self.ui = ui.ui()
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
805 self.repo = hg.repository(self.ui, ".")
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
806 self.c = self.repo.changectx('tip')
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
807 self.current = self.repo.dirstate.branch()
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
808
31
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
809 capture = manifest.GetString('default', 'repo', '')
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
810 if capture != '':
31
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
811 try: commands.pull(self.ui, self.repo, capture, rev='', update=False, force=True)
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
812 except:
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
813 wx.MessageBox('No Connection Found. Skipping Auto Update!', 'Info')
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
814 return
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
815 filename = 'ignorelist.txt'
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
816 self.filename = dir_struct["home"] + 'upmana' + os.sep + filename
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
817 component.get('validate').config_file(filename, "default_ignorelist.txt")
31
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
818 self.mana = self.LoadDoc(); ignored = []
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
819 temp = dir_struct["home"] + 'upmana' + os.sep + 'tmp' + os.sep
16
281ca8daa911 Traipse 'OpenRPG' {090808-00}
sirebral
parents: 14
diff changeset
820 for ignore in self.ignorelist:
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
821 if len(ignore.split('/')) > 1:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
822 gets = 0; dir1 = ''
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
823 while gets != len(ignore.split('/'))-1:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
824 dir1 += ignore.split('/')[gets] + os.sep
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
825 gets += 1
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
826 os.makedirs(temp+dir1)
31
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
827 ignoredfile = temp + dir1 + ignore.split('/')[len(ignore.split('/')) - 1]
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
828 ignored.append(ignoredfile)
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
829 shutil.copy(ignore, ignoredfile)
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
830 hg.clean(self.repo, self.current)
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
831 for ignore in self.ignorelist:
31
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
832 shutil.copyfile(ignored.index(ignore), ignore)
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
833 os.remove(ignored.index(ignore))
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
834 if len(ignore.split('/')) > 1:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
835 gets = 0; dir1 = ''
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
836 while gets != len(ignore.split('/'))-1:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
837 dir1 += ignore.split('/')[gets] + os.sep
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
838 gets += 1
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
839 os.removedirs(temp+dir1)
31
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
840 else: wx.MessageBox('Default Repo Not Found. Skipping Auto Update!', 'Info')
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
841
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
842 def LoadDoc(self):
31
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
843 manifest = open(self.filename)
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
844 self.ignorelist = []
31
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
845 ignore = manifest.readlines()
36
d02e9197c066 Traipse 'OpenRPG' {101220-00}
sirebral
parents: 31
diff changeset
846 for i in ignore: self.ignorelist.append(str(i[:len(i)-1]))
31
fc48380f0c9f Traipse Beta 'OpenRPG' {100503-00}
sirebral
parents: 28
diff changeset
847 manifest.close()
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
848
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
849 def OnExit(self):
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
850 imported = ['manifest', 'orpg.dirpath', 'orpg.orpgCore', 'orpg.orpg_version',
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
851 'orpg.tools.orpg_log', 'orpg.tools.orpg_log', 'orpg.orpg_xml', 'orpg.dirpath',
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 17
diff changeset
852 'orpg.dirpath', 'upmana.validate', 'mercurial.ui', 'mercurial.hg',
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
853 'mercurial.commands', 'mercurial.repo', 'mercurial.revlog', 'mercurial.cmdutil', 'shutil']
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
854 for name in imported:
14
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
855 if name in sys.modules: del sys.modules[name]
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
856
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
857 try: self.updater.Destroy()
e8260c6cb309 Traipse 'OpenRPG' {090806-00}
sirebral
parents:
diff changeset
858 except: pass