TabBar

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
pablogil
Posts: 881
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: TabBar

Post by pablogil »

triplus wrote:Improved workbench activation detection

- Improved workbench activation detection (issue reported by pablogil))
- Bar mode: option to enable/disable selector menu
- Bar mode: option to move selector menu to the end
- ToolBar mode: option to move selector menu to the end
- ToolBar mode: Quick Menu and Selector button now follow set style (Icon and text, Icon, Text)
- Don't set workbench QAction object name (avoid duplicates)
- Changed Toolbar preferences selector menu button default menu pop-up mode
Cool!
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here
User avatar
easyw-fc
Veteran
Posts: 3629
Joined: Thu Jul 09, 2015 9:34 am

Re: TabBar

Post by easyw-fc »

triplus wrote:Qt uses toolbar object name itself to identify toolbars.
Hi @triplus
I found that in your TabBar macro you have this code:

Code: Select all

def singleInstance():
    from PySide import QtGui

    mw = FreeCADGui.getMainWindow()
    if mw:
        for i in mw.findChildren(QtGui.QDockWidget):
            if i.objectName() == "TabBar":
                i.deleteLater()

singleInstance()
to allow only a single instance of TabBar...

is there a way to list the QWidget windows names?
if i.e. there is this QWidget open
http://www.freecadweb.org/wiki/index.ph ... w_Rotation
is there a way to list its name and avoid a multiple instance?
thanks
Maurice
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: TabBar

Post by triplus »

Replace the last line:

Code: Select all

rotate = rotate_gui()
With this:

Code: Select all

def singleInstance():
    app = QtGui.qApp

    for i in app.topLevelWidgets():
        if i.objectName() == "MacroViewRotation":
            i.deleteLater()
        else:
            pass

singleInstance()

rotate = rotate_gui()
rotate.setObjectName("MacroViewRotation")
User avatar
easyw-fc
Veteran
Posts: 3629
Joined: Thu Jul 09, 2015 9:34 am

Re: TabBar

Post by easyw-fc »

triplus wrote:Replace the last line:
Code: Select all
rotate = rotate_gui()
With this:
it works like a charm!

thanks a lot! :D

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

Re: TabBar

Post by triplus »

easyw-fc wrote:
triplus wrote:Replace the last line:
Code: Select all
rotate = rotate_gui()
With this:
it works like a charm!

thanks a lot! :D

Maurice
You're welcome.

P.S. As for the TabBar development status update. Currently i am investing free time in achieving first release of the PieMenu. After i will finish the mentioned and already started work on the TabBar.
User avatar
pablogil
Posts: 881
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: TabBar

Post by pablogil »

Hi @triplus,

I had finally time to finish a default style for your TabBar, it may combine perfectly with almost any FreeCAD stylesheet or with any default OS style.
Right now I'm using it but placing the code inside a stylesheet, it would be nice if you can include it inside the widget and apply it as an addition to the style that user has selected.
Some examples:
tabbar_style_vertical.png
tabbar_style_vertical.png (352.47 KiB) Viewed 2896 times
tabbar_style_horizontal.png
tabbar_style_horizontal.png (127.58 KiB) Viewed 2896 times
The only element that I feel like it impossible to match with the user selected stylesheet or OS style is the one that set the active workbench, that is QToolBar#TabBar QToolButton:checked so I think it would be very smart if you add color and background-color for that element inside TabBar Preferences so that people can freely set it as they want to, is that possible and loadable?

Well, here you have the code:

Code: Select all

/*==================================================================================================
TABBAR widget stylesheet (by Pablo Gil)
==================================================================================================*/
QToolBar:horizontal#TabBar,
QToolBar:vertical#TabBar {
    background-color: rgba(0,0,0,120);
    margin: 0px;
    padding: 0px;
}

QToolBar::handle:top#TabBar,
QToolBar::handle:bottom#TabBar,
QToolBar::handle:horizontal#TabBar {
    alignment: bottom left;
}

QToolBar::handle:left#TabBar,
QToolBar::handle:right#TabBar,
QToolBar::handle:vertical#TabBar {
    width: 100%;
    alignment: center left;
}

QToolBar:top#TabBar QToolButton,
QToolBar:bottom#TabBar QToolButton,
QToolBar:horizontal#TabBar QToolButton {
    alignment: bottom left;
}

QToolBar:left#TabBar QToolButton,
QToolBar:right#TabBar QToolButton,
QToolBar:vertical#TabBar QToolButton {
    alignment: center left;
}

QToolButton[toolbar_orientation="horizontal"] {
    /* nothing, when Horizontal there's no need to add special parameters */
}

QToolButton[toolbar_orientation="vertical"] {
    width: 100%;
}

QToolBar#TabBar QToolButton {
    border: none;
    margin: 0px;
    padding: 2px 6px;
    border-radius: 0px;
}

QToolBar#TabBar QToolButton:checked {
    color: white;
    /* if default background color doesn't contrast or if you want to add your preferred one */
    /*background-color: red;*/
}

QToolBar#TabBar QToolButton:!checked {
    background-color: transparent;
    margin: 0px;
}

QToolBar#TabBar QToolButton:!checked:hover {
    background-color: rgba(255,255,255,20);
}

QToolBar#TabBar QToolButton:!checked:pressed {
    background-color: rgba(255,255,255,40);
}
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: TabBar

Post by triplus »

Hi @pablogil and thanks for taking the initiative and for the effort.

The current plan is to make first release of PieMenu working on all supported platforms. After to create first release of persistent toolbars. After TabBar will be developed further. This hasn't been decided yet but i feel i could create separate project just for the selector toolbar in the future and to remove this feature from TabBar. About the style i will probably use it one way or another and will get back to you after development on TabBar will start again and i will evaluate the options.
User avatar
pablogil
Posts: 881
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: TabBar

Post by pablogil »

Great, I will stay tunned ;)
I find a good idea to turn workbench selector a standalone widget as it, by itself, is so useful and self explanatory (if naming it something like "workbench tab").

Meanwhile I will enjoy your work with Pie Menu which you already know I'm also very interested on :)
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: TabBar

Post by triplus »

When it comes to finalizing TabBar development. It will happen in 2 phases.

Phase 1:

Move some of the TabBar functionality into standalone modules:
  • Selector toolbar
  • Command panel
  • Autoload
Phase 2:

Remove mentioned functionality from TabBar and simplify the remaining TabBar code base. To finish all of the toolbar related things on my todo list i started with selector toolbar.
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: TabBar

Post by HoWil »

Hi triplus,
Thanks for this fresh, interesting and new interface.
I tested it and have some suggestion:
* An option to turn all toolbars (outside tabbar) for all workbenches at the same off. I had to go through all wbs and turn toolbars (in selector menu... not sure ... Toolbars ->Off)
* in Draft wb some of the toolbars resist against swichting them off. E.g. 'Draft snap' I select them to hide as mentioned above and after swichting to another wb and back they are again visiblle.
* How about Separators to visually group the filled in toolbars. Otherwise I am lost in to many equally visualized icons. Maybe I did not used it right.
* Is it possible to use this in fullscreen, like autohide it on the upper edge of the screen? Would be really nice :!:
BR,
HoWil
Post Reply