コード例 #1
0
ファイル: XSLTRTC.py プロジェクト: openrtc/OpenHRIVoice
    def __init__(self):
        parser = utils.MyParser(version=__version__,
                                usage="%prog [xsltfile]",
                                description=__doc__)
        utils.addmanageropts(parser)
        parser.add_option('-g',
                          '--gui',
                          dest='guimode',
                          action="store_true",
                          default=False,
                          help='show file open dialog in GUI')
        try:
            opts, args = parser.parse_args()
        except optparse.OptionError as e:
            print('OptionError:', e, file=sys.stderr)
            sys.exit(1)

        if opts.guimode == True:
            sel = utils.askopenfilenames(title="select XSLT files")
            if sel is not None:
                args.extend(sel)

        if len(args) == 0:
            parser.error("wrong number of arguments")
            sys.exit(1)

        self._files = args
        self._comp = {}
        self._manager = OpenRTM_aist.Manager.init(utils.genmanagerargs(opts))
        self._manager.setModuleInitProc(self.moduleInit)
        self._manager.activateManager()
コード例 #2
0
    def __init__(self):

        parser = utils.MyParser(version=__version__, description=__doc__)
        utils.addmanageropts(parser)

        try:
            opts, args = parser.parse_args()
        except optparse.OptionError as e:
            print('OptionError:', e, file=sys.stderr)
            sys.exit(1)

        if opts.configfile is None:
            try:
                cfgname = os.environ[
                    'OPENHRI_ROOT'] + "/etc/google_speech.conf".replace(
                        '/', os.path.sep)
                if os.path.exists(cfgname):
                    opts.configfile = cfgname
            except:
                pass

        self._comp = None
        self._manager = OpenRTM_aist.Manager.init(utils.genmanagerargs(opts))
        self._manager.setModuleInitProc(self.moduleInit)
        self._manager.activateManager()
コード例 #3
0
    def __init__(self):
        parser = utils.MyParser(version=__version__,
                                usage="%prog [srgsfile]",
                                description=__doc__)
        utils.addmanageropts(parser)
        parser.add_option('-g',
                          '--gui',
                          dest='guimode',
                          action="store_true",
                          default=False,
                          help='show file open dialog in GUI')

        parser.add_option('-D',
                          '--dictation',
                          dest='dictation_mode',
                          action="store_true",
                          default=False,
                          help='run with dictation mode')

        parser.add_option('-r',
                          '--rebuild-lexicon',
                          dest='rebuild_lexicon',
                          action="store_true",
                          default=False,
                          help='rebuild lexicon')
        try:
            opts, args = parser.parse_args()
        except optparse.OptionError as e:
            print('OptionError:', e, file=sys.stderr)
            sys.exit(1)

        if opts.guimode == True:
            sel = askopenfilenames(title="select W3C-SRGS grammar files")
            if sel is not None:
                args.extend(sel)

        if opts.dictation_mode == False and len(args) == 0:
            parser.error("wrong number of arguments")
            sys.exit(1)

        if opts.dictation_mode == True:
            args.extend(['dictation'])

        if opts.configfile is None:
            try:
                cfgname = os.environ[
                    'OPENHRI_ROOT'] + "/etc/julius.conf".replace(
                        '/', os.path.sep)
                if os.path.exists(cfgname):
                    opts.configfile = cfgname
            except:
                pass

        self._rebuid_lexicon = opts.rebuild_lexicon

        self._grammars = args
        self._comp = {}
        self._manager = OpenRTM_aist.Manager.init(utils.genmanagerargs(opts))
        self._manager.setModuleInitProc(self.moduleInit)
        self._manager.activateManager()
コード例 #4
0
 def __init__(self):
     parser = optparse.OptionParser(version=__version__,
                                    description=__doc__)
     utils.addmanageropts(parser)
     try:
         opts, args = parser.parse_args()
     except optparse.OptionError as e:
         print('OptionError:', e, file=sys.stderr)
         sys.exit(1)
     self._comp = None
     self._manager = OpenRTM_aist.Manager.init(utils.genmanagerargs(opts))
     self._manager.setModuleInitProc(self.moduleInit)
     self._manager.activateManager()
コード例 #5
0
    def __init__(self):
        encoding = locale.getpreferredencoding()
        sys.stdout = codecs.getwriter(encoding)(sys.stdout, errors="replace")
        sys.stderr = codecs.getwriter(encoding)(sys.stderr, errors="replace")

        parser = utils.MyParser(version=__version__, description=__doc__)
        utils.addmanageropts(parser)

        try:
            opts, args = parser.parse_args()
        except optparse.OptionError as e:
            print('OptionError:', e, file=sys.stderr)
            sys.exit(1)

        self._comp = None
        self._manager = OpenRTM_aist.Manager.init(utils.genmanagerargs(opts))
        self._manager.setModuleInitProc(self.moduleInit)
        self._manager.activateManager()
コード例 #6
0
ファイル: WebServerRTC.py プロジェクト: yosuke/OpenHRIWeb
        return RTC.RTC_OK

def WebServerRTCInit(manager):
    profile = OpenRTM_aist.Properties(defaults_str=WebServerRTC_spec)
    manager.registerFactory(profile, WebServerRTC, OpenRTM_aist.Delete)

def MyModuleInit(manager):
    WebServerRTCInit(manager)
    comp = manager.createComponent('WebServerRTC')

def main():
    encoding = locale.getpreferredencoding()
    sys.stdout = codecs.getwriter(encoding)(sys.stdout, errors = "replace")
    sys.stderr = codecs.getwriter(encoding)(sys.stderr, errors = "replace")
    
    parser = utils.MyParser(version=__version__, description=__doc__)
    utils.addmanageropts(parser)
    try:
        opts, args = parser.parse_args()
    except optparse.OptionError, e:
        print >>sys.stderr, 'OptionError:', e
        sys.exit(1)

    manager = OpenRTM_aist.Manager.init(utils.genmanagerargs(opts))
    manager.setModuleInitProc(MyModuleInit)
    manager.activateManager()
    manager.runManager()

if __name__=='__main__':
    main()