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.
Customizing of dialogs form
-
Hello everyone!
I'm new to Pythonista but already love it.I have a one simple question about dialogs module:
is it possible to customize the form_dialog window? (I suppose that ui module need to be changed - if so, how can I find it?)The question was caused by the fact that I use Pythonista on my Ipad mini. The default form_dialog width is a little bit small and not all of my inputs fit fields and they need scrolling to check them.
-
@dadedu , I think the right answer is that it would not be super simple if you are new to Pythonista. But if you hit the DIALOGS tag in your post, you will see a list of posts some that talk about accessing the internals of Dialogs.
I am not trying to be unhelpful, but there are discussions about this. I would say an easier way would be just to write your own ui.View. Maybe it does not sound easier, but I think it is. Basically you will create a uiView, create a ui.TableView and add it as a subview to the view. Then you would configure the ui.TableView attributes and add a datasource. Pythonista has a build in easy to use datasource, called ui.ListDataSource. These are basically the building blocks for Dialogs. You can also read the code for dialogs.py, somewhere in the site-packages directory. -
Try this (myform_dialog copied from original form_dialog), that's only a quick example.
import ui import dialogs def myform_dialog(title='', fields=None,sections=None, done_button_title='ok'): global c sections = [('', fields)] c = dialogs._FormDialogController(title, sections, done_button_title=done_button_title) c.container_view.frame = (0, 0, 500,900) c.container_view.present('sheet') c.container_view.wait_modal() # Get rid of the view to avoid a retain cycle: c.container_view = None if c.was_canceled: return None return c.values fields = [{'title':'title','type':'text','value':''}] f = myform_dialog(title='dialog title', done_button_title='ok',fields=fields, sections=None)
-
@cvp thank you very much for your reply, it is exactly what I needed.
I have slightly adjusted it for my needs using Pythonista's ui view doc.@Phuket2 thank you too for your reply. I'll keep it in mind for the future
-
@dadedu , no problems. I had an idea it was like @cvp response. It's been a while. But I am sure it works for you. If you understand the code then no problems, but if it's a magic answer then I still say better to write your own dialog. Will give you the fundamentals of the ui module as well using a ui.Table etc. then the funny thing as soon as you write it and understand it, then you probably would just use @cvp's solution ;)
-
I agree, it was just a quick sample.
Personnally, I often write my own dialog with images, map view, etc...