def on_apply_clicked(self, widget, data = None): self.packageWorker.perform_action(widget.get_toplevel(), self.to_add, self.to_rm) done = True update_apt_cache() for pkg in self.to_add: if not PackageInfo(pkg).check_installed(): done = False break for pkg in self.to_rm: if PackageInfo(pkg).check_installed(): done = False break if done: self.button.set_sensitive(False) InfoDialog(_('Update Successful!')).launch() else: InfoDialog(_('Update Failed!')).launch() self.to_add = [] self.to_rm = [] self.update_model()
def clean_selected_config(self): model = self.get_model() dialog = CleanConfigDialog(self.get_toplevel(), self.get_list()) if dialog.run() == gtk.RESPONSE_REJECT: dialog.destroy() dialog.user_action = True self.show_usercancel_dialog() else: self.show_success_dialog() update_apt_cache() self.update_config_model() self.emit('cleaned')
def clean_selected_package(self): state = self.__packageworker.perform_action(self.get_toplevel(), [],self.__check_list) if state == 0: self.show_success_dialog() else: self.show_failed_dialog() update_apt_cache() if self.mode == 'package': self.update_package_model() else: self.update_kernel_model() self.__check_list = [] self.emit('cleaned')
def __init__(self): TweakPage.__init__(self, _('Add/Remove Applications'), _('A simple but more effecient method for finding and installing popular packages than the default Add/Remove.')) update_apt_cache(True) self.to_add = [] self.to_rm = [] self.packageWorker = PackageWorker() vbox = gtk.VBox(False, 8) self.pack_start(vbox) hbox = gtk.HBox(False, 0) vbox.pack_start(hbox, False, False, 0) combobox = self.create_category() combobox.set_active(0) combobox.connect('changed', self.on_category_changed) hbox.pack_end(combobox, False, False, 0) sw = gtk.ScrolledWindow() sw.set_shadow_type(gtk.SHADOW_ETCHED_IN) sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) vbox.pack_start(sw) # create tree view treeview = self.create_treeview() treeview.set_rules_hint(True) treeview.set_search_column(COLUMN_NAME) sw.add(treeview) # button hbox = gtk.HBox(False, 0) vbox.pack_end(hbox, False ,False, 0) self.button = gtk.Button(stock = gtk.STOCK_APPLY) self.button.connect('clicked', self.on_apply_clicked) self.button.set_sensitive(False) hbox.pack_end(self.button, False, False, 0) self.show_all()
def on_apply_clicked(self, widget, box): to_add = [] to_rm = [] for widget in box.items: if widget.get_active(): to_add.append(widget.pkgname) else: to_rm.append(widget.pkgname) state = self.packageWorker.perform_action(widget.get_toplevel(), to_add, to_rm) if state == 0: self.button.set_sensitive(False) InfoDialog(_("Update successful!")).launch() else: InfoDialog(_("Update failed!")).launch() update_apt_cache()
def on_apply_clicked(self, widget, box): to_add = [] to_rm = [] for widget in box.items: if widget.get_active(): to_add.append(widget.pkgname) else: to_rm.append(widget.pkgname) self.packageWorker.perform_action(widget.get_toplevel(), to_add, to_rm) self.button.set_sensitive(False) InfoDialog(_("Update successful!")).launch() update_apt_cache() CompizSetting.update_context() self.remove_all_children() self.create_interface() self.show_all()
def deep_update(self): update_apt_cache() self.update_model()
def __init__(self): super(PackageCleaner, self).__init__( _('Package Cleaner'), _('Free up disk space by removing unneeded packages and cleaning the package download cache.')) update_apt_cache(True) self.to_add = [] self.to_rm = [] self.button_list = [] self.current_button = 0 hbox = gtk.HBox(False, 0) self.pack_start(hbox, True, True, 0) sw = gtk.ScrolledWindow() sw.set_shadow_type(gtk.SHADOW_ETCHED_IN) sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) hbox.pack_start(sw) vbox = gtk.VBox(False, 8) hbox.pack_start(vbox, False, False, 5) # create tree view self.treeview = PackageView() self.treeview.set_rules_hint(True) self.treeview.connect('checked', self.on_item_checked) self.treeview.connect('cleaned', self.on_item_cleaned) sw.add(self.treeview) # create the button self.pkg_button = self.create_button(_('Clean Package'), gtk.image_new_from_pixbuf(get_icon_with_name('deb', 24)), self.treeview.update_package_model) vbox.pack_start(self.pkg_button, False, False, 0) self.cache_button = self.create_button(_('Clean Cache'), gtk.image_new_from_stock(gtk.STOCK_CLEAR, gtk.ICON_SIZE_BUTTON), self.treeview.update_cache_model) vbox.pack_start(self.cache_button, False, False, 0) self.config_button = self.create_button(_('Clean Config'), gtk.image_new_from_stock(gtk.STOCK_PREFERENCES, gtk.ICON_SIZE_BUTTON), self.treeview.update_config_model) vbox.pack_start(self.config_button, False, False, 0) self.kernel_button = self.create_button(_('Clean Kernel'), gtk.image_new_from_pixbuf(get_icon_with_name('start-here', 24)), self.treeview.update_kernel_model) vbox.pack_start(self.kernel_button, False, False, 0) # checkbutton self.select_button = gtk.CheckButton(_('Select All')) self.select_button.set_sensitive(False) self.__handler_id = self.select_button.connect('toggled', self.on_select_all) self.pack_start(self.select_button, False, False, 0) # button hbox = gtk.HBox(False, 0) self.pack_end(hbox, False ,False, 5) un_lock = PolkitButton() un_lock.connect('changed', self.on_polkit_action) hbox.pack_end(un_lock, False, False, 5) self.clean_button = gtk.Button(stock = gtk.STOCK_CLEAR) self.clean_button.connect('clicked', self.on_clean_button_clicked) self.clean_button.set_sensitive(False) hbox.pack_end(self.clean_button, False, False, 5) self.show_all()
def __init__(self): TweakPage.__init__(self) button = WidgetFactory.create("GconfCheckButton", label = _('Show advanced permissions in the Nautilus "File Properties" window'), key = "show_advanced_permissions") box = ListPack(_("File Browser"), (button, )) self.pack_start(box, False, False, 0) boxes = [] hbox1 = gtk.HBox(False, 5) label = gtk.Label(_('Default thumbnail icon size (pixels)')) hbox1.pack_start(label, False, False, 0) boxes.append(hbox1) button = WidgetFactory.create('GconfSpinButton', key = 'thumbnail_size', min = 16, max = 512, step = 16) hbox1.pack_end(button, False, False, 0) button = WidgetFactory.create('GconfSpinButton', key = 'maximum_size', min = -1, max = 512, step = 1) if button: hbox2 = gtk.HBox(False, 5) label = gtk.Label(_('Maximum size of the thumbnail cache (megabytes)')) hbox2.pack_start(label, False, False, 0) hbox2.pack_end(button, False, False, 0) boxes.append(hbox2) button = WidgetFactory.create('GconfSpinButton', key = 'maximum_age', min = -1, max = 180, step = 1) if button: hbox3 = gtk.HBox(False, 5) label = gtk.Label(_('Maximum age for the thumbnail in the cache (days)')) hbox3.pack_start(label, False, False, 0) hbox3.pack_end(button, False, False, 0) boxes.append(hbox3) hbox4 = gtk.HBox(False, 5) button = gtk.Button(stock = gtk.STOCK_CLEAR) self.set_clean_button_label(button) button.connect('clicked', self.on_clean_thumbnails_clicked) hbox4.pack_end(button, False, False, 0) boxes.append(hbox4) box = ListPack(_('Thumbnails Settings'), boxes) self.pack_start(box, False, False, 0) if not DISABLE: update_apt_cache(True) self.packageWorker = PackageWorker() self.nautilus_terminal = AptCheckButton(_('Nautilus with Open Terminal'), 'nautilus-open-terminal') self.nautilus_terminal.connect('toggled', self.colleague_changed) self.nautilus_root = AptCheckButton(_('Nautilus with Root Privileges'), 'nautilus-gksu') self.nautilus_root.connect('toggled', self.colleague_changed) self.nautilus_wallpaper = AptCheckButton(_('Nautilus with Wallpaper'), 'nautilus-wallpaper') self.nautilus_wallpaper.connect('toggled', self.colleague_changed) box = ListPack(_("Nautilus Extensions"), ( self.nautilus_terminal, self.nautilus_root, self.nautilus_wallpaper, )) self.button = gtk.Button(stock = gtk.STOCK_APPLY) self.button.connect("clicked", self.on_apply_clicked, box) self.button.set_sensitive(False) hbox = gtk.HBox(False, 0) hbox.pack_end(self.button, False, False, 0) box.vbox.pack_start(hbox, False, False, 0) self.pack_start(box, False, False, 0)
def create_interface(self): if module_check.has_apt(): update_apt_cache(True) self.packageWorker = PackageWorker() self.advanced_settings = AptCheckButton(_("Install Advanced Desktop Effects Settings Manager"), 'compizconfig-settings-manager') self.advanced_settings.connect('toggled', self.colleague_changed) self.simple_settings = AptCheckButton(_("Install Simple Desktop Effects Settings manager"), 'simple-ccsm') self.simple_settings.connect('toggled', self.colleague_changed) self.screenlets = AptCheckButton(_("Install Screenlets Widget Application"), 'screenlets') self.screenlets.connect('toggled', self.colleague_changed) if module_check.has_ccm() and module_check.has_right_compiz(): hbox = gtk.HBox(False, 0) hbox.pack_start(self.create_edge_setting(), True, False, 0) edge_setting = SinglePack('Edge Settings', hbox) self.pack_start(edge_setting, False, False, 0) self.snap = SnapWindow(_("Enable snapping windows"), self) self.wobbly_w = WobblyWindow(_("Enable wobbly windows"), self); box = ListPack(_("Window Effects"), (self.snap, self.wobbly_w)) self.pack_start(box, False, False, 0) button1 = OpacityMenu(_("Enable transparent menus")) self.wobbly_m = WobblyMenu(_("Enable wobbly menus"), self) box = ListPack(_("Menu Effects"), (button1, self.wobbly_m)) self.pack_start(box, False, False, 0) if module_check.has_apt(): update_apt_cache(True) box = ListPack(_("Useful Extensions"), ( self.simple_settings, self.screenlets, )) self.button = gtk.Button(stock = gtk.STOCK_APPLY) self.button.connect("clicked", self.on_apply_clicked, box) self.button.set_sensitive(False) hbox = gtk.HBox(False, 0) hbox.pack_end(self.button, False, False, 0) box.vbox.pack_start(hbox, False, False, 0) self.pack_start(box, False, False, 0) else: box = ListPack(_("Prerequisite Conditions"), ( self.advanced_settings, )) self.button = gtk.Button(stock = gtk.STOCK_APPLY) self.button.connect("clicked", self.on_apply_clicked, box) self.button.set_sensitive(False) hbox = gtk.HBox(False, 0) hbox.pack_end(self.button, False, False, 0) box.vbox.pack_start(hbox, False, False, 0) self.pack_start(box, False, False, 0)