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.
tableview_did_select
-
@Appletrain put @ui.in_background just before the def
@ui.in_background def tableview_did_select(self, tableview, section, row):
-
@cvp, cool!
But then I do not really understand why ui.delay and the button action handler worked, as they are both run on the main UI thread, as is
tableview_did_select
. -
@mikael I don't understand too but I often (not always) meet this problem.
The problem comes from the wait_modal in the dialog, it doesn't wait sometimes -
-
@stephen I think it is something like that..
-
This post is deleted! -
@mikael @cvp @Appletrain sorry about post miss-hap.. i found this to work. but it bypasses dialogs module..
import ui class DataSource(object): def __init__(self, items): self.items=items def tableview_cell_for_row(self, tableview, section, row): # Create and return a cell for the given section/row cell = ui.TableViewCell() cell.text_label.text = self.items[row] return cell def tableview_number_of_sections(self, tableview): # Return the number of sections (defaults to 1) return 1 def tableview_number_of_rows(self, tableview, section): # Return the number of rows in the section return len(self.items) class TV: def __init__(self): self.menu_one_options = ['Banana', 'Orenge', 'Grape'] self.menu_two_options = ['happy', 'days', 'are', 'here', 'again'] frame=(0, 0, 200, 600) self.selected='' self.tv1 = ui.TableView(frame=frame) self.tv1.name='menu-one' self.tv1.delegate = self self.tv1.hidden=False self.tv1.data_source = DataSource(self.menu_one_options) self.tv1.present('sheets') self.tv2 = ui.TableView(frame=frame) self.tv2.name='menu-two' self.tv2.delegate = self self.tv2.hidden=True self.tv2.data_source = DataSource(self.menu_two_options) def tableview_did_select(self, tableview, section, row): if not self.tv1.hidden: self.selected += tableview.data_source.items[row] + ' ' self.tv1.hidden=True self.tv2.present('sheets') self.tv2.hidden=False elif not self.tv2.hidden: self.selected += tableview.data_source.items[row] print (self.selected) self.tv2.hidden=True self.tv1.close() self.tv2.close()
-
-
@cvp 😅😅 oops
-
Thank you all. @ui.in_backround solved it.
-
@Appletrain youpee