def __init__(self): InstallProgress.__init__(self) QtCore.QObject.__init__(self) self.last = 0.0 self.done = False self.message = QtGui.QMessageBox() self.message.setIcon(QtGui.QMessageBox.Information) self.message.setWindowTitle("Message")
def __init__(self, progress, action, parent): # TODO: implement the term InstallProgress.__init__(self) self.progress = progress self.action = action self.parent = parent self.finished = False self.parent.konsole.setInstallProgress(self)
def update_interface(self): InstallProgress.update_interface(self) while Gtk.events_pending(): Gtk.main_iteration() if (not self.term_expander.get_expanded() and (self.time_last_update + GDEBI_TERMINAL_TIMEOUT) < time.time()): self.term_expander.set_expanded(True) # sleep just long enough to not create a busy loop time.sleep(0.01)
def update_interface(self): """Called periodically to update the interface. Emits: status-timeout() [When a timeout happens] """ InstallProgress.update_interface(self) while self._context.pending(): self._context.iteration() if self.time_last_update + self.INSTALL_TIMEOUT < time.time(): self.emit("status-timeout")
def __init__(self,progress,term,label,term_expander): InstallProgress.__init__(self) self.progress = progress self.term = term self.term_expander = term_expander self.finished = False self.action = label self.time_last_update = time.time() self.term.connect("child-exited", self.child_exited) self.env = ["VTE_PTY_KEEP_FD=%s"% self.writefd, "DEBIAN_FRONTEND=gnome", "APT_LISTCHANGES_FRONTEND=gtk"]
def __init__(self, db, title, info, error=None): InstallProgress.__init__(self) self.db = db self.title = title self.info = info self.error_template = error self.started = False # InstallProgress uses a non-blocking status fd; our run() # implementation doesn't need that, and in fact we spin unless the # fd is blocking. flags = fcntl.fcntl(self.status_stream.fileno(), fcntl.F_GETFL) fcntl.fcntl(self.status_stream.fileno(), fcntl.F_SETFL, flags & ~os.O_NONBLOCK)
def __init__(self, term): InstallProgress.__init__(self) self.finished = False self.apt_status = -1 self.time_last_update = time.time() self.term = term if old_version: self.term.connect("child-exited", self.child_exited) else: self.term.connect("child-exited", self.child_exited_2) self.env = [ "VTE_PTY_KEEP_FD=%s" % self.writefd, "DEBIAN_FRONTEND=gnome", "APT_LISTCHANGES_FRONTEND=Gtk" ] self._context = GLib.main_context_default() super(GInstallProgress, self).__init__()
def update_interface(self): # run the base class try: InstallProgress.update_interface(self) except ValueError as e: pass # log the output of dpkg (on the master_fd) to the DumbTerminal while True: try: (rlist, wlist, xlist) = select.select([self.master_fd],[],[], 0.01) # data available, read it if len(rlist) > 0: line = os.read(self.master_fd, 255) self.parent.konsole.insertWithTermCodes(utf8(line)) else: # nothing happend within the timeout, break break except Exception as e: logging.debug("update_interface: %s" % e) break KApplication.kApplication().processEvents()
def update_interface(self): # run the base class try: InstallProgress.update_interface(self) except ValueError as e: pass # log the output of dpkg (on the master_fd) to the DumbTerminal while True: try: (rlist, wlist, xlist) = select.select([self.master_fd], [], [], 0.01) # data available, read it if len(rlist) > 0: line = os.read(self.master_fd, 255) self.parent.konsole.insertWithTermCodes(utf8(line)) else: # nothing happend within the timeout, break break except Exception as e: logging.debug("update_interface: %s" % e) break KApplication.kApplication().processEvents()
def _test(): # type: () -> None """Test function""" from apt.cache import Cache from apt.progress.base import InstallProgress cache = Cache() vp = "www-browser" print("%s virtual: %s" % (vp, cache.is_virtual_package(vp))) providers = cache.get_providing_packages(vp) print("Providers for %s :" % vp) for pkg in providers: print(" %s" % pkg.name) d = DebPackage(sys.argv[1], cache) print("Deb: %s" % d.pkgname) if not d.check(): print("can't be satified") print(d._failure_string) print("missing deps: %s" % d.missing_deps) print(d.required_changes) print(d.filelist) print("Installing ...") ret = d.install(InstallProgress()) print(ret) #s = DscSrcPackage(cache, "../tests/3ddesktop_0.2.9-6.dsc") #s.check_dep() #print "Missing deps: ",s.missingDeps #print "Print required changes: ", s.requiredChanges s = DscSrcPackage(cache=cache) ds = "libc6 (>= 2.3.2), libaio (>= 0.3.96) | libaio1 (>= 0.3.96)" print(s._satisfy_depends(apt_pkg.parse_depends(ds, False)))
def pulse(self): QtGui.qApp.processEvents() return InstallProgress.pulse(self)
def __init__(self, pbar, status_label): InstallProgress.__init__(self) self.pbar = pbar self.status_label = status_label self.last = 0.0
def __init__(self, cb=None, fileno=2): InstallProgress.__init__(self) self.cb = cb self.fileno = fileno
def test_run(self): with InstallProgress() as prog: self.assertEqual(prog.run(RunHelper()), 0)
def conffile(current, new): """Called when a conffile question from dpkg is detected.""" BaseInstallProgress.conffile(self, current, new) statusMessage("CONFFILE", current, new)
def __init__(self, sysdaemon): InstallProgress.__init__(self) self.sysdaemon = sysdaemon
def __init__(self, system): InstallProgress.__init__(self) self.system = system
def __init__(self): BaseInstallProgress.__init__(self)
def __init__(self, cb=None): InstallProgress.__init__(self) self.cb = cb
def run(self, obj): """Run.""" self.finished = False return InstallProgress.run(self, obj)
def __init__(self, sig): InstallProgress.__init__(self) self.last = 0.0 self.b = ProgressBar() self.step = sig
def pulse(self): return InstallProgress.pulse(self)