Viewer

The Viewer object represents a standalone image viewer. A collection of Viewer objects is returned by the Viewers object, which is obtainable via the DOpus.viewers property. For functions launched from within a viewer (e.g. from its toolbar), the current Viewer object is provided by the ClickData.func.viewer property.

 

Property Name

Return Type

Description

bottom

int

Returns the bottom coordinate of the viewer window.

current

object:Item 

Returns an Item object representing the currently displayed image.

files

collection:Item 

Returns a collection of Item objects representing the images in the viewer's list.

foreground

bool

Returns True if the viewer is currently the foreground (active) window in the system.

index

int

Returns the index of the currently viewed image within the viewer's list of files.

lastactive

bool

Returns True if the viewer is the most recently active viewer.

left

int

Returns the left coordinate of the viewer window.

parenttab

object:Tab 

Returns a Tab object representing the tab that launched the viewer (if there was one, and if it still exists).

right

int

Returns the right coordinate of the viewer window.

title

string

Returns or sets the title bar string for the viewer window.


You can use several special "tokens" in the title string to insert various pieces of information:

        %P - full path of the currently viewed image
        %N - name of the current displayed image
        %R - drive root of the current image
        %E - displays * if the image's metadata has been modified and not saved
        %I - current image's index (number) in the list of images
        %O - total number of images in the list
        %W - width of the current image
        %H - height of the current image
        %D - depth of the current image (bits per pixel)
        %M - current image's dimensions
        %S - file size on disk
        %F - folder name
        %C - collection name if current image is marked
        %L - any labels assigned to the current image
        %T -  original title (useful for simply adding a prefix or suffix to the title)
        %% - insert a literal % character

top

int

Returns the top coordinate of the viewer window.

 

Method Name

Arguments

Return Type

Description

AddFile

<string:filepath>
<int:index>

none

Adds the specified file to the viewer's current list of files. You can either pass a string or a Path object to indicate the file to add to the list. By default the file will be added to the end of the list, unless you specify a 0-based index as the second argument.

Command

<string:command> or

<Command:command>

none

Runs a command in the context of this viewer window. You can either pass a string or a Command object.

 

If the argument you pass is a string then it can only be a viewer command argument as documented for the Show VIEWERCMD command. For example, Command(“next”) would run the Show VIEWERCMD=next command in the context of this viewer.

 

If you pass a Command object then all commands (internal or external) can be used.

RemoveFile

<int:index> or

<string:filepath>

none

Removes the specified file from the viewer's current list of files. You can either pass the 0-based index of the file to remove, or the filepath (either as a string or a Path object).

SetTaskbarGroup

<string:group>

bool

Used to change how the viewer window is grouped with other Opus windows on the taskbar. Specify a group name to move the window into an alternative group, or omit the group argument to reset back to the default group. If one or more windows are moved into the same group, they will be grouped together, separate from other the default group.

This only works on Windows 7 and above, and only when taskbar grouping is enabled. Group names are limited to 103 characters and will be truncated if longer. Spaces and dots in group names are automatically converted to underscores.

Returns true on success.