当前位置: 首页>>代码示例>>Python>>正文


Python Log.redmsg函数代码示例

本文整理汇总了Python中utilities.Log.redmsg函数的典型用法代码示例。如果您正苦于以下问题:Python redmsg函数的具体用法?Python redmsg怎么用?Python redmsg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了redmsg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: print_energy

    def print_energy(self):

        r, final_energy_str = get_energy_from_gms_outfile(self.outputfile)

        if r == 1:  # GAMESS terminated abnormally.
            if final_energy_str:
                env.history.message(
                    redmsg(
                        final_energy_str
                        + " Check if you have set the right Gamess executable file. Usually it's called gamess.??.x or ??gamess.exe."
                    )
                )
                return

            msg = "Final energy value not found. The output file is located at: " + self.outputfile
            env.history.message(redmsg(msg))

        elif r == 2:  # The output file not exist
            msg = (
                "The output file %s doesn't exist. The reason is either that Gamess didn't run or the output file has been deleted. "
                % self.outputfile
            )
            env.history.message(redmsg(msg))

        else:  # Final energy was found.
            gmstr = self.gms_parms_info()
            msg = "GAMESS finished. The output file is located at: " + self.outputfile
            env.history.message(msg)
            msg = "Parameters: " + gmstr + ".  The final energy is: " + final_energy_str + " Hartree."
            env.history.message(msg)
开发者ID:rbisping,项目名称:nanoengineer,代码行数:30,代码来源:jig_Gamess.py

示例2: 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

示例3: 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

示例4: makegamess

    def makegamess(self):
        """
        Makes a GAMESS jig from the selected chunks or atoms.
        """
        # [mark 2007-05-07 modified docstring]

        if sys.platform == "win32":
            gms_str = "PC GAMESS"
        else:
            gms_str = "GAMESS"

        cmd = greenmsg(gms_str + ": ")

        atoms = []

        # Get a list of atoms from the selected chunks or atoms.
        atoms = self.assy.selected_atoms_list(
            include_atoms_in_selected_chunks = True)

        if not atoms:
            msg = "At least one atom must be selected to create a " + \
                  gms_str + " jig."
            env.history.message(cmd + redmsg(msg))
            return

        # Make sure that no more than 200 atoms are selected.
        nsa = len(atoms)
        if nsa > 200:
            msg = str(nsa) + " atoms selected.  The limit is 200."
            env.history.message(cmd + redmsg(msg))
            return

        # Bug 742.    Mark 050731.
        if nsa > 50:
            ret = QMessageBox.warning( self.assy.w, "Too many atoms?",
                gms_str + " jigs with more than 50 atoms may take an\n"
                "excessively long time to compute (days or weeks).\n"
                "Are you sure you want to continue?",
                "&Continue", "Cancel", "",
                0, 1 )

            if ret == 1: # Cancel
                return

        from analysis.GAMESS.jig_Gamess import Gamess
        m = Gamess(self.assy, atoms)
        m.edit()
            #bruce 050701 split edit method out of the constructor, so the
            # dialog doesn't show up when the jig is read from an mmp file
        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)

        env.history.message(cmd + gms_str + " jig created")
        self.assy.w.win_update()
开发者ID:alaindomissy,项目名称:nanoengineer,代码行数:57,代码来源:jigmakers_Mixin.py

示例5: Mirror

    def Mirror(self):
        """
        Mirror the selected chunk(s) about a selected grid plane.
        """
        cmd = greenmsg("Mirror: ")
        #ninad060814 this is necessary to fix a bug. Otherwise program will
        #crash if you try to mirror when the top node of the part
        #(main part of clipboard) is selected

        if self.topnode.picked:
            self.topnode.unpick_top()

        self.mirrorJigs = self.getQualifiedMirrorJigs()

        jigCounter = len(self.mirrorJigs)

        if jigCounter < 1:
            msg1 = "No mirror plane selected."
            msg2 = " Please select a Reference Plane or a Grid Plane first."
            msg = redmsg(msg1+msg2)
            instr1 = "(If it doesn't exist, create it using"
            instr2 = "<b>Insert > Reference Geometry menu </b> )"
            instruction = instr1 + instr2
            env.history.message(cmd + msg  + instruction)
            return
        elif jigCounter >1:
            msg = redmsg("More than one plane selected. Please select only one plane and try again")
            env.history.message(cmd + msg )
            return

        for j in self.mirrorJigs:
            j.unpick()

        copiedObject = self.o.assy.part.copy_sel_in_same_part()

        # ninad060812 Get the axis vector of the Grid Plane. Then you need to
        #rotate the inverted chunk by pi around this axis vector
        self.mirrorAxis = self.mirrorJigs[0].getaxis()

        if isinstance(copiedObject, Chunk):
            copiedObject.name = copiedObject.name + "-Mirror"
            self._mirrorChunk(copiedObject)
            return
        elif isinstance(copiedObject, Group):
            copiedObject.name = "Mirrored Items"
            def mirrorChild(obj):
                if isinstance(obj, Chunk):
                    self._mirrorChunk(obj)
                elif isinstance(obj, Jig):
                    self._mirrorJig(obj)

            copiedObject.apply2all(mirrorChild)
        return
开发者ID:alaindomissy,项目名称:nanoengineer,代码行数:53,代码来源:ops_motion.py

示例6: simPlot

def simPlot(assy): # moved here from MWsemantics method, bruce 050327
    """Opens the "Make Graphs" dialog (and waits until it's dismissed),
    for the current movie if there is one, otherwise for a previously saved
    dpb file with the same name as the current part, if one can be found.
    Returns the dialog, after it's dismissed (probably useless),
    or None if no dialog was shown.
    """
    #bruce 050326 inferred docstring from code, then revised to fit my recent changes
    # to assy.current_movie, but didn't yet try to look for alternate dpb file names
    # when the current part is not the main part. (I'm sure that we'll soon have a wholly
    # different scheme for letting the user look around for preexisting related files to use,
    # like movie files applicable to the current part.)
    #    I did reorder the code, and removed the check on the current part having atoms
    # (since plotting from an old file shouldn't require movie to be valid for current part).
    #    This method should be moved into some other file.

    if assy.current_movie and assy.current_movie.filename:
        return PlotTool(assy, assy.current_movie.filename)
    else:
        msg = redmsg("There is no current movie file loaded.")
        env.history.message(cmd + msg)
        return None
        
    # wware 060317, bug 1484
    if assy.filename:
        return PlotTool(assy, assy.filename)

    # no valid current movie, look for saved one with same name as assy
    msg = redmsg("No simulation has been run yet.")
    env.history.message(cmd + msg)
    if assy.filename:
        if assy.part is not assy.tree.part:
            msg = redmsg("Warning: Looking for saved movie for main part, not for displayed clipboard item.")
            env.history.message(cmd + msg)
        mfile = assy.filename[:-4] + ".dpb"
        movie = find_saved_movie( assy, mfile)
            # just checks existence, not validity for current part or main part
        if movie:
            #e should we set this as current_movie? I don't see a good reason to do that,
            # user can open it if they want to. But I'll do it if we don't have one yet.
            if not assy.current_movie:
                assy.current_movie = movie
            #e should we switch to the part for which this movie was made?
            # 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
            msg = "Using previously saved movie for this part."
            env.history.message(cmd + msg)
            return PlotTool(assy, movie)
        else:
            msg = redmsg("Can't find previously saved movie for this part.")
            env.history.message(cmd + msg)
    return
开发者ID:elfion,项目名称:nanoengineer,代码行数:53,代码来源:PlotTool.py

示例7: makeChunkFromSelectedAtoms

    def makeChunkFromSelectedAtoms(self):
        """
        Create a new chunk from the selected atoms.
        """

        # ninad 070411 moved the original method out of 'merge' method to
        # facilitate implementation of 'Create New Chunk
        # from selected atoms' feature

        cmd = greenmsg("Create New Chunk: ")
        if not self.selatoms:
            msg1 = "Create New Chunk: "
            msg2 = redmsg("Select some atoms first to create a new chunk")
            env.history.message(msg1 + msg2)
            return

        # ninad070411 : Following checks if the selected molecules
        # belong to more than one chunk. If they don't (i.e. if they are a part of
        # a sinle chunk, it returns from the method with proper histry msg

        molList = []
        for atm in self.selatoms.values():
            if not len(molList) > 1:
                mol = atm.molecule
                if mol not in molList:
                    molList.append(mol)

        if len(molList) < 2:
            msg1 = "Create New Chunk: "
            msg2 = redmsg(
                "Not created as the selected atoms are part of the \
            same chunk."
            )
            env.history.message(msg1 + msg2)
            return

        # bruce 060329 new feature: work on atoms too (put all selected atoms into a new chunk)
        self.ensure_toplevel_group()  # avoid bug for part containing just one chunk, all atoms selected
        numol = Chunk(self.assy, gensym("Chunk", self.assy))
        natoms = len(self.selatoms)
        for a in self.selatoms.values():
            # leave the moved atoms picked, so still visible
            a.hopmol(numol)
        self.addmol(numol)
        # e should we add it in the same groups (and just after the chunks) which these atoms used to belong to?
        # could use similar scheme to placing jigs...
        msg = fix_plurals(
            "made chunk from %d atom(s)" % natoms
        )  # len(numol.atoms) would count bondpoints, this doesn't
        msg = msg.replace("chunk", numol.name)
        env.history.message(cmd + msg)
        self.w.win_update()
开发者ID:octopus89,项目名称:NanoEngineer-1,代码行数:52,代码来源:ops_rechunk.py

示例8: placePlaneOffsetToAnother

    def placePlaneOffsetToAnother(self):
        """
        Orient the plane such that it is parallel to a selected plane , with an
        offset.
        """

        cmd = self.editCommand.cmd 

        jigList = self.win.assy.getSelectedJigs()
        if jigList:
            planeList = []
            for j in jigList:
                if isinstance(j, Plane) and (j is not self):
                    planeList.append(j)  

            #First, clear all the direction arrow drawings if any in 
            #the existing Plane objectes in the part 
            if not self.assy.part.topnode.members:
                msg = redmsg("Select a different plane first to place the"
                             " current plane offset to it")
                env.history.message(cmd + msg)
                return                            

            for p in self.assy.part.topnode.members:
                if isinstance(p, Plane):
                    if p.directionArrow:
                        p.directionArrow.setDrawRequested(False)

            if len(planeList) == 1:                
                self.offsetParentGeometry = planeList[0]
                self.offsetParentGeometry.directionArrow.setDrawRequested(True)

                if self.offsetParentGeometry.directionArrow.flipDirection:
                    offset =  2 * norm(self.offsetParentGeometry.getaxis())
                else:
                    offset = -2 * norm(self.offsetParentGeometry.getaxis())

                self.center = self.offsetParentGeometry.center + offset   
                self.quat   = Q(self.offsetParentGeometry.quat)
            else:
                msg = redmsg("Select exactly one plane to\
                             create a plane offset to it.")
                env.history.message(cmd + msg)
                return            
        else:            
            msg = redmsg("Select an existing plane first to\
                         create a plane offset to it.")
            env.history.message(cmd + msg)
            return    
        self.glpane.gl_update()            
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:50,代码来源:Plane.py

示例9: do_main_menu_op

 def do_main_menu_op(self, optype):
     """
     @note: optype should be Undo or Redo
     """
     op_was_available = not not self._current_main_menu_ops.get(optype)
     global _disable_UndoRedo
     if _disable_UndoRedo: #060414
         env.history.message(redmsg("%s is not permitted now (and this action was only offered due to a bug)" % optype))
         return
     global _AutoCheckpointing_enabled
     disabled = not _AutoCheckpointing_enabled #060312
     if disabled:
         _AutoCheckpointing_enabled = True # temporarily enable it, just during the Undo or Redo command
         self.checkpoint( cptype = "preUndo" ) # do a checkpoint with it enabled, so Undo or Redo can work normally.
         # Note: in theory this might change what commands are offered and maybe even cause the error message below to come out
         # (so we might want to revise it when disabled is true ##e), but I think that can only happen if there's a change_counter
         # bug, since the only way the enabled cp will see changes not seen by disabled one is if archive.update_before_checkpoint()
         # is first to set the change_counters (probably a bug); if this happens it might make Redo suddenly unavailable.
         ####e if optype is Redo, we could pass an option to above checkpoint to not destroy redo stack or make it inaccessible!
         # (such an option is nim)
     try:
         op = self._current_main_menu_ops.get(optype)
         if op:
             undo_xxx = op.menu_desc() # note: menu_desc includes history sernos
             env.history.message(u"%s" % undo_xxx) #e say Undoing rather than Undo in case more msgs?? ######@@@@@@ TEST u"%s"
             self.archive.do_op(op)
             self.assy.w.update_select_mode() #bruce 060227 try to fix bug 1576
             self.assy.w.win_update() #bruce 060227 not positive this isn't called elsewhere, or how we got away without it if not
         else:
             if not disabled:
                 print "no op to %r; not sure how this slot was called, since it should have been disabled" % optype
                 env.history.message(redmsg("Nothing to %s (and it's a bug that its menu item or tool button was enabled)" % optype))
             else:
                 print "no op to %r; autocp disabled (so ops to offer were recomputed just now; before that, op_was_available = %r); "\
                       "see code comments for more info" % ( optype, op_was_available)
                 if op_was_available:
                     env.history.message(redmsg("Nothing to %s (possibly due to a bug)" % optype))
                 else:
                     env.history.message(redmsg("Nothing to %s (and this action was only offered due to a bug)" % optype))
         pass
     except:
         print_compact_traceback()
         env.history.message(redmsg("Bug in %s; see traceback in console" % optype))
     if disabled:
         # better get the end-cp done now (since we might be relying on it for some reason -- I'm not sure)
         self.checkpoint( cptype = "postUndo" )
         _AutoCheckpointing_enabled = False # re-disable
     return
开发者ID:pmetzger,项目名称:nanoengineer,代码行数:48,代码来源:undo_manager.py

示例10: update_node

 def update_node(self, ok_pressed=False):
     'Update the POV-Ray Scene node.'
     self.set_params( self.node, self.gather_parameters())
     
     ini, pov, out = self.node.get_povfile_trio()
     
     # If the node was renamed, rename the POV-Ray Scene file name, too.
     # Don't do this if the "Preview" button was pressed since the user could later
     # hit "Cancel". In that case we'd loose the original .pov file, which would not be good. 
     # Mark 060702.
     if ok_pressed and self.originalName != self.node.name:
         if os.path.isfile(self.originalPov):
             if os.path.isfile(pov):
                 # Normally, I'd never allow the user to delete an existing POV-Ray Scene file without asking. 
                 # For A8 I'll allow it since I've run out of time.
                 # This will be fixed when Bruce implements the new File class in A9 (or later). Mark 060702.
                 os.remove(pov)
             os.rename(self.originalPov, pov)
             
     # Write the POV-Ray Scene (.pov) file if this is a new node or if the node's ".pov" file doesn't exist. 
     # Possible ways the ".pov" file could be missing from an existing node:
     #   1. the user renamed the node in the Model Tree, or 
     #   2. the POV-Ray Scene node was deleted, which deletes the file in self.kill(), and then Undo was pressed, or
     #   3. the ".pov" file was deleted by the user another way (via OS).
     # In the future, the POV-Ray Scene should save the view quat in the MMP (info) record. Then it
     # would always be possible to regenerate the POV-Ray Scene file from the MMP record, even if  
     # the node's .pov file didn't exist on disk anymore. Mark 060701.
     
     if self.node_is_new or not os.path.exists(pov):
         errorcode, filename_or_errortext = self.node.write_povrayscene_file()
         if errorcode:
             # The Pov-Ray Scene file could not be written, so remove the node.
             self.remove_node()
             env.history.message( self.cmdname + redmsg(filename_or_errortext) )
     return
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:35,代码来源:PovraySceneProp.py

示例11: model_changed

    def model_changed(self): 
        """
        @see: DnaSegment_EditCommand.model_changed()
        @see: DnaSegment_EditCommand.hasResizableStructure()
        @see: self._current_model_changed_params()
        """
        currentParams = self._current_model_changed_params()
        #Optimization. Return from the model_changed method if the 
        #params are the same. 
        if same_vals(currentParams, self._previous_model_changed_params):
            return 

        isStructResizable, why_not = currentParams
        #update the self._previous_model_changed_params with this new param set.
        self._previous_model_changed_params = currentParams

        if not isStructResizable:
            #disable all widgets
            if self._pmGroupBox1.isEnabled():
                self._pmGroupBox1.setEnabled(False)
                msg = redmsg("DnaSegment is not resizable. Reason: %s"%(why_not))
                self.updateMessage(msg)
        else:
            if not self._pmGroupBox1.isEnabled():
                self._pmGroupBox1.setEnabled(True)
                msg = "Use resize handles to resize the segment. Drag any axis or sugar"\
                    " atom for translation or rotation about axis respectively. Dragging"\
                    " any bond will freely move the whole segment."
                self.updateMessage(msg)
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:29,代码来源:DnaSegment_PropertyManager.py

示例12: command_for_insert_menu

    def command_for_insert_menu(self):
        """
        Run an Insert Whatever menu command to let the user generate things using this plugin.
        """
        if self.errorcode:
            env.history.message(redmsg("Plugin %r is permanently disabled due to this error, reported previously: %s" % \
                               (self.plugin_name, self.errortext)))
            return
        self.create_working_directory_if_needed()
        assert not self.errorcode
        if debug_run():
            print 'ought to insert a', self.what_we_generate
        self.make_dialog_if_needed()
        dialog = self.dialog
        ###e Not yet properly handled: retaining default values from last time it was used. (Should pass dict of them to the maker.)
        dialog.set_defaults({}) ### IMPLEM
        controller = GeneratorController(self.win, dialog, self)
            # Note: this needs both self and the dialog, to be inited.
            # So it takes care of telling the dialog to control it (and not some prior controller).
        dialog.show()
        # now it's able to take commands and run its callbacks; that does not happen inside this method, though, does it?
        # hmm, good question... if it's modal, this makes things easier (re preview and bug protection)...
        # and it means the undo wrapping was ok... but what do we do here to make it modal?
        # 1. find out by test if other generators are modal.
        # 2. find out from code, how.

        pass###e
开发者ID:alaindomissy,项目名称:nanoengineer,代码行数:27,代码来源:CoNTubGenerator.py

示例13: _makeDuplexChunk

 def _makeDuplexChunk(self, dnaGroup):
     """
     Returns a single DNA chunk given a dnaGroup containing multiple strand
     chunks.
     
     @param dnaGroup: The group object containing the DNA strand chunks.
     @type  dnaGroup: L{Group}
     
     @return: The DNA chunk.
     @rtype:  L{Chunk}
     """
     
     if not isinstance(dnaGroup.members[0], Chunk):
         env.history.message(redmsg(
             "Internal error in creating a single chunk DNA"))
         return
     
     for m in dnaGroup.members[1:]:
         if isinstance(m, Chunk):
             dnaGroup.members[0].merge(m)
             
     # Rename the merged chunk 
     dnaGroup.members[0].name = dnaGroup.name
     
     dnaChunk = dnaGroup.members[0]
     dnaChunk.setcolor(None)
     dnaGroup.ungroup()
     
     return dnaChunk
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:29,代码来源:DnaGenerator.py

示例14: loadImage

    def loadImage(self, file_name):
        """
        Loads an image to be displayed on the plane as a texture. Displays 
        a warning message if the image format is not supported or the file 
        cannot be open.

        This method should be extened to support basic image operations
        (resizing, flipping, cropping).

        @param file_name: The name of the image file.
        """

        # piotr 080528
        
        self.deleteImage()
        
        try:
            mipmaps, image = load_image_into_new_texture_name(file_name)
            self.imagePath = file_name # piotr 080624
            self.tex_image = image
            # this gl_update may not be enough to show the image immediately
            self.glpane.gl_update()
        except:
            msg = redmsg("Cannot load plane image " + file_name)
            env.history.message(msg)
            self.tex_image = None
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:26,代码来源:Plane.py

示例15: 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


注:本文中的utilities.Log.redmsg函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。