diff options
author | necoro <> | 2006-09-17 17:22:10 +0000 |
---|---|---|
committer | necoro <> | 2006-09-17 17:22:10 +0000 |
commit | fe43409d7ac9c2527ab99847fecdace175b3b81d (patch) | |
tree | e1427112c6ffbc98986d4eaa7cee9949842527b4 /geneticone/gui | |
parent | 1bf23a35968801e6884b97b4cd8cc923bd91f3ec (diff) | |
download | portato-fe43409d7ac9c2527ab99847fecdace175b3b81d.tar.gz portato-fe43409d7ac9c2527ab99847fecdace175b3b81d.tar.bz2 portato-fe43409d7ac9c2527ab99847fecdace175b3b81d.zip |
Removed our own threading-module ...
Diffstat (limited to 'geneticone/gui')
-rw-r--r-- | geneticone/gui/main.py | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/geneticone/gui/main.py b/geneticone/gui/main.py index eb7f74d..dc980b6 100644 --- a/geneticone/gui/main.py +++ b/geneticone/gui/main.py @@ -1,19 +1,25 @@ #!/usr/bin/python +# our backend stuff import geneticone -from geneticone.modules import geneticthread +# gtk stuff import pygtk pygtk.require("2.0") import gtk +import gobject # for doing emerge from subprocess import * +# threading +from threading import Thread + # for the terminal import pty import vte +# other from portage_util import unique_array class EmergeQueue: @@ -56,9 +62,10 @@ class EmergeQueue: if self.unmergeIt: # update tree self.tree.append(self.unmergeIt, [sth]) - def __emerge(self): - self.process.wait() - for p in self.ps: + def update_packages(self, process, packages): + """This updates the packages-list. It simply removes all affected categories so they have to be rebuilt.""" + process.wait() + for p in packages: try: cat = geneticone.split_package_name(p)[0] while cat[0] in ["=",">","<","!"]: @@ -73,9 +80,8 @@ class EmergeQueue: """Calls emerge and updates the terminal.""" (master, slave) = pty.openpty() self.console.set_pty(master) - self.process = Popen(["/usr/bin/python","/usr/bin/emerge"]+options+packages, stdout = slave, stderr = STDOUT, shell = False) - self.ps = packages - geneticthread.thread_start(self.__emerge) + process = Popen(["/usr/bin/python","/usr/bin/emerge"]+options+packages, stdout = slave, stderr = STDOUT, shell = False) + Thread(target=self.update_packages, args=(process, packages).start() self.remove_all(it) def emerge (self, force = False): @@ -94,7 +100,6 @@ class EmergeQueue: """Unmerges everything in the umerge-queue. If force is 'False' (default) only "emerge -pv -C" is called.""" if len(self.unmergequeue) == 0: return - #list = " ".join(self.unmergequeue) list = self.unmergequeue[:] s = ["-C"] if not force: s = ["-Cpv"] @@ -614,6 +619,7 @@ class MainWindow: def main (self): """Main.""" + gobject.threads_init() gtk.main() def blocked_dialog (blocked, blocks): |