Wish list for next release
For an update 2.1, I would very much like the ability to assign (unused) keyboard shortcuts (e.g. command+Q on an external keyboard) to script shortcuts (under the wrench, as one of the options for edit shortcut, similar to icon).
That way, you could make the editor fit your own taste :-)
I am not sure it @computable still monitors this forum https://forum.omz-software.com/topic/888/more-python-for-ipad-on-the-way/5
@ccc I sent him an email also. I'm assuming he does not, because that's his only post.
@Olaf that's an awesome suggestion, great idea.
@Olaf I don't have a keyboard to test with, but this should be possible in objc by setting the keyCommands on the SharedApplication, or perhaps the specific view controllers. Maybe someone with an ext kb and some objc knowledge can pipe in.
@JonB I have a bluetooth keyboard handy. This would, however be good for a built-in feature. I don't think saying "You can do it with
objc_util" should become a replacement for actually implementing it in the app.
Try running this, which adds a command-h shortcut, which simply prints hi to the console.
(if there is already a command-h shortcut, just change the 'h' on line 27 to some other unused character)
This is not very clean, and might not survive globals clears, and should not be run multiple times, but is more of a proof of concept. If it works, it would be easy to extend to something cleaner (ps this shows an example of swizzling, though in a not very safe manner)
Thanks, @JonB, but it doesn't work. I got an AttributeError on line 20:
No method found for selector "initWithInput:modifierFlags:action:"
UIKeyCommand.keyCommandWithInput_modifierFlags_action_and the script will run.
@JonB The script runs after above modification. But it seems to have no effect. Any ideas? It would be super awesome to get this script working.
Ok, I see the issue... we need to use class_addMethod to add a method to the UIApplication, then the action would be a selector. Apparantly I didn't actually read the docs! I think I can have a fix a little latrr tonight
sorry to hijack the wishlist thread... custom keyCommands discussion is now here
A unary minus for the Vector2 class would have been nice:
>>> import scene >>> v = scene.Vector2(1, 2) >>> v * -1 Vector2(-1.00, -2.00) >>> -v Traceback (most recent call last): File "<string>", line 1, in <module> TypeError: bad operand type for unary -
And the next beta build linked against the GameController network. We can test if it solves the problem by using the objc module.
TableView with more than a single column
PLEASE bring back the Export Canvas to Photos button (from the console); can't even find a function to copy canvas to clipboard so I can use a startup script with code like photos.save_image(clipboard.get_image()).
Argh. Now I regret updating.(Only me?)
Additional to @Oscar's unary minus, it would be nice if scene.Vector2 supported:
- unary plus
from __future__ import division(now breaks division by scalar)
- initiation from another vector (and more generally any sequence of length 2) for generic code
- polar coordinates (like
In 1.5 you could tweak this, but no longer in 2.0 as it's a built-in now
@ExParrot yes, only you. I find that most canvas stuff can be done with
ui.Pathand then exported as an image using the appropriate
Interactive notifications with the notifications module (for those that don't know what I'm talking about, swipe down on the notification next time you get a text from the Messages app.
Not a big issue. But would be nice have the console.set_color method updated or another method added to handle the console colors with more grace.
Maybe I missed something as usual, but after getting a json object from the web with css color names and hex values, I did this
conv = ui.parse_color(v) console.set_color(conv, conv, conv)
Maybe I missed something. But went looking for this as it appears that faker is also not up to date. Faker has a fake.color method in the latest version. The Pythonista version does not have it.
But anyway, would be nice to see console colors supported with single calls instead of what I did above. If it is already, sorry. I did read the docs and try. (Admittedly, I rarely use console colors, just for debugging)
Edit: v in script is a hex string
After working a bit with the UI editor I would suggest adding these features:
- Provide a view type which can serve as placeholder for a subview which is defined in another pyui file. This way you could easily re-use subviews.
- Allow several items in a view to be simultaneously selected, cut and inserted into another view. This would make refactoring view a LOT easier.
- Provide the icon for the action menu while the UI editor is active. Otherwise I always have to switch to a tab with a Python script before I can start my app using an action icon.