-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from nodedge/feature/dats
Feature/dats
- Loading branch information
Showing
22 changed files
with
1,229 additions
and
37 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"Workbook1": { | ||
"Worksheet1": [ | ||
{}, | ||
{} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import logging | ||
from typing import Optional | ||
|
||
import pandas as pd | ||
from asammdf import MDF | ||
from PySide6.QtCore import Signal | ||
from PySide6.QtWidgets import QListWidget, QListWidgetItem, QMessageBox | ||
|
||
|
||
class LogsListWidget(QListWidget): | ||
logSelected = Signal(object) | ||
|
||
def __init__(self, parent=None): | ||
super().__init__(parent) | ||
|
||
self.logs = {} | ||
|
||
self.itemClicked.connect(self.onItemClicked) # type: ignore | ||
|
||
def addLog(self, filename) -> Optional[MDF]: | ||
shortname = filename.split("/")[-1] | ||
extension = shortname.split(".")[-1] | ||
shortname = shortname.split(".")[0] | ||
|
||
log: MDF | ||
if extension.lower() == "mf4": | ||
log = MDF(filename) | ||
elif extension.lower() == "csv": | ||
df = pd.read_csv(filename) | ||
|
||
log = MDF() | ||
|
||
log.append(df) | ||
else: | ||
logging.warning("Cannot open this extension") | ||
return None | ||
|
||
startTimeStr = log.start_time.strftime("%Y/%m/%D, %H:%M:%S") | ||
shortname = f"[{startTimeStr}] {shortname}" | ||
|
||
if shortname in list(self.logs.keys()): | ||
msgBox = QMessageBox() | ||
msgBox.setText("The log has already been loaded.") | ||
msgBox.setIcon(QMessageBox.Warning) # type: ignore | ||
msgBox.exec() | ||
return log | ||
|
||
self.logs.update({shortname: log}) | ||
item = QListWidgetItem(shortname) | ||
item.setToolTip(startTimeStr) | ||
self.addItem(item) | ||
|
||
self.logSelected.emit(log) # type: ignore | ||
self.setCurrentItem(item) | ||
|
||
return log | ||
|
||
def onItemClicked(self, item): | ||
self.logSelected.emit(self.logs[item.text()]) # type: ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from PySide6.QtWidgets import QPushButton, QVBoxLayout, QWidget | ||
|
||
from nodedge.dats.logs_list_widget import LogsListWidget | ||
|
||
|
||
class LogsWidget(QWidget): | ||
def __init__(self, parent=None): | ||
super().__init__(parent) | ||
|
||
self.layout = QVBoxLayout() | ||
self.layout.setContentsMargins(1, 1, 1, 1) | ||
self.layout.setSpacing(1) | ||
self.logsListWidget = LogsListWidget() | ||
self.layout.addWidget(self.logsListWidget) | ||
self.openButton = QPushButton("Open") | ||
self.layout.addWidget(self.openButton) | ||
|
||
self.setLayout(self.layout) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from pyqtgraph import PlotDataItem | ||
from PySide6.QtGui import QMouseEvent | ||
|
||
|
||
class NPlotDataItem(PlotDataItem): | ||
def __init__(self, *args, **kargs): | ||
super().__init__(*args, **kargs) | ||
|
||
def mouseClickEvent(self, ev: QMouseEvent): | ||
super().mouseClickEvent(ev) | ||
|
||
def setData(self, *args, **kargs): | ||
super().setData(*args, **kargs) |
Oops, something went wrong.