class QmlGameFrame(QMainWindow):
    
    def __init__(self, parent = None) :
        '''
        Constructor
        '''
        super(QmlGameFrame, self).__init__(parent)
        
        layout = QVBoxLayout()
        
        self.view = QDeclarativeView(self)

        layout.addWidget(self.view)
        self.setLayout(layout)
                
        self.geoMap = GeoMap()
        #self.model.connect()
        
        #self.noteList = self.model.getNoteList()
        #self.noteList = self.model.getToDoList()
        
        
        
        rootContext = self.view.rootContext()
        rootContext.setContextProperty('geoMap', self.geoMap)
                
        path = QDir.currentPath() + '/../../qml/SimpleQmlGameEngine/main.qml'
        path = path.replace('users', 'Users')
        print path
        url = QUrl(path)
        #url = QUrl('file:///Users/unseon_pro/myworks/SimpleQmlGameEngine/qml/SimpleQmlGameEngine/main.qml')
        self.view.setSource(url)
class OverlayWidget(QtGui.QWidget):
    
    def __init__(self, *args):
        super(OverlayWidget, self).__init__(*args)
        
        # Set this widget itself to be transparent
        self.setAttribute(QtCore.Qt.WA_TranslucentBackground)

        # We need to set the base colour of the qml widget to be transparent.
        # This is done by setting its palette.
        palette = QtGui.QPalette()
        palette.setColor(QtGui.QPalette.Base, QtCore.Qt.transparent)

        self.setPalette(palette)
        
        
        self.qml_view = QDeclarativeView(self)
        self.qml_view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
        self.qml_view.setPalette(palette)
        self.qml_view.setResizeMode(QDeclarativeView.SizeRootObjectToView)

        url = QUrl('dynamic_drawers.qml')
        self.qml_view.setSource(url)
    
    def resizeEvent(self, event):
        self.qml_view.resize(event.size())
Example #3
0
    def testSignalEmission(self):
        qmlRegisterType(MyItem, "my.item", 1, 0, "MyItem")

        view = QDeclarativeView()
        view.setSource(QUrl.fromLocalFile(adjust_filename('bug_951.qml', __file__)))

        self.app.exec_()
        self.assertTrue(MyItem.COMPONENT_COMPLETE_CALLED)
    def __init__(self, parent = None):
        super(Application, self).__init__(parent)

        self.handler = DocumentXmlHandler()

        ## Set values for the store/restore settings system
        QtCore.QCoreApplication.setOrganizationName("EMR")
        QtCore.QCoreApplication.setOrganizationDomain("code.rutger.no")
        QtCore.QCoreApplication.setApplicationName("QmlChatClient")

        ## create settings
        self.__settings = QtCore.QSettings()
        hostname = self.__settings.value("QmlChatClient/hostname")
        if hostname != None:
            self.__hostname = hostname
        portnumber = self.__settings.value("QmlChatClient/portnumber")
        if portnumber != None:
            self.__portnumber = portnumber

        ## Connect the socket's signals to our slots
        self.__socket.connected.connect(self.__socketConnected)
        self.__socket.disconnected.connect(self.__socketDisconnected)
        self.__socket.error.connect(self.__socketError)
        self.__socket.readyRead.connect(self.__readyRead)
        #self.__socket.stateChanged.connect(self.__socketStateChanged)

        userpassModel = UsernamePasswordModel()
        userpassModel.setHost(self.__hostname)
        userpassModel.setPort(int(self.__portnumber))

        userpassModel.connectSignal.connect(self.__connectToSystem)
        userpassModel.cancelSignal.connect(self.quitSlot)

        self.loginView = QDeclarativeView()
        self.loginView.rootContext().setContextProperty("model", userpassModel)
        self.loginView.setSource(QUrl('qml/client/LoginDialog.qml'))
        self.loginView.setResizeMode(QDeclarativeView.SizeRootObjectToView)

        self.loggedInModel = LoggedInModel()
        self.loggedInModel.disconnectSignal.connect(self.__disconnectFromHost)
        self.loggedInModel.setHeight(self.__height)
        self.loggedInModel.setWidth(self.__width)
        self.loggedInModel.sendMessageSignal.connect(self.__sendMessage)


        self.loggedInView = QDeclarativeView()
        self.loggedInView.rootContext().setContextProperty("model", self.loggedInModel)
        self.loggedInView.setSource(QUrl('qml/client/RunningDialog.qml'))
        self.loggedInView.setResizeMode(QDeclarativeView.SizeRootObjectToView)

        self.stackedWidget = QtGui.QStackedWidget()
        self.stackedWidget.addWidget(self.loginView)
        self.stackedWidget.addWidget(self.loggedInView)
        self.stackedWidget.setCurrentWidget(self.loginView)

        self.stackedWidget.setWindowTitle('Qml Chat Client')
        self.stackedWidget.setGeometry(300, 300, self.__width, self.__height)
        self.stackedWidget.show()
Example #5
0
 def __init__(self, modules_path):
     QDeclarativeView.__init__(self)
     self.module = Module(modules_path)
     context = self.rootContext()
     print self.module.modules
     context.setContextProperty('plugins', self.module.toDict())
     self.setSource(QUrl('ui/qml/ScriptChooser.qml'))
     self.rootObject().scriptSelected.connect(self.onScriptSelected)
     self.__lock = Lock()
Example #6
0
 def __init__(self, *args, **kwargs):
     QDeclarativeView.__init__(self, *args, **kwargs)
     context = self.rootContext()
     context.setContextProperty('menu', self)
     map_file = settings.value('map')
     if not map_file:
         map_file = glob('maps/*json')[0]
     self.selected_map = map_file
     self.setSource('menu.qml')
     self.setResizeMode(QDeclarativeView.SizeRootObjectToView)
     self.rootObject().initial_map(Map.read_spec(map_file)['title'])
Example #7
0
class QmlGui(Gui):

    USES = ['geonames', 'qmllocationprovider']

    def __init__(self, core, dataroot, parent=None):
        self.app = QApplication(sys.argv)
        self.core = core
        self.view = QDeclarativeView()
        self.view.statusChanged.connect(self._status_changed)
        glw = QGLWidget()
        self.view.setViewport(glw)
        
        self.controller = Controller(self.view, self.core)
        self.settings = SettingsWrapper(self.core)

        rc = self.view.rootContext()
        rc.setContextProperty('controller', self.controller)
        rc.setContextProperty('settings', self.settings)
        rc.setContextProperty('gps', GPSDataWrapper(self.core))
        self.view.setSource(os.path.join('qml','main.qml'))

    def get_gps(self, callback):
        self.controller.callback_gps = callback

    def show(self):
        self.view.showFullScreen()
        self.app.exec_()
        self.core.on_destroy()

    def _status_changed(self, error):
        logger.error(self.view.errors())
Example #8
0
    def create(self, mimeType, url, argumentNames, argumentValues):
        if mimeType != 'application/x-qml':
            return None

        for name, value in zip(argumentNames, argumentValues):
            if name == 'width':
                width = int(value)
            elif name == 'height':
                height = int(value)

        view = QDeclarativeView()
        view.resize(width, height)
        view.setSource(url)

        return view
Example #9
0
    def testReturnPolicy(self):
        view = QDeclarativeView()

        item1 = QDeclarativeItem()
        item1.setObjectName("Item1")
        view.scene().addItem(item1)
        self.assertEqual(item1.objectName(), "Item1") # check if the item still valid

        item2 = QDeclarativeItem()
        item2.setObjectName("Item2")
        item1.scene().addItem(item2)
        item1 = None
        self.assertEqual(item2.objectName(), "Item2") # check if the item still valid

        view = None
    def __init__(self, *args):
        super(OverlayWidget, self).__init__(*args)
        
        # We need to set the base colour of the qml widget to be transparent.
        # This is done by setting its palette.
        palette = QtGui.QPalette()
        palette.setColor(QtGui.QPalette.Base, QtCore.Qt.transparent)

        qml_view = QDeclarativeView(self)
        qml_view.setPalette(palette)

        url = QUrl('control_slides.qml')
        qml_view.setSource(url)

        return
Example #11
0
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        # Create the Qt Application
        self.app = QApplication(["Prey-Config"])
        self.app.setWindowIcon(QIcon(''))
        self.view = QDeclarativeView()
        #self.setWindowTitle("Main Window")

        #get rootContext of QDeclarativeView
        self.context = self.view.rootContext()
        #make this class available to QML files as 'main' context
        self.context.setContextProperty('main', self)
        #create variables
        self.curVars = Vars()
        #make curVars available to QML files as 'vars' context
        self.context.setContextProperty('vars', self.curVars)
        # QML resizes to main window
        self.view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
        # Renders './qml/main.qml'
        self.view.setSource(QUrl.fromLocalFile('./qml/main.qml'))
        #get rootObject
        self.rootO = self.view.rootObject()

        #connect quit signal
        self.view.engine().quit.connect(self.quit_app)

        #check for prey installation, write acess to config file, and configurationstatus
        if self.prey_exists():
            if self.is_config_writable():
                self.get_current_settings()
                if self.check_if_configured() == False:
                    self.rootO.show_alert('Welcome!',"It seems this is the first time you run this setup. Please set up your reporting method now, otherwise Prey won't work!",False)
Example #12
0
class DiffView(QObject):
	def __init__(self, app, difftext, leftfile, rightfile):
		QObject.__init__(self)
		self.app = app


		self.difftext = difftext
		self.window = QMainWindow()
		self.window.setWindowTitle("Log Diffs")

		self.leftfile = leftfile
		self.rightfile = rightfile

		self.view = QDeclarativeView()
		self.glw = QtOpenGL.QGLWidget()
		self.view.setViewport(self.glw)
		self.view.setResizeMode(QtDeclarative.QDeclarativeView.SizeRootObjectToView)
		self.window.setCentralWidget(self.view)
		self.rc = self.view.rootContext()
		self.rc.setContextProperty('controller', self)
		self.rc.setContextProperty('difftext', self.difftext)
		self.view.setSource('diffview.qml')
		self.window.show()

	@Slot()
	def diff_viewer(self):
		p = subprocess.Popen("gvim -d {0} {1}".format(self.leftfile, self.rightfile), shell=True)
		sts = os.waitpid(p.pid, 0)[1]

	def checked(self):
		for build in self.build_list.checked(): 
				yield build
Example #13
0
class LogView(QObject):
	def __init__(self, app, logpath, id, sdk_model, row_number):
		QObject.__init__(self)
		self.app = app
		self.logpath = logpath
		
		self.window = QMainWindow()
		self.window.setWindowTitle("Raptor build viewer")
		self.build_list = BuildListModel(self.logpath)
		self.controller = BuildController(app, self.build_list, id, sdk_model, row_number)

		self.view = QDeclarativeView()
		self.glw = QtOpenGL.QGLWidget()
		self.view.setViewport(self.glw)
		self.view.setResizeMode(QtDeclarative.QDeclarativeView.SizeRootObjectToView)
		self.window.setCentralWidget(self.view)
		self.rc = self.view.rootContext()
		self.rc.setContextProperty('controller', self.controller)
		self.rc.setContextProperty('pyBuildListModel', self.build_list)
		self.rc.setContextProperty('logpath', self.logpath)
		self.rc.setContextProperty('info', sdk_model.sdk_info(id))
		self.rc.setContextProperty('window', self.window)
		self.rc.setContextProperty('row', row_number)
		self.view.setSource('logchooser.qml')
		self.window.show()

	def checked(self):
		for build in self.build_list.checked(): 
			yield build
Example #14
0
 def __init__(self, menu, settings, *args, **kwargs):
     QDeclarativeView.__init__(self, *args, **kwargs)
     self.exception = None
     self.sound = Sounder()
     self.menu = menu
     self.settings = settings
     self.rt_pool = []#fix fault
     self.setWindowTitle('findZbomb!')
     self.setSource('interface.qml')
     self.set_map(None)
     self.redraw()
     context = self.rootContext()
     context.setContextProperty('obj', self)
     self.mega_start.connect(self._mega_start)
     self.setResizeMode(QDeclarativeView.SizeRootObjectToView)
     code = self.settings.value('code')
     if code:
         self.rootObject().set_code(code)
Example #15
0
 def testAbstractItemModelTransferToQML(self):
     view = QDeclarativeView()
     view.setSource(QUrl.fromLocalFile(adjust_filename('bug_814.qml', __file__)))
     root = view.rootObject()
     model = ListModel()
     root.setProperty('model', model)
     view.show()
Example #16
0
    def show(self,qml_file):
        self.app=QApplication([])
        self.view=QDeclarativeView()
        self.view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
        self.view.setSource(QUrl(qml_file))
        self.ctxt = self.view.rootContext()
        self.cmd.ctxt = self.ctxt
        self.ctxt.setContextProperty("cmd", self.cmd)
        self.cmd.finish.connect(self.view.rootObject().finish)
        #self.ctxt.setContextProperty("dist", self.cmd.abort())

        self.view.show()
        self.app.exec_()
    def testModelExport(self):
        view = QDeclarativeView()
        dataList = [MyObject("Item 1"), MyObject("Item 2"), MyObject("Item 3"), MyObject("Item 4")]

        ctxt = view.rootContext()
        ctxt.setContextProperty("myModel", dataList)

        url = QUrl.fromLocalFile(adjust_filename("viewmodel.qml", __file__))
        view.setSource(url)
        view.show()

        self.assertEqual(view.status(), QDeclarativeView.Ready)
Example #18
0
def main():
    app = QApplication([])
    view = QDeclarativeView()
    manager = TodoManager()
    context = view.rootContext()
    context.setContextProperty("manager", manager)

    url = QUrl('main.qml')
    view.setSource(url)

    if "-no-fs" not in sys.argv:
        view.showFullScreen()
    else:
        view.show()

    app.exec_()
Example #19
0
	def __init__(self, app, window, logpath=None):
		QObject.__init__(self)
		self.app = app
		
		self.sdk_list_model = SDKListModel()
		self.controller = SDKController(app, self.sdk_list_model)

		self.view = QDeclarativeView()
		self.glw = QtOpenGL.QGLWidget()
		self.view.setViewport(self.glw)
		self.view.setResizeMode(QtDeclarative.QDeclarativeView.SizeRootObjectToView)
		window.setCentralWidget(self.view)
		self.rc = self.view.rootContext()
		self.rc.setContextProperty('sdk_controller', self.controller)
		self.rc.setContextProperty('pySDKListModel', self.sdk_list_model)
		self.view.setSource('sdkchooser.qml')
Example #20
0
    def __init__(self, core, dataroot, parent=None):
        self.app = QApplication(sys.argv)
        self.core = core
        self.view = QDeclarativeView()
        self.view.statusChanged.connect(self._status_changed)
        glw = QGLWidget()
        self.view.setViewport(glw)
        
        self.controller = Controller(self.view, self.core)
        self.settings = SettingsWrapper(self.core)

        rc = self.view.rootContext()
        rc.setContextProperty('controller', self.controller)
        rc.setContextProperty('settings', self.settings)
        rc.setContextProperty('gps', GPSDataWrapper(self.core))
        self.view.setSource(os.path.join('qml','main.qml'))
    def testQDeclarativeNetworkFactory(self):
        view = QDeclarativeView()

        url = QUrl.fromLocalFile(adjust_filename('hw.qml', __file__))

        view.setSource(url)
        view.show()

        self.assertEqual(view.status(), QDeclarativeView.Ready)

        self.app.exec_()
Example #22
0
def main():
    app = QApplication([])
    view = QDeclarativeView()
    manager = ServiceManager()
    context = view.rootContext()
    context.setContextProperty("manager", manager)

    url = QUrl('main.qml')
    view.setSource(url)
    view.showFullScreen()

    app.exec_()
def main():
  app = QApplication(sys.argv)

  server = ElServer()
  server.start()

  view = QDeclarativeView()
  rootContext = view.rootContext()
  rootContext.setContextProperty('server', server)
  view.setSource('main.qml')
  view.showFullScreen()

  app.exec_()

  server.stop()
Example #24
0
class QtControl(Thread):
    def __init__(self, gs):
        super(QtControl, self).__init__()

        self.gs = gs
        self.cmd=Commands(gs)
        self.results=ResultsModel(self.gs.best_times['_'])

    def get_results(self):
        # self.ctxt.setContextProperty("resutlts", [['<b>{0: >4}.</b> {2} [<font align="right" color="grey">{1:.2f}</font>]'.format(i, t[0], t[1]['name'])
        #                                               for i,t in enumerate(self.gs.best_times[s],1)]
        #                                              for s in self.gs.sets])
        self.ctxt.setContextProperty("results", self.results)

    def run(self):
        self.app=QApplication([])
        self.view=QDeclarativeView()
        self.view.setResizeMode(QDeclarativeView.SizeRootObjectToView)

        self.ctxt = self.view.rootContext()
        # setting context properities
        self.ctxt.setContextProperty("sets", self.gs.sets)
        self.ctxt.setContextProperty("cmd", self.cmd)
        self.ctxt.setContextProperty("dist", self.gs.dist)
        self.ctxt.setContextProperty("results", self.results)

        self.view.setSource(QUrl(os.path.join(BASE_QML_PATH, 'view_n900.qml')))
        self.root=self.view.rootObject()
        # connecting signals
        self.gs.out.qiface.update_race.connect(self.root.update_race)
        self.gs.out.qiface.start.connect(self.root.start)
        self.gs.out.qiface.abort.connect(self.root.abort)
        self.gs.out.qiface.finish.connect(self.root.finish)
        self.gs.out.qiface.finish.connect(self.get_results)
        self.gs.out.qiface.new_race.connect(self.root.new_race)

        self.view.show()
        self.app.exec_()
Example #25
0
	def __init__(self, app, difftext, leftfile, rightfile):
		QObject.__init__(self)
		self.app = app


		self.difftext = difftext
		self.window = QMainWindow()
		self.window.setWindowTitle("Log Diffs")

		self.leftfile = leftfile
		self.rightfile = rightfile

		self.view = QDeclarativeView()
		self.glw = QtOpenGL.QGLWidget()
		self.view.setViewport(self.glw)
		self.view.setResizeMode(QtDeclarative.QDeclarativeView.SizeRootObjectToView)
		self.window.setCentralWidget(self.view)
		self.rc = self.view.rootContext()
		self.rc.setContextProperty('controller', self)
		self.rc.setContextProperty('difftext', self.difftext)
		self.view.setSource('diffview.qml')
		self.window.show()
Example #26
0
    def run(self):
        self.app=QApplication([])
        self.view=QDeclarativeView()
        self.view.setResizeMode(QDeclarativeView.SizeRootObjectToView)

        self.ctxt = self.view.rootContext()
        # setting context properities
        self.ctxt.setContextProperty("sets", self.gs.sets)
        self.ctxt.setContextProperty("cmd", self.cmd)
        self.ctxt.setContextProperty("dist", self.gs.dist)
        self.ctxt.setContextProperty("results", self.results)

        self.view.setSource(QUrl(os.path.join(BASE_QML_PATH, 'view_n900.qml')))
        self.root=self.view.rootObject()
        # connecting signals
        self.gs.out.qiface.update_race.connect(self.root.update_race)
        self.gs.out.qiface.start.connect(self.root.start)
        self.gs.out.qiface.abort.connect(self.root.abort)
        self.gs.out.qiface.finish.connect(self.root.finish)
        self.gs.out.qiface.finish.connect(self.get_results)
        self.gs.out.qiface.new_race.connect(self.root.new_race)

        self.view.show()
        self.app.exec_()
    def __init__(self, *args):
        super(OverlayWidget, self).__init__(*args)
        
        # We need to set the base colour of the qml widget to be transparent.
        # This is done by setting its palette.
        palette = QtGui.QPalette()
        palette.setColor(QtGui.QPalette.Base, QtCore.Qt.transparent)

        qml_view = QDeclarativeView(self)
        qml_view.setPalette(palette)

        qml_context = qml_view.rootContext()
        qml_context.setContextProperty("slider_handler", self)

        url = QUrl('control_slides.qml')
        qml_view.setSource(url)

        qml_root = qml_view.rootObject()
        self.x_rotation_changed.connect(qml_root.x_rotation_changed)
        self.y_rotation_changed.connect(qml_root.y_rotation_changed)
        self.z_rotation_changed.connect(qml_root.z_rotation_changed)

        return
Example #28
0
def main():
    app = QApplication([])
    app.setApplicationName("Audio Output Test")
    view = QDeclarativeView()

    devices = []
    for info in QAudioDeviceInfo.availableDevices(QAudio.AudioOutput):
        devices.append(info)

    player = TonePlayer(devices, sys.argv[1] if len(sys.argv) > 1 else None)

    context = view.rootContext()
    context.setContextProperty("player", player)
    context.setContextProperty("deviceModel", [x.deviceName() for x in devices])

    url = QUrl("main.qml")
    view.setSource(url)

    view.show()

    app.exec_()
Example #29
0
 def __init__(self):
     QDeclarativeView.__init__(self)
     self.setAttribute(Qt.WA_OpaquePaintEvent)
     self.setAttribute(Qt.WA_NoSystemBackground)
     self.viewport().setAttribute(Qt.WA_OpaquePaintEvent)
     self.viewport().setAttribute(Qt.WA_NoSystemBackground)
Example #30
0
#!/usr/bin/env python
# -'''- coding: utf-8 -'''-

import sys
from PySide.QtCore import *
from PySide.QtGui import *
from PySide.QtDeclarative import QDeclarativeView

# Create Qt application and the QDeclarative view
app = QApplication(sys.argv)
view = QDeclarativeView()
# Create an URL to the QML file
url = QUrl('view.qml')
# Set the QML file and show
view.setSource(url)
view.show()
# Enter Qt main loop
sys.exit(app.exec_())