Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#4334 closed defect (fixed)

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

Reported by: janK Owned by: adeas31
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 adeas31 7 years ago.

Download all attachments as: .zip

Change History (17)

comment:1 Changed 7 years ago by adeas31

  • Milestone changed from Future to 1.12.0
  • Status changed from new to accepted

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

comment:2 follow-up: Changed 7 years ago by janK

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]

comment:3 in reply to: ↑ 2 Changed 7 years ago by adeas31

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 Changed 7 years ago by janK

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 Changed 7 years ago by adeas31

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.

Changed 7 years ago by adeas31

comment:6 follow-up: Changed 7 years ago by 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.

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 follow-up: Changed 7 years ago by 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)

Last edited 7 years ago by janK (previous) (diff)

comment:8 in reply to: ↑ 6 Changed 7 years ago by adeas31

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.

comment:9 in reply to: ↑ 7 Changed 7 years ago by adeas31

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 Changed 7 years ago by janK

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 Changed 7 years ago by adeas31

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

comment:12 Changed 7 years ago by janK

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 7 years ago by janK (previous) (diff)

comment:13 Changed 7 years ago by adeas31

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 Changed 7 years ago by adeas31

  • Resolution set to fixed
  • Status changed from accepted to closed

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 Changed 7 years ago by janK

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

comment:16 Changed 7 years ago by adeas31

Not really. See ticket:4344#comment:1

Note: See TracTickets for help on using tickets.