コード例 #1
0
 def setUp(self):
     self.mols = Read('Data/stringSel.pdb')
     new_mols = Read("Data/1crn.pdb")
     self.mols +=new_mols
     self.atoms = self.mols.chains.residues.atoms
     self.stringSel = AtomSetSelector()
コード例 #2
0
ファイル: stringSelectorGUI.py プロジェクト: lisarosalina/App
    def __init__(self,
                 master,
                 check=0,
                 molSet=MoleculeSet([]),
                 userPref='cS',
                 vf=None,
                 all=1,
                 crColor=(0., 1., 0),
                 clearButton=True,
                 showButton=True,
                 sets=None,
                 **kw):

        if not kw.get('packCfg'):
            self.packCfg = {'side': 'top', 'anchor': 'w', 'fill': 'x'}

        self.sets = sets
        #all is a shortcut to use all of default values
        if 'all' in kw.keys():
            all = 1
        elif __debug__:
            if check:
                apply(checkKeywords, ('stringSelector', self.entryKeywords),
                      kw)

        Tkinter.Frame.__init__(self, master)
        ##????
        Tkinter.Pack.config(self, side='left', anchor='w')

        #to make a stringSelector need vf, moleculeSet, selString
        self.master = master
        self.molSet = molSet
        self.residueSelector = ResidueSetSelector()
        self.atomSelector = AtomSetSelector()
        self.userPref = userPref
        self.vf = vf
        if not self.vf is None:
            self.addGeom(crColor)
        else:
            self.showCross = None
        self.molCts = {}
        self.chainCts = {}

        # optsDict includes defaults for all possible widgets
        # in practice
        # user can specify which widgets to put into gui
        d = self.optsDict = {}

        #first check for menubuttons:

        llists = [self.entryKeywords, self.menuKeywords, self.buttonKeywords]
        if all:
            if not clearButton:
                self.buttonKeywords.remove("clearBut")
            if not showButton:
                self.buttonKeywords.remove("showBut")
            for l in llists:
                for key in l:
                    d[key] = 1

        else:
            for l in llists:
                for key in l:
                    d[key] = kw.get(key)

        self.flexChildren = {
            'mol': ['molLabel', 'molEntry'],
            'chain': ['chainLabel', 'chainEntry'],
            'res': ['resLabel', 'resEntry'],
            'atom': ['atomLabel', 'atomEntry'],
        }

        for w in ['molWids', 'chainWids', 'resWids', 'atomWids']:
            if kw.get(w):
                lab = w[:-4]
                s = lab + 'Label'
                d[s] = 1
                s1 = lab + 'Entry'
                d[s1] = 1

        # instantiate all Tkinter variables (?)
        #DON"T HAVE ANY???
        self.buildTkVars()

        # only build requested widgets(?)
        self.buildifdDict()

        # build commandDictionary
        self.buildCmdDict()

        self.buildGUI()
コード例 #3
0
 def test_constructor(self):
     """
     instantiate an AtomSetSelector
     """
     stringSel = AtomSetSelector()
     self.assertEquals(stringSel.__class__, AtomSetSelector)