Launcher

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Launcher

Post by triplus »

Launcher.png
Launcher.png (23.63 KiB) Viewed 4840 times
Objective: Provide Launcher functionality for FreeCAD (as macro/module).

Code repository:

https://github.com/triplus/Launcher

Reference: viewtopic.php?f=8&t=13429
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Launcher

Post by triplus »

On completion run the selected command
  • Run as single instance (Dock Widget)
  • Apply some sensible defaults
  • Remove & sign from command names
  • Filter out commands that can't be reliably detected
  • Detect and delete any potential commands with the same name
  • Create and fill standard model with command items (icon, text and tooltip)
  • Custom QLineEdit behavior (focus from pop-up menu) for better Launcher efficiency
  • Update model data whenever Launcher widget gets focus or when return key is pressed
  • Commands are always visible in completer menu (enabled/disabled state is respected)
  • Changing workbench is supported (for workbenches that are not disabled in Customize Workbenches)
Launcher.png
Launcher.png (28.36 KiB) Viewed 4755 times
P.S. Currently when changing workbench through Launcher focus in or return key must be pressed to update the data.
emills2
Posts: 884
Joined: Tue Apr 28, 2015 11:23 pm

Re: Launcher

Post by emills2 »

that looks awesome :D my keyboard is much nicer to my wrists than my mouse.

I wouldn't mind making this take over shortcuts automatically. hit shortcut letter, launcher pops up, shortcut command is first option, hit enter for shortcut or keep typing to search other commands.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Launcher

Post by triplus »

emills2 wrote:that looks awesome :D my keyboard is much nicer to my wrists than my mouse.
Thanks!
I wouldn't mind making this take over shortcuts automatically. hit shortcut letter, launcher pops up, shortcut command is first option, hit enter for shortcut or keep typing to search other commands.
Thanks for your suggestion. I guess it could be done but after evaluating (my opinion can still change in the future) i feel Launcher is more suited for the purpose of searching for the commands. Shortcut (if set) i guess should run the command directly when triggered.

But your suggestion did made me think more about shortcuts and FreeCAD. When i help users out on the forum and by following debates among developers shortcuts are often mentioned. That is on how to provide good default experience for FreeCAD users. What i decided to do is to (try to) give additional possibility to the end users. That is to have an overview and the possibility to configure FreeCAD shortcuts manually. As i guess the scope is different i created separate thread. For whoever is interested can follow the progress here:

viewtopic.php?f=22&t=15638#p124333
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Launcher

Post by triplus »

Autoupdate and language fixes and improvements
  • Fix string encoding issue when non-English language is used
  • Automatically update the model data when changing workbench trough Launcher
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Launcher

Post by triplus »

Changelog:
  • Added docstrings
  • Small code restructuring and improvements
  • Increased completer maximum command number to 16
  • Always update model data when command is triggered
  • Show all available commands when down key is pressed
  • Added empty SVG icon for commands without icon (improved item layout behavior)
KeyDown.png
KeyDown.png (45.39 KiB) Viewed 4498 times
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Launcher

Post by HoWil »

Hi Triplus,

looks like this a very useful tool!
I would like to access the input of Launcher with a shortcut like "Ctrl-Space" but I could not find any thing under 'Tools->Costumize'. Did I miss something? I is a shortcut pre-set?

BR,
HoWil
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Launcher

Post by triplus »

HoWil wrote:Hi Triplus,

looks like this a very useful tool!
I would like to access the input of Launcher with a shortcut like "Ctrl-Space" but I could not find any thing under 'Tools->Costumize'. Did I miss something? I is a shortcut pre-set?

BR,
HoWil
Hi @HoWil.

Currently there is no shortcut available for this. You need to click in Launcher edit area yourself to set the focus. I could explore this option but introducing shortcut in FreeCAD isn't easy as all the sensible ones are already used for something else.

P.S. Qt 5 enables me to explore and likely to add one additional small feature in straightforward fashion. And when i will get to implementing this i will think about if it makes sense to add (optional) keyboard shortcut support for the Launcher.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Launcher

Post by triplus »

Hi @HoWil.

I added the ability to assign shortcut for Launcher. Can you please test it and see how it goes.

P.S. To assign shortcut uncomment the (setShortcut) line at the end or use ShortCuts and assign Global shortcut for the Launcher entry.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Launcher

Post by triplus »

Default Ctrl+Shift+Q key combination can now be used to set Luncher focus.

P.S. To set custom key combination use ShortCuts module.
Post Reply