Mercurial > traipse_dev
comparison upmana/updatemana.py @ 36:683536732926 traipse_dev
Update Manager 0.4. This is lookign really really nice now. OMG!!
Did you see what I did to make the repos list?? I am lost on Refresh and
Delete events. q_q.
author | sirebral |
---|---|
date | Mon, 03 Aug 2009 20:50:24 -0500 |
parents | 0b0c553d50f5 |
children | cd8f740a8ffc |
comparison
equal
deleted
inserted
replaced
35:0b0c553d50f5 | 36:683536732926 |
---|---|
166 #for st, rev, fns in changeiter: | 166 #for st, rev, fns in changeiter: |
167 # revbranch = get(rev)[5]['branch']; print revbranch | 167 # revbranch = get(rev)[5]['branch']; print revbranch |
168 | 168 |
169 heads = dict.fromkeys(self.repo.heads(), self.repo.branchtags()) | 169 heads = dict.fromkeys(self.repo.heads(), self.repo.branchtags()) |
170 branches = dict.copy(self.repo.branchtags()) | 170 branches = dict.copy(self.repo.branchtags()) |
171 | |
172 self.BranchInfo(self.current) | 171 self.BranchInfo(self.current) |
173 | |
174 | 172 |
175 def BranchInfo(self, branch): | 173 def BranchInfo(self, branch): |
176 self.filelist.SetValue('') | 174 self.filelist.SetValue('') |
177 self.filelist.AppendText("Files that will change\n\n") | 175 self.filelist.AppendText("Files that will change\n\n") |
178 self.changelog.SetValue('') | 176 self.changelog.SetValue('') |
179 changelog = "This is Dev Build 0.3 of the Update Manager. It has limited functionality.\n\nThe full release will search your Revision log and show the contents here." | 177 changelog = "Traipse 'OpenRPG' Update Manager.\n\nThis is Dev Build 0.4 of the Update Manager. It has limited functionality.\n\nThe full release will search your Revision log and show the contents here.\n\nMajor changes in this version are ... Manifest is now in a CheckListBox, very nice, Repos now allow for scrolling, New button works. Checks Box on the Updater tab work. Settings file is created and data is saved to it." |
180 self.changelog.AppendText(changelog + '\n') | 178 self.changelog.AppendText(changelog + '\n') |
181 self.filelist.AppendText("Update to " + branch + "\n\n The full release will show the files to be changed here.") | 179 self.filelist.AppendText("Update to " + branch + "\n\n The full release will show the files to be changed here.") |
182 | 180 |
183 #### Files works but not fully without the change log information, pulled for Dev 0.1 | 181 #### Files works but not fully without the change log information, pulled for Dev 0.1 |
184 #for f in files: | 182 #for f in files: |
222 self.texts = {} | 220 self.texts = {} |
223 | 221 |
224 ## Section Sizers (with frame edges and text captions) | 222 ## Section Sizers (with frame edges and text captions) |
225 self.box_sizers = {} | 223 self.box_sizers = {} |
226 self.box_sizers["newbutton"] = wx.StaticBox(self, -1) | 224 self.box_sizers["newbutton"] = wx.StaticBox(self, -1) |
227 self.box_sizers["repolist"] = wx.StaticBox(self, -1, "Current Repo List") | |
228 | 225 |
229 ## Layout Sizers | 226 ## Layout Sizers |
230 self.sizers = {} | 227 self.sizers = {} |
231 self.sizers["main"] = wx.GridBagSizer(hgap=2, vgap=2) | 228 self.sizers["main"] = wx.GridBagSizer(hgap=2, vgap=2) |
232 self.sizers["repo"] = wx.GridBagSizer(hgap=2, vgap=2) | |
233 self.sizers["button"] = wx.GridBagSizer(hgap=2, vgap=2) | 229 self.sizers["button"] = wx.GridBagSizer(hgap=2, vgap=2) |
234 | 230 |
231 #Button Layout | |
235 self.sizers["newbutton"] = wx.StaticBoxSizer(self.box_sizers["newbutton"], wx.VERTICAL) | 232 self.sizers["newbutton"] = wx.StaticBoxSizer(self.box_sizers["newbutton"], wx.VERTICAL) |
236 | |
237 self.sizers["repolist"] = wx.StaticBoxSizer(self.box_sizers["repolist"], wx.VERTICAL) | |
238 | |
239 #Button Layout | |
240 #self.buttonpanel = wx.Panel(upmana.updatemana.Repos, -1) | |
241 self.sizers["newrepo_layout"] = wx.FlexGridSizer(rows=1, cols=2, hgap=2, vgap=5) | 233 self.sizers["newrepo_layout"] = wx.FlexGridSizer(rows=1, cols=2, hgap=2, vgap=5) |
242 empty = wx.StaticText(self, -1, "") | 234 empty = wx.StaticText(self, -1, "") |
243 reponame = wx.StaticText(self, -1, "Name:") | 235 reponame = wx.StaticText(self, -1, "Name:") |
244 self.texts["reponame"] = wx.TextCtrl(self, -1, '') | 236 self.texts["reponame"] = wx.TextCtrl(self, -1, '') |
245 self.buttons['addrepo'] = wx.Button(self, wx.ID_NEW) | 237 self.buttons['addrepo'] = wx.Button(self, wx.ID_NEW) |
238 | |
246 ##Build Button | 239 ##Build Button |
247 self.sizers["newrepo_layout"].Add(self.buttons['addrepo'], -1, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL) | 240 self.sizers["newrepo_layout"].Add(self.buttons['addrepo'], -1, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL) |
248 self.sizers["newrepo_layout"].Add(empty, -1) | 241 self.sizers["newrepo_layout"].Add(empty, -1) |
249 self.sizers["newrepo_layout"].Add(reponame, -1, wx.ALIGN_CENTER|wx.ALIGN_CENTER_VERTICAL|wx.ALL) | 242 self.sizers["newrepo_layout"].Add(reponame, -1, wx.ALIGN_CENTER|wx.ALIGN_CENTER_VERTICAL|wx.ALL) |
250 self.sizers["newrepo_layout"].Add(self.texts["reponame"], -1, wx.EXPAND) | 243 self.sizers["newrepo_layout"].Add(self.texts["reponame"], -1, wx.EXPAND) |
251 self.sizers["newrepo_layout"].AddGrowableCol(1) | 244 self.sizers["newrepo_layout"].AddGrowableCol(1) |
252 self.sizers["newbutton"].Add(self.sizers["newrepo_layout"], -1, wx.EXPAND) | 245 self.sizers["newbutton"].Add(self.sizers["newrepo_layout"], -1, wx.EXPAND) |
253 | 246 |
254 #Repo List Layout | 247 self.repopanel = wx.ScrolledWindow(self) |
255 ##Needs a new Panel | 248 self.repopanel.SetScrollbars(20,20,55,40) |
256 | 249 self.repopanel.Scroll(50,10) |
250 | |
251 self.box_sizers["repolist"] = wx.StaticBox(self.repopanel, -1, "Current Repo List") | |
252 self.sizers["repolist"] = wx.StaticBoxSizer(self.box_sizers["repolist"], wx.VERTICAL) | |
253 | |
254 self.sizers["repo"] = wx.GridBagSizer(hgap=2, vgap=2) | |
257 self.sizers["repolist_layout"] = wx.FlexGridSizer(rows=1, cols=1, hgap=2, vgap=5) | 255 self.sizers["repolist_layout"] = wx.FlexGridSizer(rows=1, cols=1, hgap=2, vgap=5) |
258 self.manifest = manifest | 256 self.manifest = manifest |
259 | 257 |
260 self.repolist = [] | 258 self.repolist = [] |
261 for v in self.manifest.GetList('UpdateManifest', 'repolist', ''): self.repolist.append(v) | 259 for v in self.manifest.GetList('UpdateManifest', 'repolist', ''): self.repolist.append(v) |
262 | 260 |
263 self.id = 1; self.box = {}; self.main = {}; self.container = {}; self.layout = {} | 261 self.id = 1; self.box = {}; self.main = {}; self.container = {}; self.layout = {} |
264 self.name = {}; self.url = {}; self.pull = {}; self.uri = {}; self.delete = {} | 262 self.name = {}; self.url = {}; self.pull = {}; self.uri = {}; self.delete = {} |
265 self.defaultcheck = {}; self.default = {} | 263 self.defaultcheck = {}; self.default = {}; self.repotrac = {} |
266 | 264 |
267 #wx.Yeild() For future refrence. | 265 #wx.Yeild() For future refrence. |
268 | 266 |
269 #Repo Name; Static Text; URL; Button. | 267 #Repo Name; Static Text; URL; Button. |
270 for repo in self.repolist: | 268 for repo in self.repolist: |
271 self.box[self.id] = wx.StaticBox(self, -1, str(repo)) | 269 #self.repotrac[self.id] = repo |
270 self.box[self.id] = wx.StaticBox(self.repopanel, -1, str(repo)) | |
272 self.main[self.id] = wx.GridBagSizer(hgap=2, vgap=2) | 271 self.main[self.id] = wx.GridBagSizer(hgap=2, vgap=2) |
273 self.container[self.id] = wx.StaticBoxSizer(self.box[self.id], wx.VERTICAL) | 272 self.container[self.id] = wx.StaticBoxSizer(self.box[self.id], wx.VERTICAL) |
274 | 273 |
275 self.layout[self.id] = wx.FlexGridSizer(rows=1, cols=4, hgap=2, vgap=5) | 274 self.layout[self.id] = wx.FlexGridSizer(rows=1, cols=4, hgap=2, vgap=5) |
276 self.name[self.id] = wx.StaticText(self, -1, 'URL') | 275 self.name[self.id] = wx.StaticText(self.repopanel, -1, 'URL') |
277 self.uri[self.id] = self.manifest.GetString('updaterepo', repo, '') | 276 self.uri[self.id] = self.manifest.GetString('updaterepo', repo, '') |
278 self.url[self.id] = wx.TextCtrl(self, -1, self.uri[self.id]) | 277 self.url[self.id] = wx.TextCtrl(self.repopanel, -1, self.uri[self.id]) |
279 self.pull[self.id] = wx.Button(self, wx.ID_REFRESH) | 278 self.pull[self.id] = wx.Button(self.repopanel, wx.ID_REFRESH) |
280 self.delete[self.id] = wx.Button(self, wx.ID_DELETE) | 279 self.delete[self.id] = wx.Button(self.repopanel, wx.ID_DELETE) |
281 self.defaultcheck[self.id] = wx.CheckBox(self, -1) | 280 self.defaultcheck[self.id] = wx.CheckBox(self.repopanel, -1) |
282 self.default[self.id] = wx.StaticText(self, -1, 'Default') | 281 self.default[self.id] = wx.StaticText(self.repopanel, -1, 'Default') |
283 | 282 |
284 self.layout[self.id].Add(self.name[self.id], -1, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL) | 283 self.layout[self.id].Add(self.name[self.id], -1, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL) |
285 self.layout[self.id].Add(self.url[self.id], -1, wx.EXPAND) | 284 self.layout[self.id].Add(self.url[self.id], -1, wx.EXPAND) |
286 self.layout[self.id].Add(self.pull[self.id], -1, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALL) | 285 self.layout[self.id].Add(self.pull[self.id], -1, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALL) |
287 self.layout[self.id].Add(self.delete[self.id], -1, wx.EXPAND) | 286 self.layout[self.id].Add(self.delete[self.id], -1, wx.EXPAND) |
292 self.sizers["repolist_layout"].Add(self.container[self.id], -1, wx.EXPAND) | 291 self.sizers["repolist_layout"].Add(self.container[self.id], -1, wx.EXPAND) |
293 | 292 |
294 self.sizers["repolist_layout"].AddGrowableCol(0) | 293 self.sizers["repolist_layout"].AddGrowableCol(0) |
295 self.sizers["repolist"].Add(self.sizers["repolist_layout"], -1, wx.EXPAND) | 294 self.sizers["repolist"].Add(self.sizers["repolist_layout"], -1, wx.EXPAND) |
296 | 295 |
296 self.sizers["repo"].Add(self.sizers["repolist"], (0,0), flag=wx.EXPAND) | |
297 self.sizers["repo"].AddGrowableCol(0) | |
298 self.sizers['repo'].AddGrowableRow(0) | |
299 self.repopanel.SetSizer(self.sizers['repo']) | |
300 self.repopanel.SetAutoLayout(True) | |
301 | |
297 #Build Main Sizer | 302 #Build Main Sizer |
298 self.sizers["main"].Add(self.sizers["newbutton"], (0,0), flag=wx.EXPAND) | 303 self.sizers["main"].Add(self.sizers["newbutton"], (0,0), flag=wx.EXPAND) |
299 self.sizers["main"].Add(self.sizers["repolist"], (1,0), flag=wx.EXPAND) | 304 self.sizers["main"].Add(self.repopanel, (1,0), flag=wx.EXPAND) |
300 #self.sizers['main'].Add(self.buttonpanel, (0,0), flag=wx.EXPAND) | |
301 #self.sizers['main'].Add(self.sizers['repo'], (1,0), flag=wx.EXPAND) | |
302 self.sizers["main"].AddGrowableCol(0) | 305 self.sizers["main"].AddGrowableCol(0) |
303 self.sizers["main"].AddGrowableCol(1) | 306 self.sizers["main"].AddGrowableCol(1) |
304 self.sizers["main"].AddGrowableRow(1) | 307 self.sizers["main"].AddGrowableRow(1) |
305 self.SetSizer(self.sizers["main"]) | 308 self.SetSizer(self.sizers["main"]) |
306 | 309 |
307 self.SetAutoLayout(True) | 310 self.SetAutoLayout(True) |
308 self.Fit() | 311 self.Fit() |
309 | 312 |
310 self.Bind(wx.EVT_BUTTON, self.AddRepo, self.buttons['addrepo']) | 313 self.Bind(wx.EVT_BUTTON, self.AddRepo, self.buttons['addrepo']) |
314 self.Bind(wx.EVT_BUTTON, self.RefreshRepo, self.pull[self.id]) | |
311 | 315 |
312 def AddRepo(self, event): | 316 def AddRepo(self, event): |
313 repo = self.texts['reponame'].GetValue(); repo = repo.replace(' ', '_'); repo = 'repo-' + repo | 317 repo = self.texts['reponame'].GetValue(); repo = repo.replace(' ', '_'); repo = 'repo-' + repo |
314 self.manifest.SetString('updaterepo', repo, ''); repo = repo.split(',') #Sets URL | 318 self.manifest.SetString('updaterepo', repo, ''); repo = repo.split(',') |
315 repolist = self.manifest.GetList('UpdateManifest', 'repolist', ''); repo = repolist + repo | 319 repolist = self.manifest.GetList('UpdateManifest', 'repolist', ''); repo = repolist + repo |
316 self.manifest.SetList('UpdateManifest', 'repolist', repo) | 320 self.manifest.SetList('UpdateManifest', 'repolist', repo) |
321 | |
322 def RefreshRepo(self, event): | |
323 pass #print str(event) #repo = self.repolist[event]; print repo | |
317 | 324 |
318 | 325 |
319 class Manifest(wx.Panel): | 326 class Manifest(wx.Panel): |
320 def __init__(self, parent): | 327 def __init__(self, parent): |
321 wx.Panel.__init__(self, parent) | 328 wx.Panel.__init__(self, parent) |
326 self.manifestlist = self.c.manifest().keys() | 333 self.manifestlist = self.c.manifest().keys() |
327 self.manifestlist.sort() | 334 self.manifestlist.sort() |
328 self.SetBackgroundColour(wx.WHITE) | 335 self.SetBackgroundColour(wx.WHITE) |
329 self.sizer = wx.GridBagSizer(hgap=1, vgap=1) | 336 self.sizer = wx.GridBagSizer(hgap=1, vgap=1) |
330 | 337 |
331 #self.manifestlog = wx.TextCtrl(self, wx.ID_ANY, size=(400, -1), style=wx.TE_MULTILINE | wx.TE_READONLY) | 338 self.manifestlog = wx.CheckListBox( self, -1, wx.DefaultPosition, wx.DefaultSize, self.manifestlist, |
332 self.manifestlog = wx.ListCtrl( self, -1, size=(400, -1) ) | 339 wx.LC_REPORT|wx.SUNKEN_BORDER|wx.EXPAND|wx.LC_HRULES) |
333 self.manifestlog.InsertColumn( 0, "ID" ) | |
334 self.manifestlog.InsertColumn( 1, "Player" ) | |
335 self.manifestlog.SetStringItem(0,1,'dog') | |
336 | 340 |
337 self.sizer.Add(self.manifestlog, (0,0), flag=wx.EXPAND) | 341 self.sizer.Add(self.manifestlog, (0,0), flag=wx.EXPAND) |
338 self.sizer.AddGrowableCol(0) | 342 self.sizer.AddGrowableCol(0) |
339 self.sizer.AddGrowableRow(0) | 343 self.sizer.AddGrowableRow(0) |
340 self.SetSizer(self.sizer) | 344 self.SetSizer(self.sizer) |
341 self.SetAutoLayout(True) | 345 self.SetAutoLayout(True) |
342 #self.BuildManifest() | |
343 | |
344 def BuildManifest(self): | |
345 self.manifestlog.SetValue('') | |
346 self.manifestlog.AppendText('Currently the Manifest Log shows your files only, later you will be able to select files to ingore on update\n') | |
347 for i in self.manifestlist: | |
348 self.manifestlog.AppendText(i + '\n') | |
349 | 346 |
350 class Control(wx.Panel): | 347 class Control(wx.Panel): |
351 def __init__(self, parent): | 348 def __init__(self, parent): |
352 wx.Panel.__init__(self, parent) | 349 wx.Panel.__init__(self, parent) |
353 t = wx.StaticText(self, -1, "Here you will be able to control your branches, delete branches, \nupdate to a sepcific revision, and that type of control.", (10,60)) | |
354 | 350 |
355 | 351 |
356 class updaterFrame(wx.Frame): | 352 class updaterFrame(wx.Frame): |
357 def __init__(self, parent, title, openrpg, manifest): | 353 def __init__(self, parent, title, openrpg, manifest): |
358 wx.Frame.__init__(self, None, wx.ID_ANY, title, size=(640,480), | 354 wx.Frame.__init__(self, None, wx.ID_ANY, title, size=(640,480), |
392 self.open_rpg.add_component("log", self.log) | 388 self.open_rpg.add_component("log", self.log) |
393 self.open_rpg.add_component("xml", orpg.orpg_xml) | 389 self.open_rpg.add_component("xml", orpg.orpg_xml) |
394 self.open_rpg.add_component("dir_struct", orpg.dirpath.dir_struct) | 390 self.open_rpg.add_component("dir_struct", orpg.dirpath.dir_struct) |
395 self.validate = orpg.tools.validate.Validate() | 391 self.validate = orpg.tools.validate.Validate() |
396 self.open_rpg.add_component("validate", self.validate) | 392 self.open_rpg.add_component("validate", self.validate) |
397 self.updater = updaterFrame(self, "OpenRPG Update Manager Beta 0.3", self.open_rpg, self.manifest) | 393 self.updater = updaterFrame(self, "OpenRPG Update Manager Beta 0.4", self.open_rpg, self.manifest) |
398 self.updated = False | 394 self.updated = False |
399 try: | 395 try: |
400 self.updater.Show() | 396 self.updater.Show() |
401 self.SetTopWindow(self.updater) | 397 self.SetTopWindow(self.updater) |
402 self.updater.Fit() | 398 self.updater.Fit() |