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.
dialogs list can not be scroll down when it was present from detail_button
-
I dont have an answer, but I have obervered lists In dialog module not being able to scroll. It has been intermittent though, and wasn't sure if I was doing something wrong or not. So I have not reported it btw, I am on the latested beta. In my case I was not using wait modal myself, simply presenting a list dialog. I was also passing a list of dicts, not using the image key, just title and accessory_type. I am pretty sure I had the problem in the code share I did the other day.
Anyway, just some more info to help figure out what is going on. You can see in my example share code, I am not doing anything tricky at all. -
@cvp @Phuket2
Thanks for your help!
Exactly, if I comment wait_modal for dialogs list(test-3), the dialogs list(test-3) can be scroll down. Unfortunately, I want to do some refreshing job after the view is colsed.
It is weird even I do not comment wait_modal:- dialogs list(test-2) can be scroll down in iOS 10.x~11.x;
- dialogs list(test-3) can be scroll down in iOS10.x;
-
@ado, I also just ran your code on the App Store version of Pythonista on ios10.x, it worked as it should have, meaning scrolling was working on all dialogs.
So this appears to be an ios11.x problem. I will create an issue on the Pythonista git hub issue tracker. -
@Phuket2 Not sure the problem occurs only from ios11, I think I already met it before...
But, unfortunately, not always reproductible. -
@ado Try this
import ui import dialogs class _new_ListDialogController(dialogs._ListDialogController): def __init__(self, title, items, multiple=False, done_button_title='Done'): self.items = items self.selected_item = None self.view = ui.TableView() self.view.name = title ds = ui.ListDataSource(items) ds.action = self.row_selected ds.accessory_action = self.accessory_action self.view.data_source = ds self.view.delegate = ds self.view.frame = (0,0,500,500) def row_selected(self,ds): if self.view.name == 'test-1': list_dialog(title='test-2', items=['item-2']) elif not self.view.allows_multiple_selection: self.selected_item = self.items[ds.selected_row] self.view.close() #.......... put here your code after closing.......... return def accessory_action(self,ds): list_dialog(title='test-3', items=['item-3']) def list_dialog(title='', items=None, multiple=False, done_button_title='Done'): global n c = _new_ListDialogController(title, items,multiple, done_button_title) d = 60 c.view.frame = (n*d,n*d,500-n*d,500-n*d) # to see the title bar... n = n + 1 c.view.present('sheet') #c.view.wait_modal() return c.selected_item global n n = 0 list_dialog('test-1',items=[{'title':'item-1','accessory_type':'detail_button'}])
-
-
I would suggest that the accessory/select actions be @ui.in_backgrounded, so that control returns to the main thread and those functions exit.
list_dialog might then need to be on_main_thread'd, not sure -- or maybe if you need the result, you would call another function...
i.edef another_function(): result=list_dialog('test-3',items=['test3']) do_something(result) @ui.in_background def accessory_action(sender) another_function() @on_main_thread def list_dialog(...
You could consider refactoring so that a callback function is called, rather than using wait_modal.
A third option, is to use navigatinviews, and push a new dialog into the nav view.I suspect there are problems when you have multiple nested wait_modals.
-
@JonB agree, that’s what I called “imbricated” in my poor English 😅
-
I found new weird:
After I tap the detail_button of a item which is belong dialogs list(test-1), dialogs list(test-3) is popup. As the description in first post, dialogs list(test-3) can not be scroll down.
But if I tap any row in dialogs list(test-3), dialogs list(test-2) is popup as expected. Then I close the dialogs list(test-2) to get back dialogs list(test-3), dialogs list(test-3) can be scroll down now. -
I'm almost sure the problem comes from several wait_modal active together...