From e4738b6d9bc3f31475a16cc149d5f1ce14afd2d1 Mon Sep 17 00:00:00 2001 From: cidoku Date: Tue, 11 Mar 2025 14:07:00 -0300 Subject: [PATCH] Only reload logs on save if checkboxes changed --- options.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/options.py b/options.py index 0d6df67..6a3c87d 100644 --- a/options.py +++ b/options.py @@ -233,6 +233,11 @@ class Settings(QtGui.QDialog): main_layout.addLayout(save_layout) self.savebtn.setFocus() + + # If they're different from the respective checkbox on save, tell the gui to start/stop logging + self.savelogs_state = False + self.combinelogs_state = False + self.savedemos_state = False def showSettings(self): if exists("AO2XP.ini"): @@ -292,6 +297,10 @@ class Settings(QtGui.QDialog): for line in f: self.callwords_edit.append(line.rstrip().decode("utf-8")) + self.savelogs_state = self.savetolog.isChecked() + self.combinelogs_state = self.savetolog_combine.isChecked() + self.savedemos_state = self.savedemos.isChecked() + self.tabs.setCurrentIndex(0) self.show() @@ -333,14 +342,17 @@ class Settings(QtGui.QDialog): f.write(self.callwords_edit.toPlainText().toUtf8()) self.gamewindow.gamewidget.text_wait_time = self.textstaytime.value() - self.gamewindow.gamewidget.ooclog.set_logfiles() - self.gamewindow.gamewidget.icLog.set_logfiles(self.gamewindow.gamewidget.ooclog.logfile) self.gamewindow.gamewidget.slide_enabled = self.enableslide.isChecked() - if self.savedemos.isChecked(): - self.gamewindow.gamewidget.start_demo_recorder() - else: - self.gamewindow.gamewidget.demo_recorder = None + if not (self.savelogs_state == self.savetolog.isChecked() and self.combinelogs_state == self.savetolog_combine.isChecked()): + self.gamewindow.gamewidget.ooclog.set_logfiles() + self.gamewindow.gamewidget.icLog.set_logfiles(self.gamewindow.gamewidget.ooclog.logfile) + + if not self.savedemos_state == self.savedemos.isChecked(): + if self.savedemos.isChecked(): + self.gamewindow.gamewidget.start_demo_recorder() + else: + self.gamewindow.gamewidget.demo_recorder = None self.hide()