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()
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()
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
def route_specific_task(): result = "" if (member.user_connected == False): abort(401) controller = Controller() result = controller.view_task() return (jsonify(result))
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"])
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))
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()
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))
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)
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)
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)
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)
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)
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')])
def route_user_task_del_id(id): return Controller(get_connection(), app).handle_user_task_del(id)
def route_user_task_add(): return Controller(get_connection(), app).handle_user_task_add(request)
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)
def route_signout(): return Controller(get_connection(), app).handle_signout()
def route_signin(): return Controller(get_connection(), app).handle_signin(request)
def route_register(): return Controller(get_connection(), app).handle_register(request)
def route_all_users(): controller = Controller() if (member.user_connected == False): abort(401) result = controller.fetch_user_infos(member.name) return result
def add_user_task_route(id_task): return Controller().add_user_to_task(id_task, request.form)
def main_route(): return Controller().main()
def add_task_route(): return Controller().add_task(request.form)
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)
def page_add_task_route(): return Controller().page_add_task()
def del_task_route(id): return Controller().del_task(id)
def route_user_task(): return Controller(get_connection(), app).handle_user_task()
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())
from app.controller import Controller import sys if __name__ == '__main__': c = Controller() sys.exit(c.run())