Example #1
0
def run():
  if len(sys.argv) == 3 and (str(sys.argv[2]) == '--silent' or str(sys.argv[2]) == '-s'):
    talker = Controller(app.commands, app.speech_to_text, str(sys.argv[1]))
    app.speech_to_text.speak(set_volume(0))
    time.sleep(5)
    talker.start()
    time.sleep(60)
    app.speech_to_text.speak(set_volume(4))
  else:
    if len(sys.argv) < 2:
      talker = Controller(app.commands, app.speech_to_text, 'weather')
      talker.start()
    else:
      talker = Controller(app.commands, app.speech_to_text, str(sys.argv[1]))
      talker.start()
Example #2
0
def optimize(args):
	"""
	Runs the Scheduler with the OrderList from orderListName on the Plant
	with plantName.
	"""
	plant, orderList, configFile = loadPlantAndOrderList(args)
	Controller(plant, orderList, configFile).optimize()
Example #3
0
def controller(qtbot: QtBot, stream: io.StringIO) -> Controller:
    controller = Controller()
    printer = StreamTextPrinter(stream)
    controller._printer = printer
    controller.run_app()
    qtbot.addWidget(controller._gui)
    return controller
Example #4
0
def route_specific_task():
    result = ""
    if (member.user_connected == False):
        abort(401)
    controller = Controller()
    result = controller.view_task()
    return (jsonify(result))
Example #5
0
    def test_update_invoice(self):
        con = Controller()
        invoice = con.create_invoice(create_attrs)

        updated = con.update_invoice(invoice.id, update_attrs)
        self.assertTrue(isinstance(updated, Invoice))
        self.assertEqual(updated.id, invoice.id)
        self.assertEqual(updated.amt, update_attrs["amt"])
Example #6
0
    def test_list_invoices(self):
        con = Controller()
        con.create_invoice(create_attrs)
        invoices = con.list_invoices()
        (invoice, factoring_data) = invoices[0]
        self.assertTrue(isinstance(invoice, Invoice))
        self.assertEqual(invoice.amt, 5)

        # should return a dict
        self.assertTrue(isinstance(factoring_data, dict))
Example #7
0
def restart_daemon(process, project, collector_id=None, network=None):
    """
    Calls a Controller to restart a daemonized STACK process
    """
    if process == 'collect':
        c = Controller(
            process=process,
            project=project,
            collector_id=collector_id
        )
    else:
        c = Controller(
            process=process,
            project=project,
            network=network
        )

    t = threading.Thread(name='test-thread', target=c.process_command, args=('restart',))
    t.start()
Example #8
0
    def test_create_invoice(self):
        con = Controller()
        invoice = con.create_invoice(create_attrs)
        self.assertTrue(isinstance(invoice, Invoice))

        (fetched, factoring_data) = con.get_invoice(invoice.id)
        self.assertTrue(isinstance(fetched, Invoice))
        self.assertEqual(fetched.id, invoice.id)

        self.assertTrue(isinstance(factoring_data, dict))
Example #9
0
def mod_specific_task():
    if (member.user_connected == False):
        abort(401)
    result = request.form
    task_id = result.getlist('task_id')
    status = result.getlist('status')
    controller = Controller()
    result = controller.mod_task(task_id, status)
    loaded_response = result.data
    if (is_error(loaded_response) == True):
        return (result)
    else:
        return jsonify(result="update done")
    return (result)
Example #10
0
def del_task():
    result = ""
    if (member.user_connected == False):
        abort(401)
    result = request.form
    task_id = result.getlist('task_id')
    controller = Controller()
    result = controller.del_task(task_id)
    loaded_response = result.data
    if (is_error(loaded_response) == True):
        return (result)
    else:
        return jsonify(result="task deleted")
    return (result)
Example #11
0
def add_task():
    if (member.user_connected == False):
        abort(401)
    result = request.form
    title = result.getlist('title')
    task_id = result.getlist('task_id')
    status = "todo"
    controller = Controller()
    result = controller.add_task(member.name, title, task_id, status)
    loaded_response = result.data
    if (is_error(loaded_response) == True):
        return (result)
    else:
        return jsonify(result="new task added")
    return (result)
Example #12
0
    def __init__(self):
        super(Main, self).__init__()
        self.setupUi(self)
        self.con = Controller()

        # table setup
        self.OverviewTable.setEditTriggers(QTableWidget.NoEditTriggers)
        self.OverviewTable.setSelectionBehavior(QTableView.SelectRows)

        # table action buttons
        self.DeleteButton.clicked.connect(self.on_delete)
        self.EditButton.clicked.connect(self.on_edit)
        # connect form buttons
        self.SaveButton.clicked.connect(self.on_save)
        self.ResetButton.clicked.connect(self.on_reset)
Example #13
0
def signin_user():
    form_input = request.form
    user = form_input.getlist('username')
    password = form_input.getlist('password')
    controller = Controller()
    result = controller.signin(user, password)
    loaded_response = result.data
    if (is_error(loaded_response) == True):
        return (result)
    else:
        member.user_connected = True
        member.name = user[0]
        return render_template('tasks.html',
                               username=member.name,
                               status="connected")
    return (result)
Example #14
0
def route_all_user_tasks():
    controller = Controller()
    if (member.user_connected == False):
        abort(401)
    try:
        result = controller.fetch_all_user_tasks(member.name)
    except:
        abort(400)
    if (len(result) == 0):
        user_tasks = []
    else:
        user_tasks = result
    print(result)
    return render_template("tasks_menu.html",
                           username=member.name,
                           tasks=[('prepare_my_repo', '1', 'To do'),
                                  ('mrclean', '2', 'To do'),
                                  ('push_that', '3', 'To do'),
                                  ('NormEZ.rb', '4', 'To do')])
Example #15
0
def route_user_task_del_id(id):
    return Controller(get_connection(), app).handle_user_task_del(id)
Example #16
0
def route_user_task_add():
    return Controller(get_connection(), app).handle_user_task_add(request)
Example #17
0
def route_user_task_id(id):
    if request.method == "GET":
        return Controller(get_connection(), app).handle_user_task_id_get(id)
    return Controller(get_connection(), app).handle_user_task_id_post(id, request)
Example #18
0
def route_signout():
    return Controller(get_connection(), app).handle_signout()
Example #19
0
def route_signin():
    return Controller(get_connection(), app).handle_signin(request)
Example #20
0
def route_register():
    return Controller(get_connection(), app).handle_register(request)
Example #21
0
def route_all_users():
    controller = Controller()
    if (member.user_connected == False):
        abort(401)
    result = controller.fetch_user_infos(member.name)
    return result
Example #22
0
def add_user_task_route(id_task):
    return Controller().add_user_to_task(id_task, request.form)
Example #23
0
def main_route():
    return Controller().main()
Example #24
0
def add_task_route():
    return Controller().add_task(request.form)
Example #25
0
import os

import tkinter.filedialog as filedialog
import pygame

from app.controller import Controller

if __name__ == '__main__':

    original_dir = os.getcwd()

    chosen_dir = filedialog.askdirectory()

    # Initialize GUI
    f = Controller(chosen_dir)
    f.pack()

    # Initialize pygame
    pygame.init()

    # Initialize the clock
    clock = pygame.time.Clock()

    # Start playing songs
    f.focus_force()
    f.play()

    # Write the GUI loop manually
    while True:
        clock.tick(60)
Example #26
0
def page_add_task_route():
    return Controller().page_add_task()
Example #27
0
def del_task_route(id):
    return Controller().del_task(id)
Example #28
0
def route_user_task():
    return Controller(get_connection(), app).handle_user_task()
Example #29
0
import os
import sys

from PyQt5 import QtWidgets

sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '.')))

from app.controller import Controller

if __name__ == '__main__':
    app = QtWidgets.QApplication([])

    controller = Controller()
    controller.run_app()

    # Wrapping the GUI execution into `sys.exit()` to ensure that proper result code
    # will be returned when the window closes (otherwise it's always 0)
    sys.exit(app.exec())
Example #30
0
from app.controller import Controller
import sys

if __name__ == '__main__':
    c = Controller()
    sys.exit(c.run())