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??"
Beispiel #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("")
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
Beispiel #4
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)
Beispiel #5
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:
Beispiel #6
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)
Beispiel #7
0
			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:
			if not os.path.exists(configPath):
				shutil.copyfile(baseConfig,configPath)
			else:
				configModTime=os.path.getmtime(configPath)
				if baseModTime > configModTime:
					shutil.copyfile(baseConfig,configPath)