Table of Contents

Class: GraphGui sam/output/Graph.py

Responsible for the graphing options gui and graphing the graph.

Purpose: Creates and shows the graphing gui. Gets options for the graph from the user and displays/saves the graph.

Used by: doPlot

Uses: Selector, ErrorHandler, Numeric, Gnuplot, libglade, gtk

Attributes: None

SRS Refs: 3.2.1.6a, 3.2.1.6b, 3.2.1.7, 5.2.2, 5.2.3, 3.2.2.2

Author: mayadm

Date: 16/7/02

Methods   
__init__
__selectAll
__selectNone
closeFile
getGnuplotCommand
getHorizontalLabel
getIsGraphToFile
getStreamProperties
getTitle
getVerticalLabel
getWidgetTree
handleClose
handleGraph
handleGraphToggle
handleLineStyle
handleSelected
openFile
run
writeGnuplotfile
writeTable
  __init__ 
__init__ ( self,  table )

Purpose: Creates a new instance of the class GraphGui. If the environment variable RAMI_SAM_DIR is set, the glade file is looked for in that directory, otherwise looked for in the current directory. Displays the graph gui dialog box to the user using the widget "graphdialog" from the glade file. Adds the list of streams (in table) to the list, and initially greys out both the file entry (since initially it is set to graph to screen) and the select line style label and combo box (since initially no streams are selected). Puts in default labels for the horizontal and vertical label boxes. Connects up the handlers.

Used by: doPlot

Uses: libglade, Selector

Input: table : Table

Output: New instance of the class GraphGui

Preconditions: self.__spec_filename contains the glade file, with the widgets "graphdialog" for the widget tree, "stream_list" for the stream list, "file_fileentry" for the file entry box, "style_combo" for the combo box, "style_label" for the label of the combo box, "haxis_entry" for the horizontal label box, and "vaxis_entry" for the vertical one.

Postconditions: None

SRS Refs: 3.2.1.6a, 3.2.1.6b, 3.2.1.7, 5.2.2, 3.2.2.2

Author: mayadm

Date: 16/7/02

  __selectAll 
__selectAll ( self,  *args )

Purpose: Selects all streams in the streams selector.

Used by: Graph

Uses: None

Input: None

Output: None

Preconditions: None

Postconditions: All streams will be selected in the streams Selector class.

SRS Refs: 5.2.3

Author: lljy

Date: 29/10/02

  __selectNone 
__selectNone ( self,  *args )

Purpose: Returns the widget tree of GraphGui. Needed for testing.

Used by: Graph

Uses: None

Input: None

Output: None

Preconditions: None

Postconditions: No stream will be selected in the stream Selector class.

SRS Refs: 5.2.3

Author: lljy

Date: 29/10/02

  closeFile 
closeFile ( self )

Purpose: Closes the files which have been opened

Used by: OutputToFile

Uses: None

Input: None

Output: None

Preconditions: None

Postconditions: The file is opened if it was opened already.

SRS Refs: 3.2.2.2

Author: rihoward

Date: 4/10/02

  getGnuplotCommand 
getGnuplotCommand ( self )

Purpose: Gets the Gnuplot command entered by the user into the "gnuplot_entry" entry box.

Used by: GraphGui

Uses: None

Input: None

Output: a string

Preconditions: The name of the gnuplot entry box is "gnuplot_entry".

Postconditions: None

SRS Refs: 3.2.1.7

Author: mayadm

Date: 16/7/02

  getHorizontalLabel 
getHorizontalLabel ( self )

Purpose: Gets the horizontal label entered by the user into the "horiz_entry" entry box.

Used by: GraphGui

Uses: None

Input: None

Output: a string

Preconditions: The name of the horizontal label entry box is "horiz_entry"

Postconditions: None

SRS Refs: 3.2.1.7

Author: mayadm

Date: 16/7/02

  getIsGraphToFile 
getIsGraphToFile ( self )

Purpose: Returns 1 if the user has selected graph to file, 0 if the user has selected graph to screen.

Used by: GraphGui

Uses: None

Input: None

Output: integer (0 or 1)

Preconditions: None

Postconditions: None

SRS Refs: 3.2.1.7

Author: mayadm

Date: 19/7/02

  getStreamProperties 
getStreamProperties ( self,  index )

Purpose: Given an index of a stream, returns the properties of that stream as a string. Returns a default line style of points if the stream index does not exist.

Used by: GraphGui

Uses: None

Input: index: int

Output: string

Preconditions: None

Postconditions: None

SRS Refs: 3.2.1.7

Author: mayadm

Date: 19/7/02

  getTitle 
getTitle ( self )

Purpose: Gets the title entered by the user into the "title_entry" entry box.

Used by: GraphGui

Uses: None

Input: None

Output: a string

Preconditions: The name of the title entry box is "title_entry".

Postconditions: None

SRS Refs: 3.2.1.7

Author: mayadm

Date: 16/7/02

  getVerticalLabel 
getVerticalLabel ( self )

Purpose: Gets the vertical label entered by the user into the "vert_entry" entry box.

Used by: GraphGui

Uses: None

Input: None

Output: a string

Preconditions: The name of the vertical label entry box is "vert_entry".

Postconditions: None

SRS Refs: 3.2.1.7

Author: mayadm

Date: 16/7/02

  getWidgetTree 
getWidgetTree ( self )

Purpose: Returns the widget tree of GraphGui. Needed for testing.

Used by: tests

Uses: None

Input: None

Output: GladeXML object

Preconditions: None

Postconditions: None

SRS Refs: None

Author: mayadm

Date: 30/9/02

  handleClose 
handleClose ( self,  *args )

Purpose: Handles the user clicking on the close button. Hides the graph dialog gui, and mainquits out of the loop.

Used by: GraphGui

Uses: gtk

Input: None

Output: None

Preconditions: A mainloop has been entered. The name of the widget tree in the glade file is "graphdialog".

Postconditions: None

SRS Refs: 3.2.1.7

Author: mayadm

Date: 16/7/02

  handleGraph 
handleGraph ( self,  *args )

Purpose: Handles the user clicking on the graph button. Gets all the options entered by the user and plots the graph with the options (either to screen or to a file or as gnuplot commands, along with the data needed to plot). Does not mainquit since the user may wish to change options and re-graph.

Used by: GraphGui

Uses: Gnuplot, ErrorHandler

Input: None

Output: None

Preconditions: None

Postconditions: None

SRS Refs: 3.2.1.6a, 3.2.1.6b, 3.2.1.7, 5.2.2, 3.2.2.2

Author: mayadm

Date: 16/7/02

Exceptions   
CustomError( "Warning \"" + filename + "\" filename" + " already used", 1 )
  handleGraphToggle 
handleGraphToggle ( self,  *args )

Purpose: Handles the user clicking on either the screen or file or gnuplot commands radiobuttons. Sets __is_graph_to_file to 1 if the file radio button is active, 0 otherwise. Sets self.__isOutputGnuplot_file to 1 if the gnuplot radio button is active, 0 otherwise. Greys out the file entries if the screen radio button is active.

Used by: GraphGui

Uses: None

Input: *args : unused arguments

Output: None

Preconditions: A mainloop has been entered. The name of the file entry box is "fileentry1", the name of the file radio button is "file_radiobutton", the name of the gnuplot radiobutton is "gnuplot_radiobutton", the name of the gnuplot file entry is "fileentry2".

Postconditions: None

SRS Refs: 3.2.1.6a, 3.2.1.6b, 3.2.1.7, 3.2.2.2

Author: mayadm

Date: 16/7/02

  handleLineStyle 
handleLineStyle ( self,  *args )

Purpose: Handles the user changing the selected line style. Sets the line style for whatever stream(s) are currently selected.

Used by: GraphGui

Uses: None

Input: *args : unused arguments

Output: None

Preconditions: A mainloop has been entered. The name of the combo entry box for the line style is "linestyle_comboentry".

Postconditions: None

SRS Refs: 3.2.1.6a, 3.2.1.6b, 3.2.1.7

Author: mayadm

Date: 19/7/02

  handleSelected 
handleSelected (
        self,
        obj,
        *args,
        )

Purpose: Handles the user clicking on the stream list. Checks that the list object has caused the event, then changes its Selector's selected items. Also displays the already selected options (if any) for that stream in the option box(es). If no streams are selected, the select line style label and combo are greyed out.

Used by: GraphGui

Uses: ErrorHandler

Input: obj : GtkList, *args : unused arguments

Output: None

Preconditions: The name is "stream_list" for the stream list, "linestyle_combo" for the combo box, "style_label" for the label of the combo box, "linestyle_comboentry" for the combo entry box.

Postconditions: None

SRS Refs: 3.2.1.7

Author: mayadm

Date: 19/7/02

  openFile 
openFile ( self,  filename )

Purpose: Opens the file of the filename given, ready for writing. Used by: HandleGraphedClicked

Uses: None

Input: filename : string

Output: None

Preconditions: None

Postconditions: None

SRS Refs: 3.2.2.2

Author: rihoward

Date: 4/10/02

Exceptions   
CustomError( "Warning \"" + filename + "\" filename" + " already used", 1 )
  run 
run ( self )

Purpose: Runs a mainloop waiting for a user event.

Used by: doPlot

Uses: gtk

Input: None

Output: None

Preconditions: None

Postconditions: A mainloop has been entered

SRS Refs: 3.2.1.7

Author: mayadm

Date: 16/7/02

  writeGnuplotfile 
writeGnuplotfile ( self )

Purpose: Writes the .gplot file containing all the commands then writes the header line to the .data file. Each column represents a stream and the stream id is added to the label for that column.

Used by: writeTable

Uses: string

Input: None

Output: None

Preconditions: File has been opened. The name of the gnuplot file entry box is "save_entry2".

Postconditions: None

SRS Refs: 3.2.2.2

Author: rihoward

Date: 4/10/02

  writeTable 
writeTable ( self )

Purpose: Writes the table to the file. First writes the header, then prints the table as a single table with columns for each stream). In the case of a Table with a single array, the stream ids are not shown since they are unnecessary.

Used by:

Uses: string

Input: None

Output: None

Preconditions: The name of the gnuplot file entry box is "save_entry2".

Postconditions: None

SRS Refs: 3.2.2.2

Author: rihoward

Date: 4/10/02


Table of Contents

This document was automatically generated on Wed Oct 30 23:04:21 2002 by HappyDoc version 2.0