Path Workbench Repairing an Operation Moved Out of the Job

Here's the place for discussion related to CAM/CNC and the development of the Path module.
User avatar
freman
Posts: 1588
Joined: Tue Nov 27, 2018 10:30 pm

Re: Path Workbench Repairing an Operation Moved Out of the Job

Post by freman »

Anyone know where the comboview is defined. It's common to different WBs so I guess it's higher than Mod/Path but I can't find any pertinent .ui files.

Seems the place to start.
Paula
Posts: 32
Joined: Tue Jan 26, 2021 10:06 pm

Re: Path Workbench Repairing an Operation Moved Out of the Job

Post by Paula »

freman wrote: Wed May 19, 2021 11:44 am Anyone know where the comboview is defined. It's common to different WBs so I guess it's higher than Mod/Path but I can't find any pertinent .ui files.

Seems the place to start.
A quick look at the code suggests src/Gui/ComboView.cpp. You probably wouldn't use a .ui for things like that.
User avatar
freman
Posts: 1588
Joined: Tue Nov 27, 2018 10:30 pm

Re: Path Workbench Repairing an Operation Moved Out of the Job

Post by freman »

many thanks, I was misleading myself with silly assumptions.

Tree.cpp :

Code: Select all

TreeWidget::TreeWidget(const char *name, QWidget* parent)
    : QTreeWidget(parent), SelectionObserver(true,0), contextItem(0)
    , searchObject(0), searchDoc(0), searchContextDoc(0)
    , editingItem(0), currentDocItem(0)
    , myName(name)
{
    Instances.insert(this);
    if(!_LastSelectedTreeWidget)
        _LastSelectedTreeWidget = this;

    this->setDragEnabled(true);
    this->setAcceptDrops(true);
    
Maybe that can be set false in Path WB.

I still think making it work would be the right thing to do.
Paula
Posts: 32
Joined: Tue Jan 26, 2021 10:06 pm

Re: Path Workbench Repairing an Operation Moved Out of the Job

Post by Paula »

freman wrote: Wed May 19, 2021 6:20 pm
Maybe that can be set false in Path WB.

I still think making it work would be the right thing to do.
It might not be as much fun as you imagine. Looking at the structure of a FreeCAD window on the screen, I think there's only going to be one TreeView object for each FreeCAD window and it'll also contain objects from the other workbenches you've used so it''ll also disable D&D there too. Really though I think you should be finding and fixing the actual bug(s) rather than considering dirty hacks like disabling D&D.
User avatar
freman
Posts: 1588
Joined: Tue Nov 27, 2018 10:30 pm

Re: Path Workbench Repairing an Operation Moved Out of the Job

Post by freman »

Currently there is NO intended software path behind the drag and drop actions so disabling it in the UI is RIGHT thing to do, not a "dirty hack".

The result of a DnD in Path WB is totally arbitrary and unplanned and is having very destructive results. Obviously the correct solution is to disable it if possible.

The best solution would be to add the software so that a drag option did something useful like re-ordering Operations and that drop targets were checked to see whether a drop made sense and cleanly exit if not.

Part of the problem is that the report window is not showing the call stack when these errors occur, so it's going to take quite some picking to work back to where this broken execution path originates. I don't have the time to commit to that.

A short term solution is to stop this trashing people's work by disabling unsupported DnD actions.
chrisb
Posts: 37743
Joined: Tue Mar 17, 2015 9:14 am

Re: Path Workbench Repairing an Operation Moved Out of the Job

Post by chrisb »

freman wrote: Thu May 20, 2021 5:53 am Currently there is NO intended software path behind the drag and drop actions so disabling it in the UI is RIGHT thing to do, not a "dirty hack".

The result of a DnD in Path WB is totally arbitrary and unplanned and is having very destructive results. Obviously the correct solution is to disable it if possible.
Of course it is the right way to disable it, nobody denies this. But currently the place where this should be done is - so my guess - far far away from anything Path related. That could make a quick fix a dirty hack, where it should better be be controlled by Path workbench itself, and not by something outside.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
freman
Posts: 1588
Joined: Tue Nov 27, 2018 10:30 pm

Re: Path Workbench Repairing an Operation Moved Out of the Job

Post by freman »

this should be done is... far far away from anything Path related ... it should better be be controlled by Path workbench itself, and not by something outside.
Sorry, I'm not following what way you think this should go.

By pointing to the code in TreeView.cpp I was highlighting the existence of the relevant function, not suggesting a change was needed in that file.

One approach would be turn off DnD in the comboView when PathWB is activated and restore it afterwards.

If there are working instances of DnD in Path that are worth preserving, then there needs to be some checking of the drop mechanism to abort cleanly if the drag source or target is inside a job object.

Currently there are multiple things getting called in PathJob.py which assume a group object exists without testing for its existence. This probably means they are getting called needlessly and it needs to be walked up call stack to fix it, or disable DnD at some level.
chrisb
Posts: 37743
Joined: Tue Mar 17, 2015 9:14 am

Re: Path Workbench Repairing an Operation Moved Out of the Job

Post by chrisb »

freman wrote: Thu May 20, 2021 7:11 am One approach would be turn off DnD in the comboView when PathWB is activated and restore it afterwards.
That doesn't help. You could drag the operations as shown in my example above independently from the active workbench.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
freman
Posts: 1588
Joined: Tue Nov 27, 2018 10:30 pm

Re: Path Workbench Repairing an Operation Moved Out of the Job

Post by freman »

Ah, of course. So there needs to be some checking in the on-drop event.

Does DnD work correctly elsewhere in FC or this part of a broader issue?
chrisb
Posts: 37743
Joined: Tue Mar 17, 2015 9:14 am

Re: Path Workbench Repairing an Operation Moved Out of the Job

Post by chrisb »

freman wrote: Thu May 20, 2021 12:30 pm Does DnD work correctly elsewhere in FC or this part of a broader issue?
Both. It works correctly e.g. when dragging sketches in and out of bodies. It works correctly when dragging arbitrary things in and out of groups or Part containers.
It doesn't work in TechDraw.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply