forked from NinjaCheetah/NUSGet
Fix setting custom download dir to cwd when canceling file dialog
This commit is contained in:
parent
a3d8dc7887
commit
4f993a3a62
@ -85,8 +85,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||||||
self.ui.custom_out_dir_chkbox.toggled.connect(
|
self.ui.custom_out_dir_chkbox.toggled.connect(
|
||||||
lambda: connect_is_enabled_to_checkbox([self.ui.custom_out_dir_entry, self.ui.custom_out_dir_btn],
|
lambda: connect_is_enabled_to_checkbox([self.ui.custom_out_dir_entry, self.ui.custom_out_dir_btn],
|
||||||
self.ui.custom_out_dir_chkbox))
|
self.ui.custom_out_dir_chkbox))
|
||||||
self.ui.custom_out_dir_chkbox.toggled.connect(
|
|
||||||
lambda: update_setting(config_data, "use_out_path", self.ui.custom_out_dir_chkbox.isChecked()))
|
|
||||||
# Load auto-update settings, and initialize them if they don't exist.
|
# Load auto-update settings, and initialize them if they don't exist.
|
||||||
try:
|
try:
|
||||||
self.ui.auto_update_chkbox.setChecked(config_data["auto_update"])
|
self.ui.auto_update_chkbox.setChecked(config_data["auto_update"])
|
||||||
@ -104,6 +102,9 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||||||
self.ui.custom_out_dir_chkbox.setChecked(True)
|
self.ui.custom_out_dir_chkbox.setChecked(True)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
# Register this callback after the previous check to avoid an extra config write.
|
||||||
|
self.ui.custom_out_dir_chkbox.toggled.connect(
|
||||||
|
lambda: update_setting(config_data, "use_out_path", self.ui.custom_out_dir_chkbox.isChecked()))
|
||||||
self.ui.tid_entry.textChanged.connect(self.tid_updated)
|
self.ui.tid_entry.textChanged.connect(self.tid_updated)
|
||||||
self.ui.custom_out_dir_entry.textChanged.connect(self.custom_output_dir_changed)
|
self.ui.custom_out_dir_entry.textChanged.connect(self.custom_output_dir_changed)
|
||||||
# Basic intro text set to automatically show when the app loads. This may be changed in the future.
|
# Basic intro text set to automatically show when the app loads. This may be changed in the future.
|
||||||
@ -532,6 +533,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||||||
# that the directory does indeed exist and is a directory, and we can save it as the output directory.
|
# that the directory does indeed exist and is a directory, and we can save it as the output directory.
|
||||||
selected_dir = QFileDialog.getExistingDirectory(self, app.translate("MainWindow", "Open Directory"),
|
selected_dir = QFileDialog.getExistingDirectory(self, app.translate("MainWindow", "Open Directory"),
|
||||||
"", QFileDialog.ShowDirsOnly | QFileDialog.DontResolveSymlinks)
|
"", QFileDialog.ShowDirsOnly | QFileDialog.DontResolveSymlinks)
|
||||||
|
if selected_dir == "":
|
||||||
|
return
|
||||||
out_path = pathlib.Path(selected_dir)
|
out_path = pathlib.Path(selected_dir)
|
||||||
if not out_path.exists() or not out_path.is_dir():
|
if not out_path.exists() or not out_path.is_dir():
|
||||||
msg_box = QMessageBox()
|
msg_box = QMessageBox()
|
||||||
|
@ -499,7 +499,7 @@ class Ui_MainWindow(object):
|
|||||||
self.custom_out_dir_chkbox.setText("")
|
self.custom_out_dir_chkbox.setText("")
|
||||||
self.custom_out_dir_chkbox_lbl.setText(QCoreApplication.translate("MainWindow", u"Use a custom download directory", None))
|
self.custom_out_dir_chkbox_lbl.setText(QCoreApplication.translate("MainWindow", u"Use a custom download directory", None))
|
||||||
self.custom_out_dir_entry.setPlaceholderText(QCoreApplication.translate("MainWindow", u"Output Path", None))
|
self.custom_out_dir_entry.setPlaceholderText(QCoreApplication.translate("MainWindow", u"Output Path", None))
|
||||||
self.custom_out_dir_btn.setText(QCoreApplication.translate("MainWindow", u"Open...", None))
|
self.custom_out_dir_btn.setText(QCoreApplication.translate("MainWindow", u"Select...", None))
|
||||||
self.log_text_browser.setMarkdown("")
|
self.log_text_browser.setMarkdown("")
|
||||||
self.log_text_browser.setHtml(QCoreApplication.translate("MainWindow", u"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
self.log_text_browser.setHtml(QCoreApplication.translate("MainWindow", u"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||||
"<html><head><meta name=\"qrichtext\" content=\"1\" /><meta charset=\"utf-8\" /><style type=\"text/css\">\n"
|
"<html><head><meta name=\"qrichtext\" content=\"1\" /><meta charset=\"utf-8\" /><style type=\"text/css\">\n"
|
||||||
|
@ -657,7 +657,7 @@
|
|||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Open...</string>
|
<string>Select...</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user