hide palettes? [SOLVED]

Please use this forum to post feedback and suggestions related to QCAD.

Moderator: andrew

Post Reply
tkyler
Junior Member
Posts: 21
Joined: Thu Jan 26, 2023 2:54 pm

hide palettes? [SOLVED]

Post by tkyler » Tue Jul 02, 2024 3:58 pm

If this is implemented already I apologize. I did search the forums first :)

I'd recommend a feature to 'hide palettes', leaving only the drawing window. The image editor GIMP does this using the TAB key, which I'm not suggesting would be the key to use, but it is 'one-keystroke' handy. I tend to keep four palettes open at right and so to get my screenspace when on my laptop, currently hit "GP GL GY GB"...which is not terribly, but not as convenient as a single stroke when the mind is really moving.

If there's a key-assignable script solution? I'd certainly welcome that as well.

This has benefit for laptop work to maximize drawing screenspace...and for heavily keystroke driven apps, is quite ideal.

Just putting this out there for an already exceptional software product!

-TomK
Last edited by tkyler on Mon Jul 08, 2024 5:46 am, edited 1 time in total.

CVH
Premier Member
Posts: 4958
Joined: Wed Sep 27, 2017 4:17 pm

Re: hide palettes?

Post by CVH » Wed Jul 03, 2024 3:10 am

tkyler wrote:
Tue Jul 02, 2024 3:58 pm
I'd recommend a feature to 'hide palettes', leaving only the drawing window.
They are called Widgets.
So the goal is to toggle: GP, GL, GY and GB with one shortcut key ...

Had a look inside the beginEvent handlers of 3 of these widgets and a script solution should be possible.
We can assign a QKeySequence, but the available options become increasingly scarce with each update.

GL is an issue because that is no longer open source.
What with GV, GF and GC ?

Regards,
CVH

tkyler
Junior Member
Posts: 21
Joined: Thu Jan 26, 2023 2:54 pm

Re: hide palettes?

Post by tkyler » Sat Jul 06, 2024 1:56 pm

Thx CVH,

Are you asking my thoughts on GV, GF and GC?

If so, I do not typically use those widgets with the frequency of the four mentioned above.

....but from a 'design' point of view, I'd think that all the widgets should be encompassed in such a feature, so the design goal would be to "toggle all widget visibilities" (G[x]) with some keystroke. I also prefer the tool matrix to the CAD tools toolbar...so that is probably something I'd desire to include in the 'toggle visibility" keystroke.

TK

CVH
Premier Member
Posts: 4958
Joined: Wed Sep 27, 2017 4:17 pm

Re: hide palettes?

Post by CVH » Sat Jul 06, 2024 5:18 pm

Hi,

It required some tweaking, some educated guesses ... :lol:

The code below will toggle all off with the variable visible set to false
But the problem is that it doesn't record what was visible or not.
It is kinda flying blind, hiding or showing everything (GP, GY, GB, GF, GV, GL, GC).
GM and GS are not turned on/off.

Code: Select all

    var visible = false;
    var appWin = RMainWindowQt.getMainWindow();
    var dock;
    var ga;

    // Property Editor (GP):
    // Functional copy of PropertyEditor.prototype.beginEvent:
    dock = appWin.findChild("PropertyEditorDock");
    if (!isNull(dock)) {
        dock.visible = visible;
        if (dock.visible) dock.raise();
        // Functional copy of PropertyEditor.prototype.finishEvent:
        ga = RGuiAction.getByScriptFile("scripts/Widgets/PropertyEditor/PropertyEditor.js")
        ga.setChecked(visible);
    }
    else {
        EAction.handleUserWarning("PropertyEditorDock not found");
    }

    // Layer List (GY):
    // Non functional copy of LayerList.prototype.beginEvent:
    // # Issue # Probably functional in QCAD CE
    // QCAD Pro: Layer List (GY):
    // Educated guess for beginEvent:
    dock = appWin.findChild("LayerListProDock");
    if (!isNull(dock)) {
        dock.visible = visible;
        if (dock.visible) dock.raise();
        // Educated guess for finishEvent:
        ga = RGuiAction.getByScriptFile("scripts/Pro/Widgets/LayerListPro/LayerListPro.js");
        ga.setChecked(visible);
    }
    else {
        EAction.handleUserWarning("LayerListProDock not found");
    }

    // Block List (GB):
    // Functional copy of BlockList.prototype.beginEvent:
    dock = appWin.findChild("BlockListDock");
    if (!isNull(dock)) {
        dock.visible = visible;
        if (dock.visible) dock.raise();
        // Functional copy of BlockList.prototype.finishEvent:
        ga = RGuiAction.getByScriptFile("scripts/Widgets/BlockList/BlockList.js");
        ga.setChecked(visible);
    }
    else {
        EAction.handleUserWarning("BlockListDock not found"); 
    }

    // QCAD Pro: Selection Filter (GF):
    // Educated guess for beginEvent:
    dock = appWin.findChild("SelectionFilterDock");
    if (!isNull(dock)) {
        dock.visible = visible;
        if (dock.visible) dock.raise();
        // Educated guess for finishEvent:
        ga = RGuiAction.getByScriptFile("scripts/Pro/Widgets/SelectionFilter/SelectionFilter.js");
        ga.setChecked(visible);
    }
    else {
        EAction.handleUserWarning("SelectionFilterDock not found");
    }

    // QCAD Pro: View List (GV):
    // Educated guess for beginEvent:
    dock = appWin.findChild("ViewListDock");
    if (!isNull(dock)) {
        dock.visible = visible;
        if (dock.visible) dock.raise();
        // Educated guess for finishEvent:
        ga = RGuiAction.getByScriptFile("scripts/Pro/Widgets/ViewList/ViewList.js");
        ga.setChecked(visible);
    }
    else {
        EAction.handleUserWarning("ViewListDock not found");
    }

    // QCAD Pro: Library Browser (GL):
    // Educated guess for beginEvent:
    dock = appWin.findChild("LibraryBrowserDock");
    if (!isNull(dock)) {
        dock.visible = visible;
        if (dock.visible) dock.raise();
        // Educated guess for finishEvent:
        ga = RGuiAction.getByScriptFile("scripts/Pro/Widgets/LibraryBrowser/LibraryBrowser.js");
        // Try non-Pro for older installations:
        if (isNull(ga)) {
            ga = RGuiAction.getByScriptFile("scripts/Widgets/LibraryBrowser/LibraryBrowser.js");
        }
        ga.setChecked(visible);
    }
    else {
        EAction.handleUserWarning("LibraryBrowserDock not found");
    }

    // QCAD Pro: ClipBoard Display (GC):
    // Educated guess for beginEvent:
    dock = appWin.findChild("ClipboardDisplayDock");
    if (!isNull(dock)) {
        dock.visible = visible;
        if (dock.visible) dock.raise();
        // Educated guess for finishEvent:
        ga = RGuiAction.getByScriptFile("scripts/Pro/Widgets/ClipboardDisplay/ClipboardDisplay.js");
        ga.setChecked(visible);
    }
    else {
        EAction.handleUserWarning("ClipboardDisplayDock not found");
    }
# EDIT #
Figured out the methods for the CAD Toolbar and the Tool Matrix:

Code: Select all

    var appWin = EAction.getMainWindow();
    var tb;
    var dock;

    // CAD Toolbar:
    tb = appWin.findChild("CadQToolBar");
    if (!isNull(tb)) {
        tb.visible = true;
    }
    else {
        EAction.handleUserWarning("CadQToolBar not found");
    }
    
    // Tool Matrix:
    dock = appWin.findChild("ToolMatrixDock");
    if (!isNull(dock)) {
        dock.visible = true;
    }
    else {
        EAction.handleUserWarning("ToolMatrixDock not found");
    }
Now it is the question of including the code in 2 QCAD Addons with a proper keyboard shortcut ...
Perhaps hiding all but only showing GP, GL, GY and GB ...
GA ... Active or GD ... Display and GO ... Off are seemingly still available.

That can really be based on something minimal:
https://github.com/qcad/qcad/blob/maste ... Minimal.js
The functional part must be included in the beginEvent.
In the init section we need to include:

Code: Select all

action.setDefaultShortcut(new QKeySequence("g,o"));
Some higher sortorder may be in order.

Regards,
CVH

CVH
Premier Member
Posts: 4958
Joined: Wed Sep 27, 2017 4:17 pm

Re: hide palettes?

Post by CVH » Mon Jul 08, 2024 2:27 am

Tom,

Have a look at this contribution:
https://www.qcad.org/rsforum/viewtopic. ... 253#p45253

It is not that hard to implement Addons into QCAD.
Just create the required folder structure, copy over files and restart QCAD.

In essence it serves only a custom need.
QCAD is customizable and expandable by users, and these 2 tools cannot made so that they serve everyone's needs.
Already summing up all standard QCAD toolbars would be a bridge too far.

Regards,
CVH

tkyler
Junior Member
Posts: 21
Joined: Thu Jan 26, 2023 2:54 pm

Re: hide palettes?

Post by tkyler » Mon Jul 08, 2024 3:56 am

Thank you CVH!

It works wonderful and a great learning example! I tweaked it to my preferred visibilities and its really speeds my workflow on my laptop!

Thanks again!!

TomK

CVH
Premier Member
Posts: 4958
Joined: Wed Sep 27, 2017 4:17 pm

Re: hide palettes?

Post by CVH » Mon Jul 08, 2024 5:09 am

Glad to be of any assistance.
(What happened with 'after my vacation' :lol: )

Also meaning that it runs on OSX I presume.

Remark that it is intended for QCAD Pro.
If required then post a reply on the dedicated topic ... I'll see how lean I can make this for CE.

If considered as solved then please add [SOLVED] to the title by editing your initial post.

Regards,
CVH

tkyler
Junior Member
Posts: 21
Joined: Thu Jan 26, 2023 2:54 pm

Re: hide palettes?

Post by tkyler » Mon Jul 08, 2024 5:46 am

well I snuck in some time on the laptop when the wife wasn't looking to mess with it, I couldn't help it. :) This one is a luxury for when i'm on my laptop so I'm quite eager to get this going, being "on vacation".

I experimented a bit using a global bool in one of the scripts to toggle a 'global visibility' each time the script runs, i.e.

Code: Select all

var global_vis = true;

global_vis = !global_vis
Then in each block, I set the visibility to the global one and this allows me to toggle the widget visibilities ON/OFF with the same keystroke command.

It was just a quick test though and not at all thought through completely and Im' still green on the API so I have a bit more staring to do, there may be fallout I can't yet see. There's some calls in your code I'm not quite sure as to their purpose just yet, but its a great start to experimenting with the code.

TomK

CVH
Premier Member
Posts: 4958
Joined: Wed Sep 27, 2017 4:17 pm

Re: hide palettes? [SOLVED]

Post by CVH » Mon Jul 08, 2024 6:39 am

Tom,

Toggling all was not a preferable behavior.
I needed a baseline, a steady state, so I implemented it as 2 separate actions.
Hiding a set by preferences or displaying another set by preferences

These actions don't share variables by default ...

Take the case that the Clipboard, the Library Browser and the Matrix are hidden by default.
Toggling visibility of all widgets would then display them.

But it is perfectly feasible to add a third tool that toggles those and then again by preferences.
Seemingly GT is still available ... I'll see what I can come up with.
The tools won't interact but any combination of them can open up even more specific behavior.
tkyler wrote:
Mon Jul 08, 2024 5:46 am
There's some calls in your code I'm not quite sure as to their purpose just yet, but its a great start to experimenting with the code.
Send me an off-topic Private Message with any of your questions and I'll see if I can enlighten you.
See top-right on the forum or click on my user name.

Regards,
CVH

Post Reply

Return to “QCAD Suggestions and Feedback”