Skip to content

UserInterface Class

The UserInterface class allows interacting with PrestoPlot graphical user interface. For example, you can add buttons to toolbars to make some actions.


Public Constants

ARRANGE_CASCADE
ARRANGE_HORIZONTALLY
ARRANGE_MAXIMIZE
ARRANGE_MINIMIZE
ARRANGE_TILE
ARRANGE_VERTICALLY


Public Functions

addGraphToolbarButton(graph, image, tooltip, script)
addMenuEntry(label, script)
addToolbarButton(image, tooltip, script)
arrangeWindows(mode)
loadImage(filename)
showMessage(title, message)


Detailed Constants descriptions

ARRANGE_CASCADE

ARRANGE_CASCADE

Rearrange windows overlapping from the top left corner so that all window titles are visible.

ARRANGE_HORIZONTALLY

ARRANGE_HORIZONTALLY

Rearrange windows with equal size from top to bottom.

ARRANGE_MAXIMIZE

ARRANGE_MAXIMIZE

Make windows as large as possible.

ARRANGE_MINIMIZE

ARRANGE_MINIMIZE

Make all windows the size of a small part of the window title bar.

ARRANGE_TILE

ARRANGE_TILE

Rearrange windows with equal size in rows and columns as a grid.

ARRANGE_VERTICALLY

ARRANGE_VERTICALLY

Rearrange windows with equal size from left to right.


Detailed Functions Descriptions

addGraphToolbarButton

addGraphToolbarButton(graph, image, tooltip, script)

Add a button in a graph toolbar. An icon will take place in the Plugins group.

Parameters :

  • graph : A Graph object where the button will be added.

  • image : The image identifier to display in the button.

  • tooltip : The tooltip text to display when mouse hovers.

  • script : The code being executed when the user clicks on the button. The $graph variable will be available to access to the Graph object.

addMenuEntry

addMenuEntry(label, script)

Add an entry in the Plugin menu.

Parameters :

  • label : The menu label

  • script : The code being executed when menu is activated by the user.

addToolbarButton

addToolbarButton(image, tooltip, script)

Add a button in the main PrestoPlot toolbar. The button will take place in the Plugins group.

Parameters :

  • image : The image identifier to display in the button.

  • tooltip : The tooltip text to display when mouse hovers.

  • script : The code being executed when the user clicks on the button.

arrangeWindows

arrangeWindows(mode)

This function will arrange windows to quickly get a smart display.

Parameters :

  • mode : The way windows will be arranged :

    • ARRANGE_TILE: Rearrange windows with equal size in rows and columns as a grid.
    • ARRANGE_HORIZONTALLY: Rearrange windows with equal size from top to bottom.
    • ARRANGE_VERTICALLY: Rearrange windows with equal size from left to right.
    • ARRANGE_CASCADE: Rearrange windows overlapping from the top left corner so that all window titles are visible.
    • ARRANGE_MAXIMIZE: Make windows as large as possible.
    • ARRANGE_MINIMIZE: Make all windows the size of a small part of the window title bar.

loadImage

loadImage(filename)

Load an image file that can be used in the PrestoPlot user interface functions, like addToolbarButton.

Parameters :

  • filename : The image file name to convert (PNG, JPG, GIF).

Return : An identifier referencing the loaded image, that can be given to other functions.

showMessage

showMessage(title, message)

This function will simply display a message popup to the user. The code execution is suspended until the user closes the dialog.

Parameters :

  • title : The title of the displayed message.

  • message : A message to be displayed to the user.