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
-
@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 :)
-
@zrzka, I am not sure if you use the ui Designer or not. But a great addition would be if you were able to inc/decrement the x,y position fields and the width, height fields with the arrow keys or shifted combo of these keys. (I guess the trick, maybe doing that without changing the focus).
This could give keyboard positioning and sizing of objects in the ui Designer. Another nice addition would be a object cycling selection key like tab for example.
Sometimes i can be quite hard to select an object without resizing or moving it.Look I understand this may be way outside the scope of what you want to do. And it may not even be possible. But thought it was worth a mention. Never know unless you ask
-
@Phuket2 thanks for the suggestion. I was thinking about this as well and decided not to do it. Not that it's not possible, but it will use lot of Pythonista internals and even a minimal change from Ole can break it. Thus it will lead to maintenance hell.
Yes, I do use it and to be honest, it's a tough job sometimes. I'm talking about complicated UI. If it's simple, designer works perfectly. Agree it would be super useful to use [Shift] Tab for cycling and arrow keys for x, y and shift arrow keys for width, height. Also backspace to delete selected item.
Anyway, you should fill issues for all these ideas, so, that @omz will not miss them and they'll be eventually implemented.
-
@zrzka , thanks for the answer. I have posted these as issues on github recently. But i understand, for sure this better implemented by @omz. Not that i could do it myself, but I can imagine it could be quite brittle. I think @omz will address it. I am sure It's just about priorities.
Again thanks for getting back to me -
@zrzka, this maybe a crap suggestion but i am going to suggest it anyway :) What about a dedicated key combo for BM version check with an option to run the requests update script. It seems to make sense to me at least for now giving you are updating regularly. At first I was thinking about something in the startup script. I would not have a problem with that, but I think maybe others would. Anyway, food for thought.
Btw, i changed to using the requests install script. It did fix some problems i was having using the git pull. Same version. So seems to me that the git pull idea is dead.