3030import shutil
3131import sys
3232
33- from PyQt4 import QtCore , QtGui
33+ from matplotlib . backends . qt_compat import QtCore , QtGui , QtWidgets
3434
3535
3636# matplotlib stores the baseline images under two separate subtrees,
4949exts = ['pdf' , 'svg' ]
5050
5151
52- class Thumbnail (QtGui .QFrame ):
52+ class Thumbnail (QtWidgets .QFrame ):
5353 """
5454 Represents one of the three thumbnails at the top of the window.
5555 """
@@ -59,14 +59,14 @@ def __init__(self, parent, index, name):
5959 self .parent = parent
6060 self .index = index
6161
62- layout = QtGui .QVBoxLayout ()
62+ layout = QtWidgets .QVBoxLayout ()
6363
64- label = QtGui .QLabel (name )
64+ label = QtWidgets .QLabel (name )
6565 label .setAlignment (QtCore .Qt .AlignHCenter |
6666 QtCore .Qt .AlignVCenter )
6767 layout .addWidget (label , 0 )
6868
69- self .image = QtGui .QLabel ()
69+ self .image = QtWidgets .QLabel ()
7070 self .image .setAlignment (QtCore .Qt .AlignHCenter |
7171 QtCore .Qt .AlignVCenter )
7272 self .image .setMinimumSize (800 / 3 , 600 / 3 )
@@ -77,7 +77,7 @@ def mousePressEvent(self, ev):
7777 self .parent .set_large_image (self .index )
7878
7979
80- class ListWidget (QtGui .QListWidget ):
80+ class ListWidget (QtWidgets .QListWidget ):
8181 """
8282 The list of files on the left-hand side
8383 """
@@ -107,7 +107,7 @@ def eventFilter(self, receiver, event):
107107 return super (EventFilter , self ).eventFilter (receiver , event )
108108
109109
110- class Dialog (QtGui .QDialog ):
110+ class Dialog (QtWidgets .QDialog ):
111111 """
112112 The main dialog window.
113113 """
@@ -126,36 +126,36 @@ def __init__(self, entries):
126126 for entry in entries :
127127 self .filelist .addItem (entry .display )
128128
129- images_box = QtGui .QWidget ()
130- images_layout = QtGui .QVBoxLayout ()
131- thumbnails_box = QtGui .QWidget ()
132- thumbnails_layout = QtGui .QHBoxLayout ()
129+ images_box = QtWidgets .QWidget ()
130+ images_layout = QtWidgets .QVBoxLayout ()
131+ thumbnails_box = QtWidgets .QWidget ()
132+ thumbnails_layout = QtWidgets .QHBoxLayout ()
133133 self .thumbnails = []
134134 for i , name in enumerate (('test' , 'expected' , 'diff' )):
135135 thumbnail = Thumbnail (self , i , name )
136136 thumbnails_layout .addWidget (thumbnail )
137137 self .thumbnails .append (thumbnail )
138138 thumbnails_box .setLayout (thumbnails_layout )
139- self .image_display = QtGui .QLabel ()
139+ self .image_display = QtWidgets .QLabel ()
140140 self .image_display .setAlignment (QtCore .Qt .AlignHCenter |
141141 QtCore .Qt .AlignVCenter )
142142 self .image_display .setMinimumSize (800 , 600 )
143143 images_layout .addWidget (thumbnails_box , 3 )
144144 images_layout .addWidget (self .image_display , 6 )
145145 images_box .setLayout (images_layout )
146146
147- buttons_box = QtGui .QWidget ()
148- buttons_layout = QtGui .QHBoxLayout ()
149- accept_button = QtGui .QPushButton ("Accept (A)" )
147+ buttons_box = QtWidgets .QWidget ()
148+ buttons_layout = QtWidgets .QHBoxLayout ()
149+ accept_button = QtWidgets .QPushButton ("Accept (A)" )
150150 accept_button .clicked .connect (self .accept_test )
151151 buttons_layout .addWidget (accept_button )
152- reject_button = QtGui .QPushButton ("Reject (R)" )
152+ reject_button = QtWidgets .QPushButton ("Reject (R)" )
153153 reject_button .clicked .connect (self .reject_test )
154154 buttons_layout .addWidget (reject_button )
155155 buttons_box .setLayout (buttons_layout )
156156 images_layout .addWidget (buttons_box )
157157
158- main_layout = QtGui .QHBoxLayout ()
158+ main_layout = QtWidgets .QHBoxLayout ()
159159 main_layout .addWidget (self .filelist , 3 )
160160 main_layout .addWidget (images_box , 6 )
161161
@@ -358,7 +358,7 @@ def launch(result_images, source):
358358 print ("No failed tests" )
359359 sys .exit (0 )
360360
361- app = QtGui .QApplication (sys .argv )
361+ app = QtWidgets .QApplication (sys .argv )
362362 dialog = Dialog (entries )
363363 dialog .show ()
364364 filter = EventFilter (dialog )
0 commit comments