QTimeEdit widgets
See original GitHub issueHey @tlambert03
first of all: Happy New Year! š„³
I just programmed a magicgui-annotated function that has a time parameter (hh:mm:ss). When starting up the GUI, I receive this warning:
UserWarning: Unable to find the appropriate widget for function "_clearcontrol_loader", arg "time", type "<class 'datetime.time'>". Falling back to LiteralEvalEdit widget.
warnings.warn(
When entering a time then in the fallback QLineEdit field, this error shows up:
ERROR:root:Unhandled exception:
Traceback (most recent call last):
File "C:\Users\rober\miniconda3\envs\clustering\lib\site-packages\magicgui\core.py", line 526, in __call__
_kwargs = self.current_kwargs
File "C:\Users\rober\miniconda3\envs\clustering\lib\site-packages\magicgui\core.py", line 500, in current_kwargs
return {param: getattr(self, param) for param in self.param_names}
File "C:\Users\rober\miniconda3\envs\clustering\lib\site-packages\magicgui\core.py", line 500, in <dictcomp>
return {param: getattr(self, param) for param in self.param_names}
File "C:\Users\rober\miniconda3\envs\clustering\lib\site-packages\magicgui\core.py", line 96, in __get__
return api.getter_setter_onchange(widget).getter()
File "C:\Users\rober\miniconda3\envs\clustering\lib\site-packages\magicgui\_qt\widgets\eval_lineedit.py", line 12, in text
return literal_eval(super().text())
File "C:\Users\rober\miniconda3\envs\clustering\lib\ast.py", line 59, in literal_eval
node_or_string = parse(node_or_string, mode='eval')
File "C:\Users\rober\miniconda3\envs\clustering\lib\ast.py", line 47, in parse
return compile(source, filename, mode, flags,
File "<unknown>", line 1
1:00:00
^
SyntaxError: invalid syntax
My use case is quite specific: Iād like to select a defined timepoints from a larger dataset for loading and we image over multiple days with variable temporal resolution.
Nevertheless, I think supporting QTimeEdit as widget type would be cool.
Let me know if I can help making this happen.
No hurry btw. I do have a functional workaround for now.
Cheers, Robert
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
QTimeEdit Class | Qt Widgets 6.4.1
The QTimeEdit class provides a widget for editing times based on the QDateTimeEdit widget. More... Header: #include <QTimeEdit>. CMake: find_package(Qt6Ā ...
Read more >QTimeEdit Class | Qt Widgets | Qt Documentation (Pro) - Felgo
The QTimeEdit class provides a widget for editing times based on the QDateTimeEdit widget. Many of the properties and functions provided by QTimeEdit...
Read more >Qt 4.8: QTimeEdit Class Reference
The QTimeEdit class provides a widget for editing times based on the QDateTimeEdit widget. Many of the properties and functions provided by QTimeEdit...
Read more >QTimeEdit Class | Qt Widgets 5.12.3
The QTimeEdit class provides a widget for editing times based on the QDateTimeEdit widget. Many of the properties and functions provided by QTimeEdit...
Read more >QTimeEdit - Codetorial
The QTimeEdit widget allows users select and edit time. We'll create a QTimeEdit object in this example and set it to display as...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

yeah, sorry, it was a big change. v0.1.x was a great proof of principle, but I regretted a lot of things and now is the time to change. Things should start settling down now. in v0.2.1+ you can set min/max with
{'min': -1000, 'max': 1000}. After a little discussion, we chose to go with the ipywidgets API over the Qt API, to stick with the general python datascience vibe.In general, if youāre wondering what parameter/widget specific options you can use, you can look at the documentation for the constructor of the corresponding widget type. For instance, for your
floatvalues, youād be able to use any of the options for theFloatSpinBoxwidget (or, more generally, any of theRanged Widgets).We can gradually add back things like
displayFormatfor strings, orvalidatorsand stuff like that, but weāll do so in an explicit magicgui API way, rather than an implicit āpass to Qtā sort of way.Hey @haesleinhuepf! That should definitely be included and will be easy to do.
In the meantime, there is a DateTimeEdit widget if you annotate using
datetime.datetimeinstead ofdatetime.time(and deal with the annoyance of having the date in their as well)