Skip to content

Commit

Permalink
added option to disable auto file open
Browse files Browse the repository at this point in the history
  • Loading branch information
rohankishore committed Dec 18, 2023
1 parent f756279 commit 12e92f2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
11 changes: 10 additions & 1 deletion auratext/Core/additional_prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ def __init__(self):

self.splash_checkbox = QCheckBox("Show Adaptive Splash Screens")
self.expopen_checkbox = QCheckBox("Show Tips in Terminal")
self.open_last_file_checkbox = QCheckBox("Open the last opened file at startup")
self.ttips_checkbox = QCheckBox("Show Explorer on Startup")
with open(f"{local_app_data}/data/config.json", "r") as json_file:
self._config = json.load(json_file)

self.splash_status = self._config['splash']
self.terminaltips_status = self._config["terminal_tips"]
self.exp_open_status = self._config["explorer_default_open"]
self.file_open_status = self._config["open_last_file"]

self._config = {
"splash": "",
Expand Down Expand Up @@ -55,6 +57,7 @@ def init_ui(self):
layout.addWidget(self.splash_checkbox)
layout.addWidget(self.ttips_checkbox)
layout.addWidget(self.expopen_checkbox)
layout.addWidget(self.open_last_file_checkbox)

# Save Button
save_button = QPushButton("Apply")
Expand Down Expand Up @@ -88,10 +91,16 @@ def save_settings(self):
else:
self.exp_open_status = "False"

if self.open_last_file_checkbox.isChecked():
self.file_open_status = "True"
else:
self.file_open_status = "False"

config_data = {
"splash": self.splash_status,
"terminal_tips": self.terminaltips_status,
"explorer_default_open": self.exp_open_status
"explorer_default_open": self.exp_open_status,
"open_last_file": self.file_open_status
}

with open(f"{local_app_data}/data/config.json", "w") as json_file:
Expand Down
10 changes: 6 additions & 4 deletions auratext/Core/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import git
import pyjokes
import qdarktheme
from PyQt6.QtCore import Qt, QSize, pyqtSignal
from PyQt6.QtCore import Qt, QSize
from PyQt6.QtGui import QColor, QFont, QActionGroup, QFileSystemModel, QPixmap, QIcon
from PyQt6.QtWidgets import (
QMainWindow,
Expand Down Expand Up @@ -139,7 +139,6 @@ def splashScreen():
pass



self.tab_widget.setTabsClosable(True)

self.md_dock = QDockWidget("Markdown Preview")
Expand Down Expand Up @@ -217,8 +216,11 @@ def splashScreen():
self.setCentralWidget(self.tab_widget)
self.editors = []

if cfile != "" or cfile != " ":
self.open_last_file()
if self._config["open_last_file"] == "True":
if cfile != "" or cfile != " ":
self.open_last_file()
else:
pass
else:
pass

Expand Down

0 comments on commit 12e92f2

Please sign in to comment.