Skip to content

Commit

Permalink
added requested shorcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementJ18 committed Nov 25, 2023
1 parent 6ac728b commit 136e528
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ def __init__(self):
super().__init__()
self.base_name = "FinalBIG v2"
self.setWindowIcon(QIcon(os.path.join(basedir, "icon.ico")))
self.search_archive_regex_bool = False

self.settings = QSettings("Necro inc.", "FinalBIGv2")

Expand Down Expand Up @@ -367,8 +368,21 @@ def create_shortcuts(self):
QShortcut(QKeySequence("CTRL+H"), self, self.show_help),
"Show the help",
),
(
QShortcut(
QKeySequence("CTRL+SHIFT+F"), self, lambda: self.search_archive(self.search_archive_regex_bool)
),
"Search for text in the archive",
),
(
QShortcut(QKeySequence("ALT+R"), self, self.toggle_search_archive_regex),
"Toggle the 'Search for text in archive' shortcut regex search on/off",
),
]

def toggle_search_archive_regex(self):
self.search_archive_regex_bool = not self.search_archive_regex_bool

def create_menu(self):
menu = self.menuBar()
file_menu = menu.addMenu("&File")
Expand Down Expand Up @@ -416,7 +430,9 @@ def create_menu(self):
option_menu.triggered.connect(self.toggle_dark_mode)

self.use_external_action = QAction("Use external programs?", self, checkable=True)
self.use_external_action.setToolTip("Whether to open using the internal editor or the user's default application")
self.use_external_action.setToolTip(
"Whether to open using the internal editor or the user's default application"
)
self.use_external_action.setChecked(self.external)
option_menu.addAction(self.use_external_action)
option_menu.triggered.connect(self.toggle_external)
Expand Down Expand Up @@ -484,7 +500,11 @@ def _save(self, path):
self.archive.save(path)
QMessageBox.information(self, "Done", "Archive has been saved")
except PermissionError:
QMessageBox.critical(self, "Failed", "Could not save due to missing permissions. Save somewhere this application has access and restart the application as admin.")
QMessageBox.critical(
self,
"Failed",
"Could not save due to missing permissions. Save somewhere this application has access and restart the application as admin.",
)

self.path = path
self.update_archive_name()
Expand Down Expand Up @@ -530,9 +550,7 @@ def open_new_tab(self):
if self.listwidget.currentIndex() != self.listwidget.count() - 1:
return

name, ok = QInputDialog.getText(
self, "Tab name", "Pick a name for your new tab:"
)
name, ok = QInputDialog.getText(self, "Tab name", "Pick a name for your new tab:")
if not ok:
return False

Expand Down

0 comments on commit 136e528

Please sign in to comment.