Exemplo n.º 1
0
	def downloads_changed(self):
		if self.monitored_downloads and self.pulse is None:
			def pulse():
				self.mainwindow.update_download_status(only_update_visible = True)
				return True
			pulse()
			self.pulse = gobject.timeout_add(200, pulse)
		elif len(self.monitored_downloads) == 0:
			# Delay before resetting, in case we start a new download quickly
			gobject.timeout_add(500, self._reset_counters)

			# Stop animation
			if self.pulse:
				gobject.source_remove(self.pulse)
				self.pulse = None
				self.mainwindow.update_download_status()
Exemplo n.º 2
0
    def downloads_changed(self):
        if self.monitored_downloads and self.pulse is None:

            def pulse():
                self.mainwindow.update_download_status(
                    only_update_visible=True)
                return True

            pulse()
            self.pulse = gobject.timeout_add(200, pulse)
        elif len(self.monitored_downloads) == 0:
            # Delay before resetting, in case we start a new download quickly
            gobject.timeout_add(500, self._reset_counters)

            # Stop animation
            if self.pulse:
                gobject.source_remove(self.pulse)
                self.pulse = None
                self.mainwindow.update_download_status()
Exemplo n.º 3
0
 def downloads_changed(self):
     from zeroinstall import gobject
     if self.monitored_downloads and self.update is None:
         if self.screen_width is None:
             try:
                 import curses
                 curses.setupterm()
                 self.screen_width = curses.tigetnum('cols') or 80
             except Exception as ex:
                 logger.info("Failed to initialise curses library: %s", ex)
                 self.screen_width = 80
         self.show_progress()
         self.update = gobject.timeout_add(200, self.show_progress)
     elif len(self.monitored_downloads) == 0:
         if self.update:
             gobject.source_remove(self.update)
             self.update = None
             print()
             self.last_msg_len = None
Exemplo n.º 4
0
	def downloads_changed(self):
		from zeroinstall import gobject
		if self.monitored_downloads and self.update is None:
			if self.screen_width is None:
				try:
					import curses
					curses.setupterm()
					self.screen_width = curses.tigetnum('cols') or 80
				except Exception as ex:
					logger.info("Failed to initialise curses library: %s", ex)
					self.screen_width = 80
			self.show_progress()
			self.update = gobject.timeout_add(200, self.show_progress)
		elif len(self.monitored_downloads) == 0:
			if self.update:
				gobject.source_remove(self.update)
				self.update = None
				print()
				self.last_msg_len = None
Exemplo n.º 5
0
 def remove_task(self, task):
     Blocker.remove_task(self, task)
     if not self._zero_lib_tasks:
         gobject.source_remove(self._tag)
         self._tag = None