Ejemplo n.º 1
0
def get_version(appctxt: ApplicationContext) -> str:
    """Returns the version of the application."""
    logger.debug("Attemping to determine current application version")
    try:
        logger.debug("Parsing {}".format(appctxt.get_resource("base.json")))
        with open(appctxt.get_resource("base.json"), "r") as fp:
            data = json.load(fp)
        version = "v{}".format(data["version"])
        logger.debug("Version found: {}".format(version))
        return version
    except Exception:
        logger.exception("Determining application version failed")
        return "v??"
Ejemplo n.º 2
0
def set_theme(appctxt: ApplicationContext, fs_theme: bool) -> None:
    """Writes theme selection to config file and sets the app stylesheet."""
    logger.debug("Writing theme selection to config file")
    if fs_theme:
        config.set_key_value(config.THEME_KEY, FS_THEME)

        # apply stylesheet
        logger.debug("Applying application stylesheet {}".format(
            appctxt.get_resource("fs_style.qss")))
        stylesheet = appctxt.get_resource("fs_style.qss")
        appctxt.app.setStyleSheet(open(stylesheet, "r").read())
    else:
        config.set_key_value(config.THEME_KEY, "None")

        logger.debug("Clearing application stylesheet")
        appctxt.app.setStyleSheet("")
Ejemplo n.º 3
0
def main():
    appctxt = ApplicationContext()
    presets = []
    for preset in Path(appctxt.get_resource("Presets")).iterdir():
        presets.append(preset)

    ui_path = appctxt.get_resource("installer_design.ui")
    icon_path = appctxt.get_resource("icon_blue.png")
    window = QtUiTools.QUiLoader().load(ui_path)
    pixmap = QtGui.QPixmap(icon_path)
    window.label.setPixmap(pixmap)
    # if window.lineEdit.textChanged() is in licenseList:
    window.pushButton.clicked.connect(lambda: run(presets, window))
    window.show()
    exit_code = appctxt.app.exec_()
    return exit_code
Ejemplo n.º 4
0
def main():
    appctxt = ApplicationContext()       # 1. Instantiate ApplicationContext
    #app = QApplication(sys.argv)
    app_ui = MainWindow()
    app_ui.show()
    exit_code = appctxt.app.exec_()      # 2. Invoke appctxt.app.exec_()
    #sys.exit(app.exec_())
    sys.exit(exit_code)
Ejemplo n.º 5
0
def main():
    app_context = ApplicationContext()

    parser = argparse.ArgumentParser()
    parser.add_argument("--apps", default="config/apps.json")
    args = parser.parse_args()

    app = App(args)
    window = MainWindow(app)
    window.show()

    app_context.app.setStyle("windowsvista")
    return app_context.app.exec_()
Ejemplo n.º 6
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("--dir", default=".")

    args = parser.parse_args()
    if not os.path.isdir(args.dir):
        print("Expected a directory for editor")
        return 1

    app_ctx = ApplicationContext()
    app_ctx.app.setStyle("fusion")

    editor = Editor(args.dir)
    editor.show()

    return app_ctx.app.exec_()
Ejemplo n.º 7
0
class App(QObject):
    appctxt = ApplicationContext()

    homeDir = Path.home() / "UNote"
    newPdf = homeDir / "new.pdf"

    ICONPATH = appctxt.get_resource('icon.png')
    CURVERSION = "2020.01"

    DONATEURL = "https://www.paypal.me/vinstrobl/coffee"
    UPDATEURL = "https://stroblme.de/unote/archives/UNote.zip"
    ABOUTURL = "https://stroblme.de/unote/"

    TOOLBOXWIDTH = 200
    TOOLBOXHEIGHT = 200
    TOOLBOXSTARTX = 400
    TOOLBOXSTARTY = 500
Ejemplo n.º 8
0
def main() -> None:
    # args = sys.argv

    # start app
    appctxt = ApplicationContext()
    app = appctxt.app

    # prepare the logger
    logger.add(
        DEBUG_LOG,
        rotation="1 MB",
        retention="1 week",
        backtrace=True,
        diagnose=True,
        enqueue=True,
    )
    logger.info("-----------------------")
    logger.info("Launching application")

    try:
        # create instance of main window
        app_main_window = main_window(app, appctxt)
        # build the main window
        app_main_window.build()
        app_main_window.set_theme()

        # load data
        app_main_window.main_widget.find_sim()
        app_main_window.main_widget.check_version()
        app_main_window.main_widget.refresh(first=True)

        # resize and show
        max_resize(app_main_window, app_main_window.sizeHint())
        app_main_window.show()

        # execute the application
        sys.exit(app.exec_())

    except Exception as e:
        if isinstance(e, SystemExit):
            logger.info("System exit requested")
        else:
            logger.exception("Uncaught exception")
Ejemplo n.º 9
0
    @Slot()
    def makeNewBoard(self):
        self.db.runCommand(f'add-board "New Board"')
        self.sidebarModel.refresh()
        return


class LisztWindow(QMainWindow):
    def __init__(self, db, parent=None):

        QMainWindow.__init__(self)
        self.setStyleSheet('''
                QMainWindow {
                    background-color: #212121;
                }
        ''')
        mainWidget = MainWidget(db)
        self.setCentralWidget(mainWidget)
        self.setWindowTitle('Liszt')
        return


if __name__ == "__main__":
    appctxt = ApplicationContext()
    db = Database()
    mainWin = LisztWindow(db)
    mainWin.resize(1200, 800)
    mainWin.show()
    sys.exit(appctxt.app.exec_())
Ejemplo n.º 10
0
        elif index == 5:
            pass
            # self.init_transaction_stackpage()
        elif index == 6:
            pass
            # self.init_payroll_stackpage()
        elif index == 7:
            pass
            # self.init_staffsalary_stackpage()

        self.ui.stack.setCurrentIndex(index)

    def initBeautification(self):
        """
        This function sets all the visual goodies,
        Like making font larger
        setting font style
        setting window theme 
        setting title / icon etc
        """
        pass


if __name__ == '__main__':
    appctxt = ApplicationContext()  # 1. Instantiate ApplicationContext
    window = MainWindow()
    # window.resize(250, 150)
    window.show()
    exit_code = appctxt.app.exec_()  # 2. Invoke appctxt.app.exec_()
    sys.exit(exit_code)
Ejemplo n.º 11
0
from fbs_runtime.application_context.PySide2 import ApplicationContext
from PySide2.QtWidgets import QMainWindow
from project.mainwindow import MainWindow

import sys

if __name__ == '__main__':
    appctx = ApplicationContext()  # 1. Instantiate ApplicationContext
    window = MainWindow()
    style_sheet = appctx.get_resource('default.qss')
    appctx.app.setStyleSheet(open(style_sheet).read())
    # window.resize(1400, 900)
    window.show()
    exit_code = appctx.app.exec_()  # 2. Invoke appctx.app.exec_()
    sys.exit(exit_code)
Ejemplo n.º 12
0
from fbs_runtime.application_context.PySide2 import ApplicationContext
from PySide2.QtWidgets import QMainWindow
from retcom import *
from checkTess import *

import glob
import sys

if __name__ == '__main__':
    appctxt = ApplicationContext()  # 1. Instantiate ApplicationContext

    translator = Translator(['translate.google.com'])

    retcomconfig = RetComConfig(
        appctxt.get_resource(os.path.join('config', 'config.json')))
    retcomconfig.tessdataPath = appctxt.get_resource('tessdata')
    retcomconfig.fontPath = appctxt.get_resource(
        os.path.join(retcomconfig.fontPath))

    fonts = glob.glob(os.path.normpath(
        os.path.join(retcomconfig.fontPath, '**/*.ttf')),
                      recursive=True) + glob.glob(os.path.normpath(
                          os.path.join(retcomconfig.fontPath, '**/*.otf')),
                                                  recursive=True)
    for font in fonts:
        QtGui.QFontDatabase.addApplicationFont(appctxt.get_resource(font))

    if not tessExists():
        check = CheckTess(retcomconfig, translator)
        check.show()
    else:
Ejemplo n.º 13
0
import requests
import sys


class MainWindow(QWidget):
    def __init__(self):
        super().__init__()
        text = QLabel()
        text.setWordWrap(True)
        button = QPushButton('Next quote >')
        button.clicked.connect(lambda: text.setText(_get_quote()))
        layout = QVBoxLayout()
        layout.addWidget(text)
        layout.addWidget(button)
        layout.setAlignment(button, Qt.AlignHCenter)
        self.setLayout(layout)


def _get_quote():
    return requests.get('https://build-system.fman.io/quote').text


if __name__ == '__main__':
    appctxt = ApplicationContext()
    stylesheet = appctxt.get_resource('styles.qss')
    appctxt.app.setStyleSheet(open(stylesheet).read())
    window = MainWindow()
    window.show()
    exit_code = appctxt.app.exec_()
    sys.exit(exit_code)
Ejemplo n.º 14
0
		if op == 2:
			crWalletName.show()
			crWalletPassword.show()
			crWalletPassphrase.show()
			crMnemonic.show()
			crWalletPasswordCheck.hide()
			crWalletPassphraseCheck.hide()
			crFormLayout.labelForField(crWalletName).show()
			crFormLayout.labelForField(crWalletPassword).show()
			crFormLayout.labelForField(crWalletPassphrase).show()
			crFormLayout.labelForField(crWalletPasswordCheck).hide()
			crFormLayout.labelForField(crWalletPassphraseCheck).hide()
			crFormLayout.labelForField(crMnemonic).show()

	#Application Setup
	appctxt=ApplicationContext()
	app =appctxt.app

	#Config seteup and Swagger Api settings
	xConfig=configparser.ConfigParser()
	sysPlatform=platform.system().upper()
	baseConfig=appctxt.get_resource('x42lite.ini')
	baseModTime=os.path.getmtime(baseConfig)

	if sysPlatform == 'WINDOWS':
		configDir=os.path.join(os.environ['APPDATA'],'x42lite')
		configPath=os.path.join(configDir,'x42lite.ini')
		if not os.path.exists(configDir):
			os.makedirs(configDir)
			shutil.copyfile(baseConfig,configPath)
		else: