comparison upmana/updatemana.py @ 40:95db4430caed traipse_dev

If you have nothing in the list, New button works now. Adds duplicates though and screen updates incorrectly.
author sirebral
date Wed, 05 Aug 2009 09:10:40 -0500
parents 93a27aea09ce
children 6d18ee109e02
comparison
equal deleted inserted replaced
39:93a27aea09ce 40:95db4430caed
241 self.sizers["newrepo_layout"].Add(empty, -1) 241 self.sizers["newrepo_layout"].Add(empty, -1)
242 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)
243 self.sizers["newrepo_layout"].Add(self.texts["reponame"], -1, wx.EXPAND) 243 self.sizers["newrepo_layout"].Add(self.texts["reponame"], -1, wx.EXPAND)
244 self.sizers["newrepo_layout"].AddGrowableCol(1) 244 self.sizers["newrepo_layout"].AddGrowableCol(1)
245 self.sizers["newbutton"].Add(self.sizers["newrepo_layout"], -1, wx.EXPAND) 245 self.sizers["newbutton"].Add(self.sizers["newrepo_layout"], -1, wx.EXPAND)
246 246 #Repo List Panel
247 self.repopanel = wx.ScrolledWindow(self) 247 self.repopanel = wx.ScrolledWindow(self)
248 self.repopanel.SetScrollbars(20,20,55,40) 248 self.repopanel.SetScrollbars(20,20,55,40)
249 self.repopanel.Scroll(50,10) 249 self.repopanel.Scroll(50,10)
250
251 self.box_sizers["repolist"] = wx.StaticBox(self.repopanel, -1, "Current Repo List") 250 self.box_sizers["repolist"] = wx.StaticBox(self.repopanel, -1, "Current Repo List")
252 self.sizers["repolist"] = wx.StaticBoxSizer(self.box_sizers["repolist"], wx.VERTICAL) 251 self.sizers["repolist"] = wx.StaticBoxSizer(self.box_sizers["repolist"], wx.VERTICAL)
253
254 self.sizers["repo"] = wx.GridBagSizer(hgap=2, vgap=2) 252 self.sizers["repo"] = wx.GridBagSizer(hgap=2, vgap=2)
255 self.sizers["repolist_layout"] = wx.FlexGridSizer(rows=1, cols=1, hgap=2, vgap=5) 253 self.sizers["repolist_layout"] = wx.FlexGridSizer(rows=1, cols=1, hgap=2, vgap=5)
256 self.manifest = manifest 254 self.manifest = manifest
257 255
258 self.BuildRepoList(None) 256 self.BuildRepoList(None)
259 257
260
261 self.sizers["repolist_layout"].AddGrowableCol(0) 258 self.sizers["repolist_layout"].AddGrowableCol(0)
262 self.sizers["repolist"].Add(self.sizers["repolist_layout"], -1, wx.EXPAND) 259 self.sizers["repolist"].Add(self.sizers["repolist_layout"], -1, wx.EXPAND)
263
264 self.sizers["repo"].Add(self.sizers["repolist"], (0,0), flag=wx.EXPAND) 260 self.sizers["repo"].Add(self.sizers["repolist"], (0,0), flag=wx.EXPAND)
265 self.sizers["repo"].AddGrowableCol(0) 261 self.sizers["repo"].AddGrowableCol(0)
266 self.sizers['repo'].AddGrowableRow(0) 262 self.sizers['repo'].AddGrowableRow(0)
263 self.sizers['repo'].AddGrowableRow(1)
267 self.repopanel.SetSizer(self.sizers['repo']) 264 self.repopanel.SetSizer(self.sizers['repo'])
268 self.repopanel.SetAutoLayout(True) 265 self.repopanel.SetAutoLayout(True)
269 266
270 #Build Main Sizer 267 #Build Main Sizer
271 self.sizers["main"].Add(self.sizers["newbutton"], (0,0), flag=wx.EXPAND) 268 self.sizers["main"].Add(self.sizers["newbutton"], (0,0), flag=wx.EXPAND)
272 self.sizers["main"].Add(self.repopanel, (1,0), flag=wx.EXPAND) 269 self.sizers["main"].Add(self.repopanel, (1,0), flag=wx.EXPAND)
273 self.sizers["main"].AddGrowableCol(0) 270 self.sizers["main"].AddGrowableCol(0)
274 self.sizers["main"].AddGrowableCol(1) 271 self.sizers["main"].AddGrowableCol(1)
275 self.sizers["main"].AddGrowableRow(1) 272 self.sizers["main"].AddGrowableRow(1)
276 self.SetSizer(self.sizers["main"]) 273 self.SetSizer(self.sizers["main"])
277
278 self.SetAutoLayout(True) 274 self.SetAutoLayout(True)
279 self.Fit() 275 self.Fit()
280
281 self.Bind(wx.EVT_BUTTON, self.AddRepo, self.buttons['addrepo']) 276 self.Bind(wx.EVT_BUTTON, self.AddRepo, self.buttons['addrepo'])
282 277
283 def BuildRepoList(self, event): 278 def BuildRepoList(self, event):
284 self.repolist = [] 279 self.repolist = self.manifest.GetList('UpdateManifest', 'repolist', '')
285 for v in self.manifest.GetList('UpdateManifest', 'repolist', ''): self.repolist.append(v)
286 280
287 self.id = 0; self.box = {}; self.main = {}; self.container = {}; self.layout = {} 281 self.id = 0; self.box = {}; self.main = {}; self.container = {}; self.layout = {}
288 self.name = {}; self.url = {}; self.pull = {}; self.uri = {}; self.delete = {} 282 self.name = {}; self.url = {}; self.pull = {}; self.uri = {}; self.delete = {}
289 self.defaultcheck = {}; self.default = {}; self.repotrac = {} 283 self.defaultcheck = {}; self.default = {}; self.repotrac = {}
290 self.pull_list = {}; self.delete_list = {}; self.defchecklist = {} 284 self.pull_list = {}; self.delete_list = {}; self.defchecklist = {}
291 285
292 #wx.Yeild() For future refrence. 286 #wx.Yeild() For future refrence.
293 287
294 #Repo Name; Static Text; URL; Button.
295 for repo in self.repolist: 288 for repo in self.repolist:
296 self.id += 1 289 self.id += 1
297 self.box[self.id] = wx.StaticBox(self.repopanel, -1, str(repo)) 290 self.box[self.id] = wx.StaticBox(self.repopanel, -1, str(repo))
298 self.main[self.id] = wx.GridBagSizer(hgap=2, vgap=2) 291 self.main[self.id] = wx.GridBagSizer(hgap=2, vgap=2)
299 self.container[self.id] = wx.StaticBoxSizer(self.box[self.id], wx.VERTICAL) 292 self.container[self.id] = wx.StaticBoxSizer(self.box[self.id], wx.VERTICAL)
318 self.container[self.id].Add(self.layout[self.id], -1, wx.EXPAND) 311 self.container[self.id].Add(self.layout[self.id], -1, wx.EXPAND)
319 self.Bind(wx.EVT_BUTTON, self.RefreshRepo, self.pull[self.id]) 312 self.Bind(wx.EVT_BUTTON, self.RefreshRepo, self.pull[self.id])
320 self.sizers["repolist_layout"].Insert(0, self.container[self.id], -1, wx.EXPAND) 313 self.sizers["repolist_layout"].Insert(0, self.container[self.id], -1, wx.EXPAND)
321 self.sizers['repolist_layout'].Layout() 314 self.sizers['repolist_layout'].Layout()
322 315
323
324 def AddRepo(self, event): 316 def AddRepo(self, event):
325 repo = self.texts['reponame'].GetValue(); repo = repo.replace(' ', '_'); repo = 'repo-' + repo 317 repo = self.texts['reponame'].GetValue(); repo = repo.replace(' ', '_'); repo = 'repo-' + repo
326 self.manifest.SetString('updaterepo', repo, ''); repo = repo.split(',') 318 self.manifest.SetString('updaterepo', repo, ''); repo = repo.split(',')
327 repolist = self.manifest.GetList('UpdateManifest', 'repolist', ''); repo = repolist + repo 319 repolist = self.manifest.GetList('UpdateManifest', 'repolist', '')
328 self.manifest.SetList('UpdateManifest', 'repolist', repo) 320 if repolist == '':
321 pass
322 else:
323 repo = repolist + repo
324 self.manifest.SetList('UpdateManifest', 'repolist', repo); print repo
329 self.BuildRepoList(None) 325 self.BuildRepoList(None)
330 326
331 def RefreshRepo(self, event): 327 def RefreshRepo(self, event):
332 print self.pull_list[event.GetEventObject()] 328 print self.pull_list[event.GetEventObject()]
333 329