Skip to content

Commit

Permalink
feat: implement log viewer and fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Feb 12, 2020
1 parent a696c1d commit 2577250
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
0.7.0
- feat: implement log viewer (accessible via integrity check)
- setup: bump dclab from 0.20.7 to 0.20.8 (fix regression when
opening tdms files without "area_msd" feature)
- build: DCKit 0.6.0 falsely required dclab 0.20.6
0.6.0
- feat: implement joining of datasets (#4)
- setup: bump dclab from 0.20.6 to 0.20.7
Expand Down
23 changes: 23 additions & 0 deletions dckit/dlg_icheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ def populate_ui(self):
cue.msg)
self.textEdit.setText(text)

# Logs
with dclab.new_dataset(self.path) as ds:
if ds.logs:
for log in ds.logs:
self.comboBox_logs.addItem(log, log)
else:
self.widget_logs.hide()
self.comboBox_logs.currentIndexChanged.connect(self.on_logs)

def check(self, use_metadata=True, expand_section=True):
if use_metadata:
metadata_dump = json.dumps(self.metadata, sort_keys=True)
Expand Down Expand Up @@ -141,6 +150,20 @@ def get_metadata_value(self, section, key):
value = self.metadata[section][key]
return value

def on_logs(self):
log = self.comboBox_logs.currentData()
if log is None:
return
dlg = QtWidgets.QDialog()
dlg.setWindowTitle("{}: {}".format(self.path.name, log))
path_ui = pkg_resources.resource_filename("dckit", "dlg_log.ui")
uic.loadUi(path_ui, dlg)
dlg.label.setText(log)
with dclab.new_dataset(self.path) as ds:
text = "\n".join(ds.logs[log])
dlg.plainTextEdit.setPlainText(text)
dlg.exec_()

def save_current_metadata(self):
for sec in self.user_widgets:
for key in self.user_widgets[sec]:
Expand Down
38 changes: 36 additions & 2 deletions dckit/dlg_icheck.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>477</width>
<height>520</height>
<height>566</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -46,7 +46,7 @@
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Log of full check</string>
<string>Messages</string>
</property>
</widget>
</item>
Expand All @@ -57,6 +57,40 @@
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_logs" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Logs</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_logs">
<item>
<property name="text">
<string>Please select...</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
Expand Down
81 changes: 81 additions & 0 deletions dckit/dlg_log.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>582</width>
<height>543</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>name of log</string>
</property>
</widget>
</item>
<item>
<widget class="QPlainTextEdit" name="plainTextEdit">
<property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
long_description=open('README.rst').read() if exists('README.rst') else '',
install_requires=[# pin DCKit to a specific version of Shape-Out and dclab
"shapeout==1.0.0",
"dclab[all]==0.20.6",
"dclab[all]==0.20.8",
"h5py>=2.8.0",
"pyqt5",
],
Expand Down

0 comments on commit 2577250

Please sign in to comment.