Tasks panel (or Pyside)?

A forum for research and development of the user interface of FreeCAD
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
xianyu
Posts: 66
Joined: Mon Jun 27, 2022 7:34 am

Tasks panel (or Pyside)?

Post by xianyu »

Code: Select all

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.20.29177 (Git)
Build type: Release
Branch: releases/FreeCAD-0-20
Hash: 68e337670e227889217652ddac593c93b5e8dc94
Python 3.8.10, Qt 5.15.2, Coin 4.0.1, Vtk 8.2.0, OCC 7.6.2
I am creating a workbench. When modifying properties, a dialog box can pop up.
I think there are two ways. Which is better? :D

1.Using the Task panel.
01.png
01.png (35.45 KiB) Viewed 1167 times
If this is adopted, what "App:: XXXXX" should I use.

2.Do not use Task panel.
How to click a button like a picture to pop up a dialog box (not in Tasks).
When I import ui files to FreeCAD.Does the following code still apply?

Code: Select all

self.dialog = FreeCADGui.PySideUic.loadUi(os.path.join(os.path.dirname(__file__), "AddonManager.ui"))
Freecad novice, A Python enthusiast
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Tasks panel (or Pyside)?

Post by onekk »

xianyu wrote: Mon Oct 17, 2022 8:07 am ...

It is hard to tell as it is difficult to guess what you are trying to achieve, what properties are you modifying, on what object you are modifying, and many other conditions.

as example if you use a "Feature Python Object" it is easy to code "what happens if I modify a property", trigger proper action and modifying the final shape, if you are using some other objects it could be very different.

Abstract problems usually end in with the universal answer "it depends"...

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/
xianyu
Posts: 66
Joined: Mon Jun 27, 2022 7:34 am

Re: Tasks panel (or Pyside)?

Post by xianyu »

onekk wrote: Mon Oct 17, 2022 10:14 am It is hard to tell as it is difficult to guess what you are trying to achieve, what properties are you modifying, on what object you are modifying, and many other conditions.
I'm sorry.
Normally, I can only change one value when I want to change a property.
If my custom properties have many items that can be modified, I need to use Tasks (like placement).
02.png
02.png (6.6 KiB) Viewed 1058 times
03.png
03.png (14.09 KiB) Viewed 1058 times

But I don't know whether the best method is to use Tasks or pop up window.
04.png
04.png (19.84 KiB) Viewed 1058 times
Freecad novice, A Python enthusiast
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Tasks panel (or Pyside)?

Post by onekk »

To maie things clear.

no code no game.

Abstract questions are very difficult.

I could not guess what you want!

Do you want a way to make Task panel appear for your taylored WB or modify a property?

Is your object a FC primitive or a FPO (Feature Python Object)?

Task panel is a tab added to the combo view and there are around some examples in the Python section of this forum, probably made by @wmayer about using it.

Asking here is slightly out of scope if you are searching for code.

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/
xianyu
Posts: 66
Joined: Mon Jun 27, 2022 7:34 am

Re: Tasks panel (or Pyside)?

Post by xianyu »

onekk wrote: Tue Oct 18, 2022 6:08 am ...
It's my fault.
I can design dialog boxes. (help me get many input values from users).
What I finally want is the best place for the dialog box to pop up. Task panel or pop up window?


If you use a Task panel, what "App:: XXXXX" should I use.
If you use a pop up window, in Property-Data, is there any way to pop up the dialog (like placement)
Freecad novice, A Python enthusiast
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Tasks panel (or Pyside)?

Post by onekk »

xianyu wrote: Tue Oct 18, 2022 7:21 am I can design dialog boxes. (help me get many input values from users).
What I finally want is the best place for the dialog box to pop up. Task panel or pop up window?
This is your decision it depends on the how much values you have to enter, and if you are coding something like an FPO that could be used as a standalone object.
xianyu wrote: Tue Oct 18, 2022 7:21 am If you use a Task panel, what "App:: XXXXX" should I use.
No App::XXXX you have to find the proper child of Gui.getMainWindow():

In 0.21 is it called Task. try this code from:

https://forum.freecadweb.org/viewtopic. ... 81#p626781

Code: Select all

from PySide import QtGui, QtCore
Gui.getMainWindow().findChild(QtGui.QWidget,'Tasks').show()

But probably it will not work if you are targeting 0.20 as from the discussion some modifications have been done for 0.21.

xianyu wrote: Tue Oct 18, 2022 7:21 am If you use a pop up window, in Property-Data, is there any way to pop up the dialog (like placement)
For this is a standard dialog, but probably you have to put a button somewhere or trigger the appearance of a dialog when a property is changed, but as above if you have coded an FPO.

As usual abstract question without code are difficult to answer, at least by me.

UI is not my best known part of FC.

Hope it helps

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/
Post Reply