Skip to content

Commit

Permalink
Fix AHKWorker still trying to use settings for ahk path
Browse files Browse the repository at this point in the history
  • Loading branch information
Numerlor committed Jul 30, 2019
1 parent 7730e0e commit c2e858c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion appinfo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from collections import namedtuple

VERSION = "1.43"
VERSION = "1.431"
APP = "Auto Neutron"
ORG = "Numerlor"
APPID = f"{ORG}|{APP}|{VERSION}"
Expand Down
21 changes: 13 additions & 8 deletions hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ def fuel_alert(self):

def start_worker(self, journal, data_values, index):
settings = (self.settings.value("script"), self.settings.value("bind"),
self.dark, self.settings.value("copy_mode", type=bool))
self.dark, self.settings.value("copy_mode", type=bool),
self.settings.value("paths/AHK"))
self.worker = workers.AhkWorker(self, journal, data_values, settings, index)
self.worker.sys_signal.connect(self.main_window.grayout)
self.worker.route_finished_signal.connect(self.end_route_pop)
Expand Down Expand Up @@ -147,7 +148,7 @@ def initial_pop(self):
def end_route_pop(self):
w = popups.RouteFinishedPop(self.main_window)
w.show()
w.close_signal.connect(self.disconnect_signals)
w.close_signal.connect(self.main_window.disconnect_signals)
w.new_route_signal.connect(self.new_route)

def licenses_pop(self):
Expand Down Expand Up @@ -237,12 +238,6 @@ def write_default_settings(self):
self.settings.sync()
self.write_ahk_path()

def quit(self, size, pos):
self.settings.setValue("window/size", size)
self.settings.setValue("window/pos", pos)
self.settings.sync()
self.window_quit_signal.emit(self.save_on_quit)

def write_ahk_path(self):
if not os.path.exists((self.settings.value("paths/ahk"))):
ahk_path = QtWidgets.QFileDialog.getOpenFileName(
Expand All @@ -259,6 +254,16 @@ def write_ahk_path(self):
self.settings.setValue("copy_mode", False)
self.settings.sync()

def get_ahk_path(self):
return self.settings.value("paths/ahk")

def quit(self, size, pos):
self.settings.setValue("window/size", size)
self.settings.setValue("window/pos", pos)
self.settings.sync()
self.window_quit_signal.emit(self.save_on_quit)



def change_to_dark():
p = QtGui.QPalette()
Expand Down
2 changes: 2 additions & 0 deletions main_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from appinfo import SHIP_STATS


# TODO clean up th mess of PlotStartDialog

class SpinBoxDelegate(QtWidgets.QStyledItemDelegate):
def createEditor(self, parent, QStyleOptionViewItem, QModelIndex):
editor = QtWidgets.QSpinBox(parent)
Expand Down
7 changes: 4 additions & 3 deletions workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ class AhkWorker(QtCore.QThread):

def __init__(self, parent, journal, data_values, settings, start_index):
super(AhkWorker, self).__init__(parent)
self.hub = parent
self.journal = journal
self.data_values = data_values
self.systems = [data[0].casefold() for data in data_values]
self.settings = settings
self.script, self.bind, self.dark, self.copy = settings
self.script, self.bind, self.dark, self.copy, ahk_path = settings

if not self.copy:
self.ahk = AHK(executable_path=self.settings.value("paths/AHK"))
self.ahk = AHK(executable_path=ahk_path)
self.loop = True
# set index according to last saved route or new plot, default index 1
if start_index > 0:
Expand Down Expand Up @@ -122,7 +123,7 @@ def set_copy(self, setting):
self.close_ahk()
set_clip(self.systems[self.list_index])
else:
self.ahk = AHK(executable_path=self.settings.value("paths/AHK"))
self.ahk = AHK(executable_path=self.hub.get_ahk_path())
self.reset_ahk()

def reset_ahk(self):
Expand Down

0 comments on commit c2e858c

Please sign in to comment.