activity-browser icon indicating copy to clipboard operation
activity-browser copied to clipboard

Copy paste of process inputs

Open bsteubing opened this issue 3 years ago • 5 comments

related to https://github.com/LCA-ActivityBrowser/activity-browser/issues/687 it would be a great time-saver in inventory modeling if one could copy-paste exchanges from one activity to another. This would save the time consuming step of searching for specific inputs in the respective (biosphere and technosphere) databases.

Imagined procedure:

  • Process A has two technosphere inputs that I would like Process B to also have
  • I select these to inputs in Process A, right-click "copy exchanges"
  • I open Process B and right-click "paste exchanges"
  • same for biosphere flows

bsteubing avatar Nov 17 '21 22:11 bsteubing

Like the idea!

I don't have the time to implement this now, but as a clarification/consideration question for whoever picks this up: What if user copies an exchange from source activity that already exists in the target activity?

Which should happen?:

  1. ~~Exchange amount is overwritten with data from source activity~~
  2. ~~Exchange amount is not changed (exchange is not copied over)~~
  3. Exchange amounts are added (not a fan of this one)

The same question exists for Formulas, though option 3 wouldn't very difficult to do, though again, I already think we shouldn't do 3.

marc-vdm avatar Feb 17 '22 15:02 marc-vdm

Like the idea!

I don't have the time to implement this now, but as a clarification/consideration question for whoever picks this up: What if user copies an exchange from source activity that already exists in the target activity?

Which should happen?:

  1. Exchange amount is overwritten with data from source activity
  2. Exchange amount is not changed (exchange is not copied over)
  3. Exchange amounts are added (not a fan of this one)

The same question exists for Formulas, though option 3 wouldn't very difficult to do, though again, I already think we shouldn't do 3.

Personally I would prefer option 3, because then the modeller can visually see that an extra activity is added, and decide afterwards if they want both, or wants to delete one of them

simb-sdu avatar Jul 15 '22 11:07 simb-sdu

After thinking about this more, I indeed think option 3 would be best. Having duplicate exchanges is also not a problem for Brightway, which is nice for development.

Some thoughts for implementation: We'd need to copy the following data to make sure this works well: The process (exchange) key, amount, formula (if any) and comment (if any).

We can add the copy function to the right click context menu

marc-vdm avatar Jul 21 '22 10:07 marc-vdm

I agree with your throughts. Maybe there are some conflicts if using activity-parameters (i did have some trouble with them, hence i just model with database-parameters)

simb-sdu avatar Jul 21 '22 10:07 simb-sdu

There are probably two relatively flexible (from the end-user's standpoint) ways to implement this mechanism. One would be to copy formatted data into the clipboard, in the same way programs like Excel do; pasting formatted data like that would then trigger this behavior.

For more advanced structuring of data, another approach may be needed, such as an internal clipboard. This would be some globally accessible class which contains the data of the internal clipboard. Pressing 'ctrl+V' or pasting from the clipboard would then call the 'paste' method, which first checks if the internal clipboard's data is the same as the clipboard data. If so, it uses the more advanced paste method. If it's not the same, then the default ctrl+V behaviour would apply (possibly just do nothing). This check would make it possible to use the system-wide clipboard alongside the internal clipboard.

Of course this all depends on what kind of information would need to be copied along with the cell data, in order to be sure the pasting action happens correctly.

Joeytje50 avatar Aug 01 '22 14:08 Joeytje50