3737#
3838# ***** END LICENSE BLOCK *****
3939
40- from PyQt4 import QtGui , QtCore
40+ from PyQt6 import QtGui , QtCore , QtWidgets
4141
4242import pyffi .qskope .global_model
4343import pyffi .qskope .detail_model
6161
6262# implementation details:
6363# http://doc.trolltech.com/4.3/qmainwindow.html#details
64- class QSkope (QtGui .QMainWindow ):
64+ class QSkope (QtWidgets .QMainWindow ):
6565 """Main QSkope window."""
6666 def __init__ (self , parent = None ):
6767 """Initialize the main window."""
68- QtGui .QMainWindow .__init__ (self , parent )
68+ QtWidgets .QMainWindow .__init__ (self , parent )
6969
7070 # set up the menu bar
7171 self .createActions ()
7272 self .createMenus ()
7373
7474 # set up the global model view
75- self .globalWidget = QtGui .QTreeView ()
75+ self .globalWidget = QtWidgets .QTreeView ()
7676 self .globalWidget .setAlternatingRowColors (True )
7777
7878 # set up the detail model view
79- self .detailWidget = QtGui .QTreeView ()
79+ self .detailWidget = QtWidgets .QTreeView ()
8080 self .detailDelegate = pyffi .qskope .detail_delegate .DetailDelegate ()
8181 self .detailWidget .setItemDelegate (self .detailDelegate )
8282 self .detailWidget .setAlternatingRowColors (True )
8383
8484 # connect global with detail:
8585 # if object is selected in global view, then show its details in the
8686 # detail view
87- QtCore .QObject .connect (self .globalWidget ,
88- QtCore .SIGNAL ("clicked(const QModelIndex &)" ),
89- self .setDetailModel )
87+ self .globalWidget .clicked .connect (self .setDetailModel )
9088
9189 # set up the central widget
92- self .splitter = QtGui .QSplitter ()
90+ self .splitter = QtWidgets .QSplitter ()
9391 self .splitter .addWidget (self .globalWidget )
9492 self .splitter .addWidget (self .detailWidget )
9593 self .setCentralWidget (self .splitter )
@@ -114,42 +112,30 @@ def createActions(self):
114112 # open a file
115113 self .openAct = QtGui .QAction ("&Open" , self )
116114 self .openAct .setShortcut ("Ctrl+O" )
117- QtCore .QObject .connect (self .openAct ,
118- QtCore .SIGNAL ("triggered()" ),
119- self .openAction )
115+ self .openAct .triggered .connect (self .openAction )
120116
121117 # save a file
122118 self .saveAct = QtGui .QAction ("&Save" , self )
123119 self .saveAct .setShortcut ("Ctrl+S" )
124- QtCore .QObject .connect (self .saveAct ,
125- QtCore .SIGNAL ("triggered()" ),
126- self .saveAction )
120+ self .saveAct .triggered .connect (self .saveAction )
127121
128122 # save a file as ...
129123 self .saveAsAct = QtGui .QAction ("Save As..." , self )
130124 self .saveAsAct .setShortcut ("Ctrl+Shift+S" )
131- QtCore .QObject .connect (self .saveAsAct ,
132- QtCore .SIGNAL ("triggered()" ),
133- self .saveAsAction )
125+ self .saveAsAct .triggered .connect (self .saveAsAction )
134126
135127 # exit
136128 self .exitAct = QtGui .QAction ("E&xit" , self )
137129 self .exitAct .setShortcut ("Ctrl+Q" )
138- QtCore .QObject .connect (self .exitAct ,
139- QtCore .SIGNAL ("triggered()" ),
140- QtGui .qApp .quit )
130+ self .exitAct .triggered .connect (QtWidgets .QApplication .quit )
141131
142132 # tell something about QSkope
143133 self .aboutQSkopeAct = QtGui .QAction ("About QSkope" , self )
144- QtCore .QObject .connect (self .aboutQSkopeAct ,
145- QtCore .SIGNAL ("triggered()" ),
146- self .aboutQSkopeAction )
134+ self .aboutQSkopeAct .triggered .connect (self .aboutQSkopeAction )
147135
148136 # tell something about Qt
149137 self .aboutQtAct = QtGui .QAction ("About Qt" , self )
150- QtCore .QObject .connect (self .aboutQtAct ,
151- QtCore .SIGNAL ("triggered()" ),
152- QtGui .qApp .aboutQt )
138+ self .aboutQtAct .triggered .connect (QtWidgets .QApplication .aboutQt )
153139
154140 # implementation details:
155141 # http://doc.trolltech.com/4.3/mainwindows-menus.html
@@ -172,7 +158,7 @@ def closeEvent(self, event):
172158 """Called when the application is closed. Saves the settings."""
173159 settings = self .getSettings (versioned = True )
174160 settings .setValue ("MainWindow/geometry" , self .saveGeometry ())
175- QtGui .QMainWindow .closeEvent (self , event )
161+ QtWidgets .QMainWindow .closeEvent (self , event )
176162
177163
178164 #
@@ -294,15 +280,15 @@ def openAction(self):
294280 """Open a file."""
295281 # wrapper around openFile
296282 # (displays an extra file dialog)
297- filename = QtGui .QFileDialog .getOpenFileName (self , "Open File" )
283+ filename = QtWidgets .QFileDialog .getOpenFileName (self , "Open File" )
298284 if filename :
299285 self .openFile (filename = filename )
300286
301287 def saveAsAction (self ):
302288 """Save a file."""
303289 # wrapper around saveAction
304290 # (displays an extra file dialog)
305- filename = QtGui .QFileDialog .getSaveFileName (self , "Save File" )
291+ filename = QtWidgets .QFileDialog .getSaveFileName (self , "Save File" )
306292 if filename :
307293 self .fileName = filename
308294 self .saveAction ()
@@ -317,7 +303,7 @@ def saveAction(self):
317303 def aboutQSkopeAction (self ):
318304 """Display an information window about QSkope."""
319305 # create the box
320- mbox = QtGui .QMessageBox (self )
306+ mbox = QtWidgets .QMessageBox (self )
321307 # set window title and window text
322308 mbox .setWindowTitle ("About QSkope" )
323309 mbox .setText ("""
@@ -336,4 +322,4 @@ def aboutQSkopeAction(self):
336322<a href="https://github.com/niftools/pyffi/releases">
337323PyFFI Github Releases page</a>.""" % pyffi .__version__ )
338324 # display the window
339- mbox .exec_ ()
325+ mbox .exec ()
0 commit comments