Skip to content

Commit

Permalink
Merge pull request #938 from zariiii9003/fix_880
Browse files Browse the repository at this point in the history
Fix AttributeError: 'WindowsPath' object has no attribute 'configure'
  • Loading branch information
danielhrisca authored Nov 6, 2023
2 parents f70acfd + cd19c38 commit 601c4c5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/asammdf/gui/dialogs/advanced_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from traceback import format_exc

from natsort import natsorted
from PySide6 import QtCore, QtWidgets, QtGui
from PySide6 import QtCore, QtGui, QtWidgets

from ...blocks.utils import extract_xml_comment
from ..ui.search_dialog import Ui_SearchDialog
Expand Down
20 changes: 11 additions & 9 deletions src/asammdf/gui/widgets/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,26 +857,30 @@ def _as_mdf(self, file_name):
mdf = cls(file_name).export_mdf()

elif suffix in (".mdf", ".mf4", ".mf4z"):
mdf = file_name
mdf = MDF(file_name)

else:
raise ValueError(f"Incompatible suffix '{suffix}'")

return mdf

def _prepare_files(self, files=None, progress=None):
count = self.files_list.count()

if files is None:
files = [Path(self.files_list.item(row).text()) for row in range(count)]
files = [Path(self.files_list.item(row).text()) for row in range(self.files_list.count())]

count = len(files)
progress.signals.setMaximum.emit(count)
progress.signals.setValue.emit(0)
progress.signals.setWindowTitle.emit("Preparing measurements")

mdf_files = []
for i, file_name in enumerate(files):
progress.signals.setLabelText.emit(f"Preparing the file {i+1} of {count}\n{file_name}")
files[i] = self._as_mdf(file_name)
mdf = self._as_mdf(file_name)
mdf_files.append(mdf)
progress.signals.setValue.emit(i + 1)

return files
return mdf_files

def _get_filtered_channels(self):
iterator = QtWidgets.QTreeWidgetItemIterator(self.filter_tree)
Expand Down Expand Up @@ -1067,8 +1071,6 @@ def update_channel_tree(self, *args):
file_name = source_files[0]

mdf = self._as_mdf(file_name)
if not isinstance(mdf, MDF):
mdf = MDF(mdf)

try:
widget = self.filter_tree
Expand Down Expand Up @@ -1381,7 +1383,7 @@ def apply_processing_thread(self, progress):
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/filter.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
progress.signals.setWindowIcon.emit(icon)
progress.signals.setWindowTitle.emit(f"Filtering measurement {mdf_index+i} of {count}")
progress.signals.setWindowTitle.emit(f"Filtering measurement {mdf_index + 1} of {count}")
progress.signals.setLabelText.emit(f'Filtering selected channels from\n"{source_file}"')

# filtering self.mdf
Expand Down

0 comments on commit 601c4c5

Please sign in to comment.