GUI Customization

Both the vovconsole's main GUI and its Node Editor GUI can be customized with the gui.tcl file.

The gui.tcl file is found in one, or both, of the following directories:
  • $VOVDIR/local
  • The server configuration directory (.swd)

$VOVDIR/local/gui.tcl is installation-based customizations, while $SWD/gui.tcl project-based customizations. $VOVDIR/local/gui.tcl will always be sourced, followed by $SWD/gui.tcl (if it exists). Knowledge of Tcl/Tk is required in order to customize the vovconsole GUI.

By running vovconsole with the option -showcustomize, one can see the regions of the GUI which are customizable. The follow two screenshots show the customizable regions of both the main GUI and its Node Editor respectively.


Figure 1.


Figure 2.

With both images above, there are pinkish labels containing "Customize <TkWidgetType> <TkWidgetPath>" information messages. These labels point out where customization may occur, and what Tk widget path to use. For example on the main GUI, both the menu (type=menu path=.menubar) and tasker monitor frame (type=frame path=.fTaskerMonitor.gridbuttons) are customizable. For the Node Editor, the top-level VwxNodeEditor (path=.vgui-nodeviewer.fTop.vwxNodeEditor) is accessible, as well as the lower toolbar (type=frame path=.vgui-nodeviewer.fTop.toolbar).

Additionally, new tabs can be added to the Node Editor.

Set a Custom Title

To set a custom title, call the procedure ::VovGUI::setConsoleTitle in the gui.tcl file. This procedure takes a single argument: the custom string that will be displayed at the beginning of the vovconsole title.

Implementing ::VovGUI::customize

The procedure ::VovGUI::customize is called after many of the elements of the vovconsole have been created. You can create your version of ::VovGUI::customize in your gui.tcl file and operate on the elements. For example you can add a new command in the pop-up menu, a new button along the bottom of the Node Editor, or some artwork in the menu-bar at the top. A very good knowledge of Tcl/Tk is required.
#
# This is a fragment of gui.tcl
#
proc ::VovGUI::customize { widget } {
    set mycompany "mycompany"
    VovMessage "Opportunity to customize window $widget" 3
    switch -glob $widget {
        ".menubar" {
            menu $widget.$mycompany -tearoff false
            $widget add cascade -label {MyCompany} -menu $widget.$mycompany -underline 2
            $widget.$mycompany add command -label "MySettings"  -underline 0  -accelerator 'S' -command {exec /usr/X11/bin/xterm}
	}
        ".popupNode" {
            $widget add command -label "DoSomething" -command "::VovGUI::MySpecialCallBack"
        }
        ".vgui-nodeviewer.fTop.toolbar" {
            # Add a button along the Node Editor's bottom toolbar 
            button $widget.newButton -bd 1 -text "Report Issue" -command "::VovGUI::ReportIssue"
            pack $widget.newButton -side left -padx 10 -pady 2 -fill y -expand 0
        }
        "*.xleFormat" {
            ### Customize the list of formats in "list mode".
            $w insert end "@ID@ @JOBNAME@"
        } 
        ".nodemenu" {
            # Customize the right click popup menu in the set browser
            $w add command -label "Do something" -command MyCallback
        }
    }   
}

# Example of call back 
proc ::VovGUI::MySpecialCallBack {} {
    set nodeId    $::VovGUI::currentNodeID
    set selection [::VovGUI::GetSelection $::VovGUI::currentWidget sel 0]

    puts "DO SOMETHING WITH $nodeId"
    puts "Selection = $sel"
    puts "Widget = $::VovGUI::currentWidget"
}

proc ::VovGUI::ReportIssue { } {
    # This procedure will determine which Node Editor tab is active, and will produce
    # a message box popup with the contents of the tab.  This only applies to
    # the 'Why' and later tabs.  

    # Get notebook widget handle
    set nb ".vgui-nodeviewer.fTop.vwxNodeEditor.xnbMain"
    # Figure out 'active' tab
    set activeTab [$nb raised] 

    # Get text contents of active tab
    switch $activeTab {
        #"node"        { set txt "" }
        #"annotations" { set txt "" }
        "why"         { set txt ["$nb.nbframe.why.xstWhy.text"       get 1.0 end] }
        "out-1"       { set txt ["$nb.nbframe.out-1.xstContent.text" get 1.0 end] }
        "out-2"       { set txt ["$nb.nbframe.out-2.xstContent.text" get 1.0 end] }
        "out-3"       { set txt ["$nb.nbframe.out-3.xstContent.text" get 1.0 end] }
        "out-4"       { set txt ["$nb.nbframe.out-4.xstContent.text" get 1.0 end] }
        "out-5"       { set txt ["$nb.nbframe.out-5.xstContent.text" get 1.0 end] }
        default       { set txt "Tab '$activeTab' functionality not supported" }
    }

    # Create message box popup with the text contents
    set answer [tk_messageBox  -icon question  -type yesno  -title "Do you want to submit the issue?"  -parent .vgui-nodeviewer.fTop  -message "$txt"]

    if {$answer == "yes"} {
        # Add code here to email the text to your issue tracking system
    }
}

Add a Logo to the Console

You can add elements to the console if you know the names of the Tk widgets that compose it. In the following example, we add a graphic element to the menu bar, which happens to be the .menubar widget.
#
# This is a fragment of gui.tcl
# EXAMPLE: Add a logo to the Menu Bar.
#
proc addMyLogo {} {
    if [winfo exists .menubar] {
        set ppm /path/to/mylogo.ppm
        set img [image create photo -file $ppm]
        .menubar add command -image $img
    }
}

# This is a bit tricky.
after 3000 { ::VovGUI::addMyLogo }

Change Colors of Jobs Based on Exit Status

You can use vtk_transition_color_control to choose the color used to represent VALID and FAILED jobs in the console, depending on the exit status. For example, to display VALID jobs that exited with status 10 using the color "pink", write:
# Fragment of gui.tcl
vtk_transition_color_control SET_VALID 10 pink
To display FAILED jobs that exited with status 255 using the color "brown", do the following:
# Fragment of gui.tcl
vtk_transition_color_control SET_FAILED 255 brown

Reference documention for vtk_transition_color_control can be found in the VOV Reference Guide.

Choose the Editors Depending on File Types

Use the procedure ::VovGUI::addFileEditor to describe the editor to be used for files with a given suffix. Example:
# Fragment of gui.tcl
::VovGUI::addFileEditor ".lef" "xterm -e vi"

Change Default Priorities and Retrace Flags

Directly access the controlling variables (one for the control, one for the GUI). Example:
# Controls on priority (case-sensitive)
set ::VovGUI::retrace(priority) Low
set ::VovGUI::dialog(flagspriority.priority) LOW

# Controls on mode
# Values for retrace(mode):  force crossbarriers skipcheck aggressive   or SAFE
set ::VovGUI::retrace(mode)     "crossbarriers force skipcheck"
set ::VovGUI::dialog(flagspriority.flag.force)         1
set ::VovGUI::dialog(flagspriority.flag.crossbarriers) 1
set ::VovGUI::dialog(flagspriority.flag.aggressive)    0
set ::VovGUI::dialog(flagspriority.flag.skipcheck)     1

# Finish by refreshing the console
::VovGUI::UpdatePriorityFooter