本文整理汇总了Python中window.Window.setSource方法的典型用法代码示例。如果您正苦于以下问题:Python Window.setSource方法的具体用法?Python Window.setSource怎么用?Python Window.setSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类window.Window
的用法示例。
在下文中一共展示了Window.setSource方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Window
# 需要导入模块: from window import Window [as 别名]
# 或者: from window.Window import setSource [as 别名]
windowView = Window(result or len(sys.argv) > 1)
menu_controller = MenuController(windowView)
database = Database()
movie_info = MovieModule()
app._extra_window = weakref.ref(windowView)
qml_context = windowView.rootContext()
qml_context.setContextProperty("config", config)
qml_context.setContextProperty("_utils", utils)
qml_context.setContextProperty("database", database)
qml_context.setContextProperty("windowView", windowView)
qml_context.setContextProperty("movieInfo", movie_info)
qml_context.setContextProperty("_menu_controller", menu_controller)
windowView.setSource(QUrl.fromLocalFile(MAIN_QML))
windowView.initWindowSize()
windowView.show()
if len(parser.positionalArguments()) > 0:
windowView.play(parser.positionalArguments()[0])
windowView.windowStateChanged.connect(windowView.rootObject().monitorWindowState)
app.lastWindowClosed.connect(windowView.rootObject().monitorWindowClose)
app.focusWindowChanged.connect(windowView.focusWindowChangedSlot)
signal.signal(signal.SIGINT, signal.SIG_DFL)
sys.exit(app.exec_())
finally:
if movie_info is not None:
movie_info.close()
示例2: TranslateInfo
# 需要导入模块: from window import Window [as 别名]
# 或者: from window.Window import setSource [as 别名]
words_translate_model = plugin.get_words_model(setting_config.get_translate_config("src_lang"), setting_config.get_translate_config("dst_lang"))
translate_info = TranslateInfo()
setting_view = Window()
setting_view.qml_context.setContextProperty("sourceLangModel", source_lang_model)
setting_view.qml_context.setContextProperty("destLangModel", dest_lang_model)
setting_view.qml_context.setContextProperty("plugin", plugin)
setting_view.qml_context.setContextProperty("wordTranslateModel", word_translate_model)
setting_view.qml_context.setContextProperty("wordsTranslateModel", words_translate_model)
setting_view.qml_context.setContextProperty("screenWidth", screen_width)
setting_view.qml_context.setContextProperty("screenHeight", screen_height)
setting_view.qml_context.setContextProperty("windowView", setting_view)
setting_view.qml_context.setContextProperty("settingConfig", setting_config)
setting_view.qml_context.setContextProperty("translateInfo", translate_info)
setting_view.setSource(QtCore.QUrl.fromLocalFile(os.path.join(get_parent_dir(__file__), 'SettingView.qml')))
signal.signal(signal.SIGINT, signal.SIG_DFL)
rootObject = translate_simple.rootObject()
def show_translate(x, y, text):
if len(filter(lambda word: word != "", (text.split(" ")))) > 1:
translate_long.show_translate(x, y, text)
else:
translate_simple.show_translate(x, y, text)
def hide_translate():
if translate_simple.isVisible() and not translate_simple.in_translate_area():
translate_simple.hide_translate()
示例3: QCommandLineParser
# 需要导入模块: from window import Window [as 别名]
# 或者: from window.Window import setSource [as 别名]
try:
parser = QCommandLineParser()
parser.setApplicationDescription(PROJECT_NAME)
parser.addHelpOption()
parser.addVersionOption()
parser.addPositionalArgument("element", "Element path")
parser.process(app)
windowView = Window()
webSiteObj = WebSiteObject()
qml_context = windowView.rootContext()
qml_context.setContextProperty("windowView", windowView)
qml_context.setContextProperty("webSiteObj", webSiteObj)
windowView.setSource(QUrl.fromLocalFile(os.path.join(LIB_DIR, 'core', 'main.qml')))
windowView.initWindowSize()
windowView.show()
if len(parser.positionalArguments()) > 0:
webSiteObj.load(parser.positionalArguments()[0])
windowView.windowStateChanged.connect(windowView.rootObject().monitorWindowState)
app.lastWindowClosed.connect(windowView.rootObject().monitorWindowClose)
app.focusWindowChanged.connect(windowView.focusWindowChangedSlot)
signal.signal(signal.SIGINT, signal.SIG_DFL)
sys.exit(app.exec_())
finally:
pass
#from gi.repository import Gtk
示例4: len
# 需要导入模块: from window import Window [as 别名]
# 或者: from window.Window import setSource [as 别名]
if __name__ == "__main__":
movie_file = ""
if len(sys.argv) >= 2:
movie_file = sys.argv[1]
movie_info = MovieInfo(movie_file)
app = QApplication(sys.argv)
database = Database()
config = Config()
view = Window()
page_manager = PageManager(view)
qml_context = view.rootContext()
qml_context.setContextProperty("windowView", view)
qml_context.setContextProperty("qApp", qApp)
qml_context.setContextProperty("movieInfo", movie_info)
qml_context.setContextProperty("database", database)
qml_context.setContextProperty("config", config)
qml_context.setContextProperty("pageManager", page_manager)
view.setSource(QtCore.QUrl.fromLocalFile(os.path.join(os.path.dirname(__file__), 'Main.qml')))
view.show()
view.windowStateChanged.connect(view.rootObject().monitorWindowState)
app.lastWindowClosed.connect(view.rootObject().monitorWindowClose)
app.setQuitOnLastWindowClosed(True)
signal.signal(signal.SIGINT, signal.SIG_DFL)
sys.exit(app.exec_())