Skip to content

Commit

Permalink
- fix: ClassSelectionDialog now creates a new QDialog every time it i…
Browse files Browse the repository at this point in the history
…s requested. This solves the problem on Windows that a close() event marks a widget for deletion, hence the C++ object might be in an undefined state and cannot be accessed a second time

- turned off the threaded parsing as this makes creation of GUI elements in non-GUI threads difficult to handle
- added VMAFScore and seconds as allowed units for BD calculation
- added log files from a collect folder for testing
  • Loading branch information
Max Bläser committed Apr 3, 2019
1 parent 9f5109f commit 30087a2
Show file tree
Hide file tree
Showing 11 changed files with 619 additions and 39 deletions.
68 changes: 39 additions & 29 deletions src/rdplot/SimulationDataItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from os import listdir
from os.path import join, abspath, isfile, isdir
from PyQt5.QtCore import *
from PyQt5.QtWidgets import QDialog, QVBoxLayout, QHBoxLayout, QComboBox, QPushButton, QLabel, QCheckBox, QGroupBox, QMessageBox, QApplication
from PyQt5.QtWidgets import QDialog, QVBoxLayout, QHBoxLayout, QComboBox, QPushButton, QDialogButtonBox, QLabel, QCheckBox, QGroupBox, QMessageBox, QApplication
import re


Expand Down Expand Up @@ -409,7 +409,7 @@ def create_item_from_file(self, file_path):
if not self.class_selection_dialog.remember_decision:
self.class_selection_dialog.set_items(list(map(lambda x: re.sub('<|>|\'', '', str(x)).split('.')[-1],
list_classes)))
result = self.class_selection_dialog.exec_(file_path)
result = self.class_selection_dialog.askUser(file_path)
if result == QDialog.Accepted:
try:
cls_list.append(list_classes[self.class_selection_dialog.selected_class](file_path))
Expand All @@ -434,6 +434,7 @@ def create_item_list_from_directory(self, directory_path):
"""

item_list = []
self.class_selection_dialog.reset()
for file_name in listdir(directory_path):
path = join(directory_path, file_name)
try:
Expand Down Expand Up @@ -483,42 +484,51 @@ def __repr__(self):
return str("SimulationDataItemFactory with loaded classes: ".format(str(self)))


class ClassSelectionDialog(QDialog):
class ClassSelectionDialog():
def __init__(self):
super().__init__()
self.setWindowTitle('Error!')
self.setLayout(QVBoxLayout())
self._text_label = QLabel()
self.layout().addWidget(self._text_label)
self._combo_box = QComboBox()
self.layout().addWidget(self._combo_box)
self._check_box = QCheckBox('Remember my decision for future errors')
self.layout().addWidget(self._check_box)
self._group_box = QGroupBox()
self._group_box.setLayout(QHBoxLayout())
self._button1, self._button2 = QPushButton('Accept'), QPushButton('Cancel')
self._group_box.layout().addWidget(self._button1)
self._group_box.layout().addWidget(self._button2)
self.layout().addWidget(self._group_box)
self._button1.clicked.connect(self.accept)
self._button2.clicked.connect(self.reject)
self.checked = False
self.items = list()
self.selected = -1

def createDialog(self, textlabel, items, checked):
dialog = QDialog()
dialog.setWindowTitle('Select file parser')
dialog.setLayout(QVBoxLayout())
text_label = QLabel(textlabel)
dialog.layout().addWidget(text_label)
combo_box = QComboBox()
combo_box.addItems(items)
dialog.layout().addWidget(combo_box)
check_box = QCheckBox('Remember my decision for future errors')
check_box.setCheckState(checked)
dialog.layout().addWidget(check_box)
buttons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, dialog)
dialog.layout().addWidget(buttons)
buttons.accepted.connect(dialog.accept)
buttons.rejected.connect(dialog.reject)
val = dialog.exec_()
if val == QDialog.Accepted:
self.checked = check_box.isChecked()
self.selected = combo_box.currentIndex()
return QDialog.Accepted
else:
return QDialog.Rejected

@property
def selected_class(self):
return self._combo_box.currentIndex()
return self.selected

def exec_(self, file_name):
self._text_label.setText(('Problem with file: {}\nNo matching parsers were found.\nPlease select one of the existing ones or '
'implement a new parser.').format(file_name.split('/')[-1]))
return super().exec_()
def askUser(self, file_name):
textlabel = ('Problem with file: {}\nNo matching parsers were found.\nPlease select one of the existing ones or '
'implement a new parser.').format(file_name.split('/')[-1])
return self.createDialog(textlabel, self.items, self.checked)

def set_items(self, items):
self._combo_box.clear()
self._combo_box.addItems(items)
self.items = items

@property
def remember_decision(self):
return self._check_box.isChecked()
return self.checked

def reset(self):
self._check_box.setChecked(False)
self.checked = False
4 changes: 2 additions & 2 deletions src/rdplot/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1038,8 +1038,8 @@ def update(self, plot_data_collection, bd_option, interp_option, bd_plot):
self._plot_data_collection = plot_data_collection

self._data = np.zeros((len(seq_set) + 1, len(config_set)))

if all(collection.label == ("kbps", "dB") for collection in plot_data_collection):
allowed_units = [("kbps","dB"),("kbps","s"),("kbps","VMAFScore")]
if all(collection.label in allowed_units for collection in plot_data_collection):
self.update_table(bd_option, interp_option, 0, bd_plot)
else:
self.beginResetModel()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<Logfile>
<Codec>
<Value>TMVTMBMS1_0_SimulationDecodeIPPE</Value>
</Codec>
<SeqName>
<Value>RaceHorsesL_832x480_30fps_10bit_420pf.yuv</Value>
</SeqName>
<Rate>
<Value>4204.0776</Value>
<Unit>kbps</Unit>
</Rate>
<PsnrY>
<Value>39.4115</Value>
<Unit>dB</Unit>
</PsnrY>
<PsnrU>
<Value>41.6752</Value>
<Unit>dB</Unit>
</PsnrU>
<PsnrV>
<Value>43.2251</Value>
<Unit>dB</Unit>
</PsnrV>
<Width>
<Value>832</Value>
</Width>
<Height>
<Value>480</Value>
</Height>
<Frq>
<Value>30</Value>
</Frq>
<NumFrms>
<Value>300</Value>
</NumFrms>
<FileInBitDepth>
<Value>10</Value>
</FileInBitDepth>
<ConfigInBitDepth>
<Value>10</Value>
</ConfigInBitDepth>
<ConfigOutBitDepth>
<Value>10</Value>
</ConfigOutBitDepth>
<QP>
<Value>22</Value>
</QP>
<EncTime>
<Value>49823.0</Value>
<Unit>s</Unit>
</EncTime>
<DecTime>
<Value>23.838</Value>
<Unit>s</Unit>
</DecTime>
<VMAF>
<Value>99.959891</Value>
<Unit>VMAFScore</Unit>
</VMAF>
<BitstreamMd5>
<Value>db082f5273a8d4701fe615e680c23094</Value>
</BitstreamMd5>
<DecodedYUVMd5>
<Value>037b52e29100ff691e80a706b9e68132</Value>
</DecodedYUVMd5>
<JobId>
<Value>6930171 on knecht22</Value>
</JobId>
</Logfile>
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<Logfile>
<Codec>
<Value>TMVTMBMS1_0_SimulationDecodeIPPE</Value>
</Codec>
<SeqName>
<Value>RaceHorsesL_832x480_30fps_10bit_420pf.yuv</Value>
</SeqName>
<Rate>
<Unit>kbps</Unit>
<Value>1616.1432</Value>
</Rate>
<PsnrY>
<Unit>dB</Unit>
<Value>36.0197</Value>
</PsnrY>
<PsnrU>
<Unit>dB</Unit>
<Value>39.5402</Value>
</PsnrU>
<PsnrV>
<Unit>dB</Unit>
<Value>41.1875</Value>
</PsnrV>
<Width>
<Value>832</Value>
</Width>
<Height>
<Value>480</Value>
</Height>
<Frq>
<Value>30</Value>
</Frq>
<NumFrms>
<Value>300</Value>
</NumFrms>
<FileInBitDepth>
<Value>10</Value>
</FileInBitDepth>
<ConfigInBitDepth>
<Value>10</Value>
</ConfigInBitDepth>
<ConfigOutBitDepth>
<Value>10</Value>
</ConfigOutBitDepth>
<QP>
<Value>27</Value>
</QP>
<EncTime>
<Unit>s</Unit>
<Value>34030.0</Value>
</EncTime>
<DecTime>
<Unit>s</Unit>
<Value>15.465</Value>
</DecTime>
<VMAF>
<Value>97.410912</Value>
<Unit>VMAFScore</Unit>
</VMAF>
<BitstreamMd5>
<Value>670e4034967b16e1a70f79f5ad90eeaa</Value>
</BitstreamMd5>
<DecodedYUVMd5>
<Value>9bd057235a281d6584d4730fbc977120</Value>
</DecodedYUVMd5>
<JobId>
<Value>6930182 on knecht21</Value>
</JobId>
</Logfile>
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<Logfile>
<Codec>
<Value>TMVTMBMS1_0_SimulationDecodeIPPE</Value>
</Codec>
<SeqName>
<Value>RaceHorsesL_832x480_30fps_10bit_420pf.yuv</Value>
</SeqName>
<Rate>
<Unit>kbps</Unit>
<Value>772.4480</Value>
</Rate>
<PsnrY>
<Unit>dB</Unit>
<Value>33.3292</Value>
</PsnrY>
<PsnrU>
<Unit>dB</Unit>
<Value>37.9919</Value>
</PsnrU>
<PsnrV>
<Unit>dB</Unit>
<Value>39.7510</Value>
</PsnrV>
<Width>
<Value>832</Value>
</Width>
<Height>
<Value>480</Value>
</Height>
<Frq>
<Value>30</Value>
</Frq>
<NumFrms>
<Value>300</Value>
</NumFrms>
<FileInBitDepth>
<Value>10</Value>
</FileInBitDepth>
<ConfigInBitDepth>
<Value>10</Value>
</ConfigInBitDepth>
<ConfigOutBitDepth>
<Value>10</Value>
</ConfigOutBitDepth>
<QP>
<Value>32</Value>
</QP>
<EncTime>
<Unit>s</Unit>
<Value>22444.0</Value>
</EncTime>
<DecTime>
<Unit>s</Unit>
<Value>9.243</Value>
</DecTime>
<VMAF>
<Value>87.602761</Value>
<Unit>VMAFScore</Unit>
</VMAF>
<BitstreamMd5>
<Value>5d378355957aacfed6c50ebf1ffbaad5</Value>
</BitstreamMd5>
<DecodedYUVMd5>
<Value>165e213537616e8b57841e8b24413421</Value>
</DecodedYUVMd5>
<JobId>
<Value>6930193 on knecht24</Value>
</JobId>
</Logfile>
Loading

0 comments on commit 30087a2

Please sign in to comment.