def __toggle_callback(self, cell, path): global win10_provider """Callback function to toggle option""" options.toggle(path) if online_update_notification_enabled: self.cb_beta.set_sensitive(options.get('check_online_updates')) if 'nt' == os.name: self.cb_winapp2.set_sensitive( options.get('check_online_updates')) if 'auto_hide' == path: self.refresh_operations = True if 'dark_mode' == path: if os.name != 'nt' or options.get("win10_mode") == False: Gtk.Settings.get_default().set_property( 'gtk-application-prefer-dark-theme', options.get('dark_mode')) if 'win10_mode' == path: if options.get("win10_mode"): screen = Gdk.Display.get_default_screen( Gdk.Display.get_default()) Gtk.StyleContext.add_provider_for_screen( screen, bleachbit.GUI.Bleachbit._style_provider, 600) else: screen = Gdk.Display.get_default_screen( Gdk.Display.get_default()) Gtk.StyleContext.remove_provider_for_screen( screen, bleachbit.GUI.Bleachbit._style_provider) if 'debug' == path: from bleachbit.Log import set_root_log_level set_root_log_level()
def __toggle_callback(self, cell, path): """Callback function to toggle option""" options.toggle(path) if online_update_notification_enabled: self.cb_beta.set_sensitive(options.get('check_online_updates')) if 'nt' == os.name: self.cb_winapp2.set_sensitive( options.get('check_online_updates')) if 'auto_hide' == path: self.refresh_operations = True if 'dark_mode' == path: Gtk.Settings.get_default().set_property( 'gtk-application-prefer-dark-theme', options.get('dark_mode')) if 'debug' == path: from bleachbit.Log import set_root_log_level set_root_log_level()
if not self.config.has_section('preserve_languages'): self.config.add_section('preserve_languages') if self.config.has_option('preserve_languages', langid) and not value: self.config.remove_option('preserve_languages', langid) else: self.config.set('preserve_languages', langid, str(value)) self.__flush() def set_tree(self, parent, child, value): """Set an option for the tree view. The child may be None.""" if not self.config.has_section("tree"): self.config.add_section("tree") option = parent if child is not None: option = option + "." + child if self.config.has_option('tree', option) and not value: self.config.remove_option('tree', option) else: self.config.set('tree', option, str(value)) self.__flush() def toggle(self, key): """Toggle a boolean key""" self.set(key, not self.get(key)) options = Options() # Now that the configuration is loaded, honor the debug preference there. set_root_log_level()