Table Of Contents

Previous topic

pyviblib.gui.resources

Next topic

pyviblib.gui.windows

This Page

pyviblib.gui.widgets

GUI building blocks of the windows and dialogs of PyVib2

Inheritance diagram of pyviblib.gui.widgets

Classes

BaseWidget
base class for all widgets
MoleculeRenderWidget
widget for 3D rendering
MoleculeThumbnailWidget
small frame for exploring a molecule
ButtonToolbar
button toolbar
VibrationalToolbar
navigation through vibrations
VibrationalToolbarLight
for exploring single vibration
NavigationToolbar
manipulating camera of MoleculeRenderWidget
WindowNavigationToolbar
toolbar for switching between windows
GeometryMeasureToolbar
widget for measuring distances, angles etc.
VibNavigationFrame
component of VibrationalToolbar
SplashScreen
shown during a long operation
InfoWidget
widget for providing a help text
TwoDCircles
canvas for rendering matrices
CorrelationResultsTable
table for representing matrices
CorrelationResultsNoteBook
exploring results of a correlation of v/m
WizardWidget
wizard widget
ChooseColorWidget
widget for choosing a color
AxesSettingsWidget
widget for setting properties of axes
PropertiesWidget
widget for showing text properties
PatchedPmwOptionMenu
patched version of Pmw.OptionMenu

Functions

show_exception()
show an exception in a text dialog
mouse_wheel()
mouse wheel callback for a widget
bind_mouse_wheel()
bind the mouse wheel events to a widget
pmw_widget()
instantiate a Pmw widget
Author:Maxim Fedorovsky
class pyviblib.gui.widgets.BaseWidget(**kw)

Base class for all widgets.

This class defines a set of protected methods that are called in the initializer in the following sequence:

_init_vars()
initialize some variables
_constructGUI()
construct the GUI of the widget
_declare_properties()
declare properties of the widget
_bind_help()
bind help messages to the GUI components
_bind_events()
bind events

These methods are intended to be overridden in subclasses. The base class implementations do nothing.

The following protected instance variables are created:

_smartdict
to store options
_varsdict
to store GUI variables
_balloon
to provide help message on the GUI

Initializer of the class.

Keywords arguments are options of the widget.

class pyviblib.gui.widgets.MoleculeRenderWidget(master, **kw)

Widget for 3D rendering.

The class inherits from vtkTkRenderWidget and overrides the mouse button events.

The following readable and writable properties are exposed:
molecule
molecule (pyviblib.molecule.Molecule)
molecule_mode
molecule rendering mode
bonds_mode
bonds rendering mode
color_sphere_1
used for rendering vibrational motion
color_sphere_2
used for rendering vibrational motion
color_picked_atom
color of picked atoms
marked_vib_atoms
mark vibrational motion of these atoms
mark_fragment
whether to mark v/m on marked_vib_atoms
show_marked_only
whether to show v/m only on fragment
do_picking
whether the picking of atoms is allowed
do_render_picked
whether picked atoms are to be rendered
do_sync_rotation
whether the synchronized rotation is on
do_sync_zoom
whether the synchronized zooming is om
clicked_atom_callback
called when an atom has been clicked
clicked_bond_callback
called when a bond has been clicked
clicked_vibatom_callback
called when an v/m atom has been clicked
background
background of the widget
perspective_projection
whether the perspective projection is on
resolution
resolution
camera
camera installed in the widget
camera_state
state of the camera currenly installed
The following read-only properties are exposed:
picked_atoms_indices
list of picked atoms
Npicked
number of picked atoms
renderer
renderer (vtk.vtkRenderer)
The following public methods are exported:
cleanup()
remove all actor from the widget
render_molecule()
render the molecule
render_vibration()
render a vibration
render_triangle()
render a triangle
render_scalars()
render scalar values e.g. ACPs
render_gcp()
render group coupling matrices (GCPs)
rotate()
rotate the molecule
zoom()
zoom in/out
start_pairs_picking()
start a picking of atoms
end_pairs_picking()
end a picking of atoms
depick_atoms()
unpick atoms
highlight_picked_atoms()
highlight picked atoms
remove_triangles()
remove triangles
synchronize_camera_state()
specify a widget to synchronize with
get_node()
get a certain node in the widget
snapshot()
make a snapshot of the 3D window
create_animation_frames()
create frames for animating vibration

Initializer of the class.

Parameters:
  • master – parent widget
  • molecule – molecule
  • vib_toolbar – vibrational toolbar
  • msgBar – message bar (Pmw.MessageBar)
  • molecule_mode – render the molecule in the ball & stick, stick or van der Waals radii representation, one of (resources.NUM_MODE_BALLSTICK, resources.NUM_MODE_STICK, resources.NUM_MODE_VDW)
  • bonds_mode – render a bond in the molecule as a cylinder or two cylinders, one of (resources.NUM_MODE_BONDS_MONOLITH_COLOR, resources.NUM_MODE_BONDS_ATOMS_COLOR)
  • resolution – resolution
  • background – background color in the HTML format
  • hydrogen_bond – whether hydrogen bonds are to be rendered
  • atom_labels – whether atom labels are to be rendered
  • color_sphere_1 – color of the first hemisphere in the sphere mode representation of vibrational motion
  • color_sphere_2 – color of the first hemisphere in the sphere mode representation of vibrational motion
  • bonds_transparency – transparency level of the bonds a value between 0. (completely opaque) and 1. (completely transparent)
  • color_picked_atom – color of picked atoms in the HTML format
  • invert_phase – whether the phase of vibrations is to be inverted
  • mark_fragment – whether to mark the v/m on a fragment defined by the marked_vib_atoms property
  • show_marked_only – whether to show v/m only on a fragment defined by the marked_vib_atoms property
  • do_picking – whether picking of atoms is allowed
  • do_render_picked – whether picked atoms are to be rendered
  • do_sync_rotation – whether the synchronized rotation is to be enabled, the second render widget must be supplied for this to work, see synchronize_camera_state()
  • do_sync_zoom – whether the synchronized zooming is to be enabled the second render widget must be supplied for this to work, see synchronize_camera_state()
cleanup()
Clean up the widget by removing all its actors.
create_animation_frames(Lx, scale_factor, nFrames, resolution=10, format_='ppm', transparent_bg=False)

Create a series of files for animation of a vibration.

The function does not compile the result images to the animation. It produces the files and returns the name of file with the list of the created frames. The files will be stored in a temporaral directory.

Parameters:
  • Lx – cartesian excursion of the vibration (one-based ndarray), shape: (1 + Natoms, 4) with Natoms is the number of atoms
  • scale_factor – numeric factor with which the radii of the spheres are multiplied
  • nFrames – number of frame pro direction
  • resolution – resolution
  • format – image format one of (‘jpeg’, ‘tiff’, ‘png’, ‘eps’, ‘ppm’, ‘gif’), if ‘gif’ is supplied, then the ppmtogif utility from the Netpbm package should be installed. See http://netpbm.sourceforge.net/
  • transparent_bg – whether the background should be made transparent
depick_atoms(atom_index_list=None)

Deselect the picked atoms.

Parameter:atom_index_list – list of 0-based indices of PICKED atoms these are NOT indices of atoms to be unpicked. If None, use all the PICKED atoms

If the only element in the list is -1 -> depick the last picked atom.

end_pairs_picking()
End the synchronous picking of atoms.
get_node(category, index)

Get a node.

Parameters:
  • category – type of the node, one of (‘atoms’, ‘bonds’, ‘vibatoms’, ‘atom_labels’)
  • index – index of the node (zero-based)
Returns:

None unless the arguments are valid or nothing was found.

highlight_picked_atoms(atom_index_list, highlight=True)

Highlight/unhighlight the picked atoms.

Nothing is done the atom list is not supplied.

Parameters:
  • atom_index_list – atom indices (null-based ndarray), indices are null-based
  • highlight – whether to highlight
pick_atoms(atom_index_list=None)

Pick given atoms.

If the atom list is not supplied, all the atoms are picked.

Parameter:atom_index_list – atom indices (zero-based ndarray), indices are zero-based
remove_triangles()
Remove the triangles.
render_gcp(acp, groups, scale_factor=1.0, ambient=0.20000000000000001)

Render group contribution patterns (GCPs).

The contributions are placed in center of gravities of the groups.

Parameters:
  • acp – atomic contribution patterns (one-based ndarray), shape: (1 + Ngr,) with Ngr being the number of groups
  • groups – groups (null-based list), atom numbers are one-based, example: [[1, 4], [2, 7]]
  • scale_factor – numeric factor with which the radii of the spheres are multiplied
  • ambient – ambient lightning coefficient
render_molecule(**kw)

Render the molecule.

Parameters:
  • resolution – resolution
  • molecule_mode – render the molecule in the ball & stick, stick or van der Waals radii representation one of (resources.NUM_MODE_BALLSTICK, resources.NUM_MODE_STICK, resources.NUM_MODE_VDW)
  • bonds_mode – render a bond in the molecule as a cylinder or two cylinders one of (resources.NUM_MODE_BONDS_MONOLITH_COLOR, resources.NUM_MODE_BONDS_ATOMS_COLOR)
  • color_picked_atom – color of picked atoms in the HTML format
  • rounded_bond – whether the bonds are to be rendered rounded
  • hydrogen_bond – whether hydrogen bonds are to be rendered
  • atom_labels – whether atom labels are to be rendered
render_scalars(scalars, scale_factor=1.0, marked_atoms=None, ambient=0.20000000000000001)

Render scalar values on the atoms such as e.g. ACPs.

Parameters:
  • scalars – values to be rendered (one-based array), shape: (1 + Natoms) with Natoms being the number of atoms in the molecule
  • scale_factor – numeric factor with which the radii of the spheres are multiplied
  • marked_atoms – list of atom indices (one based to be picked)
  • ambient – ambient lightning coefficient
render_triangle(i1, i2, i3, **kw)

Render a triangle.

Parameter:i1, i2, i3 – coordinates of the vertices

See also

pyviblib.gui.rendering.BaseNode

render_vibration(**kw)

Render a vibration.

Parameters:
  • vib_no – number of the vibration, must be supplied if vib_toolbar is None
  • resolution – resolution
  • mode – sphere, arrow representation or animation, one of (resources.STRING_MODE_VIB_REPRESENTATION_SPHERES, resources.STRING_MODE_VIB_REPRESENTATION_ARROWS, resources.STRING_MODE_VIB_REPRESENTATION_ANIMATION) must be supplied if vib_toolbar is None
  • rep_type – cartesian or mass-weighted excursions one of (resources.STRING_VIB_ENERGY, STRING_VIB_EXCURSIONS) must be supplied if vib_toolbar is None
  • rep_subtype – representation subtype one of (STRING_VIB_ENERGY_VOLUME, STRING_VIB_ENERGY_VOLUME_ZERO_POINT, STRING_VIB_EXCURSIONS_DIAMETER, STRING_VIB_EXCURSIONS_DIAMETER_ZEROPOINT, STRING_VIB_EXCURSIONS_DIAMETER_STANDARD) must be supplied if vib_toolbar is None
  • scale_factor – multiply factor for the amplitude of v/m must be supplied if vib_toolbar is None
  • invert_phase – whether the phase of the vibration is to be inverted, must be supplied if vib_toolbar is None
  • color_sphere_1 – color of the first hemisphere in the sphere mode i.e. resources.STRING_MODE_VIB_REPRESENTATION_SPHERES
  • color_sphere_2 – color of the first hemisphere in the sphere mode, i.e. resources.STRING_MODE_VIB_REPRESENTATION_ARROWS
rotate(euler_azimuth=0.0, euler_elevation=0.0, euler_roll=0.0)

Rotate the active camera at given Euler angles.

Parameters:
  • euler_azimuth – angle of rotation about the view up vector centered at the focal point of the camera
  • euler_elevation – angle of rotation about the cross product of the direction of projection and the view up vector centered on the focal point
  • euler_roll – angle of rotation about the direction of projection of the camera

The rotation does not affect the synchronized widget.

snapshot(filename, format_='tiff', magnification=1, resolution=None)

Make a snapshot of the 3D render window.

Parameters:
  • filename – file name of the snapshot
  • format – image format, one of (‘jpeg’, ‘tiff’, ‘png’, ‘eps’, ‘ppm’)
  • magnification – integer magnification factor for the 3D window
  • resolution – resolution, if None, use the current resolution
start_pairs_picking(pairs, callback)

Start a synchronous picking of atoms in two render widgets.

Parameters:
  • pairs – reference to the picked atom pairs
  • callback – callable function which accepts one argument being the widget
synchronize_camera_state(sync_widget)

Set a render widget for synchronous rotation/zooming.

By default the rotation and zooming are synchronized. Consider the do_sync_rotation and do_sync_zoom properties to control the synchronized behaviour.

Parameter:sync_widget – the render widget can be None
zoom(zoomFactor)

Zoom in/out.

Parameter:zoomFactor – the height of the viewport in world-coordinate distances.

Note

This factor works as an “inverse scale” i.e. larger numbers produce smaller images. This factor has no meaning if the perspective projection is on.

The zooming does not affect the synchronized widget.

class pyviblib.gui.widgets.MoleculeThumbnailWidget(master, mol, **kw)

Small frame for viewing a molecule.

The widget is made up of a Molecule menu at the top, a 3D render widget and a check box. The contents of the menu reflects the data which the molecule possesses.

The following readable and writable property is exposed:
checked
if the widget is “checked”
The following read-only properties are exposed:
molecule
molecule
renderWidget
render widget

Initializer of the class.

Parameters:
  • master – parent widget
  • mainApp – reference to the main window if supplied, the Molecule menu is added
  • check_command – called if the status of the check box is changed
update_menu()
Update the Molecule menu.
class pyviblib.gui.widgets.ButtonToolbar(master, **kw)

Button toolbar.

The widget is based on Tkinter.Frame.

The following public methods are exported:
add_button()
add a button
add_separator()
add a separator

Initializer of the class.

Parameters:
  • master – parent widget
  • style

    style of the toolbar:

    • 0: raised with a thin border
    • 1: flat without any border
  • horizontal – whether the toolbar is horizontal
  • button_pad – padding for the buttons being added
add_button(**kw)

Add a button.

The methods accepts the keyword arguments for Tkinter.Button.

Parameters:
  • helptext – help message which is shown if the mouse is over the button
  • imagename – name of the image resource either the imagename or image argument must be supplied
Returns:

the reference to the button created

add_separator()
Add a separator.
class pyviblib.gui.widgets.VibrationalToolbar(master, **kw)

Widget for navigating through vibrations.

The widget is based on Pmw.ScrolledFrame.

The following read-only properties are exposed:
mode
sphere, arrow, animation or structure
rep_type
cartesian or mass-weighted excursions
rep_subtype
representation subtype
invert_phase
whether the phase is to be inverted
scale factor
factor for the amplitude of v/m
The following readable and writable properties are exposed:
vib_no
number of the current vibration
The following public methods are exported:
go_backward()
go one vibration backward
go_forward()
go one vibration forward
go_first()
go to the first vibration
go_last()
go to the last vibration
increase_scale_factor()
increase the scale factor
decrease_scale_factor()
decrease the scale factor

Initializer of the class.

The size of the toolbar is hardcoded to be 1000x105.

Parameters:
  • master – parent widget
  • freqs – wavenumbers of the vibrations (one-based ndarray), shape: (1 + NFreq, ) with NFreq being the number of vibrations
  • render_callback – called if a vibration is to rendered, the callable does not require any arguments
decrease_scale_factor(*dummy)
Decrease the scale factor.
go_backward(*dummy)
Go one vibration back.
go_first()
Go to the first vibration.
go_forward(*dummy)
Go one vibration forward.
go_last()
Go to the last vibration.
increase_scale_factor(*dummy)
Increase the scale factor.
class pyviblib.gui.widgets.VibrationalToolbarLight(master, **kw)

Like VibrationalToolbar but for exploring single vibration.

Supports also marking of vibrational motion on a fragment.

The following readable and writable properties are exposed:

vib_no
number of the vibration
rep_type
cartesian or mass-weighted excursions
rep_subtype
representation subtype
invert_phase
whether the phase is to be inverted
sync_toolbar
VibrationalToolbarLight to synchronize with

The following properties are exposed uf fragment_controls=True was supplied in the Initializer of the class:

mark_fragment
fragment to be marked
show_marked_only
show vibrational motion only on the fragment

The following public methods are exported:

increase_scale_factor()
increase the scale factor
decrease_scale_factor()
decrease the scale factor

Initializer of the class.

Parameters:
  • master – parent widget
  • rep_type – cartesian or mass-weighted excursions one of (resources.STRING_VIB_ENERGY, STRING_VIB_EXCURSIONS)
  • rep_subtype – representation subtype one of (STRING_VIB_ENERGY_VOLUME, STRING_VIB_ENERGY_VOLUME_ZERO_POINT, STRING_VIB_EXCURSIONS_DIAMETER, STRING_VIB_EXCURSIONS_DIAMETER_ZEROPOINT, STRING_VIB_EXCURSIONS_DIAMETER_STANDARD)
  • scale_factor – multiply factor for the amplitude of vibrational motion
  • invert_phase – whether the phase of the vibration is to be inverted
  • fragment_controls – whether to create the controls for marking fragment
  • mark_fragment – whether to mark vibrational motion of a fragment
  • show_marked_only – whether to show vibrational motion on a fragment only
  • roa_gen – whether to show the Raman/ROA generation button
  • vcd_gen – whether to show the IR/VCD generation button
  • sync_toolbar – VibrationalToolbarLight to synchronize with
  • molinv – molecular invariant or cross-section to be opened in the Raman/ROA generation interface
  • intensity – intensity to be opened in the IR/VCD generation interface
  • invert_roa – whether to invert the sign of ROA
  • invert_vcd – whether to invert the sign of VCD
decrease_scale_factor(*dummy)
Decrease the scale factor.
increase_scale_factor(*dummy)
Increase the scale factor.
class pyviblib.gui.widgets.NavigationToolbar(master, renderWidget, **kw)

Manipulating camera of MoleculeRenderWidget.

The following public methods are exported:
save_camera_state()
save the camera state to a dictionary
update_camera()
update the camera state

Initializer of the class.

Parameters:
  • master – parent widget
  • renderWidget – render widget to be manipulated
  • orientation

    orientation for the toolbar:

    • 0: horizontal
    • 1: vertical
save_camera_state(camera_state=None)

Save the camera camera state to a dictionary.

Parameter:camera_state – the dictionary to save to, if None save to the internal dictionary
update_camera(camera_state)

Update the current camera.

Parameter:camera_stat – dictionary with the camera state
class pyviblib.gui.widgets.WindowNavigationToolbar(master, **kw)

Toolbar for switching between windows.

Initializer of the class.

Parameters:
  • master – parent widget
  • mainApp – reference to the main window of PyVib2
  • backbutton – whether to create a back button
  • homebutton – whether to create a home button
  • backbutton_command – command for the back button
class pyviblib.gui.widgets.GeometryMeasureToolbar(master, renderWidget, **kw)

Toolbar for measuring distances, angles and dihedral angles.

The following readable and writable property is exposed:
resolution
resolution of the connected render widget

Initializer of the class.

Parameters:
  • master – parent widget
  • widget – render widget to connect to
  • horizontal – whether the toolbar is horizontal
class pyviblib.gui.widgets.VibNavigationFrame(master, freqs, **kw)

Frame for navigating through vibrations.

Component of VibrationalToolbar.

The following readable and writable property is exposed:
vib_no
number of the current vibration
sync_vib_frame
a vibrational frame to synchronize with
The following public method is exported:
enable_controls()
enable / disable the controls

Initializer of the class.

Parameters:
  • master – parent widget
  • freqs – wavenumbers (one-based ndarray), shape: (1 + NFreq,) with NFreq being the number of vibrations
  • label – descriptive text
  • label_width – length of the descriptive text
  • changed_callback – callable, accepting vibration number
enable_controls(enable_)

Enable / disable the controls.

Parameter:enable – whether the controls are to be enabled
class pyviblib.gui.widgets.SplashScreen(master, text, **kw)

Splash screen which can be shown during a long operation.

Initializer of the class.

Parameters:
  • master – parent widget
  • text – text to be shown
  • font – font for rendering text
  • overrideredirect – if True the splash will be ignored by the window manager
class pyviblib.gui.widgets.InfoWidget(master, **kw)

Widget for providing a help text.

Initializer of the class.

Parameters:
  • master – parent widget
  • text – text to be shown
  • height – number of rows in the widget
  • icon – whether to render the icon to the left of the text
class pyviblib.gui.widgets.TwoDCircles(master, **kw)

Canvas for rendering matrices such as e.g. GCMs, overlaps or similarities.

The widget is based on Tkinter.Canvas.

The following public methods are exported:
update()
update the canvas
mark_rect_ij()
mark a rectangle on the canvas

Initializer of the class.

All arrays supplied in the keyword args must be one-based ndarrays.

Parameters:
  • master – parent widget
  • data – matrix with numeric values
  • mode – how to render the matrix, one of (resources.NUM_MODE_WHOLE, resources.NUM_MODE_UPPERHALFONLY, resources.NUM_MODE_LOWERHALFONLY
  • sumup_diag – whether to sum the elements in the upper- or lowerhalf mode
  • type – whether the square or the diameters of the circles are proportional to the values (resources.NUM_TYPE_PROPORTIONAL_TO_SQUARE, resources.NUM_TYPE_PROPORTIONAL_TO_DIAMETER)
  • labels_on – render the labels
  • labels1_cols – first column headers
  • labels2_cols – second column headers
  • labels1_rows – first row headers
  • labels2_cols – second row headers
  • bbox_on – whether to render the bounding box around the circles
  • font_labels1 – font for the headers1
  • font_labels2 – font for the headers2
  • color_positive – filling color for positive values
  • color_negative – filling color for negative values
  • color_rect – color of the bounding rectangles
  • scale_factor – number for the radii of the circles
  • max_circlewidth – maximum width of the bounding box of a circle in pixel
  • indent – indent from the upper left corner of the canvas
  • text_padding – padding with a label box
  • full_circle – value of a completely filled circle
  • color_highlight – highlighting color for a selected pair
  • ndigits – show numbers under 10**(-ndigits) in the message bar as 0 if None, show the number in the scientific notation
  • msgBar – message bar for messages
  • click_callback – called on a double click
  • mouse_motion_callback – called when the mouse enters the canvas (args: i j)
  • mouse_leave_callback – called when the mouse leaves the canvas (no args)
  • render_data2 – render a vertical column
mark_rect_ij(ij, mark=True)

Mark/unmark a rectangle.

Parameters:
  • ij – identifier of the rectangle
  • mark – whether to mark
update(**kw)
Update the canvas. See the keywords of the initializer.
class pyviblib.gui.widgets.CorrelationResultsTable(master, matrix, freqs_ref, freqs_tr, include_tr_rot, **kw)

Table for representing matrices e.g. overlaps or similarities.

The widget is based on Pmw.ScrolledText.

The following read-only properties are exposed:
csv
contents in the CSV format
data
contents as a matrix
labels
labels as a dictionary
The following public methods are exported:
update_table()
update the table
ij_to_vibno()
convert rows and columns to vibration numbers
vibno_to_ij()
convert vibration numbers to rows and columns

Initializer of the class.

Parameters:
  • matrix – matrix to show (one-based ndarray), shape: (1 + NFreq_ref, 1 + NFreq_tr)
  • freqs_ref – wavenumbers of the reference molecule (one-based ndarray), shape: (1 + NFreq_ref, )
  • freqs_tr – wavenumbers of the trial molecule (one-based ndarray), shape: (1 + NFreq_tr, )
  • include_tr_rot – whether translations/rotations are in the matrix
  • click_callback – called when double clicked on an element if supplied, must accept 2 arguments: ref_no and tr_no
  • msgBar – message bar (: lass:Pmw.MessageBar)
ij_to_vibno(i, j)

Get the numbers of vibrations.

Parameters:
  • i – row number
  • j – column number
Returns:

(ref_index, tr_index). Negative indices correspond to translations/rotations

update_table(ref_from, ref_to, tr_from, tr_to, precision, show_tr_rot, nrot_ref, nrot_tr, mark=False, threshold_marked=0.0)

Update the contents of the table.

Parameters:
  • ref_from – start vibration number of the reference molecule
  • ref_to – end vibration number of the reference molecule
  • tr_from – start vibration number of the trial molecule
  • tr_to – end vibration number of the reference molecule
  • precision – number of decimal points to show
  • show_tr_rot – whether translations/rotations are to be shown
  • nrot_ref – number of rotations in the reference molecule
  • nrot_tr – number of rotations in the trial molecule
  • mark – whether to mark elements exceeding a threshold supplied by the threshold_marked argument
  • threshold_marked – threshold for marking elements
vibno_to_ij(ref_index, tr_index)

Get the number of the row and column.

Parameters:
  • ref_index – vibration number of the reference molecule
  • tr_index – vibration number of the trial molecule
class pyviblib.gui.widgets.CorrelationResultsNoteBook(master, matrix, freqs_ref, freqs_tr, include_tr_rot, **kw)

Widget for representing results of a correlation of vibrational motions.

The widget is based on Pmw.NoteBook.

The following read-only properties are exposed:
table
table with the text, see CorrelationResultsTable
circles_frame
frame with the circles
The following public methods are exported:
:meth`update_contents`
update the contents of the widget
:meth`show_A4`
switch to the A4 representation of circles

Initializer of the class.

Parameters:
  • matrix – matrix (one-based ndarray)
  • freqs_ref – wavenumbers of the reference molecule (one-based ndarray)
  • freqs_tr – wavenumbers of the trial molecule (one-based ndarray)
  • include_tr_rot – whether translations / rotations are present in the table
  • click_callback – called on a double clicke on an element function of 2 arguments: ref_no and tr_no
  • msgBar – message bar
show_A4(scale_factor=1.0, show_tr_rot=False, nrot_ref=0, nrot_tr=0)

Switch to the A4 representation of the circles.

Parameters:
  • scale_factor – number for scaling the canvas size
  • show_tr_rot – whether to show translations/rotations
  • nrot_ref – number of rotations in the reference molecule
  • nrot_tr – number of rotations in the trial molecule
update_contents(ref_from, ref_to, tr_from, tr_to, precision, show_tr_rot, nrot_ref, nrot_tr, mark=False, threshold_marked=0.0)

Update the contents of the table and circles.

Parameters:
  • ref_from – start vibration number of the reference molecule
  • ref_to – end vibration number of the reference molecule
  • tr_from – start vibration number of the trial molecule
  • tr_to – end vibration number of the reference molecule
  • precision – number of decimal points to show
  • show_tr_rot – whether translations/rotations are to be shown
  • nrot_ref – number of rotations in the reference molecule
  • nrot_tr – number of rotations in the trial molecule
  • mark – whether to mark elements exceeding a threshold supplied by the threshold_marked argument
  • threshold_marked – threshold for marking elements
class pyviblib.gui.widgets.WizardWidget(master, **kw)

Wizard widget.

The following read-only properties are exposed:
notebook
encapsulated internal notebook
buttonbox
Back and Next buttons

Initializer of the class.

Parameters:
  • master – parent widget
  • back_command – command for the Back button
  • next_command – command for the Next button
class pyviblib.gui.widgets.ChooseColorWidget(master, **kw)

Widget for choosing a color.

Consists of a label with a description and a button for changing the color.

The following readable and writable property is exposed:
color
color in the HTML format

Initializer of the class.

Parameters:
  • master – parent widget
  • text – description
  • initialcolor – initial color of the button
  • sticky – sticky option for the button
  • label_width – width of the label
  • button_width – width of the button
class pyviblib.gui.widgets.AxesSettingsWidget(master, add_limits=True, add_invert=False, buttons_to_validate=None, base_order=1)

Widget for setting properties of axes.

The following readable and writable properties are exposed
limits_auto
whether the limits are set automatically (*)
from_
upper range of the y axis (*)
to_
lower range of the y axis (*)
multfactor
order of magnitude for y values (*)
ticks_number
number of ticks(*)
ticks_scaling_factor
scaling factor (*)
linewidth
line width
linecolor
line color
invert
whether to invert the y values
The following read-only properties are exposed:
ticks_option
how to render ticks (*)
ticks_auto
whether the ticks are found automatically (*)

Properties marked with an asterisk (*) are exposed if the add_limits argument of the constructor was set to True.

Initializer of the class.

Parameters:
  • master – parent widget
  • add_limits – whether to add the controls for the y values
  • add_invert – whether to add a checkbox for inverting y values
  • buttons_to_validate – list of buttons to block if the user input is invalid
  • base_order – for defining the limits of the axes
class pyviblib.gui.widgets.PropertiesWidget(master, **kw)

Widget for showing text properties.

Each property is represented by one line with the name of the property shown at the left and its value at the right.

The following public methods are exported:
add_line
add a new line
add_separator
add a separator

Initializer of the class.

Parameters:
  • master – parent widget
  • title – title at the top of the widget
  • width – width in pixel
  • height – heigh in pixel
add_line(key, value)

Add a new line.

Parameters:
  • key – property name
  • value – property value
add_separator()
Add a separator.
class pyviblib.gui.widgets.PatchedPmwOptionMenu(parent=None, **kw)

Patched version of Pmw.OptionMenu.

The original setitems() raises an exception for Python 2.5.4+.

http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg728050.html

Initializer of the class.

Parameter:parent – parent widget

The keywords are passed to Pmw.OptionMenu

setitems(items, index=None)
Populate the option menu with new items.
pyviblib.gui.widgets.show_exception(exception_info)

Show an exception in a dialog.

Parameter:exception_info – must be the return value of sys.exc_info()
pyviblib.gui.widgets.mouse_wheel(e, widget)

Mouse wheel callback for a widget.

Parameter:widget – widget

Usage:

>>> from pyviblib.util.misc import Command
>>> from pyviblib.gui.widgets import mouse_wheel
>>> widget.bind('<Button-4>', Command(mouse_wheel, widget))
>>> widget.bind('<Button-5>', Command(mouse_wheel, widget))
pyviblib.gui.widgets.bind_mouse_wheel(widget)
Bind the mouse wheel events to a widget.
pyviblib.gui.widgets.pmw_widget(cls_name, *args, **kw)

Instantiate a Pmw widget.

Parameter:cls_name – class name of the widget

The positional and keyword arguments will be delegated to the widget.


SourceForge.net Logo