View Issue Details

IDProjectCategoryView StatusLast Update
0000111FreeCADFeaturepublic2011-07-27 13:06
Reporteryorik Assigned Towmayer  
PriorityhighSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version 
Target Version0.12Fixed in Version0.12 
Summary0000111: Make the task panel accessible from python
DescriptionThe task panel is really cool... One single non-obtrusive place where all the UI workflow is concentrated. I think it would be nice to have it accessible from python, so anything where you need user input can happen there.

If someone can explain me a bit how it works on the C++ side, I can try...
I suppose the best way would be to make it something that works like the Console?

I also think we could add a bit of styling to it (using the same gradient as the 3D view, maybe some special icons, something like that...) But that's purely cosmetic and can be thought about later.

What do you guys think?
TagsNo tags attached.
FreeCAD Information

Relationships

child of 0000276 closedJriegel Stringent user interface behavior 

Activities

Jriegel

2010-06-29 12:43

administrator   ~0000254

Thats more complicated ;)

The TaskPanel has multible usage. And is somwhat still
in expermimental use. I used it a lot in Robot.

First usage is the Dialog. Werner used it e.g. for the
Placment dialog. Its blocking and diactivates all commands
(which change the document) until the user accept or discards..

The other usage is the real TaskView like in Windows Explorer in
XP. Which show stuff dependend to the selection. A simple usage is
the:

Gui::TaskView::TaskWatcherCommands

which you give a selction filter and and a Gui::Command list
he have to show in case the selection filter match.
Exampel you find here:

src/Mod/Robot/Gui/Workbench.cpp Line 54.

You besides commands show any kind of dialog (ui) dependend of a selection
filter.

The base class is the so called Gui::TaskWatcher and normaly this "handler"
get registered when the workbench is opened. So every workbench kann have
its own set of TaskWatcher to present different behaviour....

I have to think about an interface in the workbench to expose this
stuff. Since I still quite experimenting with this stuff, not quit easy...

yorik

2010-07-07 19:54

administrator   ~0000261

Actually I just wanted to use it as a placeholder...
My idea was to get rid of the draft command bar (or at least offer the choice) and use the task view instead. It would be pretty convenient, you click the line button, and the line options appear, same as Werner did with the Part tools. This would save a good amount of screen space and concentrate all user input at the same place. Basically I'd like to be able to do this with python/pyqt:

TaskExtrusion::TaskExtrusion()
{
    widget = new DlgExtrusion();
    taskbox = new Gui::TaskView::TaskBox(
        Gui::BitmapFactory().pixmap("Part_Extrude"),
        widget->windowTitle(), true, 0);
    taskbox->groupLayout()->addWidget(widget);
    Content.push_back(taskbox);
}

If I understand well, the Ok/Cancel buttons are part of the TaskView itself and not of the inserted widget? Can you explain me a bit more how the TaskView works or where I should look? I've already done python bindings, maybe I can have a try some day...

Jriegel

2010-07-08 06:09

administrator   ~0000262

Mhh,
the buttons are showed by the TaskView if you open a TaskDialog.
The TaskDialog can decide what collection of buttons it whant to show:
http://doc.trolltech.com/4.2/qdialogbuttonbox.html#StandardButton-enum
The TaskBox is a smaller component (one you can switch open and close).
A TaskDialog can consinst of one or more TaskBoxs. While the TaskDialog
is aktive all GuiCommands to change the document are greyed. That ment
as long the Dialog is open it hat the sole ability to alter the document.
But that can also be changed.

On the other hand are the TaskWatcher which are added to the TaskView by e.g.
the Workbench. They are basically allways present but invisibel. The TaskView
allways checks the state of the selection and what is in edit and view the
TaskWatcher for that e.g. object selected (or edit). But you could also show
some TaskBoxes which are permanent on in your workbench. But Im not quit shure
if your TaskView get to much crowded that way.... ;)

yorik

2010-07-08 15:09

administrator   ~0000263

Hmm that looks amazingly perfect! To follow with the draft workbench example, there is indeed a part that changes form command to command (and that must impeach other commands to run) and a part that is always there (the right part where you can choose line color).

So basically when you want to show something on the TaskView you insert a TaskDialog in it, then you stuff it with the taskboxes you want, then when you are done you remove the taskdialog... Is that more or less right?

Is there an example of how the taskwatcher is used somewhere?

Jriegel

2010-07-09 12:26

administrator   ~0000264

The robot workbench use it quit a lot in both forms, as TaskWatcher and TaskDialog.

I will use it also extensifly in the Sketcher/PartDesign workflow I work
at the moment...

But never the less - I see the User interaction still as a field of discussion.
Im not quit shure what I think of is the perfect way....

yorik

2010-07-13 18:06

administrator   ~0000266

Yes, me neither. I'll have a look at how the robot workbench uses it...

yorik

2010-07-14 19:18

administrator   ~0000268

In the meantime I made a very small modif at the task panel in rev 3316 (made it use the current palette instead of qt default) and i modified a bit the colors to make it more stylish...

yorik

2010-07-15 15:10

administrator   ~0000271

I had a deeper look yesterday, and I begin to think like you, this is far from easy... One could make something similar to the mechanism to add an .ui page to the preferences dialog, but the usability of this would be pretty limited... (no easy way to make the .ui page update things in realtime on the 3D view, or vice-versa) And inserting directly a pyqt widget into the taskview system looks very complicated.

Maybe let's close this subject for now? Or we keep it for some later release than 0.11?

wmayer

2011-07-26 14:20

administrator   ~0000949

> One could make something similar to the mechanism to add an .ui page to the preferences dialog, but the usability of this would be pretty limited...
No absolutely not. Using Qt's introspection mechanism this is as powerful as the generated python sources. Using the findChild() method of a QObject you can find all children you need.

I have almost finished now the python binding and also provide a reference implementation how to use it. Have a look to Taskpanel.py in the TemplatePyMod folder.

wmayer

2011-07-27 13:06

administrator   ~0000950

Finished in rev. 4673

Issue History

Date Modified Username Field Change
2010-06-27 13:58 yorik New Issue
2010-06-29 12:43 Jriegel Note Added: 0000254
2010-06-29 12:43 Jriegel Status new => assigned
2010-06-29 12:43 Jriegel Assigned To => Jriegel
2010-06-29 13:35 Jriegel Target Version => 0.11
2010-07-07 19:54 yorik Note Added: 0000261
2010-07-08 06:09 Jriegel Note Added: 0000262
2010-07-08 15:09 yorik Note Added: 0000263
2010-07-09 12:26 Jriegel Note Added: 0000264
2010-07-13 18:06 yorik Note Added: 0000266
2010-07-14 19:18 yorik Note Added: 0000268
2010-07-15 15:10 yorik Note Added: 0000271
2011-01-06 21:38 Jriegel Target Version 0.11 => 0.12
2011-02-22 11:58 Jriegel Relationship added child of 0000276
2011-05-26 15:04 Jriegel Priority low => high
2011-07-26 14:20 wmayer Note Added: 0000949
2011-07-26 14:20 wmayer Assigned To Jriegel => wmayer
2011-07-27 13:06 wmayer Note Added: 0000950
2011-07-27 13:06 wmayer Status assigned => closed
2011-07-27 13:06 wmayer Resolution open => fixed
2011-07-27 13:06 wmayer Fixed in Version => 0.12