Multiple dialogs in tasks view
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Multiple dialogs in tasks view
Hi all,
What is the convention for the case where I need to add multiple dialogs into the tasks view panel?
How the user should interact with those dialogs?
Prev/Next buttons and OK for the last one?
Lets say I have a multi-stage task that I want to implement using several dialogs in the tasks view.
There are too much information to show it all in one task-dialog.
Every stage in the process is dependent on the previous stage.
Selecting something in stage 1 change the information shown in stage 2 and so on.
Should I have OK/Cancel buttons for every stage?
In that case the user will not be able to go back, he could only cancel the process.
OK will go to the next stage.
Or there should be Prev/Next buttons that will allow to go back as well?
What is the API to change/focus on another dialog in the task view?
Thanks.
What is the convention for the case where I need to add multiple dialogs into the tasks view panel?
How the user should interact with those dialogs?
Prev/Next buttons and OK for the last one?
Lets say I have a multi-stage task that I want to implement using several dialogs in the tasks view.
There are too much information to show it all in one task-dialog.
Every stage in the process is dependent on the previous stage.
Selecting something in stage 1 change the information shown in stage 2 and so on.
Should I have OK/Cancel buttons for every stage?
In that case the user will not be able to go back, he could only cancel the process.
OK will go to the next stage.
Or there should be Prev/Next buttons that will allow to go back as well?
What is the API to change/focus on another dialog in the task view?
Thanks.
Re: Multiple dialogs in tasks view
I don't remember off the top of my head a tool that allows you to go forwards and backwards, it's usually only forwards.
Let's see Draft Text; it shows one task panel to set coordinates, then you accept it, and a second task panel shows a dialog to enter the text, and then finish the input. This works okay, I suppose, but if I were to remake this tool, I would probably add the coordinates and the text in the same task panel, maybe in different windows or sections.
This code allows you to load two different interfaces in the "form" variable.
Code: Select all
class CommandTaskPanel:
def __init__(self):
one = Gui.PySideUic.loadUi("some1.ui")
two = Gui.PySideUic.loadUi("some2.ui")
self.form = [one, two]
ui = CommandTaskPanel()
Gui.Control.showDialog(ui)
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
Re: Multiple dialogs in tasks view
Thanks.
In my case there are too much information to push them all into one dialog.
And the information is well divided into "logical" blocks, so I prefer to have separate dialogs.
I'm not on the PC where I have the code, will have to check it later if there are several dialogs in the task panel, those are shown as closed "tabs"...
The question is whether the user can just switch ti another "tab" and skip some steps in the process - this will break the logic completely.
In my case there are too much information to push them all into one dialog.
And the information is well divided into "logical" blocks, so I prefer to have separate dialogs.
I'm not on the PC where I have the code, will have to check it later if there are several dialogs in the task panel, those are shown as closed "tabs"...
The question is whether the user can just switch ti another "tab" and skip some steps in the process - this will break the logic completely.
Re: Multiple dialogs in tasks view
You may have a look at the Path workbench. The operations have different sub tabs, e.g. for heights, depths, etc.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Multiple dialogs in tasks view
As chrisb says, also look at the Path Workbench. The tools here often launch a task panel that has many subwindows in various tabs.
It really depends on what your command does; if you have optional values, maybe these should have suitable default values, but if you really need the input from the user, then yes, a sequential display of task panels, like Draft Text does, may be best. This command doesn't handle going back and forth, but I think it should be possible to just a add a few buttons to control this.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
Re: Multiple dialogs in tasks view
I've tried to add few dialogs to task view, but it looks I'm doing something wrong...
I've expected that calling Gui.Control.showDialog() with different dialog classes will do the trick, but it looks like it does not.
I get "Active task dialog found" for the second call of showDialog.
I found that sketch workbench adds several tasks: But it looks like the UI allows the user to switch to any task he wants and that's not good for my case.
Looks like the only option I have is to close stage1 dialog when user clicks OK button and immediately show stage2 dialog and so on...
Am I missing something?
There is no way to have a multi-stage task?
I've expected that calling Gui.Control.showDialog() with different dialog classes will do the trick, but it looks like it does not.
I get "Active task dialog found" for the second call of showDialog.
I found that sketch workbench adds several tasks: But it looks like the UI allows the user to switch to any task he wants and that's not good for my case.
Looks like the only option I have is to close stage1 dialog when user clicks OK button and immediately show stage2 dialog and so on...
Am I missing something?
There is no way to have a multi-stage task?
Re: Multiple dialogs in tasks view
I'm not sure I understand how to use that "Draft Text" command to see how it works.vocx wrote: ↑Sun Oct 04, 2020 4:30 pm It really depends on what your command does; if you have optional values, maybe these should have suitable default values, but if you really need the input from the user, then yes, a sequential display of task panels, like Draft Text does, may be best. This command doesn't handle going back and forth, but I think it should be possible to just a add a few buttons to control this.
Should I be in a specific workbench? Couldn't find the command in the Draft workbench...
Re: Multiple dialogs in tasks view
You describe the classical use case of a wizard. Qt offers the class QWizard for this. There you can also define for a page whether it allows you to go back.project4 wrote: ↑Sat Oct 03, 2020 5:28 pm What is the convention for the case where I need to add multiple dialogs into the tasks view panel?
How the user should interact with those dialogs?
Prev/Next buttons and OK for the last one?
Lets say I have a multi-stage task that I want to implement using several dialogs in the tasks view.
There are too much information to show it all in one task-dialog.
Every stage in the process is dependent on the previous stage.
Selecting something in stage 1 change the information shown in stage 2 and so on.
Should I have OK/Cancel buttons for every stage?
In that case the user will not be able to go back, he could only cancel the process.
OK will go to the next stage.
Or there should be Prev/Next buttons that will allow to go back as well?
What is the API to change/focus on another dialog in the task view?
So, the easiest when embedding a QWizard into a Task dialog is to override the method getStandardButtons() to return QDialogButtonBox::NoButton. This means that the buttons of the wizard are used and therefore the Task dialog doesn't need its own buttons.
Re: Multiple dialogs in tasks view
Thanks.wmayer wrote: ↑Sun Oct 04, 2020 4:57 pm You describe the classical use case of a wizard. Qt offers the class QWizard for this. There you can also define for a page whether it allows you to go back.
So, the easiest when embedding a QWizard into a Task dialog is to override the method getStandardButtons() to return QDialogButtonBox::NoButton. This means that the buttons of the wizard are used and therefore the Task dialog doesn't need its own buttons.
But in TaskView the buttons are on top, while in the wizard those are on the bottom of the dialog...
It kinda breaks the user experience.
Re: Multiple dialogs in tasks view
For the moment it's better than nothing. What you can try is to move the push buttons from the QWizard to the QDialogButtonBox
Code: Select all
from PySide import QtGui
wiz=QtGui.QWizard()
box=QtGui.QDialogButtonBox()
pb=wiz.button(wiz.CancelButton)
box.addButton(pb, box.RejectRole)
box.show()
wiz.show()