Ideas for implementing 0003393: Configuration wizard when launching FreeCAD for the first time
Ideas for implementing 0003393: Configuration wizard when launching FreeCAD for the first time
Hello guys. Silas from Wikilab here (more about Wikilab here).
With our small team of beginners, we have sucessfully solved issue 0003499. Tomorrow we are going to make a pull request. Although it is a simple change (only three lines of code!) people got a bit scared with C++, which is not a problem for students that are just starting.
So we are thinking about making a more complex change, but in Python this time. So we have choose issue 0003393: Configuration wizard when launching FreeCAD for the first time. On the issue tracker the reporter sugests a window from LibreCAD, which I found interesting and a good starting point.
So, as a good starting point, our plan is to allow the user to chose the following options:
* Default unit
* GUI Language (fetchs a initial option from the system language)
And, later, we can implement other features the NormandC (a commenter) tells on the tracker.
Any tips about that?
Ah, I'd also like to ask you if you have some tip about a good starting point at the code so we can take a look at. We want to maximize Python and minimize C++. Anyway, we can deal with some C++, if necessary.
Thanks!
With our small team of beginners, we have sucessfully solved issue 0003499. Tomorrow we are going to make a pull request. Although it is a simple change (only three lines of code!) people got a bit scared with C++, which is not a problem for students that are just starting.
So we are thinking about making a more complex change, but in Python this time. So we have choose issue 0003393: Configuration wizard when launching FreeCAD for the first time. On the issue tracker the reporter sugests a window from LibreCAD, which I found interesting and a good starting point.
So, as a good starting point, our plan is to allow the user to chose the following options:
* Default unit
* GUI Language (fetchs a initial option from the system language)
And, later, we can implement other features the NormandC (a commenter) tells on the tracker.
Any tips about that?
Ah, I'd also like to ask you if you have some tip about a good starting point at the code so we can take a look at. We want to maximize Python and minimize C++. Anyway, we can deal with some C++, if necessary.
Thanks!
Re: Ideas for implementing 0003393: Configuration wizard when launching FreeCAD for the first time
Congratulations to your first FreeCAD contribution. Three lines of code is a good amount for a start. Simply double the number of lines on each contribution! You might have heard about the story of the invention of the chess game.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Ideas for implementing 0003393: Configuration wizard when launching FreeCAD for the first time
@silas 
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Re: Ideas for implementing 0003393: Configuration wizard when launching FreeCAD for the first time
Maybe you can look at BIM workbench, developped by Yorik: https://github.com/yorikvanhavre/BIM_Workbenchsilas wrote: ↑Wed Jul 04, 2018 7:41 pm So we are thinking about making a more complex change, but in Python this time. So we have choose issue 0003393: Configuration wizard when launching FreeCAD for the first time. On the issue tracker the reporter sugests a window from LibreCAD, which I found interesting and a good starting point.
Video presentation where you could see the setup dialog (between 1'15'' and 3'00''):
[EDIT] BIM workbench topic for inspiration too: https://forum.freecadweb.org/viewtopic.php?f=9&t=27237
- wandererfan
- Veteran
- Posts: 5992
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: Ideas for implementing 0003393: Configuration wizard when launching FreeCAD for the first time
In Mod/Draft/Draft.py approximately line #117 2 functions will be helpful:
- def getParam(param,default=None): and
- def setParam(param,value):.
Re: Ideas for implementing 0003393: Configuration wizard when launching FreeCAD for the first time
Starting from a dialog similar to the librecad one seems a very good idea indeed.
This is pretty simple to do fully in python. I did one for BIM (that appears in the video), that is basically one ui file designed in qt designer (dialogSetup.ui) , and one python file:
https://github.com/yorikvanhavre/BIM_Wo ... imSetup.py
I think you can do something very similar...
In FreeCAD, Tools -> Edit parameters is very useful to know all the settings and their types.
To launch your screen at FreeCAD startup, when it's the first launch, you can implement a separate workbench, but it's much just to show a dialog, or I would suggest to hook it to the Mod/Tux module, which contains several other utilities that are run at FreeCAD startup.
This is pretty simple to do fully in python. I did one for BIM (that appears in the video), that is basically one ui file designed in qt designer (dialogSetup.ui) , and one python file:
https://github.com/yorikvanhavre/BIM_Wo ... imSetup.py
I think you can do something very similar...
In FreeCAD, Tools -> Edit parameters is very useful to know all the settings and their types.
To launch your screen at FreeCAD startup, when it's the first launch, you can implement a separate workbench, but it's much just to show a dialog, or I would suggest to hook it to the Mod/Tux module, which contains several other utilities that are run at FreeCAD startup.
Re: Ideas for implementing 0003393: Configuration wizard when launching FreeCAD for the first time
Maybe the wizard could also ask user what type of mouse navigation methodology users perfer? Maybe a scrollbar just like in the taskbar ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Re: Ideas for implementing 0003393: Configuration wizard when launching FreeCAD for the first time
Hello.
Although drawing the wizard UI and writing its related code are not difficult, we are stuck at where (and how to) show the window.
We have two choices:
1. Show it just after the splash screen gets closed (add these lines on lines 1838 of Gui/Application.cpp). Something like:
The exec() function blocks until the user closes the dialog.
2. Write a Python module.
We've made a very small prototype with [1] (C++ only) and it seems to work, but we would really like to implement it in Python, if possible. Looking at the documentation, we figured out a python module can be loaded with:
And we create a directory within the Mod directory. We tested it and it works fine for arbitrary Python code (like creating a file) but when we try to create a window in our Python code (by creating a class that subclass QtGui.QDialog) we get the following error:
Python script cannot detect we have a QApplication at the Python side (that makes sense, since it would allow the Python interpreter to have full access of the hosting app). I am probably missing something.
We can probably implement that feature in Python in other manners that not a standalone window at the beginning of the application, but a standalone would be the "classic" way
What you recommend? It is not a problem the WizardConfig window have to be done only in C++ at this level. We just would like to know
Thanks!
Although drawing the wizard UI and writing its related code are not difficult, we are stuck at where (and how to) show the window.
We have two choices:
1. Show it just after the splash screen gets closed (add these lines on lines 1838 of Gui/Application.cpp). Something like:
Code: Select all
if (firstTime) {
WizardConfigDialog wizardDlg;
wizardDlg.exec();
}
2. Write a Python module.
We've made a very small prototype with [1] (C++ only) and it seems to work, but we would really like to implement it in Python, if possible. Looking at the documentation, we figured out a python module can be loaded with:
Code: Select all
Base::Interpreter().loadModule("WizardConfig");
Code: Select all
QWidget: Must construct a QApplication before a QPaintDevice
zsh: abort (core dumped) ./bin/FreeCAD
We can probably implement that feature in Python in other manners that not a standalone window at the beginning of the application, but a standalone would be the "classic" way

What you recommend? It is not a problem the WizardConfig window have to be done only in C++ at this level. We just would like to know

Thanks!
Re: Ideas for implementing 0003393: Configuration wizard when launching FreeCAD for the first time
Hey Silas,
I hope some devs are able to address your questions. Thanks again for working on this. Also I'm going to link this thread with:
I hope some devs are able to address your questions. Thanks again for working on this. Also I'm going to link this thread with:
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Re: Ideas for implementing 0003393: Configuration wizard when launching FreeCAD for the first time
This simply means that you create that dialog too early. Before creating any kind of widget a QApplication must exist.And we create a directory within the Mod directory. We tested it and it works fine for arbitrary Python code (like creating a file) but when we try to create a window in our Python code (by creating a class that subclass QtGui.QDialog) we get the following error:
Could it be that you load it from the Init.py file of your application module? If yes then move it to the initGui.py file. If this is not the case you should explain the way how you invoke your Python module.