Skip to content
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

Implement DateInput and TimeInput for Cocoa, GTK and iOS #1939

Open
LunaMeadows opened this issue May 11, 2023 · 6 comments
Open

Implement DateInput and TimeInput for Cocoa, GTK and iOS #1939

LunaMeadows opened this issue May 11, 2023 · 6 comments
Labels
enhancement New features, or improvements to existing features. iOS The issue relates to Apple iOS mobile support. linux The issue relates Linux support. macOS The issue relates to Apple macOS support.

Comments

@LunaMeadows
Copy link
Contributor

What is the problem or limitation you are having?

Currently there is no implementation for showing a calendar. It would be useful for at least 2 reasons and probably more.

1st reason would be allowing the user to select a specific date for the program to use.
2nd reason would be allowing the program to show a custom calender that the user could fill with their own events that may be useful inside a specific app instead of in the built in calender. An example would be a finance app that allows the user to specify when bills or subscriptions get billed easier.

Describe the solution you'd like

For Android there is 2 different widgets that can be used for each reason. For displaying a calender with events I believe that the CalenderView is the option that would be wanted. For selecting a date there is a date picker implementation already.

For Gtk there is only one widget for this. The Gtk.Calender allows for displaying a calendar and has the ability to add custom events as well as the ability to get the selected date. For a date picker implementation a custom window may need to be made similar to the error dialogs and such.

Describe alternatives you've considered

Not having a calender widget and having the user manually type in dates and making a custom view for dates and such.

Additional context

No response

@LunaMeadows LunaMeadows added the enhancement New features, or improvements to existing features. label May 11, 2023
@LunaMeadows
Copy link
Contributor Author

After further looking I did realize that there is already the start of a datepicker implementation, just not documented in on the readthedocs yet.

@freakboy3742
Copy link
Member

DatePicker and TimePicker both exist in the Toga API; however, they're only implemented on Windows and Android. The lack of documentation is definitely an oversight; and we'd definitely like to fill this out with GTK, iOS, Cocoa and Web implementations.

@LunaMeadows
Copy link
Contributor Author

I can see about the GTK implementation. My question there is since a custom widget may need to be made, is there anything with GTK already that would be appropriate to take inspiration from to create it?

Also for web I can look into it as well. If shoelace is still the wanted framework it looks like there has been a discussion about an implementation of this so I can go from there for an implementation maybe.

@LunaMeadows
Copy link
Contributor Author

Actually, after looking at it a popover would probably be the best option for a date and time picker for GTK

@rmartin16
Copy link
Member

Adding error that happens when you try to use DatePicker on GTK for search seo.

Traceback (most recent call last):
  File "/home/russell/github/beeware/toga/examples/date_and_time/build/date_and_time/pop/jammy/date_and_time-0.0.1/usr/lib/date_and_time/app_packages/toga_gtk/app.py", line 98, in gtk_startup
    self.interface.startup()
  File "/home/russell/github/beeware/toga/examples/date_and_time/build/date_and_time/pop/jammy/date_and_time-0.0.1/usr/lib/date_and_time/app/date_and_time/app.py", line 21, in startup
    toga.DatePicker(
  File "/home/russell/github/beeware/toga/examples/date_and_time/build/date_and_time/pop/jammy/date_and_time-0.0.1/usr/lib/date_and_time/app_packages/toga/widgets/datepicker.py", line 43, in __init__
    self._impl = self.factory.DatePicker(interface=self)
AttributeError: module 'toga_gtk.factory' has no attribute 'DatePicker'

@mhsmith
Copy link
Member

mhsmith commented Jun 19, 2023

This error message will be improved in #1992.

And in the next version of Toga:

  • DatePicker and TimePicker will be renamed to DateInput and TimeInput, for consistency with the other widgets.
  • Both widgets will be documented.

@mhsmith mhsmith changed the title Calendar Widget Implement DateInput and TimeInput for Cocoa, GTK and iOS Jun 19, 2023
@mhsmith mhsmith added iOS The issue relates to Apple iOS mobile support. linux The issue relates Linux support. macOS The issue relates to Apple macOS support. labels Jun 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features, or improvements to existing features. iOS The issue relates to Apple iOS mobile support. linux The issue relates Linux support. macOS The issue relates to Apple macOS support.
Projects
None yet
Development

No branches or pull requests

4 participants