def __init__(self, uac=True, shred_paths=None): if uac and 'nt' == os.name and Windows.elevate_privileges(): # privileges escalated in other process sys.exit(0) import RecognizeCleanerML RecognizeCleanerML.RecognizeCleanerML() register_cleaners() self.create_window() gobject.threads_init() if shred_paths: self.shred_paths(shred_paths) return if options.get("first_start") and 'posix' == os.name: pref = PreferencesDialog(self.window, self.cb_refresh_operations) pref.run() options.set('first_start', False) if online_update_notification_enabled and options.get("check_online_updates"): self.check_online_updates() if 'nt' == os.name: # BitDefender false positive. BitDefender didn't mark BleachBit as infected or show # anything in its log, but sqlite would fail to import unless BitDefender was in "game mode." # http://bleachbit.sourceforge.net/forum/074-fails-errors try: import sqlite3 except ImportError, e: print e print dir(e) self.append_text( _("Error loading the SQLite module: the antivirus software may be blocking it."), 'error')
def cleaners_list(): """Yield each cleaner-option pair""" register_cleaners() for key in sorted(backends): c_id = backends[key].get_id() for (o_id, o_name) in backends[key].get_options(): yield "%s.%s" % (c_id, o_id)
def args_to_operations(args, preset): """Read arguments and return list of operations""" register_cleaners() operations = {} if preset: # restore presets from the GUI for key in sorted(backends): c_id = backends[key].get_id() for (o_id, o_name) in backends[key].get_options(): if Options.options.get_tree(c_id, o_id): args.append('.'.join([c_id, o_id])) for arg in args: if 2 != len(arg.split('.')): print _("not a valid cleaner: %s") % arg continue (cleaner_id, option_id) = arg.split('.') # enable all options (for example, firefox.*) if '*' == option_id: if operations.has_key(cleaner_id): del operations[cleaner_id] operations[cleaner_id] = [] for (option_id2, o_name) in backends[cleaner_id].get_options(): operations[cleaner_id].append(option_id2) continue # add the specified option if not operations.has_key(cleaner_id): operations[cleaner_id] = [] if not option_id in operations[cleaner_id]: operations[cleaner_id].append(option_id) for (k, v) in operations.iteritems(): operations[k] = sorted(v) return operations
def cb_refresh_operations(self): """Callback to refresh the list of cleaners""" # reload cleaners from disk register_cleaners() # update tree view self.tree_store.refresh_rows() # expand tree view self.view.expand_all() # remove from idle loop (see gobject.idle_add) return False
def cleaners_list(): """Yield each cleaner-option pair""" register_cleaners() for key in sorted(backends): # c_id = backends[key].get_id() # c_name = backends[key].get_name() if backends[key].auto_hide(): # hide irrelevant cleaner (e.g., the application is not # detected) continue for (c_id, o_id, c_name, label, description) in backends[key].get_option_all(): yield "%s.%s....%s:%s----%s" % (c_id, o_id, c_name, label, description)