Basically I have a launcher type deal for an application goin on with pyside2 / pyqt in the latest version of python. Upon a button press in the launcher I want it to close the current window class and open the next window(which has its own class). While doing this I would like it to pass a filename to the new window(basically, tell it which file to open). This is the part that I'm struggling with. The following code snippets are a snippet of what I have so far that I felt was important to better help explain the question!
class launcherWidget( QMainWindow ) :
def __init__(self) :
#header
QMainWindow.__init__(self)
self.setWindowTitle("Scouting Software Launcher")
#main central table
self.table = QTableWidget(self)
self.table.setColumnCount(3)
self.table.setHorizontalHeaderLabels(["Save Name", "Mod Date","Creation Date"])
self.table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
self.table.setSelectionBehavior(QAbstractItemView.SelectRows)
self.table.verticalHeader().setVisible(False)
self.fill_table_with_list( listOfSavesLists )
self.table.resize(470,165)
self.table.move(15,50)
self.b4 = QPushButton("Open",self)
self.b4.clicked.connect(self.openSelected) #wip
self.b4.resize(70,25)
self.b4.move(340,225)
self.b5 = QPushButton("View",self)
self.b5.clicked.connect(self.viewSelected) #wip
self.b5.resize(70,25)
self.b5.move(420,225)
def viewSelected ( self ) :
print("placeholder") #THIS POINT TO CALL NEXT FUNCTION (I want to send a string)
def openSelected ( self ) :
print("placeholder")
@Slot()
def exit_app(self, checked):
QApplication.quit()
class viewWindow( QMainWindow ) :
def __init__( self , savename ) : #STRING TRANSFERED = savename
#header
QMainWindow.__init__(self)
self.setWindowTitle("Scouting Software Viewer")
self.openSaveName = str(savename) #deal with arg
@Slot()
def exit_app(self, checked) : #on exit, shutdown properly
QApplication.quit()
def onLaunch () :
app = QApplication(sys.argv)
window = launcherWidget()
window.resize(500,300)
window.show()
sys.exit(app.exec_())