• zinc

    WHOA! Thumbs UP! I didn't know about that, and sure enough, there it is. THANKS!

    posted in Pythonista read more
  • zinc

    I ran into this too-- I'm still logged on one computer, but I can't login on another because I forgot the password. Looks like I may be able to change my email address, but not sure that would help (thought maybe the one I used has a too strict spam filter or something, though I've checked the spam folder)...

    And I'm hesitant to try various possible passwords I may have used for fear it might disable the account...

    posted in Pythonista read more
  • zinc

    Works a champ, thanks!

    posted in Pythonista read more
  • zinc

    That looks like the right approach, but I’m using a TableView, not a View- when I try that approach with a TableView:

    class myTable(ui.TableView):
        def will_close(self):
            os.abort()
    
    

    It throws the error, “type _ui.TableView is not an acceptable base type”

    So, is there another way to override the TableView close, or will I need to create the TableView as a sub view of a parent view? I would have thought TableView inherits from View, but if that’s the case it’s not clear what I need to do different to make this work...

    posted in Pythonista read more
  • zinc

    Well, that works, but too good :-) The thing is, if I put it at the end of my script, it's not waiting for the tableview to be closed by the user, it aborts immediately.

    That tells me that the .present() is not blocking, but depends on something after the script exits to continue to process the tableview. And if I do a .wait_modal() on the tableview, it locks up because it's not getting the opportunity to process.

    So I tried decorating the .present with @ui.in_background and doing the .wait_modal in the foreground, but that didn't seem to work so well either.

    If I could override/delegate the close action on the tableview, I could put the os.abort() there and go ahead and exit the script as normal which would continue to process the tableview until the close occurs. But it's not clear if or how I can do that.

    Barring that, I tried to see if I could add a test for the active tableview object, but that requires logic that also interferes with the script exit which is clearly needed for the view to keep processing.

    The other thing I looked into is to see if there's some kind of call I could make in a polling loop, to keep the tableview processing while I wait for it to finish. Something like an application.processmessages() or application.doevents() that other systems have been known to use, a call to continue the UI event processing while I check for the tableview to go away. I looked into .update() to see if that would do it, but it didn't continue to process. Also, I had trouble determining if the tableview was still present, the object continues to exist once the view is closed by the user...

    I'd prefer overriding the tableview.close() but at this point, I don't know how to do either, trying to figure out what to do in the iOS/Pythonista context here...

    posted in Pythonista read more
  • zinc

    I wrote my last comment while you were posting yours-- that's an interesting looking example, stripped down to something not too huge that could be pretty interesting-- I could use it to display more than just the "key" column, and save the oversize column for the detail popup (my last column is a "notes" column where it can be anything from a null to a couple of sentences, to big to squeeze in a columnar format but the other columns would work nice in a grid like that...

    I also spotted some comments in the documentation that implied that if the data source is properly hooked up to the tableview, in an edit mode it could propagate the view changes back to the database? Or that is, could be made to do that. I'll have to look more into that as well...

    posted in Pythonista read more
  • zinc

    I think you understood-- but I realized that some of my content is too wide to fit that way, so I decided to have the initial tableview just display the "key" column, and then used mikael's suggestion of using tableview_did_select to pop up a list dialog with the details. That's now working great. That's probably enough for my immediate needs, though having it integrated with some kind of edit functionality of individual items would be a nice feature-- at the moment I've got a separate script that just prompts with input() and writes to the DB. Gets the job done but isn't particularly pretty. Fortunately, I don't need to add that often so I can live with it as a separate script, but it does give me some food for thought on how to integrate it with the data viewer.

    An edit feature would want to happen in the list dialog, and if that's not capable of doing it, I suppose it could be done by constructing my own list dialog from an additional popup table view, once I figure out how to do the edit. I probably don't need a delete, just an insert and an update operation. I see that tableview objects do support some form of editing. If you know of an example that demonstrates a tableview with edit capability (changing of row content, not just a delete), that would be educational and I could try it to see if it's the kind of thing that'll work for me.

    Barring that, I'll probably play around with an edit-enabled tableview and see how it behaves...

    Thanks for the tips gang...

    posted in Pythonista read more
  • zinc

    End up on the home screen.

    posted in Pythonista read more
  • zinc

    Information on this is scant, but I figured out how to create an IOS13.4 shortcut to run a script in pythonista. But when the script is done, it leaves me in the pythonista editor-- how do I get it to exit from pythonista when it's done?

    posted in Pythonista read more
  • zinc

    Hmm... some interesting examples, though pretty complex-- but thanks.

    The context menu with the delete is an interesting idea-- I didn't know it was there. It raises the question though, I presume that delete just deletes it from the view and not the underlying datasource. I'm populating the tableview from a SQLite DB, and I'd love it if I could actually edit the data in the tableview, whether that's deleting rows or adding them.

    The other question that has come up is that right now, I've just got a single string per row in the view, but the data has 4 columns. The example I found just concatenated individual strings together to make a "row" for the tableview, but given padding them to align columns is problematic the way the proportional font is displaying them, I'd actually like the tableview to have 4 cells across so that they would stay aligned, and if an edit was possible, would want that to be on a cell level... The delete could delete the entire row, but I don't know that any of this is within the scope of Pythonista and Tableviews. Seems to me, an event or callback triggered by an action on the tableview would be the easiest to work with, so if a delete event is done, I could then propagate the delete to the underlying database so that it's in sync with the view...

    At any rate, I'll stare at your examples, as I'm sure I'll be able to learn something there.

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!