Changeset 3 for trunk/src/CreateKit.py
- Timestamp:
- 11-09-2008 17:17:52 (5 years ago)
- Files:
-
- 1 modified
-
trunk/src/CreateKit.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/CreateKit.py
r2 r3 31 31 apt_pkg.init() 32 32 33 class ProgressBar(): 34 def __init__(self, dialogName, pbobj): 35 self._progressbar = pbobj 36 self._dialog = dialogName 37 38 def progressbarTimeout(self, pbobj): 39 pbobj.pulse() 40 return True 41 42 def start(self): 43 self._dialog.show() 44 self._timer = gobject.timeout_add(100, self.progressbarTimeout, self._progressbar) 45 46 def stop(self): 47 gobject.source_remove(self._timer) 48 self._timer = 0 49 self._dialog.hide() 50 51 33 52 class CreateKitGTK(threading.Thread): 34 53 … … 45 64 # 46 65 # Package list 47 # 48 def progressbarTimeout(pbobj, val): 49 print pbobj 50 print val 51 if pbobj.activity_check.get_active(): 52 pbobj.pulse() 53 else: 54 # Calculate the value of the progress bar using the 55 # value range set in the adjustment object 56 new_val = pbobj.get_fraction() + 0.01 57 if new_val > 1.0: 58 new_val = 0.0 59 # Set the new value 60 pbobj.set_fraction(new_val) 61 62 # As this is a timeout function, return TRUE so that it 63 # continues to get called 64 return True 65 66 # 66 67 def setupPackageList(self, ignore=True): 67 self.window.set_sensitive(False) 68 self.cpbar = ProgressBar(self.dialogProgress, self.pbar) 69 self.cpbar.start() 70 68 71 self.treeStore = gtk.TreeStore(gobject.TYPE_BOOLEAN, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING) 69 self.dialogProgress.show()70 self.pbar.pulse()71 self.pbar.set_fraction(0.0)72 #t = gobject.timeout_add(100, self.progressbarTimeout, self.pbar)73 72 74 73 time.sleep(1) 75 self.stopthread = threading.Event()76 74 cache = apt_pkg.GetCache(progress.TextProgress()) 77 75 records = apt_pkg.GetPkgRecords(cache) … … 79 77 pkgList = [] 80 78 #while not self.stopthread.isSet(): 81 79 count=0 82 80 gtk.gdk.threads_enter() 83 81 for pkg in packages: 84 82 for pkgInfo in pkg.VersionList: 85 83 for packFile, index in pkgInfo.FileList: 84 count += 1 85 print count 86 86 records.Lookup((packFile,index)) 87 87 if packFile.IndexType != 'Debian Package Index' and ignore: 88 88 continue 89 89 pkgList.append((None,(None, pkg.Name, pkgInfo.VerStr, records.ShortDesc))) 90 91 #self.pbar.set_fraction(util.pbarFraction(count, cache.PackageCount)) 92 #print self.pbar.get_fraction() 93 90 94 #print (None, pkg.Name, pkgInfo.VerStr, records.ShortDesc, packFile.IndexType) 91 95 … … 114 118 115 119 gtk.gdk.threads_leave() 116 self.dialogProgress.hide() 117 self.window.set_sensitive(True) 118 #self.stopthread.set() 120 self.stopthread.set() 121 122 self.stopthread.set() 123 124 #self.window.set_sensitive(True) 119 125 120 126 def colToggledClicked( self, cell, path, model ): … … 163 169 self.gladefile = "CreateKit.glade" 164 170 self.wTree = gtk.glade.XML(self.gladefile) 171 172 self.stopthread = threading.Event() 165 173 166 174 #botoes do notebook … … 229 237 230 238 #treeview 231 #self.setupPackageList() 239 #self.cpbar = ProgressBar(self.dialogProgress, self.pbar) 240 #self.cpbar.start() 232 241 threading.Thread(name="self.setupPackageList", target=self.setupPackageList).start() 242 233 243 #self.ProgTest() 234 244