class Server(FlaskView): route_base = "" default_methods = ['GET', 'POST'] controller = TaskController() def __init__(self): logger.info('Server created') super().__init__() @route('/', methods=['GET']) def home(self): return MAIN_PAGE @route('/get-active-tasks-count', methods=['GET']) def active_threads_count(self): return f'<h1>Current threads count is: {Server.controller.get_tasks_number()}</p>' @route('/get-all-tasks', methods=['GET']) def all_tasks(self): res = [] for task in Server.controller.get_all_tasks(): res.append(f'<p>{task}</p>') if len(res) == 0: res = '<h1>There are no tasks :(</h1>' res = ''.join(res) return res @route('push-task-with-weight/<weight>', methods=['POST']) def push_task(self, weight) -> str: Server.controller.push_task_for(weight) return f'<h1>Your "task" has been pushed to computation with weight: {weight}</h1>'\ f'<h2>Current tasks count: {Server.controller.get_tasks_number()} <h2>'
def __init__(self): TaskController.__init__(self) #--- Safe Control --- self.sbc = SafeBaseControl() self.sbc.set_previous_velocity((0, 0, 0)) # enable safe base control thread self.control_factor_thread = threading.Thread( target=self.sbc.update_control_factor) self.control_factor_thread.setDaemon(True) self.control_factor_thread.start() self.message("Safe base control initialized") self.safe = False # toggle starting value self.safe_prev = 0
def __init__(self): TaskController.__init__(self)
import Tkinter as tk from task_model import TaskModel from task_view import TaskView from task_controller import TaskController root = tk.Tk() root.withdraw() models = [] list = load_from_file("task_json.json") for title in list: t = TaskModel(title) models.append(t) tc = TaskController(root, models) root.mainloop() def load_from_file(filename): if not os.path.isfile(filename): raise Exception("filename is not valid or doesn't exist") f = open(filename, 'r') full = f.read() f.close my_list = [] for i in json.loads(full): # y = eval(i['kind'])(0, "okay", [1,1,1], "Female", "Green") #y.load_from_json(i)
def __init__(self): TaskController.__init__(self) self.mqs = []
def __init__(self): TaskController.__init__(self) self.doneTests = []
def __init__(self): TaskController.__init__(self) self.grippers = []
def __init__(self): TaskController.__init__(self) self.ppu = None
import Tkinter as tk from task_model import TaskModel from task_view import TaskView from task_controller import TaskController root = tk.Tk() root.withdraw() t = TaskModel("Finish this funny project") tc = TaskController(root, t) root.mainloop()