Package Pmv :: Module colorCommands :: Class ColorCommand
[hide private]
[frames] | no frames]

Class ColorCommand

source code

ViewerFramework.VFCommand.Command --+    
                                    |    
                  mvCommand.MVCommand --+
                                        |
                                       ColorCommand
Known Subclasses:
ColorFromPalette, ColorByProperties, sdCommands.ColorMolIndexedPolygons

The ColorCommand class is the base class from which all the color commands implemented for PMV will derive.
    
Package : Pmv
    
Module  : colorCommands
    
Class   : ColorCommand
    
Command : color
    
Description:

    It implements the general functionalities to color the specified geometries
    representing the specified nodes with the given list of colors.

    
Synopsis:

      None <--- color(nodes, colors[(1.,1.,1.),], geomsToColor='all', **kw)

    
Required Arguments:
 
      nodes --- any set of MolKit nodes describing molecular components

    
Optional Arguments:
  
      colors --- list of rgb tuple

      geomsToColor --- list of the name of geometries to color default is 'all'

      Keywords --- color

    



Instance Methods [hide private]
  __init__(self, func=None)
  onAddCmdToViewer(self)
method called when an instance of this command is added to the viewer.
  doit(self, nodes, colors, geomsToColor)
virtual method.
  __call__(self, nodes, colors=[(1.,1.,1.),], geomsToColor=('all',), **kw)
None <--- color(nodes, colors=[(1.,1.,1.),], geomsToColor=('all',), **kw)
  buildFormDescr(self, formName)
descr <- buildFormDescr(self, formName): this virtual method is implemented in the classes derived from Command.
  guiCallback(self)
  getNodes(self, nodes, returnNodes=False)
Expand nodes argument into a list of atoms and a list of molecules.This function is used to prevent the expansion operation to be done in both doit and setupUndoBefore.The nodes.findType( Atom ) is the operation that is potentially expensive
  cleanup(self)
This method is called by the afterDoit method and will be called eventhough the doit failed.
  setupUndoBefore(self, nodes, colors, geomsToColor)
This method builds the self.undoCmds string.
  getChildrenGeomsName(self, mol)
  getAvailableGeoms(self, nodes, showUndisplay=0)
Method to build a dictionary containing all the geometries available in the scene.
  selectall_cb(self)
  deselectall_cb(self)
  showUndisplayed_cb(self)
  addNewEntries(self, widget, showUndisplay)
  dismiss_cb(self)
  color_cb(self, colors)
  showForm(self, *args, **kw)
val/form <- getUserInput(self, formName, force=0, master=None, root=None, modal=1, blocking=0, defaultDirection='row', closeWithWindow=1, okCfg={'text':'OK'}, cancelCfg={'text':'Cancel'}, initFunc=None, scrolledFrame=0, width=100, height=200, okcancel=1, onDestroy=None, help=None, posx=None, posy=None) MAKE SURE that the list of arguments passed to showForm is up to date with the list of arguments of the InputForm constructor.

Inherited from mvCommand.MVCommand: strArg

Inherited from mvCommand.MVCommand (private): _strArg

Inherited from ViewerFramework.VFCommand.Command: __repr__, addCallbackAfter, addCallbackBefore, addUndoCall, afterDoit, beforeDoit, buildLogArgList, checkDependencies, customizeGUI, doitWrapper, getArguments, getHelp, getLastUsedValues, getLogArgs, getValNamedArgs, log, logString, onAddNewCmd, onCmdRun, setLastUsedValues, setupUndoAfter, tkCb, updateGeom, warningMsg


Class Variables [hide private]

Inherited from ViewerFramework.VFCommand.Command: negateKw, objArgOnly


Method Details [hide private]

__init__(self, func=None)
(Constructor)

source code 
None
Overrides: mvCommand.MVCommand.__init__

onAddCmdToViewer(self)

source code 
method called when an instance of this command is added to the viewer. This enable viewer-addition time initializations
Overrides: ViewerFramework.VFCommand.Command.onAddCmdToViewer
(inherited documentation)

doit(self, nodes, colors, geomsToColor)

source code 
virtual method. Has to be implemented by the sub classes
Overrides: ViewerFramework.VFCommand.Command.doit
(inherited documentation)

__call__(self, nodes, colors=[(1.,1.,1.),], geomsToColor=('all',), **kw)
(Call operator)

source code 

None <--- color(nodes, colors=[(1.,1.,1.),], geomsToColor=('all',), **kw)

nodes---TreeNodeSet holding the current selection

colors---list of rgb tuple.

geomsToColor---list of the name of geometries to color,default is 'all'
Overrides: ViewerFramework.VFCommand.Command.__call__

buildFormDescr(self, formName)

source code 
descr <- buildFormDescr(self, formName): this virtual method is implemented in the classes derived from Command. This is where the inputFormDescr is created and the description of the widgets appended. If a command has several inputForm buildFormDescr should build all the inputFormDescr and you do a if / elif check to know which one to create. formName : string name of the form corresponding to this descr.
Overrides: ViewerFramework.VFCommand.Command.buildFormDescr
(inherited documentation)

guiCallback(self)

source code 
None
Overrides: mvCommand.MVCommand.guiCallback

getNodes(self, nodes, returnNodes=False)

source code 
Expand nodes argument into a list of atoms and a list of molecules.This function is used to prevent the expansion operation to be done in both doit and setupUndoBefore.The nodes.findType( Atom ) is the operation that is potentially expensive

cleanup(self)

source code 
This method is called by the afterDoit method and will be called eventhough the doit failed.
Overrides: ViewerFramework.VFCommand.Command.cleanup

setupUndoBefore(self, nodes, colors, geomsToColor)

source code 
This method builds the self.undoCmds string. This method should have the same signature than the __call__. When this string is executed it should undo the actions of this command. This string will be appended to the undoCmdStack list if the command is successfuly carried out. This method handles only commands with the negateKw. Other commands have to overwrite it.
Overrides: ViewerFramework.VFCommand.Command.setupUndoBefore
(inherited documentation)

getChildrenGeomsName(self, mol)

source code 
None

getAvailableGeoms(self, nodes, showUndisplay=0)

source code 
Method to build a dictionary containing all the geometries available in the scene.

selectall_cb(self)

source code 
None

deselectall_cb(self)

source code 
None

showUndisplayed_cb(self)

source code 
None

addNewEntries(self, widget, showUndisplay)

source code 
None

dismiss_cb(self)

source code 
None

color_cb(self, colors)

source code 
None

showForm(self, *args, **kw)

source code 

val/form <- getUserInput(self, formName, force=0, master=None, root=None,
                         modal=1, blocking=0, defaultDirection='row',
                         closeWithWindow=1, okCfg={'text':'OK'},
                         cancelCfg={'text':'Cancel'}, initFunc=None,
                         scrolledFrame=0, width=100, height=200,
                         okcancel=1, onDestroy=None, help=None,
                         posx=None, posy=None)

MAKE SURE that the list of arguments passed to showForm is up to date
with the list of arguments of the InputForm constructor.
showForm will return either the dictionary of values (name of the widget: value
of the widget) if the form has a OK/CANCEL button or the form object itself.

required arguments:
    formName -- String which will be given to buildFormDescr. It refers to
                the name of the inputform to be created.

optional arguments :
    master  -- container widget or the master of the widget to be created
               which means that the current form will be a 'slave' of the
               given master if None is specified then self.vf.GUI.ROOT
               
    root    -- if root is not specified a Tkinter.TopLevel will
               be created.

    modal   -- Flag specifying if the form is modal or not. When a form
               is modal it grabs the focus and only releases it when the
               form is dismissed. When a form is modal an OK and a CANCEL
      button will be automatically added to the form.
      (default = 1)

    blocking -- Flag specifying if the form is blocking or not. When set to
      1 the form is blocking and the calling code will be stopped until the
      form is dismissed. An OK and a CANCEL button will be automatically
      added to the form. (default = 0)

    defaultDirection -- ('row', 'col') specifies the direction in
      which widgets are gridded  into the form by default. (default='row')

    closeWithWindow -- Flag specifying whether or not the form should be
      minimized/maximized  when the master window is. (default=1)

    okCfg -- dictionnary specifying the configuration of the OK button.
             if a callback function is specified using the keyword
             command this callback will be added to the default callback
             Ok_cb

    cancelCfg -- dictionnary specifying the configuration of the CANCEL button
             if a callback function is specified using the keyword
             command this callback will be added to the default callback
             Ok_cb

    initFunc  -- specifies a function to initialize the form.

    onDestroy -- specifies a function to be called when using the close
       widget of a window.

    okcancel -- Boolean Flag to specify whether or not to create the OK and
               CANCEL
                button.
    scrolledFrame -- Flag when set to 1 the main frame is a scrollable frame
                     else it is static Frame (default 0)
    width -- specifies the width of the main frame (400)
    height -- specifies the height of the main frame. (200)
    help   -- specifies the web adress to a help page. If this is provided
              a Help (?) button will be created which will open a
              web browser to the given adress.
              By default help URL is:
              http://www.scripps.edu/~sanner/software/help/PACKNAME/doc/moduleName.html#guiCallback
              Which is the documentation generated by Happydoc from the
              code's documentation strings.
    posy posy position wher the form is displayed
         

Overrides: ViewerFramework.VFCommand.Command.showForm
(inherited documentation)