Skip to content
Snippets Groups Projects
Commit b595d3ad authored by Garrett Bates's avatar Garrett Bates
Browse files

Added concrete class for main UI window, added stubs for slots + implementation of file selection.

parent b0414856
No related branches found
No related tags found
1 merge request!3Main UI and miscellaneous associated widgets
import sys
from PySide2 import QtCore, QtGui, QtWidgets
from main_ui import Ui_MainWindow
class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
"""
Implements the core logic for the Ui_MainWindow class
produced by Qt Designer. Any custom slots / signals
should be implemented in this class. Any modifications to
Ui_MainWindow *will* be lost if the UI is ever updated in
Qt Designer.
"""
def __init__(self, parent=None):
super().__init__(parent)
self.setupUi(self)
@QtCore.Slot()
def readSelectedFile(self):
print('Reading currently selected file.')
@QtCore.Slot()
def stopFileRead(self):
print('Abandoning file read.')
@QtCore.Slot()
def writePSFile(self):
print('Writing PS file.')
@QtCore.Slot()
def reloadFile(self):
print('Reloading last file.')
@QtCore.Slot(str)
def changeCurrentDirectory(self, path=''):
fd = QtWidgets.QFileDialog(self)
fd.setFileMode(QtWidgets.QFileDialog.Directory)
fd.exec_()
new_path = fd.selectedFiles()[0]
self.currentDirectoryChanged.emit(new_path)
currentDirectoryChanged = QtCore.Signal(str)
if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
wnd = MainWindow()
wnd.show()
sys.exit(app.exec_())
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment