From 5f7e75ae1e53d3833114880d20e899629d21e31a Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Wed, 22 Dec 2021 20:01:14 +0100 Subject: Improvements, file name display --- solo_tool_qt.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/solo_tool_qt.py b/solo_tool_qt.py index 14c0fe1..71e2f82 100644 --- a/solo_tool_qt.py +++ b/solo_tool_qt.py @@ -15,7 +15,10 @@ class PlaylistModel(QAbstractListModel): def data(self, index, role): if role == Qt.DisplayRole: - return self.soloTool.getSongs()[index.row()] + from pathlib import Path + path = Path(self.soloTool.getSongs()[index.row()]) + return path.name + def rowCount(self, index): return len(self.soloTool.getSongs()) @@ -65,8 +68,8 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.saveSessionButton.pressed.connect(self.saveSession) self.loadSessionButton.pressed.connect(self.loadSession) self.addSongButton.pressed.connect(self.addSong) - #self.initMidiButton.pressed.connect() self.abRepeatCheckBox.clicked.connect(self.toggleAbRepeat) + #self.initMidiButton.pressed.connect() self.timer.start() self.show() @@ -93,12 +96,12 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.soloTool.setAbLimitEnable(enable) def saveSession(self): - path, _ = QFileDialog.getSaveFileName(self, "Open file", "", "session file (*.json);All files (*.*)") + path, _ = QFileDialog.getSaveFileName(self, "Open file", "", "session file (*.json)") if path: self.soloTool.saveSession(path) def loadSession(self): - path, _ = QFileDialog.getOpenFileName(self, "Open file", "", "session file (*.json);All files (*.*)") + path, _ = QFileDialog.getOpenFileName(self, "Open file", "", "session file (*.json)") if path: self.soloTool.loadSession(path) self.playlistModel.layoutChanged.emit() @@ -128,7 +131,6 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.aSlider.setValue(int(ab[0] * POSITION_FACTOR)) self.bSlider.setValue(int(ab[1] * POSITION_FACTOR)) - if __name__ == '__main__': app = QApplication([]) app.setApplicationName("Solo Tool") -- cgit v1.2.3