reduced or minimized FC window

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
Oli772
Posts: 26
Joined: Wed Apr 27, 2022 2:35 pm

reduced or minimized FC window

Post by Oli772 »

Hello,
I am a running FC with its GUI in a python subprocess macro.
OS is ubuntu 20.04 on Linux. FC is 0.19.
However during the process the FC window appears to fit all the screen.
I would like to have it more discrete as a reduced window or a minimized banner.
How could this done?
Thank you for your help
Last edited by Oli772 on Sat Aug 20, 2022 5:34 am, edited 1 time in total.
User avatar
onekk
Veteran
Posts: 6205
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: reduced or minimized FC window

Post by onekk »

Hello please add information required in IMPORTANT post at top of this forum.

Without proper version information it is hard to supply a solution as something may differ depending on OS and libraries versions.

It is however difficult to use "FreeCAD as a library", and to interact with the MainWindow of FC if OS is unknown as something may depend on the OS used.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: reduced or minimized FC window

Post by openBrain »

Something like

Code: Select all

mw=FreeCADGui.getMainWindow() 
mw.setWindowState(mw.windowState() & QtCore.Qt.WindowMinimized)
Oli772
Posts: 26
Joined: Wed Apr 27, 2022 2:35 pm

Re: reduced or minimized FC window

Post by Oli772 »

thank you,
but what I get then is:
name 'QtCore' is not defined
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: reduced or minimized FC window

Post by openBrain »

Oli772 wrote: Sat Aug 20, 2022 5:43 am thank you,
but what I get then is:
name 'QtCore' is not defined

Code: Select all

from PySide2 import QtCore
Oli772
Posts: 26
Joined: Wed Apr 27, 2022 2:35 pm

Re: reduced or minimized FC window

Post by Oli772 »

Thank you very much, that works: the FC starts reduced then minimized.
Do you know how it could be right minimized from the start ?

here the start of my script:

Code: Select all

from __future__ import unicode_literals
__title__= ".."
__author__= ".."
__date__= ".."
__version__= "..."

import sys
# add folder containing FreeCAD.pyd, FreeCADGui.pyd to sys.path
sys.path.append("/usr/lib/freecad/lib")

import FreeCAD, FreeCADGui
import ImportGui

from PySide2 import QtCore
mw=FreeCADGui.getMainWindow() 
mw.setWindowState(mw.windowState() & QtCore.Qt.WindowMinimized)

from FreeCAD import Base
import Draft, PartDesign, Part, Import
import BOPTools.SplitFeatures
#import _CommandCompoundFilter
import CompoundTools.CompoundFilter


doc = App.newDocument()
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: reduced or minimized FC window

Post by openBrain »

Oli772 wrote: Tue Aug 23, 2022 5:26 am Thank you very much, that works: the FC starts reduced then minimized.
Do you know how it could be right minimized from the start ?
Hmmm... I see nowhere in your code a line where you actually launch FreeCAD...
Post Reply