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.")
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.")
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.")
def paintEvent(self, event): QDialog.paintEvent(self, event) if not self.line.isNull(): painter = QPainter(self) pen = QPen(Qt.GlobalColor.red, 3) painter.setPen(pen) painter.drawLine(self.line)
def reject(self): self.prefs_for_persistence.set(self.name + '-geometry', bytearray(self.saveGeometry())) if hasattr(self, 'splitter'): self.prefs_for_persistence.set( self.name + '-splitter-state', bytearray(self.splitter.saveState())) QDialog.reject(self)
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.")
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")
def sizeHint(self): ans = QDialog.sizeHint(self) ans.setWidth( max(min(ans.width(), 500), self.bb.sizeHint().width() + 100)) ans.setHeight(min(ans.height(), 500)) return ans
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")
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.")
def _dialog_handler(self, _widget: QWidget): _dialog = QDialog(self) _widget.saved.connect(_dialog.close) _widget.canceled.connect(_dialog.close) _layout = QVBoxLayout() _layout.setContentsMargins(0, 0, 0, 0) _layout.addWidget(_widget) _dialog.setWindowModality(Qt.WindowModality.WindowModal) _dialog.setLayout(_layout) _parent_size = self.sizeHint() _modal_size = QSize(_parent_size.width() - 100, _parent_size.height() - 100) _dialog.setFixedSize(_modal_size) _dialog.show()
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")
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.")
def __init__(self, title, name, parent=None, prefs=gprefs): QDialog.__init__(self, parent) self.prefs_for_persistence = prefs self.setWindowTitle(title) self.name = name self.bb = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel) self.bb.accepted.connect(self.accept) self.bb.rejected.connect(self.reject) self.setup_ui() self.resize(self.sizeHint()) geom = self.prefs_for_persistence.get(name + '-geometry', None) if geom is not None: self.restoreGeometry(geom) if hasattr(self, 'splitter'): state = self.prefs_for_persistence.get(name + '-splitter-state', None) if state is not None: self.splitter.restoreState(state)
def showEvent(self, ev): ret = QDialog.showEvent(self, ev) if self.is_question: try: self.bb.button(QDialogButtonBox.StandardButton.Yes if self. default_yes else QDialogButtonBox. StandardButton.No).setFocus( Qt.FocusReason.OtherFocusReason) except Exception: pass # Buttons were changed else: self.bb.button(QDialogButtonBox.StandardButton.Ok).setFocus( Qt.FocusReason.OtherFocusReason) return ret
import sys import webbrowser from PyQt6.QtWidgets import QApplication, QDialog from ui_zakaz1 import Ui_zakaz app = QApplication(sys.argv) window = QDialog() ui = Ui_zakaz() ui.setupUi(window) #webbrowser.open("https://konovalov.top/index.php/ssylki.html") window.show() sys.exit(app.exec())
def exec(self): ret = QDialog.exec(self) self.break_cycles() return ret
def __init__(self, type_, title, msg, det_msg='', q_icon=None, show_copy_button=True, parent=None, default_yes=True, yes_text=None, no_text=None, yes_icon=None, no_icon=None): QDialog.__init__(self, parent) if q_icon is None: icon = { self.ERROR: QStyle.StandardPixmap.SP_MessageBoxCritical, self.WARNING: QStyle.StandardPixmap.SP_MessageBoxWarning, self.INFO: QStyle.StandardPixmap.SP_MessageBoxInformation, self.QUESTION: QStyle.StandardPixmap.SP_MessageBoxQuestion, }[type_] self.icon = self.style().standardIcon(icon) else: self.icon = q_icon if isinstance(q_icon, QIcon) else get_icon(q_icon) self.setup_ui() self.setWindowTitle(title) self.setWindowIcon(self.icon) self.icon_label.setPixmap(self.icon.pixmap(64, 64)) self.msg.setText(msg) self.det_msg.setPlainText(det_msg) self.det_msg.setVisible(False) self.toggle_checkbox.setVisible(False) if show_copy_button: self.ctc_button = self.bb.addButton( _('&Copy to clipboard'), QDialogButtonBox.ButtonRole.ActionRole) self.ctc_button.clicked.connect(self.copy_to_clipboard) self.show_det_msg = _('Show &details') self.hide_det_msg = _('Hide &details') self.det_msg_toggle = self.bb.addButton( self.show_det_msg, QDialogButtonBox.ButtonRole.ActionRole) self.det_msg_toggle.clicked.connect(self.toggle_det_msg) self.det_msg_toggle.setToolTip( _('Show detailed information about this error')) self.copy_action = QAction(self) self.addAction(self.copy_action) self.copy_action.setShortcuts(QKeySequence.StandardKey.Copy) self.copy_action.triggered.connect(self.copy_to_clipboard) self.is_question = type_ == self.QUESTION if self.is_question: self.bb.setStandardButtons(QDialogButtonBox.StandardButton.Yes | QDialogButtonBox.StandardButton.No) self.bb.button(QDialogButtonBox.StandardButton.Yes if default_yes else QDialogButtonBox.StandardButton.No).setDefault( True) self.default_yes = default_yes if yes_text is not None: self.bb.button( QDialogButtonBox.StandardButton.Yes).setText(yes_text) if no_text is not None: self.bb.button( QDialogButtonBox.StandardButton.No).setText(no_text) if yes_icon is not None: self.bb.button(QDialogButtonBox.StandardButton.Yes).setIcon( yes_icon if isinstance(yes_icon, QIcon ) else get_icon(yes_icon)) if no_icon is not None: self.bb.button(QDialogButtonBox.StandardButton.No).setIcon( no_icon if isinstance(no_icon, QIcon) else get_icon(no_icon )) else: self.bb.button(QDialogButtonBox.StandardButton.Ok).setDefault(True) if not det_msg: self.det_msg_toggle.setVisible(False) self.resize_needed.connect(self.do_resize, type=Qt.ConnectionType.QueuedConnection) self.do_resize()