Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#4334 closed defect (fixed)

OMEdit: "save experiment annotation inside model" file changed and undo

Reported by: Jan Kokert Owned by: Adeel Asghar
Priority: low Milestone: 1.12.0
Component: OMEdit Version:
Keywords: undo save experiment annotation Cc:

Description

If we activate "Save experiment annotation inside model" the annotation is edited but it does not show, that the file was changed (no star).

Furthermore, it is not possible to undo this via UNDO.
Probably again due to a lack of a do/undo event generated.

Attachments (1)

ticket4334.swf (1.5 MB ) - added by Adeel Asghar 8 years ago.

Download all attachments as: .zip

Change History (17)

comment:1 by Adeel Asghar, 8 years ago

Milestone: Future1.12.0
Status: newaccepted

Do you have a use-case for it?
I can't reproduce it.

comment:2 by Jan Kokert, 8 years ago

1.) Open a model
2.) Choose "Simulation Setup"
3.) Activate the checkbox "save experiment annotation inside model"
4.) Click OK and simulate the model
5.) Go back to the model

Issue 1: The model code was changed by OMEdit (the annotation was added) but the file seems not to be changed (no star behind the filename)
Issue 2: The annotation can not be removed by [control] + [z]

in reply to:  2 comment:3 by Adeel Asghar, 8 years ago

Replying to janK:

1.) Open a model
2.) Choose "Simulation Setup"

You mean click on "Simulation Setup" button in the toolbar OR right click the model and choose "Simulation Setup"?

3.) Activate the checkbox "save experiment annotation inside model"
4.) Click OK and simulate the model
5.) Go back to the model

What do you mean "go back to the model"?

Issue 1: The model code was changed by OMEdit (the annotation was added) but the file seems not to be changed (no star behind the filename)
Issue 2: The annotation can not be removed by [control] + [z]

comment:4 by Jan Kokert, 8 years ago

Hi Adeel, sorry for not beeing clear enought:

"Choose "Simulation Setup": Click the button "Simulation Setup" in the top toolbar with the green capital S and the green frame.

"Go back to the model": OMEdit will switch to the plotting perspective. Go back to the TextView by clicking "Modeling" in the bottom-right tabbed view.

comment:5 by Adeel Asghar, 8 years ago

Issue 1 is not valid. I made a small video about it. See attachment.

Issue 2 is valid but actually we don't allow redo/undo when you are in the text view. If you switch back to Diagram/Icon View then you can undo the change.

by Adeel Asghar, 8 years ago

Attachment: ticket4334.swf added

comment:6 by Jan Kokert, 8 years ago

Thanks for making the video - this makes things clear... Actually, my OMEdit is set to Tabbed View, not SubWindow View (for the default modeling view mode). Hence, I refer to the missing star indicator in the tabs. Also in #4321 I refer to the tabs.

but actually we don't allow redo/undo when you are in the text view.

Ok, I understand that. This explains the behavior.

But is this limitation reasonable?. Is there already a ticket to allow redo/undo in the text view?

comment:7 by Jan Kokert, 8 years ago

I further investigated Issue 1: It does not matter which default modeling view mode is chosen. Furthermore, I observed that on my system, the star is shown for about half a second and then it vanishes...

Version 0, edited 8 years ago by Jan Kokert (next)

in reply to:  6 comment:8 by Adeel Asghar, 8 years ago

Replying to janK:

Thanks for making the video - this makes things clear... Actually, my OMEdit is set to Tabbed View, not SubWindow View (for the default modeling view mode). Hence, I refer to the missing star indicator in the tabs. Also in #4321 I refer to the tabs.

That doesn't matter. You should get star in the tab.

but actually we don't allow redo/undo when you are in the text view.

Ok, I understand that. This explains the behavior.

But is this limitation reasonable?. Is there already a ticket to allow redo/undo in the text view?

No, there is no ticket about it. The problem is text editor has its own undo stack (e.g., type something in the text editor then press ctrl+z) and I don't want to mess with it.

in reply to:  7 comment:9 by Adeel Asghar, 8 years ago

Replying to janK:

I further investigated Issue 1: It does not matter which default modeling view mode is chosen. Furthermore, I observed that on my system, the star is shown for about half a second and then it vanishes... It seems that during the simulation, the file is saved automatically (which makes actually sense)

Aha....guess what? You have auto save enabled in Tools->Options->Enable Auto Save.

comment:10 by Jan Kokert, 8 years ago

No. I checked it - it is NOT enabled! The box with the 300s is also disabled. Or do you mean another "Enable Auto Save" which I don't see? I went through every single option under Tools->Options and there is only the aforementioned one which is disabled.

It seems that OMEdit saves the file when I start the simulation.

comment:11 by Adeel Asghar, 8 years ago

Yes there is another option Tools->Options->Simulation->Save class before simulation.

comment:12 by Jan Kokert, 8 years ago

Right. It is there... And it was checked. My fault. The left horizontal scrollbar was positioned at the bottom and I only saw the radio buttons Structured and Formatted Text in the hurry.

I know it is a minor defect, but I think we should leave this ticket open until we can UNDO this autosave (Issue 2).

The problem is text editor has its own undo stack

Why is that? I think it will happen from time to time, that an UI action can change the source code and vice versa. There should be only one coherent UNDO stack I guess.

I already noticed this strange behavior and wanted to create a ticket...
I mean: edit something in Graphics View, switch to Text View, -> UNDO not possible! -> ARG!

Last edited 8 years ago by Jan Kokert (previous) (diff)

comment:13 by Adeel Asghar, 8 years ago

Why is that? I think it will happen from time to time, that an UI action can change the source code and vice versa. There should be only one coherent UNDO stack I guess.

Text Editor has its own builtin undo stack and then OMEdit has one. I don't think I can disable the built in one. However, I might be able to merge them. Basically just use text editor undo stack as long as it is valid and when we don't have anything in it then use OMEdit one.

comment:14 by Adeel Asghar, 8 years ago

Resolution: fixed
Status: acceptedclosed

It is not possible to merge the two stacks since the one in QPlainTextEdit is internal and I can't access it. However, I made them work together as one. So you change things when you are in diagram view and still you can undo them when you are in text view.

Fixed in 90da68c/OMEdit.

comment:15 by Jan Kokert, 8 years ago

Great! So you have the pleasure to also close the ticket #4344 :D

comment:16 by Adeel Asghar, 8 years ago

Not really. See ticket:4344#comment:1

Note: See TracTickets for help on using tickets.