moved core functions in tasks.py to class Tasker

Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
Arthur Lu 2020-06-10 18:19:58 +00:00
parent 236c28c3be
commit 8a212a21df

View File

@ -6,30 +6,23 @@ __author__ = (
"Arthur Lu <learthurgo@gmail.com>",
)
match_ = False
metric_ = False
pit_ = False
class Tasker():
match_enable = True
metric_enable = True
pit_enable = True
match_ = False
metric_ = False
pit_ = False
config = {}
match_enable = True
metric_enable = True
pit_enable = True
def init():
config = {}
global match_
global metric_
global pit_
def __init__():
global match_enable
global metric_enable
global pit_enable
global config
config = su.load_config("config.json")
def match():
def match():
match_ = True
@ -47,7 +40,7 @@ def match():
task = threading.Thread(name = "match", target = match)
task.start()
def metric():
def metric():
metric_ = True
@ -67,7 +60,7 @@ def metric():
task = threading.Thread(name = "match", target = metric)
task.start()
def pit():
def pit():
pit_ = True
@ -85,26 +78,44 @@ def pit():
task = threading.Thread(name = "pit", target = pit)
task.start()
def start_match():
def start_match():
task = threading.Thread(name = "match", target = match)
task.start()
def start_metric():
def start_metric():
task = threading.Thread(name = "match", target = metric)
task.start()
def start_pit():
def start_pit():
task = threading.Thread(name = "pit", target = pit)
task.start()
def stop_match():
def stop_match():
match_enable = False
def stop_metric():
def stop_metric():
metric_enable = False
def stop_pit():
def stop_pit():
pit_enable = False
def get_match():
return match_
def get_metric():
return metric_
def get_pit():
return pit_
def get_match_enable():
return match_enable
def get_metric_enable():
return metric_enable
def get_pit_enable():
return pit_enable
"""
def main():