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


Python Ui_MainWindow.video_canvas方法代码示例

本文整理汇总了Python中mainwindow.Ui_MainWindow.video_canvas方法的典型用法代码示例。如果您正苦于以下问题:Python Ui_MainWindow.video_canvas方法的具体用法?Python Ui_MainWindow.video_canvas怎么用?Python Ui_MainWindow.video_canvas使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mainwindow.Ui_MainWindow的用法示例。


在下文中一共展示了Ui_MainWindow.video_canvas方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from mainwindow import Ui_MainWindow [as 别名]
# 或者: from mainwindow.Ui_MainWindow import video_canvas [as 别名]
def main():
    """
    The main function of the application.
     Check the input file for correctness.
     Creates the main window, the thread pool, etc.
     Connects all handlers
    :return: None
    """
    if len(sys.argv) != 2:
        sys.exit("Usage: ./main.py <video file>")
    if not os.path.isfile(sys.argv[1]):
        sys.exit("Video file is not found")

    orig_filename = os.path.abspath(sys.argv[1])
    splitted = os.path.splitext(orig_filename)
    result_filename = splitted[0] + "_edited" + splitted[1]

    try:
        ffmpeg_parse_infos(orig_filename)
    except IOError:
        sys.exit("Can't detect valid video in specified file")

    app = QtGui.QApplication([])
    app.setApplicationName("Title machine")
    window = QtGui.QMainWindow()

    ui = Ui_MainWindow()
    ui.setupUi(window)

    ui.video_seek = SeekSlider(ui.layoutWidget)
    ui.video_seek.setIconVisible(False)
    ui.video_seek.setPageStep(1000)
    ui.video_seek.setSingleStep(200)
    ui.v_layout_1.addWidget(ui.video_seek)

    ui.video_canvas = VideoCanvas()
    ui.video_canvas.set_source(orig_filename)
    ui.video_seek.setMediaObject(ui.video_canvas.media)
    ui.v_layout_1.insertWidget(0, ui.video_canvas)

    pool = Pool(1)
    log_watcher = QtCore.QFileSystemWatcher([os.path.dirname(result_filename)])

    ui.button_process.clicked.connect(
        on_process_clicked(ui, orig_filename, result_filename, pool))
    ui.button_add_caption.clicked.connect(on_add_caption_clicked(ui))
    ui.button_remove_caption.clicked.connect(on_remove_caption_clicked(ui))
    ui.table_captions.cellChanged.connect(on_tablewidget_cell_changed(ui))

    ui.button_play_pause.clicked.connect(on_button_play_pause_clicked(ui))
    ui.video_canvas.media.stateChanged.connect(on_video_state_changed(ui))
    ui.video_canvas.media.tick.connect(on_video_tick(ui))
    ui.video_canvas.media.totalTimeChanged.connect(on_video_total_time_changed)

    log_watcher.directoryChanged.connect(on_log_dir_changed(log_watcher, result_filename))
    log_watcher.fileChanged.connect(on_log_file_changed(ui, log_watcher))
    app.lastWindowClosed.connect(on_app_quit(ui, pool))

    ui.textbrowser_log.insertPlainText("Welcome to Title Machine!")
    ui.video_canvas.media.pause()
    window.show()

    app.exec_()
开发者ID:avesloguzova,项目名称:title-machine,代码行数:65,代码来源:main.py


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