Skip to content

Commit

Permalink
Make the set datetime feature work again
Browse files Browse the repository at this point in the history
  • Loading branch information
jaj42 committed Jun 19, 2020
1 parent 552f26f commit 71c7c52
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
7 changes: 3 additions & 4 deletions graphysio/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,11 @@ def chooseColor(self):


class DlgSetDateTime(ui.Ui_SetDateTime, QtWidgets.QDialog):
dlgdata = QtCore.pyqtSignal(object)

def __init__(self, parent=None, prevdatetime=None):
super().__init__(parent=parent)
self.setupUi(self)

self.dlgdata = None
self.btnOk.clicked.connect(self.ok)
self.btnCancel.clicked.connect(self.reject)

Expand All @@ -319,7 +318,7 @@ def ok(self):
time = self.edTime.time()
dt = QtCore.QDateTime(date, time, QtCore.Qt.UTC)
timestamp = dt.toMSecsSinceEpoch() * 1e6
self.dlgdata.emit(timestamp)
self.dlgdata = timestamp
self.accept()


Expand Down Expand Up @@ -431,7 +430,7 @@ def askUserValue(param):
elif param.request is datetime:
dlg = DlgSetDateTime()
isok = dlg.exec_()
value = dlg.result
value = dlg.dlgdata
elif type(param.request) is list:
value, isok = QtGui.QInputDialog.getItem(
None, 'Choose value', param.description, param.request, editable=False
Expand Down
15 changes: 7 additions & 8 deletions graphysio/plotwidgets/tsplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,14 @@ def setDateTime(self):
fstcurve = sortedcurves[0]
curtimestamp = fstcurve.series.index[0]
dlg = dialogs.DlgSetDateTime(prevdatetime=curtimestamp)

def cb(newtimestamp):
offset = newtimestamp - curtimestamp
for curve in self.curves.values():
curve.series.index += offset
curve.render()

dlg.dlgdata.connect(cb)
dlg.exec_()
newtimestamp = dlg.dlgdata
if not newtimestamp:
return
offset = newtimestamp - curtimestamp
for curve in self.curves.values():
curve.series.index += offset
curve.render()

def launchTransformation(self):
param = Parameter(
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = graphysio
version = 2020.06.16
version = 2020.06.19
author = Jona Joachim
author-email = [email protected]
home-page = https://github.com/jaj42/graphysio
Expand Down

0 comments on commit 71c7c52

Please sign in to comment.