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_select
-
I’ve written a custom input form sub-classed from input form dialog. It works fine stand alone. It also works fine when called from a button on my tableview form. When I call it from tableview select, it blows out. Somehow container_view becomes None. I’ve tried everything I can think of, including calling the button action. Any thoughts?
-
@Appletrain, have you tried decorating the
tableview_selected
method with@on_main_thread
? -
-
@Appletrain, can you share your stripped-out code?
-
@mikael, this is about as stripped out as I can make it
def tableview_add(self): trxRec = {} result = {} # trxRec = {'account': self.selected_account} result = bucks_dialog(trxRec) # this works def tableview_update(self): result = {} trxRec = {} # trxRec = self.selected_item result = bucks_dialog(trxRec) # this blows out - self.container_view changes to None def tableview_did_select(self, tv, section, row): self.tableview_update() def transaction_action(sender): # sender is ui.button sender.tint_color = 'blue' ds.tableview_add()
Bucks_dialog is a custom form_dialogs from dialogs
Error is:
Pythonista3/Documents/Projects/bucks/bucks_form.py", line 217, in trans_type_action
self.container_view.name = segment_names[ind]
AttributeError: 'NoneType' object has no attribute 'name'self.container_view is none (form_dialog)
-
@Appletrain, sorry, my faulty memory. You need to decorate the method with
@ui.in_background
. This will mean that you do not get the method return value in the same thread, so you need to set the tableview values within the backgrounded method, or look at this thread. -
@mikael, thank you, that took care of it. I had tried that, but I put it at the update function not the select function.