[Solved] PyQt Question : Getting FreeCAD's System Font

Need help, or want to share a macro? Post here!
openBrain
Posts: 5748
Joined: Fri Nov 09, 2018 5:38 pm

Re: PyQt Question : Getting FreeCAD's System Font

Postby openBrain » Wed Mar 10, 2021 6:28 pm

melwynfranciscarlo wrote:
Sun Feb 21, 2021 11:03 am
That'd be great, openBrain! Thank you very much! :)
Kunda1 wrote:
Sun Feb 21, 2021 12:01 pm
That sounds fantastic!
A first draft is available here : https://github.com/0penBrain/FreeCAD-ma ... og.FCMacro
Still much to do (comment code, fix bugs, write wiki page, ...) but here is the frame.
At some point I'll need some opinions to get the right balance between code complexity and interest. ;)
User avatar
Kunda1
Posts: 10391
Joined: Thu Jan 05, 2017 9:03 pm

Re: [Solved] PyQt Question : Getting FreeCAD's System Font

Postby Kunda1 » Wed Mar 10, 2021 6:42 pm

:+1:
Lets do this!
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
melwynfranciscarlo
Posts: 81
Joined: Thu Feb 04, 2021 7:47 am
Location: Mumbai, India

Re: PyQt Question : Getting FreeCAD's System Font

Postby melwynfranciscarlo » Thu Mar 11, 2021 2:00 am

openBrain wrote:
Wed Mar 10, 2021 6:28 pm
A first draft is available here : https://github.com/0penBrain/FreeCAD-ma ... og.FCMacro
Still much to do (comment code, fix bugs, write wiki page, ...) but here is the frame.
At some point I'll need some opinions to get the right balance between code complexity and interest. ;)

Why is the SoLocation2Event at position [0,0] when the mouse hovers to the bottom-left of the view-area? Isn't it normally the top-left? Just wondering. Other than that, it's a cool app; especially the close button handler: didn't know you could do that in Python.
8-) MFC Boy: the one and only! 8-)
openBrain
Posts: 5748
Joined: Fri Nov 09, 2018 5:38 pm

Re: PyQt Question : Getting FreeCAD's System Font

Postby openBrain » Sun Apr 18, 2021 4:02 pm

melwynfranciscarlo wrote:
Thu Mar 11, 2021 2:00 am
Why is the SoLocation2Event at position [0,0] when the mouse hovers to the bottom-left of the view-area? Isn't it normally the top-left? Just wondering. Other than that, it's a cool app; especially the close button handler: didn't know you could do that in Python.
This is the case in Qt, but not in Coin world. :)
Kunda1 wrote:
Wed Mar 10, 2021 6:42 pm
Lets do this!
Anyway guys, pushed a release candidate of the code and would like your comments : https://github.com/0penBrain/FreeCAD-ma ... og.FCMacro

The main goals were :
* Keep it below 200 lines so it has an acceptable length to be read (goal achieved if we doesn't count blank lines)
* Demonstrate how to properly set up a dialog that stays on top of FC main window
* Demonstrate how to use layouts to get a proper GUI behavior

The secondary goals that added themselves when coding :
* Demonstrate several way to communicate between class instances (callback, Qt signals, ...)
* Demonstrate subclassing of QDialog methods (accept, reject and xxxEvent)
* Show some useful Qt widget attributes
* Demonstrate basic usage of FC observers (document, selection, view)

My plan is that the code will come with a more "human" tutorial as a wiki page to more extensively explain the whys.
But any feedback regarding the code and how comments help understanding is very welcome ATM. ;)
edi
Posts: 278
Joined: Fri Jan 17, 2020 1:32 pm

Re: [Solved] PyQt Question : Getting FreeCAD's System Font

Postby edi » Mon Apr 19, 2021 4:25 pm

Thank you very much for pulishing the macro.

A published and commented macro helps more than many pages of explanation.

One question: is there any documentation how to observe views which are not of type "View3DInventor" ? I think of TechDraw Page, returning the type "MDIView".
openBrain
Posts: 5748
Joined: Fri Nov 09, 2018 5:38 pm

Re: [Solved] PyQt Question : Getting FreeCAD's System Font

Postby openBrain » Mon Apr 19, 2021 4:52 pm

edi wrote:
Mon Apr 19, 2021 4:25 pm
Thank you very much for pulishing the macro.

A published and commented macro helps more than many pages of explanation.

Actually it's more intended to be a tutorial and eventually a template that a real macro. :lol:
One question: is there any documentation how to observe views which are not of type "View3DInventor" ? I think of TechDraw Page, returning the type "MDIView".
I don't think a view observer for TechDraw is possible but I may just ignore it. However in TechDraw case, I doesn't see what it would bring more than a selection observer.