Beispiel #1
0
                apply( self.doitWrapper,(pack, page,),{})
            CmdName1 =() 
            
        if  len(CmdName2) != 0:
            
            if CmdName2[0] == 'Login Page':
                page = "Login Page"
                pack = "Vision"
                apply( self.doitWrapper,(pack, page,),{})
         
            if CmdName2[0] == 'Archive Page':
                page = "Archive Page"
                pack = "Vision"
                apply( self.doitWrapper,(pack, page,),{})
            CmdName2 =()
mailingListsCommandGUI = CommandGUI()
mailingListsCommandGUI.addMenuCommand('menuRoot', 'Help',
                              'Mailing List')


class orderModelsCommand(Command):
    """Opens 'http://models.scripps.edu/?source=Pmv' with webbrowser
    \nPackage : Pmv
    \nModule : helpCommands
    \nClass : orderModelsCommand
    \nCommand : orderModelsCommand
    \nSynopsis:\n
        None <--- orderModelsCommand()
    """
    def guiCallback(self, evt=None):
        webbrowser.open_new('http://models.scripps.edu/?source=Pmv')
Beispiel #2
0
from AutoDockTools.autoanalyzeCommands import menuText,\
checkHasInitializedDockings, hideShowHide, toggleShowHide,\
checkNameStr, ADChooseMacro, ADReadMacro, ADEPDBMol,\
ADSeeSpots, ADShowBindingSite, ADMakeAllGrids, ADGetOutput,\
ADGetAGrid, ADSelectDLG, ADDeleteDLG, ADGetDirDLGs, ADGetDLG,\
ClusterDockingChooser, ModelDockingChooser, ADDrawHistogram,\
ADMacroLigandChart, ADDockingChooser, ReadAutoDockStates,\
StatesPlayerWidget, ShowAutoDockStatesBaseCmd, ShowAutoDockStates,\
ShowAutoDockStatesByEnergy, ShowAutoDockPopulation,\
ShowAutoDockStatesHISTOGRAM, ShowAutoDockClusteringStates,\
ReadAutoDockClusteringStates, WriteAutoDockStates,\
WriteAutoDockClustering, MakeAutoDockCLUSTERING,\
MakeAutoDockSubsetCLUSTERING


ADChooseMacroGUI=CommandGUI()
ADChooseMacroGUI.addMenuCommand('AutoTools3Bar', menuText['AnalyzeMB'], 
        menuText['chooseMacro'], cascadeName = menuText['MoleculesMB'])


ADReadMacroGUI=CommandGUI()
ADReadMacroGUI.addMenuCommand('AutoTools3Bar', menuText['AnalyzeMB'], 
        menuText['readMacro'], cascadeName = menuText['MoleculesMB'])


ADEPDBMolGUI=CommandGUI()
ADEPDBMolGUI.addMenuCommand('AutoTools3Bar', menuText['AnalyzeMB'], 
        menuText['epdbMol'], cascadeName = menuText['GridsMB'])


ADSeeSpotsGUI=CommandGUI()
            except IndexError:
                warnings.warn("IndexError for %s" %textcolor)

        molecules, nodeSets = self.vf.getNodesByMolecule(nodes)

        for mol, nodes in map(None, molecules, nodeSets):
            nodes.sort()
            drawLabels(mol, nodes, materials, function , lambdaFunc, font,
                       location, only, negate, format)

               

#labelByPropertiesGuiDescr = {'widgetType':'Menu', 'menuBarName':'menuRoot',
#                 'menuButtonName':'Label', 'menuEntryLabel':'by Properties'}

LabelByPropertiesGUI = CommandGUI()
LabelByPropertiesGUI.addMenuCommand('menuRoot', 'Display', 'by Properties',
                                     cascadeName= 'Label')
                
LabelByExpressionGUI = CommandGUI()
LabelByExpressionGUI.addMenuCommand('menuRoot', 'Display', 'by Expression',
                                     cascadeName= 'Label')

commandList = [
    {'name':'labelByProperty','cmd': LabelByProperties(), 'gui': LabelByPropertiesGUI},
    {'name':'labelByExpression','cmd': LabelByExpression(), 'gui': LabelByExpressionGUI}
    ]


def initModule(viewer):
    for dict in commandList:
Beispiel #4
0
file to edit from a file browser.
    
"""

from ViewerFramework.VFCommand import CommandGUI

from AutoDockTools.autogpfCommands import GpfSetGpo,\
GpfMacroInit, GpfLoadDefaults, GpfEditor, GpfInitLigand, GpfWriter,\
SelectCenter, SetUpCovalentMap4, SetBoxParameters, SetOtherOptions,\
Gpf4ParameterFileSelector, Gpf4ParameterFileEditor, GpfMergeNonPolarHs,\
Gpf4SetMapTypes, Gpf4SetAtomTypes, Gpf4MacroInit, Gpf4MacroReader,\
Gpf4MacroChooser, Gpf4InitLigand, Gpf4LigandChooser, Gpf4LigReader,\
Gpf4FlexResChooser, Gpf4FlexResReader, Gpf4Writer, menuText, gridOpts,\
messages, checkHasGpo, box, cenSph, cenCross

GpfLoadDefaultsGUI = CommandGUI()
GpfLoadDefaultsGUI.addMenuCommand('AutoTools4Bar', menuText['AutoGpfMB'],\
        menuText['ReadGpfMB'])

GpfEditorGUI = CommandGUI()
GpfEditorGUI.addMenuCommand('AutoTools4Bar', menuText['AutoGpfMB'],\
        menuText['EditGpfMB'])

GpfWriterGUI = CommandGUI()
GpfWriterGUI.addMenuCommand('AutoTools4Bar', menuText['AutoGpfMB'], \
    menuText['WriteGpfMB'], cascadeName=menuText['WriteMB'])

SetUpCovalentMap4GUI = CommandGUI()
SetUpCovalentMap4GUI.addMenuCommand('AutoTools4Bar', menuText['AutoGpfMB'], \
    menuText['SetUpCovalentMap4'], cascadeName = menuText['SetMapTypesMB'])
"""
from ViewerFramework.VFCommand import CommandGUI
from AutoDockTools.autostartCommands import ADKill, ADProcessManager,\
AutoStarter, AutoGridStarter, AutoDockStarter, AddAutoDockHost, removePCs,\
entropiaPresent, menuText



if entropiaPresent:
    from Entropia.EntropiaDef import entropia_job_dir
    from Entropia.EntropiaUI import EntropiaUI
    from Entropia.EntropiaEx import EntropiaError
    import ftplib

ADProcessManagerGUI=CommandGUI()
ADProcessManagerGUI.addMenuCommand('AutoTools4Bar', menuText['StartMB'], menuText['processManagerMB'])

AutoGridStarterGUI=CommandGUI()
AutoGridStarterGUI.addMenuCommand('AutoTools4Bar', menuText['StartMB'], menuText['startGridMB'])


AutoDockStarterGUI=CommandGUI()
AutoDockStarterGUI.addMenuCommand('AutoTools4Bar', menuText['StartMB'], menuText['startDockMB'])

        
AddAutoDockHostGUI=CommandGUI()
AddAutoDockHostGUI.addMenuCommand('AutoTools4Bar', menuText['StartMB'], menuText['editHostsMB'])

commandList = [
    {'name':'AD4start_autogrid','cmd':AutoGridStarter(),'gui':AutoGridStarterGUI},
Beispiel #6
0
        #print 'acceptorList=', acceptorList
        return self.doitWrapper(node,
                                paramDict,
                                reset=self.resetVar.get(),
                                topCommand=0)


BuildStrutsBondsGUICommandGuiDescr = {
    'widgetType': 'Menu',
    'menuBarName': 'menuRoot',
    'menuButtonName': 'Struts Bonds',
    'menuEntryLabel': 'Set Params + Build',
}
#                                          'menuCascadeName':'Build'}

BuildStrutsBondsGUICommandGUI = CommandGUI()
BuildStrutsBondsGUICommandGUI.addMenuCommand(
    'menuRoot',
    'Struts Bonds',
    'Set Parms + Build',
)  # cascadeName = 'Build')


class BuildStrutsBonds(MVCommand):
    """This command finds hydrogen donor atoms within 2.4*percentCutoff angstrom distance of hydrogen acceptor atoms. It builds and returns a dictionary atDict whose keys are hydrogen atoms (or hydrogenbond donor atoms if there are no hydrogens) and whose values are potential h-bond acceptors and distances to these atoms, respectively
    \nPackage : Pmv
    \nModule  : StrutsCommands
    \nClass   : BuildStrutsBonds 
    \nCommand : buildStruts
    \nSynopsis:\n
        atDict <- buildStruts(group, paramDict, **kw)
Beispiel #7
0
##              sys.stdout = sys.__stdout__

##              # Save the pyShell stdin and redirect it to the main Python
##              # interpreter only works if the main interpreter has been
##              # started in a interactive mode.
##              self.vf.pyShellstdin = sys.stdin
##              sys.stdin = sys.__stdin__

##              # Save the pyShell stderr and redirect it to the main Python
##              # interpreter only works if the main interpreter has been
##              # started in a interactive mode.
##              self.vf.pyShellstderr = sys.stderr
##              sys.stderr = sys.__stderr__

# HideGUI command GUI.
HideGUI = CommandGUI()
HideGUI.addMenuCommand('menuRoot',
                       'File',
                       'Hide VF GUI...',
                       cascadeName='Preferences')


class ShowGUICommand(Command):
    """Allow to show the ViewerFrameworkGUI at any time
    \nPackage : Pmv
    \nModule : customizeVFGUICommands
    \nClass : ShowGUICommand
    \nCommand : ShowGUI
    \nSynopsis:\n 
    None <- ShowGUI(**kw)
    """
import Tkinter
from ViewerFramework.VFCommand import CommandGUI
from AutoDockTools.autotorsCommands import rootSph, markSph,\
menuText, AtorsMoleculeChooser, MAXTORS, AdtSetMode,\
AtorsReader, Ators4MoleculeChooser, Ators4Reader, AtorsRefWriter, \
RigidMolecule, RigidMolecule4, AUTOTORSWriter, AUTOTORS4Writer,  AUTOTORS4RandomWriter,\
MarkRoot, SelectRoot, SetTorsionNumberGUICommand, SetTorsionNumber, \
AutoRoot, SetRotatableBonds, DefiningRotatableBonds, SetBondRotatableFlag,\
CheckAromatic, StopCheckAromatic, SetCarbonNames, ChangeAromaticCutOff, \
TogglerootSphere, AutoAutoTors, StopAutoTors, AtorsInit, AtorsInitMol, \
ProcessCharges, ProcessBonds, rootSph, markSph, check_autotors_geoms,\
MAXTORS, menuText, warningText, checkMolCharges,\
autoMergeNPHS, set_autoMergeNPHS


Ators41MoleculeChooserGUI=CommandGUI()
Ators41MoleculeChooserGUI.addMenuCommand('AutoTools41Bar', menuText['AutoTorsMB'], menuText['Choose Molecule4'], cascadeName = menuText['Input Molecule'])



Ators41ReaderGUI = CommandGUI()
Ators41ReaderGUI.addMenuCommand('AutoTools41Bar', menuText['AutoTorsMB'], menuText['Read Molecule4'], cascadeName = menuText['Input Molecule'])


AtorsRefWriterGUI = CommandGUI()
AtorsRefWriterGUI.addMenuCommand('AutoTools41Bar', menuText['AutoTorsMB'], menuText['Ref Molecule'], cascadeName = menuText['Input Molecule'])


RigidMolecule41GUI = CommandGUI()
RigidMolecule41GUI.addMenuCommand('AutoTools41Bar', menuText['AutoTorsMB'], menuText['Rigid Molecule4'], cascadeName = menuText['Input Molecule'])
        i = 0
        for f in faces:
            for n in range(ntr):
                if (n/2)*2 == n:
                    new_faces[i] = [f[n], f[n+1], f[n+2]]
                else:
                    new_faces[i] = [f[n+2], f[n+1], f[n]]
                i = i + 1
        return new_faces

    def dismiss_cb(self):
          """Withdraws the GUI."""
          self.cmdForms['sl'].withdraw()
          self.isDisplayed=0
        
SLGUI = CommandGUI()
SLGUI.addMenuCommand('menuRoot', 'SL','Operate objects', index=1)

class SaveBsptCommand(MVCommand):
    """Command to save a Bspt set in a file."""
    def __init__(self):
        MVCommand.__init__(self)
        self.isDisplayed=0
        #self.sl = SLGeom()

    def checkDependencies(self):
        try:
            from SpatialLogic import geometrylib
        except:
            print "WARNING: Spatial Logic module not found"
Beispiel #10
0
                                 }
                    Specs.define_field(specEntry)
        else: return None
        if not (Specs.DefFieldsDict.has_key('x') and
                Specs.DefFieldsDict.has_key('y') and
                Specs.DefFieldsDict.has_key('z')):
            msg = "specs for atom coordinates (x,y,z) are missing"
            self.warningMsg(msg)
            return None
        return Specs
       
genPDBReaderGuiDescr = {'widgetType':'menuRoot', 'menuBarName':'File',
                        'menuButtonName':'Read PDB with Gen Parser ...',
                        'index':0}

GenPDBReaderGUI = CommandGUI()
GenPDBReaderGUI.addMenuCommand('menuRoot', 'File',
                               'Read PDB with Gen Parser ...',index=0)


FieldNames = ('serial', 'name', 'altLoc', 'resName', 'chainID',
                      'resSeq', 'iCode', 'x', 'y', 'z', 'occupancy',
                      'tempFactor', 'segID', 'element', 'charge', 'other')
variableTypes = ('int', 'character', 'float', 'alphabetic', 'string')
specEntries = ('field_name', 'var_type', 'from', 'to', 'index')


class DefinePdbSpecifications(MVCommand):
    """ class to define some pdb specifications in a dictionary and save them
    in a file """
    
Beispiel #11
0
file to edit from a file browser.
    
"""
from ViewerFramework.VFCommand import CommandGUI

from AutoDockTools.autogpfCommands import GpfSetGpo,\
GpfLoadDefaults, GpfMacroInit, CheckMacroAtomTypes,\
GpfMacroReader, GpfMacroChooser, GpfAddSol, GpfInitLigand,\
GpfLigandChooser, GpfLigReader, GpfEditor, GpfWriter,\
SelectCenter, SetMapTypes, SetUpCovalentMap,\
DefineNewAtomParms, SetBoxParameters, SetOtherOptions,\
GpfMergeNonPolarHs, menuText, gridOpts,\
messages, checkHasGpo, box, cenSph, cenCross, autodockElementDict,\
setAutoDockElements, getSideLengths, checkFile

GpfLoadDefaultsGUI = CommandGUI()
GpfLoadDefaultsGUI.addMenuCommand('AutoTools3Bar', menuText['AutoGpfMB'],\
menuText['ReadGpfMB'])

GpfMacroReaderGUI = CommandGUI()
GpfMacroReaderGUI.addMenuCommand('AutoTools3Bar', menuText['AutoGpfMB'],\
    menuText['ReadMacro'], cascadeName = menuText['MacromoleculeMB'])

GpfMacroChooserGUI = CommandGUI()
GpfMacroChooserGUI.addMenuCommand('AutoTools3Bar',
                                  menuText['AutoGpfMB'],
                                  menuText['ChooseMacro'],
                                  cascadeName=menuText['MacromoleculeMB'])

GpfAddSolGUI = CommandGUI()
GpfAddSolGUI.addMenuCommand('AutoTools3Bar',
Beispiel #12
0
                executable = sys.executable
                if os.name == 'nt':
                    executable = executable.replace("\\", """\\\\""")

                cmd = executable
                cmd += ' -c "import time,os;time.sleep(1);os.system(\''
                script = self.vf.help_about.path_data.split(
                    'script                : ')[1].split('\n')[0]
                if os.name == 'nt':
                    script = script.replace("\\", """\\\\""")
                script = r'\"' + script + r'\"'
                cmd += executable + " " + script + "')\""
                if os.name == 'nt':
                    #cmd = cmd.replace("\\","""\\\\""")
                    cmd = 'start ' + cmd.encode()
                else:
                    cmd += ' &'
                subprocess.Popen(cmd, shell=True)
                os._exit(0)


UpdateGUI = CommandGUI()
UpdateGUI.addMenuCommand('menuRoot', 'Help', 'Update', separatorAbove=1)

commandList = [{'name': 'update', 'cmd': Update(), 'gui': UpdateGUI}]


def initModule(viewer):
    for _dict in commandList:
        viewer.addCommand(_dict['cmd'], _dict['name'], _dict['gui'])
Beispiel #13
0
                    'variable': self.levelVar,
                    'value': level,
                    'justify': 'left',
                    'activebackground': self.levelColors[level],
                    'selectcolor': self.levelColors[level],
                    'command': self.setLevel_cb
                },
                'gridcfg': {
                    'sticky': 'we'
                }
            })
        ifd.append({
            'name': 'dismiss',
            'widgetType': Tkinter.Button,
            'defaultValue': 1,
            'wcfg': {
                'text': 'Dismiss',
                'command': self.Close_cb
            },
            'gridcfg': {
                'sticky': 'we'
            }
        })
        self.form = self.vf.getUserInput(self.ifd, modal=0, blocking=0)
        self.form.root.protocol('WM_DELETE_WINDOW', self.Close_cb)


MVSetSelectionLevelGUI = CommandGUI()
MVSetSelectionLevelGUI.addMenuCommand('menuRoot', 'Select',
                                      'Set Selection Level')
    * The results of the previous steps are written to a file. The user selects a filename via a filebrowser.  By convention, the file should have a .dpf extension. If no macromolecule has been selected, it is not possible to write a grid parameter file and the user gets a warning message to that effect. Likewise, the types of the maps to be calculated must be set before the grid parameter file is written and a warning message to this effect appears if the types have not been set.
(A checkbutton, "DONE", allows the user to withdraw the autoTools menuBar)
    
"""
from ViewerFramework.VFCommand import CommandGUI

from AutoDockTools.autodpfCommands import DpfSetDpo, DpfLoadDefaults,\
Dpf4MacroSelector, Dpf4FlexResSelector, Dpf4MacroChooser,\
Dpf4InitLigand, Dpf4LigandChooser, Dpf4LigPDBQReader,\
DpfEditor, Dpf4SAWriter, Dpf4GAWriter, Dpf4LSWriter,\
Dpf4GALSWriter, Dpf4ClusterWriter, SimAnneal, GA,\
LS, SetDockingRunParms, SetAutoDock4Parameters, StopAutoDpf, menuText,\
checkHasDpo, sortKeyList, setDpoFields


DpfLoadDefaultsGUI = CommandGUI()
DpfLoadDefaultsGUI.addMenuCommand('AutoTools4Bar', menuText['AutoDpfMB'], menuText['ReadDpfMB'])


Dpf4MacroSelectorGUI=CommandGUI()
Dpf4MacroSelectorGUI.addMenuCommand('AutoTools4Bar', menuText['AutoDpfMB'],\
menuText['ReadMacro4'], cascadeName = menuText['MacromoleculeMB'])


Dpf4FlexResSelectorGUI=CommandGUI()
Dpf4FlexResSelectorGUI.addMenuCommand('AutoTools4Bar', menuText['AutoDpfMB'],\
menuText['ReadFlexRes4'], cascadeName = menuText['MacromoleculeMB'])


Dpf4MacroChooserGUI=CommandGUI()
Dpf4MacroChooserGUI.addMenuCommand('AutoTools4Bar', menuText['AutoDpfMB'],\
##     def guiCallback(self,**kw):
##         folderPath = dirChoose(self.vf.GUI.ROOT)
##         if folderPath:
##             print folderPath,type(folderPath)
##             ## get all the *.vu file from folderPath,
##             ## create filelist
##             from glob import glob
##             filelist = glob(str(folderPath)+'/*.vu')  
##             if filelist:
##                 if self.vf.userpref['expandNodeLogString']['value'] == 0:
##                     self.nodeLogString = "self.getSelection()"
##                 apply(self.doitWrapper, (self.vf.getSelection(),filelist),kw)
            


loadVectGUI = CommandGUI()
loadVectGUI.addMenuCommand('menuRoot', 'VectField', 'loadVect')

####### VU Field ###################
class loadVUFile(MVCommand):
    """ Command  to a load a VU file to display"""

    def __init__(self):
        MVCommand.__init__(self)
        self.fileTypes =[('VU file',"*.vu")]
        self.fileBrowserTitle = "Read VU File"
        self.lastDir = "."
        
        
    def onAddCmdToViewer(self):
        if not self.vf.commands.has_key('loadVect'):
Beispiel #16
0
                               command=self.destroy)
            b.pack(side='left')
            notebook.setnaturalsize()
        else:
            self.master.deiconify()
            self.master.lift()

    def destroy(self):
        self.master.destroy()
        self.master = None

    def openurl(self, evt=None):
        import webbrowser
        webbrowser.open('http://mgltools.scripps.edu')

    def register(self):
        self.master.withdraw()
        from mglutil.splashregister.register import Register_User
        Register_User(self.vf.help_about.version)


AboutGUI = CommandGUI()
AboutGUI.addMenuCommand('menuRoot', 'Help', 'About', separatorAbove=1)

commandList = [{'name': 'about', 'cmd': About(), 'gui': AboutGUI}]


def initModule(viewer):
    for _dict in commandList:
        viewer.addCommand(_dict['cmd'], _dict['name'], _dict['gui'])
Beispiel #17
0
    def setLevel_cb(self, level):
        col = self.vf.ICmdCaller.levelColors
        c = (col[level][0]/1.5,col[level][1]/1.5,col[level][2]/1.5)
        self.LevelOption._menubutton.configure(
            background = TkColor(c),
            activebackground = TkColor(col[level]))
        if level=='Atom':
            self.vf.setIcomLevel(Atom)
        elif level=='Residue':
            self.vf.setIcomLevel(Residue)
        elif level=='Chain':
            self.vf.setIcomLevel(Chain)
        elif level=='Molecule':
            self.vf.setIcomLevel(Molecule)

PCOMGUI = CommandGUI()
from moleculeViewer import ICONPATH
PCOMGUI.addToolBar('PCOM', icon1 = 'mouse.gif', icon_dir=ICONPATH,
                   balloonhelp = 'Picking COMmands', index = 0)


class MVBindCmdToKey(MVCommand):

    def __init__(self, func=None):
        MVCommand.__init__(self, func=None)
        otherKeys = ['Escape', 'F1', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8',
                     'F9', 'Tab', 'space', 'Return', 'Insert', 'Delete',
                     'Home', 'End', 'Prior', 'Next', 'Up', 'Down', 'Left',
                     'Right', 'Caps_Lock', 'Num_Lock', 'BackSpace']
                     
        self.bindings = {}
    StatesPlayerWidget,
    ShowAutoDockStatesBaseCmd,
    ShowAutoDockStates,
    ShowAutoDockStatesByEnergy,
    ShowAutoDockPopulation,
    ShowAutoDockStatesHISTOGRAM,
    ShowAutoDockClusteringStates,
    ReadAutoDockClusteringStates,
    WriteAutoDockStates,
    WriteAutoDockClustering,
    MakeAutoDockCLUSTERING,
    MakeAutoDockSubsetCLUSTERING,
)


ADChooseMacroGUI = CommandGUI()
ADChooseMacroGUI.addMenuCommand(
    "AutoTools4Bar", menuText["AnalyzeMB"], menuText["chooseMacro"], cascadeName=menuText["MoleculesMB"]
)


ADReadMacroGUI = CommandGUI()
ADReadMacroGUI.addMenuCommand(
    "AutoTools4Bar", menuText["AnalyzeMB"], menuText["readMacro"], cascadeName=menuText["MoleculesMB"]
)


ADEPDBMolGUI = CommandGUI()
ADEPDBMolGUI.addMenuCommand(
    "AutoTools4Bar", menuText["AnalyzeMB"], menuText["epdbMol"], cascadeName=menuText["GridsMB"]
)
                    'widgetType':Tkinter.Button,
                    'wcfg':{'text':'Dismiss',
                            'command':self.dismissCB},
                    'gridcfg':{'column':3, 'row':10,'sticky':'ew'}})

        self.form = self.vf.getUserInput(idf, modal = 0, blocking = 0)
        lb = idf.entryByName['selectedGeometries']['widget'].lb
        lb.bind("<ButtonRelease-1>", self.updateProps, '+')

        e1 = idf.entryByName['pigment']['widget']
        e1.bind("<Return>", self.bindPigment)
        
        e2 = idf.entryByName['finish']['widget']
        e2.bind("<Return>", self.bindFinish)
        
povrayGuiDescr = {'widgetType':'Menu', 'menuBarName':'menuRoot',
                  'menuButtonName':'File',
                  'menuEntryLabel':'Povray', 'index':0}

PovrayGUI = CommandGUI()
PovrayGUI.addMenuCommand('menuRoot', 'File', 'Povray', index = 0)

commandList = [
    {'name':'povray','cmd': Povray(), 'gui': PovrayGUI},
    ]


def initModule(viewer):
    for dict in commandList:
        viewer.addCommand(dict['cmd'], dict['name'], dict['gui'])
Beispiel #20
0
        packW = ebn['packList']['widget']
        packs = packW.getcurselection()
        # Nothing selected
        if len(packs) == 0:
            return
        packName = packs[0]
        if not self.citations.has_key(packName): return
        citation = self.citations[packName]
        citWidget = ebn['citation']['widget']
        citWidget.setvalue(citation)

    def guiCallback(self):
        form = self.showForm('chooseCitation', modal=0, blocking=0)


citationCommandGUI = CommandGUI()
citationCommandGUI.addMenuCommand('menuRoot', 'Help', 'Citation Information')


class CiteThisSceneCommand(Command):
    """Command that helps to cite references used in a given scene
    \nPackage : Pmv
    \nModule : helpCommands
    \nClass : CiteThisSceneCommand
    """
    def buildFormDescr(self, formName):
        if formName == 'citationHelp':
            idf = InputFormDescr(title="Choose Package")
            citeKeys = self.vf.showCitation.citations.keys()

            txt = """
Beispiel #21
0
            #tagModified=False)
            self.lines.Set(vertices=self.lineVertices,
                           type=GL.GL_LINE_STRIP,
                           faces=self.faces,
                           freshape=1)
            #tagModified=False)

        elif len(self.lineVertices) == 1 and len(self.labelCenters) == 1:
            #this fixes case of stepping back over 1st label
            self.labels.Set(vertices=[])
            #self.labels.Set(vertices=[], tagModified=False)
            self.lines.Set(vertices=[])
            #self.lines.Set(vertices=[], tagModified=False)


MeasureDistanceGUICommandGUI = CommandGUI()
MeasureDistanceGUICommandGUI.addMenuCommand('menuRoot',
                                            'Display',
                                            'Distance (Shift Pick)',
                                            cascadeName='Measure')


class MeasureAngleGUICommand(MeasureGUICommand):
    """Accumulates picked atoms.Draws fans, lines and labels labelling the angle between trios of selected atoms (color-coded orange).Userpref 'measureAngleSL' sets the 'snakeLength' which is how many angle measureDisplays can be seen at the same time.When more than that number are measured, the first angle measured is no longer labeled.
   \nPackage : Pmv
   \nModule  : measureCommands
   \nClass   : MeasureAngleGUICommand
   \nCommand : measureAngleGC
   \nSynopsis:\n
        angle/None<---measureAngleGC(atoms)
   \nRequired Argument:\n        
    Dpf4ClusterWriter,
    SimAnneal,
    GA,
    LS,
    SetDockingRunParms,
    SetAutoDock4Parameters,
    SetAutoDock41Parameters,
    StopAutoDpf,
    menuText,
    checkHasDpo,
    sortKeyList,
    setDpoFields,
)


DpfLoadDefaultsGUI = CommandGUI()
DpfLoadDefaultsGUI.addMenuCommand("AutoTools41Bar", menuText["AutoDpfMB"], menuText["ReadDpfMB"])


Dpf4MacroSelectorGUI = CommandGUI()
Dpf4MacroSelectorGUI.addMenuCommand(
    "AutoTools41Bar", menuText["AutoDpfMB"], menuText["ReadMacro4"], cascadeName=menuText["MacromoleculeMB"]
)


Dpf4FlexResSelectorGUI = CommandGUI()
Dpf4FlexResSelectorGUI.addMenuCommand(
    "AutoTools41Bar", menuText["AutoDpfMB"], menuText["ReadFlexRes4"], cascadeName=menuText["MacromoleculeMB"]
)


    def guiCallback(self):
        """called each time the 'read ->Grid' sequence is pressed"""
        gridFile = self.vf.askFileOpen(types=[('grid data files', '*.*')],
        title = 'Grid File:')
        if gridFile is not None and len(gridFile):
            self.doitWrapper(gridFile, redraw=0)


gridReaderGuiDescr = {'widgetType':'Menu', 'menuBarName':'menuRoot',
              'menuButtonName':'Grid', 'menuEntryLabel':'Grid',
              'menuCascadeName':'read'}


GridReaderGUI = CommandGUI()
GridReaderGUI.addMenuCommand('menuRoot', 'Grid', 'Grid', cascadeName='read')




class AutoGridReader(MVCommand):
    """ Command to load autogrid data files, creating an 'AutoGrid' object
   \nPackage : Pmv
   \nModule  : GridCommands
   \nClass   : AutoGridReader
   \nCommand : readAUTOGRID
   \nSynopsis:\n
        None <- readAUTOGRID(gridFile, **kw)
   \nRequired Arguments:\n 
        gridFile --- path to the autogrid data file    
                         'gridcfg':{'sticky':'we' }})

            idf.append({ 'widgetType':StringSelectorGUI,
                         'parent':'mobgroup',
                         #'defaultValue':self.vf.Mols[1].name+", , , ",
                         'tooltip':'Please select the mobile nodes set. By default the mobile nodes will be the second molecule loaded in the viewer',
                         'name':'smobNodes',
                         'wcfg':{ 'molSet': self.vf.Mols,
                                  'vf': self.vf,
                                  'all':1,
                                  'crColor':(0.,0.,1.),'forceEmpty':1,
                                  },
                         'gridcfg':{'row':-1, 'sticky':'we' }})
            return idf

SuperimposeAtomsCommandGUI = CommandGUI()
## SuperimposeAtomsGUICommandGUI.addMenuCommand('menuRoot', 'Compute',
##                                              'superimpose Atom Pairs',
##                                              cascadeName = "Superimpose")
SuperimposeAtomsCommandGUI.addMenuCommand('menuRoot', 'Compute',
                                             'Superimpose Atom Pairs')


commandList = [
    {'name':'superimposeAtoms', 'cmd':SuperimposeAtomsCommand(),
     'gui':None},
##     {'name':'superimposeAtomsGC2', 'cmd':SuperimposeAtomsGUICommand(),
##      'gui':SuperimposeAtomsCommandGUI},
    {'name':'superimposeGUI', 'cmd':SuperimposeAtomsGUICommand(),
     'gui':SuperimposeAtomsCommandGUI},
    
        levelLabels = ['Molecule      ', 'Chain           ', 
                       'Residue       ', 'Atom           ']
        self.levelVar.set("Molecule")
        for level, levlabel in zip(levels, levelLabels):
            ifd.append({'name':level, 
                        'widgetType': Tkinter.Radiobutton,
                        'wcfg':{'text':levlabel,
                                'variable':self.levelVar,
                                'value':level,
                                'justify':'left',
                                'activebackground':self.levelColors[level],
                                'selectcolor':self.levelColors[level],
                                'command':self.setLevel_cb},
                        'gridcfg':{'sticky':'we'}})
        ifd.append({'name':'dismiss',
                    'widgetType':Tkinter.Button,
                    'defaultValue':1,
                    'wcfg':{'text':'Dismiss',
                            'command':self.Close_cb},
                    'gridcfg':{'sticky':'we'}
                    })
        self.form = self.vf.getUserInput(self.ifd, modal=0, blocking=0)
        self.form.root.protocol('WM_DELETE_WINDOW',self.Close_cb)
  


MVSetSelectionLevelGUI = CommandGUI()
MVSetSelectionLevelGUI.addMenuCommand('menuRoot', 'Select','Set Selection Level')


        self,
        event=None,
    ):
        name = self.vf.__class__.__name__
        file = self.vf.askFileOpen(types=[('%s scripts' % name, '*.py'),
                                          ('Resource file', '*.rc'),
                                          ('All Files', '*.*')],
                                   title="read %s script file:" % name)
        if file:
            self.doitWrapper(file, redraw=0)
            if hasattr(self.vf, 'recentFiles'):
                self.vf.recentFiles.add(file, self.name)


# Source Command GUI
SourceGUI = CommandGUI()
SourceGUI.addMenuCommand('menuRoot',
                         'File',
                         'Python Scripts',
                         cascadeName='Import',
                         cascadeIndex=1)

## SaveSessionCommand Command GUI
#SaveSessionCommandGUI = CommandGUI()
#SaveSessionCommandGUI.addMenuCommand('menuRoot', 'File',
#'Current Session', cascadeName='Save', index=1)

# SetUserPreference Command GUI
SetUserPreferenceGUI = CommandGUI()
SetUserPreferenceGUI.addMenuCommand('menuRoot',
                                    'File',
Beispiel #27
0
# $Header: /opt/cvs/python/packages/share1.5/Pmv/bondsCommandsGUI.py,v 1.3 2009/08/13 20:21:23 sargis Exp $
from ViewerFramework.VFCommand import CommandGUI, CommandProxy


class BuildBondsByDistanceProxy(CommandProxy):
    def __init__(self, vf, gui):
        CommandProxy.__init__(self, vf, gui)
        from Pmv.bondsCommands import BuildBondsByDistance
        command = BuildBondsByDistance()
        self.vf.addCommand(command, 'buildBondsByDistance', self.gui)


BuildBondsByDistanceGUI = CommandGUI()
BuildBondsByDistanceGUI.addMenuCommand('menuRoot',
                                       'Edit',
                                       'Build By Distance',
                                       cascadeName='Bonds')


class AddBondsGUICommandProxy(CommandProxy):
    def guiCallback(self, **kw):
        if self.command:
            self.command.guiCallback(**kw)
        else:
            from Pmv.bondsCommands import AddBondsGUICommand
            command = AddBondsGUICommand()
            loaded = self.vf.addCommand(command, 'addBondsGC', self.gui)
            if loaded:
                command = loaded
            self.command = command
            self.command.guiCallback(**kw)
                                     command=self.register)
                reg.pack(side = 'left')
            b = Tkinter.Button(self.master,text='   Close   ',
                               command=self.destroy)
            b.pack(side = 'left')
            notebook.setnaturalsize()
        else:
            self.master.deiconify()
            self.master.lift()
            
    def destroy(self):
        self.master.destroy()
        self.master = None
            
    def openurl(self, evt=None):
        import webbrowser
        webbrowser.open('http://mgltools.scripps.edu')
        
    def register(self):
        self.master.withdraw()
        from mglutil.splashregister.register import Register_User
        Register_User(self.vf.help_about.version)
        
AboutGUI = CommandGUI()
AboutGUI.addMenuCommand('menuRoot', 'Help', 'About',separatorAbove = 1)

commandList  = [{'name':'about','cmd':About(),'gui':AboutGUI}]
def initModule(viewer):
    for _dict in commandList:
        viewer.addCommand(_dict['cmd'],_dict['name'],_dict['gui'])
Beispiel #29
0

    * The results of the previous steps are written to a file. The user selects a filename via a filebrowser.  By convention, the file should have a .dpf extension. If no macromolecule has been selected, it is not possible to write a grid parameter file and the user gets a warning message to that effect. Likewise, the types of the maps to be calculated must be set before the grid parameter file is written and a warning message to this effect appears if the types have not been set.
(A checkbutton, "DONE", allows the user to withdraw the autoTools menuBar)
    
"""
from ViewerFramework.VFCommand import CommandGUI


from AutoDockTools.autodpfCommands import DpfSetDpo, DpfLoadDefaults,\
DpfMacroSelector, DpfMacroChooser, DpfInitLigand, DpfLigandChooser,\
DpfLigPDBQReader, DpfEditor, DpfSAWriter, DpfGAWriter, DpfLSWriter, DpfGALSWriter, \
DpfClusterWriter, SimAnneal, GA, LS, SetDockingRunParms, StopAutoDpf,\
menuText, checkHasDpo, sortKeyList, setDpoFields

DpfLoadDefaultsGUI = CommandGUI()
DpfLoadDefaultsGUI.addMenuCommand('AutoTools3Bar', menuText['AutoDpfMB'],
                                  menuText['ReadDpfMB'])

DpfMacroSelectorGUI = CommandGUI()
DpfMacroSelectorGUI.addMenuCommand('AutoTools3Bar', menuText['AutoDpfMB'],\
menuText['ReadMacro'], cascadeName = menuText['MacromoleculeMB'])

DpfMacroChooserGUI = CommandGUI()
DpfMacroChooserGUI.addMenuCommand('AutoTools3Bar', menuText['AutoDpfMB'],\
menuText['ChooseMacro'], cascadeName = menuText['MacromoleculeMB'])

DpfInitLigandGUI = CommandGUI()
DpfInitLigandGUI.addMenuCommand('AutoTools3Bar',
                                menuText['AutoDpfMB'],
                                menuText['AdjustLigand'],
from AutoDockTools.autoanalyzeCommands import menuText,\
checkHasInitializedDockings, hideShowHide, toggleShowHide,\
checkNameStr, ADChooseMacro, ADReadMacro, ADEPDBMol,\
ADSeeSpots, ADShowBindingSite, ADMakeAllGrids, ADGetOutput,\
ADGetAGrid, ADSelectDLG, ADDeleteDLG, ADGetDirDLGs, ADGetDLG,\
ClusterDockingChooser, ModelDockingChooser, ADDrawHistogram,\
ADMacroLigandChart, ADDockingChooser, ReadAutoDockStates,\
StatesPlayerWidget, ShowAutoDockStatesBaseCmd, ShowAutoDockStates,\
ShowAutoDockStatesByEnergy, ShowAutoDockPopulation,\
ShowAutoDockStatesHISTOGRAM, ShowAutoDockClusteringStates,\
ReadAutoDockClusteringStates, WriteAutoDockStates,\
WriteAutoDockClustering, MakeAutoDockCLUSTERING,\
MakeAutoDockSubsetCLUSTERING


ADChooseMacroGUI=CommandGUI()
ADChooseMacroGUI.addMenuCommand('AutoTools4Bar', menuText['AnalyzeMB'], 
        menuText['chooseMacro'], cascadeName = menuText['MoleculesMB'])


ADReadMacroGUI=CommandGUI()
ADReadMacroGUI.addMenuCommand('AutoTools4Bar', menuText['AnalyzeMB'], 
        menuText['readMacro'], cascadeName = menuText['MoleculesMB'])


ADEPDBMolGUI=CommandGUI()
ADEPDBMolGUI.addMenuCommand('AutoTools4Bar', menuText['AnalyzeMB'], 
        menuText['epdbMol'], cascadeName = menuText['GridsMB'])


ADSeeSpotsGUI=CommandGUI()
                'name': 'smobNodes',
                'wcfg': {
                    'molSet': self.vf.Mols,
                    'vf': self.vf,
                    'all': 1,
                    'crColor': (0., 0., 1.),
                    'forceEmpty': 1,
                },
                'gridcfg': {
                    'row': -1,
                    'sticky': 'we'
                }
            })
            return idf

SuperimposeAtomsCommandGUI = CommandGUI()
## SuperimposeAtomsGUICommandGUI.addMenuCommand('menuRoot', 'Compute',
##                                              'superimpose Atom Pairs',
##                                              cascadeName = "Superimpose")
SuperimposeAtomsCommandGUI.addMenuCommand('menuRoot', 'Compute',
                                          'Superimpose Atom Pairs')

commandList = [
    {
        'name': 'superimposeAtoms',
        'cmd': SuperimposeAtomsCommand(),
        'gui': None
    },
    ##     {'name':'superimposeAtomsGC2', 'cmd':SuperimposeAtomsGUICommand(),
    ##      'gui':SuperimposeAtomsCommandGUI},
    {
Beispiel #32
0
    def deleteViews(self):
        """ Remove all existing views. """
        for b in self.viewsContainer.interior().grid_slaves():
            b.destroy()
        self.views = {}
        self.allViews = 0
        for d in self.viewsDirectors.values():
            if d.gui:
                d.gui.root.destroy()
                d.gui = None
            d = None
        self.viewsDirectors = {}
        self.representations = {}


ViewsCommandGUI = CommandGUI()
ViewsCommandGUI.addMenuCommand('menuRoot',
                               '3D Graphics',
                               'Show Views Panel',
                               index=10)

from mglutil.gui.BasicWidgets.Tk.customizedWidgets import SaveButton, LoadButton


class SaveViewsToFile(MVCommand):
    """This command allows the user to save created views to two files:
    *_views.py ( orientation) and *_repr.db(representation). These files are used to
    restore the saved views (ReadViews Command). The saved orientations and representations
    could also be loaded (separately) whith the DejaVu Viewer GUI."""
    def buildFormDescr(self, formName):
        if formName == 'saveViewsToFile':
    
"""

from ViewerFramework.VFCommand import CommandGUI

from AutoDockTools.autogpfCommands import GpfSetGpo,\
GpfMacroInit, GpfLoadDefaults, GpfEditor, GpfInitLigand, GpfWriter,\
SelectCenter, SetUpCovalentMap4, SetBoxParameters, SetOtherOptions,\
Gpf4ParameterFileSelector, Gpf4ParameterFileEditor, GpfMergeNonPolarHs,\
Gpf4SetMapTypes, Gpf4SetAtomTypes, Gpf4MacroInit, Gpf4MacroReader,\
Gpf4MacroChooser, Gpf4InitLigand, Gpf4LigandChooser, Gpf4LigReader,\
Gpf4FlexResChooser, Gpf4FlexResReader, Gpf4Writer, menuText, gridOpts,\
messages, checkHasGpo, box, cenSph, cenCross


GpfLoadDefaultsGUI = CommandGUI()
GpfLoadDefaultsGUI.addMenuCommand('AutoTools4Bar', menuText['AutoGpfMB'],\
        menuText['ReadGpfMB'])


GpfEditorGUI= CommandGUI()
GpfEditorGUI.addMenuCommand('AutoTools4Bar', menuText['AutoGpfMB'],\
        menuText['EditGpfMB'])


GpfWriterGUI= CommandGUI()
GpfWriterGUI.addMenuCommand('AutoTools4Bar', menuText['AutoGpfMB'], \
    menuText['WriteGpfMB'], cascadeName=menuText['WriteMB'])


SetUpCovalentMap4GUI = CommandGUI()
Beispiel #34
0
"""
from ViewerFramework.VFCommand import CommandGUI
from AutoDockTools.autostartCommands import ADKill, ADProcessManager,\
AutoStarter, AutoGridStarter, AutoDockStarter, AddAutoDockHost, removePCs,\
entropiaPresent, menuText

from AutoDockTools.autostartCommands import VinaStarter

if entropiaPresent:
    from Entropia.EntropiaDef import entropia_job_dir
    from Entropia.EntropiaUI import EntropiaUI
    from Entropia.EntropiaEx import EntropiaError
    import ftplib

ADProcessManagerGUI = CommandGUI()
ADProcessManagerGUI.addMenuCommand('AutoTools41Bar', menuText['StartMB'],
                                   menuText['processManagerMB'])

AutoGridStarterGUI = CommandGUI()
AutoGridStarterGUI.addMenuCommand('AutoTools41Bar', menuText['StartMB'],
                                  menuText['startGridMB'])

AutoDockStarterGUI = CommandGUI()
AutoDockStarterGUI.addMenuCommand('AutoTools41Bar', menuText['StartMB'],
                                  menuText['startDockMB'])

VinaStarterGUI = CommandGUI()
VinaStarterGUI.addMenuCommand('AutoTools41Bar', menuText['StartMB'],
                              menuText['startVinaMB'])
Beispiel #35
0

    * The results of the previous steps are written to a file. The user selects a filename via a filebrowser.  By convention, the file should have a .dpf extension. If no macromolecule has been selected, it is not possible to write a grid parameter file and the user gets a warning message to that effect. Likewise, the types of the maps to be calculated must be set before the grid parameter file is written and a warning message to this effect appears if the types have not been set.
(A checkbutton, "DONE", allows the user to withdraw the autoTools menuBar)
    
"""
from ViewerFramework.VFCommand import CommandGUI
from AutoDockTools.autodpfCommands import DpfSetDpo, DpfLoadDefaults,\
Dpf4MacroSelector, Dpf4FlexResSelector, Dpf4MacroChooser,\
Dpf4InitLigand, Dpf4LigandChooser, Dpf4LigPDBQReader,\
DpfEditor, Dpf41SAWriter, Dpf41GAWriter, Dpf41LSWriter,\
Dpf41GALSWriter, Dpf4ClusterWriter, SimAnneal, GA,\
LS, SetDockingRunParms, SetAutoDock4Parameters, SetAutoDock41Parameters,\
StopAutoDpf, menuText, checkHasDpo, sortKeyList, setDpoFields

DpfLoadDefaultsGUI = CommandGUI()
DpfLoadDefaultsGUI.addMenuCommand('AutoTools41Bar', menuText['AutoDpfMB'],
                                  menuText['ReadDpfMB'])

Dpf4MacroSelectorGUI = CommandGUI()
Dpf4MacroSelectorGUI.addMenuCommand('AutoTools41Bar', menuText['AutoDpfMB'],\
menuText['ReadMacro4'], cascadeName = menuText['MacromoleculeMB'])

Dpf4FlexResSelectorGUI = CommandGUI()
Dpf4FlexResSelectorGUI.addMenuCommand('AutoTools41Bar', menuText['AutoDpfMB'],\
menuText['ReadFlexRes4'], cascadeName = menuText['MacromoleculeMB'])

Dpf4MacroChooserGUI = CommandGUI()
Dpf4MacroChooserGUI.addMenuCommand('AutoTools41Bar', menuText['AutoDpfMB'],\
menuText['ChooseMacro4'], cascadeName = menuText['MacromoleculeMB'])
Beispiel #36
0
        req._username = username
        req._passwd = passwd
        resp = gamaLoginService.loginUserMyProxy(req)
        f = open(self.proxy_gama, "w")
        f.write(resp._loginUserMyProxyReturn)
        f.close()
        if self.RememberLogin_var.get():
            file = open(self.rc_ad,'w')
            user = self.cmdForms['default'].descr.entryByName\
                                          ['UserName_Entry']['widget'].get()
            passwd = self.cmdForms['default'].descr.entryByName\
                                          ['Password_Entry']['widget'].get()
            file.write("User:%s\nPassword:%s\n"%(user,passwd))
        self.login = True
        
WebServicesGUI=CommandGUI()
WebServicesGUI.addMenuCommand('AutoToolsBar', menuText['StartMB'], "Web Services...")

commandList = [{'name':'ADweb_services','cmd':WebServices(),'gui':WebServicesGUI}]  

WebServices4GUI=CommandGUI()
WebServices4GUI.addMenuCommand('AutoTools4Bar', menuText['StartMB'], "Web Services...")


def initModule(viewer):
    if not hasattr(viewer, 'ADweb_services') and hasattr(viewer, 'GUI')\
        and hasattr(viewer.GUI, 'currentADTBar'):
        viewer.addCommand(WebServices(),'ADweb_services',WebServices4GUI)
    #else:
    #    for _dict in commandList:
    #        viewer.addCommand(_dict['cmd'],_dict['name'],_dict['gui'])
            self.ifd.entryByName['gridPointsXEnd']['widget'].set(
                atom.coords[0])
            self.ifd.entryByName['gridPointsYEnd']['widget'].set(
                atom.coords[1])
            self.ifd.entryByName['gridPointsZEnd']['widget'].set(
                atom.coords[2])
            self.endCross.Set(vertices=((atom.coords[0], atom.coords[1],
                                         atom.coords[2]), ))

        self.vf.GUI.VIEWER.Redraw()

    def openPklData(self):
        self.vf.AutoLigandMovieCommand(self.fileBaseName + '_flood.pkl')


AutoLigandCommandGUI = CommandGUI()
AutoLigandCommandGUI.addMenuCommand('menuRoot',
                                    'Compute',
                                    'Run AutoLigand...',
                                    cascadeName="AutoLigand")


class OpenMovieCommand(MVCommand):
    "GUI that opens saved movie of fill file."

    def __init__(self, func=None):
        MVCommand.__init__(self, func)
        self.floodFile = None

    def guiCallback(self):
        file = self.vf.askFileOpen(types=[('Saved Flood File', '*.pkl'),
Beispiel #38
0
            os.remove(os.path.join(self.vf.rcFolder,"colorByAtom_map.py"))
        except:
            pass
        from Pmv.pmvPalettes import AtomElements
        self.vf.colorByAtomType.palette = ColorPalette('Atom Elements', colorDict=AtomElements,
                                    lookupMember='element')        
        geoms = self.vf.colorByAtomType.getAvailableGeoms(self.vf.Mols)
        self.cleanup() 
        self.vf.colorByAtomType(self.vf.Mols, geoms)
        
    def doit(self):
        self.vf.colorByAtomType.palette.configure(ramp=self.paletteGUI.ramp, labels=self.paletteGUI.labels)
        self.vf.colorByAtomType.palette.configureCmap()
        self.vf.colorByAtomType.palette.write(os.path.join(self.vf.rcFolder,"colorByAtom_map.py"))
        
EditColorPaletteByAtomTypeGUI = CommandGUI()
EditColorPaletteByAtomTypeGUI.addMenuCommand('menuRoot', 
                                             'Edit', 
                                             'Edit Color by Atom Type',
                                             cascadeName='Color Palettes')

class EditColorPaletteByResidueType(MVCommand):

    def onAddCmdToViewer(self):
        if not self.vf.commands.has_key('colorByResidueType'):
            self.vf.loadCommand('colorCommands', 'colorByResidueType', 'Pmv', topCommand = 0)
        self.vf.colorByResidueType.palette.read(os.path.join(self.vf.rcFolder,"colorByResidueType_map.py"))


    def guiCallback(self):
        self.paletteGUI = PaletteChooser(apply_cb=self.apply, makeDefault_cb=self.doit, 
##              # Save the pyShell stdin and redirect it to the main Python
##              # interpreter only works if the main interpreter has been
##              # started in a interactive mode.
##              self.vf.pyShellstdin = sys.stdin
##              sys.stdin = sys.__stdin__

##              # Save the pyShell stderr and redirect it to the main Python
##              # interpreter only works if the main interpreter has been
##              # started in a interactive mode.
##              self.vf.pyShellstderr = sys.stderr
##              sys.stderr = sys.__stderr__
            

# HideGUI command GUI.
HideGUI = CommandGUI()
HideGUI.addMenuCommand('menuRoot', 'File', 'Hide VF GUI...',
                       cascadeName='Preferences')

class ShowGUICommand(Command):
    """Allow to show the ViewerFrameworkGUI at any time
    \nPackage : Pmv
    \nModule : customizeVFGUICommands
    \nClass : ShowGUICommand
    \nCommand : ShowGUI
    \nSynopsis:\n 
    None <- ShowGUI(**kw)
    """

    def __call__(self,**kw):
        """ None <- ShowGUI(**kw)
Beispiel #40
0
            at0, at1, at2, at3 = self.atomList
            angle = self.extslider.get()
            if self.torsionType.get() == '1':
                self.vf.setTorsion(at0, at1, at2, at3, angle)
            else:
                self.vf.setRelativeTorsion(at1, at2, angle)

setTorsionGuiDescr = {
    'widgetType': 'Menu',
    'menuBarName': 'menuRoot',
    'menuButtonName': 'Set Torsion Angle',
    'menuEntryLabel': 'Show Set Torsion Panel',
    'index': 0
}

SetTorsionGUI = CommandGUI()
SetTorsionGUI.addMenuCommand('menuRoot',
                             'Edit',
                             'Set Torsion',
                             cascadeName='Torsion Angles')


class TorsionAngle:
    def __init__(self, atom1, atom2, atom3, atom4):
        self.molecule = atom1.top
        self.name_string = atom1.name + "-" + atom2.name + "-" + atom3.name + "-" + atom4.name
        self.atom1 = atom1
        self.atom2 = atom2
        self.atom3 = atom3
        self.atom4 = atom4
        self.mov_atoms = self.molecule.subTree(atom2, atom3,
                    cb = self.vf.playTrajectory.ifd.entryByName['trs']['widget']
                    sl = cb.component('scrolledlist')
                    trajnames = self.vf.Trajectories.keys()
                    sl.setlist(trajnames)
                    cb.selectitem(name)
            return name
        else: return None

    def __call__(self, trajFile, ask=False, **kw):
        """trajName<-openTrajectory(trajFile)
           open aand parse a trajectory file (.trr or .xtc)."""
        
        self.doitWrapper(trajFile, ask)

            
OpenTrajectoryGUI = CommandGUI()
OpenTrajectoryGUI.addMenuCommand('menuRoot', "Trajectory", "Read...")
#OpenTrajectoryGUI.addMenuCommand('menuRoot', 'File', 
#                         'Trajectory (Gromacs)', cascadeName='Read', index=3)      




class PlayTrajectoryCommand (MVCommand):
    """This class allows the user to select/read a trajectory and a corresponding molecule.
       It invokes TrajPlayer interface to play selected trajectory"""
    
    def __init__(self):
        MVCommand.__init__(self)
        self.trajectory = None
        self.player = None
            return
        if self.minZ < atom.coords[2] > self.maxZ:
            return
        
        self.ifd.entryByName['gridPointsX']['widget'].set(atom.coords[0])
        self.ifd.entryByName['gridPointsY']['widget'].set(atom.coords[1])
        self.ifd.entryByName['gridPointsZ']['widget'].set(atom.coords[2])
        self.cross.Set(visible=1)
        self.cross.Set(vertices=((atom.coords[0], atom.coords[1], atom.coords[2]),))
        self.vf.GUI.VIEWER.Redraw()                          
         
        
    def openPklData(self):
        self.vf.AutoLigandMovieCommand(self.fileBaseName+'_flood.pkl')
            
AutoLigandCommandGUI = CommandGUI()
AutoLigandCommandGUI.addMenuCommand('menuRoot', 'Compute', 'Run AutoLigand...', 
                                    cascadeName="AutoLigand")


class OpenMovieCommand(MVCommand):        
    "GUI that opens saved movie of fill file."       
    def __init__(self, func=None):
        MVCommand.__init__(self, func)
        self.floodFile = None


    def guiCallback(self):
        file = self.vf.askFileOpen(types=[('Saved Flood File', '*.pkl'),('All Files', '*')],
                                   title='Open Saved Flood File')        
        if file:
        """
        if type(nodes) is types.StringType:
            self.nodeLogString = "'"+nodes+"'"
        
        self.vf.resetUndo(topCommand=0)
        apply ( self.doitWrapper, (nodes,), kw )


deleteMoleculeGuiDescr = {'widgetType':'Menu', 'menuBarName':'menuRoot',
                          'menuButtonName':'Edit',
                          'menuCascadeName':'Delete',
                          'menuEntryLabel':'Molecule',
                          'index':0}


DeleteMoleculeGUI = CommandGUI()
DeleteMoleculeGUI.addMenuCommand('menuRoot', 'Edit', 'Delete Molecule', 
        cascadeName = 'Delete')



class DeleteAllMolecules(MVCommand):
    """Command to delete all molecules from the MoleculeViewer
    \nPackage : Pmv
    \nModule  : deleteCommands
    \nClass   : DeleteAllMolecules
    \nCommand : deleteAllMolecules
    \nSynopsis:\n
        None<---deleteAllMolecules( **kw)
    \nRequired Arguments:\n
         It resets the undo stack automatically.\n
Beispiel #44
0
    def __call__(self, *args, **kw):
        """None <--- buildDNA(name,seq,**kw)
        \nnodes---TreeNodeSet holding the current selection
        \ncolors---list of rgb tuple.
        \ngeomsToColor---list of the name of geometries to color,default is 'all'
        """
        status = self.doitWrapper(
            *args, **kw)  #apply( self.doitWrapper, (name, seq), kw)
        return status

    def guiCallback(self):
        status = self.doitWrapper()


autoPACKGUI = CommandGUI()
autoPACKGUI.addMenuCommand('menuRoot', 'Compute', 'autoPack')

commandList = [
    {
        'name': 'autoPACK',
        'cmd': AutoPACKCommand(),
        'gui': autoPACKGUI
    },
]


def initModule(viewer):
    for dict in commandList:
        viewer.addCommand(dict['cmd'], dict['name'], dict['gui'])
            
    def alignment_cb(self, event=None):
        if not hasattr(self.vf,'alignment'):
            self.vf.alignment = Alignment()
        if not hasattr(self.vf,'alnEditor'):
            self.vf.alnEditor = PmvAlignmentEditor(vf=self.vf)
            self.vf.alnEditor.alignment = self.vf.alignment
        else:
            self.vf.alnEditor.redraw()
            self.vf.alnEditor.master.deiconify()
        for mol in self.vf.Mols:
            if mol.name not in self.vf.alignment.seqNames:
                self.vf.alnEditor.getSequence(mol)

       
SuperImposeAtomsGUICommandGUI = CommandGUI()
SuperImposeAtomsGUICommandGUI.addMenuCommand('menuRoot', 'Compute',
                                             'superimposeAtoms',

                                             cascadeName = "Superimpose")
    
    

class SuperimposeCoordsCommand(MVCommand):
    
    def onAddCmdToViewer(self):
        if not self.vf.commands.has_key('superimposeAtoms'):
            self.vf.loadCommand('superImposeCommands', 'superimposeAtoms',
                                'Pmv', topCommand = 0)
            
Beispiel #46
0
import Tkinter
from ViewerFramework.VFCommand import CommandGUI
from AutoDockTools.autotorsCommands import rootSph, markSph,\
menuText, AtorsMoleculeChooser, MAXTORS, AdtSetMode,\
AtorsReader, Ators4MoleculeChooser, Ators4Reader, AtorsRefWriter, \
RigidMolecule, RigidMolecule4, AUTOTORSWriter, AUTOTORS4Writer,  AUTOTORS4RandomWriter,\
MarkRoot, SelectRoot, SetTorsionNumberGUICommand, SetTorsionNumber, \
AutoRoot, SetRotatableBonds, DefiningRotatableBonds, SetBondRotatableFlag,\
CheckAromatic, StopCheckAromatic, SetCarbonNames, ChangeAromaticCutOff, \
TogglerootSphere, AutoAutoTors, StopAutoTors, AtorsInit, AtorsInitMol, \
ProcessCharges, ProcessBonds, rootSph, markSph, check_autotors_geoms,\
MAXTORS, menuText, warningText, checkMolCharges,\
autoMergeNPHS, set_autoMergeNPHS

Ators41MoleculeChooserGUI = CommandGUI()
Ators41MoleculeChooserGUI.addMenuCommand(
    'AutoTools41Bar',
    menuText['AutoTorsMB'],
    menuText['Choose Molecule4'],
    cascadeName=menuText['Input Molecule'])

Ators41ReaderGUI = CommandGUI()
Ators41ReaderGUI.addMenuCommand('AutoTools41Bar',
                                menuText['AutoTorsMB'],
                                menuText['Read Molecule4'],
                                cascadeName=menuText['Input Molecule'])

AtorsRefWriterGUI = CommandGUI()
AtorsRefWriterGUI.addMenuCommand('AutoTools41Bar',
                                 menuText['AutoTorsMB'],
        """ Remove all existing views. """
        for b in self.viewsContainer.interior().grid_slaves():
            b.destroy()
        self.views = {}
        self.allViews = 0
        for d in self.viewsDirectors.values():
            if d.gui:
                d.gui.root.destroy()
                d.gui = None
            d = None
        self.viewsDirectors={}
        self.representations = {}
    


ViewsCommandGUI = CommandGUI()
ViewsCommandGUI.addMenuCommand('menuRoot', '3D Graphics','Show Views Panel',
                                   index = 10)

from mglutil.gui.BasicWidgets.Tk.customizedWidgets import SaveButton, LoadButton

class SaveViewsToFile(MVCommand):
    """This command allows the user to save created views to two files:
    *_views.py ( orientation) and *_repr.db(representation). These files are used to
    restore the saved views (ReadViews Command). The saved orientations and representations
    could also be loaded (separately) whith the DejaVu Viewer GUI."""

    def buildFormDescr(self, formName):
        if formName=='saveViewsToFile':
            if self.vf.commands.has_key("viewsPanel"):
                if len(self.vf.viewsPanel.views) == 0:
Beispiel #48
0
        geom.Set(instanceMatrices=matrices)#packing
        if not molecule.geomContainer.geoms.has_key('Unit Cell'):
            fractCoords=((1,1,0),(0,1,0),(0,0,0),(1,0,0),(1,1,1),(0,1,1),
                                                            (0,0,1),(1,0,1))
            coords = []
            coords = molecule.crystal.toCartesian(fractCoords)
            box=Box('Unit Cell', vertices=coords)
            self.vf.GUI.VIEWER.AddObject(box, parent=geom)
            molecule.geomContainer.geoms['Unit Cell'] = box
            
    def showUnitCell(self, molecule):
        visible = not molecule.geomContainer.geoms['Unit Cell'].visible
        molecule.geomContainer.geoms['Unit Cell'].Set(visible=visible)

    def showPacking(self, molecule):
        geom = molecule.geomContainer.geoms['master']
        if len(geom.instanceMatricesFortran) >= 2:
            geom.Set(instanceMatrices=[numpy.eye(4,4)])
        else:
            matrices = instanceMatricesFromGroup(molecule)
            geom.Set(instanceMatrices=matrices)
            
        
        
CrystalCommandGUI = CommandGUI()
CrystalCommandGUI.addMenuCommand('menuRoot', 'Display', 'Crystal')

commandList  = [{'name':'crystalCommand','cmd':CrystalCommand(),'gui':CrystalCommandGUI}]
def initModule(viewer):
    for _dict in commandList:
        viewer.addCommand(_dict['cmd'],_dict['name'],_dict['gui'])
	"""Write STL file ( molecules, filename )"""
        self.doit(atoms, filename)


    def guiCallback(self):
        newfile = self.vf.askFileSave(types = [('STL files', '*.stl'),],
                                 title = 'Select STL files:')
        print 'filename: ', newfile
        if newfile != None:
            self.doit(self.vf.getSelection(), newfile)

writeSTLGuiDescr = {'widgetType':'Menu', 'menuBarName':'menuRoot',
                    'menuButtonName':'File',
                    'menuEntryLabel':'Write STL'}

WriteSTLGUI = CommandGUI()
WriteSTLGUI.addMenuCommand('menuRoot', 'File', 'Write STL')

class WriteColoredM(MVCommand):

    def onAddCmdToViewer(self):
        if not self.vf.commands.has_key('msmsMol'):
            self.vf.loadCommand('msmsCommands', 'msmsMol', 'Pmv',
                                topCommand = 0) 

    def writeCMsurface(self, mol, filename):
        """Write the MSMS surface corresponding to all selected molecules
	in the .m format with rbg color for each vertex"""

	if not hasattr(mol.geomContainer, 'msms'): #surface not computed
	    self.vf.msmsMol.guiCallback()
Beispiel #50
0
    
"""




from ViewerFramework.VFCommand import CommandGUI

from AutoDockTools.autoflexCommands import  AF_MacroReader,\
AF_MacroChooser, AF_SelectResidues, AF_ProcessResidues,\
AF_ProcessHingeResidues, AF_EditHinge, AF_SetHinge,\
AF_SetBondRotatableFlag, AF_StepBack, AF_FlexFileWriter,\
AF_RigidFileWriter, AF_LigandDirectoryWriter, menuText


AF_MacroReaderGUI=CommandGUI()
AF_MacroReaderGUI.addMenuCommand('AutoTools4Bar', menuText['AutoFlexMB'], \
        menuText['Read Macro'], cascadeName = menuText['InputMB'])

AF_MacroChooserGUI=CommandGUI()
AF_MacroChooserGUI.addMenuCommand('AutoTools4Bar', menuText['AutoFlexMB'],
            menuText['Choose Macro'], cascadeName = menuText['InputMB'])

AF_SelectResiduesGUI = CommandGUI()
AF_SelectResiduesGUI.addMenuCommand('AutoTools4Bar', menuText['AutoFlexMB'],menuText['Set Residues'])

AF_ProcessResiduesGUI = CommandGUI()
AF_ProcessHingeResiduesGUI = CommandGUI()

AF_EditHingeGUI = CommandGUI()
AF_EditHingeGUI.addMenuCommand('AutoTools4Bar', menuText['AutoFlexMB'],\
        apply(self.doitWrapper, (filename,), kw)


    def guiCallback(self, event=None,):
        name = self.vf.__class__.__name__
        file = self.vf.askFileOpen(types=[('%s scripts'%name, '*.py'),
                                          ('Resource file','*.rc'),
                                           ('All Files', '*.*')],
                                          title="read %s script file:"%name)
        if file:
            self.doitWrapper(file, redraw=0)
            if hasattr(self.vf, 'recentFiles'):
                self.vf.recentFiles.add(file, self.name)

# Source Command GUI
SourceGUI = CommandGUI()
SourceGUI.addMenuCommand('menuRoot', 'File', 'Python Scripts',
                         cascadeName='Import', cascadeIndex=1)

## SaveSessionCommand Command GUI
#SaveSessionCommandGUI = CommandGUI()
#SaveSessionCommandGUI.addMenuCommand('menuRoot', 'File',
                                     #'Current Session', cascadeName='Save', index=1)

# SetUserPreference Command GUI
SetUserPreferenceGUI = CommandGUI()
SetUserPreferenceGUI.addMenuCommand('menuRoot', 'File', 'Set...',
                                    cascadeName='Preferences'
                                    )
## # SetCmdParam Command GUI
## SetCmdParamGUI = CommandGUI()
Beispiel #52
0
class ColorCommandProxy(CommandProxy):
    def guiCallback(self, **kw):
        if self.command:
            self.command.guiCallback(**kw)
        else:
            from Pmv.colorCommands import ColorCommand
            command = ColorCommand()
            loaded = self.vf.addCommand(command, 'color', self.gui)
            if loaded:
                command = loaded
            self.command = command
            self.command.guiCallback(**kw)


ColorGUI = CommandGUI()
ColorGUI.addMenuCommand('menuRoot', 'Color', 'Choose Color')


class ColorByAtomTypeProxy(CommandProxy):
    def guiCallback(self, **kw):
        if self.command:
            self.command.guiCallback(**kw)
        else:
            from Pmv.colorCommands import ColorByAtomType
            command = ColorByAtomType()
            loaded = self.vf.addCommand(command, 'colorByAtomType', self.gui)
            if loaded:
                command = loaded
            self.command = command
            self.command.guiCallback(**kw)
        #for k in sets__.keys():
        for k in self.vf.sets.keys():
            ifd.append({'name': k,
                    'widgetType':Tkinter.Checkbutton,
                    'wcfg':{ 'text': k,
                             'variable': Tkinter.IntVar(),
                             'command': None},
                    'gridcfg':{'sticky':Tkinter.W,'row':gridrow,'column':0,
                               'columnspan':2},
                    })
            gridrow = gridrow + 1
        return ifd



ExportSetsGUI = CommandGUI() # adds ok/cancel
ExportSetsGUI.addMenuCommand('menuRoot', 'Select', 'Add to Vision',
                             cascadeName='Export Sets')

commandList = [
    {'name':'vision', 'cmd':VisionCommand(), 'gui':VisionCommandGUI},
    {'name':'exportSets', 'cmd':ExportSets(), 'gui':ExportSetsGUI},
    ]

def initModule(viewer):
    for dict in commandList:
        viewer.addCommand(dict['cmd'], dict['name'], dict['gui'])



Beispiel #54
0
            box = Box('Unit Cell', vertices=coords)
            self.vf.GUI.VIEWER.AddObject(box, parent=geom)
            molecule.geomContainer.geoms['Unit Cell'] = box

    def showUnitCell(self, molecule):
        visible = not molecule.geomContainer.geoms['Unit Cell'].visible
        molecule.geomContainer.geoms['Unit Cell'].Set(visible=visible)

    def showPacking(self, molecule):
        geom = molecule.geomContainer.geoms['master']
        if len(geom.instanceMatricesFortran) >= 2:
            geom.Set(instanceMatrices=[numpy.eye(4, 4)])
        else:
            matrices = instanceMatricesFromGroup(molecule)
            geom.Set(instanceMatrices=matrices)


CrystalCommandGUI = CommandGUI()
CrystalCommandGUI.addMenuCommand('menuRoot', 'Display', 'Crystal')

commandList = [{
    'name': 'crystalCommand',
    'cmd': CrystalCommand(),
    'gui': CrystalCommandGUI
}]


def initModule(viewer):
    for _dict in commandList:
        viewer.addCommand(_dict['cmd'], _dict['name'], _dict['gui'])
Beispiel #55
0
            
    def alignment_cb(self, event=None):
        if not hasattr(self.vf,'alignment'):
            self.vf.alignment = Alignment()
        if not hasattr(self.vf,'alnEditor'):
            self.vf.alnEditor = PmvAlignmentEditor(vf=self.vf)
            self.vf.alnEditor.alignment = self.vf.alignment
        else:
            self.vf.alnEditor.redraw()
            self.vf.alnEditor.master.deiconify()
        for mol in self.vf.Mols:
            if mol.name not in self.vf.alignment.seqNames:
                self.vf.alnEditor.getSequence(mol)

       
SuperImposeAtomsGUICommandGUI = CommandGUI()
SuperImposeAtomsGUICommandGUI.addMenuCommand('menuRoot', 'Compute',
                                             'superimposeAtoms',

                                             cascadeName = "Superimpose")
    
    

class SuperimposeCoordsCommand(MVCommand):
    
    def onAddCmdToViewer(self):
        if not self.vf.commands.has_key('superimposeAtoms'):
            self.vf.loadCommand('superImposeCommands', 'superimposeAtoms',
                                'Pmv', topCommand = 0)