diff options
author | Eddy Pedroni <eddy@0xf7.com> | 2021-12-22 20:01:14 +0100 |
---|---|---|
committer | Eddy Pedroni <eddy@0xf7.com> | 2021-12-22 20:01:14 +0100 |
commit | 5f7e75ae1e53d3833114880d20e899629d21e31a (patch) | |
tree | c2e81546b5befc8bfa90ebfd44505ebdcdfefce2 | |
parent | 9436fbcb4994779fe1d9a56fc167420eead8a9b7 (diff) |
Improvements, file name display
-rw-r--r-- | solo_tool_qt.py | 12 |
1 files 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") |