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, '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): 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)