How to use the maestral.gui.utils.get_scaled_font function in maestral

To help you get started, we’ve selected a few maestral examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SamSchott / maestral-dropbox / maestral / gui / sync_issues_window.py View on Github external
def __init__(self, sync_err, parent=None):
        super(self.__class__, self).__init__(parent=parent)
        uic.loadUi(SYNC_ISSUE_WIDGET_PATH, self)

        self.sync_err = sync_err

        self.errorLabel.setFont(get_scaled_font(scaling=0.85))
        self.update_dark_mode()  # set appropriate item icon and colors in style sheet

        self.pathLabel.setText(self.to_display_path(self.sync_err["local_path"]))
        self.errorLabel.setText(self.sync_err["title"] + ":\n" + self.sync_err["message"])

        def request_context_menu():
            self.actionButton.customContextMenuRequested.emit(self.actionButton.pos())

        self.actionButton.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.actionButton.pressed.connect(request_context_menu)
        self.actionButton.customContextMenuRequested.connect(self.showContextMenu)
github SamSchott / maestral-dropbox / maestral / gui / settings_window.py View on Github external
acc_mail = self.mdbx.get_conf("account", "email")
        acc_type = self.mdbx.get_conf("account", "type")
        acc_space_usage = self.mdbx.get_conf("account", "usage")
        acc_space_usage_type = self.mdbx.get_conf("account", "usage_type")

        if acc_space_usage_type == "team":
            acc_space_usage += " (Team)"

        # if the display name is longer than 230 pixels, reduce font-size
        default_font = get_scaled_font(1.5)
        if NEW_QT:
            account_display_name_length = QtGui.QFontMetrics(default_font).horizontalAdvance(acc_display_name)
        else:
            account_display_name_length = QtGui.QFontMetrics(default_font).width(acc_display_name)
        if account_display_name_length > 240:
            font = get_scaled_font(scaling=1.5*240/account_display_name_length)
            self.labelAccountName.setFont(font)
        self.labelAccountName.setText(acc_display_name)

        if acc_type is not "":
            acc_type_text = ", Dropbox {0}".format(acc_type.capitalize())
        else:
            acc_type_text = ""
        self.labelAccountInfo.setText(acc_mail + acc_type_text)
        self.labelSpaceUsage.setText(acc_space_usage)
github SamSchott / maestral-dropbox / maestral / gui / rebuild_index_dialog.py View on Github external
def __init__(self, mdbx, parent=None):
        super(self.__class__, self).__init__(parent=parent)
        uic.loadUi(REBUILD_INDEX_DIALOG_PATH, self)
        self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)

        self.mdbx = mdbx

        self.titleLabel.setFont(get_scaled_font(bold=True))
        self.infoLabel.setFont(get_scaled_font(scaling=0.9))
        self.statusLabel.setFont(get_scaled_font(scaling=0.9))

        self.cancelButton = self.buttonBox.buttons()[1]
        self.rebuildButton = self.buttonBox.buttons()[0]
        self.rebuildButton.setText("Rebuild")

        self.progressBar.hide()
        self.statusLabel.hide()

        self.adjustSize()
github SamSchott / maestral-dropbox / maestral / gui / settings_window.py View on Github external
def __init__(self, parent, mdbx):
        super(self.__class__, self).__init__(parent=None)
        uic.loadUi(SETTINGS_WINDOW_PATH, self)
        self._parent = parent
        self.update_dark_mode()
        self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
        self.adjustSize()

        self.mdbx = mdbx
        self.folders_dialog = FoldersDialog(self.mdbx, parent=self)
        self.unlink_dialog = UnlinkDialog(self._parent.restart, parent=self)

        self.labelAccountName.setFont(get_scaled_font(1.5))
        self.labelAccountInfo.setFont(get_scaled_font(0.85))
        self.labelSpaceUsage.setFont(get_scaled_font(0.85))

        self._profile_pic_height = round(self.labelUserProfilePic.height() * 0.65)

        if platform.system() == "Darwin" and NEW_QT:
            self.spacerMacOS.setMinimumWidth(2)  # bug fix for macOS
            self.spacerMacOS.setMaximumWidth(2)  # bug fix for macOS

        self.populate_gui()

        # update profile pic and account info periodically
        self.update_timer = QtCore.QTimer()
        self.update_timer.timeout.connect(self.update_account_info_from_chache)
        self.update_timer.start(1000*60*5)  # every 5 min

        # connect callbacks
github SamSchott / maestral-dropbox / maestral / gui / settings_window.py View on Github external
def __init__(self, restart_func, parent=None):
        super(self.__class__, self).__init__(parent=parent)
        # load user interface layout from .ui file
        uic.loadUi(UNLINK_DIALOG_PATH, self)

        self.restart_func = restart_func
        self.setModal(True)

        self.setWindowFlags(QtCore.Qt.Sheet)

        self.buttonBox.buttons()[0].setText("Unlink")
        self.titleLabel.setFont(get_scaled_font(bold=True))
        self.infoLabel.setFont(get_scaled_font(scaling=0.9))

        icon = QtGui.QIcon(APP_ICON_PATH)
        pixmap = icon_to_pixmap(icon, self.iconLabel.width(), self.iconLabel.height())
        self.iconLabel.setPixmap(pixmap)
github SamSchott / maestral-dropbox / maestral / gui / settings_window.py View on Github external
def set_account_info_from_cache(self):

        acc_display_name = self.mdbx.get_conf("account", "display_name")
        acc_mail = self.mdbx.get_conf("account", "email")
        acc_type = self.mdbx.get_conf("account", "type")
        acc_space_usage = self.mdbx.get_conf("account", "usage")
        acc_space_usage_type = self.mdbx.get_conf("account", "usage_type")

        if acc_space_usage_type == "team":
            acc_space_usage += " (Team)"

        # if the display name is longer than 230 pixels, reduce font-size
        default_font = get_scaled_font(1.5)
        if NEW_QT:
            account_display_name_length = QtGui.QFontMetrics(default_font).horizontalAdvance(acc_display_name)
        else:
            account_display_name_length = QtGui.QFontMetrics(default_font).width(acc_display_name)
        if account_display_name_length > 240:
            font = get_scaled_font(scaling=1.5*240/account_display_name_length)
            self.labelAccountName.setFont(font)
        self.labelAccountName.setText(acc_display_name)

        if acc_type is not "":
            acc_type_text = ", Dropbox {0}".format(acc_type.capitalize())
        else:
            acc_type_text = ""
        self.labelAccountInfo.setText(acc_mail + acc_type_text)
        self.labelSpaceUsage.setText(acc_space_usage)
github SamSchott / maestral-dropbox / maestral / gui / settings_window.py View on Github external
def __init__(self, parent, mdbx):
        super(self.__class__, self).__init__(parent=None)
        uic.loadUi(SETTINGS_WINDOW_PATH, self)
        self._parent = parent
        self.update_dark_mode()
        self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
        self.adjustSize()

        self.mdbx = mdbx
        self.folders_dialog = FoldersDialog(self.mdbx, parent=self)
        self.unlink_dialog = UnlinkDialog(self._parent.restart, parent=self)

        self.labelAccountName.setFont(get_scaled_font(1.5))
        self.labelAccountInfo.setFont(get_scaled_font(0.85))
        self.labelSpaceUsage.setFont(get_scaled_font(0.85))

        self._profile_pic_height = round(self.labelUserProfilePic.height() * 0.65)

        if platform.system() == "Darwin" and NEW_QT:
            self.spacerMacOS.setMinimumWidth(2)  # bug fix for macOS
            self.spacerMacOS.setMaximumWidth(2)  # bug fix for macOS

        self.populate_gui()

        # update profile pic and account info periodically
        self.update_timer = QtCore.QTimer()
        self.update_timer.timeout.connect(self.update_account_info_from_chache)
        self.update_timer.start(1000*60*5)  # every 5 min
github SamSchott / maestral-dropbox / maestral / gui / rebuild_index_dialog.py View on Github external
def __init__(self, mdbx, parent=None):
        super(self.__class__, self).__init__(parent=parent)
        uic.loadUi(REBUILD_INDEX_DIALOG_PATH, self)
        self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)

        self.mdbx = mdbx

        self.titleLabel.setFont(get_scaled_font(bold=True))
        self.infoLabel.setFont(get_scaled_font(scaling=0.9))
        self.statusLabel.setFont(get_scaled_font(scaling=0.9))

        self.cancelButton = self.buttonBox.buttons()[1]
        self.rebuildButton = self.buttonBox.buttons()[0]
        self.rebuildButton.setText("Rebuild")

        self.progressBar.hide()
        self.statusLabel.hide()

        self.adjustSize()