#3776 closed enhancement (fixed)
Copy & paste in OMEdit
Reported by: | anonymous | Owned by: | Adeel Asghar |
---|---|---|---|
Priority: | high | Milestone: | 1.14.0 |
Component: | OMEdit | Version: | |
Keywords: | Cc: | tobias.bellmann@…, Andrea Bartolini |
Description
It looks like in diagram view of OMEdit it is not possible to do common copy/cut & paste operations.
I think it would be very useful to have them to copy/cut & paste models both inside the same diagram and across different diagrams (e.g. those that are open in different tabs)
Change History (34)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
I think this is a very important feature. The Copy&Paste feature should also include graphical elements in IconView and DiagramView like a connector or a line annotation.
comment:3 by , 8 years ago
Cc: | added |
---|
I agree that the feature is very important. I just got some user feedback about OMEdit in which this feature was asked for, too. I also use copy/paste on the diagram layers a lot when working with another tool.
comment:4 by , 6 years ago
Milestone: | 2.0.0 → 1.14.0 |
---|
This old ticket is still in the new state.
I also think that new copy/paste across diagrams is very needed. I suppose it should not be hard to add, since it should just imply copying/pasting lines of code without adjustments (except for removing annotations).
Maybe, in this case the current "duplicate" command can be dropped since the same effect can be obtained by a copy/paste pair.
I propose to move the milestone to 1.4.0
comment:6 by , 6 years ago
May I ask whether there are plans to address this ticket in the coming weeks?
It impacts my plans for the OM version I will use with the students.
I mean, copy/paste across tabs.
comment:9 by , 5 years ago
I found two glitches on this fix:
1) if I copy something from a model, I cannot paste using CTRL+V: I must use the menu; only once I've pasted the first time through menu, I can make further pastes with CTRL+V
2) in some cases a redundant red error occurs. For instance
-open Modelica.Electrical.Analog.Examples.rectifier.
-Select a box containing SineVoltage1, Inductor1 and the line connecting their two positive pins
-copy the selected area and paste it into a new model. The following red error message appears, which I think should be suppressed:
[1] 07:37:39 Scripting Error Unable to find component SineVoltage2.n while parsing connection {SineVoltage1.n,SineVoltage2.n,}.
follow-up: 12 comment:10 by , 5 years ago
The first issue should not happen. It always works for me with shortcut. Maybe its because the view is active and when you use the context menu the view gets the focus and becomes active.
I will take a look at both points.
comment:11 by , 5 years ago
Cc: | added |
---|
Andrea, would you like to try that out as soon as the Linux nightly is back from the dead? I see Martin is working on that, I hope it doesn't take too much time.
comment:12 by , 5 years ago
Replying to adeas31:
The first issue should not happen.
I can be more precise. If I have two open tabs and copy something from a model in the first tab, then I click on the tab header to select the second tab, CRTL+V does not work.
If instead, after having selected the second tab I first click on the diagram sheet, CRTL+V works as expected.
It is a minor glitch, but I suppose it is worthwhile fixing it.
follow-up: 14 comment:13 by , 5 years ago
I confirm the behavior in the last comment of Ceraolo.
I think that the clik inside the diagram to get focus is the normal behavior of the QT...
comment:14 by , 5 years ago
Replying to Andrea.Bartolini:
I confirm the behavior in the last comment of Ceraolo.
I think that the clik inside the diagram to get focus is the normal behavior of the QT...
Yes, but focus can be forced. In this case when the tab is selected
follow-up: 16 comment:15 by , 5 years ago
Another issue is that copying text from a tab and pasting into another produces a wrong result
follow-up: 17 comment:16 by , 5 years ago
Replying to ceraolo:
Another issue is that copying text from a tab and pasting into another produces a wrong result
You have a test case for it?
comment:17 by , 5 years ago
You have a test case for it?
A simple procedure to reproduce the issue:
1) create a blank model (say model "a")
2) create in a new tab a second model ("say "b")
3) write some text in "a" for instance "this is some text" and copy it
4) click on "b" tab; using mouse and context menu paste
=> instead of the correct text only a single red square is displayed.
comment:18 by , 5 years ago
Thanks. I also discovered it yesterday and already have a fix for it in my working copy. This is a bit different problem but it just surfaced using the copy paste functionality.
follow-up: 20 comment:19 by , 5 years ago
I have now fixed the focus issue and the text copying issue. See 7aa92c1/OpenModelica.
As for the red error message I expect this message to occur because when you select a box containing SineVoltage1
, Inductor1
and the line connecting their two positive pins from Modelica.Electrical.Analog.Examples.rectifier
the connection between SineVoltage1
and SineVoltage2
also got copied. So when you paste it you see the error message because in the pasting model it fails to find SineVoltage2
that is why pasting of the connection is dropped. I actually like the error message because it tells you exactly what has happened.
comment:20 by , 5 years ago
Replying to adeas31:
I have now fixed the focus issue and the text copying issue. See 7aa92c1/OpenModelica.
thanks a lot.
As for the red error message I expect this message to occur because when you select a box containing
SineVoltage1
,Inductor1
and the line connecting their two positive pins fromModelica.Electrical.Analog.Examples.rectifier
the connection betweenSineVoltage1
andSineVoltage2
also got copied. So when you paste it you see the error message because in the pasting model it fails to findSineVoltage2
that is why pasting of the connection is dropped. I actually like the error message because it tells you exactly what has happened.
I understand this. From a programmer's point of view is perfect. From a user's perspective, I'm not sure: if the user selects two components and the connecting line, he expects that connections between this stuff and the rest of the circuit are dropped silently.
So, I'm personally in favour of removing this message. Maybe for programmers this can be enabled with some esoteric flag.
follow-up: 22 comment:21 by , 5 years ago
if the user selects two components and the connecting line
Precisely that's the problem. The user doesn't know but has selected another connection as well. Perhaps using shift+click for selection is better in such cases.
Anyways one idea to solve this problem is to drop such connections where both start and end components are not selected.
comment:22 by , 5 years ago
Anyways one idea to solve this problem is to drop such connections where both start and end components are not selected.
I think this is the best solution from the user point of view.
This would better Dymola's way: Dymola in these cases includes dangling lines that should be then manually dropped.
In case implementing this solution requires a too large effort, or it is preferred for any other reason, another fix (for me worse, but still acceptable) is to convert the messages that presently are issued from errors into notifications.
Using shift+click is a good alternative, but not always advantageous: one might have to select a rather large portion of a diagram, which would imply several, tedious, clicks.
follow-up: 26 comment:24 by , 5 years ago
I could not check the latest improvements since there is not today's nightly. However, I've found two other glitches regarding copy-paste.
1) context menu item "paste" is never greyed. Is it possible to grey it when the clipboard is empty?
2) Once a text box is created, it appears selected (it has small red squares around), but indeed it is not: if I click CTRL-V, it is not copied into the clipboard
comment:25 by , 5 years ago
@adrpo is apparently trying to get the Windows nightly back again. The Linux nightly is also broken, I have sent a message to @sjoelund.se about that.
comment:26 by , 5 years ago
Replying to ceraolo:
I could not check the latest improvements since there is not today's nightly. However, I've found two other glitches regarding copy-paste.
1) context menu item "paste" is never greyed. Is it possible to grey it when the clipboard is empty?
2) Once a text box is created, it appears selected (it has small red squares around), but indeed it is not: if I click CTRL-V, it is not copied into the clipboard
Fixed both points mentioned above. Please test again tomorrow.
comment:27 by , 5 years ago
It seems to me that everything in copying/pasting across tabs works as expected.
Only, implementation of point 1 in comment 25 is not smooth.
If OMEdit is started from a freshly booted PC, paste is greyed.
But consider the following sequence:
- load OMEdit, create a model "a"
- and create a text box in "a" and copy it
- close OMEdit, and load it again
- create a model "a"
At this point, paste (on "a") in not greyed, but CRTL-V does nothing.
follow-up: 30 comment:28 by , 5 years ago
Yes that is because we put things on clipboard and closed the OMEdit session. Next time it reads from clipboard and finds that there is data. But the reason that nothing happens is because the data is not valid anymore since it belongs to the last session.
I thought about clearing the clipboard when user quits OMEdit but I m not sure whethere we should do that or not.
comment:29 by , 5 years ago
I understand that this is not the biggest problem to address... However, maybe some thought might help.
What about graying the icon upon loading OMEdit if the clipboard is invalid? This could be extended keeping greyed (or greying) the icon also in case clipboard is filled by other applications with contents OMEdit cannot interpret (and therefore paste).
comment:30 by , 5 years ago
Replying to adeas31:
I thought about clearing the clipboard when user quits OMEdit but I m not sure whethere we should do that or not.
If that data is no reusable in the next session, clearing it seems the only reasonable thing to do. In fact one may want to paste elsewhere (e.g. in a text editor) after closing OMEdit, but that seems quite a corner case to me.
comment:31 by , 5 years ago
In fact one may want to paste elsewhere (e.g. in a text editor) after closing OMEdit, but that seems quite a corner case to me.
Precisely the reason why I decided not to clear it.
Well I can also check if the data is valid. It is a bit expensive operation depending on the size of the data but is affordable since you only need to check it when creating the context menu.
comment:32 by , 5 years ago
Checking for the validity of data was much simpler than what I expected.
Should work fine with 98f34a4/OpenModelica.
comment:34 by , 5 years ago
I think it works very well now.
It is also good for me that the Duplicate command has been left in place. In fact, it operates differently from a Copy-Paste pair: it slightly displaces the duplicated object(s), while copy/paste does not.
We have the command "duplicate", which is good as a substitute for copy/paste within the same model.
We still miss a way to copying parts of a model from a model into another, using diagram view.
Will copy/paste across models be implemented in the near future?
It would increase productivity with OMEdit a lot.