本文整理汇总了Python中utilities.Log.greenmsg函数的典型用法代码示例。如果您正苦于以下问题:Python greenmsg函数的具体用法?Python greenmsg怎么用?Python greenmsg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了greenmsg函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: saveFavorite
def saveFavorite(self):
"""
Writes the current favorite (selected in the combobox) to a file, any
where in the disk that
can be given to another NE1 user (i.e. as an email attachment).
"""
cmd = greenmsg("Save Favorite File: ")
env.history.message(greenmsg("Save Favorite File:"))
current_favorite = self.favoritesComboBox.currentText()
favfilepath = getFavoritePathFromBasename(current_favorite)
formats = \
"Favorite (*.txt);;"\
"All Files (*.*)"
fn = QFileDialog.getSaveFileName(
self,
"Save Favorite As", # caption
favfilepath, #where to save
formats, # file format options
QString("Favorite (*.txt)") # selectedFilter
)
if not fn:
env.history.message(cmd + "Cancelled")
else:
saveFavoriteFile(str(fn), favfilepath)
return
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:30,代码来源:LightingScheme_PropertyManager.py
示例2: viewParallelTo
def viewParallelTo(self):
"""
Set view parallel to the vector defined by 2 selected atoms.
"""
cmd = greenmsg("Set View Parallel To: ")
atoms = self.assy.selatoms_list()
if len(atoms) != 2:
msg = redmsg("You must select 2 atoms.")
env.history.message(cmd + msg)
return
v = norm(atoms[0].posn()-atoms[1].posn())
if vlen(v) < 0.0001: # Atoms are on top of each other.
info = 'The selected atoms are on top of each other. No change in view.'
env.history.message(cmd + info)
return
# If vec is pointing into the screen, negate (reverse) vec.
if dot(v, self.glpane.lineOfSight) > 0:
v = -v
# Compute the destination quat (q2).
q2 = Q(V(0,0,1), v)
q2 = q2.conj()
self.glpane.rotateView(q2)
info = 'View set parallel to the vector defined by the 2 selected atoms.'
env.history.message(cmd + info)
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:32,代码来源:ops_view.py
示例3: __init__
def __init__(self, win):
"""
@param win: the main window object
"""
self.win = win
self.pw = None # pw = part window. Its subclasses will create their
# partwindow objects (and destroy them after Done)
###REVIEW: I think this (assignment or use of self.pw) does not
# belong in this class [bruce 070615 comment]
self.struct = None
self.previousParams = None
#bruce 060616 added the following kluge to make sure both cmdname and
# cmd are set properly.
if not self.cmdname and not self.cmd:
self.cmdname = "Generate something"
if self.cmd and not self.cmdname:
# deprecated but common, as of 060616
self.cmdname = self.cmd # fallback value; usually reassigned below
try:
cmdname = self.cmd.split('>')[1]
cmdname = cmdname.split('<')[0]
cmdname = cmdname.split(':')[0]
self.cmdname = cmdname
except:
if debug_flags.atom_debug:
print "fyi: %r guessed wrong about format of self.cmd == %r" \
% (self, self.cmd,)
pass
elif self.cmdname and not self.cmd:
# this is intended to be the usual situation, but isn't yet, as of
# 060616
self.cmd = greenmsg(self.cmdname + ": ")
self.change_random_seed()
return
开发者ID:elfion,项目名称:nanoengineer,代码行数:35,代码来源:GeneratorBaseClass.py
示例4: makeAnchor
def makeAnchor(self):
"""
Anchors the selected atoms so that they will not move
during a minimization or simulation run.
"""
cmd = greenmsg("Anchor: ")
atoms = self.assy.selatoms_list()
if not atoms:
msg = "You must select at least one atom to create an Anchor."
env.history.message(cmd + redmsg(msg))
return
# Print warning if over 200 atoms are selected.
if atom_limit_exceeded_and_confirmed(self.assy.w,
len(atoms),
limit=200):
return
m = Anchor(self.assy, atoms)
self.unpickall_in_GLPane()
self.place_new_jig(m)
env.history.message(cmd + "Anchor created")
self.assy.w.win_update()
开发者ID:alaindomissy,项目名称:nanoengineer,代码行数:26,代码来源:jigmakers_Mixin.py
示例5: makeGridPlane
def makeGridPlane(self):
cmd = greenmsg("Grid Plane: ")
atoms = self.assy.selatoms_list()
if not atoms:
msg = "You must select 3 or more atoms to create a Grid Plane."
env.history.message(cmd + redmsg(msg))
return
# Make sure only one atom is selected.
if len(atoms) < 3:
msg = "To create a Grid Plane, at least 3 atoms must be selected."
env.history.message(cmd + redmsg(msg))
return
from model.jigs_planes import GridPlane
m = GridPlane(self.assy, atoms)
m.edit()
if m.cancelled: # User hit 'Cancel' button in the jig dialog.
env.history.message(cmd + "Cancelled")
return
self.unpickall_in_GLPane()
self.place_new_jig(m)
#After placing the jig, remove the atom list from the jig.
m.atoms = []
env.history.message(cmd + "Grid Plane created")
self.assy.w.win_update()
return
开发者ID:alaindomissy,项目名称:nanoengineer,代码行数:32,代码来源:jigmakers_Mixin.py
示例6: unselectConnected
def unselectConnected(self, atomlist=None):
"""
Unselect any atom that can be reached from any currently
selected atom through a sequence of bonds.
If <atomlist> is supplied, use it instead of the currently selected atoms.
"""
cmd = greenmsg("Unselect Connected: ")
if atomlist is None and not self.selatoms:
msg = redmsg("No atoms selected")
env.history.message(cmd + msg)
return
if atomlist is None: # test for None since atomlist can be an empty list.
atomlist = self.selatoms.values()
catoms = self.getConnectedAtoms(atomlist)
if not len(catoms): return
natoms = 0
for atom in catoms[:]:
if atom.picked:
atom.unpick()
if not atom.picked:
# Just in case a selection filter was applied to this atom.
natoms += 1
from platform_dependent.PlatformDependent import fix_plurals
info = fix_plurals( "%d atom(s) unselected." % natoms)
env.history.message( cmd + info)
self.o.gl_update()
开发者ID:alaindomissy,项目名称:nanoengineer,代码行数:31,代码来源:ops_connected.py
示例7: dispShowInvisAtoms
def dispShowInvisAtoms(self):
"""
Resets the display setting for each invisible atom in the selected
chunks or atoms to Default display mode.
"""
cmd = greenmsg("Show Invisible Atoms: ")
if not self.assy.selmols and not self.assy.selatoms:
msg = "No atoms or chunks selected."
env.history.message(cmd + msg)
return
nia = 0 # nia = Number of Invisible Atoms
if self.assy.selmols:
nia = self.assy.showInvisibleAtoms()
if self.assy.selectionContainsInvisibleAtoms():
for a in self.assy.selatoms.itervalues(): #bruce 060707 itervalues
if a.display == diINVISIBLE:
a.setDisplay(diDEFAULT)
nia += 1
msg = cmd + str(nia) + " invisible atoms found."
env.history.message(msg)
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:26,代码来源:ops_display.py
示例8: selectDoubly
def selectDoubly(self):
"""
Select any atom that can be reached from any currently
selected atom through two or more non-overlapping sequences of
bonds. Also select atoms that are connected to this group by
one bond and have no other bonds.
"""
###@@@ same comment about interspace bonds as in selectConnected
cmd = greenmsg("Select Doubly: ")
if not self.selatoms:
msg = redmsg("No atoms selected")
env.history.message(cmd + msg)
return
alreadySelected = len(self.selatoms.values())
from operations.op_select_doubly import select_doubly # new code, bruce 050520
#e could also reload it now to speed devel!
select_doubly(self.selatoms.values()) #e optim
totalSelected = len(self.selatoms.values())
from platform_dependent.PlatformDependent import fix_plurals
info = fix_plurals("%d new atom(s) selected (besides the %d initially selected)." % \
(totalSelected - alreadySelected, alreadySelected) )
env.history.message( cmd + info)
if totalSelected > alreadySelected:
## otherwise, means nothing new selected. Am I right? ---Huaicai, not analyze the markdouble() algorithm yet
#self.w.win_update()
self.o.gl_update()
return
开发者ID:alaindomissy,项目名称:nanoengineer,代码行数:32,代码来源:ops_connected.py
示例9: makeESPImage
def makeESPImage(self):
cmd = greenmsg("ESP Image: ")
atoms = self.assy.selatoms_list()
if len(atoms) < 3:
msg = "You must select at least 3 atoms to create an ESP Image."
env.history.message(cmd + redmsg(msg))
return
from analysis.ESP.ESPImage import ESPImage
m = ESPImage(self.assy, atoms)
m.edit()
if m.cancelled: # User hit 'Cancel' button in the jig dialog.
env.history.message(cmd + "Cancelled")
return
self.unpickall_in_GLPane()
self.place_new_jig(m)
# After placing the jig, remove the atom list from the jig.
m.atoms = []
env.history.message(cmd + "ESP Image created.")
self.assy.w.win_update()
return
开发者ID:alaindomissy,项目名称:nanoengineer,代码行数:26,代码来源:jigmakers_Mixin.py
示例10: calculate_energy
def calculate_energy(self):
"""
Calculate energy.
"""
cmd = greenmsg("Calculate Energy: ")
errmsgs = ["GAMESS job aborted.",
"Error: GAMESS job failed."]
pset = self.pset
runtyp = pset.ui.runtyp # Save runtyp (Calculate) setting to restore it later.
pset.ui.runtyp = 0 # Energy calculation
origCalType = self.gmsjob.Calculation
self.gmsjob.Calculation = 'Energy'
self.update_gamess_parms()
# Run GAMESS job. Return value r:
# 0 = success
# 1 = job aborted
# 2 = job failed.
r = self.gmsjob.launch()
pset.ui.runtyp = runtyp # Restore to original value
self.gmsjob.Calculation = origCalType
if r: # Job was aborted or an error occurred.
msg = redmsg(errmsgs[r-1])
env.history.message( cmd + msg )
return
self.print_energy()
开发者ID:elfion,项目名称:nanoengineer,代码行数:33,代码来源:jig_Gamess.py
示例11: __CM_Align_to_chunk
def __CM_Align_to_chunk(self):
"""
Rotary or Linear Motor context menu command: "Align to chunk"
This uses the chunk connected to the first atom of the motor.
"""
# I needed this when attempting to simulate the rotation of a long, skinny
# chunk. The axis computed from the attached atoms was not close to the axis
# of the chunk. I figured this would be a common feature that was easy to add.
#
##e it might be nice to dim this menu item if the chunk's axis hasn't moved since this motor was made or recentered;
# first we'd need to extend the __CM_ API to make that possible. [mark 050717]
cmd = greenmsg("Align to Chunk: ")
chunk = self.atoms[0].molecule # Get the chunk attached to the motor's first atom.
# wware 060116 bug 1330
# The chunk's axis could have its direction exactly reversed and be equally valid.
# We should choose between those two options for which one has the positive dot
# product with the old axis, to avoid reversals of motor direction when going
# between "align to chunk" and "recenter on atoms".
#bruce 060116 modified this fix to avoid setting axis to V(0,0,0) if it's perpendicular to old axis.
newAxis = chunk.getaxis()
if dot(self.axis,newAxis) < 0:
newAxis = - newAxis
self.axis = newAxis
self.assy.changed() # wware 060116 bug 1331 - assembly changed when axis changed
info = "Aligned motor [%s] on chunk [%s]" % (self.name, chunk.name)
env.history.message( cmd + info )
self.assy.w.win_update()
return
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:32,代码来源:jigs_motors.py
示例12: makethermo
def makethermo(self):
"""
Attaches a thermometer to the single atom selected.
"""
cmd = greenmsg("Thermometer: ")
atoms = self.assy.selatoms_list()
if not atoms:
msg = "You must select an atom on the chunk you want to " \
"associate with a Thermometer."
env.history.message(cmd + redmsg(msg))
return
# Make sure only one atom is selected.
if len(atoms) != 1:
msg = "To create a Thermometer, only one atom may be selected."
env.history.message(cmd + redmsg(msg))
return
m = Thermo(self.assy, atoms)
self.unpickall_in_GLPane()
self.place_new_jig(m)
env.history.message(cmd + "Thermometer created")
self.assy.w.win_update()
开发者ID:alaindomissy,项目名称:nanoengineer,代码行数:26,代码来源:jigmakers_Mixin.py
示例13: merge
def merge(self):
"""
Merges selected atoms into a single chunk, or merges the selected
chunks into a single chunk.
@note: If the selected atoms belong to the same chunk, nothing happens.
"""
#mark 050411 changed name from weld to merge (Bug 515)
#bruce 050131 comment: might now be safe for clipboard items
# since all selection is now forced to be in the same one;
# this is mostly academic since there's no pleasing way to use it on them,
# though it's theoretically possible (since Groups can be cut and maybe copied).
cmd = greenmsg("Combine Chunks: ")
if self.selatoms:
self.makeChunkFromSelectedAtoms()
return
if len(self.selmols) < 2:
msg = redmsg("Need two or more selected chunks to merge")
env.history.message(cmd + msg)
return
self.changed() #bruce 050131 bugfix or precaution
mol = self.selmols[0]
for m in self.selmols[1:]:
mol.merge(m)
开发者ID:alaindomissy,项目名称:nanoengineer,代码行数:27,代码来源:ops_rechunk.py
示例14: modifyHydrogenate
def modifyHydrogenate(self):
"""
Add hydrogen atoms to bondpoints on selected chunks/atoms.
"""
cmd = greenmsg("Hydrogenate: ")
fixmols = {} # helps count modified mols for statusbar
if self.selmols:
counta = countm = 0
for m in self.selmols:
changed = m.Hydrogenate()
if changed:
counta += changed
countm += 1
fixmols[id(m)] = m
if counta:
didwhat = "Added %d atom(s) to %d chunk(s)" \
% (counta, countm)
if len(self.selmols) > countm:
didwhat += \
" (%d selected chunk(s) had no bondpoints)" \
% (len(self.selmols) - countm)
didwhat = fix_plurals(didwhat)
else:
didwhat = "Selected chunks contain no bondpoints"
elif self.selatoms:
count = 0
for a in self.selatoms.values():
ma = a.molecule
for atm in a.neighbors():
matm = atm.molecule
changed = atm.Hydrogenate()
if changed:
count += 1
fixmols[id(ma)] = ma
fixmols[id(matm)] = matm
if fixmols:
didwhat = \
"Added %d atom(s) to %d chunk(s)" \
% (count, len(fixmols))
didwhat = fix_plurals(didwhat)
# Technically, we *should* say ", affected" instead of "from"
# since the count includes mols of neighbors of
# atoms we removed, not always only mols of atoms we removed.
# Since that's rare, we word this assuming it didn't happen.
# [#e needs low-pri fix to be accurate in that rare case;
# might as well deliver that as a warning, since that case is
# also "dangerous" in some sense.]
else:
didwhat = "No bondpoints on selected atoms"
else:
didwhat = redmsg("Nothing selected")
if fixmols:
self.changed()
self.w.win_update()
env.history.message(cmd + didwhat)
return
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:59,代码来源:ops_atoms.py
示例15: viewRotate180
def viewRotate180(self):
"""
Set view to the opposite of current view.
"""
cmd = greenmsg("Opposite View: ")
info = 'Current view opposite to the previous view'
env.history.message(cmd + info)
self.glpane.rotateView(self.glpane.quat + Q(V(0,1,0), math.pi))
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:8,代码来源:ops_view.py
示例16: setViewZoomToSelection
def setViewZoomToSelection(self):
"""
Zoom to selection (Implemented for only selected jigs and chunks
"""
cmd = greenmsg("Zoom To Selection:")
info = ''
env.history.message(cmd + info)
self.glpane.setViewZoomToSelection()
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:8,代码来源:ops_view.py
示例17: setViewFitToWindow
def setViewFitToWindow(self):
"""
Fit to Window
"""
cmd = greenmsg("Fit to Window: ")
info = ''
env.history.message(cmd + info)
self.glpane.setViewFitToWindow()
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:8,代码来源:ops_view.py
示例18: movieInfo
def movieInfo(self):
"""
Prints information about the current movie to the history widget.
"""
if not self.w.assy.current_movie:
return
env.history.message(greenmsg("Movie Information"))
self.w.assy.current_movie._info()
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:8,代码来源:MoviePropertyManager.py
示例19: viewRotateMinus90
def viewRotateMinus90(self): # Added by Mark. 051013.
"""
Decrement the current view by 90 degrees around the vertical axis.
"""
cmd = greenmsg("Rotate View -90 : ")
info = 'View decremented by 90 degrees'
env.history.message(cmd + info)
self.glpane.rotateView(self.glpane.quat + Q(V(0,1,0), -math.pi/2))
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:8,代码来源:ops_view.py
示例20: setViewHomeToCurrent
def setViewHomeToCurrent(self):
"""
Changes Home view of the model to the current view in the glpane.
"""
cmd = greenmsg("Set Home View to Current View: ")
info = 'Home'
env.history.message(cmd + info)
self.glpane.setViewHomeToCurrent()
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:8,代码来源:ops_view.py
注:本文中的utilities.Log.greenmsg函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论