示例#1
0
    def __init__(self,
                 cmdName,
                 func,
                 desc,
                 help,
                 ensoapi,
                 generatorManager,
                 takesArg=False,
                 argValue=None):
        CommandObject.__init__(self)

        self.name = cmdName

        # added to unify command name retrieval
        self.cmdName = cmdName

        self.func = func
        self.takesArg = takesArg
        self.argValue = argValue
        self.ensoapi = ensoapi
        self.generatorManager = generatorManager

        self.setName(cmdName)
        self.setHelp(help)
        self.setDescription(desc)
    def __init__(self,
                 cmdName,
                 func,
                 desc,
                 help,
                 ensoapi,
                 generatorManager,
                 takesArg=False,
                 argValue=None,
                 overrideKeycodes=None):
        CommandObject.__init__(self)

        self.name = cmdName
        self.func = func
        self.takesArg = takesArg
        self.argValue = argValue
        self.ensoapi = ensoapi
        self.generatorManager = generatorManager

        self.setName(cmdName)
        if hasattr(func, "help"):
            self.setHelp(func.help)
        else:
            self.setHelp(help)

        func.setDescription = self.setDescription
        func.setHelp = self.setHelp

        if hasattr(func, "description"):
            self.setDescription(func.description)
        else:
            if hasattr(func, "set_description") and callable(
                    func.set_description):
                new_desc = None
                try:
                    new_desc = func.set_description(argValue)
                except:
                    pass
                if new_desc:
                    self.setDescription(new_desc)
                else:
                    self.setDescription(desc)
            else:
                if "%s" in desc:
                    if argValue:
                        new_desc = desc % u"\u201c%s\u201d" % argValue
                    else:
                        arg_name = getargspec(func)[0][1]
                        new_desc = desc % "{%s}" % arg_name
                    self.setDescription(new_desc)
                else:
                    self.setDescription(desc)

        if overrideKeycodes:
            self.OVERRIDE_ALLOWED_KEYCODES = overrideKeycodes
示例#3
0
    def __init__(self, parameter=None):
        """
        Initializes the google command.
        """

        CommandObject.__init__(self)

        self.parameter = parameter

        if parameter != None:
            self.setDescription("Performs a Google web search for "
                                "\u201c%s\u201d." % parameter)
示例#4
0
文件: google.py 项目: tartakynov/enso
    def __init__( self, parameter = None ):
        """
        Initializes the google command.
        """

        CommandObject.__init__( self )

        self.parameter = parameter

        if parameter != None:
            self.setDescription( u"Performs a Google web search for "
                                 u"\u201c%s\u201d." % parameter )
示例#5
0
    def __init__( self, cmdName, func, desc, help, ensoapi, 
                  generatorManager, takesArg = False, argValue = None ):
        CommandObject.__init__( self )

        self.name = cmdName
        self.func = func
        self.takesArg = takesArg
        self.argValue = argValue
        self.ensoapi = ensoapi
        self.generatorManager = generatorManager

        self.setName( cmdName )
        self.setHelp( help )
        self.setDescription( desc )
示例#6
0
    def __init__(self, parameter=None):
        """
        Initializes the undo command.
        """

        print "UndoCommand.__init__()"
        CommandObject.__init__(self)

        self.parameter = parameter
        """
        if parameter != None:
            self.setDescription( u"Performs a Google web search for "
                                 u"\u201c%s\u201d." % parameter )
        """
        self.setDescription(" sfsdfsfsf")
        self.setHelp("asdsf ")
示例#7
0
文件: undo.py 项目: tartakynov/enso
    def __init__( self, parameter = None ):
        """
        Initializes the undo command.
        """
        
        print "UndoCommand.__init__()"
        CommandObject.__init__( self )

        self.parameter = parameter

        """
        if parameter != None:
            self.setDescription( u"Performs a Google web search for "
                                 u"\u201c%s\u201d." % parameter )
        """
        self.setDescription(" sfsdfsfsf")
        self.setHelp("asdsf ")
 def __init__(self, description, message, ensoapi):
     CommandObject.__init__(self)
     self.setDescription(description)
     self.ensoapi = ensoapi
     self.message = message
示例#9
0
 def __init__(self):
     CommandObject.__init__(self)
     self.setName(self.NAME)
     self.setDescription(self.DESCRIPTION)
示例#10
0
 def __init__( self, description, message, ensoapi ):
     CommandObject.__init__( self )
     self.setDescription( description )
     self.ensoapi = ensoapi
     self.message = message
示例#11
0
 def __init__(self, parameter=None):
     CommandObject.__init__(self)
     self.parameter = parameter
示例#12
0
 def __init__(self, parameter = None):
     CommandObject.__init__( self )
     self.parameter = parameter
示例#13
0
 def __init__( self ):
     CommandObject.__init__( self )
     self.setName( self.NAME )
     self.setDescription( self.DESCRIPTION )