本文整理汇总了Python中utilities.Log.orangemsg函数的典型用法代码示例。如果您正苦于以下问题:Python orangemsg函数的具体用法?Python orangemsg怎么用?Python orangemsg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了orangemsg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: logMessage
def logMessage(self, type = 'DEFAULT'):
"""
Updates the PM message groupbox message with the one specified below.
"""
msg = ''
if type == 'ADD_SEGMENTS_ACTIVATED':
msg = """To add new PAM3 DNA segments to the list, click on the segment's
axis. Multiple segments can be added at once by doing a
rectangular lasso selection in the 3D workspace."""
elif type == 'REMOVE_SEGMENTS_ACTIVATED':
msg = """To remove segments from the list, click on the segment's
axis. Multiple segments can be removed at once by doing a
rectangular lasso selection in the 3D workspace."""
elif type == 'LEFT_DRAG_STARTED':
msg = """Transparent green spheres (if present) around the atoms indicate
potential crossover sites."""
elif type == 'LEFT_DRAG_FINISHED':
msg = self.propMgr.defaultLogMessage
elif type == 'WARNING_LIMIT_EXCEEDED':
msg = "Only a maximum of <b> %d </b> DNA segments can be searched for "\
"crossover sites. Segments not added to the list"%self.itemLimitForSegmentListWidget()
msg = orangemsg(msg)
elif type == 'WARNING_PAM5_SEGMENT_FOUND':
msg = """Warning: One or more of the PAM5 DNA segments have been
removed from the segment list.Make Crossovers command is only
availble for PAM3 model."""
msg = orangemsg(msg)
else:
msg = self.propMgr.defaultLogMessage
self.propMgr.updateMessage(msg)
示例2: deposit_from_MMKit
def deposit_from_MMKit(self, atom_or_pos):
"""
Deposit the clipboard item being previewed into the 3D workspace
Calls L{self.deposit_from_Clipboard_page}
@attention: This method needs renaming. L{depositMode} still uses it
so simply overriden here. B{NEEDS CLEANUP}.
@see: L{self.deposit_from_Clipboard_page}
"""
if self.o.modkeys is None: # no Shift or Ctrl modifier key.
self.o.assy.unpickall_in_GLPane()
deposited_stuff, status = \
self.command.deposit_from_Clipboard_page(atom_or_pos)
deposited_obj = 'Chunk'
self.o.selatom = None
if deposited_stuff:
self.w.win_update()
status = self.ensure_visible( deposited_stuff, status)
env.history.message(status)
else:
env.history.message(orangemsg(status))
return deposited_obj
示例3: __init__
def __init__(self, mapping, chunk):
# immediately memoize some settings which need to be constant
# during use, as a bug precaution. Also do whatever precomputes
# are convenient.
writemmp_mapping_memo.__init__(self, mapping)
self.chunk = chunk
self.ladder = chunk.ladder
if not dna_updater_is_enabled():
msg = "Warning: can't convert PAM model when dna updater is disabled; affects [N] chunk(s)"
env.history.deferred_summary_message( orangemsg( msg))
elif not self.ladder:
# (might happen if dna updater is turned off at runtime -- not sure;
# note, doing that might have worse effects, like self.ladder existing
# but being out of date, causing traceback errors. #### FIX those sometime (elsewhere).)
print "error: ladder not set during writemmp, can't convert pam model, in %r" % chunk
msg = "Error: [N] chunk(s) don't have ladders set"
env.history.deferred_summary_message( redmsg( msg))
else:
self.convert_pam_enabled = True
if self.convert_pam_enabled:
# Note: this only means conversion is possible -- we don't yet know
# if it's requested by options on this mapping and chunk.
# The ladder memo will decide that.
self._ladder_memo = mapping.get_memo_for(self.ladder)
self._save_as_pam = self._ladder_memo._f_save_as_what_PAM_model()
return
示例4: Backup
def Backup(self):
"""
Undo any bonds made between chunks.
"""
# This undoes only the last fused chunks. Will work on supporting
# multiple undos when we get a single undo working. Mark 050326
# Bust bonds between last pair/set of fused chunks.
if self.bondable_pairs_atoms:
for a1, a2 in self.bondable_pairs_atoms:
b = a1.get_neighbor_bond(a2)
if b: b.bust()
if self.merged_chunks:
nchunks_str = "%d" % (len(self.merged_chunks) + 1,)
msg = "Fuse Chunks: Bonds broken between %s chunks." % (nchunks_str)
env.history.message(msg)
msg = "Warning: Cannot separate the original chunks. You can " \
"do this yourself using <b>Modify > Separate</b>."
env.history.message(orangemsg(msg))
cnames = "Their names were: "
# Here are the original names...
for chunk in self.merged_chunks:
cnames += '[' + chunk.name + '] '
env.history.message(cnames)
self.o.gl_update()
else:
msg = "Fuse Chunks: No bonds have been made yet. Undo ignored."
env.history.message(redmsg(msg))
示例5: _postProcess
def _postProcess(self, baseList): # bruce 070414
"""
Set bond direction on the backbone bonds.
@param baseList: List of basepair chunks that make up the duplex.
@type baseList: list
@note: baseList must contain at least two base-pair chunks.
"""
# This implem depends on the specifics of how the end-representations
# are terminated. If that's changed, it might stop working or it might
# start giving wrong results. In the current representation,
# baseList[0] (a chunk) is the starting end of the duplex. It has two
# bonds whose directions we should set, which will determine the
# directions of their strands: Se3 -> Ss3, and Sh3 <- Ss3.
# Just find those bonds and set the strand directions.
assert len(baseList) >= 2
basepair1_atoms = baseList[0].atoms.values() # StartBasePair.MMP
basepair2_atoms = baseList[1].atoms.values() # MiddleBasePair or EndBasePair.MMP
Se3_list = filter( lambda atom: atom.element.symbol in ('Se3'), basepair1_atoms)
Sh3_list = filter( lambda atom: atom.element.symbol in ('Sh3'), basepair1_atoms)
# To set the direction of the Se3 -> Ss3 bond, we need the Ss3 atom
# from the second base-pair (i.e. baseList[1]) that is connected to
# the Se3 atom in the first base-pair.
# Ss3_list will have only one Ss3 atom if the duplex is only two
# base-pairs long. Otherwise, Ss3_list will have two Ss3 atoms.
Ss3_list = filter( lambda atom: atom.element.symbol in ('Ss3'), basepair2_atoms)
if len(Se3_list) == len(Sh3_list) == 1:
for atom in Se3_list:
assert len(atom.bonds) == 2
# This is fragile since it is dependent on the bond order in the
# PAM3 StartBasePair.MMP file. If the order gets changed in that
# file, this will fail.
# A more robust approach would be to check for the Se3 -> Ss3
# bond, which is the one we want here. Mark 2007-09-27.
#atom.bonds[1].set_bond_direction_from(atom, 1, propogate = True)
# This implements the more robust stategy mentioned
# above. I'd like Bruce to review it and confirm it is good.
# Mark 2007-09-27.
#atom.bonds[1].set_bond_direction_from(Ss3_list[0], -1, propogate = True)
try: # Try the first Ss3 atom in Ss3_list.
atom.bonds[1].set_bond_direction_from(Ss3_list[0], -1, propogate = True)
except: # That wasn't it, so it must be the second Ss3 atom.
atom.bonds[1].set_bond_direction_from(Ss3_list[1], -1, propogate = True)
for atom in Sh3_list:
assert len(atom.bonds) == 1
atom.bonds[0].set_bond_direction_from(atom, -1, propogate = True)
else:
#bruce 070604 mitigate bug in above code when number of bases == 1
# by not raising an exception when it fails.
msg = "Warning: strand not terminated, bond direction not set \
(too short)"
env.history.message( orangemsg( msg))
return
示例6: simMoviePlayer
def simMoviePlayer(assy):
"""
Plays a DPB movie file created by the simulator,
either the current movie if any, or a previously saved
dpb file with the same name as the current part, if one can be found.
"""
from simulation.movie import find_saved_movie, Movie #bruce 050329 precaution (in case of similar bug to bug 499)
win = assy.w
if not assy.molecules: # No model, so no movie could be valid for current part.
# bruce 050327 comment: even so, a movie file might be valid for some other Part...
# not yet considered here. [050427 addendum: note that user can't yet autoload a new Part
# just by opening a movie file, so there's no point in going into the mode -- it's only meant
# for playing a movie for the *current contents of the current part*, for now.]
env.history.message(redmsg("Movie Player: Need a model."))
win.simMoviePlayerAction.setChecked(0) # toggle on the Movie Player icon ninad 061113
return
if assy.current_movie and assy.current_movie.might_be_playable():
win.commandSequencer.userEnterCommand('MOVIE')
return
# no valid current movie, look for saved one with same name as assy
## env.history.message("Plot Tool: No simulation has been run yet.")
if assy.filename:
if assy.part is not assy.tree.part:
msg = "Movie Player: Warning: Looking for saved movie for main part, not for displayed clipboard item."
env.history.message(orangemsg(msg))
errorcode, partdir = assy.find_or_make_part_files_directory()
if not errorcode: # filename could be an MMP or PDB file.
dir, fil = os.path.split(assy.filename)
fil, ext = os.path.splitext(fil)
mfile = os.path.join(partdir, fil + '.dpb')
else:
mfile = os.path.splitext(assy.filename)[0] + ".dpb"
movie = find_saved_movie( assy, mfile)
# checks existence -- should also check validity for current part or main part, but doesn't yet ###e
# (neither did the pre-030527 code for this function, unless that's done in moviePlay, which it might be)
if movie:
# play this movie, and make it the current movie.
assy.current_movie = movie
#e should we switch to the part for which this movie was made? [might be done in moviePlay; if not:]
# No current way to tell how to do that, and this might be done even if it's not valid
# for any loaded Part. So let's not... tho we might presume (from filename choice we used)
# it was valid for Main Part. Maybe print warning for clip item, and for not valid? #e
env.history.message("Movie Player: %s previously saved movie for this part." % ("playing" or "loading"))
win.commandSequencer.userEnterCommand('MOVIE')
return
# else if no assy.filename or no movie found from that:
# bruce 050327 comment -- do what the old code did, except for the moviePlay
# which seems wrong and tracebacks now.
assy.current_movie = Movie(assy)
# temporary kluge until bugs in movieMode for no assy.current_movie are fixed
win.commandSequencer.userEnterCommand('MOVIE')
return
示例7: viewNormalTo
def viewNormalTo(self): #
"""
Set view to the normal vector of the plane defined by 3 or more
selected atoms or a jig's (Motor or RectGadget) axis.
"""
cmd = greenmsg("Set View Normal To: ")
chunks = self.assy.selmols
jigs = self.assy.getSelectedJigs()
atoms = self.assy.selatoms_list()
#following fixes bug 1748 ninad 061003.
if len(chunks) > 0 and len(atoms) == 0:
# Even though chunks have an axis, it is not necessarily the same
# axis attr stored in the chunk. Get the chunks atoms and let
# compute_heuristic_axis() recompute them.
for c in range(len(chunks)):
atoms += chunks[c].atoms.values()
elif len(jigs) == 1 and len(atoms) == 0:
# Warning: RectGadgets have no atoms. We handle this special case below.
atoms = jigs[0].atoms
elif len(atoms) < 3:
# There is a problem when allowing only 2 selected atoms.
# Changing requirement to 3 atoms fixes bug 1418. mark 060322
msg = redmsg("Please select some atoms, jigs, and/or chunks, covering at least 3 atoms")
print "ops_view.py len(atoms) = ", len(atoms)
env.history.message(cmd + msg)
return
# This check is needed for jigs that have no atoms. Currently, this
# is the case for RectGadgets (ESP Image and Grid Plane) only.
if len(atoms):
pos = A( map( lambda a: a.posn(), atoms ) )
nears = [ self.glpane.out, self.glpane.up ]
axis = compute_heuristic_axis( pos, 'normal', already_centered = False, nears = nears, dflt = None )
else: # We have a jig with no atoms.
axis = jigs[0].getaxis() # Get the jig's axis.
# If axis is pointing into the screen, negate (reverse) axis.
if dot(axis, self.glpane.lineOfSight) > 0:
axis = -axis
if not axis:
msg = orangemsg( "Warning: Normal axis could not be determined. No change in view." )
env.history.message(cmd + msg)
return
# Compute the destination quat (q2).
q2 = Q(V(0,0,1), axis)
q2 = q2.conj()
self.glpane.rotateView(q2)
info = 'View set to normal vector of the plane defined by the selected atoms.'
env.history.message(cmd + info)
示例8: _postProcess
def _postProcess(self, baseList): # bruce 070414
"""
Set bond direction on the backbone bonds.
@param baseList: List of basepair chunks that make up the duplex.
@type baseList: list
"""
# This implem depends on the specifics of how the end-representations
# are terminated. If that's changed, it might stop working or it might
# start giving wrong results. In the current representation,
# baseList[0] (a chunk) has two bonds whose directions we must set,
# which will determine the directions of their strands:
# Ss5 -> Sh5, and Ss5 <- Pe5.
# Just find those bonds and set the strand directions (until such time
# as they can be present to start with in the end1 mmp file).
# (If we were instead passed all the atoms, we could be correct if we
# just did this to the first Pe5 and Sh5 we saw, or to both of each if
# setting the same direction twice is allowed.)
atoms = baseList[0].atoms.values()
Pe_list = filter( lambda atom: atom.element.symbol in ('Pe5'), atoms)
Sh_list = filter( lambda atom: atom.element.symbol in ('Sh5'), atoms)
if len(Pe_list) == len(Sh_list) == 1:
for atom in Pe_list:
assert len(atom.bonds) == 1
atom.bonds[0].set_bond_direction_from(atom, 1, propogate = True)
for atom in Sh_list:
assert len(atom.bonds) == 1
atom.bonds[0].set_bond_direction_from(atom, -1, propogate = True)
else:
#bruce 070604 mitigate bug in above code when number of bases == 1
# by not raising an exception when it fails.
msg = "Warning: strand not terminated, bond direction not set \
(too short)"
env.history.message( orangemsg( msg))
# Note: It turns out this bug is caused by a bug in the rest of the
# generator (which I didn't try to diagnose) -- for number of
# bases == 1 it doesn't terminate the strands, so the above code
# can't find the termination atoms (which is how it figures out
# what to do without depending on intimate knowledge of the base
# mmp file contents).
# print "baseList = %r, its len = %r, atoms in [0] = %r" % \
# (baseList, len(baseList), atoms)
## baseList = [<molecule 'unknown' (11 atoms) at 0xb3d6f58>],
## its len = 1, atoms in [0] = [Ax1, X2, X3, Ss4, Pl5, X6, X7, Ss8, Pl9, X10, X11]
# It would be a mistake to fix this here (by giving it that
# intimate knowledge) -- instead we need to find and fix the bug
# in the rest of generator when number of bases == 1.
return
示例9: viewQuteMol
def viewQuteMol(self):
"""
Slot for 'View > QuteMolX'. Opens the QuteMolX Property Manager.
@note: The QuteMolX PM will not open if there are no atoms in the part.
"""
cmd = greenmsg("QuteMolX : ")
if self.assy.molecules:
self.qutemolPM.show()
else:
msg = orangemsg("No atoms in the current part.")
env.history.message(cmd + msg)
示例10: _modifyStructure
def _modifyStructure(self, params):
"""
Modifies the structure (Rotary Motor) using the provided params.
@param params: The parameters used as an input to modify the structure
(Rotary Motor created using this
RotaryMotor_EditCommand)
@type params: tuple
"""
assert self.struct
assert params
assert len(params) == 7
torque, initial_speed, final_speed, \
dampers_state, enable_minimize_state, \
color, atoms = params
numberOfAtoms = len(atoms)
atomNumberRequirementMet, logMessage = \
self._checkMotorAtomLimits(numberOfAtoms)
if not atomNumberRequirementMet:
atoms = self.struct.atoms[:]
logMessage = logMessage + " Motor will remain attached to the"\
" atoms listed in the 'Motor Atoms' list in this" \
" property manager"
logMessage = orangemsg(logMessage)
self.propMgr.updateMessage(logMessage)
assert len(atoms) > 0
self.struct.cancelled = False
self.struct.torque = torque
self.struct.initial_speed = initial_speed
self.struct.speed = final_speed
self.struct.dampers_enabled = dampers_state
self.struct.enable_minimize = enable_minimize_state
self.struct.color = color
#Not sure if it is safe to do self.struct.atoms = atoms
#Instead using 'setShaft method -- ninad 2007-10-09
self.struct.setShaft(atoms)
self.struct.findCenterAndAxis(atoms, self.win.glpane)
self.propMgr.updateAttachedAtomListWidget(atomList = atoms)
self.win.win_update() # Update model tree
self.win.assy.changed()
示例11: _clear_illegal_direction
def _clear_illegal_direction(bond):
"""
[private helper for _fix_atom_or_return_error_info]
bond has a direction but is not directional
(since one of its atoms does not permit directional bonds,
e.g. it might be an Ss-Ax bond).
Report and immediately fix this error.
@type bond: Bond
"""
bond.clear_bond_direction()
summary_format = "Warning: dna updater cleared [N] bond direction(s) on pseudoelements that don't permit one"
env.history.deferred_summary_message( orangemsg(summary_format) )
return
示例12: strandLengthChanged
def strandLengthChanged( self, inStrandLength ):
"""
Slot for the Strand Length spin box, called whenever the value of the
Strand Length spin box changes.
@param inStrandLength: The number of bases in the strand sequence.
@type inStrandLength: int
"""
theSequence = self.getPlainSequence()
sequenceLen = len( theSequence )
lengthChange = inStrandLength - self.getSequenceLength()
# Preserve the cursor's position/selection
cursor = self.sequenceTextEdit.textCursor()
#cursorPosition = cursor.position()
selectionStart = cursor.selectionStart()
selectionEnd = cursor.selectionEnd()
if inStrandLength < 0:
return # Should never happen.
if lengthChange < 0:
# If length is less than the previous length,
# simply truncate the current sequence.
theSequence.chop( -lengthChange )
elif lengthChange > 0:
# If length has increased, add the correct number of base
# letters to the current strand sequence.
numNewBases = lengthChange
# Get current base selected in combobox.
chosenBase = 'X' # Unassigned.
basesToAdd = chosenBase * numNewBases
theSequence.append( basesToAdd )
else:
env.history.message(
orangemsg( "strandLengthChanged(): Length has not changed." ))
self.setSequence( theSequence )
return
示例13: adjustSinglet
def adjustSinglet(singlet, minimize=False): # Mark 2007-10-21.
"""
Adjusts I{singlet} using one of two methods based on I{minimize}:
1. Hydrogenate the singlet, then transmute it back to a singlet
(default). Singlet positions are much better after this, but
they are not in their optimal location.
2. Hydrogenate the singlet, then call the simulator via the
L{LocalMinimize_Function} to adjust (minimize) the hydrogen atom, then
tranmute the hydrogen back to a singlet. Singlet positions are best
after using this method, but it has one major drawback -- it
redraws while minimizing. This is a minor problem when breaking
strands, but is intolerable in the DNA duplex generator (which adjusts
open bond singlets in its postProcess method.
@param singlet: A singlet.
@type singlet: L{Atom}
@param minimize: If True, use the minimizer to adjust the singlet
(i.e. method #2).
@type minimize: bool
@note: Real atoms are not adjusted.
@see: L{Hydrogenate} for details about how we are using it to
reposition singlets (via method 1 mentioned above).
"""
if not singlet.is_singlet():
return
singlet.Hydrogenate()
if minimize:
msg = "ATTENTION: Using minimizer to adjust open bond singlets."
env.history.message(orangemsg(msg))
# Singlet is repositioned properly using minimize.
# The problem is that this redraws while running. Don't want that!
# Talk to Bruce and Eric M. about it. Mark 2007-10-21.
LocalMinimize_function([singlet], nlayers=0)
# Transmute() will not transmute singlets. Since <singlet> is a Hydrogen,
# and not a singlet, this will work. -mark 2007-10-31 (Boo!)
from model.elements import Singlet
singlet.Transmute(Singlet)
return
示例14: recompute_center_axis
def recompute_center_axis(self, glpane): #bruce 060120 replaced los arg with glpane re bug 1344
# try to point in direction of prior axis, or along line of sight if no old axis (self.axis is V(0,0,0) then)
nears = [self.axis, glpane.lineOfSight, glpane.down]
pos = A( map( lambda a: a.posn(), self.atoms ) )
self.center = sum(pos)/len(pos)
relpos = pos - self.center
from geometry.geometryUtilities import compute_heuristic_axis
axis = compute_heuristic_axis( relpos, 'normal', already_centered = True, nears = nears, dflt = None )
if not axis:
#e warning? I think so... BTW we pass dflt = None to make the warning come out more often;
# I don't know if we'd need to check for it here if we didn't.
env.history.message( orangemsg( "Warning: motor axis chosen arbitrarily since atom arrangement doesn't suggest one." ))
#k can this come out too often during movie-playing? No, because we don't recompute axis then at all.
axis = glpane.lineOfSight
self.axis = axis
self.assy.changed() #bruce 060116 fix unreported bug analogous to bug 1331
self._initial_posns = None #bruce 050518; needed in RotaryMotor, harmless in others
return
示例15: _modifyStructure
def _modifyStructure(self, params):
"""
Modifies the structure (Plane) using the provided params.
@param params: The parameters used as an input to modify the structure
(Plane created using this Plane_EditCommand)
@type params: tuple
"""
assert self.struct
assert params
assert len(params) == 5
force, stiffness, enable_minimize_state, color, atoms = params
numberOfAtoms = len(atoms)
atomNumberRequirementMet, logMessage = self._checkMotorAtomLimits(numberOfAtoms)
if not atomNumberRequirementMet:
atoms = self.struct.atoms[:]
logMessage = (
logMessage + " Motor will remain attached to the"
" atoms listed in the <b>Attached Atoms</b> list in"
" this property manager"
)
logMessage = orangemsg(logMessage)
self.propMgr.updateMessage(logMessage)
assert len(atoms) > 0
self.struct.cancelled = False
self.struct.force = force
self.struct.stiffness = stiffness
self.struct.enable_minimize = enable_minimize_state
self.struct.color = color
# Not sure if it is safe to do self.struct.atoms = atoms
# Instead using 'setShaft method -- ninad 2007-10-09
self.struct.setShaft(atoms)
self.struct.findCenterAndAxis(atoms, self.win.glpane)
self.propMgr.updateAttachedAtomListWidget(atomList=atoms)
self.win.win_update() # Update model tree
self.win.assy.changed()