def __init__(self): self.builder = Gtk.Builder() self.builder.add_from_file("/usr/lib/linuxmint/mintDrivers/main.ui") self.builder.connect_signals(self) for o in self.builder.get_objects(): if issubclass(type(o), Gtk.Buildable): name = Gtk.Buildable.get_name(o) setattr(self, name, o) else: print("can not get name for object '%s'" % o) self.window_main.show() self.window_main.set_title(_("Driver Manager")) self.window_main.connect("delete_event", self.quit_application) self.apt_cache = apt.Cache() self.apt_client = client.AptClient() self.init_drivers() self.show_drivers() with open('/proc/cmdline') as f: cmdline = f.read() if ((not "boot=casper" in cmdline) and (not "boot=live" in cmdline)): print ("Post-install mode detected") self.info_bar_label.set_text(_("Drivers cannot be installed.\nPlease connect to the Internet or insert the Linux Mint installation DVD (or USB stick).")) self.check_internet_or_live_dvd() self.button_info_bar.connect("clicked", self.check_internet_or_live_dvd) else: print ("Live mode detected") self.info_bar.hide()
def __init__(self, options=None): QWidget.__init__(self) self.initUI() self.closeBtn.clicked.connect(self.call_reject) self.apt_client = client.AptClient() self.downloadText = "" self.detailText = "" self.old_short_desc="" self.details="" self.status="" self.errors = [] #TODO make a terminal work to see more info #self.master, self.slave = pty.openpty() '''proc = subprocess.Popen(['qterminal'], stdin=self.slave, #stdout=subprocess.PIPE, stdout=self.slave, #stderr=subprocess.PIPE stderr=self.slave)''' if options.fullUpgrade: self.trans2 = self.apt_client.upgrade_system(safe_mode=False) else: self.trans2 = self.apt_client.upgrade_system(safe_mode=True) if options.cacheUpdate: self.trans1 = self.apt_client.update_cache() self.update_cache() else: self.upgrade()
def upgrade(self): self.progressBar.setVisible(False) #TODO ¿Hacerlo paquete a paquete pare que hay más/mejor info? self.treeView.setVisible(False) self.errors = [] self.label.setText("Applying changes...") self.apt_client = client.AptClient() try: self.trans2 = self.apt_client.commit_packages(install=self.install_pkgs, remove=self.remove_pkgs, reinstall=[], purge=[], upgrade=self.upgrade_pkgs, downgrade=[]) #self.trans2 = self.apt_client.upgrade_system(safe_mode=False) self.trans2.connect('progress-changed', self.upgrade_progress) self.trans2.connect('cancellable-changed', self.upgrade_cancellable_changed) self.trans2.connect('progress-details-changed', self.upgrade_progress_detail) self.trans2.connect('progress-download-changed', self.upgrade_progress_download) self.trans2.connect('finished', self.upgrade_finish) self.trans2.connect('error', self.upgrade_error) self.trans2.set_debconf_frontend('kde') self.trans2.run() except (NotAuthorizedError, TransactionFailed) as e: print("Warning: install transaction not completed successfully:" + "{}".format(e))
def main(): repo = [ "deb", "http://packages.glatzor.de/silly-packages", "sid", ["main"], "Silly packages", "silly.list" ] aptclient = client.AptClient() bus = dbus.SystemBus() name = bus.get_unique_name() # high level auth try: # Preauthentication action = policykit1.PK_ACTION_INSTALL_PURCHASED_PACKAGES flags = policykit1.CHECK_AUTH_ALLOW_USER_INTERACTION yield policykit1.check_authorization_by_name(name, action, flags=flags) if (Globals.DEBUG_SWITCH): print("111111") action = policykit1.PK_ACTION_INSTALL_FILE yield policykit1.check_authorization_by_name(name, action, flags=flags) if (Globals.DEBUG_SWITCH): print("222222") # Setting up transactions trans_add = yield aptclient.add_repository(*repo) trans_inst = yield aptclient.install_packages(["gimp"]) yield trans_inst.set_allow_unauthenticated(True) # Check when the last transaction was done trans_inst.connect("finished", on_finished) # Chaining transactions yield trans_inst.run_after(trans_add) yield trans_add.run() except Exception as error: if (Globals.DEBUG_SWITCH): print(error) loop.quit()
def __init__(self): self.builder = Gtk.Builder() self.builder.add_from_file("/usr/share/linuxmint/mintdrivers/main.ui") self.builder.connect_signals(self) for o in self.builder.get_objects(): if issubclass(type(o), Gtk.Buildable): name = Gtk.Buildable.get_name(o) setattr(self, name, o) else: print("can not get name for object '%s'" % o) self.window_main.show() self.window_main.set_title(_("Driver Manager")) self.window_main.connect("delete_event", self.quit_application) self.button_driver_revert = Gtk.Button(label=_("Re_vert"), use_underline=True) self.button_driver_revert.connect("clicked", self.on_driver_changes_revert) self.button_driver_apply = Gtk.Button(label=_("_Apply Changes"), use_underline=True) self.button_driver_apply.connect("clicked", self.on_driver_changes_apply) self.button_driver_cancel = Gtk.Button(label=_("_Cancel"), use_underline=True) self.button_driver_cancel.connect("clicked", self.on_driver_changes_cancel) self.button_driver_restart = Gtk.Button(label=_("_Restart..."), use_underline=True) self.button_driver_restart.connect("clicked", self.on_driver_restart_clicked) self.button_driver_revert.set_sensitive(False) self.button_driver_revert.set_visible(True) self.button_driver_apply.set_sensitive(False) self.button_driver_apply.set_visible(True) self.button_driver_cancel.set_visible(False) self.button_driver_restart.set_visible(False) self.box_driver_action.pack_end(self.button_driver_apply, False, False, 0) self.box_driver_action.pack_end(self.button_driver_revert, False, False, 0) self.box_driver_action.pack_end(self.button_driver_restart, False, False, 0) self.box_driver_action.pack_end(self.button_driver_cancel, False, False, 0) self.info_bar.set_no_show_all(True) self.progress_bar = Gtk.ProgressBar() self.box_driver_action.pack_end(self.progress_bar, False, False, 0) self.progress_bar.set_visible(False) self.needs_restart = False self.live_mode = False self.apt_client = client.AptClient() with open('/proc/cmdline') as f: cmdline = f.read() if ((not "boot=casper" in cmdline) and (not "boot=live" in cmdline)): print ("Post-install mode detected") self.info_bar_label.set_text(_("Drivers cannot be installed.\nPlease connect to the Internet or insert the Linux Mint installation DVD (or USB stick).")) self.check_internet_or_live_dvd() self.button_info_bar.connect("clicked", self.check_internet_or_live_dvd) else: print ("Live mode detected") self.live_mode = True self.info_bar.hide() self.update_cache()
def update(self): """Run a update to refresh the package list""" self.ac = client.AptClient() t = self.ac.update_cache(exit_handler=self._on_exit) dia = AptProgressDialog(t, parent=self.window_main, terminal=False) dia.run() dia.hide() self._show_messages(t)
def commit(self, add, remove): """Commit a list of package adds and removes""" self.ac = client.AptClient() t = self.ac.commit_packages(list(add), [], list(remove), [], [], exit_handler=self._on_exit) dia = AptProgressDialog(t, parent=self.window_main) dia.run() dia.hide() self._show_messages(t)
def __init__(self, window_main, action): InstallBackend.__init__(self, window_main, action) ui_path = os.path.join(window_main.datadir, "gtkbuilder/UpdateProgress.ui") BuilderDialog.__init__(self, window_main, ui_path, "pane_update_progress") self.client = client.AptClient() self.unity = UnitySupport() self._expanded_size = None self.button_cancel = None
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 __init__(self, options=None, pkg=None): QWidget.__init__(self) self.initUI() self.closeBtn.clicked.connect(self.call_reject) self.apt_client = client.AptClient() self.downloadText = "" self.detailText = "" self.old_short_desc = "" self.details = "" self.status = "" self.errors = [] #TODO make a terminal work to see more info #self.master, self.slave = pty.openpty() '''proc = subprocess.Popen(['qterminal'], stdin=self.slave, #stdout=subprocess.PIPE, stdout=self.slave, #stderr=subprocess.PIPE stderr=self.slave)''' if (len(pkgs) > 0): #need to separate install from upgrade packages '''with depcahce it would be: depcache.marked_install(pkg) or depcache.marked_upgrade(pkg) depcahceh ussage: apt_pkg.init() cache = apt_pkg.Cache(apt.progress.base.OpProgress())#la idea seria no hacer el update del cache. depcache = apt_pkg.DepCache(cache) apparently can't be done with aptdaemon''' self.trans2 = self.apt_client.commit_packages(install=pkg, remove=[], reinstall=[], purge=[], upgrade=[], downgrade=[]) else: if options.fullUpgrade: self.trans2 = self.apt_client.upgrade_system(safe_mode=False) else: self.trans2 = self.apt_client.upgrade_system(safe_mode=True) if options.cacheUpdate: self.trans1 = self.apt_client.update_cache() self.update_cache() else: self.upgrade()
def __init__(self, depcache, cache, upgrades, security_updates): QWidget.__init__(self) #uic.loadUi("designer/update_notifier.ui", self) self.upgrades = upgrades self.initUI() self.closeBtn.clicked.connect(self.call_reject) self.apt_client = client.AptClient() self.downloadText = "" self.detailText = "" #self.upgrade_swBtn.clicked.connect(self.call_update_software) self.upgradeBtn.clicked.connect(self.upgrade) '''
def _versioncheckapt(package): #check for linux using Apt # initial vars oldversion = False msg = '' result = '' # try to import apt try: import apt from aptdaemon import client from aptdaemon import errors except: log('python apt import error') sys.exit(0) apt_client = client.AptClient() try: result = apt_client.update_cache(wait=True) if (result == "exit-success"): log("Finished updating the cache") else: log("Error updating the cache %s" % result) except errors.NotAuthorizedError: log("You are not allowed to update the cache") sys.exit(0) trans = apt_client.upgrade_packages([package]) trans.simulate(reply_handler=_apttransstarted, error_handler=_apterrorhandler) pkg = trans.packages[4][0] if (pkg == package): cache = apt.Cache() cache.open(None) cache.upgrade() if (cache[package].installed and cache[package].installed.version != cache[package].candidate.version): log("Version installed %s" % cache[package].installed.version) log("Version available %s" % cache[package].candidate.version) oldversion = True msg = __localize__(32011) elif (cache[package].installed): log("Already on newest version %s" % cache[package].installed.version) else: log("No installed package found, probably manual install") sys.exit(0) return oldversion, msg
def add_dell_recovery_clicked(self, widget): """Callback to launch a dialog to add dell-recovery to the image""" #check if dpkg-repack is available if not os.path.exists('/usr/bin/dpkg-repack'): if not self.apt_client: try: self.apt_client = client.AptClient() except NameError: pass if self.apt_client: self.builder_widgets.get_object( 'add_dell_recovery_repack_button').show() self.builder_widgets.get_object( 'build_dell_recovery_button').set_sensitive(False) else: self.builder_widgets.get_object( 'build_dell_recovery_button').set_sensitive(True) self.builder_widgets.get_object( 'builder_add_dell_recovery_window').show()
def __init__(self, options=None): QWidget.__init__(self) self.initUI() self.closeBtn.clicked.connect(self.call_reject) self.apt_client = client.AptClient() self.downloadText = "" self.detailText = "" self.old_short_desc = "" self.errors = [] if options.fullUpgrade: self.trans2 = self.apt_client.upgrade_system(safe_mode=False) else: self.trans2 = self.apt_client.upgrade_system(safe_mode=True) if options.cacheUpdate: self.trans1 = self.apt_client.update_cache() self.update_cache() else: self.upgrade()
def __init__(self): self.builder = Gtk.Builder() self.builder.add_from_file("/usr/lib/linuxmint/mintDrivers/main.ui") self.builder.connect_signals(self) for o in self.builder.get_objects(): if issubclass(type(o), Gtk.Buildable): name = Gtk.Buildable.get_name(o) setattr(self, name, o) else: print("can not get name for object '%s'" % o) self.window_main.show() self.window_main.set_title(_("Driver Manager")) self.window_main.connect("delete_event", Gtk.main_quit) self.apt_cache = apt.Cache() self.apt_client = client.AptClient() self.init_drivers() self.show_drivers()
def __init__(self): self.aptclient = client.AptClient()
def __init__(self): super(QAptInterface, self).__init__() self.aptd = client.AptClient() self.transactions = [] self._progress = None self.transactions_running = False
def __init__(self, window_main): # Pass None for datadir because of LP: #1026257 InstallBackend.__init__(self, window_main, self.ACTION_INSTALL) self.client = client.AptClient() self.unity = UnitySupport()
from gi.repository import Gtk from gi.repository import Pango from gi.repository import GdkPixbuf from ConfigParser import RawConfigParser from notify import notify import control import os from aptdaemon import client, gtk3widgets from . import LOG import gettext _ = gettext.gettext client = client.AptClient() dialog = gtk3widgets.AptProgressDialog(debconf=True) control.__init__() import sqlite3 db_path = os.path.join(control.controller.db_path, "lsc_packages.db") try: db = sqlite3.Connection(db_path) cursor = db.cursor() except sqlite3.OperationalError: result = os.system('gksu -m %s xenta-software-center-build-db %s %s \ /usr/share/LSC/categories.ini' % ( _('"The database for Xenta Software Center needs to be (re-)created"'), db_path, control.controller.app_install_directory)) if result == 0:
def init(distro): global apt_client if distro == 'Ubuntu' or distro == 'Debian': from aptdaemon import client apt_client = client.AptClient()
def __init__(self): Handler.__init__(self) self.apt_client = client.AptClient()