Exemplo n.º 1
0
def main():
    print('main()')

    qmlRegisterType(CustomPaintedItem, "CustomPaintedItem", 1, 0,
                    "CustomPaintedItem")

    app = QApplication(sys.argv)
    engine = QQmlApplicationEngine()
    main_controller = MainController()
    context = engine.rootContext()
    context.setContextProperty("main", main_controller)
    script_directory = os.path.dirname(os.path.abspath(__file__))
    engine.load(os.path.join(script_directory, 'main.qml'))

    main_controller.start()

    sys.exit(app.exec_())
Exemplo n.º 2
0
def main():
    try:
        updater = Updater(token=BotConfig.token, use_context=True)
        dispatcher = updater.dispatcher
        test_controller = MainController(dispatcher=dispatcher)
        updater.start_polling()
        updater.idle()
    except Exception as e:
        print('main error: %s' % str(e))
Exemplo n.º 3
0
    def __init__(self, sys_argv):
        super(App, self).__init__(sys_argv)
        self._main_model = MainModel()
        self._main_view = MainView()
        self._main_controller = MainController(self._main_model,
                                               self._main_view)

        self._main_model.set_main_controller(self._main_controller)
        self._main_view.set_main_controller(self._main_controller)

        self._main_view.show()
Exemplo n.º 4
0
def read_config():
    print(
        '====================================== \n Starting up DEMA BACKTESTING \n======================================'
    )
    # Try opening the config file.
    try:
        with open('config.json', 'r') as configfile:
            data = configfile.read()
    except FileNotFoundError:
        print("[ERROR] no config file found.")
        raise SystemExit
    except:
        print("[ERROR] something went wrong parsing config file.",
              sys.exc_info()[0])
        raise SystemExit

    config = json.loads(data)

    # Check whether config contains all necessary properties
    check_config_max_open_trades(config)
    check_config_starting_capital(config)
    check_config_stoploss(config)

    MainController(config)
Exemplo n.º 5
0
def main():
    # Initialize floormap
    grid = [
        [
            -1, 0, 1, -1, -1, -1, -1, 0, 0, -1, -1, -1, -1, -1, -1, 1,
            -1, -1, -1, 1
        ], [-1, 0, 1, 1, 1, -1, -1, -1, 0, 2, 2, 2, 2, 2, 4, 4, -1, -1, -1, 1],
        [-1, 0, 0, 0, 1, 4, 2, 2, 4, 2, 3, 3, 3, 3, 4, 2, 2, 4, 1,
         1],
        [-1, -1, -1, 0, 0, 4, -1, -1, 4, 3, 3, -1, -1, -1, 3, 3, 4, 4, 2, -1],
        [
            -1, -1, -1, -1, -1, 2, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1, 3, 3,
            2, 2
        ],
        [
            -1, -1, -1, -1, -1, 4, 4, 3, 3, -1, -1, -1, -1, -1, -1, -1, -1, 3,
            3, 2
        ],
        [
            -1, -1, -1, -1, -1, 2, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
            -1, 3, 2
        ],
        [
            -1, -1, -1, -1, 2, 2, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
            -1, 3, 2
        ],
        [
            -1, -1, -1, -1, 2, 3, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
            -1, 4, 4
        ],
        [
            -1, -1, -1, -1, 2, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
            -1, 3, 2
        ],
        [
            -1, -1, -1, -1, 2, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
            -1, 3, 2
        ],
        [
            1, 1, 1, 1, 4, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
            3, 2
        ],
        [
            -1, -1, 0, 0, 4, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
            3, 2
        ],
        [
            0, 0, 0, -1, 2, 3, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
            3, 2
        ],
        [
            -1, -1, -1, -1, 2, 4, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
            3, 2
        ],
        [
            -1, -1, -1, -1, 1, 4, 2, 3, 3, -1, -1, -1, -1, -1, -1, -1, -1, 3,
            3, 2
        ], [-1, -1, -1, -1, 1, 0, 2, 2, 4, 3, 3, 3, 4, 3, -1, -1, 3, 3, 2, 2],
        [-1, -1, -1, 1, 1, 0, -1, 4, 4, 2, 2, 2, 4, 3, 3, 4, 3, 2, 2, -1],
        [-1, 1, 1, 1, 0, 0, -1, 1, -1, -1, -1, -1, 2, 2, 2, 4, 2, 2, -1, -1],
        [
            -1, 1, 0, 0, 0, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1,
            -1, -1
        ],
        [
            -1, 1, 0, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1,
            -1, -1
        ]
    ]

    floormap = np.array(grid).transpose(1, 0)

    # Set up queues for interprocess data
    cameraData = Queue()
    mainControllerData = Queue()
    simulatorData = Queue()
    travelTimeData = Queue()

    # Initialize processes
    cameraProcess = Camera(floormap, simulatorData, cameraData)
    mainControllerProcess = MainController(cameraData, mainControllerData)
    simulator = Simulator(floormap,
                          mainControllerData,
                          simulatorData,
                          travelTimeData,
                          debug=False)
    travelTime = TravelTime(travelTimeData)

    cameraProcess.start()
    mainControllerProcess.start()
    travelTime.start()

    numOfPeople = [1, 5, 10, 25, 40, 50, 100]

    simulator.run(40)
Exemplo n.º 6
0
def generate():
    image_src = MainController().generate_image(request)
    return send_file(image_src)
Exemplo n.º 7
0
import sys
from PyQt5.QtWidgets import QApplication
from main_controller import MainController

if __name__ == '__main__':
    a = QApplication(sys.argv)
    w = MainController()
    w.start()
    sys.exit(a.exec_())
Exemplo n.º 8
0
parser.add_argument('--torrent_file_path', type=str, required=True)
parser.add_argument('--seeder', action='store_true')
args = parser.parse_args()

if not os.path.exists(args.torrent_file_path):
    sys.exit('File torrent not exists')

torrent_file_data = parse_torrent_file(args.torrent_file_path)

info_hash = hashlib.sha1(
    json.dumps(torrent_file_data['info']).encode('utf-8')).hexdigest()
my_id = ''.join(
    random.choice(string.ascii_letters + string.digits)
    for i in range(PEER_ID_SIZE))

main_controller = MainController.start(my_id, info_hash, torrent_file_data,
                                       args.seeder)

server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_socket.bind((socket.gethostname(), 0))
server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
server_socket.listen(5)

tracker_client = TrackerClient(my_id, info_hash,
                               server_socket.getsockname()[0],
                               server_socket.getsockname()[1],
                               torrent_file_data['tracker_ip'],
                               torrent_file_data['tracker_port'],
                               main_controller)
tracker_client.daemon = True
tracker_client.start()
Exemplo n.º 9
0
def run_tests(configFile):
	main = MainController(configFile)
	main.start()
Exemplo n.º 10
0
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 28 17:47:03 2017

@author: abhyudai
"""

#Entry point to run code

from main_controller import MainController

mc = MainController(num_ap=20)
mc.load_data()
mc.initialize_gaussian_processes(
    visualize=False)  #Visualize the wifi data in 3D space

#Visualize gaussians after regression
print "Number of gaussians", mc.number_of_access_points
for ap_index in range(0, mc.number_of_access_points):
    pass  #mc.visualize_gaussian(ap_index, mc.gaussian_processes[ap_index])

#Run particle filter for all gaussians
n_particles = 200
num_iterations = 2000
mc.start_particle_filter(mc.gaussian_processes,
                         mc.wifi_values,
                         num_particles=n_particles,
                         num_iter=num_iterations)
Exemplo n.º 11
0
from main_view import MainView
from main_controller import MainController
from mfcc_svm import Voice
from PyQt5 import QtCore, QtGui, QtWidgets
import sys

if __name__ == "__main__":
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    voice = Voice()
    main_view = MainView(MainWindow)
    main_controller = MainController(voice, main_view)

    MainWindow.show()
    sys.exit(app.exec_())
Exemplo n.º 12
0
def run_engine(args):
    controller = MainController(args)
    controller.run()
Exemplo n.º 13
0
 def __init__(self):
     window = tk.Tk()
     MainController(MainView(window), MasterTransceiverInterface())
     window.mainloop()