예제 #1
0
 def _close(self, close_provider=False):
     """Run tasks for "closing" the currently opened file(s)."""
     if self.file_loaded or self.file_loading:
         if close_provider:
             self._file_provider = None
         self.update_last_read_page()
         if self.archive_type is not None:
             self._extractor.close()
         self._window.imagehandler.cleanup()
         self.file_loaded = False
         self.file_loading = False
         self.archive_type = None
         self._current_file = None
         self._base_path = None
         self._stop_waiting = True
         self._comment_files = []
         self._name_table.clear()
         self.file_closed()
     # Catch up on UI events, so we don't leave idle callbacks.
     while gtk.events_pending():
         gtk.main_iteration_do(False)
     tools.garbage_collect()
     if self._tmp_dir is not None:
         self.thread_delete(self._tmp_dir)
         self._tmp_dir = None
예제 #2
0
def _close_dialog(*args):
    global _dialog

    if _dialog is not None:
        _dialog.destroy()
        _dialog = None
        tools.garbage_collect()
예제 #3
0
def _close_dialog(*args):
    global _dialog

    if _dialog is not None:
        _dialog.destroy()
        _dialog = None
        tools.garbage_collect()
예제 #4
0
 def _close(self, close_provider=False):
     """Run tasks for "closing" the currently opened file(s)."""
     if self.file_loaded or self.file_loading:
         if close_provider:
             self._file_provider = None
         self.update_last_read_page()
         if self.archive_type is not None:
             self._extractor.close()
         self._window.imagehandler.cleanup()
         self.file_loaded = False
         self.file_loading = False
         self.archive_type = None
         self._current_file = None
         self._base_path = None
         self._stop_waiting = True
         self._comment_files = []
         self._name_table.clear()
         self.file_closed()
     # Catch up on UI events, so we don't leave idle callbacks.
     while gtk.events_pending():
         gtk.main_iteration_do(False)
     tools.garbage_collect()
     if self._tmp_dir is not None:
         self.thread_delete(self._tmp_dir)
         self._tmp_dir = None
예제 #5
0
    def close(self, *args):
        """Run tasks for "closing" the currently opened file(s)."""

        self.first_wanted = 0
        self.last_wanted = 1

        self.cleanup()
        self._base_path = None
        self._image_files = []
        self._current_image_index = None
        self._raw_pixbufs.clear()

        tools.garbage_collect()
예제 #6
0
    def close(self, *args):
        """Run tasks for "closing" the currently opened file(s)."""

        self.first_wanted = 0
        self.last_wanted = 1

        self.cleanup()
        self._base_path = None
        self._image_files = []
        self._current_image_index = None
        self._raw_pixbufs.clear()
        self._cache_pages = prefs['max pages to cache']

        tools.garbage_collect()
예제 #7
0
    def _get_pixbuf(self, index):
        """Return the pixbuf indexed by <index> from cache.
        Pixbufs not found in cache are fetched from disk first.
        """
        pixbuf = image_tools.MISSING_IMAGE_ICON

        if index not in self._raw_pixbufs:
            self._wait_on_page(index + 1)

            try:
                pixbuf = image_tools.load_pixbuf(self._image_files[index])
                self._raw_pixbufs[index] = pixbuf
                tools.garbage_collect()
            except Exception, e:
                self._raw_pixbufs[index] = image_tools.MISSING_IMAGE_ICON
                log.error('Could not load pixbuf for page %u: %r', index + 1, e)
예제 #8
0
    def _get_pixbuf(self, index):
        """Return the pixbuf indexed by <index> from cache.
        Pixbufs not found in cache are fetched from disk first.
        """
        pixbuf = constants.MISSING_IMAGE_ICON

        if index not in self._raw_pixbufs:
            self._wait_on_page(index + 1)

            try:
                pixbuf = image_tools.load_pixbuf(self._image_files[index])
                self._raw_pixbufs[index] = pixbuf
                tools.garbage_collect()
            except Exception, e:
                self._raw_pixbufs[index] = constants.MISSING_IMAGE_ICON
                log.debug('Could not load pixbuf for page %d: %r', index, e)
예제 #9
0
 def _cache_pixbuf(self, index, force=False):
     self._wait_on_page(index + 1)
     with self._cache_lock[index]:
         if index in self._raw_pixbufs:
             return
         with self._lock:
             if not force and index not in self._wanted_pixbufs:
                 return
         log.debug('Caching page %u', index + 1)
         try:
             pixbuf = image_tools.load_pixbuf(self._image_files[index])
             tools.garbage_collect()
         except Exception as e:
             log.error('Could not load pixbuf for page %u: %r', index + 1, e)
             pixbuf = image_tools.MISSING_IMAGE_ICON
         self._raw_pixbufs[index] = pixbuf
예제 #10
0
    def close(self, *args):
        """Run tasks for "closing" the currently opened file(s)."""

        self.first_wanted = 0
        self.last_wanted = 1
        self._current_file = None

        self._base_path = None
        self._stop_cacheing = False
        self._image_files = []
        self._current_image_index = None
        self._raw_pixbufs.clear()
        self._name_table.clear()
        self.is_cacheing = False

        tools.garbage_collect()
예제 #11
0
 def close_file(self, *args):
     """Run tasks for "closing" the currently opened file(s)."""
     self.update_last_read_page()
     self.file_loaded = False
     self.file_loading = False
     self.archive_type = None
     self._current_file = None
     self._base_path = None
     self._stop_waiting = True
     self._comment_files = []
     self._name_table.clear()
     self._window.clear()
     self._window.uimanager.set_sensitivities()
     self._extractor.stop()
     self.thread_delete(self._tmp_dir)
     self._tmp_dir = tempfile.mkdtemp(prefix=u'mcomix.', suffix=os.sep)
     self._window.imagehandler.close()
     self._window.thumbnailsidebar.clear()
     self._window.set_icon_list(*icons.mcomix_icons())
     tools.garbage_collect()
예제 #12
0
 def close_file(self, *args):
     """Run tasks for "closing" the currently opened file(s)."""
     self.update_last_read_page()
     self.file_loaded = False
     self.file_loading = False
     self.archive_type = None
     self._current_file = None
     self._base_path = None
     self._stop_waiting = True
     self._comment_files = []
     self._name_table.clear()
     self._window.clear()
     self._window.uimanager.set_sensitivities()
     self._extractor.stop()
     self.thread_delete(self._tmp_dir)
     self._tmp_dir = tempfile.mkdtemp(prefix=u'mcomix.', suffix=os.sep)
     self._window.imagehandler.close()
     self._window.thumbnailsidebar.clear()
     self._window.set_icon_list(*icons.mcomix_icons())
     tools.garbage_collect()