Example #1
0
    def init(self):
        super().init()
        QGuiApplication.setApplicationDisplayName(self.ApplicationName)
        widget_settings_dir_cfg = environ.get_path("widget_settings_dir", "")
        if widget_settings_dir_cfg:
            # widget_settings_dir is configured via config file
            set_widget_settings_dir_components(widget_settings_dir_cfg,
                                               self.ApplicationVersion)

        canvas_settings_dir_cfg = environ.get_path("canvas_settings_dir", "")
        if canvas_settings_dir_cfg:
            # canvas_settings_dir is configured via config file
            QSettings.setPath(QSettings.IniFormat, QSettings.UserScope,
                              canvas_settings_dir_cfg)

        for t in spec:
            occonfig.register_setting(*t)
Example #2
0
def clipboard_has_format(mimetype):
    # type: (str) -> bool
    """Does the system clipboard contain data for mimetype?"""
    cb = QGuiApplication.clipboard()
    if cb is None:
        return False
    mime = cb.mimeData()
    if mime is None:
        return False
    return mime.hasFormat(mimetype)
Example #3
0
def clipboard_data(mimetype: str) -> Optional[bytes]:
    """Return the binary data of the system clipboard for mimetype."""
    cb = QGuiApplication.clipboard()
    if cb is None:
        return None
    mime = cb.mimeData()
    if mime is None:
        return None
    if mime.hasFormat(mimetype):
        return bytes(mime.data(mimetype))
    else:
        return None