Skip to content
Commits on Source (1)
......@@ -39,9 +39,9 @@ class ProgressDialog(QProgressDialog):
def sizeof_fmt(num, suffix="B"):
for unit in ["", "Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "Zi"]:
if abs(num) < 1024.0:
return "{:.02f}{}{}".format(num, unit, suffix)
return "{:.02f} {}{}".format(num, unit, suffix)
num /= 1024.0
return "{:.02f}{}{}".format(num, "Yi", suffix)
return "{:.02f} {}{}".format(num, "Yi", suffix)
def t_round(dt):
......@@ -114,7 +114,8 @@ class PreprocessJob(Job):
self.start()
def handle_progess(self, state):
if not self:
sent=object()
if state.get("return",sent)!=sent:
self.progress_dialog.close()
return
msg = "Processed: {}/{}".format(
......@@ -136,14 +137,17 @@ class RouterJob(Job):
super().__init__(app, main_window, Router, *args, **kwargs)
self.progress_dialog = ProgressDialog("", "Cancel", 0, 0, self.main_window)
self.progress_dialog.setAutoClose(False)
self.progress_dialog.setLabelText("Loading (this will take a bit) ...")
self.progress_dialog.setLabelText("Loading data (this will take a bit) ...")
self.progress_dialog.setWindowTitle("Loading...")
self.progress_dialog.canceled.connect(self.cancel)
self.progress_dialog.show()
self.start()
self.state={}
def handle_progess(self, state):
if state.get("return") is not None:
sent=object()
if state.get("return",sent)!=sent:
print(state['return'])
self.progress_dialog.close()
route_win = WRoute(self.main_window, state["return"])
return
......@@ -245,6 +249,7 @@ class App(QApplication):
class WRoute(Ui_diag_route):
def __init__(self, main_window, hops):
super().__init__()
self.route=hops
dialog = QDialog(main_window)
self.setupUi(dialog)
for n, item in enumerate(hops):
......@@ -257,7 +262,7 @@ class WRoute(Ui_diag_route):
item["system"],
"{body} ({star_type})".format(**item),
str(item["distance"]),
None,
"<NotImplemented>", # Jump distance
],
)
item.setFlags(item.flags() & ~Qt.ItemIsDropEnabled)
......