Forum Archive

ui: random error

JadedTuna

I've ran my application and got this error (see screenshot). Running my program again just crashed the Pythonista.

I've been expecting such issues for a while now. Probably some problems with the new UI module? Or maybe some bug in the module loading?

The Code:

import ui

view = ui.View()

table = ui.TableView()
table.flex = "WH"
table.data_source = ui.ListDataSource(["tableview.py", "items"])

nav = ui.NavigationView(table)
nav.flex = "WH"

view.add_subview(nav)
view.present("sheet")

Screenshot:

randomgalaxy.com/programming/python/forums/omz-pythonista/ui-problem.png

JonB

I can't reproduce the error with the posted code.
Then again, for me the above code doesn't allow one to delete a row, because of the flex settings on the nav view. (Never can see the delete button). If I remove that line I'm able to delete at will.

You should be able to check if your ListDataSource does indeed have a delete_enabled. If not... Maybe do a dir, perhaps it is not the class you think it is.
Perhaps you accidentally monkey patched ListDataSource elsewhere in your code?

JadedTuna

@JobB, no I haven't and I am sure about that. After I restarted Pythonista (it actually crashes) it ran just fine. And I had simular errors before, just popping up without any reason.