def _run_transaction(self, transaction): transaction.connect('finished', self._on_transaction_done) dia = AptProgressDialog(transaction) #parent=self.parent.get_window()) dia.run(close_on_finished=True, show_error=True, reply_handler=lambda: True, error_handler=self._on_error)
def apt_run_transaction(self, transaction): transaction.connect("finished", self.on_transaction_finish) dia = AptProgressDialog(transaction, parent=self.main_window) dia.run(close_on_finished=True, show_error=True, reply_handler=lambda: True, error_handler=self.apt_on_error)
def _run_transaction(self, transaction): if self.progress_callback is None: dia = AptProgressDialog(transaction, parent=self.parent_window) dia.run(close_on_finished=True, show_error=True, reply_handler=lambda: True, error_handler=self._on_error) transaction.connect("finished", self._on_finish) else: AptDaemonTransaction(transaction, self.progress_callback, self.finished_callback, self.error_callback, self.parent_window)
def do_install(): trans_inst = aptclient.install_packages(packages) trans_inst.connect("finished", on_finished_install) dia2 = AptProgressDialog(trans_inst) dia2.run(close_on_finished=True, show_error=True, reply_handler=lambda: True, error_handler=on_error, ) return False
def _run_transaction(self): self.apt_transaction.connect("finished", self.on_transaction_finished) if self.task.has_window: self.apt_transaction.connect("progress-changed", self.on_transaction_progress) self.apt_transaction.connect("error", self.on_transaction_error) self.apt_transaction.run(reply_handler=lambda: None, error_handler=self._on_error) else: progress_window = AptProgressDialog(self.apt_transaction) progress_window.run(show_error=False, error_handler=self._on_error)
def do_update(): trans_update = aptclient.update_cache() trans_update.connect("finished",on_finished_update) dia = AptProgressDialog(trans_update) dia.run(close_on_finished=True, show_error=True, reply_handler=lambda: True, error_handler=on_error, ) return False
def do_update(self): trans_update = self.apt_client.update_cache() trans_update.connect("finished", self.on_finished_update) dia = AptProgressDialog(trans_update) dia.run(close_on_finished=True, show_error=False, reply_handler=lambda: True, error_handler=self.on_error) return
def on_reply(self, trans): self.main_dlg.hide() trans.connect('finished', self.on_trans_finished) self.prog_dlg = AptProgressDialog(trans, None, True, False) self.prog_dlg.connect('response', self.on_prog_dlg_response) self.prog_dlg_cancel = self.prog_dlg.get_action_area().get_children( )[0] self.prog_dlg.get_action_area().remove(self.prog_dlg_cancel) self.prog_dlg.add_button(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE) self.prog_dlg.set_response_sensitive(Gtk.ResponseType.CLOSE, False) self.prog_dlg.run(False, False, True, lambda: True, self.on_error)
def _check_updates_aptdaemon(): from gi.repository import Gtk from aptdaemon import client, enums from aptdaemon.gtk3widgets import AptProgressDialog client = client.AptClient() trans = client.update_cache() dia = AptProgressDialog(trans) dia.connect("finished", Gtk.main_quit) dia.run() Gtk.main() return trans.exit == enums.EXIT_SUCCESS
def _install_all_updates_aptdaemon(): from gi.repository import Gtk from aptdaemon import client, enums from aptdaemon.gtk3widgets import AptProgressDialog client = client.AptClient() trans = client.upgrade_system(safe_mode=True) dia = AptProgressDialog(trans) dia.connect("finished", Gtk.main_quit) dia.run() Gtk.main() return trans.exit == enums.EXIT_SUCCESS
def update_cache(self): self.update_transaction = self.apt_client.update_cache() self.update_transaction.connect("finished", self._on_cache_update_finished) dia = AptProgressDialog(self.update_transaction) dia.set_transient_for(self.window_main) dia.set_modal(True) dia.run(close_on_finished=True, show_error=True, reply_handler=lambda: True, error_handler=self.on_error, )
def install_app(self, widget): """Launch into an installer for dpkg-repack""" packages = [] wizard = self.widgets.get_object('wizard') packages = ['dpkg-repack'] try: trans = self.apt_client.install_packages(packages, wait=False, reply_handler=None, error_handler=None) dialog = AptProgressDialog(trans, transient_for=wizard) dialog.run() super(AptProgressDialog, dialog).run() except dbus.exceptions.DBusException as msg: self.dbus_exception_handler(msg, wizard) widget.hide()
def do_install(self): trans_inst = self.apt_client.install_packages( package_names=[self.replacement["apt"]]) trans_inst.connect("finished", self.on_finished_install) dia = AptProgressDialog(transaction=trans_inst) dia.connect("finished", self.on_install_dialog_finished) dia.run(close_on_finished=True, show_error=False, reply_handler=lambda: True, error_handler=self.on_error) return
def _run_transaction(self, transaction): transaction.connect("finished", self._on_transaction_done) dia = AptProgressDialog(transaction) # parent=self.parent.get_window()) dia.run(close_on_finished=True, show_error=True, reply_handler=lambda: True, error_handler=self._on_error)
def _run_in_dialog(self, trans, action): dia = AptProgressDialog(trans, parent=self.window_main) dia.set_icon_name("update-manager") dia.connect("finished", self._on_finished, action) yield dia.run()
def _install(self): dialog = AptProgressDialog(self._transaction) dialog.run(close_on_finished=True, show_error=True, reply_handler=lambda: True, error_handler=self._error_handler)
def _run_transaction(self, transaction): dia = AptProgressDialog(transaction) dia.set_transient_for(self.window_main) dia.connect("finished", self._on_finished) dia.run(error_handler=self._on_error)
class MaintenanceDialog(object): """Retrieve main_dlg.""" def __init__(self, parent): self.pkgs = [] self.apt_client = aptdaemon.client.AptClient() self.builder = Gtk.Builder() self.builder.add_from_file('maintenance.ui') self.builder.connect_signals(self) self.main_dlg = self.builder.get_object('main_dlg') self.main_dlg_tview = self.builder.get_object('main_dlg_tview') self.main_dlg_tstore = self.builder.get_object('main_dlg_tstore') self.main_dlg_lbl_title = self.builder.get_object('main_dlg_lbl_title') self.main_dlg_lbl_space = self.builder.get_object('main_dlg_lbl_space') self.main_dlg_img_lbl = self.builder.get_object('main_dlg_img_lbl') self.main_dlg.set_transient_for(parent) self.main_dlg.set_default_response(Gtk.ResponseType.CANCEL) def populate_treeview(self): """AptDeamon Callbacks.""" tview_pkgs = [] for ppkg in self.pkgs: if ppkg.name.startswith('linux-image'): tview_pkgs.append(ppkg) desc = '<b>%s</b>\n<small>%s (%s)</small>' % ( ppkg.name, ppkg.desc, ppkg.sum) size = '%sB' % apt_pkg.size_to_str(ppkg.size) piter = self.main_dlg_tstore.append(None, [ppkg, None, desc, size, \ Gtk.IconSize.LARGE_TOOLBAR, None, None, False]) for cpkg in ppkg.childs: tview_pkgs.append(cpkg) desc = '<b>%s</b>\n<small>%s (%s)</small>' % ( cpkg.name, cpkg.desc, cpkg.sum) size = '%sB' % apt_pkg.size_to_str(cpkg.size) self.main_dlg_tstore.append(piter, [cpkg, None, desc, size, \ Gtk.IconSize.SMALL_TOOLBAR, None, None, False]) for ppkg in self.pkgs: if ppkg not in tview_pkgs: desc = '<b>%s</b>\n<small>%s (%s)</small>' % ( ppkg.name, ppkg.desc, ppkg.sum) size = '%sB' % apt_pkg.size_to_str(ppkg.size) piter = self.main_dlg_tstore.append(None, [ppkg, None, desc, size, \ Gtk.IconSize.LARGE_TOOLBAR, None, None, False]) def on_reply(self, trans): self.main_dlg.hide() trans.connect('finished', self.on_trans_finished) self.prog_dlg = AptProgressDialog(trans, None, True, False) self.prog_dlg.connect('response', self.on_prog_dlg_response) self.prog_dlg_cancel = self.prog_dlg.get_action_area().get_children( )[0] self.prog_dlg.get_action_area().remove(self.prog_dlg_cancel) self.prog_dlg.add_button(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE) self.prog_dlg.set_response_sensitive(Gtk.ResponseType.CLOSE, False) self.prog_dlg.run(False, False, True, lambda: True, self.on_error) def on_error(self, error): try: raise error except aptdaemon.errors.NotAuthorizedError: # Silently ignore auth failures return except aptdaemon.errors.TransactionFailed as error: pass except Exception as error: error = aptdaemon.errors.TransactionFailed(ERROR_UNKNOWN, str(error)) self.error_dlg = AptErrorDialog(error, None) self.error_dlg.set_title('Σφάλμα') self.error_dlg.run() def on_trans_finished(self, trans, status): self.prog_dlg.expander.terminal.show() self.prog_dlg.expander.set_sensitive(True) self.prog_dlg.set_response_sensitive(Gtk.ResponseType.CLOSE, True) def on_prog_dlg_response(self, prog_dlg, response): self.prog_dlg.destroy() self.main_dlg.destroy() def on_main_dlg_pkg_toggle_toggled(self, widget, path): """Callbacks.""" self.main_dlg_tstore[path][5] = not self.main_dlg_tstore[path][5] if not self.main_dlg_tstore[path][5]: self.pkgs.remove(self.main_dlg_tstore[path][0]) for iter in self.main_dlg_tstore[path].iterchildren(): self.pkgs.remove(iter[0]) iter[5] = False else: self.pkgs.append(self.main_dlg_tstore[path][0]) for iter in self.main_dlg_tstore[path].iterchildren(): self.pkgs.append(iter[0]) iter[5] = True if len(self.pkgs) != 0: self.main_dlg.set_response_sensitive(Gtk.ResponseType.OK, True) if len(self.pkgs) == 1: self.main_dlg_lbl_space.set_text( '%d πακέτο έχει επιλέγει, %sB χώρου στο δίσκο θα ελευθερωθούν.' \ %(len(self.pkgs), apt_pkg.size_to_str(sum(pkg.size for pkg in self.pkgs)))) else: self.main_dlg_lbl_space.set_text( '%d πακέτα έχουν επιλέγει, %sB χώρου στο δίσκο θα ελευθερωθούν.' \ %(len(self.pkgs), apt_pkg.size_to_str(sum(pkg.size for pkg in self.pkgs)))) else: self.main_dlg.set_response_sensitive(Gtk.ResponseType.OK, False) self.main_dlg_lbl_space.set_text( 'Δεν έχετε επιλέξει κάποιο πυρήνα προς αφαίρεση.')
def _run_transaction(self, transaction): dia = AptProgressDialog(transaction, parent=self.window_main) dia.connect("finished", self._on_finished) dia.run(error_handler=self._on_error)