本文整理汇总了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)
示例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)
示例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()
示例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)
示例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()