31
31
import split_parser
32
32
from AutoControlledWorker import AutoControlledWorker
33
33
from capture_windows import capture_region , Rect
34
- from gen import design
34
+ from compare import checkIfImageHasTransparency , compareImage
35
+ from gen import about , design , update_checker
35
36
from hotkeys import send_command , afterSettingHotkey , setSplitHotkey , setResetHotkey , setSkipSplitHotkey , \
36
37
setUndoSplitHotkey , setPauseHotkey
37
- from menu_bar import AboutWidget , VERSION , UpdateCheckerWidget , about , viewHelp , checkForUpdates
38
+ from menu_bar import open_about , VERSION , viewHelp , checkForUpdates , open_update_checker
38
39
from screen_region import selectRegion , selectWindow , alignRegion , validateBeforeComparison
39
40
from split_parser import BELOW_FLAG , DUMMY_FLAG , PAUSE_FLAG
40
- from compare import checkIfImageHasTransparency , compareImage
41
41
42
42
43
43
# Resize to these width and height so that FPS performance increases
@@ -67,6 +67,7 @@ class AutoSplit(QMainWindow, design.Ui_MainWindow):
67
67
undoSplitSignal = QtCore .pyqtSignal ()
68
68
pauseSignal = QtCore .pyqtSignal ()
69
69
afterSettingHotkeySignal = QtCore .pyqtSignal ()
70
+ updateCheckerWidgetSignal = QtCore .pyqtSignal (str , bool )
70
71
# Use this signal when trying to show an error from outside the main thread
71
72
showErrorSignal = QtCore .pyqtSignal (FunctionType )
72
73
@@ -75,8 +76,9 @@ class AutoSplit(QMainWindow, design.Ui_MainWindow):
75
76
timerStartImage = QtCore .QTimer ()
76
77
77
78
# Windows
78
- aboutWidget : AboutWidget
79
- updateCheckerWidget : UpdateCheckerWidget
79
+ AboutWidget : about .Ui_aboutAutoSplitWidget
80
+ UpdateCheckerWidget : update_checker .Ui_UpdateChecker
81
+ CheckForUpdatesThread : QtCore .QThread
80
82
81
83
# Settings
82
84
split_image_directory = ""
@@ -155,7 +157,7 @@ def __init__(self, parent: Optional[QWidget] = None):
155
157
156
158
# close all processes when closing window
157
159
self .actionView_Help .triggered .connect (viewHelp )
158
- self .actionAbout .triggered .connect (lambda : about (self ))
160
+ self .actionAbout .triggered .connect (lambda : open_about (self ))
159
161
self .actionCheck_for_Updates .triggered .connect (lambda : checkForUpdates (self ))
160
162
self .actionSave_Settings .triggered .connect (lambda : settings .saveSettings (self ))
161
163
self .actionSave_Settings_As .triggered .connect (lambda : settings .saveSettingsAs (self ))
@@ -210,6 +212,9 @@ def __init__(self, parent: Optional[QWidget] = None):
210
212
self .alignregionButton .clicked .connect (lambda : alignRegion (self ))
211
213
self .selectwindowButton .clicked .connect (lambda : selectWindow (self ))
212
214
self .startImageReloadButton .clicked .connect (lambda : self .loadStartImage (True , True ))
215
+ self .actionCheck_for_Updates_on_Open .changed .connect (lambda : self .set_check_for_updates_on_open (
216
+ self .actionCheck_for_Updates_on_Open .isChecked ())
217
+ )
213
218
214
219
# update x, y, width, and height when changing the value of these spinbox's are changed
215
220
self .xSpinBox .valueChanged .connect (self .updateX )
@@ -221,6 +226,8 @@ def __init__(self, parent: Optional[QWidget] = None):
221
226
self .updateCurrentSplitImage .connect (self .updateSplitImageGUI )
222
227
self .afterSettingHotkeySignal .connect (lambda : afterSettingHotkey (self ))
223
228
self .startAutoSplitterSignal .connect (self .autoSplitter )
229
+ self .updateCheckerWidgetSignal .connect (lambda latest_version , check_on_open :
230
+ open_update_checker (self , latest_version , check_on_open ))
224
231
self .resetSignal .connect (self .reset )
225
232
self .skipSplitSignal .connect (self .skipSplit )
226
233
self .undoSplitSignal .connect (self .undoSplit )
@@ -1107,10 +1114,6 @@ def updateSplitImage(self, custom_image_file: str = "", from_start_image: bool =
1107
1114
# exit safely when closing the window
1108
1115
1109
1116
def closeEvent (self , a0 : Optional [QtGui .QCloseEvent ] = None ):
1110
- # save global setting values here
1111
- self .setting_check_for_updates_on_open .setValue ("check_for_updates_on_open" ,
1112
- self .actionCheck_for_Updates_on_Open .isChecked ())
1113
-
1114
1117
def exitProgram ():
1115
1118
if a0 is not None :
1116
1119
a0 .accept ()
@@ -1161,7 +1164,7 @@ def main():
1161
1164
main_window .show ()
1162
1165
# Needs to be after main_window.show() to be shown over
1163
1166
if main_window .actionCheck_for_Updates_on_Open .isChecked ():
1164
- checkForUpdates (main_window , check_for_updates_on_open = True )
1167
+ checkForUpdates (main_window , check_on_open = True )
1165
1168
1166
1169
# Kickoff the event loop every so often so we can handle KeyboardInterrupt (^C)
1167
1170
timer = QtCore .QTimer ()
0 commit comments