Пример #1
0
def redirect_to_onyx():
    configPath = get_path('onyx')
    installConfig = get_config('onyx')
    installConfig.set('Install', 'done', 'True')
    with open(configPath, 'w') as configfile:
        installConfig.write(configfile)
    flash(gettext('Onyx is installed !'), 'success')
    return redirect(url_for('install.reboot', url='install.finish', error_url='install.finish'))
Пример #2
0
 def change_lang(self):
     try:
         configPath = get_path('onyx')
         langConfig = get_config('onyx')
         langConfig.set('Base', 'lang', self.lang)
         with open(configPath, 'w') as configfile:
             langConfig.write(configfile)
         logger.info('Language update successfully')
         return json.encode({"status": "success"})
     except Exception as e:
         logger.error('Language update error : ' + str(e))
         raise OptionsException(str(e))
         return json.encode({"status": "error"})
Пример #3
0
def main():
    import tornado.options

    tornado.options.parse_command_line()
    config = get_config('onyx')

    host = config.get("Websocket", "host")
    port = int(config.get("Websocket", "port"))
    route = config.get("Websocket", "route")
    validate_param(host, "websocket.host")
    validate_param(port, "websocket.port")
    validate_param(route, "websocket.route")

    routes = [(route, WebsocketEventHandler)]
    application = web.Application(routes, **settings)
    application.listen(port, host)
    ioloop.IOLoop.instance().start()
Пример #4
0
def main():
    import tornado.options
    tornado.options.parse_command_line()
    config = get_config('onyx')

    host = config.get("Websocket", "host")
    port = int(config.get("Websocket", "port"))
    route = config.get("Websocket", "route")
    validate_param(host, "websocket.host")
    validate_param(port, "websocket.port")
    validate_param(route, "websocket.route")

    routes = [
        (route, WebsocketEventHandler)
    ]
    application = web.Application(routes, **settings)
    application.listen(port, host)
    ioloop.IOLoop.instance().start()
Пример #5
0
    def change_lang(self):
        try:
            configPath = get_path('onyx')
            langConfig = get_config('onyx')
            langConfig.set('Base', 'lang', self.lang)

            with open(configPath, 'w') as configfile:
                langConfig.write(configfile)

            query = ConfigModel.Config.query.filter_by(config='lang').first()

            query.value = self.lang

            db.session.add(query)
            db.session.commit()

            refresh()

            logger.info('Language update successfully')
            return json.encode({"status":"success"})
        except Exception as e:
            logger.error('Language update error : ' + str(e))
            raise OptionsException(str(e))
Пример #6
0
    def change_lang(self):
        try:
            configPath = get_path('onyx')
            langConfig = get_config('onyx')
            langConfig.set('Base', 'lang', self.lang)

            with open(configPath, 'w') as configfile:
                langConfig.write(configfile)

            query = ConfigModel.Config.query.filter_by(config='lang').first()

            query.value = self.lang

            db.session.add(query)
            db.session.commit()

            refresh()

            logger.info('Language update successfully')
            return json.encode({"status": "success"})
        except Exception as e:
            logger.error('Language update error : ' + str(e))
            raise OptionsException(str(e))
Пример #7
0
# -*- coding: utf-8 -*-
"""
Onyx Project
http://onyxproject.fr
Software under licence Creative Commons 3.0 France
http://creativecommons.org/licenses/by-nc-sa/3.0/fr/
You may not use this software for commercial purposes.
@author :: Cassim Khouani
"""
from abc import abstractmethod

import onyx, importlib
from onyx.config import get_config

config = get_config('onyx')

class TTS(object):

	def __init__(self, lang):
		self.lang = config.get('Base', 'lang')
		self.voice = None
		self.filename = '/tmp/tts.wav'

	def init(self, ws):
		self.ws = ws

	@abstractmethod
	def execute(self, sentence):
		pass

class TTSFactory(object):
Пример #8
0
from flask import g
from onyx.api.navbar import *
import importlib
import onyx, pip, os, git, shutil
import logging
from onyx.api.widgets import *
from onyx.api.scenario import *

scenario = Scenario()
widgets = Widgets()
navbar = Navbar()
logger = logging.getLogger()
json = Json()

from onyx.config import get_config
config = get_config('onyx')


class Plugin:
    def __init__(self):
        self.name = None
        self.url = None

    def get(self):
        try:
            plugins = [
                d for d in os.listdir(onyx.__path__[0] + "/plugins/")
                if os.path.isdir(
                    os.path.join(onyx.__path__[0] + "/plugins/", d))
            ]
            plug = []
Пример #9
0
 def __init__(self, name):
     super(MediaSkill, self).__init__(name)
     self.isPlaying = False
     config = get_config('onyx')
     self.base_conf = config
Пример #10
0
 def __init__(self, name):
     super(MediaSkill, self).__init__(name)
     self.isPlaying = False
     config = get_config('onyx')
     self.base_conf = config