def __init__(self): TweakModule.__init__(self, "templates.ui") if not is_right_path(): label = Gtk.Label( label=_( 'The templates path is incorrect! The current path points to "%s".\nPlease reset it to a location within your Home Folder.' ) % USER_DIR ) hbox = Gtk.HBox() self.add_start(hbox, False, False, 0) hbox.pack_start(label, False, False, 0) button = Gtk.Button(stock=Gtk.STOCK_GO_FORWARD) button.connect("clicked", self.on_go_button_clicked) set_label_for_stock_button(button, _("Go And Set")) hbox.pack_end(button, False, False, 0) button = Gtk.Button(stock=Gtk.STOCK_EXECUTE) button.connect("clicked", self.on_restart_button_clicked) set_label_for_stock_button(button, _("Restart This Module")) hbox.pack_end(button, False, False, 0) else: self.create_interface()
def set_clean_button_label(self, button): try: size = os.popen('du -bs ~/.thumbnails').read().split()[0] except: size = '0' button.set_sensitive(False) set_label_for_stock_button(button, _('Delete thumbnail cache (Frees %s of disk space)') % filesizeformat(size))
def __init__(self): TweakModule.__init__(self, 'sourcecenter.ui') self.url = SOURCE_VERSION_URL set_label_for_stock_button(self.sync_button, _('_Sync')) self.sourceview = SourcesView() self.sourceview.set_status_active(True) self.sourceview.update_model() self.sourceview.connect('sourcechanged', self.on_source_changed) self.sourceview.selection.connect('changed', self.on_selection_changed) self.sourceview.set_sensitive(False) self.sourceview.set_rules_hint(True) self.source_selection = self.sourceview.get_selection() self.source_selection.connect('changed', self.on_source_selection) self.right_sw.add(self.sourceview) self.cateview = CategoryView(os.path.join(SOURCE_ROOT, 'cates.json')) self.cateview.set_status_from_view(self.sourceview) self.cateview.update_model() self.cate_selection = self.cateview.get_selection() self.cate_selection.connect('changed', self.on_category_changed) self.left_sw.add(self.cateview) un_lock = PolkitButton(PK_ACTION_SOURCE) un_lock.connect('authenticated', self.on_polkit_action) self.hbuttonbox1.pack_end(un_lock, False, False, 0) self.update_timestamp() UPDATE_SETTING.set_value(False) UPDATE_SETTING.connect_notify(self.on_have_update, data=None) log.debug('Start check update') thread.start_new_thread(self.check_update, ()) GObject.timeout_add(60000, self.update_timestamp) if self.check_source_upgradable() and UPGRADE_DICT: GObject.idle_add(self.upgrade_sources) self.reparent(self.main_vbox)
def __init__(self): TweakModule.__init__(self, 'sourcecenter.ui') self.url = SOURCE_VERSION_URL set_label_for_stock_button(self.sync_button, _('_Sync')) self.cateview = SourceCategoryView( os.path.join(SOURCE_ROOT, 'cates.json')) self.cateview.update_cate_model() self.cateview.get_selection().connect('changed', self.on_category_changed) self.left_sw.add(self.cateview) self.sourceview = SourcesView() self.sourceview.set_status_active(True) self.sourceview.update_source_model() self.sourceview.connect('sourcechanged', self.on_source_changed) self.sourceview.connect('new_purge', self.on_purge_changed) self.sourceview.get_selection().connect('changed', self.on_source_selection) self.sourceview.set_rules_hint(True) self.right_sw.add(self.sourceview) self.cateview.set_status_from_view(self.sourceview) self.update_timestamp() UPDATE_SETTING.set_value(False) UPDATE_SETTING.connect_notify(self.on_have_update, data=None) log.debug('Start check update') thread.start_new_thread(self.check_update, ()) GObject.timeout_add(60000, self.update_timestamp) if self.check_source_upgradable() and UPGRADE_DICT: GObject.idle_add(self.upgrade_sources) self.add_start(self.main_vbox) self.connect('realize', self.setup_ui_tasks) GObject.idle_add(self.show_warning)
def __init__(self): TweakModule.__init__(self, 'appcenter.ui') set_label_for_stock_button(self.sync_button, _('_Sync')) self.to_add = [] self.to_rm = [] self.url = APP_VERSION_URL self.appview = AppView() self.appview.set_status_active(True) self.appview.update_model() self.appview.sort_model() self.appview.connect('changed', self.on_app_status_changed) self.app_selection = self.appview.get_selection() self.app_selection.connect('changed', self.on_app_selection) self.right_sw.add(self.appview) self.cateview = AppCategoryView( os.path.join(APPCENTER_ROOT, 'cates.json')) self.cateview.set_status_from_view(self.appview) self.cateview.update_cate_model() self.cate_selection = self.cateview.get_selection() self.cate_selection.connect('changed', self.on_category_changed) self.left_sw.add(self.cateview) self.update_timestamp() self.show_all() UPDATE_SETTING.set_value(False) UPDATE_SETTING.connect_notify(self.on_have_update, data=None) thread.start_new_thread(self.check_update, ()) GObject.timeout_add(60000, self.update_timestamp) self.add_start(self.main_vbox) self.connect('realize', self.setup_ui_tasks)
def __init__(self): TweakModule.__init__(self, 'templates.ui') if not is_right_path(): label = Gtk.Label(label=_('The templates path is incorrect! The current path points to "%s".\nPlease reset it to a location within your Home Folder.') % USER_DIR) hbox = Gtk.HBox() self.add_start(hbox, False, False, 0) hbox.pack_start(label, False, False, 0) button = Gtk.Button(stock=Gtk.STOCK_GO_FORWARD) button.connect('clicked', self.on_go_button_clicked) set_label_for_stock_button(button, _('Go And Set')) hbox.pack_end(button, False, False, 0) button = Gtk.Button(stock=Gtk.STOCK_EXECUTE) button.connect('clicked', self.on_restart_button_clicked) set_label_for_stock_button(button, _('Restart This Module')) hbox.pack_end(button, False, False, 0) else: self.create_interface()
def __init__(self): TweakModule.__init__(self, 'appcenter.ui') set_label_for_stock_button(self.sync_button, _('_Sync')) self.to_add = [] self.to_rm = [] self.package_worker = PACKAGE_WORKER self.url = APP_VERSION_URL self.appview = AppView() self.appview.set_status_active(TweakSettings.get_enable_new_item()) self.appview.update_model() self.appview.sort_model() self.appview.connect('changed', self.on_app_status_changed) self.app_selection = self.appview.get_selection() self.app_selection.connect('changed', self.on_app_selection) self.right_sw.add(self.appview) self.cateview = CategoryView(os.path.join(APPCENTER_ROOT, 'cates.json')) self.cateview.set_status_from_view(self.appview) self.cateview.update_model() self.cate_selection = self.cateview.get_selection() self.cate_selection.connect('changed', self.on_category_changed) self.left_sw.add(self.cateview) self.update_timestamp() self.show_all() UPDATE_SETTING.set_value(False) UPDATE_SETTING.connect_notify(self.on_have_update, data=None) if TweakSettings.get_sync_notify(): thread.start_new_thread(self.check_update, ()) gobject.timeout_add(60000, self.update_timestamp) self.reparent(self.main_vbox)
def __init__(self): TweakModule.__init__(self, 'appcenter.ui') set_label_for_stock_button(self.sync_button, _('_Sync')) self.to_add = [] self.to_rm = [] self.url = APP_VERSION_URL self.appview = AppView() self.appview.set_status_active(True) self.appview.update_model() self.appview.sort_model() self.appview.connect('changed', self.on_app_status_changed) self.app_selection = self.appview.get_selection() self.app_selection.connect('changed', self.on_app_selection) self.right_sw.add(self.appview) self.cateview = AppCategoryView(os.path.join(APPCENTER_ROOT, 'cates.json')) self.cateview.set_status_from_view(self.appview) self.cateview.update_cate_model() self.cate_selection = self.cateview.get_selection() self.cate_selection.connect('changed', self.on_category_changed) self.left_sw.add(self.cateview) self.update_timestamp() self.show_all() UPDATE_SETTING.set_value(False) UPDATE_SETTING.connect_notify(self.on_have_update, data=None) thread.start_new_thread(self.check_update, ()) GObject.timeout_add(60000, self.update_timestamp) self.add_start(self.main_vbox) self.connect('realize', self.setup_ui_tasks)
def __init__(self): TweakModule.__init__(self, 'sourcecenter.ui') self.url = SOURCE_VERSION_URL set_label_for_stock_button(self.sync_button, _('_Sync')) self.cateview = SourceCategoryView(os.path.join(SOURCE_ROOT, 'cates.json')) self.cateview.update_cate_model() self.cateview.get_selection().connect('changed', self.on_category_changed) self.left_sw.add(self.cateview) self.sourceview = SourcesView() self.sourceview.set_status_active(True) self.sourceview.update_source_model() self.sourceview.connect('sourcechanged', self.on_source_changed) self.sourceview.connect('new_purge', self.on_purge_changed) self.sourceview.get_selection().connect('changed', self.on_source_selection) self.sourceview.set_rules_hint(True) self.right_sw.add(self.sourceview) self.cateview.set_status_from_view(self.sourceview) self.update_timestamp() UPDATE_SETTING.set_value(False) UPDATE_SETTING.connect_notify(self.on_have_update, data=None) log.debug('Start check update') thread.start_new_thread(self.check_update, ()) GObject.timeout_add(60000, self.update_timestamp) if self.check_source_upgradable() and UPGRADE_DICT: GObject.idle_add(self.upgrade_sources) self.add_start(self.main_vbox) self.connect('realize', self.setup_ui_tasks) GObject.idle_add(self.show_warning)
def __init__(self): TweakModule.__init__(self, 'sourcecenter.ui') self.url = SOURCE_VERSION_URL set_label_for_stock_button(self.sync_button, _('_Sync')) self.sourceview = SourcesView() self.sourceview.set_status_active(TweakSettings.get_enable_new_item()) self.sourceview.update_model() self.sourceview.connect('sourcechanged', self.on_source_changed) self.sourceview.selection.connect('changed', self.on_selection_changed) self.sourceview.set_sensitive(False) self.sourceview.set_rules_hint(True) self.source_selection = self.sourceview.get_selection() self.source_selection.connect('changed', self.on_source_selection) self.right_sw.add(self.sourceview) self.cateview = CategoryView(os.path.join(SOURCE_ROOT, 'cates.json')) self.cateview.set_status_from_view(self.sourceview) self.cateview.update_model() self.cate_selection = self.cateview.get_selection() self.cate_selection.connect('changed', self.on_category_changed) self.left_sw.add(self.cateview) self.expander = gtk.Expander(_('Details')) self.vbox1.pack_start(self.expander, False, False, 0) self.sourcedetail = SourceDetail() self.expander.set_sensitive(False) self.expander.add(self.sourcedetail) un_lock = PolkitButton() un_lock.connect('changed', self.on_polkit_action) self.hbox2.pack_end(un_lock, False, False, 0) self.hbox2.reorder_child(un_lock, 0) #TODO when server is ready, work on it again # try: # if os.getenv('LANG').startswith('zh_CN'): # if TweakSettings.get_use_mirror_ppa(): # gobject.idle_add(self.start_check_cn_ppa) # else: # self.sourceview.unconver_ubuntu_cn_mirror() # except AttributeError: # pass # CONFIG.get_client().notify_add('/apps/ubuntu-tweak/use_mirror_ppa', # self.value_changed) self.update_timestamp() UPDATE_SETTING.set_value(False) UPDATE_SETTING.connect_notify(self.on_have_update, data=None) if TweakSettings.get_sync_notify(): log.debug('Start check update') thread.start_new_thread(self.check_update, ()) gobject.timeout_add(60000, self.update_timestamp) if self.check_source_upgradable() and UPGRADE_DICT: gobject.idle_add(self.upgrade_sources) self.reparent(self.main_vbox)
def __init__(self): gtk.Window.__init__(self) self.notify_func = None self.connect("destroy", self.destroy) self.set_title(APP) self.set_default_size(740, 480) self.set_position(gtk.WIN_POS_CENTER) self.set_border_width(10) vbox = gtk.VBox(False, 6) self.add(vbox) self.hpaned = gtk.HPaned() vbox.pack_start(self.hpaned, True, True, 0) swindow = gtk.ScrolledWindow() swindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) swindow.set_size_request(150, -1) self.hpaned.pack1(swindow) self.model = self.__create_model() self.update_model() self.treeview = gtk.TreeView(self.model) self.treeview.set_enable_tree_lines(True) self.__add_columns(self.treeview) selection = self.treeview.get_selection() selection.connect("changed", self.selection_cb) self.treeview.expand_all() swindow.add(self.treeview) self.notebook = self.create_notebook() self.moduletable = {'0': 0} self.modules = {} self.hpaned.pack2(self.notebook) hbox = gtk.HBox(False, 12) vbox.pack_start(hbox, False, False, 0) l_hbutton_box = gtk.HButtonBox() l_hbutton_box.set_spacing(12) hbox.pack_start(l_hbutton_box, False, False, 0) button = gtk.Button(stock=gtk.STOCK_ABOUT) button.connect("clicked", self.show_about) l_hbutton_box.pack_start(button, False, False, 0) d_button = gtk.Button(stock=gtk.STOCK_YES) set_label_for_stock_button(d_button, _('_Donate')) d_button.connect("clicked", self.on_d_clicked) l_hbutton_box.pack_start(d_button, False, False, 0) r_hbutton_box = gtk.HButtonBox() r_hbutton_box.set_spacing(12) hbox.pack_end(r_hbutton_box, False, False, 0) button = gtk.Button(stock=gtk.STOCK_PREFERENCES) button.connect('clicked', self.on_preferences_clicked) r_hbutton_box.pack_end(button, False, False, 0) button = gtk.Button(stock=gtk.STOCK_QUIT) button.connect("clicked", self.destroy) r_hbutton_box.pack_end(button, False, False, 0) self.get_gui_state() self.set_icon(icon.get_from_name('ubuntu-tweak', size=48)) self.show_all() if TweakSettings.get_check_update(): log.debug("get_check_update will start after 5 seconds") gobject.timeout_add(5000, self.on_timeout) launch = TweakSettings.get_default_launch() try: if launch and not launch.isdigit(): self.__create_newpage(launch) except: pass # Only check if the distribution is supported if system.is_supported(): gobject.idle_add(self.notify_stable_source) try: log.debug("Check the sources list to make it valid") valid, disabled_list = proxy.check_sources_is_valid( TweakSettings.get_separated_sources()) if not valid: gobject.idle_add(self.notify_invalid_sources, disabled_list) except Exception, e: log.error(e)
def __init__(self): gtk.Window.__init__(self) self.notify_func = None self.connect("destroy", self.destroy) self.set_title(APP) self.set_default_size(740, 480) self.set_position(gtk.WIN_POS_CENTER) self.set_border_width(10) vbox = gtk.VBox(False, 6) self.add(vbox) self.hpaned = gtk.HPaned() vbox.pack_start(self.hpaned, True, True, 0) swindow = gtk.ScrolledWindow() swindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) swindow.set_size_request(150, -1) self.hpaned.pack1(swindow) self.model = self.__create_model() self.update_model() self.treeview = gtk.TreeView(self.model) self.treeview.set_enable_tree_lines(True) self.__add_columns(self.treeview) selection = self.treeview.get_selection() selection.connect("changed", self.selection_cb) self.treeview.expand_all() swindow.add(self.treeview) self.notebook = self.create_notebook() self.moduletable = {'0': 0} self.modules = {} self.hpaned.pack2(self.notebook) hbox = gtk.HBox(False, 12) vbox.pack_start(hbox, False, False, 0) button = gtk.Button(stock=gtk.STOCK_ABOUT) button.connect("clicked", self.show_about) hbox.pack_start(button, False, False, 0) d_button = gtk.Button(stock=gtk.STOCK_YES) set_label_for_stock_button(d_button, _('_Donate')) d_button.connect("clicked", self.on_d_clicked) hbox.pack_start(d_button, False, False, 0) button = gtk.Button(stock=gtk.STOCK_QUIT) button.connect("clicked", self.destroy) hbox.pack_end(button, False, False, 0) button = gtk.Button(stock=gtk.STOCK_PREFERENCES) button.connect('clicked', self.on_preferences_clicked) hbox.pack_end(button, False, False, 0) self.get_gui_state() self.set_icon(icon.get_from_name('ubuntu-tweak', size=48)) self.show_all() if TweakSettings.get_check_update(): log.debug("get_check_update will start after 5 seconds") gobject.timeout_add(5000, self.on_timeout) launch = TweakSettings.get_default_launch() try: if launch and not launch.isdigit(): self.__create_newpage(launch) except: pass # Only check if the distribution is supported if module_check.get_codename(): gobject.idle_add(self.notify_stable_source)
def __init__(self): TweakModule.__init__(self, 'sourcecenter.ui') self.url = SOURCE_VERSION_URL set_label_for_stock_button(self.sync_button, _('_Sync')) self.sourceview = SourcesView() self.sourceview.set_status_active(TweakSettings.get_enable_new_item()) self.sourceview.update_model() self.sourceview.connect('sourcechanged', self.on_source_changed) self.sourceview.selection.connect('changed', self.on_selection_changed) self.sourceview.set_sensitive(False) self.sourceview.set_rules_hint(True) self.source_selection = self.sourceview.get_selection() self.source_selection.connect('changed', self.on_source_selection) self.right_sw.add(self.sourceview) self.cateview = CategoryView(os.path.join(SOURCE_ROOT, 'cates.json')) self.cateview.set_status_from_view(self.sourceview) self.cateview.update_model() self.cate_selection = self.cateview.get_selection() self.cate_selection.connect('changed', self.on_category_changed) self.left_sw.add(self.cateview) self.expander = gtk.Expander(_('Details')) self.vbox1.pack_start(self.expander, False, False, 0) self.sourcedetail = SourceDetail() self.expander.set_sensitive(False) self.expander.add(self.sourcedetail) un_lock = PolkitButton() un_lock.connect('changed', self.on_polkit_action) self.hbuttonbox1.pack_end(un_lock, False, False, 0) #TODO when server is ready, work on it again # try: # if os.getenv('LANG').startswith('zh_CN'): # if TweakSettings.get_use_mirror_ppa(): # gobject.idle_add(self.start_check_cn_ppa) # else: # self.sourceview.unconver_ubuntu_cn_mirror() # except AttributeError: # pass # CONFIG.get_client().notify_add('/apps/ubuntu-tweak/use_mirror_ppa', # self.value_changed) self.update_timestamp() UPDATE_SETTING.set_value(False) UPDATE_SETTING.connect_notify(self.on_have_update, data=None) if TweakSettings.get_sync_notify(): log.debug('Start check update') thread.start_new_thread(self.check_update, ()) gobject.timeout_add(60000, self.update_timestamp) if self.check_source_upgradable() and UPGRADE_DICT: gobject.idle_add(self.upgrade_sources) self.reparent(self.main_vbox)
def __init__(self): TweakModule.__init__(self) self.to_add = [] self.to_rm = [] self.button_list = [] self.current_button = 0 hbox = gtk.HBox(False, 12) self.add_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, 6) hbox.pack_start(vbox, False, False, 0) # 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 Packages'), gtk.image_new_from_pixbuf(icon.get_from_name('deb')), 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 Kernels'), gtk.image_new_from_pixbuf(icon.get_from_name('start-here')), self.treeview.update_kernel_model) vbox.pack_start(self.kernel_button, False, False, 0) self.ppa_button = self.create_button( _('Purge PPAs'), gtk.image_new_from_pixbuf(icon.get_from_name('start-here')), self.treeview.update_ppa_model) vbox.pack_start(self.ppa_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.add_start(self.select_button, False, False, 0) # button hbuttonbox = gtk.HButtonBox() hbuttonbox.set_spacing(12) hbuttonbox.set_layout(gtk.BUTTONBOX_END) self.add_end(hbuttonbox, False, False, 0) self.clean_button = gtk.Button(stock=gtk.STOCK_CLEAR) set_label_for_stock_button(self.clean_button, _('_Cleanup')) self.clean_button.connect('clicked', self.on_clean_button_clicked) self.clean_button.set_sensitive(False) hbuttonbox.pack_end(self.clean_button, False, False, 0) un_lock = PolkitButton() un_lock.connect('changed', self.on_polkit_action) hbuttonbox.pack_end(un_lock, False, False, 0) self.show_all()
def __init__(self): TweakModule.__init__(self) self.to_add = [] self.to_rm = [] self.button_list = [] self.current_button = 0 hbox = gtk.HBox(False, 0) self.add_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 Packages'), gtk.image_new_from_pixbuf(icon.get_from_name('deb')), 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 Kernels'), gtk.image_new_from_pixbuf(icon.get_from_name('start-here')), self.treeview.update_kernel_model) vbox.pack_start(self.kernel_button, False, False, 0) self.ppa_button = self.create_button(_('Purge PPAs'), gtk.image_new_from_pixbuf(icon.get_from_name('start-here')), self.treeview.update_ppa_model) vbox.pack_start(self.ppa_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.add_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) set_label_for_stock_button(self.clean_button, _('_Cleanup')) 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()