From 7adfeaf9a302f6cc9e11cf8f6690eb0c6505c2c3 Mon Sep 17 00:00:00 2001
From: michael02022 <86170350+michael02022@users.noreply.github.com>
Date: Thu, 23 Jan 2025 20:43:24 -0600
Subject: [PATCH] added jump buttons for pack/map
---
scripts/update_ui_files.sh | 2 +-
src/ui/mainwindow.py | 52 ++++++++++++++++++++++++++++++++++++++
src/ui/mainwindow.ui | 22 +++++++++++++++-
3 files changed, 74 insertions(+), 2 deletions(-)
diff --git a/scripts/update_ui_files.sh b/scripts/update_ui_files.sh
index 9671405..42ad9de 100755
--- a/scripts/update_ui_files.sh
+++ b/scripts/update_ui_files.sh
@@ -22,4 +22,4 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' "s|import resources_rc|from .rc_resources import *|g" src/ui/ui_mainwindow.py
else
sed -i "s/import resources_rc/from .rc_resources import */g" src/ui/ui_mainwindow.py
-fi
\ No newline at end of file
+fi
diff --git a/src/ui/mainwindow.py b/src/ui/mainwindow.py
index 6e602aa..6299941 100644
--- a/src/ui/mainwindow.py
+++ b/src/ui/mainwindow.py
@@ -166,6 +166,10 @@ def __init__(self, app, parent=None):
self.ui.btnAutoname.clicked.connect(self.onAutoname)
+ # Jump Buttons
+ self.ui.pbnMapJumpUp.clicked.connect(self.onMapJumpUp)
+ self.ui.pbnMapJumpDown.clicked.connect(self.onMapJumpDown)
+
# Velocity Mapper
self.ui.pbnVelAdd.clicked.connect(self.onVelMapAdd)
self.ui.pbnVelDel.clicked.connect(self.onVelMapDel)
@@ -782,6 +786,54 @@ def onItemMap(self):
self.map_objects[idx].change_value("tuned_checkbox", False)
self.ui.chkTunedVersion.setEnabled(False)
+ def onMapJumpDown(self):
+ if self.ui.listMap.count() != 0:
+ idx = self.ui.listMap.currentRow()
+ pk_idx = self.ui.cbxPack.currentIndex()
+ mp_idx = self.ui.cbxMap.currentIndex()
+
+ current_ls = self.map_ls[mp_idx].split(os.sep)[:-1]
+
+ for i in range(len(self.map_ls) - mp_idx):
+ if self.map_ls[mp_idx + i].split(os.sep)[:-1] != current_ls:
+ self.ui.cbxMap.setCurrentIndex(mp_idx + i)
+ self.map_objects[idx].set_map(list(self.current_pack_dict)[pk_idx], self.map_ls[mp_idx + i])
+
+ self.ui.listMap.clear(); self.ui.listMap.addItems(get_map_names(self.map_objects))
+ self.ui.listMap.setCurrentRow(idx)
+ # the most horrible line of code I have ever wrote
+ if Path(f"""{self.settings.value("mainfolderpath")}/MappingPool/{str(pathlib.Path(f"{self.map_objects[idx].pack}/{self.map_objects[idx].map}").parent).replace(os.sep, '/')}/{pathlib.Path(self.map_objects[idx].map).stem} --TN.sfz""").is_file():
+ self.map_objects[idx].change_value("tuned_checkbox", True)
+ self.ui.chkTunedVersion.setEnabled(True)
+ else:
+ self.map_objects[idx].change_value("tuned_checkbox", False)
+ self.ui.chkTunedVersion.setEnabled(False)
+ break
+
+ def onMapJumpUp(self):
+ if self.ui.listMap.count() != 0:
+ idx = self.ui.listMap.currentRow()
+ pk_idx = self.ui.cbxPack.currentIndex()
+ mp_idx = self.ui.cbxMap.currentIndex()
+
+ current_ls = self.map_ls[mp_idx].split(os.sep)[:-1]
+
+ for i in range(mp_idx):
+ if self.map_ls[mp_idx - i].split(os.sep)[:-1] != current_ls:
+ self.ui.cbxMap.setCurrentIndex(mp_idx - i)
+ self.map_objects[idx].set_map(list(self.current_pack_dict)[pk_idx], self.map_ls[mp_idx - i])
+
+ self.ui.listMap.clear(); self.ui.listMap.addItems(get_map_names(self.map_objects))
+ self.ui.listMap.setCurrentRow(idx)
+ # the most horrible line of code I have ever wrote
+ if Path(f"""{self.settings.value("mainfolderpath")}/MappingPool/{str(pathlib.Path(f"{self.map_objects[idx].pack}/{self.map_objects[idx].map}").parent).replace(os.sep, '/')}/{pathlib.Path(self.map_objects[idx].map).stem} --TN.sfz""").is_file():
+ self.map_objects[idx].change_value("tuned_checkbox", True)
+ self.ui.chkTunedVersion.setEnabled(True)
+ else:
+ self.map_objects[idx].change_value("tuned_checkbox", False)
+ self.ui.chkTunedVersion.setEnabled(False)
+ break
+
def onAutoname(self):
idx = self.ui.listMap.currentRow()
self.ui.txtPreset.setText(self.map_objects[idx].get_name_b())
diff --git a/src/ui/mainwindow.ui b/src/ui/mainwindow.ui
index 9b56e8d..424ed3c 100644
--- a/src/ui/mainwindow.ui
+++ b/src/ui/mainwindow.ui
@@ -8,7 +8,7 @@
0
0
1467
- 1163
+ 1203
@@ -11053,6 +11053,26 @@ p, li { white-space: pre-wrap; }
+ -
+
+
+
+ 0
+ 0
+
+
+
+ v
+
+
+
+ -
+
+
+ ^
+
+
+