30
30
import shutil
31
31
import sys
32
32
33
- from PyQt4 import QtCore , QtGui
33
+ from matplotlib . backends . qt_compat import QtCore , QtGui , QtWidgets
34
34
35
35
36
36
# matplotlib stores the baseline images under two separate subtrees,
49
49
exts = ['pdf' , 'svg' ]
50
50
51
51
52
- class Thumbnail (QtGui .QFrame ):
52
+ class Thumbnail (QtWidgets .QFrame ):
53
53
"""
54
54
Represents one of the three thumbnails at the top of the window.
55
55
"""
@@ -59,14 +59,14 @@ def __init__(self, parent, index, name):
59
59
self .parent = parent
60
60
self .index = index
61
61
62
- layout = QtGui .QVBoxLayout ()
62
+ layout = QtWidgets .QVBoxLayout ()
63
63
64
- label = QtGui .QLabel (name )
64
+ label = QtWidgets .QLabel (name )
65
65
label .setAlignment (QtCore .Qt .AlignHCenter |
66
66
QtCore .Qt .AlignVCenter )
67
67
layout .addWidget (label , 0 )
68
68
69
- self .image = QtGui .QLabel ()
69
+ self .image = QtWidgets .QLabel ()
70
70
self .image .setAlignment (QtCore .Qt .AlignHCenter |
71
71
QtCore .Qt .AlignVCenter )
72
72
self .image .setMinimumSize (800 / 3 , 600 / 3 )
@@ -77,7 +77,7 @@ def mousePressEvent(self, ev):
77
77
self .parent .set_large_image (self .index )
78
78
79
79
80
- class ListWidget (QtGui .QListWidget ):
80
+ class ListWidget (QtWidgets .QListWidget ):
81
81
"""
82
82
The list of files on the left-hand side
83
83
"""
@@ -107,7 +107,7 @@ def eventFilter(self, receiver, event):
107
107
return super (EventFilter , self ).eventFilter (receiver , event )
108
108
109
109
110
- class Dialog (QtGui .QDialog ):
110
+ class Dialog (QtWidgets .QDialog ):
111
111
"""
112
112
The main dialog window.
113
113
"""
@@ -126,36 +126,36 @@ def __init__(self, entries):
126
126
for entry in entries :
127
127
self .filelist .addItem (entry .display )
128
128
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 ()
133
133
self .thumbnails = []
134
134
for i , name in enumerate (('test' , 'expected' , 'diff' )):
135
135
thumbnail = Thumbnail (self , i , name )
136
136
thumbnails_layout .addWidget (thumbnail )
137
137
self .thumbnails .append (thumbnail )
138
138
thumbnails_box .setLayout (thumbnails_layout )
139
- self .image_display = QtGui .QLabel ()
139
+ self .image_display = QtWidgets .QLabel ()
140
140
self .image_display .setAlignment (QtCore .Qt .AlignHCenter |
141
141
QtCore .Qt .AlignVCenter )
142
142
self .image_display .setMinimumSize (800 , 600 )
143
143
images_layout .addWidget (thumbnails_box , 3 )
144
144
images_layout .addWidget (self .image_display , 6 )
145
145
images_box .setLayout (images_layout )
146
146
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)" )
150
150
accept_button .clicked .connect (self .accept_test )
151
151
buttons_layout .addWidget (accept_button )
152
- reject_button = QtGui .QPushButton ("Reject (R)" )
152
+ reject_button = QtWidgets .QPushButton ("Reject (R)" )
153
153
reject_button .clicked .connect (self .reject_test )
154
154
buttons_layout .addWidget (reject_button )
155
155
buttons_box .setLayout (buttons_layout )
156
156
images_layout .addWidget (buttons_box )
157
157
158
- main_layout = QtGui .QHBoxLayout ()
158
+ main_layout = QtWidgets .QHBoxLayout ()
159
159
main_layout .addWidget (self .filelist , 3 )
160
160
main_layout .addWidget (images_box , 6 )
161
161
@@ -358,7 +358,7 @@ def launch(result_images, source):
358
358
print ("No failed tests" )
359
359
sys .exit (0 )
360
360
361
- app = QtGui .QApplication (sys .argv )
361
+ app = QtWidgets .QApplication (sys .argv )
362
362
dialog = Dialog (entries )
363
363
dialog .show ()
364
364
filter = EventFilter (dialog )
0 commit comments