Beispiel #1
0
 def __init__(self, app):
     self.started = False
     self.app = app
     self.args = app.args
     self.config = app.config
     self.library = app.library
     self.workplace = app.workplace
     self.analyzer = app.analyzer
     logging.debug("qt_argv: %r", self.args.qt_argv)
     self.qapp = QApplication(self.args.qt_argv)
     self.qapp.setApplicationName("Sample Drawer")
     for path in RESOURCE_FILENAMES:
         if os.path.exists(path):
             logger.debug("Loading resources from %r", path)
             QResource.registerResource(path)
     QIcon.setThemeSearchPaths(QIcon.themeSearchPaths() +
                               ["/home/jajcus/git/sampledrawer/icons"])
     logger.debug("Icon search path: %r", QIcon.themeSearchPaths())
     QIcon.setFallbackSearchPaths([":icons/"] + QIcon.fallbackSearchPaths())
     logger.debug("Icon fallback path: %r", QIcon.fallbackSearchPaths())
     logger.debug("Theme name %r", QIcon.themeName())
     logger.debug("Fallback theme name: %r", QIcon.fallbackThemeName())
     self.qapp.setWindowIcon(QIcon(":icons/sampledrawer.svg"))
Beispiel #2
0
    @classmethod
    def load(cls, form: str) -> QWidget:
        """
        Load up a .ui file and return it.

        :param form: The name of the .ui file to load, without the .ui extension
        :return: The QWidget created from the UI file
        """

        ui_path = str(cls.path / f"forms/designer/{form}.ui")
        ui_file = QFile(ui_path)
        ui_file.open(QFile.ReadOnly)

        return cls.loader.load(ui_file)


QResource.registerResource(str(UILoader.path / "assets/assets.rcc"))

QIcon.setFallbackSearchPaths(  # Not all platforms know what an icon theme is
    QIcon.fallbackSearchPaths() + [":fallback_icons"]
)

print(QIcon.fallbackSearchPaths())

main_window: MainWindowStub = UILoader.load("main_window")


def get_edit_account_dialog() -> EditAccountDialogStub:
    return UILoader.load("edit_account")