Ejemplo n.º 1
0
    def restore(self):
        """Restore saved options from disk"""
        try:
            self.config.read(Common.options_file)
        except:
            traceback.print_exc()
        if not self.config.has_section("bleachbit"):
            self.config.add_section("bleachbit")
        if not self.config.has_section("hashpath"):
            self.config.add_section("hashpath")
        if not self.config.has_section("list/shred_drives"):
            from FileUtilities import guess_overwrite_paths

            try:
                self.set_list("shred_drives", guess_overwrite_paths())
            except:
                traceback.print_exc()
                print "ERROR: error setting default shred drives"

        # set defaults
        self.__set_default("auto_hide", True)
        self.__set_default("auto_start", False)
        self.__set_default("check_beta", False)
        self.__set_default("check_online_updates", True)
        self.__set_default("shred", False)
        self.__set_default("exit_done", False)
        self.__set_default("delete_confirmation", True)
        self.__set_default("units_iec", False)

        if "nt" == os.name:
            self.__set_default("update_winapp2", False)

        if not self.config.has_section("preserve_languages"):
            lang = Common.user_locale
            pos = lang.find("_")
            if -1 != pos:
                lang = lang[0:pos]
            for _lang in set([lang, "en"]):
                print "info: automatically preserving language '%s'" % lang
                self.set_language(_lang, True)

        # BleachBit upgrade or first start ever
        if not self.config.has_option("bleachbit", "version") or self.get("version") != Common.APP_VERSION:
            self.set("first_start", True)

        # set version
        self.set("version", Common.APP_VERSION)
Ejemplo n.º 2
0
    def restore(self):
        """Restore saved options from disk"""
        try:
            self.config.read(Common.options_file)
        except:
            traceback.print_exc()
        if not self.config.has_section("bleachbit"):
            self.config.add_section("bleachbit")
        if not self.config.has_section("hashpath"):
            self.config.add_section("hashpath")
        if not self.config.has_section("list/shred_drives"):
            from FileUtilities import guess_overwrite_paths
            try:
                self.set_list('shred_drives', guess_overwrite_paths())
            except:
                traceback.print_exc()
                print 'ERROR: error setting default shred drives'

        # set defaults
        self.__set_default("auto_hide", True)
        self.__set_default("auto_start", False)
        self.__set_default("check_beta", False)
        self.__set_default("check_online_updates", True)
        self.__set_default("shred", False)
        self.__set_default("exit_done", False)
        self.__set_default("delete_confirmation", True)
        self.__set_default("units_iec", False)

        if 'nt' == os.name:
            self.__set_default("update_winapp2", False)

        if not self.config.has_section('preserve_languages'):
            lang = Common.user_locale
            pos = lang.find('_')
            if -1 != pos:
                lang = lang[0:pos]
            for _lang in set([lang, 'en']):
                print "info: automatically preserving language '%s'" % lang
                self.set_language(_lang, True)

        # BleachBit upgrade or first start ever
        if not self.config.has_option('bleachbit', 'version') or \
                self.get('version') != Common.APP_VERSION:
            self.set('first_start', True)

        # set version
        self.set("version", Common.APP_VERSION)
Ejemplo n.º 3
0
    def restore(self):
        """Restore saved options from disk"""
        try:
            self.config.read(Common.options_file)
        except:
            traceback.print_exc()
        if not self.config.has_section("bleachbit"):
            self.config.add_section("bleachbit")
        if not self.config.has_section("hashpath"):
            self.config.add_section("hashpath")
        if not self.config.has_section("list/shred_drives"):
            from FileUtilities import guess_overwrite_paths
            self.set_list('shred_drives', guess_overwrite_paths())

        # set defaults
        self.__set_default("auto_hide", True)
        self.__set_default("auto_start", False)
        self.__set_default("check_beta", False)
        self.__set_default("check_online_updates", True)
        self.__set_default("shred", False)
        self.__set_default("exit_done", False)
        self.__set_default("no_popup", False)

        if 'nt' == os.name:
            self.__set_default("update_winapp2", False)

        if not self.config.has_section('preserve_languages'):
            lang = Common.user_locale
            pos = lang.find('_')
            if -1 != pos:
                lang = lang[0: pos]
            for _lang in set([lang, 'en']):
                print "info: automatically preserving language '%s'" % lang
                self.set_language(_lang, True)

        # BleachBit upgrade or first start ever
        if not self.config.has_option('bleachbit', 'version') or \
                self.get('version') != Common.APP_VERSION:
            self.set('first_start', True)

        # set version
        self.set("version", Common.APP_VERSION)