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


Python Qt.DirectConnection方法代码示例

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


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

示例1: install

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import DirectConnection [as 别名]
def install(self, profile):
        """Set up the download manager on a QWebEngineProfile."""
        profile.downloadRequested.connect(self.handle_download,
                                          Qt.DirectConnection) 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:6,代码来源:webenginedownloads.py

示例2: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import DirectConnection [as 别名]
def __init__(self, parent=None):
        super().__init__(parent=parent)
        self.mpv = MPV(vo='opengl-cb', ytdl=True)
        self.mpv_gl = _mpv_get_sub_api(self.mpv.handle, MpvSubApi.MPV_SUB_API_OPENGL_CB)
        self.on_update_c = OpenGlCbUpdateFn(self.on_update)
        self.on_update_fake_c = OpenGlCbUpdateFn(self.on_update_fake)
        self.get_proc_addr_c = OpenGlCbGetProcAddrFn(get_proc_addr)
        _mpv_opengl_cb_set_update_callback(self.mpv_gl, self.on_update_c, None)
        self.frameSwapped.connect(self.swapped, Qt.DirectConnection) 
开发者ID:feeluown,项目名称:FeelUOwn,代码行数:11,代码来源:mpv_qtwidget_opengl.py

示例3: play_thread

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import DirectConnection [as 别名]
def play_thread(
        self,
        outputs: List[IOutputConfig],
        mode: "PreviewOrRender",
        dlg: Optional["CorrProgressDialog"],
    ):
        assert self.model

        arg = self._get_args(outputs)
        cfg = copy_config(self.model.cfg)
        t = self.corr_thread = CorrThread(cfg, arg, mode)

        if dlg:
            # t.abort -> Locked.set() is thread-safe (hopefully).
            # It can be called from main thread (not just within CorrThread).
            dlg.canceled.connect(t.abort, Qt.DirectConnection)
            t.arg = attr.evolve(
                arg,
                on_begin=run_on_ui_thread(dlg.on_begin, (float, float)),
                progress=run_on_ui_thread(dlg.setValue, (int,)),
                on_end=run_on_ui_thread(dlg.reset, ()),  # TODO dlg.close
            )

        t.finished.connect(self.on_play_thread_finished)
        t.error.connect(self.on_play_thread_error)
        t.ffmpeg_missing.connect(self.on_play_thread_ffmpeg_missing)
        t.start() 
开发者ID:corrscope,项目名称:corrscope,代码行数:29,代码来源:__init__.py

示例4: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import DirectConnection [as 别名]
def __init__(self, parent=None, file=None, **mpv_opts):
        super(mpvWidget, self).__init__(parent)
        self.parent = parent
        self.filename = file
        self.mpvError = mpv.MPVError
        self.originalParent = None
        self.logger = logging.getLogger(__name__)
        locale.setlocale(locale.LC_NUMERIC, 'C')

        self.mpv = mpv.Context()

        self.option('msg-level', self.msglevel)
        self.setLogLevel('terminal-default')
        self.option('config', 'no')

        def _istr(o):
            return ('yes' if o else 'no') if isinstance(o, bool) else str(o)

        # do not break on non-existant properties/options
        for opt, val in mpv_opts.items():
            try:
                self.option(opt.replace('_', '-'), _istr(val))
            except mpv.MPVError:
                self.logger.warning('error setting MPV option "%s" to value "%s"' % (opt, val))

        self.mpv.initialize()

        self.opengl = self.mpv.opengl_cb_api()
        self.opengl.set_update_callback(self.updateHandler)

        if sys.platform == 'win32':
            try:
                self.option('gpu-context', 'angle')
            except mpv.MPVError:
                self.option('opengl-backend', 'angle')

        self.frameSwapped.connect(self.swapped, Qt.DirectConnection)

        self.mpv.observe_property('time-pos')
        self.mpv.observe_property('duration')
        self.mpv.observe_property('eof-reached')
        self.mpv.set_wakeup_callback(self.eventHandler)

        if file is not None:
            self.initialized.connect(self.play) 
开发者ID:ozmartian,项目名称:vidcutter,代码行数:47,代码来源:mpvwidget.py

示例5: initThumbs

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import DirectConnection [as 别名]
def initThumbs(self) -> None:
        framesize = self.parent.videoService.framesize()
        thumbsize = QSize(
            VideoService.config.thumbnails['TIMELINE'].height() * (framesize.width() / framesize.height()),
            VideoService.config.thumbnails['TIMELINE'].height())
        positions, frametimes = [], []
        thumbs = int(math.ceil((self.rect().width() - (self.offset * 2)) / thumbsize.width()))
        for pos in range(thumbs):
            val = QStyle.sliderValueFromPosition(self.minimum(), self.maximum(),
                                                 (thumbsize.width() * pos) - self.offset,
                                                 self.rect().width() - (self.offset * 2))
            positions.append(val)
        positions[0] = 1000
        [frametimes.append(self.parent.delta2QTime(msec).toString(self.parent.timeformat)) for msec in positions]

        class ThumbWorker(QObject):
            completed = pyqtSignal(list)

            def __init__(self, settings: QSettings, media: str, times: list, size: QSize):
                super(ThumbWorker, self).__init__()
                self.settings = settings
                self.media = media
                self.times = times
                self.size = size

            @pyqtSlot()
            def generate(self):
                frames = list()
                [
                    frames.append(VideoService.captureFrame(self.settings, self.media, frame, self.size))
                    for frame in self.times
                ]
                self.completed.emit(frames)

        self.thumbsThread = QThread(self)
        self.thumbsWorker = ThumbWorker(self.parent.settings, self.parent.currentMedia, frametimes, thumbsize)
        self.thumbsWorker.moveToThread(self.thumbsThread)
        self.thumbsThread.started.connect(self.parent.sliderWidget.setLoader)
        self.thumbsThread.started.connect(self.thumbsWorker.generate)
        self.thumbsThread.finished.connect(self.thumbsThread.deleteLater, Qt.DirectConnection)
        self.thumbsWorker.completed.connect(self.buildTimeline)
        self.thumbsWorker.completed.connect(self.thumbsWorker.deleteLater, Qt.DirectConnection)
        self.thumbsWorker.completed.connect(self.thumbsThread.quit, Qt.DirectConnection)
        self.thumbsThread.start() 
开发者ID:ozmartian,项目名称:vidcutter,代码行数:46,代码来源:videoslider.py


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