Skip to content

Disable time format if we don't have a measurement date #175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 29, 2023

Conversation

mscheltienne
Copy link
Member

Don't allow "T" shortcut if we don't have a measurement date.

Traceback:

TypeError                                 Traceback (most recent call last)
File ~\pyvenv\mscheltienne\eeg-flow\lib\site-packages\pyqtgraph\graphicsItems\AxisItem.py:654, in AxisItem.paint(self, p, opt, widget)
    652 if self.style["tickFont"]:
    653     painter.setFont(self.style["tickFont"])
--> 654 specs = self.generateDrawSpecs(painter)
    655 profiler('generate specs')
    656 if specs is not None:

File ~\pyvenv\mscheltienne\eeg-flow\lib\site-packages\pyqtgraph\graphicsItems\AxisItem.py:1100, in AxisItem.generateDrawSpecs(self, p)
   1098 if tickStrings is None:
   1099     spacing, values = tickLevels[i]
-> 1100     strings = self.tickStrings(values, self.autoSIPrefixScale * self.scale, spacing)
   1101 else:
   1102     strings = tickStrings[i]

File ~\git\mne-tools\mne-qt-browser\mne_qt_browser\_pg_figure.py:509, in TimeAxis.tickStrings(self, values, scale, spacing)
    507 tick_strings = list()
    508 for val in values:
--> 509     val_time = datetime.timedelta(seconds=val) + \
    510                first_time + meas_date
    511     val_str = val_time.strftime('%H:%M:%S')
    512     if int(val_time.microsecond):

TypeError: unsupported operand type(s) for +: 'datetime.timedelta' and 'NoneType'

@larsoner larsoner merged commit c912752 into mne-tools:main Jun 29, 2023
@larsoner
Copy link
Member

Thanks @mscheltienne !

@mscheltienne mscheltienne deleted the fix-time-format branch June 29, 2023 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants