Beispiel #1
0
    def on_polkit_action(self, widget, action):
        if action:
            self.sync_button.set_sensitive(True)

            if proxy.get_object():
                #                if os.getenv('LANG').startswith('zh_CN'):
                #                    self.sourceview.setup_ubuntu_cn_mirror()
                self.sourceview.set_sensitive(True)
                self.expander.set_sensitive(True)

                if not CONFIG.get_value_from_key(WARNING_KEY):
                    dialog = WarningDialog(_(
                        'It is a possible security risk to '
                        'use packages from Third-Party Sources.\n'
                        'Please be careful and use only sources you trust.'),
                                           buttons=gtk.BUTTONS_OK,
                                           title=_('Warning'))
                    checkbutton = GconfCheckButton(_('Never show this dialog'),
                                                   WARNING_KEY)
                    dialog.add_widget(checkbutton)

                    dialog.run()
                    dialog.destroy()
            else:
                ServerErrorDialog().launch()
        else:
            AuthenticateFailDialog().launch()
    def __init__(self):
        TweakModule.__init__(self, 'updatemanager.ui')

        self.updateview = UpdateView()
        self.updateview.connect('changed', self.on_update_status_changed)
        self.updateview.connect('select', self.on_select_action)
        self.update_list()
        self.sw1.add(self.updateview)

        button = GconfCheckButton(label=_('Automatically run System Update Manager'), 
                                  key='/apps/update-notifier/auto_launch')
        self.vbox1.pack_start(button, False, False, 0)

        self.ppa_button = GconfCheckButton(
                            label=_('Temporarily disable third-party PPA sources whilst refreshing'),
                            key='/apps/ubuntu-tweak/disable_ppa')
        self.vbox1.pack_start(self.ppa_button, False, False, 0)

        self.reparent(self.main_vbox)
Beispiel #3
0
    def notify_stable_source(self):
        log.debug("Stable Source Warning is %s",
                  CONFIG.get_value_from_key(WARNING_KEY))
        log.debug("The Stable Source enabling is %s",
                  proxy.get_stable_source_enabled())
        if proxy.get_object() and not CONFIG.get_value_from_key(
                WARNING_KEY) and not proxy.get_stable_source_enabled():
            dialog = WarningDialog(_(
                'It is highly recommended that you enable the Ubuntu Tweak stable repository to get security and maintenance updates.\n'
                'If you don\'t enable this repository, you will need to update manually.\n\n'
                'Would you like to enable this repository?'),
                                   title=_('Warning'))
            checkbutton = GconfCheckButton(_('Never show this dialog'),
                                           WARNING_KEY)
            dialog.add_widget(checkbutton)

            response = dialog.run()
            dialog.destroy()

            if response == gtk.RESPONSE_YES:
                log.debug("Start enable the source")
                proxy.enable_stable_source()
                log.debug("Finish enable the source, now it's %s",
                          proxy.get_stable_source_enabled())
class UpdateManager(TweakModule):
    __title__ = _('Update Manager')
    __desc__ = _('A simple and easy-to-use update manager')
    __icon__ = 'system-software-update'
    __category__ = 'application'

    def __init__(self):
        TweakModule.__init__(self, 'updatemanager.ui')

        self.updateview = UpdateView()
        self.updateview.connect('changed', self.on_update_status_changed)
        self.updateview.connect('select', self.on_select_action)
        self.update_list()
        self.sw1.add(self.updateview)

        button = GconfCheckButton(label=_('Automatically run System Update Manager'), 
                                  key='/apps/update-notifier/auto_launch')
        self.vbox1.pack_start(button, False, False, 0)

        self.ppa_button = GconfCheckButton(
                            label=_('Temporarily disable third-party PPA sources whilst refreshing'),
                            key='/apps/ubuntu-tweak/disable_ppa')
        self.vbox1.pack_start(self.ppa_button, False, False, 0)

        self.reparent(self.main_vbox)

    def update_list(self):
        PACKAGE_WORKER.update_apt_cache(init=True)
        self.updateview.get_model().clear()
        self.updateview.update_updates(list(PACKAGE_WORKER.get_update_package()))
        self.install_button.set_sensitive(False)

    def on_refresh_button_clicked(self, widget):
        do_ppa_disable = False
        if self.ppa_button.get_active():
            proxy.disable_ppa()
            do_ppa_disable = True

        UpdateCacheDialog(widget.get_toplevel()).run()

        PACKAGE_WORKER.update_apt_cache(True)

        new_updates = list(PACKAGE_WORKER.get_update_package())
        if new_updates:
            self.updateview.get_model().clear()
            self.updateview.update_updates(new_updates)
        else:
            dialog = InfoDialog(_("Your system is clean and no updates are available."),
                        title=_('Software information is now up-to-date'))

            dialog.launch()

        if do_ppa_disable:
            proxy.enable_ppa()
        self.emit('call', 'ubuntutweak.modules.sourcecenter', 'update_thirdparty', {})
        self.emit('call', 'ubuntutweak.modules.sourceeditor', 'update_source_combo', {})

    def on_select_action(self, widget, active):
        self.updateview.select_all_action(active)

    def on_update_status_changed(self, widget, count):
        self.install_button.set_label(ngettext('Install Update',
                                               'Install Updates', count))
        if count:
            self.install_button.set_sensitive(True)
        else:
            self.install_button.set_sensitive(False)

    def on_install_button_clicked(self, widget):
        PACKAGE_WORKER.perform_action(widget.get_toplevel(), self.updateview.to_add, self.updateview.to_rm)

        PACKAGE_WORKER.update_apt_cache(True)

        PACKAGE_WORKER.show_installed_status(self.updateview.to_add, self.updateview.to_rm)

        self.updateview.get_model().clear()
        self.updateview.update_updates(list(PACKAGE_WORKER.get_update_package()))
        self.updateview.select_all_action(False)