TabBar

Need help, or want to share a macro? Post here!
pablogil
Posts: 505
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: TabBar

Postby pablogil » Fri Jun 03, 2016 3:02 pm

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
Posts: 609
Joined: Thu Jul 09, 2015 9:34 am

Re: TabBar

Postby easyw-fc » Mon Jun 13, 2016 10:20 pm

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

Re: TabBar

Postby triplus » Mon Jun 13, 2016 11:18 pm

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
Posts: 609
Joined: Thu Jul 09, 2015 9:34 am

Re: TabBar

Postby easyw-fc » Tue Jun 14, 2016 7:07 am

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

Re: TabBar

Postby triplus » Wed Jun 15, 2016 11:25 am

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.
pablogil
Posts: 505
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: TabBar

Postby pablogil » Tue Jul 19, 2016 11:04 am

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 691 times

tabbar_style_horizontal.png
tabbar_style_horizontal.png (127.58 KiB) Viewed 691 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
Posts: 4866
Joined: Mon Dec 12, 2011 4:45 pm

Re: TabBar

Postby triplus » Tue Jul 19, 2016 12:31 pm

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.
pablogil
Posts: 505
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: TabBar

Postby pablogil » Tue Jul 19, 2016 2:04 pm

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

Re: TabBar

Postby triplus » Sat Mar 18, 2017 9:30 pm

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.