• Gcarver166

    I'm sorry to hear the sk module is going away. I've been having fun with it. Hope it's only temporary.

    posted in Pythonista read more
  • Gcarver166

    I do this by supplying a custom action for the ui element which overloads call(self, bnt): self.action(btn) to perform the action. Then I simply add whatever I need to this object and access it with the ui.action member.

    posted in Pythonista read more
  • Gcarver166

    I often use the copy module.
    import copy

    newobj = copy.copy(oldobj)

    posted in Pythonista read more
  • Gcarver166

    Misha, try setting new.alpha = 1

    posted in Pythonista read more
  • Gcarver166

    misha,
    regarding your issue.
    new = particle_tpl.copy() #does not correctly copy the physics body.
    new.physics_body = particle_tpl.physics_body.copy() #should fix your problem.

    posted in Pythonista read more
  • Gcarver166

    node.copy() does not copy the physics body correctly. The node copy points to a physics body but I think it's the same as the original. I have to manually make a copy.

    posted in Pythonista read more
  • Gcarver166

    I really think sk.Scene.update() should take a delta time parameter instead of assuming 16ms.

    posted in Pythonista read more
  • Gcarver166

    Still a bug: In one of my editor scripts I still get a row_height of -1 from a TableView. Now it actually seems to never be set. I'm manually setting it during init at the moment. I checked the value in did_load() and layout(). Btw my editor script presents a view. I get a -1 if run directly as well. I have reported this in previous versions of 1.6. The height worked in 1.5 but other issues prevented this script from working before.

    posted in Pythonista read more
  • Gcarver166

    Bug: I was adjusting the order of editor actions, moving the default ones to the bottom of the list. Suddenly only the last script in my list was available . I removed and readded mine (about 6) but still only the last one is available for selection. They still show up in the editor action list in settings though.

    posted in Pythonista read more
  • Gcarver166

    ui.TableView.row_height is still always -1.

    posted in Pythonista read more
  • Gcarver166

    Sorry to say any sleep amount still crashes. However commenting out the set_selection call removes the crash.

    posted in Pythonista read more
  • Gcarver166

    Here is my script that crashes unless I remove any reference to sel. So that's just a guess by me of the cause.

    import editor
    import os
    from time import sleep
     
    dbname = 'swap.txt'
     
    if __name__ == '__main__':
      fname = editor.get_path()
      sel = editor.get_selection()
       
      try:
        dbfile = open(dbname,'r')
        newf = dbfile.readline().strip() #strip off the newline character.
        poss = dbfile.readline()
        pos = int(poss)
        dbfile.close()
        editor.open_file(newf)
        sleep(0.5)  #wait a bit for the file to open.
        editor.set_selection(pos, pos)
      except:
        pass
     
      pos = 0 if sel == None else sel[0]
      data = [fname, '\n', str(pos)]
      dbfile = open(dbname,'w')
      dbfile.writelines(data)
      dbfile.close()
    

    posted in Pythonista read more
  • Gcarver166

    There does not seem to be a way to set a tint or background color to transparent in the ui editor's new color picker.

    posted in Pythonista read more
  • Gcarver166

    Selecting an action from the action menu closes the keyboard and clears the cursor position.
    I have a number of scripts that use editor.get_selection() that do not work correctly now as when they run this value is not set. I suspect this is also causing some of my scripts that use the selection to crash pythonista.
    Not to mention that it is annoying to have to re-open the keyboard after performing an action.

    posted in Pythonista read more
  • Gcarver166

    ui.TableView.row_height seems to always be -1 for me. This is new behavior. I can provide repro code if you need it.

    posted in Pythonista read more
  • Gcarver166

    I've updated my MazeCraze game to use the new ui system for it's options menu. Much much cleaner.

    https://gist.github.com/GuyCarver/4000630

    posted in Pythonista read more
  • Gcarver166

    In addition to the above, I also changed file creation in gistcheck.py and that correctly made the .pyui file.
    It'd be best if it only wrote .pyui files but it was just a test.

       #replacing with direct file write.
       #editor.make_new_file(filename, content)
       f = open(filename, 'w')
       f.write(content)
       f.close()

    posted in Pythonista read more
  • Gcarver166

    I created a script I added to my action menu that uses a TableView to show me a list of templates such as for loop, if statement, function definition etc. It runs ok and I can activate it continuously with no issues. However if I run it more than once and then use any of my other action scripts pythonista will lock up. If I run it only once the other scripts continue to work ok. I've stripped the script down and created a gist for it.

    https://gist.github.com/GuyCarver/d5da6f4b29a844a5865a

    I've attempted to determine exactly what may be causing the lockup with no success. I'm hoping there is a solution as being able to have actions use UI is very nice.

    Thanks

    posted in Pythonista read more
  • Gcarver166

    The lockup happens for me in any script that uses editor functions or console.input_alert. Most of my scripts modify the current file in some way and they all lock up. A hello world script works ok for me as well.

    posted in Pythonista read more
  • Gcarver166

    I Have TableView using a ListDataSource with an array of dict items containing the title, and accessory_type of detail_button.
    I am attempting to get the info button in my TableView to show some detail text. I need to set the text on the TableViewCell.detail_text_label.
    ListDataSource.accesssory_action is triggerred correctly but I can't find any way of getting the TableViewCell associated with the activated item. I've looked for them on the root view, the TableView, the ListDataSource and even on my array of ListDataSource items. I was sure the ListDataSource internally creates one of these cells for each of my items but I can't find them.

    Is there no way to get access the cells? Do I have to implement my own ListDataSource so I can call tableview_cell_for_row() to create and maintain my own list of TableViewCells?

    Thanks.

    posted in Pythonista read more
Internal error.

Oops! Looks like something went wrong!