MemWeb/Python/Application/MemWeb.Threads.py

56 lines
1.4 KiB
Python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
if "MemWeb" not in globals():
class MemWeb:pass
class Anonymous(MemWeb.Abstracts.Common):
def __set_basic_data(self):
self.__timer = self.settings(("threads_timer", "timer"))
self.__bucle = self.settings(("threads_bucle", "bucle"))
def __init__(self, mem_web, inputs = None):
super().__init__(mem_web, "threads")
self._print("info", "mem_web_threads_building")
self.__threads = []
self.__set_basic_data()
self._print("ok", "mem_web_threads_built")
def __start(self, end):
self.__set_basic_data()
end()
# def start(self, callback = None):
# self._print("info", "mem_web_threads_starting")
# end = lambda status:MemWeb.execute(callback, status)
# if self.__started:
# self._print("warn", "mem_web_threads_already_started")
# end(False)
# return False
# self.__started = True
# end(True)
# self._print("ok", "mem_web_threads_started")
# return True
def __execute(self, thread):
pass
def add(self, callback, inputs = None, show_errors = None):
timer = MemWeb.get_value("timer", inputs, self.__timer)
bucle = MemWeb.get_value("bucle", inputs, self.__bucle)
error = 0
MemWeb.Threads = Anonymous
del globals()["Anonymous"]