def setValueAt(self, value, row_index, column_index):
     property = self.getColumnName(column_index).lower()
     if self._column_model.is_array(column_index):
         value = InfrastructureHelpers.split(value)
     Application.get_instance().execute(
         self._create_set_object_property_application_command(
             self._objects[row_index].get_id(), property, value))
 def itemStateChanged(self, event):
     for button in self._buttons:
         if button.isSelected():
             Application.get_instance().execute(
                 SetDomainDictValueCommand(
                     SetDomainDictValueCommand.TYPE_PRE_ANALYZE_VALIDATOR,
                     'capturing', button.getLabel()))
             break
示例#3
0
 def _execute_select_objects_command(self):
     Application.get_instance().execute(
         SetDomainDictValueCommand(
             self._get_domain_dict_type(), 'object_ids',
             self._model.map_object_indexes_to_ids([
                 self.convertRowIndexToModel(i)
                 for i in self.getSelectedRows()
             ])))
 def itemStateChanged(self, event):
     for button in self._buttons:
         if button.isSelected():
             Application.get_instance().execute(
                 SetDomainDictValueCommand(
                     SetDomainDictValueCommand.TYPE_VISIBLE_ITEMS,
                     'tags_operator', button.getLabel()))
             break
示例#5
0
 def itemStateChanged(self, event):
     statuses = []
     for check_box in self._check_boxes:
         if check_box.isSelected():
             statuses.append(check_box.getLabel())
     Application.get_instance().execute(
         SetDomainDictValueCommand(
             SetDomainDictValueCommand.TYPE_VISIBLE_ITEMS, 'statuses',
             statuses))
示例#6
0
 def _prepare_application(self):
     database = Database(Logger())
     Application.set_instance(Application(
         BurpServices(),
         database,
         ItemRepository(database),
         PathPatternRepository(database),
         UIServices(),
         ValueRepository()
     ))
示例#7
0
 def itemStateChanged(self, event):
     scope_tools = []
     for check_box in self._check_boxes:
         if check_box.isSelected():
             scope_tools.append(check_box.getLabel())
     Application.get_instance().execute(SetDomainDictValueCommand(
         SetDomainDictValueCommand.TYPE_PRE_ANALYZE_VALIDATOR,
         'scope_tools',
         scope_tools
     ))
示例#8
0
 def _execute_select_main_object_command(self):
     main_object_id = None
     main_object_index = self.getSelectedRow()
     if main_object_index != -1:
         main_object_id = self._model.map_object_indexes_to_ids(
             [self.convertRowIndexToModel(main_object_index)])[0]
     if main_object_id != self._prev_main_selected_object_id:
         Application.get_instance().execute(
             SetDomainDictValueCommand(self._get_domain_dict_type(),
                                       'main_object_id', main_object_id))
         self._prev_main_selected_object_id = main_object_id
示例#9
0
    def application():
        complete = {}
        if request.method == 'POST':
            result = request.form

            for key, value in result.items():
                if key != 'csrf_token':
                    if key != 'submit':
                        complete[key] = value
            now = unicode(datetime.datetime.now())
            complete['timestamp'] = now

            #print application

            app_obj = Application(complete['full_name'])
            process_form_results(complete, app_obj)
            app_obj.id = complete['full_name']
            app_obj.grade = complete['grade']
            app_obj.multiply(app_obj.qualifier)
            app_obj.expo_bloom(app_obj.qualifier, app_obj.raw_score)
            #print application

            application = json.dumps(app_obj.__dict__)
            with open("data/output.json", "a") as record:
                record.write('\n\n' + application)

            return render_template('ack.html', result=complete, object=app_obj)
        else:
            form = ApplicationForm()
            return render_template('application_form.html',
                                   title="Application",
                                   form=form,
                                   wtf=wtf)
示例#10
0
def load_config(path_str, language_model):
    with open(path_str) as data_file:
        data = json.load(data_file)

    app_dict = {}
    for app in data[APPLICATIONS_TAG]:
        turn_on = bool(app[APPLICATION_TURN_ON])
        if not turn_on:
            continue
        app_name = app[APPLICATION_NAME_TAG]
        description = app[APPLICATION_DESCRIPTION_TAG]
        type = app[APPLICATION_TYPE_TAG]
        URL = app.get(APPLICATION_ENDPOINT_URL_TAG, None)
        intents = []
        for intent in app[APPLICATION_INTENTS_TAG]:
            intent_name = intent[INTENT_NAME_TAG]
            samples_list = intent.get(INTENT_SAMPLES_TAG, None)
            if samples_list is not None:
                samples_list = [get_lemmas(el, language_model) for el in samples_list]

            key_phrases_list = intent.get(INTENT_KEY_PHRASES_TAG, EMPTY_LIST)
            key_phrases_list = [x.lower() for x in key_phrases_list]
            parameters_list = []
            param_description_list = intent.get(INTENT_PARAMETERS_TAG, EMPTY_LIST)
            for parameter in param_description_list:
                param_name = parameter[PARAMETER_NAME_TAG]
                param_data_type = parameter[PARAMETER_TYPE_TAG]
                param_data_type = DataType[param_data_type.upper()]
                param_obligatory = parameter[PARAMETER_OBLIGATORY_TAG]
                param_regexp = parameter.get(PARAMETER_REGEXP_TAG, None)
                param_regexp_group = parameter.get(PARAMETER_REGEXP_GROUP_TAG, None)
                param_question = parameter.get(PARAMETER_QUESTION_TAG, None)
                param_inst = Parameter(param_name, param_data_type, obligatory_bool=param_obligatory,
                                       question_str=param_question, regexp=param_regexp,
                                       regexp_group=param_regexp_group)
                parameters_list.append(param_inst)

            intent_desc = intent.get(INTENT_DESCRIPTION_TAG, None)
            intent_ints = Intent(intent_name, key_phrases_list, parameters_list, samples=samples_list, description=intent_desc)
            intents.append(intent_ints)

        app_inst = Application(app_name, description, intents, integration_type=IntegrationType[type], url=URL)

        clazz = app.get(APPLICATION_IMPLEMENTATION, None)
        if clazz is not None:
            app_inst.set_impl(clazz)

        app_dict[app_name.lower()] = app_inst

    return app_dict
示例#11
0
def execute_from_terminal(args):

    if len(args) == 1:
        print(
            "No parameters here! \nFor start this app use script\n\tpython startapp.py runserver"
        )
        return -1
    else:
        command = args[1]
        if command == "runserver":
            port = 5555
            application = Application(port=port)
            cors = CORS(application.server)
            application.server.run(debug=True, port=port)

        elif command == "createsuperuser":
            create_superuser()
        elif command == "createtables":
            create_tables()
        elif command == "droptables":
            drop_all_tables()
        else:
            print(
                "Unsupported command! Use next commands:\n\t1. runserver\n\t2. createsuperuser\n\t3. createtables\n\t4. droptables"
            )
示例#12
0
 def actionPerformed(self, event):
     database_path = UIHelpers.choose_file()
     if database_path:
         if Application.get_instance().execute(
                 SetDomainDictValueCommand(
                     SetDomainDictValueCommand.TYPE_PERSISTENCE,
                     'database_path', database_path)):
             self._text_field.setText(database_path)
示例#13
0
def app(request):
    # Before
    driver = webdriver.Chrome("/usr/local/bin/chromedriver")
    fixture = Application(driver)

    # request.addfinalizer(fixture.driver.close)

    # After
    def fin():
        # driver.quit()
        pass

    request.addfinalizer(fin)

    return fixture
示例#14
0
def main():
    options.parse_command_line()

    config_file = options.config_file
    try:
        config = json.load(open(config_file))
        db_conf = config['db']
        rows_per_page = config.get('rows_per_page', 20),
    except BaseException as exc:
        logging.error("[x] Failed to load configuration. %s", str(exc))
        return 1

    logging.info('Starting main server')
    http_server = tornado.httpserver.HTTPServer(
        Application(db_conf, rows_per_page[0]))
    http_server.listen(options.application_port)

    tornado.ioloop.IOLoop.current().start()
示例#15
0
            EXIT_STATUS = -1


def stop():
    ioloop = tornado.ioloop.IOLoop.instance()
    ioloop.add_callback(ioloop.stop)

if __name__ == "__main__":
    import tornado

    from application.application import Application
    from application.controller.plugins_controller import PluginsController
    from webservice.webservice import WebService


    application = Application(path_data="wstest/data/", address='localhost', test=True)
    application.register(WebService(application, 3000))

    application.start()
    controller = application.controller(PluginsController)

    for plugin_uri in controller.lv2_builder.plugins:
        print(plugin_uri)

    from _thread import start_new_thread
    start_new_thread(test_thread, ())
    tornado.ioloop.IOLoop.current().start()

    application.stop()

    sys.exit(EXIT_STATUS)
示例#16
0

def stop():
    ioloop = tornado.ioloop.IOLoop.instance()
    ioloop.add_callback(ioloop.stop)


if __name__ == "__main__":
    import tornado

    from application.application import Application
    from application.controller.plugins_controller import PluginsController
    from webservice.webservice import WebService

    application = Application(path_data="wstest/data/",
                              address='localhost',
                              test=True)
    application.register(WebService(application, 3000))

    application.start()
    controller = application.controller(PluginsController)

    for plugin_uri in controller.lv2_builder.plugins:
        print(plugin_uri)

    from _thread import start_new_thread
    start_new_thread(test_thread, ())
    tornado.ioloop.IOLoop.current().start()

    application.stop()
示例#17
0
文件: main.py 项目: beannie-j/agar-io
import pygame
from application.application import Application, Camera

application = Application("Agar.io", 800, 600, False)
clock = pygame.time.Clock()
FPS = 60

def main():
    application.start()
    pause = False
    while application.is_running:
        clock.tick(FPS)
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                application.shut_down()
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_ESCAPE:
                    application.shut_down()
                if event.key == pygame.K_p:
                    pause = True
                if event.key == pygame.K_r:
                    pause = False
        if pause == False:
            application.update()  
            application.draw()
    pygame.quit()

if __name__=="__main__":
    main()
示例#18
0
 def _is_pre_analyze_validation_pass(self, tool_flag):
     return Application.get_instance().execute(
         self._create_make_pre_analyze_validation_command(tool_flag))
 def actionPerformed(self, event):
     Application.get_instance().execute(self._create_application_command(
         event.getActionCommand()
     ))
示例#20
0
from application.application import Application
import utils.updatechecker as upd
import sys, os, time

app = Application("Ultra", show_tabs=False)
app.run()
 def run(self):
     Application.get_instance().execute(self.command)
示例#22
0
 def itemStateChanged(self, event):
     Application.get_instance().execute(
         SetDomainDictValueCommand(self._get_domain_dict_type(),
                                   self._get_domain_dict_key(),
                                   self._check_box.isSelected()))
示例#23
0
from application.application import Application
from flask_cors import CORS
from werkzeug.middleware.proxy_fix import ProxyFix

application = Application(port=5555)
cors = CORS(application.server)

application.server.wsgi_app = ProxyFix(application.server.wsgi_app)
示例#24
0
 def _is_pre_process_validation_pass(self, request_info, response_info):
     return Application.get_instance().execute(
         self._create_make_pre_process_validation_command(
             request_info, response_info))
示例#25
0
 def __init__(self, checkpoint_path, model_name):
     self.chkpoint = checkpoint_path
     self.app = Application(load_path=checkpoint_path,
                            model_name=model_name)
     self.datahelper = DataHelper()
示例#26
0
文件: kdb.py 项目: zxbaby/kdb_be
import tornado.ioloop
import tornado.options
from tornado.options import define, options

import first_module
from application.application import Application

from helper import config
from util.log import logger

from init import init

port = config.ConfigHelper.get_server_port()
define("port", default=port, help="run on the given port", type=int)

if __name__ == "__main__":
    init()
    tornado.options.parse_command_line()
    Application().listen(options.port)
    tornado.ioloop.IOLoop.current().start()
示例#27
0
文件: main.py 项目: jagnip/CCMS
def main():
    """
    Entry point for the application.
    """
    app = Application()
    app.run()
示例#28
0
import sys

from application.application import Application

if __name__ == '__main__':
    app = Application(sys.argv)
    sys.exit(app.run())
示例#29
0
                             (If you don't have a configuration yet,
                             create one with the CETONI Elements software first.)"""
                        )
    parser.add_argument('-v',
                        '--version',
                        action='version',
                        version='%(prog)s ' + __version__)
    parser.add_argument(
        '-p',
        '--server-base-port',
        action='store',
        default=DEFAULT_BASE_PORT,
        help='The port number for the first SiLA server (default: %d)' %
        DEFAULT_BASE_PORT)
    return parser.parse_args()


if __name__ == '__main__':
    logging_level = logging.DEBUG  # or use logging.ERROR for less output
    LOGGING_FORMAT = '%(asctime)s [%(threadName)-12.12s] %(levelname)-8s| %(module)s.%(funcName)s: %(message)s'
    try:
        coloredlogs.install(fmt=LOGGING_FORMAT, level=logging_level)
    except NameError:
        logging.basicConfig(format=LOGGING_FORMAT, level=logging_level)

    parsed_args = parse_command_line()

    app = Application(parsed_args.config_path,
                      int(parsed_args.server_base_port))
    app.run()
示例#30
0
# Copyright 2017 SrMouraSilva
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from application.application import Application
from raspberry_p0.raspberry_p0 import RaspberryP0

application = Application(path_data="data/", address='localhost', test=True)

p0 = RaspberryP0(application, configuration_file='config_test.ini')

application.register(p0)
application.start()

application.stop()
 def focusLost(self, event):
     Application.get_instance().execute(
         SetDomainDictValueCommand(
             self._get_domain_dict_type(), self._get_domain_dict_key(),
             InfrastructureHelpers.split(self._text_field.getText())))