diff --git a/sulfur/src/sulfur/__init__.py b/sulfur/src/sulfur/__init__.py index 83f27d6f3..80a569880 100644 --- a/sulfur/src/sulfur/__init__.py +++ b/sulfur/src/sulfur/__init__.py @@ -58,7 +58,7 @@ from sulfur.entropyapi import Equo, QueueExecutor from sulfur.setup import SulfurConf, const, fakeoutfile, fakeinfile, \ cleanMarkupString from sulfur.widgets import SulfurConsole -from sulfur.core import UI, Controller, FORK_PIDS, fork_function, \ +from sulfur.core import UI, Controller, \ busy_cursor, normal_cursor, get_entropy_webservice, Privileges from sulfur.views import * from sulfur.filters import Filter @@ -255,14 +255,6 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin): SulfurSignals.emit('application_quit') - def do_kill(pid): - try: - os.kill(pid, signal.SIGTERM) - except OSError: - pass - for pid in FORK_PIDS: - do_kill(pid) - if hasattr(self, '_entropy'): entropy.tools.release_entropy_locks(self._entropy) self._entropy.shutdown() diff --git a/sulfur/src/sulfur/core.py b/sulfur/src/sulfur/core.py index dffda77ac..d4c04f923 100644 --- a/sulfur/src/sulfur/core.py +++ b/sulfur/src/sulfur/core.py @@ -30,8 +30,6 @@ from entropy.misc import ParallelTask from entropy.core import Singleton from sulfur.setup import const -FORK_PIDS = [] - CURRENT_CURSOR = None STATUS_BAR_CONTEXT_IDS = { @@ -125,29 +123,6 @@ def normal_cursor(mainwin): global CURRENT_CURSOR CURRENT_CURSOR = None -def fork_function(child_function, parent_function): - # Uber suber optimized stuffffz - - def do_wait(pid): - os.waitpid(pid, 0) - FORK_PIDS.remove(pid) - gobject.idle_add(parent_function) - - pid = os.fork() - if pid != 0: - const_debug_write(__name__, "_fork_function: enter %s" % ( - child_function,)) - FORK_PIDS.append(pid) - if parent_function is not None: - task = ParallelTask(do_wait, pid) - task.start() - const_debug_write(__name__, "_fork_function: leave %s" % ( - child_function,)) - else: - sys.excepthook = sys.__excepthook__ - child_function() - os._exit(0) - def resize_image(max_width, image_path, new_image_path): shutil.copy2(image_path, new_image_path) img = gtk.Image() diff --git a/sulfur/src/sulfur/dialogs.py b/sulfur/src/sulfur/dialogs.py index a680245a8..c995535ff 100644 --- a/sulfur/src/sulfur/dialogs.py +++ b/sulfur/src/sulfur/dialogs.py @@ -38,7 +38,7 @@ import entropy.dep import entropy.tools from sulfur.event import SulfurSignals -from sulfur.core import UI, busy_cursor, normal_cursor, fork_function, \ +from sulfur.core import UI, busy_cursor, normal_cursor, \ resize_image, resize_image_height, load_url, get_entropy_webservice, \ Privileges from sulfur.setup import const, cleanMarkupString, SulfurConf diff --git a/sulfur/src/sulfur/views.py b/sulfur/src/sulfur/views.py index f0272aa94..4df1a2c79 100644 --- a/sulfur/src/sulfur/views.py +++ b/sulfur/src/sulfur/views.py @@ -33,7 +33,7 @@ from entropy.dep import dep_getkey from sulfur.setup import const, cleanMarkupString, SulfurConf from sulfur.core import UI, busy_cursor, normal_cursor, \ - STATUS_BAR_CONTEXT_IDS, resize_image, fork_function, \ + STATUS_BAR_CONTEXT_IDS, resize_image, \ get_entropy_webservice, Privileges from sulfur.widgets import CellRendererStars from sulfur.package import DummyEntropyPackage, EntropyPackage @@ -1836,17 +1836,15 @@ class EntropyPackageView: cache_key, local_path,)) break - return got_something - - def _fetch_icons_parent(): - if _fetch_icons(cache, True): + if got_something: self._emit_ugc_update() with Privileges(): - # run as separate process, avoid blocking the UI - def _forked_func(): - return _fetch_icons(cache, False) - fork_function(_forked_func, _fetch_icons_parent) + def _parallel_func(): + _fetch_icons(cache, False) + _fetch_icons(cache, True) + th = ParallelTask(_parallel_func) + th.start() def __ugc_dnd_updates_clear_cache(self, *args): @@ -2410,7 +2408,6 @@ class EntropyPackageView: # sync_item,)) return - self._ugc_metadata_sync_exec_cache.add(sync_item) if not self._ugc_available(repoid): if const_debug_enabled(): const_debug_write(__name__, @@ -2429,13 +2426,13 @@ class EntropyPackageView: const_debug_write(__name__, "__new_ugc_pixbuf_stash_fetch: enqueued!! %s" % ( sync_item,)) + self._ugc_metadata_sync_exec_cache.add(sync_item) except self.queue_full_exception as err: # argh! queue full! if const_debug_enabled(): const_debug_write(__name__, "__new_ugc_pixbuf_stash_fetch: ARGH QUEUE FULL %s" % ( sync_item,)) - pass def new_ugc_pixbuf(self, column, cell, model, myiter): @@ -2453,9 +2450,10 @@ class EntropyPackageView: cell.set_property('visible', False) else: # delay a bit, to avoid overloading the UI - gobject.timeout_add_seconds(8, - self.__new_ugc_pixbuf_stash_fetch, pkg, - priority = gobject.PRIORITY_LOW) + if not self._ugc_icon_load_queue.full(): + gobject.timeout_add_seconds(8, + self.__new_ugc_pixbuf_stash_fetch, pkg, + priority = gobject.PRIORITY_LOW) cell.set_property('visible', True) pixbuf = self._get_cached_pkg_ugc_icon(pkg) if pixbuf: diff --git a/sulfur/src/sulfur_client.py b/sulfur/src/sulfur_client.py index 8c005d12c..bac15ad64 100644 --- a/sulfur/src/sulfur_client.py +++ b/sulfur/src/sulfur_client.py @@ -29,20 +29,11 @@ from entropy.exceptions import PermissionDenied from sulfur import SulfurApplication from sulfur.dialogs import ExceptionDialog from sulfur.setup import const -from sulfur.core import FORK_PIDS MAIN_APP = None -def kill_pid(pid): - try: - os.kill(pid, signal.SIGTERM) - except OSError: - pass - def kill_threads(): entropy.tools.kill_threads() - for pid in FORK_PIDS: - kill_pid(pid) """ debug options: