Ejemplo n.º 1
0
    def __init__(self, uac=True, shred_paths=None, auto_exit=False):

        if os.name == 'nt':
            if Windows.elevate_privileges(uac):
                # privileges escalated in other process
                sys.exit(0)
            if portable_mode:
                Windows.copy_fonts_in_portable_app(auto_exit)

        Gtk.Application.__init__(
            self, application_id='org.gnome.Bleachbit', flags=Gio.ApplicationFlags.FLAGS_NONE)
        GObject.threads_init()
        
        if auto_exit:
            # This is used for automated testing of whether the GUI can start.
            # It is called from assert_execute_console() in windows/setup_py2exe.py
            self._auto_exit = True        

        if shred_paths:
            self._shred_paths = shred_paths

        if os.name == 'nt':
            # clean up nonce files https://github.com/bleachbit/bleachbit/issues/858
            import atexit
            atexit.register(Windows.cleanup_nonce)

            # 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."
            # https://www.bleachbit.org/forum/074-fails-errors
            try:
                import sqlite3
            except ImportError:
                logger.exception(
                    _("Error loading the SQLite module: the antivirus software may be blocking it."))
Ejemplo n.º 2
0
    def _init_windows_misc(self, auto_exit, shred_paths, uac):
        application_id_suffix = ''
        if os.name == 'nt':
            if Windows.elevate_privileges(uac):
                # privileges escalated in other process
                sys.exit(0)
            if portable_mode:
                Windows.copy_fonts_in_portable_app(auto_exit)

            if auto_exit and shred_paths:
                # When we have a running application and executing the Windows
                # context menu command we start a new process with new application_id.
                # That is because the command line arguments of the context menu command
                # are not passed to the already running instance.
                application_id_suffix = 'ContextMenuShred'
        return application_id_suffix