本文整理汇总了Python中PySide.QtDeclarative.QDeclarativeView.setSource方法的典型用法代码示例。如果您正苦于以下问题:Python QDeclarativeView.setSource方法的具体用法?Python QDeclarativeView.setSource怎么用?Python QDeclarativeView.setSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtDeclarative.QDeclarativeView
的用法示例。
在下文中一共展示了QDeclarativeView.setSource方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start
# 需要导入模块: from PySide.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PySide.QtDeclarative.QDeclarativeView import setSource [as 别名]
def start(self):
global client
if (len(self.email) > 0 and len(self.password) > 0):
self.email = str(self.email[0])
self.password = str(base64.b64decode(self.password[0]))
client = Client(self.email, self.password)
response = client.login()
if (response['result'] == 'ok'):
startup = client.notify_startup()
if (not startup):
print_message("Could not startup!")
else:
print_message("Notified!")
else:
Mbox("Budibox", "Credentials undefined or incorrect. Please login again.")
# Create the QML user interface.
view = QDeclarativeView()
view.setSource(QUrl('qml/main.qml'))
view.setWindowTitle("Budibox")
view.setWindowIcon(QIcon("qml/budibox.jpg"))
context = view.rootContext()
context.setContextProperty("send_data",Receive_data())
# Display the user interface and allow the user to interact with it.
view.setGeometry(360, 360, 360, 360)
view.setMaximumSize(360, 360)
view.show()
app.exec_()
示例2: LogView
# 需要导入模块: from PySide.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PySide.QtDeclarative.QDeclarativeView import setSource [as 别名]
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
示例3: QmlGui
# 需要导入模块: from PySide.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PySide.QtDeclarative.QDeclarativeView import setSource [as 别名]
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())
示例4: DiffView
# 需要导入模块: from PySide.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PySide.QtDeclarative.QDeclarativeView import setSource [as 别名]
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
示例5: QmlGameFrame
# 需要导入模块: from PySide.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PySide.QtDeclarative.QDeclarativeView import setSource [as 别名]
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)
示例6: testAbstractItemModelTransferToQML
# 需要导入模块: from PySide.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PySide.QtDeclarative.QDeclarativeView import setSource [as 别名]
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()
示例7: OverlayWidget
# 需要导入模块: from PySide.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PySide.QtDeclarative.QDeclarativeView import setSource [as 别名]
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())
示例8: testSignalEmission
# 需要导入模块: from PySide.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PySide.QtDeclarative.QDeclarativeView import setSource [as 别名]
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)
示例9: testQDeclarativeNetworkFactory
# 需要导入模块: from PySide.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PySide.QtDeclarative.QDeclarativeView import setSource [as 别名]
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_()
示例10: testModelExport
# 需要导入模块: from PySide.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PySide.QtDeclarative.QDeclarativeView import setSource [as 别名]
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)
示例11: main
# 需要导入模块: from PySide.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PySide.QtDeclarative.QDeclarativeView import setSource [as 别名]
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_()
示例12: main
# 需要导入模块: from PySide.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PySide.QtDeclarative.QDeclarativeView import setSource [as 别名]
def main(argv):
app = QApplication(argv)
display_widget = QDeclarativeView()
display_widget.setViewport(QGLWidget())
display_widget.setResizeMode(QDeclarativeView.SizeRootObjectToView)
display_widget.setSource(QUrl('drawer_demo.qml'))
display_widget.show()
display_widget.resize(640,480)
sys.exit(app.exec_())
示例13: create
# 需要导入模块: from PySide.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PySide.QtDeclarative.QDeclarativeView import setSource [as 别名]
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
示例14: main
# 需要导入模块: from PySide.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PySide.QtDeclarative.QDeclarativeView import setSource [as 别名]
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()
示例15: __init__
# 需要导入模块: from PySide.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PySide.QtDeclarative.QDeclarativeView import setSource [as 别名]
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