def __init__(self, arch_menu_widget, archs): GObject.GObject.__init__(self) self.all_archs = archs self.arch_menu_widget = arch_menu_widget if not CONFIG.conf.archs: CONFIG.conf.archs = list(archs) CONFIG.write() self.current_archs = set(CONFIG.conf.archs) self.arch_menu = self._setup_archmenu()
def _on_arch(self, widget): state = widget.get_active() label = widget.get_label() if state: self.current_archs.add(label) else: self.current_archs.remove(label) CONFIG.conf.archs = list(self.current_archs) CONFIG.write() self.emit("changed", 'arch', list(self.current_archs))
def _set_cache_refreshed(self, cache_type): time_fmt = '%Y-%m-%d %H:%M' now = datetime.datetime.now() now_str = now.strftime(time_fmt) if cache_type == 'session': CONFIG.conf.session_refresh = now_str CONFIG.write() elif cache_type == 'system': CONFIG.conf.system_refresh = now_str CONFIG.write()
def on_archmenu_clicked(self, widget): state = widget.get_active() label = widget.get_label() if state: self.current_archs.add(label) else: self.current_archs.remove(label) archs = ",".join(list(self.current_archs)) CONFIG.conf.archs = list(self.current_archs) CONFIG.write() self.emit("arch-changed", archs)
def on_shutdown(self, app): if self.window and not self.install_mode: CONFIG.conf.info_paned = self.window.main_paned.get_position() if self.window.cur_maximized: CONFIG.conf.win_maximized = True else: CONFIG.conf.win_width = self.window.cur_width CONFIG.conf.win_height = self.window.cur_height CONFIG.conf.win_maximized = False self.window.release_root_backend(quit_dnfdaemon=True) logger.info('Saving config on exit') CONFIG.write() return 0
def on_shutdown(self, app): if self.window and not self.install_mode: CONFIG.conf.info_paned = self.window.main_paned.get_position() if self.window.cur_maximized: CONFIG.conf.win_maximized = True else: CONFIG.conf.win_width = self.window.cur_width CONFIG.conf.win_height = self.window.cur_height CONFIG.conf.win_maximized = False self.window.release_root_backend(quit=True) logger.info('Saving config on exit') CONFIG.write() return 0
def _setup_archs(self): if not CONFIG.conf.archs: CONFIG.conf.archs = list(self.all_archs) CONFIG.write() self.current_archs = set(CONFIG.conf.archs) for arch in self.all_archs: cb = Gtk.CheckButton(label=arch) self._arch_box.pack_start(cb, True, True, 0) if arch in CONFIG.conf.archs: cb.set_active(True) else: cb.set_active(False) cb.show() cb.connect('toggled', self._on_arch)
def set_settings(self): changed = False need_reset = False # handle options for option in self._settings: widget = self.base.ui.get_object('pref_' + option) state = widget.get_active() if state != getattr(CONFIG.conf, option): # changed ?? setattr(CONFIG.conf, option, state) changed = True self.handle_setting(option, state) # handle colors for name in [ 'color_install', 'color_update', 'color_normal', 'color_obsolete', 'color_downgrade' ]: widget = self.base.ui.get_object(name) rgba = widget.get_rgba() color = yumex.misc.color_to_hex(rgba) if color != getattr(CONFIG.conf, name): # changed ?? setattr(CONFIG.conf, name, color) changed = True # handle update checker values for name in [ 'update_startup_delay', 'update_interval', 'refresh_interval', 'installonly_limit' ]: widget = self.base.ui.get_object('pref_' + name) value = widget.get_value_as_int() if value != getattr(CONFIG.conf, name): # changed ?? setattr(CONFIG.conf, name, value) changed = True # handle repos repo_before = CONFIG.session.enabled_repos repo_now = self.repo_view.get_selected() # repo selection changed if repo_now != repo_before: CONFIG.session.enabled_repos = repo_now # set the new selection # we need to reset the gui need_reset = True if CONFIG.conf.repo_saved: CONFIG.conf.repo_enabled = repo_now changed = True if changed: CONFIG.write() return need_reset
def set_settings(self): changed = False need_reset = False # handle boolean options for option in Preferences.FLAGS: widget = self.base.ui.get_object("pref_" + option) state = widget.get_active() if state != getattr(CONFIG.conf, option): # changed ?? setattr(CONFIG.conf, option, state) changed = True self.handle_setting(option, state) # handle color options for name in Preferences.COLORS: widget = self.base.ui.get_object(name) rgba = widget.get_rgba() color = yumex.misc.color_to_hex(rgba) if color != getattr(CONFIG.conf, name): # changed ?? setattr(CONFIG.conf, name, color) changed = True # handle value options for name in Preferences.VALUES: widget = self.base.ui.get_object("pref_" + name) value = widget.get_value_as_int() if value != getattr(CONFIG.conf, name): # changed ?? setattr(CONFIG.conf, name, value) changed = True # handle repos repo_before = CONFIG.session.enabled_repos repo_now = self.repo_view.get_selected() # repo selection changed if repo_now != repo_before: CONFIG.session.enabled_repos = repo_now # set the new selection # we need to reset the gui need_reset = True if CONFIG.conf.repo_saved: CONFIG.conf.repo_enabled = repo_now changed = True if changed: CONFIG.write() return need_reset
def set_settings(self): changed = False need_reset = False # handle boolean options for option in Preferences.FLAGS: widget = self.base.ui.get_object('pref_' + option) state = widget.get_active() if state != getattr(CONFIG.conf, option): # changed ?? setattr(CONFIG.conf, option, state) changed = True self.handle_setting(option, state) # handle color options for name in Preferences.COLORS: widget = self.base.ui.get_object(name) rgba = widget.get_rgba() color = yumex.misc.color_to_hex(rgba) if color != getattr(CONFIG.conf, name): # changed ?? setattr(CONFIG.conf, name, color) changed = True # handle value options for name in Preferences.VALUES: widget = self.base.ui.get_object('pref_' + name) value = widget.get_value_as_int() if value != getattr(CONFIG.conf, name): # changed ?? setattr(CONFIG.conf, name, value) changed = True # handle repos repo_before = CONFIG.session.enabled_repos repo_now = self.repo_view.get_selected() # repo selection changed if repo_now != repo_before: CONFIG.session.enabled_repos = repo_now # set the new selection # we need to reset the gui need_reset = True if CONFIG.conf.repo_saved: CONFIG.conf.repo_enabled = repo_now changed = True if changed: CONFIG.write() return need_reset
def set_settings(self): changed = False need_reset = False # handle options for option in self._settings: widget = self.base.ui.get_object("pref_" + option) state = widget.get_active() if state != getattr(CONFIG.conf, option): # changed ?? setattr(CONFIG.conf, option, state) changed = True self.handle_setting(option, state) # handle colors for name in ["color_install", "color_update", "color_normal", "color_obsolete", "color_downgrade"]: widget = self.base.ui.get_object(name) rgba = widget.get_rgba() color = yumex.misc.color_to_hex(rgba) if color != getattr(CONFIG.conf, name): # changed ?? setattr(CONFIG.conf, name, color) changed = True # handle update checker values for name in ["update_startup_delay", "update_interval", "refresh_interval", "installonly_limit"]: widget = self.base.ui.get_object("pref_" + name) value = widget.get_value_as_int() if value != getattr(CONFIG.conf, name): # changed ?? setattr(CONFIG.conf, name, value) changed = True # handle repos repo_before = CONFIG.session.enabled_repos repo_now = self.repo_view.get_selected() # repo selection changed if repo_now != repo_before: CONFIG.session.enabled_repos = repo_now # set the new selection # we need to reset the gui need_reset = True if CONFIG.conf.repo_saved: CONFIG.conf.repo_enabled = repo_now changed = True if changed: CONFIG.write() return need_reset