Launcher

Need help, or want to share a macro? Post here!
triplus
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Launcher

Postby triplus » Sun May 01, 2016 9:27 pm

Launcher.png
Launcher.png (23.63 KiB) Viewed 2748 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
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: Launcher

Postby triplus » Fri May 06, 2016 6:08 pm

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 2663 times
P.S. Currently when changing workbench through Launcher focus in or return key must be pressed to update the data.
emills2
Posts: 631
Joined: Tue Apr 28, 2015 11:23 pm

Re: Launcher

Postby emills2 » Fri May 06, 2016 6:24 pm

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
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: Launcher

Postby triplus » Sat May 07, 2016 6:04 pm

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
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: Launcher

Postby triplus » Wed May 11, 2016 1:25 pm

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
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: Launcher

Postby triplus » Mon Aug 15, 2016 12:51 pm

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 2406 times
HoWil
Posts: 1199
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Launcher

Postby HoWil » Tue Feb 07, 2017 9:03 pm

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
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: Launcher

Postby triplus » Wed Feb 08, 2017 11:12 am

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
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: Launcher

Postby triplus » Wed Feb 08, 2017 1:15 pm

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
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: Launcher

Postby triplus » Mon Jun 04, 2018 10:43 am

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

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