示例#1
0
 def show(self):
     """Display the window and scan the caches to populate it."""
     self.window.show()
     self.window.window.set_cursor(gtkutils.get_busy_pointer())
     gtk.gdk.flush()
     self._populate_model()
     self.set_initial_expansion()
示例#2
0
	def show(self):
		"""Display the window and scan the caches to populate it."""
		self.window.show()
		self.window.window.set_cursor(gtkutils.get_busy_pointer())
		gtk.gdk.flush()
		self._populate_model()
		self.set_initial_expansion()
示例#3
0
 def show(self):
     """Display the window and scan the caches to populate it."""
     self.window.show()
     self.window.window.set_cursor(gtkutils.get_busy_pointer())
     gtk.gdk.flush()
     try:
         self._populate_model()
         i = self.model.get_iter_root()
         while i:
             self.tree_view.expand_row(self.model.get_path(i), False)
             i = self.model.iter_next(i)
     finally:
         self.window.window.set_cursor(None)
示例#4
0
 def show(self):
     """Display the window and scan the caches to populate it."""
     self.window.show()
     self.window.window.set_cursor(gtkutils.get_busy_pointer())
     gtk.gdk.flush()
     try:
         self._populate_model()
         i = self.model.get_iter_root()
         while i:
             self.tree_view.expand_row(self.model.get_path(i), False)
             i = self.model.iter_next(i)
     finally:
         self.window.window.set_cursor(None)
示例#5
0
    def update_download_status(self, only_update_visible=False):
        """Called at regular intervals while there are downloads in progress,
		and once at the end. Update the display."""
        if not self.window:
            return  # (being destroyed)
        if not self.window.get_window():
            return  # (being destroyed)
        monitored_downloads = self.driver.config.handler.monitored_downloads

        self.browser.update_download_status(only_update_visible)

        if not monitored_downloads:
            self.progress_area.hide()
            self.window.get_window().set_cursor(None)
            return

        if not self.progress_area.get_property("visible"):
            self.progress_area.show()
            self.window.get_window().set_cursor(gtkutils.get_busy_pointer())

        any_known = False
        done = total = self.driver.config.handler.total_bytes_downloaded  # Completed downloads
        n_downloads = self.driver.config.handler.n_completed_downloads
        # Now add downloads in progress...
        for x in monitored_downloads:
            if x.status != download.download_fetching:
                continue
            n_downloads += 1
            if x.expected_size:
                any_known = True
            so_far = x.get_bytes_downloaded_so_far()
            total += x.expected_size or max(4096, so_far)  # Guess about 4K for feeds/icons
            done += so_far

        progress_text = "%s / %s" % (pretty_size(done), pretty_size(total))
        self.progress.set_text(
            ngettext("Downloading one file (%(progress)s)", "Downloading %(number)d files (%(progress)s)", n_downloads)
            % {"progress": progress_text, "number": n_downloads}
        )

        if total == 0 or (n_downloads < 2 and not any_known):
            self.progress.pulse()
        else:
            self.progress.set_fraction(float(done) / total)
    def update_download_status(self, only_update_visible=False):
        """Called at regular intervals while there are downloads in progress,
		and once at the end. Update the display."""
        monitored_downloads = self.policy.handler.monitored_downloads

        self.browser.update_download_status(only_update_visible)

        if not monitored_downloads:
            self.progress_area.hide()
            self.window.window.set_cursor(None)
            return

        if not self.progress_area.get_property('visible'):
            self.progress_area.show()
            self.window.window.set_cursor(gtkutils.get_busy_pointer())

        any_known = False
        done = total = self.policy.handler.total_bytes_downloaded  # Completed downloads
        n_downloads = self.policy.handler.n_completed_downloads
        # Now add downloads in progress...
        for x in monitored_downloads:
            if x.status != download.download_fetching: continue
            n_downloads += 1
            if x.expected_size:
                any_known = True
            so_far = x.get_bytes_downloaded_so_far()
            total += x.expected_size or max(
                4096, so_far)  # Guess about 4K for feeds/icons
            done += so_far

        progress_text = '%s / %s' % (pretty_size(done), pretty_size(total))
        self.progress.set_text(
            ngettext('Downloading one file (%(progress)s)',
                     'Downloading %(number)d files (%(progress)s)',
                     n_downloads) % {
                         'progress': progress_text,
                         'number': n_downloads
                     })

        if total == 0 or (n_downloads < 2 and not any_known):
            self.progress.pulse()
        else:
            self.progress.set_fraction(float(done) / total)
示例#7
0
	def show(self):
		"""Display the window and scan the caches to populate it."""
		self.window.show()
		self.window.get_window().set_cursor(gtkutils.get_busy_pointer())
		gtk.gdk.flush()
		# (async so that the busy pointer works on GTK 3)
		@tasks.async
		def populate():
			populate = self._populate_model()
			yield populate
			try:
				tasks.check(populate)
			except:
				import logging
				logging.warn("fail", exc_info = True)
				raise
			# (we delay until here because inserting with the view set is very slow)
			self.tree_view.set_model(self.view_model)
			self.set_initial_expansion()
		return populate()
示例#8
0
	def update_download_status(self):
		"""Called at regular intervals while there are downloads in progress,
		and once at the end. Update the display."""
		monitored_downloads = self.policy.handler.monitored_downloads

		self.browser.update_download_status()

		if not monitored_downloads:
			self.progress_area.hide()
			self.window.window.set_cursor(None)
			return

		if not self.progress_area.get_property('visible'):
			self.progress_area.show()
			self.window.window.set_cursor(gtkutils.get_busy_pointer())

		any_known = False
		done = total = self.policy.handler.total_bytes_downloaded	# Completed downloads
		n_downloads = self.policy.handler.n_completed_downloads
		# Now add downloads in progress...
		for x in monitored_downloads.values():
			if x.status != download.download_fetching: continue
			n_downloads += 1
			if x.expected_size:
				any_known = True
			so_far = x.get_bytes_downloaded_so_far()
			total += x.expected_size or max(4096, so_far)	# Guess about 4K for feeds/icons
			done += so_far

		progress_text = '%s / %s' % (pretty_size(done), pretty_size(total))
		self.progress.set_text(
			ngettext('Downloading one file (%(progress)s)',
					 'Downloading %(number)d files (%(progress)s)', n_downloads)
			% {'progress': progress_text, 'number': n_downloads})

		if total == 0 or (n_downloads < 2 and not any_known):
			self.progress.pulse()
		else:
			self.progress.set_fraction(float(done) / total)
示例#9
0
	def show(self):
		"""Display the window and scan the caches to populate it."""
		self.window.show()
		self.window.get_window().set_cursor(gtkutils.get_busy_pointer())
		gtk.gdk.flush()