def __init__(self, datadir, parent, to_add, to_rm):
     SimpleGtkbuilderApp.__init__(self, path=datadir+"/gnome-app-install.ui")
     self.add_store = gtk.ListStore(gobject.TYPE_STRING,
                                    gobject.TYPE_PYOBJECT,
                                    gobject.TYPE_INT)
     self.remove_store = gtk.ListStore(gobject.TYPE_STRING,
                                       gobject.TYPE_PYOBJECT,
                                       gobject.TYPE_INT)
     for elm in to_add:
         self.add_store.append([elm.name, elm, 0])
     for elm in to_rm:
         self.remove_store.append([elm.name, elm ,0])
     self.dialog_pending_changes.realize()
     self.dialog_pending_changes.set_transient_for(parent)
     self.button_confirm_changes.grab_default()
     self.dialog_pending_changes.window.set_functions(gtk.gdk.FUNC_MOVE)
     # Setup the app list viewers
     self.treeview_add = AppListView(style=1)
     self.treeview_remove = AppListView(style=1)
     self.scrolledwindow_add.add(self.treeview_add)
     self.scrolledwindow_remove.add(self.treeview_remove)
     self.treeview_add.set_headers_visible(False)
     self.treeview_remove.set_headers_visible(False)
     self.treeview_add.set_model(self.add_store)
     self.treeview_remove.set_model(self.remove_store)
     self.treeview_add.show()
     self.treeview_remove.show()
 def __init__(self, datadir, parent, multiple_items_list, name, remove):
     SimpleGtkbuilderApp.__init__(self,
                                  path=datadir + "/gnome-app-install.ui")
     self.store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_PYOBJECT,
                                gobject.TYPE_INT)
     for elm in multiple_items_list:
         self.store.append((elm.name, elm, 0))
     self.dialog_multiple_apps.set_transient_for(parent)
     # Setup the application list
     self.treeview_apps = AppListView(style=1)
     self.scrolledwindow_multiple_apps.add(self.treeview_apps)
     self.treeview_apps.set_headers_visible(False)
     self.treeview_apps.set_model(self.store)
     self.treeview_apps.show()
     # Create the dialog message text
     if remove == True:
         header = (_("Remove %s and bundled applications?") % name)
         msg = _("%s is part of a software collection. If you remove "
                 "%s, you will remove all bundled applications as well.") %\
               (name, name)
         label = _("_Remove All")
     else:
         header = (_("Install %s and bundled applications?") % name)
         msg = _("%s is part of a software collection. If you install "
                 "%s, you will install all bundled applications as well.") %\
               (name, name)
         label = _("_Install All")
     self.label_multiple.set_markup("<b><big>%s</big></b>\n\n%s" %\
                                    (header, msg))
     self.button_multiple_action.set_label(label)
 def __init__(self, datadir, parent, multiple_items_list, name, remove):
     SimpleGtkbuilderApp.__init__(self, path=datadir + "/gnome-app-install.ui")
     self.store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_PYOBJECT, gobject.TYPE_INT)
     for elm in multiple_items_list:
         self.store.append((elm.name, elm, 0))
     self.dialog_multiple_apps.set_transient_for(parent)
     # Setup the application list
     self.treeview_apps = AppListView(style=1)
     self.scrolledwindow_multiple_apps.add(self.treeview_apps)
     self.treeview_apps.set_headers_visible(False)
     self.treeview_apps.set_model(self.store)
     self.treeview_apps.show()
     # Create the dialog message text
     if remove == True:
         header = _("Remove %s and bundled applications?") % name
         msg = _(
             "%s is part of a software collection. If you remove "
             "%s, you will remove all bundled applications as well."
         ) % (name, name)
         label = _("_Remove All")
     else:
         header = _("Install %s and bundled applications?") % name
         msg = _(
             "%s is part of a software collection. If you install "
             "%s, you will install all bundled applications as well."
         ) % (name, name)
         label = _("_Install All")
     self.label_multiple.set_markup("<b><big>%s</big></b>\n\n%s" % (header, msg))
     self.button_multiple_action.set_label(label)
    def __init__(self, datadir, parent, item):
        SimpleGtkbuilderApp.__init__(self,
                                     path=datadir+"/gnome-app-install.ui",
                                     root="dialog_proprietary")
        # Create the text of the dialog
        if item.isv:
            vendor = item.isv
        else:
            vendor = item.channel
        header = _("Enable the installation of software "
                   "from %s?") % vendor
        body = _("%s is provided by a third party vendor.") % item.name
        internet = _("You need a working internet connection to continue.")
        msg = "<b><big>%s</big></b>\n\n%s\n\n%s" % (header, body, internet)

        self.browser = BrowserView()
        self.vbox_custom.pack_start(self.browser)
        self.dialog_proprietary.set_transient_for(parent)
        self.dialog_proprietary.realize()
        self.dialog_proprietary.window.set_functions(gtk.gdk.FUNC_MOVE)
        self.label_proprietary.set_markup(msg)
        self.item = item
        self.button_add_channel.set_label(_("_Enable"))
Beispiel #5
0
    def __init__(self, datadir, parent, to_add, to_rm, cache, auto_close=False):
        def add_apps_to_store(apps, store):
            for app in apps:
                store.append([app.name, app, 0])

        SimpleGtkbuilderApp.__init__(self,
                                path=datadir+"/gnome-app-install.ui")
        self.cache = cache
        self.auto_close = auto_close
        self.store = gtk.ListStore(gobject.TYPE_STRING,
                                   gobject.TYPE_PYOBJECT,
                                   gobject.TYPE_INT)
        if parent:
            self.window_complete.set_transient_for(parent)
        self.treeview = AppListViewComplete()
        self.scrolledwindow_complete.add(self.treeview)
        self.treeview.set_headers_visible(False)
        self.treeview.set_model(self.store)
        self.treeview.show()
        # Identify failed and exectuable applications and extras
        # (stuff without execCmd lines like codecs)
        failed_apps = []
        failed_extras = []
        installed_apps = []
        installed_extras = []  
        self.install_failures = False
        for app in to_add:
            pkg = app.pkgname
            available = cache.has_key(pkg)
            installed = available and cache[pkg].is_installed
            if not available:
                if app.execCmd != "":
                    failed_apps.append(app)
                else:
                    failed_extras.append(app)
            elif not installed:
                 if app.execCmd != "":
                    failed_apps.append(app)
                 else:
                    failed_extras.append(app)
            elif installed and app.execCmd != '':
                installed_apps.append(app)
            elif installed and app.execCmd == '':
                installed_extras.append(app)
        for app in to_rm:
            pkg = app.pkgname
            if self.cache.has_key(pkg) and self.cache[pkg].is_installed:
                if app.execCmd != "":
                    failed_apps.append(app)
                else:
                    failed_extras.append(app)
        # record if anything failed (for auto_close)
        if failed_extras or failed_apps:
                self.install_failures = True
        # Connect the signals
        self.button_complete_retry.connect("clicked",
                                           self.on_button_retry_clicked)
        self.button_complete_more.connect("clicked",
                                          self.on_button_more_clicked)
        self.button_complete_close.connect("clicked",
                                           self.on_button_close_clicked)
        self.window_complete.connect("delete-event",
                                     self.on_delete)
        # Adjust the dialog text
        if (len(failed_apps) > 0 or len(failed_extras) > 0) and len(to_rm) == 0:
            if len(failed_extras) > 0:
                header = _("Software installation failed")
                body = _("There has been a problem during the installation "
                         "of the following pieces of software.")
                self.button_complete_more.set_label(_("Add/Remove More Software"))
            else:
                header = _("Application installation failed")
                body = _("There has been a problem during the installation "
                         "of the following applications.")
            add_apps_to_store(failed_apps, self.store)
            add_apps_to_store(failed_extras, self.store)
            self.image_complete_icon.set_from_stock(gtk.STOCK_DIALOG_ERROR,
                                                    gtk.ICON_SIZE_DIALOG)
            self.button_complete_retry.show()
        elif (len(failed_apps) > 0 or len(failed_extras)> 0) and\
             len(to_add) == 0:
            if len(failed_extras) > 0:
                header = _("Software could not be removed")
                body = _("There has been a problem during the removal "
                         "of the following pieces of software.")
                self.button_complete_more.set_label(_("Add/Remove More Software"))
            else:
                header = _("Not all applications could be removed")
                body = _("There has been a problem during the removal "
                         "of the following applications.")
            add_apps_to_store(failed_apps, self.store)
            add_apps_to_store(failed_extras, self.store)
            self.image_complete_icon.set_from_stock(gtk.STOCK_DIALOG_ERROR,
                                                    gtk.ICON_SIZE_DIALOG)
            self.button_complete_retry.show()
        elif len(failed_extras) > 0 or len(failed_apps) > 0:
            #FIXME: perhaps separate widgets would make more sence
            if len(failed_extras) > 0:
                header = _("Installation and removal of software failed")
                body = _("There has been a problem during the installation or "
                         "removal of the following pieces of software.")
                self.button_complete_more.set_label(_("Add/Remove More Software"))
            else:
                header = _("Installation and removal of applications failed")
                body = _("There has been a problem during the installation or "
                         "removal of the following applications.")
            add_apps_to_store(failed_apps, self.store)
            add_apps_to_store(failed_extras, self.store)
            self.button_complete_retry.show()
            self.image_complete_icon.set_from_stock(gtk.STOCK_DIALOG_ERROR,
                                                    gtk.ICON_SIZE_DIALOG)
        elif len(installed_apps) > 0:
            header = ngettext(_("New application has been installed"),
                              _("New applications have been installed"),
                              len(installed_apps))
            add_apps_to_store(installed_apps, self.store)
            # we do not support launching apps when runing as root
            if os.getuid() == 0:
                body = _("To start a newly installed application, "
                         "choose it from the applications menu.")
            else:
                body = _("To start a newly installed application "
                         "double click on it.")
                self.treeview.set_executable(True)
        elif len(installed_extras) > 0:
            header = _("Software has been installed successfully")
            body = _("Do you want to install or remove further " \
                     "software?")
            self.scrolledwindow_complete.hide()
            self.button_complete_more.set_label(_("Add/Remove More Software"))
        else:
            header = _("Applications have been removed successfully")
            body = _("Do you want to install or remove further " \
                     "applications?")
            self.scrolledwindow_complete.hide()
        self.label_complete.set_markup("<b><big>%s</big></b>\n\n%s" % (header,
                                                                       body))
    def __init__(self, datadir, parent, to_add, to_rm, cache, auto_close=False):
        def add_apps_to_store(apps, store):
            for app in apps:
                store.append([app.name, app, 0])

        SimpleGtkbuilderApp.__init__(self,
                                path=datadir+"/gnome-app-install.ui")
        self.cache = cache
        self.auto_close = auto_close
        self.store = gtk.ListStore(gobject.TYPE_STRING,
                                   gobject.TYPE_PYOBJECT,
                                   gobject.TYPE_INT)
        if parent:
            self.window_complete.set_transient_for(parent)
        self.treeview = AppListViewComplete()
        self.scrolledwindow_complete.add(self.treeview)
        self.treeview.set_headers_visible(False)
        self.treeview.set_model(self.store)
        self.treeview.show()
        # Identify failed and exectuable applications and extras
        # (stuff without execCmd lines like codecs)
        failed_apps = []
        failed_extras = []
        installed_apps = []
        installed_extras = []  
        self.install_failures = False
        for app in to_add:
            pkg = app.pkgname
            available = cache.has_key(pkg)
            installed = available and cache[pkg].isInstalled
            if not available:
                if app.execCmd != "":
                    failed_apps.append(app)
                else:
                    failed_extras.append(app)
            elif not installed:
                 if app.execCmd != "":
                    failed_apps.append(app)
                 else:
                    failed_extras.append(app)
            elif installed and app.execCmd != '':
                installed_apps.append(app)
            elif installed and app.execCmd == '':
                installed_extras.append(app)
        for app in to_rm:
            pkg = app.pkgname
            if self.cache.has_key(pkg) and self.cache[pkg].isInstalled:
                if app.execCmd != "":
                    failed_apps.append(app)
                else:
                    failed_extras.append(app)
        # record if anything failed (for auto_close)
        if failed_extras or failed_apps:
                self.install_failures = True
        # Connect the signals
        self.button_complete_retry.connect("clicked",
                                           self.on_button_retry_clicked)
        self.button_complete_more.connect("clicked",
                                          self.on_button_more_clicked)
        self.button_complete_close.connect("clicked",
                                           self.on_button_close_clicked)
        self.window_complete.connect("delete-event",
                                     self.on_delete)
        # Adjust the dialog text
        if (len(failed_apps) > 0 or len(failed_extras) > 0) and len(to_rm) == 0:
            if len(failed_extras) > 0:
                header = _("Software installation failed")
                body = _("There has been a problem during the installation "
                         "of the following pieces of software.")
                self.button_complete_more.set_label(_("Add/Remove More Software"))
            else:
                header = _("Application installation failed")
                body = _("There has been a problem during the installation "
                         "of the following applications.")
            add_apps_to_store(failed_apps, self.store)
            add_apps_to_store(failed_extras, self.store)
            self.image_complete_icon.set_from_stock(gtk.STOCK_DIALOG_ERROR,
                                                    gtk.ICON_SIZE_DIALOG)
            self.button_complete_retry.show()
        elif (len(failed_apps) > 0 or len(failed_extras)> 0) and\
             len(to_add) == 0:
            if len(failed_extras) > 0:
                header = _("Software could not be removed")
                body = _("There has been a problem during the removal "
                         "of the following pieces of software.")
                self.button_complete_more.set_label(_("Add/Remove More Software"))
            else:
                header = _("Not all applications could be removed")
                body = _("There has been a problem during the removal "
                         "of the following applications.")
            add_apps_to_store(failed_apps, self.store)
            add_apps_to_store(failed_extras, self.store)
            self.image_complete_icon.set_from_stock(gtk.STOCK_DIALOG_ERROR,
                                                    gtk.ICON_SIZE_DIALOG)
            self.button_complete_retry.show()
        elif len(failed_extras) > 0 or len(failed_apps) > 0:
            #FIXME: perhaps separate widgets would make more sence
            if len(failed_extras) > 0:
                header = _("Installation and removal of software failed")
                body = _("There has been a problem during the installation or "
                         "removal of the following pieces of software.")
                self.button_complete_more.set_label(_("Add/Remove More Software"))
            else:
                header = _("Installation and removal of applications failed")
                body = _("There has been a problem during the installation or "
                         "removal of the following applications.")
            add_apps_to_store(failed_apps, self.store)
            add_apps_to_store(failed_extras, self.store)
            self.button_complete_retry.show()
            self.image_complete_icon.set_from_stock(gtk.STOCK_DIALOG_ERROR,
                                                    gtk.ICON_SIZE_DIALOG)
        elif len(installed_apps) > 0:
            header = ngettext(_("New application has been installed"),
                              _("New applications have been installed"),
                              len(installed_apps))
            add_apps_to_store(installed_apps, self.store)
            # we do not support launching apps when runing as root
            if os.getuid() == 0:
                body = _("To start a newly installed application, "
                         "choose it from the applications menu.")
            else:
                body = _("To start a newly installed application "
                         "double click on it.")
                self.treeview.set_executable(True)
        elif len(installed_extras) > 0:
            header = _("Software has been installed successfully")
            body = _("Do you want to install or remove further " \
                     "software?")
            self.scrolledwindow_complete.hide()
            self.button_complete_more.set_label(_("Add/Remove More Software"))
        else:
            header = _("Applications have been removed successfully")
            body = _("Do you want to install or remove further " \
                     "applications?")
            self.scrolledwindow_complete.hide()
        self.label_complete.set_markup("<b><big>%s</big></b>\n\n%s" % (header,
                                                                       body))
  def __init__(self, datadir=None, options=None, file=None, parent=None):
    """ Provide a GTK based graphical user interface to configure
        the used software repositories, corresponding authentication keys
        and update automation """
    SoftwareProperties.__init__(self, options=options, datadir=datadir)
    Gtk.Window.set_default_icon_name("software-properties")

    SimpleGtkbuilderApp.__init__(self,
                                 os.path.join(datadir, "gtkbuilder", "main.ui"),
                                 domain="software-properties")

    if parent:
      self.window_main.set_type_hint(Gdk.WindowTypeHint.DIALOG)
      self.window_main.show()
      try:
        self.window_main.set_transient_for(parent)
      except:
        pass

    # If externally called, reparent to external application.
    self.options = options
    if options and options.toplevel != None:
      self.window_main.set_type_hint(Gdk.WindowTypeHint.DIALOG)
      self.window_main.show()
      try:
        toplevel = Gdk.window_foreign_new(int(options.toplevel))
      except AttributeError:
        toplevel = None
      if (toplevel):
        try:
          self.window_main.set_transient_for(toplevel)
        except: 
          pass
    if options and options.open_tab:
      self.notebook_main.set_current_page(int(options.open_tab))

    # gsettings
    all_schemas = Gio.Settings.list_schemas()
    if "com.ubuntu.update-notifier" in all_schemas:
        self.settings = Gio.Settings("com.ubuntu.update-notifier")
        # we need this for reverting
        self.initial_auto_launch = self.settings.get_int("regular-auto-launch-interval") 
    else:
        self.settings = None
        self.initial_auto_launch = 0
        self.combobox_other_updates.set_sensitive(False)

    # get the dbus backend
    bus = dbus.SystemBus()
    proxy = bus.get_object("com.ubuntu.SoftwareProperties", "/")
    self.backend = dbus.Interface(proxy, "com.ubuntu.SoftwareProperties")
    self.backend.connect_to_signal(
        "SourcesListModified", self.on_sources_list_modified)
    self.backend.connect_to_signal(
        "ConfigModified", self.on_config_modified)
    self.backend.connect_to_signal(
        "KeysModified", self.on_keys_modified)
    self.backend.connect_to_signal(
        "AuthFailed", self.on_auth_failed)
    self.backend.connect_to_signal(
        "CdromScanFailed", self.on_cdrom_scan_failed)
    
    # Show what we have early
    self.window_main.show()

    # used to store the handlers of callbacks
    self.handlers = []

    # Put some life into the user interface:
    self.init_popcon()
    self.init_auto_update()
    self.init_release_upgrades()
    self.show_auto_update_level()
    # Setup the key list
    self.init_keys()
    self.show_keys()
    # Setup the ISV sources list
    self.init_isv_sources()
    self.show_isv_sources()
    self.show_cdrom_sources()
    # Setup and show the distro elements
    self.init_distro()
    self.show_distro()

    # Show the import/replace sources.list dialog if a file different
    # to the default sources.list was specified 
    # NOTE: If the file path points to the default sources.list the user
    #       perhaps assumed that s-p would act like a normal editor.
    #       We have got some bug reports from users calling
    #       "sudo software-properties-gtk /etc/apt/sources.list" from the
    #       command line.
    if (file != None and
       os.path.abspath(file) !=  "%s%s" % (apt_pkg.config.find_dir("Dir::Etc"),
                                           apt_pkg.config.find("Dir::Etc::sourcelist"))):
        self.open_file(file)
Beispiel #8
0
 def __init__(self):
     SimpleGtkbuilderApp.__init__(self, "../data/gtkbuilder/UpdateManager.ui", "update-manager")
  def __init__(self, datadir=None, options=None, file=None, parent=None):
    """ Provide a GTK based graphical user interface to configure
        the used software repositories, corresponding authentication keys
        and update automation """
    SoftwareProperties.__init__(self, options=options, datadir=datadir)
    gtk.window_set_default_icon_name("software-properties")

    SimpleGtkbuilderApp.__init__(self, os.path.join(datadir, "gtkbuilder", "main.ui"),
                            domain="software-properties")

    if parent:
      self.window_main.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
      self.window_main.show()
      try:
        self.window_main.set_transient_for(parent)
      except:
        pass

    # If externally called, reparent to external application.
    self.options = options
    if options and options.toplevel != None:
      self.window_main.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
      self.window_main.show()
      toplevel = gtk.gdk.window_foreign_new(int(options.toplevel))
      if (toplevel):
        try:
          self.window_main.window.set_transient_for(toplevel)
        except:
          pass
    if options and options.open_tab:
      self.notebook_main.set_current_page(int(options.open_tab))

    # Show what we have early
    self.window_main.show()

    # used to store the handlers of callbacks
    self.handlers = []

    # Put some life into the user interface:
    #self.init_popcon()
    #self.init_auto_update()
    #self.init_release_upgrades()
    #self.show_auto_update_level()
    self.vbox_popcon.hide()
    self.vbox8.hide()

    # Setup the key list
    self.init_keys()
    self.show_keys()
    # Setup the ISV sources list
    self.init_isv_sources()
    self.show_isv_sources()
    self.show_cdrom_sources()
    # Setup and show the distro elements
    self.init_distro()
    self.show_distro()

    # Show the import/replace sources.list dialog if a file different
    # to the default sources.list was specified
    # NOTE: If the file path points to the default sources.list the user
    #       perhaps assumed that s-p would act like a normal editor.
    #       We have got some bug reports from users calling
    #       "sudo software-properties-gtk /etc/apt/sources.list" from the
    #       command line.
    if file != None and \
       os.path.abspath(file) !=  "%s%s" % (apt_pkg.config.find_dir("Dir::Etc"),
                                           apt_pkg.config.find("Dir::Etc::sourcelist")):
        self.open_file(file)