videoinfo.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:vidcutter 作者: ozmartian 项目源码 文件源码
def __init__(self, media, parent=None, flags=Qt.Dialog | Qt.WindowCloseButtonHint):
        super(VideoInfo, self).__init__(parent, flags)
        self.logger = logging.getLogger(__name__)
        self.media = media
        self.parent = parent
        self.setObjectName('videoinfo')
        self.setContentsMargins(0, 0, 0, 0)
        self.setWindowModality(Qt.ApplicationModal)
        self.setWindowTitle('Media information - {}'.format(os.path.basename(self.media)))
        self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        self.setMinimumSize(self.modes.get(self.parent.parent.scale))
        metadata = '''<style>
    table {
        font-family: "Noto Sans UI", sans-serif;
        font-size: 13px;
        margin-top: -10px;
    }
    td i {
        font-family: "Noto Sans UI", sans-serif;
        font-weight: normal;
        font-style: normal;
        text-align: right;
        color: %s;
        white-space: nowrap;
    }
    td {
        font-weight: normal;
        text-align: right;
    }
    td + td { text-align: left; }
    h1, h2, h3 { color: %s; }
</style>
<div align="center">%s</div>''' % ('#C681D5' if self.parent.theme == 'dark' else '#642C68',
                                   '#C681D5' if self.parent.theme == 'dark' else '#642C68',
                                   self.parent.videoService.mediainfo(self.media))
        content = QTextBrowser(self.parent)
        content.setStyleSheet('QTextBrowser { border: none; background-color: transparent; }')
        content.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        content.setHtml(metadata)
        keyframesButton = QPushButton('View keyframes', self)
        keyframesButton.clicked.connect(self.showKeyframes)
        okButton = QDialogButtonBox(QDialogButtonBox.Ok)
        okButton.accepted.connect(self.close)
        button_layout = QHBoxLayout()
        mediainfo_version = self.parent.videoService.cmdExec(self.parent.videoService.backends.mediainfo,
                                                             '--version', True)
        if len(mediainfo_version) >= 2:
            mediainfo_version = mediainfo_version.split('\n')[1]
            mediainfo_label = QLabel('<div style="font-size:11px;"><b>Media information by:</b><br/>%s @ '
                                     % mediainfo_version + '<a href="https://mediaarea.net" target="_blank">' +
                                     'mediaarea.net</a></div>')
            button_layout.addWidget(mediainfo_label)
        button_layout.addStretch(1)
        button_layout.addWidget(keyframesButton)
        button_layout.addWidget(okButton)
        layout = QVBoxLayout()
        layout.addWidget(content)
        layout.addLayout(button_layout)
        self.setLayout(layout)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号