Esempio n. 1
0
class HAEClient:
	def __init__(self):
		from codec import Codec
		from window import Window
		from system import System
		from datajar import DataJar
		from filesystem import FileSystem

		try:
			manifest = json.load(codecs.open('manifest.json', 'r', 'utf-8'))
		except:
			manifest = {}

		for key in assets.manifest:
			if key in manifest:
				assets.manifest[key] = manifest[key]

		self.app = QApplication(sys.argv)
		self.app.setApplicationName(assets.manifest['name'])
		self.app.setApplicationVersion(assets.manifest['version'])

		assets.sys = System()
		assets.codec = Codec()
		assets.fs = FileSystem()
		assets.dataJar = DataJar()

		translator = QTranslator()
		if translator.load("zh_CN.qm"):
			self.app.installTranslator(translator)

		self.window = Window(None, assets.manifest['path'] + 'index.html')

		sys.exit(self.app.exec_())
Esempio n. 2
0
class HAEClient:
    def __init__(self):
        from codec import Codec
        from window import Window
        from system import System
        from datajar import DataJar
        from filesystem import FileSystem

        try:
            manifest = json.load(codecs.open('manifest.json', 'r', 'utf-8'))
        except:
            manifest = {}

        for key in assets.manifest:
            if key in manifest:
                assets.manifest[key] = manifest[key]

        self.app = QApplication(sys.argv)
        self.app.setApplicationName(assets.manifest['name'])
        self.app.setApplicationVersion(assets.manifest['version'])

        assets.sys = System()
        assets.codec = Codec()
        assets.fs = FileSystem()
        assets.dataJar = DataJar()

        translator = QTranslator()
        if translator.load("zh_CN.qm"):
            self.app.installTranslator(translator)

        self.window = Window(None, assets.manifest['path'] + 'index.html')

        sys.exit(self.app.exec_())
Esempio n. 3
0
    def __init__(self, app_dir):

        app_dir = os.path.realpath(app_dir)
        manifest_path = os.path.join(app_dir, "manifest.json")

        try:
            manifest = json.load(codecs.open(manifest_path, 'r', 'utf-8'))
        except:
            manifest = {}

        for key in manifest:
            assets.manifest[key] = manifest[key]

        app = QApplication(sys.argv)
        app.setApplicationName(assets.manifest['name'])
        app.setApplicationVersion(assets.manifest['version'])

        assets.sys = System()
        assets.codec = Codec()
        assets.fs = FileSystem()
        assets.dataJar = DataJar()
        # import rpdb2
        # rpdb2.start_embedded_debugger('12345', fAllowRemote=True)
        translator = QTranslator()
        translateLocaleName = "qt_" + QLocale.system().name()
        translator.load(translateLocaleName,
                        QLibraryInfo.location(QLibraryInfo.TranslationsPath))
        app.installTranslator(translator)

        if assets.manifest.get("plugins"):
            plugindir = os.path.join(app_dir, assets.manifest["plugins"])
            plugin_manager = PluginsManager(plugindir)
            plugin_manager.load(assets)

        assets.manifest['icon'] = os.path.join(app_dir,
                                               assets.manifest["icon"])
        assets.manifest['app_dir'] = app_dir
        if "--debug" in sys.argv:
            assets.manifest['debug'] = True

        index_path = os.path.join(app_dir,
                                  assets.manifest['path'] + 'index.html')
        self.window = Window(None, index_path)

        sys.exit(app.exec_())
    def __init__(self, app_dir):

        app_dir = os.path.realpath(app_dir)
        manifest_path = os.path.join(app_dir, "manifest.json")

        try:
            manifest = json.load(codecs.open(manifest_path, 'r', 'utf-8'))
        except:
            manifest = {}

        for key in manifest:
            assets.manifest[key] = manifest[key]

        app = QApplication(sys.argv)
        app.setApplicationName(assets.manifest['name'])
        app.setApplicationVersion(assets.manifest['version'])

        assets.sys = System()
        assets.codec = Codec()
        assets.fs = FileSystem()
        assets.dataJar = DataJar()

        translator = QTranslator()
        translateLocaleName = "qt_" + QLocale.system().name()
        translator.load(translateLocaleName, QLibraryInfo.location(QLibraryInfo.TranslationsPath))
        app.installTranslator(translator)

        if assets.manifest.get("plugins"):
            plugindir = os.path.join(app_dir, assets.manifest["plugins"])
            plugin_manager = PluginsManager(plugindir)
            plugin_manager.load(assets)

        assets.manifest['icon'] = os.path.join(app_dir, assets.manifest["icon"])
        assets.manifest['app_dir'] = app_dir
        if "--debug" in sys.argv:
            assets.manifest['debug'] = True

        index_path = os.path.join(app_dir, assets.manifest['path'] + 'index.html')
        self.window = Window(None, index_path)

        sys.exit(app.exec_())
Esempio n. 5
0
class HAEClient:
    def __init__(self, app_dir):
        from codec import Codec
        from window import Window
        from system import System
        from datajar import DataJar
        from filesystem import FileSystem

        manifest_json = os.path.join(app_dir, "manifest.json")

        try:
            manifest = json.load(codecs.open(manifest_json, 'r', 'utf-8'))
        except:
            manifest = {}

        for key in assets.manifest:
            if key in manifest:
                assets.manifest[key] = manifest[key]

        self.app = QApplication(sys.argv)
        self.app.setApplicationName(assets.manifest['name'])
        self.app.setApplicationVersion(assets.manifest['version'])

        assets.sys = System()
        assets.codec = Codec()
        assets.fs = FileSystem()
        assets.dataJar = DataJar()

        translator = QTranslator()
        if translator.load(os.path.join(current_dir, "zh_CN.qm")):
            self.app.installTranslator(translator)

        paths = [app_dir]
        paths += assets.manifest['path'].split("/")
        paths.append("index.html")
        html_index = os.path.join(*paths)
        self.window = Window(None, html_index)

        sys.exit(self.app.exec_())
Esempio n. 6
0
import resource.qss.res_qss_rc as res_qss_rc
import json

if __name__ == '__main__':
    import sys
    app = QApplication(sys.argv)
    app.setOrganizationDomain('com.smartsoft.iclosure')
    app.setOrganizationName('smartsoft')
    app.setApplicationName('carmonitor')
    app.setApplicationDisplayName('飞行器遥控️系统')
    app.setApplicationVersion('%d.%d.%d' % (1, 0, 0))

    # translator - system
    translator = QTranslator()
    translator.load(':/lang/qt_' + 'zh_CN')
    app.installTranslator(translator)

    # translator
    translator = QTranslator()
    translator.load(':/lang/' + 'zh_CN')
    app.installTranslator(translator)

    # style sheet
    file = QFile(":/qss/stylesheet-1.qss")
    if file.open(QFile.ReadOnly | QFile.Text):
        app.setStyleSheet(QTextStream(file).readAll())

    app.setFont(QFont('Microsoft Yahei', 15))

    # main window
    mainWidget = MainWidget()