Esempio n. 1
0
    def initPlugins(self):
        # init QML plugin container
        if hasattr(self, 'stackedWidget'):
            del (self.stackedWidget)

        self.stackedWidget = QStackedWidget(self)
        self.plugins = []

        for pluginName in self.config.PLUGINS:
            view = QQuickView()
            view.setFlags(Qt.SubWindow)

            # add clientapi into the plugin context
            context = view.rootContext()

            context.setContextProperty('zulApi', self.zulApi)
            context.setContextProperty('GUI', self)

            # load plugin translations if i18n subfolder exists
            i18nDir = 'plugins/{}/i18n'.format(pluginName)
            if os.path.exists(i18nDir):
                translator = QtCore.QTranslator()
                fileName = 'send_'.format(QtCore.QLocale.system().name())
                #fileName = 'send_fr'
                translator.load(fileName, i18nDir)
                self.app.installTranslator(translator)

            # load QML file
            plugin_index_path = 'plugins/{}/index.qml'.format(pluginName)
            view.setSource(QUrl(plugin_index_path))

            plugin = view.rootObject()
            self.plugins.append(plugin)

            # call plugin init callback
            plugin.init()

            # add the plugin in the container
            container = QWidget.createWindowContainer(view, self)
            self.stackedWidget.addWidget(container)
Esempio n. 2
0
class VVSQMLApp(QObject):
    QMLFILE = 'gui.qml'

    def __init__(self, connections):
        super(QObject, self).__init__()
        self.app = QGuiApplication(sys.argv)
        self.view = QQuickView()
        self.view.setResizeMode(QQuickView.SizeRootObjectToView)
        if settings['alwaysOnTop']:
            self.view.setFlags(Qt.WindowStaysOnTopHint)

        self.con = []
        for connection in connections:
            updaterThread = VVSConnectionUpdater(
                connection[0],
                connection[1],
                connection[2],
                updateDelay=settings['updateDelay'])
            updaterThread.start()
            self.con.append(updaterThread)
            #print(connection)
        #self.con = VVSConnectionUpdater('5006021', 'X60', 'Leonberg Bf')
        #self.con.start()

        #print(self.con)

        self.view.rootContext().setContextProperty('con', self.con)
        self.view.setSource(QUrl(self.QMLFILE))

        #Setup notifications
        VVSNotifier.setup(self.con)

    def run(self):
        if settings['fullscreen']:
            self.view.showFullScreen()
        else:
            self.view.show()
        sys.exit(self.app.exec_())
Esempio n. 3
0
def createWindow():
    view = QQuickView()
    view.setSurfaceType(QSurface.OpenGLSurface)

    fmt = QSurfaceFormat()
    fmt.setAlphaBufferSize(8)
    fmt.setRenderableType(QSurfaceFormat.OpenGL)
    view.setFormat(fmt)

    color = QColor()
    color.setRedF(0.0)
    color.setGreenF(0.0)
    color.setBlueF(0.0)
    color.setAlphaF(0.0)
    view.setColor(color)

    view.setClearBeforeRendering(True)
    view.setFlags(Qt.FramelessWindowHint | Qt.ToolTip
                  | Qt.WindowStaysOnTopHint)

    context = view.rootContext()

    return (view, context)
Esempio n. 4
0

	view = QQuickView()
	context = view.rootContext()
	
	view.engine().setOfflineStoragePath(".")
	
	exutil = LauncherEXUtils()
	qmlRegisterType(LauncherEXUtils, 'ExUtils', 1, 0, 'ExUtils')
	qmlRegisterType(Bozorgrah,'Bozorgrah',1,0,'Bozorgrah')
	context.setContextProperty('exutils',exutil)
	
	view.setResizeMode(QQuickView.SizeRootObjectToView)
	try:
		approot = os.path.dirname(os.path.abspath(__file__))
	except NameError:  # We are the main py2exe script, not a module
		approot = os.path.dirname(os.path.abspath(sys.argv[0]))
	print(approot)
	view.setSource(
			QUrl.fromLocalFile(
					os.path.join(approot,'qml\\app.qml')))
					

	view.setFlags(Qt.Dialog or Qt.WindowStaysOnBottomHint);
	view.setTitle("ميزکار")
	view.show()
	
	view.engine().quit.connect(app.quit)

	sys.exit(app.exec_())
Esempio n. 5
0
from PyQt5.QtWidgets import QApplication, qApp
from PyQt5.QtQuick import QQuickView
from PyQt5.QtGui import QSurfaceFormat, QColor

from read_conf import confList, create_qml
from PyQt5 import Qt
from tray_icon import TrayIcon
from settingWindow import SettingWindow
import subprocess

if __name__=="__main__":
        app = QApplication(sys.argv)
        signal.signal(signal.SIGINT, signal.SIG_DFL)

        view = QQuickView()
        view.setFlags(Qt.Qt.FramelessWindowHint)

        surface_format = QSurfaceFormat()
        surface_format.setAlphaBufferSize(8)
        view.setFormat(surface_format)

        view.setColor(QColor(0, 0, 0, 0))
        view.setResizeMode(QQuickView.SizeRootObjectToView)

        create_qml()
        t_icon=TrayIcon()
        sw=SettingWindow()
def show_window():
        path='screen.qml'
        view.engine().quit.connect(app.quit)
        view.setSource(QUrl(path))