Dark and Light FreeCAD stylesheets (v1.8a)

Info about new implemented features, classes, modules or APIs. Might get technical!
triplus
Posts: 4857
Joined: Mon Dec 12, 2011 4:45 pm

Re: Dark and Light FreeCAD stylesheets (v1.8a)

Postby triplus » Sun Jan 31, 2016 9:19 pm

Sounds good.
User avatar
bill
Posts: 156
Joined: Fri Jan 09, 2015 9:25 pm

Re: Dark and Light FreeCAD stylesheets (v1.8a)

Postby bill » Tue Feb 02, 2016 12:57 am

From what your pic post showed, id guess that was it. But i cant verify, since i will be out / gone for 30 days.
User avatar
easyw-fc
Posts: 604
Joined: Thu Jul 09, 2015 9:34 am

Re: Dark and Light FreeCAD stylesheets (v1.8a)

Postby easyw-fc » Thu Feb 25, 2016 12:08 pm

pablogil wrote:Updated to version 1.8a

Hi I tried this new feature on FC 0.16 windows latest and it is fine
Then I tried to open some GUI Macro e.g.
http://www.freecadweb.org/wiki/index.ph ... oneConvert
or my kicad StepUp tools macro
and all text/buttons are with a bad/bigger font dimension
I use custom font size 120%, but in my macro I set font size, which seems not to be respected by the stylesheet
Is there anything I should add to the macro to give more compatibility to Stylesheets?
Maurice

OS: Windows 8.1
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6458 (Git)
Build type: Release
Branch: master
Hash: f4b288fcf87b0fbca7a7b38abddf6fcdff95ad24
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
pablogil
Posts: 505
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: Dark and Light FreeCAD stylesheets (v1.8a)

Postby pablogil » Thu Feb 25, 2016 12:28 pm

easyw-fc wrote:
pablogil wrote:Updated to version 1.8a

Hi I tried this new feature on FC 0.16 windows latest and it is fine
Then I tried to open some GUI Macro e.g.
http://www.freecadweb.org/wiki/index.ph ... oneConvert
or my kicad StepUp tools macro
and all text/buttons are with a bad/bigger font dimension
I use custom font size 120%, but in my macro I set font size, which seems not to be respected by the stylesheet
Is there anything I should add to the macro to give more compatibility to Stylesheets?
Maurice

OS: Windows 8.1
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6458 (Git)
Build type: Release
Branch: master
Hash: f4b288fcf87b0fbca7a7b38abddf6fcdff95ad24
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17


Could you share a picture with me?
Could you also share a link to download your macro and try it out?

Thanks
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here
User avatar
easyw-fc
Posts: 604
Joined: Thu Jul 09, 2015 9:34 am

Re: Dark and Light FreeCAD stylesheets (v1.8a)

Postby easyw-fc » Thu Feb 25, 2016 1:27 pm

pablogil wrote:Could you share a picture with me?
Could you also share a link to download your macro and try it out?

no-stylesheet.png
no-stylesheet.png (53.86 KiB) Viewed 340 times

dark-stylesheet.png
dark-stylesheet.png (59.48 KiB) Viewed 340 times


you can find my macro at
https://sourceforge.net/projects/kicads ... t/download
the file is inside the demo prj
kicad-StepUp-tools.FCMacro
pablogil
Posts: 505
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: Dark and Light FreeCAD stylesheets (v1.8a)

Postby pablogil » Thu Feb 25, 2016 3:19 pm

I have just had a look to the macro in FreeCAD and the code: I think the problem is that your GUI is "fixed", I mean, you have placed the buttons at a exact point in the window while the normal way to layout a window is using other QT elements that serve as containers in order to finally let your buttons and stuff to dinamicaly flow depending on the window size.
This is part of your code:

Code: Select all

# RotateX button
        RotateX = QtGui.QPushButton('Rotate X', self)
        RotateX.clicked.connect(self.onRotateX)
        RotateX.setMinimumWidth(100)
        #RotateX.setAutoDefault(False)
        RotateX.move(130, 20)
        # RotateY button
        RotateY = QtGui.QPushButton('Rotate Y', self)
        RotateY.clicked.connect(self.onRotateY)
        RotateY.setMinimumWidth(100)
        #RotateY.setAutoDefault(False)
        RotateY.move(130, 60)
        # RotateZ button
        RotateZ = QtGui.QPushButton('Rotate Z', self)
        RotateZ.clicked.connect(self.onRotateZ)
        RotateZ.setMinimumWidth(100)
        #RotateZ.setAutoDefault(False)
        RotateZ.move(130, 100)

I know how to design a stylesheet using QT elements because it's quite similar than CSS (used for styling webs) but still don't know how C++ works and handle GUIs... anyway, I think it might be done using .ui files but I don't know how to do it. Check other macros which have a GUI window and get an idea from them...
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here
User avatar
easyw-fc
Posts: 604
Joined: Thu Jul 09, 2015 9:34 am

Re: Dark and Light FreeCAD stylesheets (v1.8a)

Postby easyw-fc » Thu Feb 25, 2016 4:28 pm

pablogil wrote:I have just had a look to the macro in FreeCAD and the code: I think the problem is that your GUI is "fixed", I mean, you have placed the buttons at a exact point in the window while the normal way to layout a window is using other QT elements that serve as containers in order to finally let your buttons and stuff to dinamicaly flow depending on the window size.

Hummm I don't think so...
I have the same prob with the Macro clone convert
http://www.freecadweb.org/wiki/index.ph ... oneConvert
no-stylesheet-cc.png
no-stylesheet-cc.png (14.19 KiB) Viewed 314 times

dark-stylesheet-cc.png
dark-stylesheet-cc.png (16.6 KiB) Viewed 314 times
ickby
Posts: 2428
Joined: Wed Oct 05, 2011 7:36 am

Re: Dark and Light FreeCAD stylesheets (v1.8a)

Postby ickby » Thu Feb 25, 2016 5:02 pm

No he is right, you explicitly place your widgets with move which is a very bad idea. Once somebody changes the font size or changes the desktop style this fails as shown here. You need to use layouts which automatically adopt the positions of your Widgets dependend in the needed and available sizes. To get a feeling for this you can play with qdesigner.
User avatar
easyw-fc
Posts: 604
Joined: Thu Jul 09, 2015 9:34 am

Re: Dark and Light FreeCAD stylesheets (v1.8a)

Postby easyw-fc » Thu Feb 25, 2016 5:09 pm

ickby wrote:Once somebody changes the font size or changes the desktop style this fails as shown here.

wrong, I set the font size inside the Macro
you can test that changing your interface fonts
I have this issues only on stylesheets
M
ickby
Posts: 2428
Joined: Wed Oct 05, 2011 7:36 am

Re: Dark and Light FreeCAD stylesheets (v1.8a)

Postby ickby » Thu Feb 25, 2016 5:16 pm

Ok than not with font sizes, i overlooked that, but Buttons and Widgets sizes are also defined by Styles which define Border sizes and spaces. And those Change between every Operating System and even between one Operating System where the User can choose styles, like kubuntu. This is Why basically every qt GUI Code uses layouts. And every gui included in freecad does so too, all dialogs, the Task Bar boxes etc. If you want Cross Platform and cross style compatibility you need to use then too.