I have created a subclass for an option to Open File. Alongside PYQT5, I have imported the python library Mido & py-midi in order to read the MIDI files. If my logic is correct. I will use PYQT5's FileDialog in order to retrieve a file, assign it to a variable and then use Mido to read that said MIDI file when I Will then use py-midi to edit these files
class OpenDialog(QFileDialog):
def __init__(self, *args, **kwargs):
super(OpenDialog, self).__init__(*args, **kwargs)
self.setWindowTitle("Open")
self.setFixedSize(1000, 450)
buttons = QDialogButtonBox.Open | QDialogButtonBox.Cancel
self.buttonBox = QDialogButtonBox(buttons)
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.rejected.connect(self.reject)
self.layout = QVBoxLayout()
self.layout.addWidget(self.buttonBox)
self.setLayout(self.layout)
# OpenedFile =
I have commented out OpenedFile becuase i plan to use this as a variable to link to the opened files. However, I am unsure how this can be done in PYQ5. Furthermore, how to do this with a specific file extension.