Example #1
0
    import gobject,dbus.mainloop.glib
    gobject.threads_init()
    dbus.mainloop.glib.threads_init()
    dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
    bus = dbus.SessionBus()



    app = QtGui.QApplication(sys.argv)
    view = QtDeclarative.QDeclarativeView()
    view.setWindowTitle(__doc__)
    view.setResizeMode(QtDeclarative.QDeclarativeView.SizeRootObjectToView)
    
    rc = view.rootContext()
    controller = Controller()
    rc.setContextProperty('controller', controller)
    
    view.setSource(__file__.replace('.py', '.qml'))
    proxy = QMLProxy(view.rootObject())
    view.show()
    
    servo_arduino = ardubus.ardubus_qml(bus, 'arduino0', proxy)
    ardubus_instances[servo_arduino.object_name] = servo_arduino
    switch_arduino = ardubus.ardubus_qml(bus, 'arduino1', proxy)
    ardubus_instances[switch_arduino.object_name] = switch_arduino



    sys.exit(app.exec_())

Example #2
0
        return self.qml_root.findChild(QtDeclarative.QDeclarativeItem, objectName)

if __name__ == '__main__':
    import gobject,dbus.mainloop.glib
    gobject.threads_init()
    dbus.mainloop.glib.threads_init()
    dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
    bus = dbus.SessionBus()



    app = QtGui.QApplication(sys.argv)
    view = QtDeclarative.QDeclarativeView()
    view.setWindowTitle(__doc__)
    view.setResizeMode(QtDeclarative.QDeclarativeView.SizeRootObjectToView)
    
    rc = view.rootContext()
    controller = Controller()
    rc.setContextProperty('controller', controller)
    
    view.setSource(__file__.replace('.py', '.qml'))
    proxy = QMLProxy(view.rootObject())
    view.show()
    
    lid_arduino = ardubus.ardubus_qml(bus, 'arduino2', proxy)
    ardubus_instances[lid_arduino.object_name] = lid_arduino


    sys.exit(app.exec_())

Example #3
0
                                       objectName)


if __name__ == '__main__':
    # Yes we are using threads, in ardubus_qml.py....
    import gobject, dbus.mainloop.glib
    gobject.threads_init()
    dbus.mainloop.glib.threads_init()
    dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
    bus = dbus.SessionBus()

    app = QtGui.QApplication(sys.argv)
    view = QtDeclarative.QDeclarativeView()
    view.setWindowTitle(__doc__)
    view.setResizeMode(QtDeclarative.QDeclarativeView.SizeRootObjectToView)

    rc = view.rootContext()
    controller = Controller()
    rc.setContextProperty('controller', controller)

    view.setSource(__file__.replace('.py', '.qml'))
    proxy = QMLProxy(view.rootObject())
    view.show()

    servo_arduino = ardubus.ardubus_qml(bus, 'arduino0', proxy)
    ardubus_instances[servo_arduino.object_name] = servo_arduino
    switch_arduino = ardubus.ardubus_qml(bus, 'arduino1', proxy)
    ardubus_instances[switch_arduino.object_name] = switch_arduino

    sys.exit(app.exec_())