Beispiel #1
0
 def on_rebuild_clicked(self, widget):
     dialog = WarningDialog(_('This will delete all disabled scripts.\nDo you wish to continue?'))
     if dialog.run() == gtk.RESPONSE_YES:
         self.default.remove()
         self.default.create()
         self.disable_scripts.update_model()
     dialog.destroy()
Beispiel #2
0
 def on_rebuild_clicked(self, widget):
     dialog = WarningDialog(_('This will delete all disabled templates.\n'
                              'Do you wish to continue?'))
     if dialog.run() == gtk.RESPONSE_YES:
         self.default.remove()
         self.default.create()
         self.disable_templates.update_model()
     dialog.destroy()
Beispiel #3
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 colleague_changed(self, widget):
     enabled = self.recently_used.get_active()
     file = os.path.expanduser("~/.recently-used.xbel")
     if enabled:
         os.system('rm -r %s' % file)
         os.system('touch %s' % file)
     else:
         dialog = WarningDialog(_('Disabling "Recent Documents" may break other software, for example the history feature in VMware Player.'),
                                title=_("Warning"))
         if dialog.run() == gtk.RESPONSE_YES:
             os.system('rm -r %s' % file)
             os.system('mkdir %s' % file)
         else:
             widget.set_active(True)
         dialog.destroy()
Beispiel #5
0
    def notify_invalid_sources(self, disabled_list):
        treeview = ErrorListView(disabled_list)
        dialog = WarningDialog(_('To keep the package manager work, Ubuntu Tweak has disabled these broken sources.\n\nIf you want to re-open these sources, Please try to correct it.\n\nYou can click "Help" to see the guide, then edit these sources at Source Editor.'),
                    title=_("The software sources list is broken"),
                    buttons=gtk.BUTTONS_CLOSE)

        dialog.add_widget_with_scrolledwindow(treeview, height=100)
        dialog.add_button(_('_Help'), gtk.RESPONSE_YES)

        response = dialog.run()
        dialog.destroy()
        if response == gtk.RESPONSE_YES:
            webbrowser.open('http://blog.ubuntu-tweak.com/guide/how-to-fix-the-source-list-files')
Beispiel #6
0
    def notify_invalid_sources(self, disabled_list):
        treeview = ErrorListView(disabled_list)
        dialog = WarningDialog(_(
            'To keep the package manager work, Ubuntu Tweak has disabled these broken sources.\n\nIf you want to re-open these sources, Please try to correct it.\n\nYou can click "Help" to see the guide, then edit these sources at Source Editor.'
        ),
                               title=_("The software sources list is broken"),
                               buttons=gtk.BUTTONS_CLOSE)

        dialog.add_widget_with_scrolledwindow(treeview, height=100)
        dialog.add_button(_('_Help'), gtk.RESPONSE_YES)

        response = dialog.run()
        dialog.destroy()
        if response == gtk.RESPONSE_YES:
            webbrowser.open(
                'http://blog.ubuntu-tweak.com/guide/how-to-fix-the-source-list-files'
            )
Beispiel #7
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())
Beispiel #8
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()
Beispiel #9
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())
Beispiel #10
0
    def on_action_clicked(self, cell, path):
        iter = self.model.get_iter_from_string(path)
        installed = self.model.get_value(iter, self.COLUMN_ACTION)
        task = self.model.get_value(iter, self.COLUMN_TASK)
        name = self.model.get_value(iter, self.COLUMN_NAME)

        self.set_busy()
        updateview = UpdateView()
        updateview.set_headers_visible(False)

        if installed == 'Installed':
            dialog = InfoDialog(
                _('You\'ve installed the <b>"%s"</b> task.' % name))
            dialog.add_button(_('Remove'), gtk.RESPONSE_YES)
            res = dialog.run()
            dialog.destroy()
            if res == gtk.RESPONSE_YES:
                dialog = WarningDialog(_(
                    'It is dangerous to remove a task, it may remove the desktop related packages.\nPlease only continue when you know what you are doing.'
                ),
                                       title=_("Dangerous!"))
                res = dialog.run()
                dialog.destroy()

                if res == gtk.RESPONSE_YES:
                    data = os.popen('tasksel -t remove %s' % task).read()
                    pkgs = self.filter_remove_packages(data)
                    updateview.update_updates(pkgs)
                    updateview.select_all_action(True)

                    dialog = self.create_task_dialog(
                        title=_('Packages will be removed'),
                        desc=_(
                            'You are going to remove the <b>"%s"</b> task.\nThe following packages will be remove.'
                            % name),
                        updateview=updateview)

                    res = dialog.run()
                    dialog.destroy()

                    if res == gtk.RESPONSE_YES:
                        PACKAGE_WORKER.perform_action(self.get_toplevel(), [],
                                                      updateview.to_add)
                        PACKAGE_WORKER.update_apt_cache(True)
                        self.update_model()
        else:
            list = os.popen('tasksel --task-packages %s' %
                            task).read().split('\n')
            list = [
                pkg for pkg in list
                if pkg.strip() and not PackageInfo(pkg).check_installed()
            ]

            updateview.update_updates(list)
            updateview.select_all_action(True)

            dialog = self.create_task_dialog(
                title=_('New packages will be installed'),
                desc=_(
                    'You are going to install the <b>"%s"</b> task.\nThe following packager will be installed.'
                    % name),
                updateview=updateview)

            res = dialog.run()
            dialog.destroy()

            if res == gtk.RESPONSE_YES:
                PACKAGE_WORKER.perform_action(self.get_toplevel(),
                                              updateview.to_add, [])
                PACKAGE_WORKER.update_apt_cache(True)
                self.update_model()

        print self.model.get_value(iter, self.COLUMN_ACTION)

        self.unset_busy()