2019-07-21 23:55:38 +00:00
|
|
|
import queue
|
2019-09-20 15:40:56 +00:00
|
|
|
from collections import namedtuple
|
2019-07-21 23:55:38 +00:00
|
|
|
from datetime import datetime, timedelta
|
2019-09-20 15:40:56 +00:00
|
|
|
from multiprocessing import Process, Queue, freeze_support
|
|
|
|
|
2019-07-21 23:55:38 +00:00
|
|
|
import _ed_lrr
|
2019-09-20 15:40:56 +00:00
|
|
|
# from PyQt5.QtWidgets import QProgressDialog
|
|
|
|
|
|
|
|
|
|
|
|
# class RouteProgress(QProgressDialog):
|
|
|
|
# def __init__(self, *args, **kwargs):
|
|
|
|
# super().__init__(*args, **kwargs)
|
|
|
|
# self.setWindowModality(Qt.WindowModal)
|
2019-07-21 23:55:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Router(Process):
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
super().__init__()
|
|
|
|
self.state = {}
|
|
|
|
self.queue = Queue()
|
|
|
|
self.daemon = True
|
|
|
|
self.args = args
|
|
|
|
self.kwargs = kwargs
|
|
|
|
self.kwargs["callback"] = self.callback
|
|
|
|
|
|
|
|
def callback(self, state):
|
|
|
|
self.queue.put({"status": state})
|
|
|
|
|
|
|
|
def run(self):
|
|
|
|
route = _ed_lrr.route(*self.args, **self.kwargs)
|
|
|
|
self.queue.put({"return": route})
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
freeze_support()
|
|
|
|
r = Router(
|
|
|
|
["Ix", "Beagle Point"],
|
|
|
|
48,
|
|
|
|
"BFS",
|
|
|
|
False,
|
|
|
|
False,
|
|
|
|
None,
|
|
|
|
None,
|
|
|
|
r"D:\devel\rust\ED_LRR\stars.csv",
|
|
|
|
)
|
|
|
|
for e in r:
|
|
|
|
print(e)
|