chore: formatting (ran black)
This commit is contained in:
parent
65fe131006
commit
47b007ca41
4 changed files with 172 additions and 67 deletions
|
@ -26,7 +26,7 @@ from PyQt5.QtWidgets import (
|
|||
QProgressDialog,
|
||||
QTreeWidgetItem,
|
||||
QLabel,
|
||||
QDialog
|
||||
QDialog,
|
||||
)
|
||||
|
||||
|
||||
|
@ -143,9 +143,9 @@ class RouterJob(Job):
|
|||
self.start()
|
||||
|
||||
def handle_progess(self, state):
|
||||
if state.get('return') is not None:
|
||||
if state.get("return") is not None:
|
||||
self.progress_dialog.close()
|
||||
route_win=WRoute(self.main_window,state['return'])
|
||||
route_win = WRoute(self.main_window, state["return"])
|
||||
return
|
||||
msg = "Depth: {depth}\nBody: {body}\nQueued: {queue_size}\nDistance remaining: {d_rem:.2f} Ly".format(
|
||||
**state["status"]
|
||||
|
@ -241,18 +241,29 @@ class App(QApplication):
|
|||
self.styles[style] = palette
|
||||
self.styles["Light"] = self.style().standardPalette()
|
||||
|
||||
|
||||
class WRoute(Ui_diag_route):
|
||||
def __init__(self,main_window,hops):
|
||||
def __init__(self, main_window, hops):
|
||||
super().__init__()
|
||||
dialog=QDialog(main_window)
|
||||
dialog = QDialog(main_window)
|
||||
self.setupUi(dialog)
|
||||
for n,item in enumerate(hops):
|
||||
if item['body'].startswith(item['system']):
|
||||
item['body']=item['body'].replace(item['system'],"").strip()
|
||||
item = QTreeWidgetItem(self.lst_route, [str(n+1),item['system'],"{body} ({star_type})".format(**item),str(item['distance']), None])
|
||||
for n, item in enumerate(hops):
|
||||
if item["body"].startswith(item["system"]):
|
||||
item["body"] = item["body"].replace(item["system"], "").strip()
|
||||
item = QTreeWidgetItem(
|
||||
self.lst_route,
|
||||
[
|
||||
str(n + 1),
|
||||
item["system"],
|
||||
"{body} ({star_type})".format(**item),
|
||||
str(item["distance"]),
|
||||
None,
|
||||
],
|
||||
)
|
||||
item.setFlags(item.flags() & ~Qt.ItemIsDropEnabled)
|
||||
dialog.exec_()
|
||||
|
||||
|
||||
class ED_LRR(Ui_ED_LRR):
|
||||
dl_thread = None
|
||||
diag_prog = None
|
||||
|
@ -317,23 +328,23 @@ class ED_LRR(Ui_ED_LRR):
|
|||
self.inp_systems_pp.clear()
|
||||
self.inp_systems_dest_dl.clear()
|
||||
for path in cfg["history.systems_path"][:]:
|
||||
self.inp_systems_pp.addItem(path)
|
||||
self.inp_systems_pp.addItem(path)
|
||||
self.inp_systems_pp.setCurrentText(path)
|
||||
self.inp_systems_dest_dl.addItem(path)
|
||||
self.inp_systems_dest_dl.addItem(path)
|
||||
self.inp_systems_dest_dl.setCurrentText(path)
|
||||
self.inp_bodies_pp.clear()
|
||||
self.inp_bodies_dest_dl.clear()
|
||||
for path in cfg["history.bodies_path"][:]:
|
||||
self.inp_bodies_pp.addItem(path)
|
||||
self.inp_bodies_pp.addItem(path)
|
||||
self.inp_bodies_pp.setCurrentText(path)
|
||||
self.inp_bodies_dest_dl.addItem(path)
|
||||
self.inp_bodies_dest_dl.addItem(path)
|
||||
self.inp_bodies_dest_dl.setCurrentText(path)
|
||||
self.inp_sys_lst.clear()
|
||||
self.inp_out_pp.clear()
|
||||
for path in cfg["history.stars_csv_path"]:
|
||||
self.inp_sys_lst.addItem(path)
|
||||
self.inp_sys_lst.addItem(path)
|
||||
self.inp_sys_lst.setCurrentText(path)
|
||||
self.inp_out_pp.addItem(path)
|
||||
self.inp_out_pp.addItem(path)
|
||||
self.inp_out_pp.setCurrentText(path)
|
||||
return
|
||||
|
||||
|
@ -405,16 +416,27 @@ class ED_LRR(Ui_ED_LRR):
|
|||
|
||||
def compute_route(self):
|
||||
self.bar_status.showMessage("Resolving systems...")
|
||||
num_resolved=self.resolve_systems()
|
||||
num_resolved = self.resolve_systems()
|
||||
if num_resolved:
|
||||
if QMessageBox.question(self.main_window,"ED_LRR","Resolved {} system(s), are the names correct?".format(num_resolved))==QMessageBox.No:
|
||||
if (
|
||||
QMessageBox.question(
|
||||
self.main_window,
|
||||
"ED_LRR",
|
||||
"Resolved {} system(s), are the names correct?".format(
|
||||
num_resolved
|
||||
),
|
||||
)
|
||||
== QMessageBox.No
|
||||
):
|
||||
return
|
||||
self.bar_status.clearMessage()
|
||||
print(self.systems)
|
||||
systems = [str(s["id"]) for s in self.systems]
|
||||
jump_range = self.sb_range.value()
|
||||
if jump_range==0:
|
||||
self.error("Your jump range is set to zero, you're not going to get anywhere that way")
|
||||
if jump_range == 0:
|
||||
self.error(
|
||||
"Your jump range is set to zero, you're not going to get anywhere that way"
|
||||
)
|
||||
return
|
||||
mode = self.cmb_mode.currentText()
|
||||
primary = self.chk_primary.isChecked()
|
||||
|
@ -479,7 +501,7 @@ class ED_LRR(Ui_ED_LRR):
|
|||
def resolve_systems(self):
|
||||
# TODO: show spinner
|
||||
names = []
|
||||
nums=[]
|
||||
nums = []
|
||||
for n in range(self.lst_sys.topLevelItemCount()):
|
||||
sys_id = getattr(self.lst_sys.topLevelItem(n), "__id__", None)
|
||||
if sys_id is not None:
|
||||
|
@ -491,7 +513,7 @@ class ED_LRR(Ui_ED_LRR):
|
|||
systems = self.find_sys_by_names(names)
|
||||
if systems is None:
|
||||
return
|
||||
for i, name in zip(nums,names):
|
||||
for i, name in zip(nums, names):
|
||||
_, system = systems[name]
|
||||
self.lst_sys.topLevelItem(i).setData(0, 0, system["system"])
|
||||
self.lst_sys.topLevelItem(i).setData(1, 0, system["star_type"])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue