Skip to content

Commit

Permalink
Additional style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Numerlor committed Jul 15, 2019
1 parent 2ce46b9 commit 34595e6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
15 changes: 11 additions & 4 deletions MainWindows.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,14 @@ def licenses_pop(self):

def update_jumps(self, index):
total_jumps = sum(
int(self.MainTable.item(i, 3).text()) for i in range(self.MainTable.rowCount()))
int(self.MainTable.item(i, 3).text()) for i in
range(self.MainTable.rowCount()))

if total_jumps != 0:
remaining_jumps = sum(
int(self.MainTable.item(i, 3).text()) for i in
range(index, self.MainTable.rowCount()))

self.MainTable.horizontalHeaderItem(3).setText(
f"Jumps {remaining_jumps}/{total_jumps}")
self.MainTable.resizeColumnToContents(3)
Expand Down Expand Up @@ -530,8 +533,11 @@ def setupUi(self):
self.gridLayout_4.addWidget(self.range, 2, 0, 1, 1)
self.gridLayout_4.addWidget(self.source, 0, 0, 1, 1)
self.gridLayout_4.addWidget(self.nearest, 5, 1, 1, 1)
spacerItem2 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum,
QtWidgets.QSizePolicy.Expanding)
spacerItem2 = QtWidgets.QSpacerItem(
20, 40,
QtWidgets.QSizePolicy.Minimum,
QtWidgets.QSizePolicy.Expanding)

self.gridLayout_4.addItem(spacerItem2, 6, 0, 1, 1)
self.gridLayout_4.addWidget(self.eff_spinbox, 5, 0, 1, 1)
self.gridLayout_4.addWidget(self.sp_submit, 7, 1, 1, 1)
Expand Down Expand Up @@ -595,7 +601,8 @@ def change_path(self):
def get_journals(self):
try:
self.journals = sorted(
[self.jpath + file for file in os.listdir(self.jpath) if file.endswith(".log")],
[self.jpath + file for file in os.listdir(self.jpath)
if file.endswith(".log")],
key=os.path.getctime, reverse=True)
except FileNotFoundError:
d = popups.QuitDialog(self, "Journal folder not detected")
Expand Down
19 changes: 13 additions & 6 deletions workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ def main(self):
self.sys_signal.emit(self.list_index, self.dark)
for line in self.follow_file(open(self.journal, encoding='utf-8')):
loaded = json.loads(line)
if loaded['event'] == "FSDJump" and loaded['StarSystem'].casefold(
) == self.data_values[self.list_index][0].casefold():
if (loaded['event'] == "FSDJump" and
loaded['StarSystem'].casefold() ==
self.data_values[self.list_index][0].casefold()):

self.list_index += 1
if self.list_index == len(self.data_values):
self.close_ahk()
Expand Down Expand Up @@ -173,8 +175,11 @@ def run(self):
def plot(self, efficiency, jrange, source, to):
try:
job_request = requests.get("https://spansh.co.uk/api/route",
params=f"efficiency={efficiency}&range={jrange}"
f"&from={source}&to={to}")
params=
f"efficiency={efficiency}"
f"&range={jrange}"
f"&from={source}"
f"&to={to}")
except requests.exceptions.ConnectionError:
self.status_signal.emit("Cannot establish a connection to Spansh")
else:
Expand All @@ -200,8 +205,10 @@ def plot(self, efficiency, jrange, source, to):
self.sleep(min(ceil(ceil((sleep_base / 10) ** 2) / 1.9), 30))
else:
self.finished_signal.emit(
[[data['system'], round(float(data['distance_jumped']), 2),
round(float(data['distance_left']), 2), int(data['jumps'])]
[[data['system'],
round(float(data['distance_jumped']), 2),
round(float(data['distance_left']), 2),
int(data['jumps'])]
for data in job_json['result']['system_jumps']])
break

Expand Down

0 comments on commit 34595e6

Please sign in to comment.