Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Calendar View Class
-
I created a class called CalendarView. You can download from Github at sanit/pythonista/calview.py. Please feel free to modify the code.
-
@sanit , hey thanks for sharing. I have done similar things, but I don't know when to stop, so I don't finish 😱 I am stupid this way. But what you have done is nice and works.
But I hope you don't mind, I would like suggest a few things.I think the biggest suggestion is to have your class CalendarView inherit from ui.View. Then handle the drawing of your buttons inside the layout method. It's a little bit of refactoring, but I think it would be a lot more programmer friendly. Maybe you had a different idea. But if you inherit from ui.View, your class can be added as subview to other views.
But for this to work out well, you need to implement the layout method and move your positioning code into that method.
Another observation, is that the arrow keys for the month navigation might be better placed on the left and right margins of your view.
You could also change your month/year label to a button to bring up a ui.DatePicker to do big navigation jumps. -
Just to give an idea, I put here in a gist
needs more work to be done, but still a few changes. I tagged the changed lines with #here -
MonthView is the ten lines or less version. It is not nearly as cool as your code but there are limits to what you can achieve in just ten lines.