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)
评论列表
文章目录