コード例 #1
0
def parse_color(fields, name):

    if len(fields) == 0:
        raise syn, 'Missing %s value' % name

    # Color from color dialog
    if fields[0] in ('colorpanel', 'fromeditor', 'editor'):
        from CGLtk.color import ColorWell
        if not ColorWell._colorPanel:
            from chimera import dialogs
            dialogs.display("color editor")
            raise syn, 'Choose color in panel first'
        return ColorWell.colorPanel().rgba

    # Chimera color defined with colordef
    from chimera import Color
    c = Color.lookup(fields[0])
    if c:
        return c.rgba()

    try:
        # Tk color name.
        from chimera.tkgui import app
        color = [c / 65535.0 for c in app.winfo_rgb(fields[0])]
    except:
        # Comma separated list of rgb or rgba float values.
        color = parse_values(fields, 'color', float, (3, 4))

    return color
コード例 #2
0
def show_side_view():
    'Show side view dialog'
    from chimera import dialogs
    from chimera import viewing
    dialogs.display(viewing.ViewerDialog.name)
    d = dialogs.find(viewing.ViewerDialog.name, create=1)
    d.nb.raise_page('pSideView')
コード例 #3
0
def parse_color(fields, name):

    if len(fields) == 0:
        raise syn, 'Missing %s value' % name

    # Color from color dialog
    if fields[0] in ('colorpanel', 'fromeditor', 'editor'):
        from CGLtk.color import ColorWell
        if not ColorWell._colorPanel:
            from chimera import dialogs
            dialogs.display("color editor")
            raise syn, 'Choose color in panel first'
        return ColorWell.colorPanel().rgba

    # Chimera color defined with colordef
    from chimera import Color
    c = Color.lookup(fields[0])
    if c:
        return c.rgba()

    try:
        # Tk color name.
        from chimera.tkgui import app
        color = [c/65535.0 for c in app.winfo_rgb(fields[0])]
    except:
        # Comma separated list of rgb or rgba float values.
        color = parse_values(fields, 'color', float, (3,4))

    return color
コード例 #4
0
def initiateAddHyd(models, cancelCB=None, okCB=None, hisScheme=None,
					addFunc=AddH.hbondAddHydrogens):
	"""Request the addition of hydrogens to the given models.

	If all atoms in the models have known hydrogen-adding geometries,
	the hydrogens are added immediately.  Otherwise, a dialog is
	started to request the missing information from the user.  Once
	the user 'Ok's the information-gathering dialog, the hydrogens are
	added.  The dialog can instead be cancelled, in which case no 
	hydrogens are added.

	This function may be called from the user interface or from other
	functions.  If the latter, then typically the cancelCB and okCB
	callback functions are provided so that the calling function can
	ascertain whether hydrogens were in fact added to the models.
	"""
	unks = AddH.gatherUnknowns(models)
	if unks:
		dialogs.display(addHinfoDialog.name)
		dialog = dialogs.find(addHinfoDialog.name)
		dialog.setAtoms(unks)
		dialog.models = models
		dialog.cancelCB = cancelCB
		dialog.okCB = okCB
		dialog.hisScheme = hisScheme
		dialog.addFunc = addFunc
	else:
		addFunc(models, hisScheme=hisScheme)
		if okCB:
			okCB()
コード例 #5
0
	def Apply(self):
		val = self.seqMenu1.get()
		if val == self.ALL:
			seqs1 = self.mav.seqs
		else:
			seqs1 = [s for s in self.mav.seqs if s.name == val]
		val = self.seqMenu2.get()
		if val == self.ALL:
			seqs2 = self.mav.seqs
		else:
			seqs2 = [s for s in self.mav.seqs if s.name == val]

		denom = self.denominator.get()
		for s1 in seqs1:
			for s2 in seqs2:
				pi = percentIdentity(s1, s2, denominator=denom)
				self.mav.status("%s vs. %s:\n"
					"   %.2f%% identity\n" % (s1.name,
					s2.name, pi))
				# since once OK is clicked, the mouse may be
				# over a part of the alignment that causes a
				# status message, also send to regular status
				# line
				replyobj.status("%s vs. %s: %.2f%% identity\n"
					% (s1.name, s2.name, pi), log=True)
		if len(seqs1) > 1 or len(seqs2) > 1:
			self.mav.status("Percent identity info in Reply Log")
			from chimera import dialogs, tkgui
			dialogs.display(tkgui._ReplyDialog.name)
コード例 #6
0
    def Apply(self):
        val = self.seqMenu1.get()
        if val == self.ALL:
            seqs1 = self.mav.seqs
        else:
            seqs1 = [s for s in self.mav.seqs if s.name == val]
        val = self.seqMenu2.get()
        if val == self.ALL:
            seqs2 = self.mav.seqs
        else:
            seqs2 = [s for s in self.mav.seqs if s.name == val]

        denom = self.denominator.get()
        for s1 in seqs1:
            for s2 in seqs2:
                pi = percentIdentity(s1, s2, denominator=denom)
                self.mav.status("%s vs. %s:\n"
                                "   %.2f%% identity\n" %
                                (s1.name, s2.name, pi))
                # since once OK is clicked, the mouse may be
                # over a part of the alignment that causes a
                # status message, also send to regular status
                # line
                replyobj.status("%s vs. %s: %.2f%% identity\n" %
                                (s1.name, s2.name, pi),
                                log=True)
        if len(seqs1) > 1 or len(seqs2) > 1:
            self.mav.status("Percent identity info in Reply Log")
            from chimera import dialogs, tkgui
            dialogs.display(tkgui._ReplyDialog.name)
コード例 #7
0
 def showRainbowDialog(models):
     from chimera import dialogs
     from rainbow import RainbowDialog
     if len(models) > 1:
         target = "models"
     else:
         target = "residues"
     dialogs.display(RainbowDialog.name).configure(models=models,
                                                   target=target)
コード例 #8
0
ファイル: base.py プロジェクト: davem22101/semanticscience
		def showRainbowDialog(models):
			from chimera import dialogs
			from rainbow import RainbowDialog
			if len(models) > 1:
				target = "models"
			else:
				target = "residues"
			dialogs.display(RainbowDialog.name).configure(
						models=models, target=target)
コード例 #9
0
def _showBondRotUI(trigger, myData, br):
	if chimera.nogui:
		return
	if trigger == bondRotMgr.CREATED:
		# some window managers are slow to raise windows
		# only auto-raise the dialog if a new rotation is created
		dialogs.display(StructMeasure.name)
	d = dialogs.find(StructMeasure.name)
	d.setCategoryMenu(BONDROTS)
	d.rotChange(trigger, br)
コード例 #10
0
def _reportStatus(msg, assigned, propList, modelList, rba):
	if len(assigned) == 1:
		phrase = "one atom"
	else:
		phrase = "%d atoms" % len(assigned)
	pList = [ repr(p) for p in propList ]
	if len(pList) == 1:
		s = pList[0]
		plural = ""
		verb = "was"
	else:
		s = ", ".join(pList[:-1]) + " and " + pList[-1]
		plural = "s"
		verb = "were"
	msg += ("Attribute%s %s %s created for %s.\n"
		% (plural, s, verb, phrase))
	chimera.replyobj.status(msg)
	chimera.replyobj.message(msg)
	if rba and assigned:
		try:
			from ShowAttr import ShowAttrDialog
		except ImportError:
			# No "render by attribute", just ignore
			pass
		else:
			from chimera import dialogs
			d = dialogs.display(ShowAttrDialog.name)
			d.configure(models=modelList, attrsOf="atoms",
					attrName=None)
			d.refreshAttrs()
			d.configure(models=modelList, attrsOf="atoms",
					attrName=propList[0])
コード例 #11
0
ファイル: gui.py プロジェクト: davem22101/semanticscience
	def _selectModelCB(self, tableSel):
		if self.treatmentSelAtom.get():
			from chimera import selection
			selection.clearCurrent()
			selection.addCurrent(tableSel)
			selection.addImpliedCurrent()
		if self.treatmentSelModel.get():
			from ModelPanel import ModelPanel
			from chimera import dialogs
			d = dialogs.display(ModelPanel.name)
			d.selectionChange(tableSel)
		shown = {}
		if self.treatmentHideOthers.get():
			for m in self.molList:
				key = (m.id, m.subid)
				shown[key] = m in tableSel or not tableSel
		else:
			for m in tableSel:
				key = (m.id, m.subid)
				shown[key] = True
		for m in chimera.openModels.list():
			key = (m.id, m.subid)
			try:
				m.display = shown[key]
			except KeyError:
				pass
コード例 #12
0
 def _getParameters(self, mols, nogui, addhyd):
     timestamp("_getParameters")
     import DockPrep
     import chimera
     self.originalAtoms = set([])
     for m in mols:
         self.originalAtoms.update(m.atoms)
     from AddCharge import AMBER99SB
     kw = {
         "doneCB": self._finishDockPrep,
         "gaffType": True,
         "chargeModel": AMBER99SB
     }
     if nogui or chimera.nogui:
         if not addhyd:
             kw["addHFunc"] = None
         DockPrep.prep(mols, nogui=nogui, **kw)
     else:
         from DockPrep.gui import DockPrepDialog
         from chimera import dialogs
         d = dialogs.display(DockPrepDialog.name, wait=True)
         d.addHydVar.set(addhyd)
         d.applyKeywords = kw
         d.molListBox.setvalue(mols)
         d.writeMol2Var.set(False)
     """
コード例 #13
0
 def Apply(self):
     minimize = self.minimizeVar.get()
     steps = 60
     ef = self.stepsCounter.component("entryfield")
     if ef.valid():
         value = int(ef.getvalue())
         if value > 0:
             steps = value
     self.state.makeMovie(minimize=minimize, steps=steps)
     action = self.createActionMenu.getvalue()
     if action == ActionShowModelPanel:
         from ModelPanel import ModelPanel
         from chimera import dialogs
         dialogs.display(ModelPanel.name)
     elif action == ActionHideConformations:
         self.state.hideConformations()
コード例 #14
0
    def Apply(self):
        from chimera import UserError
        attrName = self.attrNameOption.get()
        from chimera.misc import stringToAttr
        fixedAttrName = stringToAttr(attrName, collapse=False)
        if fixedAttrName != attrName:
            self.enter()
            raise UserError("Attribute name must be composed only"
                            " of letters, digits, and underscores and must"
                            " not start with a digit.")
        refName = self.refMenu.getvalue()

        sels = self.alignList.getcurselection()
        if len(sels) == 0:
            self.enter()
            raise UserError('Select at least one evaluation '
                            'structure to assess')
        refMol = self.mols[refName]
        evalMols = []
        for sel in sels:
            evalMols.append(self.mols[sel])
        self.mav.assessMatch(refMol, evalMols, attrName)
        from chimera import dialogs
        from ShowAttr import ShowAttrDialog
        d = dialogs.display(ShowAttrDialog.name)
        d.configure(models=evalMols,
                    attrsOf="residues",
                    attrName=attrName,
                    mode="Select")
コード例 #15
0
ファイル: gui.py プロジェクト: davem22101/semanticscience
	def Apply(self):
		minimize = self.minimizeVar.get()
		steps = 60
		ef = self.stepsCounter.component("entryfield")
		if ef.valid():
			value = int(ef.getvalue())
			if value > 0:
				steps = value
		self.state.makeMovie(minimize=minimize, steps=steps)
		action = self.createActionMenu.getvalue()
		if action == ActionShowModelPanel:
			from ModelPanel import ModelPanel
			from chimera import dialogs
			dialogs.display(ModelPanel.name)
		elif action == ActionHideConformations:
			self.state.hideConformations()
コード例 #16
0
	def Apply(self):
		from chimera import UserError
		attrName = self.attrNameOption.get()
		from chimera.misc import stringToAttr
		fixedAttrName = stringToAttr(attrName, collapse=False)
		if fixedAttrName != attrName:
			self.enter()
			raise UserError("Attribute name must be composed only"
				" of letters, digits, and underscores and must"
				" not start with a digit.")
		refName = self.refMenu.getvalue()

		sels = self.alignList.getcurselection()
		if len(sels) == 0:
			self.enter()
			raise UserError('Select at least one evaluation '
						'structure to assess')
		refMol = self.mols[refName]
		evalMols = []
		for sel in sels:
			evalMols.append(self.mols[sel])
		self.mav.assessMatch(refMol, evalMols, attrName)
		from chimera import dialogs
		from ShowAttr import ShowAttrDialog
		d = dialogs.display(ShowAttrDialog.name)
		d.configure(models=evalMols, attrsOf="residues",
					attrName=attrName, mode="Select")
コード例 #17
0
ファイル: gui.py プロジェクト: davem22101/semanticscience
	def _colorKeyCB(self):
		for entry in self.values:
			entry.invoke()
		from Ilabel.gui import IlabelDialog
		from chimera import dialogs
		d = dialogs.display(IlabelDialog.name)
		d.keyConfigure(zip([w.rgba for w in self.wells],
					[e.getvalue() for e in self.values]))
コード例 #18
0
ファイル: marker.py プロジェクト: triciatricia/SIMPLE
def show_seg_marker_dialog():
    """Shows the Segment Marker dialog.

    show_seg_marker_dialog()
    """
    
    from chimera import dialogs
    return dialogs.display(Segment_Marker.name)
コード例 #19
0
ファイル: gui.py プロジェクト: davem22101/semanticscience
 def color_key_cb(self, *args):
   if self.n < 2:
     raise chimera.UserError("At least two colors needed to create key")
   from Ilabel.gui import IlabelDialog
   from chimera import dialogs
   d = dialogs.display(IlabelDialog.name)
   d.keyConfigure([(w.rgba, h.variable.get()) for w, h in zip(self.colorwells,
                     self.entry_fields)[:self.n]])
コード例 #20
0
ファイル: volmorph.py プロジェクト: triciatricia/SIMPLE
def show_vol_morph_dialog():
    """Shows the Volume Morph dialog.

    show_vol_morph_dialog()
    """
    
    from chimera import dialogs
    return dialogs.display(Volume_Morph.name)
コード例 #21
0
ファイル: __init__.py プロジェクト: triciatricia/SIMPLE
def show_simple_distance_dialog():
    """Shows the Measure Stick dialog.

    show_simple_distance_dialog()
    """
    
    from chimera import dialogs
    return dialogs.display(Measure_Stick.name)
コード例 #22
0
def displayDialog(wait=False):
    if dialogs.find(BugReportGUI.name):
	replyobj.status("Bug report already in progress!",
			color="red", blankAfter=15)
	return None
    else:
	br_gui = dialogs.display(BugReportGUI.name, wait)
	return br_gui
コード例 #23
0
	def activate(self, molecules=None):
		from chimera import dialogs
		d = dialogs.display(self.module('gui').MatchMaker.name)
		if molecules:
			d.refMolList.setvalue(molecules[0])
			d.matchMolList.setvalue(molecules[1:])
			d.showSeqVar.set(False)
		return None
コード例 #24
0
 def _colorKeyCB(self):
     for entry in self.values:
         entry.invoke()
     from Ilabel.gui import IlabelDialog
     from chimera import dialogs
     d = dialogs.display(IlabelDialog.name)
     d.keyConfigure(
         zip([w.rgba for w in self.wells],
             [e.getvalue() for e in self.values]))
コード例 #25
0
def displayDialog(wait=False):
    if dialogs.find(BugReportGUI.name):
        replyobj.status("Bug report already in progress!",
                        color="red",
                        blankAfter=15)
        return None
    else:
        br_gui = dialogs.display(BugReportGUI.name, wait)
        return br_gui
コード例 #26
0
def color_secondary_structure():
    'Color secondary structure using ColorSS extension'
    import ColorSS
    from chimera import dialogs
    d = dialogs.find(ColorSS.ColorSSDialog.name, create=False)
    if d == None:
        d = dialogs.display(ColorSS.ColorSSDialog.name)
        d.Close()
    d.Apply()
コード例 #27
0
 def color_key_cb(self, *args):
     if self.n < 2:
         raise chimera.UserError("At least two colors needed to create key")
     from Ilabel.gui import IlabelDialog
     from chimera import dialogs
     d = dialogs.display(IlabelDialog.name)
     d.keyConfigure([
         (w.rgba, h.variable.get())
         for w, h in zip(self.colorwells, self.entry_fields)[:self.n]
     ])
コード例 #28
0
def show_attribute_histogram(molecule, attribute_name):

    import ShowAttr
    from chimera import dialogs
    d = dialogs.display(ShowAttr.ShowAttrDialog.name)
    d.configure(models=[molecule],
                mode='Render',
                attrsOf=ShowAttr.ATTRS_ATOMS,
                attrName=attribute_name)
    d.renderNotebook.selectpage('Colors')
コード例 #29
0
def _prepDialog(nogui, mols, **kw):
    if nogui or chimera.nogui:
        prep(mols, **kw)
        return None
    from gui import DockPrepDialog
    from chimera import dialogs
    d = dialogs.display(DockPrepDialog.name, wait=True)
    d.applyKeywords = kw
    d.molListBox.setvalue(mols)
    return d
コード例 #30
0
ファイル: __init__.py プロジェクト: Khitem/semanticscience
def _prepDialog(nogui, mols, **kw):
	if nogui or chimera.nogui:
		prep(mols, **kw)
		return None
	from gui import DockPrepDialog
	from chimera import dialogs
	d = dialogs.display(DockPrepDialog.name, wait=True)
	d.applyKeywords = kw
	d.molListBox.setvalue(mols)
	return d
コード例 #31
0
def show_attribute_histogram(molecule, attribute_name):

    import ShowAttr
    from chimera import dialogs
    d = dialogs.display(ShowAttr.ShowAttrDialog.name)
    d.configure(models = [molecule],
                mode = 'Render',
                attrsOf = ShowAttr.ATTRS_ATOMS,
                attrName = attribute_name)
    d.renderNotebook.selectpage('Colors')
コード例 #32
0
def seqCmd(items):
    global _seqInspectors
    todo = []
    for item in items:
        if not _seqInspectors.has_key(item):
            from chimera.Sequence import StructureSequence
            if isinstance(item, StructureSequence):
                from MultAlignViewer.MAViewer import MAViewer
                copySeq = StructureSequence.__copy__(item)
                copySeq.name = item.fullName()
                _addSeqInspector(item, mavSeq=copySeq)
            else:
                todo.extend(item.sequences())
                continue
        _seqInspectors[item].enter()
    if todo:
        if len(todo) > 1:
            from seqPanel import SeqPickerDialog
            from chimera import dialogs
            d = dialogs.display(SeqPickerDialog.name)
            d.molListBox.setvalue(todo)
        else:
            seqCmd(todo)
コード例 #33
0
	def _getParameters(self, mols, nogui, addhyd):
		timestamp("_getParameters")
		import DockPrep
		import chimera
		self.originalAtoms = set([])
		for m in mols:
			self.originalAtoms.update(m.atoms)
		from AddCharge import AMBER99SB
		kw = { "doneCB": self._finishDockPrep, "gaffType": True,
			"chargeModel": AMBER99SB }
		if nogui or chimera.nogui:
			if not addhyd:
				kw["addHFunc"] = None
			DockPrep.prep(mols, nogui=nogui, **kw)
		else:
			from DockPrep.gui import DockPrepDialog
			from chimera import dialogs
			d = dialogs.display(DockPrepDialog.name, wait=True)
			d.addHydVar.set(addhyd)
			d.applyKeywords = kw
			d.molListBox.setvalue(mols)
			d.writeMol2Var.set(False)
		"""
コード例 #34
0
ファイル: base.py プロジェクト: davem22101/semanticscience
def seqCmd(items):
	global _seqInspectors
	todo = []
	for item in items:
		if not _seqInspectors.has_key(item):
			from chimera.Sequence import StructureSequence
			if isinstance(item, StructureSequence):
				from MultAlignViewer.MAViewer import MAViewer
				copySeq = StructureSequence.__copy__(item)
				copySeq.name = item.fullName()
				_addSeqInspector(item, mavSeq=copySeq)
			else:
				todo.extend(item.sequences())
				continue
		_seqInspectors[item].enter()
	if todo:
		if len(todo) > 1:
			from seqPanel import SeqPickerDialog
			from chimera import dialogs
			d = dialogs.display(SeqPickerDialog.name)
			d.molListBox.setvalue(todo)
		else:
			seqCmd(todo)
コード例 #35
0
ファイル: base.py プロジェクト: davem22101/semanticscience
		def showTileDialog(models):
			from chimera import dialogs
			from EnsembleMatch.choose import TileStructuresCB
			dialogs.display(TileStructuresCB.name).configure(
								models=models)
コード例 #36
0
def show_memory_use_dialog():

    from chimera import dialogs
    return dialogs.display(Memory_Use_Dialog.name)
コード例 #37
0
ファイル: maskmain.py プロジェクト: triciatricia/SIMPLE
def show_seg_mask_dialog():
    """show_seg_mask_dialog() - shows the Segment Mask dialog.
    """
    
    from chimera import dialogs
    return dialogs.display(Segment_Mask.name)
コード例 #38
0
def show_crystal_contacts_dialog():

  from chimera import dialogs
  return dialogs.display(Crystal_Contacts_Dialog.name)
コード例 #39
0
	def activate(self):
		from chimera.dialogs import display
		display(self.module('gui').WritePrmtopDialog.name)
		return None
コード例 #40
0
def show_fit_map_dialog():

    from chimera import dialogs
    return dialogs.display(Fit_Map_Dialog.name)
コード例 #41
0
ファイル: trackxform.py プロジェクト: triciatricia/SIMPLE
def show_track_xform_dialog():
    """show_track_xform_dialog() - shows the Track Transform dialog.
    """
    
    from chimera import dialogs
    return dialogs.display(TrackXformDialog.name)
コード例 #42
0
 def activate(self):
     from chimera import dialogs
     gui = self.module('gui')
     dlg = dialogs.display(gui.BuildStructureDialog.name)
     dlg.notebook.selectpage(gui.ADD_ATOMS)
     return None
コード例 #43
0
    def Results(self):

        from chimera import dialogs, tkgui
        dialogs.display(tkgui._ReplyDialog.name)
コード例 #44
0
def showDialog(models, mode):
	import ShowAttr
	from chimera import dialogs
	d = dialogs.display(ShowAttr.ShowAttrDialog.name)
	d.configure(models=models, mode=mode)
コード例 #45
0
	def activate(self):
		from chimera import dialogs
		dialogs.display(self.module().ShowAttrDialog.name).configure(
								mode="Render")
		return None
コード例 #46
0
def show_unit_cell_dialog():

  from chimera import dialogs
  return dialogs.display(Unit_Cell_Dialog.name)
コード例 #47
0
def raiseViewingTab(tab):
	from chimera import dialogs, viewing
	d = dialogs.display(viewing.ViewerDialog.name)
	d.nb.raise_page('p' + tab)
コード例 #48
0
	def activate(self):
		from chimera.dialogs import display
		display(self.module('gui').WriteMol2Dialog.name)
		return None
コード例 #49
0
def raiseStructMeasureTab(tab):
	from chimera import dialogs
	from StructMeasure.gui import StructMeasure
	d = dialogs.display(StructMeasure.name)
	d.notebook.selectpage(tab)
コード例 #50
0
ファイル: fetch.py プロジェクト: davem22101/semanticscience
	def showPreferences(self):
		from chimera import dialogs
		d = dialogs.display('preferences')
		d.menu.invoke(index = FETCH_PREFERENCES)
コード例 #51
0
	def activate(self):
		from chimera.dialogs import display
		display(self.module("gui").StructureDiagramDialog.name)
		return None
コード例 #52
0
def show_morph_map_dialog():

    from chimera import dialogs
    return dialogs.display(Morph_Map_Dialog.name)
コード例 #53
0
 def showPreferences(self):
     from chimera import dialogs
     d = dialogs.display('preferences')
     d.menu.invoke(index=FETCH_PREFERENCES)
コード例 #54
0
 def activate(self):
     from chimera import dialogs
     dialogs.display(
         self.module().ShowAttrDialog.name).configure(mode="Render")
     return None
コード例 #55
0
def show_benchmark_dialog():

    from chimera import dialogs
    return dialogs.display(Benchmark_Dialog.name)
コード例 #56
0
def showDialog(models, mode):
    import ShowAttr
    from chimera import dialogs
    d = dialogs.display(ShowAttr.ShowAttrDialog.name)
    d.configure(models=models, mode=mode)