当前位置: 首页>>代码示例>>Python>>正文


Python Window.setSource方法代码示例

本文整理汇总了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()
开发者ID:fpemud,项目名称:DMovie,代码行数:31,代码来源:main.py

示例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()
开发者ID:Jactry,项目名称:deepin-translator,代码行数:32,代码来源:main.py

示例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
开发者ID:fpemud,项目名称:satori,代码行数:33,代码来源:main.py

示例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_())
开发者ID:electricface,项目名称:deepin-movie,代码行数:32,代码来源:main.py


注:本文中的window.Window.setSource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。