Пример #1
0
    def __init__(self, email, password):
        QDialog.__init__(self)
        Ui_WelcomeDialog.__init__(self)
        self.setupUi(self)

        self.email = email
        self.password = password
        self.logger = get_logger()

        self.setWindowIcon(QIcon(LOGO_PATH))

        self.account_label.setText(f"Account: {email}")

        self.logo_label.setPixmap(get_pixmap(LOGO_PATH, 20, 20))

        self.initialize_thread = InitializeThread(email, password)
        self.initialize_thread.initialized.connect(self.accept)
        self.start_backing_up_button.pressed.connect(self.initialize)

        self.terms_of_service_label.linkActivated.connect(
            lambda: webbrowser.open(TERMS_URL))
        self.restore_files_label.linkActivated.connect(self.restore_files)

        if not self.has_computers():
            self.restore_files_label.setVisible(False)

        self.logger.info("Welcome dialog displayed.")
Пример #2
0
    def __init__(self, email, password, computer_id):
        QDialog.__init__(self)
        Ui_RestoreDialog.__init__(self)
        self.setupUi(self)

        self.email = email
        self.password = password
        self.computer_id = computer_id
        self.logger = get_logger()

        self.setWindowIcon(QIcon(LOGO_PATH))

        self.snapshot_tree_widget = QLazyTreeWidget()
        self.snapshot_tree_layout.addWidget(self.snapshot_tree_widget)

        self.snapshots_combo_box.currentTextChanged.connect(
            self.load_current_snapshot)
        self.restore_button.pressed.connect(self.restore)

        self.set_elements_enabled(False)
        self.setWindowTitle("Loading Backups. Please Wait...")
        self.snapshots_combo_box.clear()
        self.snapshots_thread = SnapshotsThread(email, password, computer_id)
        self.snapshots_thread.loaded.connect(self.snapshots_loaded)
        self.snapshots_thread.start()

        self.reset_loading_backup_dialog()
        self.restoring_dialog = LoadingDialog(
            self,
            "Restoring. Please Wait...",
        )

        self.logger.info("Restore dialog displayed.")
Пример #3
0
    def __init__(self, main_window):
        QDialog.__init__(self)
        Ui_SettingsDialog.__init__(self)
        self.setupUi(self)

        self.logger = get_logger()
        self.main_window = main_window

        self.setWindowIcon(QIcon(LOGO_PATH))

        self.populate_settings()

        self.inclusions_add_button.pressed.connect(self.inclusions_add)
        self.inclusions_remove_button.pressed.connect(self.inclusions_remove)
        self.exclusions_add_button.pressed.connect(self.exclusions_add)
        self.exclusions_remove_button.pressed.connect(self.exclusions_remove)
        self.restore_different_computer_label.linkActivated.connect(
            self.restore_different_computer
        )
        self.inherit_backup_history_label.linkActivated.connect(
            self.inherit_backup_history
        )
        self.change_password_label.linkActivated.connect(self.change_password)
        self.save_button.pressed.connect(self.accept)

        if not self.has_other_computers():
            self.restore_different_computer_label.setVisible(False)
            self.inherit_backup_history_label.setVisible(False)

        if is_windows():
            self.backup_connected_file_systems_label.setVisible(False)
            self.backup_connected_file_systems_combo_box.setVisible(False)

        self.logger.info("Settings dialog displayed.")
Пример #4
0
    def __init__(self, first_time=False):
        QMainWindow.__init__(self)
        Ui_MainWindow.__init__(self)
        self.setupUi(self)
        self.logger = get_logger()

        self.setWindowIcon(QIcon(LOGO_PATH))

        self.logo_label.setPixmap(get_pixmap(LOGO_PATH, 20, 20))
        self.computer_label.setPixmap(get_pixmap(COMPUTER_PATH, 20, 20))
        self.arrow_label.setPixmap(get_pixmap(ARROW_PATH, 20, 20))
        self.cloud_label.setPixmap(get_pixmap(CLOUD_PATH, 20, 20))

        self.settings_button.pressed.connect(self.open_settings)
        self.backup_now_button.pressed.connect(self.toggle_backup)
        self.restore_button.pressed.connect(self.open_restore_files)
        self.privacy_label.linkActivated.connect(
            lambda: webbrowser.open(PRIVACY_URL))
        self.support_label.linkActivated.connect(
            lambda: webbrowser.open(SUPPORT_URL))

        self.launch_status_thread()
        self.launch_backup_thread()

        if first_time:
            dialog = BackupStartedDialog()
            dialog.exec()
Пример #5
0
 def __init__(self, email, password, snapshot_id, computer_id):
     QThread.__init__(self)
     self.email = email
     self.password = password
     self.snapshot_id = snapshot_id
     self.computer_id = computer_id
     self.logger = get_logger()
Пример #6
0
    def __init__(self, force_run=False):
        QThread.__init__(self)
        self.process = None
        self.backup_terminated = False
        self.force_run = force_run
        self.logger = get_logger()

        self.status_updated_at = time.time()
Пример #7
0
 def __init__(self, email, password, computer_id, snapshot_id, target,
              snapshot_tree_widget):
     QThread.__init__(self)
     self.email = email
     self.password = password
     self.computer_id = computer_id
     self.snapshot_id = snapshot_id
     self.target = target
     self.snapshot_tree_widget = snapshot_tree_widget
     self.logger = get_logger()
Пример #8
0
    def __init__(
        self,
        reauth=False,
        show_register_button=True,
        title="Sign In - Blobbackup",
        heading=None,
        sign_in_button_text=None,
        email=None,
    ):
        QDialog.__init__(self)
        Ui_LoginDialog.__init__(self)

        self.email = None
        self.password = None
        self.reauth = reauth
        self.title = title
        self.logger = get_logger()
        self.loading_dialog = LoadingDialog(
            self,
            "Re-authenticating. This might take a moment...",
        )

        self.setupUi(self)

        if not is_prod():
            self.title = self.title + " (Test)"

        self.setWindowIcon(QIcon(LOGO_PATH))
        self.setWindowTitle(self.title)

        self.logo_label.setPixmap(get_pixmap(LOGO_PATH, 32, 32))

        self.register_button.setVisible(show_register_button)
        self.register_button.linkActivated.connect(
            lambda: webbrowser.open(REGISTER_URL))

        self.change_password_button.setVisible(show_register_button)
        self.change_password_button.linkActivated.connect(self.change_password)

        self.sign_in_button.pressed.connect(self.login)
        if sign_in_button_text:
            self.sign_in_button.setText(sign_in_button_text)

        if heading:
            self.heading_label.setText(heading)
        if email:
            self.email_line_edit.setText(email)
            self.email_line_edit.setReadOnly(True)
            self.password_line_edit.setFocus()

        self.logger.info("Login dialog displayed.")
Пример #9
0
    def __init__(self):
        QDialog.__init__(self)
        Ui_BackupStartedDialog.__init__(self)
        self.setupUi(self)

        self.logger = get_logger()

        self.setWindowIcon(QIcon(LOGO_PATH))

        self.logo_label.setPixmap(get_pixmap(LOGO_PATH, 20, 20))
        self.check_label.setPixmap(get_pixmap(CHECK_PATH, 20, 20))

        self.close_button.pressed.connect(self.accept)
        self.logger.info("Backup started dialog displayed")
Пример #10
0
    def __init__(self):
        QDialog.__init__(self)
        Ui_RequestFullDiskDialog.__init__(self)
        self.setupUi(self)

        self.logger = get_logger()

        self.setWindowIcon(QIcon(LOGO_PATH))

        self.screenshot_label.setPixmap(
            get_pixmap(FULL_DISK_SCREENSHOT_PATH, 450, 403))
        self.guide_label.linkActivated.connect(
            lambda: webbrowser.open(GUIDE_URL))
        self.open_button.pressed.connect(self.open_system_preferences)
        self.skip_button.linkActivated.connect(self.accept)

        self.logger.info("Request full disk dialog displayed")
Пример #11
0
    def __init__(self, email=None):
        QDialog.__init__(self)
        Ui_ChangePasswordDialog.__init__(self)
        self.setupUi(self)

        self.setWindowIcon(QIcon(LOGO_PATH))
        self.logger = get_logger()
        self.loading_dialog = LoadingDialog(
            self,
            "Changing Password. Please Wait...",
            "We're changing the password on your account and your backups. This might take a minute. Thanks for your patience :-)",
        )
        self.change_password_button.pressed.connect(self.change_password)

        if email:
            self.email_line_edit.setText(email)
            self.email_line_edit.setReadOnly(True)

        self.logger.info("Change password dialog displayed.")
Пример #12
0
    def __init__(self, email, password, heading):
        QDialog.__init__(self)
        Ui_ChooseComputerDialog.__init__(self)
        self.setupUi(self)

        self.email = email
        self.password = password
        self.computer_id = None
        self.logger = get_logger()

        self.setWindowIcon(QIcon(LOGO_PATH))
        self.heading_label.setText(heading)

        for computer in get_computers(email, password):
            if str(computer["id"]) != config["meta"]["computer_id"]:
                self.computers_combo_box.addItem(computer["name"],
                                                 userData=computer["id"])

        self.continue_button.pressed.connect(self.accept)
        self.logger.info("Choose computer dialog displayed.")
Пример #13
0
    def __init__(self,
                 parent=None,
                 title="Loading. Please Wait...",
                 message=None):
        QDialog.__init__(self, parent)
        Ui_LoadingDialog.__init__(self)
        self.setupUi(self)

        self.logger = get_logger()

        self.setParent(parent, Qt.WindowType.Sheet)
        self.setWindowIcon(QIcon(LOGO_PATH))
        self.setWindowTitle(title)
        self.setWindowFlag(Qt.WindowType.WindowCloseButtonHint, False)

        if message == None:
            message = title
        self.message_label.setText(message)

        self.logger.info("Loading dialog displayed")
Пример #14
0
def get_logger_and_password(email, password):
    hashed_password = hash_password(password, email)
    logger = get_logger()
    return logger, hashed_password
Пример #15
0
def main():
    logger = get_logger()
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--open-minimized",
        dest="open_minimized",
        action="store_true",
        default=False,
    )
    parser.add_argument(
        "--set-server",
        dest="server",
        default=None,
    )
    parser.add_argument(
        "--no-reload-scripts",
        dest="reload_scripts",
        action="store_false",
        default=True,
    )
    args = parser.parse_args()

    if args.server:
        config["meta"]["server"] = args.server
        save_config()
        sys.exit()

    if not is_alive():
        logger.info("Application started.")
        init_application_properties()
        application = Application()

        if is_mac() and not full_disk_access():
            request_dialog = RequestFullDiskDialog()
            if not request_dialog.exec():
                sys.exit()

        first_time = False
        if not client_initialized():
            first_time = True

            login_dialog = LoginDialog()
            login_successful = login_dialog.exec()
            if not login_successful:
                sys.exit()

            welcome_dialog = WelcomeDialog(login_dialog.email,
                                           login_dialog.password)
            accepted_terms = welcome_dialog.exec()
            if not accepted_terms:
                sys.exit()

        main_window = MainWindow(first_time)
        if args.reload_scripts:
            try:
                load_scripts()
            except PermissionError:
                logger.error(
                    "Failed to load scripts because of permission error.")
        if not args.open_minimized:
            main_window.show()

        tray = SystemTrayIcon(main_window)
        tray.setVisible(True)

        application.exec()
    else:
        logger.info("Application not started (already running).")
Пример #16
0
 def __init__(self, email, password, reauth):
     QThread.__init__(self)
     self.email = email
     self.password = password
     self.reauth = reauth
     self.logger = get_logger()