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.
Black Mamba - open quickly and other shortcuts
-
@zrzka, sorry. I cant see what I am doing wrong. I have done this a few times so all your cmds are not there. But I think you can see from the printout below, the site-packages-3 dir is empty before I do the clone. Bu you can see I only end up with a single folder in the site-packages-3 dir after the clone.
I cant see what I am doing wrong[site-packages-3]$ pwd
~/Documents/site-packages-3
[site-packages-3]$ ls -la[site-packages-3]$ git clone https://github.com/zrzka/pythonista-site-packages-3.git
[site-packages-3]$ ls -la
pythonista-site-packages-3 (256.0B) 2017-08-12 15:39:32
[site-packages-3]$ -
I had probably older StaSH. Did update StaSH and you're right, now
git clone
behaves correctly. So the clone command is:git clone https://github.com/zrzka/pythonista-site-packages-3.git .
(<- space dot at the end)
-
@zrzka , perfect, works great. Thanks for your help. You might want to make a note in your installation instructions about the trailing period. I can see you changed it, but this would trip up newbies like me.
-
Done :) More updates later, going to take week off :)
-
@zrzka , ok. Enjoy. Thanks again.
-
cool,perfect,thanks.
and wish @omz next pythonista update can support it native.
-
@zrzka, hey. I know you are off right now, hope you are having a good break. But when you return could you consider having a (dedicated) key combo (cmd-something) that you can apply to invoke a given wrench menu item. Eg. Maybe the user could pass the name of the wrench item name as a param in the bm.start('StaSh'). I guess it could also be a .py filename. Although that seems a bit more on the wild side. Maybe you have some better ideas than that.
I also mention dedicated, because I think it would get infinitely more complicated to let users to map their own keys.
Anyway thanks again, still only a day or so with what you have done so far and its very useful for me with the Apple iPad Pro keyboard. -
@Phuket2 thanks for the suggestions.
Open Quickly
I would like to reuse Open Quickly dialog (when I refactor it) for:
- Run Quickly (search for just
.py
and run it, basically emulation of open and tapping on play), - Wrench Quickly, same idea, but you can search for wrench items.
UI for mapping keys
I'm not going to provide UI for mapping keys, because it's a lot of work, which can be replaced with something more simpler. I can remove HW shortcuts registration from
bm.start
, can provide something likebm.register_default_key_commands
. And if you don't call this function in yourpythonista_startup.py
file, feel free to map your own shortcuts viabm.register_key_command
. Or call it and add your own afterbm.start()
.Shortcut for the wrench item
Just do this in your
pythonista_startup.py
file:#!python3 import blackmamba.startup as bm import blackmamba.key_commands as bkc import blackmamba.uikit as bui def launch_wrench_item(name): print('Wrench item: {}'.format(name)) def launch_stash(): launch_wrench_item('StaSh') bm.start() bkc.register_key_command( bkc.PYTHONISTA_SCOPE_EDITOR, 'S', bui.UIKeyModifierCommand | bui.UIKeyModifierShift, launch_stash, 'Launch StaSh')
This maps
Cmd-Shift-S
tolaunch_stash
, where you can do whatever you want :) - Run Quickly (search for just
-
Some breaking changes pushed. Check Usage section in the readme. Summary:
external_screen.py
moved toblackmamba/experimental
blackmamba/startup.py
trashedregister_default_key_commands
introduced inblackmamba/__init__.py
- removed scope in
blackmamba/key_commands.py
- usage examples updated
- repository renamed (
pythonista-site-packages-3
->blackmamba
)
If you don't want to check all these changes, just update your
pythonista_startup.py
content:#!python3 import blackmamba as bm bm.register_default_key_commands()
-
@zrzka , hey thanks. The git pull worked perfectly. Thanks for your help to get it setup correctly. Makes a huge difference being able to do that. I haven't added my own keys yet, but will put some thought into it. I am always running 'Check Style' and 'Reformat Code' these days so I am guessing, i just need to find these scripts and run them from function stubs like you do with the hallo example. Anyway, will give it a go later.
Thanks again. This is really fantastic with an external keyboard. I am sure a lot of other apps would be envious of this ability.Oppps, sorry, I missed the post above this...Looks like the wrench keys have been handled. That's great. I will try them now!!!!
-
@Phuket2 wrench item(s) are not handled yet. It's just silly example how to print smth with keyboard shortcut. I'll try to add run script / wrench item today. Then you'll be able to use it.
-
@zrzka , ok. Cool. I had a lame attempt to get it working and started going down a rabbit hole. But for me it will be a big help. Esp the check styles/reformat code. @ccc has beaten me with a big stick so I don't dare to push anything anymore until I have done all the checks :) I find it super annoying and time consuming. But I am happy I am staring to take the time to do things properly. Just a matter of time it will become second nature.
Ok, will keep a look out for the next update :) -
@Phuket2 I did refactor my picker, thus I was able to add Run Quickly... (Cmd Shift R) and Wrench Quickly... (Cmd Option R). But it does work only and only if scripts are Python 3 compatible. Otherwise you can run them, but they will fail to execute. See another thread for more info. Sorry for this, will try to solve it somehow.
It's useless for StaSh (Python 2) and maybe for many more scripts.
-
@Phuket2 works now, but it's kinda limited. See this commit.
-
Another update ...
wrench_picker
renamed toaction_picker
Wrench Quickly...
renamed toAction Quickly...
with new shortcutCmd-Shift-A
ide.run_action
added (see example below)- slight Action Quickly... UI improvements
- title is custom title or just script name without extension if title is not provided
- subtitle is script path
... and here's an example how to register custom shortcut to launch StaSh for example ...
#!python3 import blackmamba as bm from blackmamba.key_commands import register_key_command from blackmamba.uikit import * # UIKeyModifier* import blackmamba.ide as ide bm.register_default_key_commands() def launch_stash(): ide.run_action('StaSh') # <- editor action custom title, case sensitive # or ide.run_script('launch_stash.py') register_key_command('S', UIKeyModifierCommand | UIKeyModifierShift, launch_stash, 'Launch StaSh...')
ide.run_action
accepts editor action custom title and it's case sensitive. Another option is to ignore editor actions and use justide.run_script
with script name. -
Another installation method added (StaSh & Pip). Check readme. This is preferred way to install Black Mamba. The old git way still works and will work.
-
Hmm, StaSh & pip & GitHub doesn't support update. Hmm.
-
Okay, managed to create PyPI package. So, it's installable via:
cd ~/Documents pip install blackmamba -d site-packages-3
But there's an issue with XML RPC and PyPI, see issue #264. So far, the workaround is to change line number 899 in the
site-packages/stash/bin/pip.py
file from ...hits = self.pypi.package_releases(pkg_name, True) # True to show all versions
... to ...
hits = self.pypi.package_releases(pkg_name, False)
This fixes the pip issue. Or at least, it looks like it does.
-
I give up smoking last night and changed to vamping instead. Maybe this was not a good week to do that :)
-
For those who are using
git
, feel free to pull:Basically did add more complex sample pythonista_startup.py (readme) and ability to set which folders are ignored in Run/Open Quickly... dialogs. Now going to figure out how to publish PyPI package on iPad, left MBP at home for two days :)