Open Object Dialog, Slot Copy/Paste Enhancements for RiverWare 6.8
Phil Weinstein, David Neumann, CADSWES. 8-16-2015. Minor edits: 8-21-2015. [PDF]
Document Home: R:\doc\openObject\CopySlots\OpenObjCopyPasteEnh-Aug2015.docx

Overview

The following enhancements have been applied to the Open Object Dialog for RiverWare 6.8.

  1. Existing Copy Slots and Paste Slots operations now have keyboard shortcuts: Ctrl-C and Ctrl-V.
  2. New operation: Duplicate selected slots.
  3. New operation: Copy selected slots to multiple specified data objects.
         

(1) Open Object Dialog Revisions.

The modified and added Slot Copy, Paste, and Duplicate operations appear in two places within the Open Object dialog.

  1. The menubar's "Slot" menu.
  2. The context menu within the slot list, on the "Slots" tab.

Below is a comparison of the slot list context menu, on a Data Object, for the prior version of RiverWare and the new enhanced version. Note that the "Paste Slots" and "Duplicate Slots" operations are visible in the Open Object dialog for only Data Objects, not for other types of simulation objects.

The Copy Slots and Paste Slots operation now support the standard Ctrl+C and Ctrl+V keys. Copy Slots copies references to the selected slot items to the internal RiverWare slot clipbard (and also copies the names of those slots to the system clipboard). There are a number of places in RiverWare where these slot references (in the internal slot clipboard) can be pasted into a slot list. In the context of the Open Object dialog, this is relevant for only the Paste Slot operation. This creates new instances of the copied slots, if necessary with a slightly different name -- i.e. if the simulation object to which the slots are being pasted already contains slots with the original names.

Note: Apparently because other widgets in this dialog internally support these accelerator keys (but only when such widgets have keyboard input focus), it's turning out that these shortcuts for Copy Slots and Paste Slots are functioning only when the Slot List has keyboard input focus.

It's not entirely clear why they are not working when the overall dialog -- but not specific widgets which internally implement them -- has focus, because the QActions for these operations are implemented at the dialog level. (Temporarily removing them from the slot list context menu does not resolve the problem). Some changes were made to explicitly preserve keyboard input focus within the slot list, when it had been moving to other widgets (for non-fundamental reasons). [This is with Qt 4.8.5].

The new Duplicate Slots operation (available for only Data Objects) is effectively a quick way to perform a Copy Slots and Paste Slots operation, both within the same Open Object Dialog. The newly created slots always have a modified name.

The slot name change consists of a different set of four digits at the end of the slot name. When modifying a slot name to insure uniqueness, all trailing digits, spaces, and underscores are first removed from the slot name, and an underscore and four digits are then appended.

Although the slot clipboard is used internally to implement this operation, the slot clipboard's state is restored (i.e. not ultimately effected by this operation).

Review Note: We may want to use a confirmation dialog for the Duplicate Slots operation. In the initial implementation, the selected slots are immediately created, and become the (only) selected slots in the dialog.

The new "Copy Slots to Data Objects..." operation also uses the slot items selected within the Open Object Dialog's slot list. This brings up the new modal dialog box, of the same name. The operation of that dialog is described in the subsequent section.

Copy Slots to Data Objects Dialog Box

Selecting "Copy Slots to Data Objects..." within an Open Object Dialog shows this dialog (of the same name), and populates the "Copied Slots" panel with the slots which had been selected in the Open Object Dialog. (Note that no slots have actually yet been copied -- clicking "Cancel" in this dialog results in no new slots being created).

The user then clicks the "Add..." button to pick the set of Data Objects to which the "copied slots" are to be copied ...

Items within the two display lists -- "Copied Slots" and "Destination Data Objects" -- are not selectable, so direct editing operations on individual items is not supported. The user may repeadly operate the "Add..." button to add more data objects, or may click th "Clear" button to erase that list and start over. The list of selected slots, as well as the state of the last use of the object selector, are preserved between uses of this operation (within the current RiverWare session).

As illustrated in the accompanying screenshots, the number of "copied slots" and of "destination data objects" are indicated, in parenthesis, in the panel heading text for those lists.

The "Include object name" checkbox is shown only when copying slots from a Non-Data Object (e.g. a from a Reservoir). This allows modification of the behavior of the conventional Paste Slots operation:

For the new Copy Slots to Data Objects operation, in the case of slots copied from a Non-Data Object, the user may choose to prepend the copied slot's object name, or not. These two choices are illustrated below.

 

The "Paste Behavior when Slot Exists" radio buttons control the behavior when a destination object already has a slot with the name of the copied slot (taking into account the "Prepend copied slots' object name" option described above). It supports these three options. (Tooltips on these choices are also indicated here):

  1. Do note paste slot
    "Leave existing matching slot on destination data object intact"
     
  2. Paste and overwrite existing slot
    "Replace existing matching slot on destination data object with copied slot"
     
  3. Paste with new name
    "Add new copy of slot to destination data object with new slot name"

Clicking the OK button performs the Copy Slots to Data Objects operation, as configured within the dialog. This shows a popup dialog indicating the result of the operation (see the following example) and dismisses the dialog (after the result popup is dismissed by the user). Clicking the Cancel button dismisses the dialog without performing any operation.

         

Within a single RiverWare session, all user settings within the Copy Slots to Data Objects dialog are preserved in between uses, as is the dialog's adjusted size and screen location.

--- (end) ---