Skip to content

Commit b46079c

Browse files
argilowillcode
authored andcommitted
filter: Update QMessageBox to work in Qt5
Signed-off-by: Clayton Smith <[email protected]>
1 parent d547826 commit b46079c

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

gr-filter/python/filter/design/fir_design.py

+31-31
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import scipy
1010
from gnuradio import filter, fft
11-
from PyQt5 import QtGui
11+
from PyQt5 import QtGui, QtWidgets
1212

1313

1414
# Filter design functions using a window
@@ -28,8 +28,8 @@ def design_win_lpf(fs, gain, wintype, mainwin):
2828
taps = filter.firdes.low_pass_2(gain, fs, pb, tb,
2929
atten, wintype)
3030
except (RuntimeError, IndexError) as e:
31-
reply = QtGui.QMessageBox.information(mainwin, "Runtime Error",
32-
e.args[0], QtGui.QMessageBox.Ok)
31+
reply = QtWidgets.QMessageBox.information(mainwin, "Runtime Error",
32+
e.args[0], QtWidgets.QMessageBox.Ok)
3333
return ([], [], ret)
3434
else:
3535
params = {"fs": fs, "gain": gain, "wintype": wintype,
@@ -56,8 +56,8 @@ def design_win_bpf(fs, gain, wintype, mainwin):
5656
taps = filter.firdes.band_pass_2(gain, fs, pb1, pb2, tb,
5757
atten, wintype)
5858
except RuntimeError as e:
59-
reply = QtGui.QMessageBox.information(mainwin, "Runtime Error",
60-
e.args[0], QtGui.QMessageBox.Ok)
59+
reply = QtWidgets.QMessageBox.information(mainwin, "Runtime Error",
60+
e.args[0], QtWidgets.QMessageBox.Ok)
6161
return ([], [], ret)
6262
else:
6363
params = {"fs": fs, "gain": gain, "wintype": wintype,
@@ -84,8 +84,8 @@ def design_win_cbpf(fs, gain, wintype, mainwin):
8484
taps = filter.firdes.complex_band_pass_2(gain, fs, pb1, pb2, tb,
8585
atten, wintype)
8686
except RuntimeError as e:
87-
reply = QtGui.QMessageBox.information(mainwin, "Runtime Error",
88-
e.args[0], QtGui.QMessageBox.Ok)
87+
reply = QtWidgets.QMessageBox.information(mainwin, "Runtime Error",
88+
e.args[0], QtWidgets.QMessageBox.Ok)
8989
return ([], [], ret)
9090
else:
9191
params = {"fs": fs, "gain": gain, "wintype": wintype,
@@ -112,8 +112,8 @@ def design_win_bnf(fs, gain, wintype, mainwin):
112112
taps = filter.firdes.band_reject_2(gain, fs, pb1, pb2, tb,
113113
atten, wintype)
114114
except RuntimeError as e:
115-
reply = QtGui.QMessageBox.information(mainwin, "Runtime Error",
116-
e.args[0], QtGui.QMessageBox.Ok)
115+
reply = QtWidgets.QMessageBox.information(mainwin, "Runtime Error",
116+
e.args[0], QtWidgets.QMessageBox.Ok)
117117
return ([], [], ret)
118118
else:
119119
params = {"fs": fs, "gain": gain, "wintype": wintype,
@@ -139,8 +139,8 @@ def design_win_hpf(fs, gain, wintype, mainwin):
139139
taps = filter.firdes.high_pass_2(gain, fs, pb, tb,
140140
atten, wintype)
141141
except RuntimeError as e:
142-
reply = QtGui.QMessageBox.information(mainwin, "Runtime Error",
143-
e.args[0], QtGui.QMessageBox.Ok)
142+
reply = QtWidgets.QMessageBox.information(mainwin, "Runtime Error",
143+
e.args[0], QtWidgets.QMessageBox.Ok)
144144
else:
145145
params = {"fs": fs, "gain": gain, "wintype": wintype,
146146
"filttype": "hpf", "sbend": sb, "pbstart": pb,
@@ -164,8 +164,8 @@ def design_win_hb(fs, gain, wintype, mainwin):
164164
fft.window.WIN_BLACKMAN_hARRIS: 'blackmanharris'}
165165

166166
if int(filtord) & 1:
167-
reply = QtGui.QMessageBox.information(mainwin, "Filter order should be even",
168-
"Filter order should be even", QtGui.QMessageBox.Ok)
167+
reply = QtWidgets.QMessageBox.information(mainwin, "Filter order should be even",
168+
"Filter order should be even", QtWidgets.QMessageBox.Ok)
169169
return ([], [], False)
170170

171171
if(ret):
@@ -193,8 +193,8 @@ def design_win_rrc(fs, gain, wintype, mainwin):
193193
taps = filter.firdes.root_raised_cosine(gain, fs, sr,
194194
alpha, ntaps)
195195
except RuntimeError as e:
196-
reply = QtGui.QMessageBox.information(mainwin, "Runtime Error",
197-
e.args[0], QtGui.QMessageBox.Ok)
196+
reply = QtWidgets.QMessageBox.information(mainwin, "Runtime Error",
197+
e.args[0], QtWidgets.QMessageBox.Ok)
198198
else:
199199
params = {"fs": fs, "gain": gain, "wintype": wintype,
200200
"filttype": "rrc", "srate": sr, "alpha": alpha,
@@ -219,8 +219,8 @@ def design_win_gaus(fs, gain, wintype, mainwin):
219219
taps = filter.firdes.gaussian(gain, spb, bt, ntaps)
220220

221221
except RuntimeError as e:
222-
reply = QtGui.QMessageBox.information(mainwin, "Runtime Error",
223-
e.args[0], QtGui.QMessageBox.Ok)
222+
reply = QtWidgets.QMessageBox.information(mainwin, "Runtime Error",
223+
e.args[0], QtWidgets.QMessageBox.Ok)
224224
else:
225225
params = {"fs": fs, "gain": gain, "wintype": wintype,
226226
"filttype": "gaus", "srate": sr, "bt": bt,
@@ -247,8 +247,8 @@ def design_opt_lpf(fs, gain, mainwin):
247247
taps = filter.optfir.low_pass(gain, fs, pb, sb,
248248
ripple, atten)
249249
except RuntimeError as e:
250-
reply = QtGui.QMessageBox.information(mainwin, "Filter did not converge",
251-
e.args[0], QtGui.QMessageBox.Ok)
250+
reply = QtWidgets.QMessageBox.information(mainwin, "Filter did not converge",
251+
e.args[0], QtWidgets.QMessageBox.Ok)
252252
return ([], [], False)
253253
else:
254254
params = {"fs": fs, "gain": gain, "wintype": mainwin.EQUIRIPPLE_FILT,
@@ -279,8 +279,8 @@ def design_opt_bpf(fs, gain, mainwin):
279279
taps = filter.optfir.band_pass(gain, fs, sb1, pb1, pb2, sb2,
280280
ripple, atten)
281281
except RuntimeError as e:
282-
reply = QtGui.QMessageBox.information(mainwin, "Filter did not converge",
283-
e.args[0], QtGui.QMessageBox.Ok)
282+
reply = QtWidgets.QMessageBox.information(mainwin, "Filter did not converge",
283+
e.args[0], QtWidgets.QMessageBox.Ok)
284284
return ([], [], False)
285285

286286
else:
@@ -313,8 +313,8 @@ def design_opt_cbpf(fs, gain, mainwin):
313313
taps = filter.optfir.complex_band_pass(gain, fs, sb1, pb1, pb2, sb2,
314314
ripple, atten)
315315
except RuntimeError as e:
316-
reply = QtGui.QMessageBox.information(mainwin, "Filter did not converge",
317-
e.args[0], QtGui.QMessageBox.Ok)
316+
reply = QtWidgets.QMessageBox.information(mainwin, "Filter did not converge",
317+
e.args[0], QtWidgets.QMessageBox.Ok)
318318
return ([], [], False)
319319
else:
320320
params = {"fs": fs, "gain": gain, "wintype": mainwin.EQUIRIPPLE_FILT,
@@ -346,8 +346,8 @@ def design_opt_bnf(fs, gain, mainwin):
346346
taps = filter.optfir.band_reject(gain, fs, pb1, sb1, sb2, pb2,
347347
ripple, atten)
348348
except RuntimeError as e:
349-
reply = QtGui.QMessageBox.information(mainwin, "Filter did not converge",
350-
e.args[0], QtGui.QMessageBox.Ok)
349+
reply = QtWidgets.QMessageBox.information(mainwin, "Filter did not converge",
350+
e.args[0], QtWidgets.QMessageBox.Ok)
351351
return ([], [], False)
352352
else:
353353
params = {"fs": fs, "gain": gain, "wintype": mainwin.EQUIRIPPLE_FILT,
@@ -366,8 +366,8 @@ def design_opt_hb(fs, gain, mainwin):
366366
trwidth, r = getfloat(mainwin.gui.firhbtrEdit.text())
367367
ret = r and ret
368368
if int(filtord) & 1:
369-
reply = QtGui.QMessageBox.information(mainwin, "Filter order should be even",
370-
"Filter order should be even", QtGui.QMessageBox.Ok)
369+
reply = QtWidgets.QMessageBox.information(mainwin, "Filter order should be even",
370+
"Filter order should be even", QtWidgets.QMessageBox.Ok)
371371
return ([], [], False)
372372

373373
if(ret):
@@ -376,8 +376,8 @@ def design_opt_hb(fs, gain, mainwin):
376376
taps = scipy.signal.remez(int(filtord) + 1, bands, [1, 0], [1, 1])
377377
taps[abs(taps) <= 1e-6] = 0.
378378
except RuntimeError as e:
379-
reply = QtGui.QMessageBox.information(mainwin, "Filter Design Error",
380-
e.args[0], QtGui.QMessageBox.Ok)
379+
reply = QtWidgets.QMessageBox.information(mainwin, "Filter Design Error",
380+
e.args[0], QtWidgets.QMessageBox.Ok)
381381
return ([], [], False)
382382
else:
383383
params = {"fs": fs, "gain": gain, "wintype": mainwin.EQUIRIPPLE_FILT,
@@ -403,8 +403,8 @@ def design_opt_hpf(fs, gain, mainwin):
403403
taps = filter.optfir.high_pass(gain, fs, sb, pb,
404404
atten, ripple)
405405
except RuntimeError as e:
406-
reply = QtGui.QMessageBox.information(mainwin, "Filter did not converge",
407-
e.args[0], QtGui.QMessageBox.Ok)
406+
reply = QtWidgets.QMessageBox.information(mainwin, "Filter did not converge",
407+
e.args[0], QtWidgets.QMessageBox.Ok)
408408
return ([], [], False)
409409
else:
410410
params = {"fs": fs, "gain": gain, "wintype": mainwin.EQUIRIPPLE_FILT,

0 commit comments

Comments
 (0)