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 , 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 :)
-
0.0.11 released (git & pip):
- two shortcuts modified
Ctrl-Shift-B
added for clear annotations & pyflakes (Analyze)
P.S. Did want to use
Cmd-Shift-B
(Xcode sync), but it's already used in Pythonista for toggle breakpoint.WARNING I did release the package via PyPI as well, but StaSh pip doesn't see it. Thinking what should I do with this :)
-
@zrzka , i am still using git pull. Working great. Ctrl-shift-b working perfectly!
I am going to add an issue to the Pythonista github issues about the hud display delay for 'check style' and 'Analyse'. I feel its twice the time it should be. Depends what @omz thinks. It does not deserve its own param setting in my view (more important things). Can live with what it is now, but seems to me that the hud should be shown for half the time. -
@Phuket2 This HUD delay you're talking about, do you mean HUD delay when you do use
Ctrl Shift B
or when you do use Wrench - Analyze / Check Style action item? If you're talking about the first case (viaCtrl Shift B
), then the delay is 1.0s. Check analyzer.py, lines 72 & 99. I do not emulate tapping on these items, nor using these action items from my script. I have customanalyzer.py
module which usespyflakes
directly. So, it's a completely independent implementation. -
@zrzka , yes i agree. It's different. I was talking about when you select from the wrench menu. But i did think it affected your code also, but I can see now it does not. I guess you felt the same, the time was to long.
-
re pythonista version check in latest version... I wonder if it would make more sense to check for conflicting shortcuts. Then just enable the ones that are free.
-
@JonB basically I see two issues here:
Pythonista version
This check is here, because:
- Pythonista UI can be changed (-> associated function will not work in case that the function emulates UI touching)
- What if dependent module will be removed?
- What if behaviour of some modules will be modified?
- Can imagine many more worse scenarios than these two.
It's just safety measure, nothing more. Will not happen probably, but who knows. I can change it in this way:
- Write red warning to the console
- Continue, but warn user that it's a risk and can lead to data loss (Pythonista crash, ...)
Keyboard shortcuts
I see this as another issue. What I can do in the
keyCommands
:- If there's Pythonista key command with the same shortcut, disable Black Mamba key command and write a warning to the console.
- Or add a settings to change this behavior (which one has higher priority).
- Or add a way how to modify default Black Mamba keyboard shortcuts.
Low hanging fruit is the first one for now.
-
@JonB first issue (Pythonista version) fixed in the
master
(not released yet). Second one (shortcuts) is in the category no need to do anything. I just tested it ...keyCommands
method is called zillion times and it must be blazingly fast. So, I'm just concatenating two lists. Just tried to filter BM key commands there and experienced significant slow down of Pythonista. Almost unusable even on the latest and biggest iPad available. No way to do it here. Slow down wasn't here just because of filtering only, but some print statements, ... -> no way.Issue is that I have no idea what key commands Pythonista provides, because original
keyCommands
does return different set of shortcuts. Depends on where I am (what's open in Pythonista). I can't filter out key commands in advance -> no way.Anyway, I just tried to assign same shortcut for one of my commands to test what will happen. Found that the first command in the array is used by the iOS - HUD, functionality, ... In other words, when Black Mamba registers command with some shortcut which is already provided by the Pythonista, Pythonista one will be used automatically, because I'm concatenating Black Mamba key commands at the end of the key commands list.
-
@zrzka Seems like it should be possible to call keyCommands in advance (at startup), for a few of the main viewControllers, to see what is provided. IIRCthe little keycommand swizzle technique we have been using swizzles the root view controller, so it is last in line. It would technically be possible to swizzle down at a particular view controller, say, to have commands in the editor, and different commands in the console.
But, point taken, that if ole changes the structure of the app, then things break if you are trying to be too clever. -
@JonB that's what I initially did want to achieve with scope (removed) - to have different set of shortcuts for the editor, console, ... I will eventually put it back, because we have lot of commands now and I'm accidentally closing editor files when I hit Cmd W in the console for example :)