Exemplo n.º 1
0
 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')
Exemplo n.º 2
0
    def __general_page(self):
        """Return a widget containing the general page"""

        if 'nt' == os.name:
            swcc = Windows.start_with_computer_check
        if 'posix' == os.name:
            swcc = Unix.start_with_computer_check

        options.set('auto_start', swcc())

        vbox = gtk.VBox()

        if online_update_notification_enabled:
            cb_updates = gtk.CheckButton(
                _("Check periodically for software updates via the Internet"))
            cb_updates.set_active(options.get('check_online_updates'))
            cb_updates.connect(
                'toggled', self.__toggle_callback, 'check_online_updates')
            cb_updates.set_tooltip_text(
                _("If an update is found, you will be given the option to view information about it.  Then, you may manually download and install the update."))
            vbox.pack_start(cb_updates, False)

            updates_box = gtk.VBox()
            updates_box.set_border_width(10)

            self.cb_beta = gtk.CheckButton(_("Check for new beta releases"))
            self.cb_beta.set_active(options.get('check_beta'))
            self.cb_beta.set_sensitive(options.get('check_online_updates'))
            self.cb_beta.connect(
                'toggled', self.__toggle_callback, 'check_beta')
            updates_box.pack_start(self.cb_beta, False)

            if 'nt' == os.name:
                self.cb_winapp2 = gtk.CheckButton(
                    _("Download and update cleaners from community (winapp2.ini)"))
                self.cb_winapp2.set_active(options.get('update_winapp2'))
                self.cb_winapp2.set_sensitive(
                    options.get('check_online_updates'))
                self.cb_winapp2.connect(
                    'toggled', self.__toggle_callback, 'update_winapp2')
                updates_box.pack_start(self.cb_winapp2, False)

            vbox.pack_start(updates_box, False)

        # TRANSLATORS: Overwriting is the same as shredding.  It is a way
        # to prevent recovery of the data. You could also translate
        # 'Shred files to prevent recovery.'
        cb_shred = gtk.CheckButton(_("Overwrite files to hide contents"))
        cb_shred.set_active(options.get('shred'))
        cb_shred.connect('toggled', self.__toggle_callback, 'shred')
        cb_shred.set_tooltip_text(
            _("Overwriting is ineffective on some file systems and with certain BleachBit operations.  Overwriting is significantly slower."))
        vbox.pack_start(cb_shred, False)

        cb_start = gtk.CheckButton(_("Start BleachBit with computer"))
        cb_start.set_active(options.get('auto_start'))
        cb_start.connect('toggled', self.__toggle_callback, 'auto_start')
        vbox.pack_start(cb_start, False)
        return vbox
Exemplo n.º 3
0
 def __init__(self, parent_window=None):
     self.parent_window = parent_window
     try:
         self.salt = options.get('hashsalt')
     except ConfigParser.NoOptionError:
         self.salt = hashdigest(str(random.random()))
         options.set('hashsalt', self.salt)
     self.__scan()
Exemplo n.º 4
0
 def __init__(self, parent_window=None):
     self.parent_window = parent_window
     try:
         self.salt = options.get('hashsalt')
     except ConfigParser.NoOptionError:
         self.salt = hashdigest(str(random.random()))
         options.set('hashsalt', self.salt)
     self.__scan()
Exemplo n.º 5
0
 def restoreConfigDefaults(self, parm_map):
     d = OptionsClass()
     d.load_defaults(defaults)
     for section, option in parm_map:
         if option is not None:
             if not options.no_restore(section, option):
                 options.set(section, option, d.get(section,option))
     options.update_file(optionsPathname)
Exemplo n.º 6
0
    def restoreConfigDefaults(self, parm_map):
        # note that the behaviour of this function has subtly changed:
        # previously options were removed from the config file, now the
        # config file is updated to match the defaults
        d = OptionsClass()
        d.load_defaults(defaults)

        # Only restore the settings that appear on the form.
        for section, option in parm_map:
            if option is not None:
                if not options.no_restore(section, option):
                    options.set(section, option, d.get(section,option))

        options.update_file(optionsPathname)
Exemplo n.º 7
0
    def onChangeopts(self, **parms):
        pmap = self.parm_ini_map
        if parms.has_key("how"):
            if parms["how"] == "Save advanced options":
                pmap = self.advanced_options_map
            del parms["how"]
        html = self._getHTMLClone()
        html.shutdownTableCell = " "
        html.mainContent = self.html.headedBox.clone()
        errmsg = self.verifyInput(parms, pmap)

        if errmsg != '':
            html.mainContent.heading = "Errors Detected"
            html.mainContent.boxContent = errmsg
            html.title = 'Home > Error'
            html.pagename = '> Error'
            self.writeOKHeaders('text/html')
            self.write(html)
            return

        for name, value in parms.items():
            sect, opt = name.split('_', 1)
            if (sect, opt) in pmap:
                options.set(sect, opt, value)
            # If a section name has an underscore in it (like html_ui)
            # the split won't work the first time
            else:
                sect2, opt = opt.split('_', 1)
                sect += '_' + sect2
                options.set(sect, opt, value)

        options.update_file(optionsPathname)
        self.reReadOptions()

        html.mainContent.heading = "Options Changed"
        html.mainContent.boxContent = "%s.  Return <a href='home'>Home</a>." \
                                      % "Options changed"
        html.title = 'Home &gt; Options Changed'
        html.pagename = '&gt; Options Changed'
        self.writeOKHeaders('text/html')
        self.write(html)
Exemplo n.º 8
0
    def __general_page(self):
        """Return a widget containing the general page"""

        if 'nt' == os.name:
            swcc = Windows.start_with_computer_check
        if 'posix' == os.name:
            swcc = Unix.start_with_computer_check

        options.set('auto_start', swcc())

        vbox = gtk.VBox()

        if online_update_notification_enabled:
            cb_updates = gtk.CheckButton(
                _("Check periodically for software updates via the Internet"))
            cb_updates.set_active(options.get('check_online_updates'))
            cb_updates.connect(
                'toggled', self.__toggle_callback, 'check_online_updates')
            cb_updates.set_tooltip_text(
                _("If an update is found, you will be given the option to view information about it.  Then, you may manually download and install the update."))
            vbox.pack_start(cb_updates, False)

            updates_box = gtk.VBox()
            updates_box.set_border_width(10)

            self.cb_beta = gtk.CheckButton(_("Check for new beta releases"))
            self.cb_beta.set_active(options.get('check_beta'))
            self.cb_beta.set_sensitive(options.get('check_online_updates'))
            self.cb_beta.connect(
                'toggled', self.__toggle_callback, 'check_beta')
            updates_box.pack_start(self.cb_beta, False)

            if 'nt' == os.name:
                self.cb_winapp2 = gtk.CheckButton(
                    _("Download and update cleaners from community (winapp2.ini)"))
                self.cb_winapp2.set_active(options.get('update_winapp2'))
                self.cb_winapp2.set_sensitive(
                    options.get('check_online_updates'))
                self.cb_winapp2.connect(
                    'toggled', self.__toggle_callback, 'update_winapp2')
                updates_box.pack_start(self.cb_winapp2, False)

            vbox.pack_start(updates_box, False)

        # TRANSLATORS: This means to hide cleaners which would do
        # nothing.  For example, if Firefox were never used on
        # this system, this option would hide Firefox to simplify
        # the list of cleaners.
        cb_auto_hide = gtk.CheckButton(_("Hide irrelevant cleaners"))
        cb_auto_hide.set_active(options.get('auto_hide'))
        cb_auto_hide.connect('toggled', self.__toggle_callback, 'auto_hide')
        vbox.pack_start(cb_auto_hide, False)

        # TRANSLATORS: Overwriting is the same as shredding.  It is a way
        # to prevent recovery of the data. You could also translate
        # 'Shred files to prevent recovery.'
        cb_shred = gtk.CheckButton(_("Overwrite files to hide contents"))
        cb_shred.set_active(options.get('shred'))
        cb_shred.connect('toggled', self.__toggle_callback, 'shred')
        cb_shred.set_tooltip_text(
            _("Overwriting is ineffective on some file systems and with certain BleachBit operations.  Overwriting is significantly slower."))
        vbox.pack_start(cb_shred, False)

        cb_start = gtk.CheckButton(_("Start BleachBit with computer"))
        cb_start.set_active(options.get('auto_start'))
        cb_start.connect('toggled', self.__toggle_callback, 'auto_start')
        vbox.pack_start(cb_start, False)

        # Close the application after cleaning is complete.
        cb_exit = gtk.CheckButton(_("Exit after cleaning"))
        cb_exit.set_active(options.get('exit_done'))
        cb_exit.connect('toggled', self.__toggle_callback, 'exit_done')
        vbox.pack_start(cb_exit, False)

        # Disable delete confirmation message.
        cb_popup = gtk.CheckButton(_("Confirm before delete"))
        cb_popup.set_active(options.get('delete_confirmation'))
        cb_popup.connect(
            'toggled', self.__toggle_callback, 'delete_confirmation')
        vbox.pack_start(cb_popup, False)

        return vbox
Exemplo n.º 9
0
    def __general_page(self):
        """Return a widget containing the general page"""

        if 'nt' == os.name:
            swcc = Windows.start_with_computer_check
        if 'posix' == os.name:
            swcc = Unix.start_with_computer_check

        options.set('auto_start', swcc())

        vbox = gtk.VBox()

        if online_update_notification_enabled:
            cb_updates = gtk.CheckButton(
                _("Check periodically for software updates via the Internet"))
            cb_updates.set_active(options.get('check_online_updates'))
            cb_updates.connect('toggled', self.__toggle_callback,
                               'check_online_updates')
            cb_updates.set_tooltip_text(
                _("If an update is found, you will be given the option to view information about it.  Then, you may manually download and install the update."
                  ))
            vbox.pack_start(cb_updates, False)

            updates_box = gtk.VBox()
            updates_box.set_border_width(10)

            self.cb_beta = gtk.CheckButton(_("Check for new beta releases"))
            self.cb_beta.set_active(options.get('check_beta'))
            self.cb_beta.set_sensitive(options.get('check_online_updates'))
            self.cb_beta.connect('toggled', self.__toggle_callback,
                                 'check_beta')
            updates_box.pack_start(self.cb_beta, False)

            if 'nt' == os.name:
                self.cb_winapp2 = gtk.CheckButton(
                    _("Download and update cleaners from community (winapp2.ini)"
                      ))
                self.cb_winapp2.set_active(options.get('update_winapp2'))
                self.cb_winapp2.set_sensitive(
                    options.get('check_online_updates'))
                self.cb_winapp2.connect('toggled', self.__toggle_callback,
                                        'update_winapp2')
                updates_box.pack_start(self.cb_winapp2, False)

            vbox.pack_start(updates_box, False)

        # TRANSLATORS: This means to hide cleaners which would do
        # nothing.  For example, if Firefox were never used on
        # this system, this option would hide Firefox to simplify
        # the list of cleaners.
        cb_auto_hide = gtk.CheckButton(_("Hide irrelevant cleaners"))
        cb_auto_hide.set_active(options.get('auto_hide'))
        cb_auto_hide.connect('toggled', self.__toggle_callback, 'auto_hide')
        vbox.pack_start(cb_auto_hide, False)

        # TRANSLATORS: Overwriting is the same as shredding.  It is a way
        # to prevent recovery of the data. You could also translate
        # 'Shred files to prevent recovery.'
        cb_shred = gtk.CheckButton(_("Overwrite files to hide contents"))
        cb_shred.set_active(options.get('shred'))
        cb_shred.connect('toggled', self.__toggle_callback, 'shred')
        cb_shred.set_tooltip_text(
            _("Overwriting is ineffective on some file systems and with certain BleachBit operations.  Overwriting is significantly slower."
              ))
        vbox.pack_start(cb_shred, False)

        cb_start = gtk.CheckButton(_("Start BleachBit with computer"))
        cb_start.set_active(options.get('auto_start'))
        cb_start.connect('toggled', self.__toggle_callback, 'auto_start')
        vbox.pack_start(cb_start, False)

        # Close the application after cleaning is complete.
        cb_exit = gtk.CheckButton(_("Exit after cleaning"))
        cb_exit.set_active(options.get('exit_done'))
        cb_exit.connect('toggled', self.__toggle_callback, 'exit_done')
        vbox.pack_start(cb_exit, False)

        # Disable delete confirmation message.
        cb_popup = gtk.CheckButton(_("Confirm before delete"))
        cb_popup.set_active(options.get('delete_confirmation'))
        cb_popup.connect('toggled', self.__toggle_callback,
                         'delete_confirmation')
        vbox.pack_start(cb_popup, False)

        # Use base 1000 over 1024?
        cb_units_iec = gtk.CheckButton(
            _("Use IEC sizes (1 KiB = 1024 bytes) instead of SI (1 kB = 1000 bytes)"
              ))
        cb_units_iec.set_active(options.get("units_iec"))
        cb_units_iec.connect('toggled', self.__toggle_callback, 'units_iec')
        vbox.pack_start(cb_units_iec, False)
        return vbox
Exemplo n.º 10
0
 def onChangeopts(self, **parms):
     pmap = self.parm_ini_map
     if parms.has_key("how"):
         if parms["how"] == _("Save advanced options"):
             pmap = self.advanced_options_map
         elif parms["how"] == _("Save experimental options"):
             pmap = experimental_ini_map
         del parms["how"]
     html = self._getHTMLClone()
     html.shutdownTableCell = "&nbsp;"
     html.mainContent = self.html.headedBox.clone()
     errmsg = self.verifyInput(parms, pmap)
     if errmsg != '':
         html.mainContent.heading = _("Errors Detected")
         html.mainContent.boxContent = errmsg
         html.title = _('Home &gt; Error')
         html.pagename = _('&gt; Error')
         self.writeOKHeaders('text/html')
         self.write(html)
         return
     old_database_type = options["Storage", "persistent_use_database"]
     old_name = options["Storage", "persistent_storage_file"]
     for name, value in parms.items():
         sect, opt = name.split('_', 1)
         if (sect, opt) in pmap:
             options.set(sect, opt, value)
         else:
             sect2, opt = opt.split('_', 1)
             sect += '_' + sect2
             options.set(sect, opt, value)
     options.update_file(optionsPathname)
     if options["Storage", "persistent_use_database"] != \
        old_database_type and os.path.exists(old_name):
         new_name = options["Storage", "persistent_storage_file"]
         new_type = options["Storage", "persistent_use_database"]
         self.close_database()
         try:
             os.remove(new_name + ".tmp")
         except OSError:
             pass
         storage.convert(old_name, old_database_type,
                         new_name + ".tmp", new_type)
         if os.path.exists(new_name):
             try:
                 os.remove(new_name + ".old")
             except OSError:
                 pass
             os.rename(new_name, new_name + ".old")
         os.rename(new_name + ".tmp", new_name)
         if os.path.exists(options["Storage",
                                   "messageinfo_storage_file"]):
             try:
                 os.remove(options["Storage",
                                   "messageinfo_storage_file"] + ".old")
             except OSError:
                 pass
             os.rename(options["Storage", "messageinfo_storage_file"],
                       options["Storage",
                               "messageinfo_storage_file"] + ".old")
     self.reReadOptions()
     html.mainContent.heading = _("Options Changed")
     html.mainContent.boxContent = _("Options changed.  Return " \
                                     "<a href='home'>Home</a>.")
     html.title = _('Home &gt; Options Changed')
     html.pagename = _('&gt; Options Changed')
     self.writeOKHeaders('text/html')
     self.write(html)