diff --git a/examples/example-plugin/ExampleWidget.py b/examples/example-plugin/ExampleWidget.py index 7743becd..6ead06f8 100644 --- a/examples/example-plugin/ExampleWidget.py +++ b/examples/example-plugin/ExampleWidget.py @@ -29,20 +29,20 @@ def __init__(self, **kwargs): group="Examples", **kwargs) def init_ui(self): - layout = QtGui.QVBoxLayout() + layout = QtWidgets.QVBoxLayout() self.setLayout(layout) - hbox = QtGui.QHBoxLayout() - hbox.addWidget(QtGui.QLabel('Example Plugin Widget')) + hbox = QtWidgets.QHBoxLayout() + hbox.addWidget(QtWidgets.QLabel('Example Plugin Widget')) hbox.addStretch(1) hbox.addWidget(BatchButton(self)) hbox.addWidget(HelpButton(self, "example_plugin")) layout.addLayout(hbox) - desc = QtGui.QLabel(DESC) + desc = QtWidgets.QLabel(DESC) desc.setWordWrap(True) layout.addWidget(desc) - layout.addWidget(QtGui.QLabel("")) + layout.addWidget(QtWidgets.QLabel("")) def activate(self): self.ivm.sig_all_data.connect(self.data_changed) @@ -64,15 +64,15 @@ def __init__(self, **kwargs): super(ExampleWidget, self).__init__(name="Threshold", desc="Threshold data", icon="quantiphyse", **kwargs) def init_ui(self): - main_vbox = QtGui.QVBoxLayout() + main_vbox = QtWidgets.QVBoxLayout() - hbox = QtGui.QHBoxLayout() - hbox.addWidget(QtGui.QLabel('Threshold volume')) + hbox = QtWidgets.QHBoxLayout() + hbox.addWidget(QtWidgets.QLabel('Threshold volume')) hbox.addStretch(1) hbox.addWidget(HelpButton(self)) main_vbox.addLayout(hbox) - explanation = QtGui.QLabel('This is a basic example of a \n' + explanation = QtWidgets.QLabel('This is a basic example of a \n' 'widget for development purposes. \n' 'A DCE-MRI image and ROI are \n' 'loaded normally and clicking run \n' @@ -80,21 +80,21 @@ def init_ui(self): 'in the ROI above a defined threshold.') main_vbox.addWidget(explanation) - hbox = QtGui.QHBoxLayout() - self.b1 = QtGui.QPushButton('Process', self) + hbox = QtWidgets.QHBoxLayout() + self.b1 = QtWidgets.QPushButton('Process', self) self.b1.clicked.connect(self.run_threshold) hbox.addWidget(self.b1) hbox.addStretch(1) - hbox.addWidget(QtGui.QLabel('ROI threshold value:')) - self.val_t1 = QtGui.QLineEdit('1', self) + hbox.addWidget(QtWidgets.QLabel('ROI threshold value:')) + self.val_t1 = QtWidgets.QLineEdit('1', self) hbox.addWidget(self.val_t1) main_vbox.addLayout(hbox) - hbox = QtGui.QHBoxLayout() + hbox = QtWidgets.QHBoxLayout() hbox.addStretch(1) - hbox.addWidget(QtGui.QLabel('Slice to threshold:')) - self.val_s1 = QtGui.QLineEdit('0', self) + hbox.addWidget(QtWidgets.QLabel('Slice to threshold:')) + self.val_s1 = QtWidgets.QLineEdit('0', self) hbox.addWidget(self.val_s1) main_vbox.addLayout(hbox) diff --git a/quantiphyse/gui/dialogs.py b/quantiphyse/gui/dialogs.py index d162cfa3..558a9f0e 100644 --- a/quantiphyse/gui/dialogs.py +++ b/quantiphyse/gui/dialogs.py @@ -45,9 +45,9 @@ def error_dialog(msg, title="Warning", detail=None, subtitle="Details:"): detail_str = detail_str.replace(os.linesep, "
") text += "

%s

%s" % (subtitle, detail_str) - QtGui.QMessageBox.warning(MAINWIN, title, text, QtGui.QMessageBox.Close) + QtWidgets.QMessageBox.warning(MAINWIN, title, text, QtWidgets.QMessageBox.Close) -class MultiTextViewerDialog(QtGui.QDialog): +class MultiTextViewerDialog(QtWidgets.QDialog): """ Text viewer dialog with multiple pages presented as tabs @@ -58,9 +58,9 @@ class MultiTextViewerDialog(QtGui.QDialog): def __init__(self, parent, title="Log", pages=()): super(MultiTextViewerDialog, self).__init__(parent) self.setWindowTitle(title) - vbox = QtGui.QVBoxLayout() + vbox = QtWidgets.QVBoxLayout() - self.tabs = QtGui.QTabWidget() + self.tabs = QtWidgets.QTabWidget() self._browsers = {} for heading, content in pages: browser = self._text_browser(content) @@ -69,12 +69,12 @@ def __init__(self, parent, title="Log", pages=()): vbox.addWidget(self.tabs) - hbox = QtGui.QHBoxLayout() - self.copy_btn = QtGui.QPushButton("Copy") + hbox = QtWidgets.QHBoxLayout() + self.copy_btn = QtWidgets.QPushButton("Copy") self.copy_btn.clicked.connect(self._copy) hbox.addWidget(self.copy_btn) hbox.addStretch(1) - self.button_box = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok) + self.button_box = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok) self.button_box.accepted.connect(self.close) hbox.addWidget(self.button_box) vbox.addLayout(hbox) @@ -100,13 +100,13 @@ def setText(self, heading, content): scrollbar.setValue(original_pos) def _text_browser(self, content): - browser = QtGui.QTextBrowser() + browser = QtWidgets.QTextBrowser() browser.setFontFamily("Courier") browser.setText(content) return browser def _copy(self): - clipboard = QtGui.QApplication.clipboard() + clipboard = QtWidgets.QApplication.clipboard() clipboard.setText(self.tabs.currentWidget().toPlainText()) class TextViewerDialog(MultiTextViewerDialog): @@ -126,7 +126,7 @@ def text(self): def text(self, newtext): self.setText("", newtext) -class MatrixViewerDialog(QtGui.QDialog): +class MatrixViewerDialog(QtWidgets.QDialog): """ Dialog box enabling a read-only viewing of a number matrix """ @@ -134,18 +134,18 @@ class MatrixViewerDialog(QtGui.QDialog): def __init__(self, parent, vals, title="Data", text=""): super(MatrixViewerDialog, self).__init__(parent) self.setWindowTitle(title) - vbox = QtGui.QVBoxLayout() + vbox = QtWidgets.QVBoxLayout() - self.table = QtGui.QTableWidget(len(vals), len(vals[0])) + self.table = QtWidgets.QTableWidget(len(vals), len(vals[0])) vbox.addWidget(self.table) for row, rvals in enumerate(vals): for col, val in enumerate(rvals): - self.table.setItem(row, col, QtGui.QTableWidgetItem(str(val))) + self.table.setItem(row, col, QtWidgets.QTableWidgetItem(str(val))) - self.text = QtGui.QLabel(text) + self.text = QtWidgets.QLabel(text) vbox.addWidget(self.text) - self.button_box = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel) + self.button_box = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel) self.button_box.accepted.connect(self.accept) self.button_box.rejected.connect(self.reject) vbox.addWidget(self.button_box) @@ -153,7 +153,7 @@ def __init__(self, parent, vals, title="Data", text=""): self.setLayout(vbox) self.resize(500, 500) -class GridEditDialog(QtGui.QDialog): +class GridEditDialog(QtWidgets.QDialog): """ Dialog box enabling a numerical matrix to be edited """ @@ -161,28 +161,28 @@ class GridEditDialog(QtGui.QDialog): def __init__(self, parent, vals, col_headers=None, row_headers=None, title="Data", text="", expandable=(True, True)): super(GridEditDialog, self).__init__(parent) self.setWindowTitle(title) - vbox = QtGui.QVBoxLayout() + vbox = QtWidgets.QVBoxLayout() from .widgets import NumberGrid # prevent circular import dependency self.table = NumberGrid(vals, col_headers=col_headers, row_headers=row_headers, expandable=expandable) self.table.sig_changed.connect(self._validate) vbox.addWidget(self.table) - self.text = QtGui.QLabel(text) + self.text = QtWidgets.QLabel(text) vbox.addWidget(self.text) - self.button_box = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel) + self.button_box = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel) self.button_box.accepted.connect(self.accept) self.button_box.rejected.connect(self.reject) - self.button_box.button(QtGui.QDialogButtonBox.Ok).setEnabled(False) + self.button_box.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(False) vbox.addWidget(self.button_box) self.setLayout(vbox) def _validate(self): - self.button_box.button(QtGui.QDialogButtonBox.Ok).setEnabled(self.table.valid()) + self.button_box.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(self.table.valid()) -class ChooseFromListDialog(QtGui.QDialog): +class ChooseFromListDialog(QtWidgets.QDialog): """ Dialog box enabling one item to be chosen from a list """ @@ -193,13 +193,13 @@ def __init__(self, parent, values, return_values=None, title="Choose"): self.sel_data = None self.setWindowTitle(title) - vbox = QtGui.QVBoxLayout() + vbox = QtWidgets.QVBoxLayout() if return_values is None: return_values = values - self._list = QtGui.QListWidget(self) + self._list = QtWidgets.QListWidget(self) for value, data in zip(values, return_values): - item = QtGui.QListWidgetItem(value) + item = QtWidgets.QListWidgetItem(value) item.setData(QtCore.Qt.UserRole, data) self._list.addItem(item) @@ -207,10 +207,10 @@ def __init__(self, parent, values, return_values=None, title="Choose"): self._list.itemClicked.connect(self._item_clicked) self._list.itemDoubleClicked.connect(self._item_double_clicked) - self.button_box = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel) + self.button_box = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel) self.button_box.accepted.connect(self.accept) self.button_box.rejected.connect(self.reject) - self.button_box.button(QtGui.QDialogButtonBox.Ok).setEnabled(False) + self.button_box.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(False) vbox.addWidget(self.button_box) self.setLayout(vbox) @@ -218,25 +218,25 @@ def __init__(self, parent, values, return_values=None, title="Choose"): def _item_clicked(self, item): self.sel_text = item.text() self.sel_data = item.data(QtCore.Qt.UserRole) - self.button_box.button(QtGui.QDialogButtonBox.Ok).setEnabled(True) + self.button_box.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(True) def _item_double_clicked(self, item): self._item_clicked(item) self.accept() -class PlotDialog1d(QtGui.QDialog): +class PlotDialog1d(QtWidgets.QDialog): """ Dialog that shows a 1D plot """ def __init__(self, parent, arr, title="Plot"): - QtGui.QDialog.__init__(self, parent) + QtWidgets.QDialog.__init__(self, parent) if arr.ndim != 1: raise ValueError("Only for 1D plotting") self.setWindowTitle(title) - vbox = QtGui.QVBoxLayout() + vbox = QtWidgets.QVBoxLayout() self.setLayout(vbox) from quantiphyse.gui.plot import Plot diff --git a/quantiphyse/gui/main_window.py b/quantiphyse/gui/main_window.py index b83372fa..5e0f4238 100644 --- a/quantiphyse/gui/main_window.py +++ b/quantiphyse/gui/main_window.py @@ -36,7 +36,7 @@ from .widgets import FingerTabWidget from .viewer.viewer import Viewer -class DragOptions(QtGui.QDialog): +class DragOptions(QtWidgets.QDialog): """ Interface for dealing with drag and drop """ @@ -50,52 +50,52 @@ def __init__(self, parent, fname, ivm, force_t_option=False, default_main=False, self.type = "" self.name = "" - layout = QtGui.QVBoxLayout() + layout = QtWidgets.QVBoxLayout() - grid = QtGui.QGridLayout() - grid.addWidget(QtGui.QLabel("Name:"), 1, 0) - self.name_combo = QtGui.QComboBox() + grid = QtWidgets.QGridLayout() + grid.addWidget(QtWidgets.QLabel("Name:"), 1, 0) + self.name_combo = QtWidgets.QComboBox() def_name = self.ivm.suggest_name(os.path.split(fname)[1].split(".", 1)[0]) for name in [def_name, 'MRI', 'T10', 'Ktrans', 'kep', 've', 'vp', 'model_curves']: self.name_combo.addItem(name) self.name_combo.setEditable(True) grid.addWidget(self.name_combo, 1, 1) layout.addLayout(grid) - hbox = QtGui.QHBoxLayout() + hbox = QtWidgets.QHBoxLayout() if possible_roi: - btn = QtGui.QPushButton("ROI") + btn = QtWidgets.QPushButton("ROI") btn.clicked.connect(self._roi) hbox.addWidget(btn) - btn = QtGui.QPushButton("Data") + btn = QtWidgets.QPushButton("Data") btn.setDefault(True) btn.clicked.connect(self._data) hbox.addWidget(btn) - btn = QtGui.QPushButton("Cancel") + btn = QtWidgets.QPushButton("Cancel") btn.clicked.connect(self.reject) hbox.addWidget(btn) layout.addLayout(hbox) - self.main_cb = QtGui.QCheckBox("Set as main data") + self.main_cb = QtWidgets.QCheckBox("Set as main data") self.main_cb.setChecked(default_main) layout.addWidget(self.main_cb) - self.force_t_cb = QtGui.QCheckBox("Treat as 2D multi-volume") + self.force_t_cb = QtWidgets.QCheckBox("Treat as 2D multi-volume") if force_t_option: # Currently only one possible advanced option so hide it when this is not required - hbox = QtGui.QHBoxLayout() - self.adv_cb = QtGui.QCheckBox("Advanced Options") + hbox = QtWidgets.QHBoxLayout() + self.adv_cb = QtWidgets.QCheckBox("Advanced Options") self.adv_cb.stateChanged.connect(self._adv_changed) hbox.addWidget(self.adv_cb) layout.addLayout(hbox) - self.adv_pane = QtGui.QWidget() - vbox = QtGui.QVBoxLayout() + self.adv_pane = QtWidgets.QWidget() + vbox = QtWidgets.QVBoxLayout() self.adv_pane.setLayout(vbox) - grid = QtGui.QGridLayout() + grid = QtWidgets.QGridLayout() grid.setColumnStretch(2, 1) - self.force_t_cb = QtGui.QCheckBox("Treat as 2D multi-volume") + self.force_t_cb = QtWidgets.QCheckBox("Treat as 2D multi-volume") #self.force_t_cb.setVisible(force_t_option) grid.addWidget(self.force_t_cb, 0, 0) @@ -122,15 +122,15 @@ def _accepted(self): self.make_main = self.main_cb.isChecked() self.name = self.name_combo.currentText() if self.name in self.ivm.data: - btn = QtGui.QMessageBox.warning(self, "Name already exists", + btn = QtWidgets.QMessageBox.warning(self, "Name already exists", "Data already exists with this name - overwrite?", - QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel) - if btn == QtGui.QMessageBox.Ok: + QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel) + if btn == QtWidgets.QMessageBox.Ok: self.accept() else: self.accept() -class MainWindow(QtGui.QMainWindow): +class MainWindow(QtWidgets.QMainWindow): """ Main application window @@ -160,12 +160,12 @@ def __init__(self, load_data=None, widgets=True): self.current_widget = None # Main layout - image view to left, tabs to right - main_widget = QtGui.QWidget() + main_widget = QtWidgets.QWidget() self.setCentralWidget(main_widget) - hbox = QtGui.QHBoxLayout() + hbox = QtWidgets.QHBoxLayout() main_widget.setLayout(hbox) - splitter = QtGui.QSplitter(QtCore.Qt.Horizontal) + splitter = QtWidgets.QSplitter(QtCore.Qt.Horizontal) splitter.addWidget(self.ivl) splitter.setStretchFactor(0, 4) hbox.addWidget(splitter) @@ -241,50 +241,50 @@ def init_menu(self): """ # File --> Load Data - load_action = QtGui.QAction(QtGui.QIcon(get_icon("picture")), '&Load Data', self) + load_action = QtWidgets.QAction(QtGui.QIcon(get_icon("picture")), '&Load Data', self) load_action.setShortcut('Ctrl+L') load_action.setStatusTip('Load a 3d or 4d image or ROI') load_action.triggered.connect(self.load_data_interactive) # File --> Save Data - save_ovreg_action = QtGui.QAction(QtGui.QIcon.fromTheme("document-save"), '&Save current data', self) + save_ovreg_action = QtWidgets.QAction(QtGui.QIcon.fromTheme("document-save"), '&Save current data', self) save_ovreg_action.setStatusTip('Save current data as a NIFTI file') save_ovreg_action.triggered.connect(self.save_data) save_ovreg_action.setShortcut('Ctrl+S') # File --> Save ROI - save_roi_action = QtGui.QAction(QtGui.QIcon.fromTheme("document-save"), '&Save current ROI', self) + save_roi_action = QtWidgets.QAction(QtGui.QIcon.fromTheme("document-save"), '&Save current ROI', self) save_roi_action.setStatusTip('Save current ROI as a NIFTI file') save_roi_action.triggered.connect(self.save_roi) # File --> Clear all - clear_action = QtGui.QAction(QtGui.QIcon.fromTheme("clear"), '&Clear all data', self) + clear_action = QtWidgets.QAction(QtGui.QIcon.fromTheme("clear"), '&Clear all data', self) clear_action.setStatusTip('Remove all data from the viewer') clear_action.triggered.connect(self._clear) # File --> Exit - exit_action = QtGui.QAction(QtGui.QIcon.fromTheme("application-exit"), '&Exit', self) + exit_action = QtWidgets.QAction(QtGui.QIcon.fromTheme("application-exit"), '&Exit', self) exit_action.setShortcut('Ctrl+Q') exit_action.setStatusTip('Exit Application') exit_action.triggered.connect(self.close) # About - about_action = QtGui.QAction(QtGui.QIcon.fromTheme("help-about"), '&About', self) + about_action = QtWidgets.QAction(QtGui.QIcon.fromTheme("help-about"), '&About', self) about_action.setStatusTip('About Quantiphyse') about_action.triggered.connect(self._show_about) # Help -- > Online help - help_action = QtGui.QAction(QtGui.QIcon.fromTheme("help-contents"), '&Online Help', self) + help_action = QtWidgets.QAction(QtGui.QIcon.fromTheme("help-contents"), '&Online Help', self) help_action.setStatusTip('See online help file') help_action.triggered.connect(self._show_help) # Advanced --> Python Console - console_action = QtGui.QAction(QtGui.QIcon(get_icon("console")), '&Console', self) + console_action = QtWidgets.QAction(QtGui.QIcon(get_icon("console")), '&Console', self) console_action.setStatusTip('Run a console for advanced interaction') console_action.triggered.connect(self.show_console) # Advanced --> Install Packages - #install_action = QtGui.QAction(QtGui.QIcon(get_icon("package")), '&Install Packages', self) + #install_action = QtWidgets.QAction(QtGui.QIcon(get_icon("package")), '&Install Packages', self) #install_action.setStatusTip('Install additional packages') #install_action.triggered.connect(self.install_packages) @@ -311,7 +311,7 @@ def init_menu(self): widget_submenus[group] = widget_menu.addMenu(group) for w in self.widget_groups[group]: - action = QtGui.QAction(w.icon, '&%s' % w.name, self) + action = QtWidgets.QAction(w.icon, '&%s' % w.name, self) action.setStatusTip(w.description) action.widget = w action.triggered.connect(self._show_widget) @@ -379,7 +379,7 @@ def _show_about(self): for ack, role in __acknowledge__.items(): text += "

%s

" % ack - QtGui.QMessageBox.about(self, "Quantiphyse", text) + QtWidgets.QMessageBox.about(self, "Quantiphyse", text) #def install_packages(self): # raise QpException("Package installation not implemented yet") @@ -418,7 +418,7 @@ def load_data_interactive(self, fname=None, name=None): Load data into the IVM from a file (which may already be known) """ if fname is None: - fname, _ = QtGui.QFileDialog.getOpenFileName(self, 'Open file', default_save_dir()) + fname, _ = QtWidgets.QFileDialog.getOpenFileName(self, 'Open file', default_save_dir()) if not fname: return set_default_save_dir(os.path.dirname(fname)) @@ -441,11 +441,11 @@ def load_data_interactive(self, fname=None, name=None): # If we had to do anything evil to make data fit, warn and give user the chance to back out if force_t: - msg_box = QtGui.QMessageBox(self) + msg_box = QtWidgets.QMessageBox(self) msg_box.setText("3D data was interpreted as multiple 2D volumes") - msg_box.setStandardButtons(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel) - msg_box.setDefaultButton(QtGui.QMessageBox.Ok) - if msg_box.exec_() != QtGui.QMessageBox.Ok: return + msg_box.setStandardButtons(QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel) + msg_box.setDefaultButton(QtWidgets.QMessageBox.Ok) + if msg_box.exec_() != QtWidgets.QMessageBox.Ok: return data.set_2dt() self.ivm.add(data, make_main=options.make_main, make_current=not options.make_main) @@ -466,14 +466,14 @@ def save_data(self): Dialog for saving an data as a nifti file """ if self.ivm.current_data is None: - QtGui.QMessageBox.warning(self, "No data", "No current data to save", QtGui.QMessageBox.Close) + QtWidgets.QMessageBox.warning(self, "No data", "No current data to save", QtWidgets.QMessageBox.Close) else: if hasattr(self.ivm.current_data, "fname") and self.ivm.current_data.fname is not None: fname = self.ivm.current_data.fname else: fname = os.path.join(default_save_dir(), self.ivm.current_data.name + ".nii") - fname, _ = QtGui.QFileDialog.getSaveFileName(self, 'Save file', dir=fname, + fname, _ = QtWidgets.QFileDialog.getSaveFileName(self, 'Save file', dir=fname, filter="NIFTI files (*.nii *.nii.gz)") if fname != '': save(self.ivm.current_data, fname) @@ -485,13 +485,13 @@ def save_roi(self): Dialog for saving an ROI as a nifti file """ if self.ivm.current_roi is None: - QtGui.QMessageBox.warning(self, "No ROI", "No current ROI to save", QtGui.QMessageBox.Close) + QtWidgets.QMessageBox.warning(self, "No ROI", "No current ROI to save", QtWidgets.QMessageBox.Close) else: if hasattr(self.ivm.current_roi, "fname") and self.ivm.current_roi.fname is not None: fname = self.ivm.current_roi.fname else: fname = os.path.join(default_save_dir(), self.ivm.current_roi.name + ".nii") - fname, _ = QtGui.QFileDialog.getSaveFileName(self, 'Save file', dir=fname, + fname, _ = QtWidgets.QFileDialog.getSaveFileName(self, 'Save file', dir=fname, filter="NIFTI files (*.nii *.nii.gz)") if fname != '': save(self.ivm.current_roi, fname) @@ -500,7 +500,7 @@ def save_roi(self): def _clear(self): if self.ivm.data: - ret = QtGui.QMessageBox.warning(self, "Clear all data", "Are you sure you want to clear all data?", - QtGui.QMessageBox.Yes | QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Cancel) - if ret == QtGui.QMessageBox.Yes: + ret = QtWidgets.QMessageBox.warning(self, "Clear all data", "Are you sure you want to clear all data?", + QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.Cancel, QtWidgets.QMessageBox.Cancel) + if ret == QtWidgets.QMessageBox.Yes: self.ivm.reset() diff --git a/quantiphyse/gui/options.py b/quantiphyse/gui/options.py index 3139a599..a0d557bb 100644 --- a/quantiphyse/gui/options.py +++ b/quantiphyse/gui/options.py @@ -47,17 +47,17 @@ LOG = logging.getLogger(__name__) -class OptionBox(QtGui.QGroupBox): +class OptionBox(QtWidgets.QGroupBox): """ A box containing structured options for a QpWidget """ sig_changed = QtCore.Signal() def __init__(self, title="", **kwargs): - QtGui.QGroupBox.__init__(self, title) + QtWidgets.QGroupBox.__init__(self, title) if not title and not kwargs.get("border", False): self.setStyleSheet("border: none") - self.grid = QtGui.QGridLayout() + self.grid = QtWidgets.QGridLayout() self.setLayout(self.grid) self._current_row = 0 self._options = {} @@ -98,11 +98,11 @@ def add(self, label, *options, **kwargs): col = 0 if label: - self.grid.addWidget(QtGui.QLabel(label), self._current_row, col, 1, 1 if real_options else 3) + self.grid.addWidget(QtWidgets.QLabel(label), self._current_row, col, 1, 1 if real_options else 3) col += 1 if checked: - cb = QtGui.QCheckBox() + cb = QtWidgets.QCheckBox() cb.setChecked(enabled) self.grid.addWidget(cb, self._current_row, col) col += 1 @@ -152,7 +152,7 @@ def set_visible(self, key, visible=True): if item is None: break item.widget().setVisible(visible) - if isinstance(item.widget(), QtGui.QCheckBox) and not isinstance(item.widget(), Option): + if isinstance(item.widget(), QtWidgets.QCheckBox) and not isinstance(item.widget(), Option): checked = item.widget().isChecked() item.widget().setEnabled(visible) else: @@ -165,7 +165,7 @@ def set_checked(self, key, checked): """ row = self._rows[key] cb = self.grid.itemAtPosition(row, 1) - if isinstance(cb.widget(), QtGui.QCheckBox) and not isinstance(cb.widget(), Option): + if isinstance(cb.widget(), QtWidgets.QCheckBox) and not isinstance(cb.widget(), Option): cb.widget().setChecked(checked) else: raise ValueError("set_checked called on option '%s' which is not a checked option" % key) @@ -233,7 +233,7 @@ class Option(object): """ pass -class DataOption(Option, QtGui.QComboBox): +class DataOption(Option, QtWidgets.QComboBox): """ A combo box which gives a choice of data @@ -350,7 +350,7 @@ def _item_pressed(self, idx): def hidePopup(self): """ - Overridden from QtGui.QComboBox + Overridden from QtWidgets.QComboBox To allow multi-select, don't hide the popup when it's clicked on to select/deselect data sets, so we can check and uncheck @@ -359,7 +359,7 @@ def hidePopup(self): window), this will close the popup """ if not self._changed: - QtGui.QComboBox.hidePopup(self) + QtWidgets.QComboBox.hidePopup(self) self._changed = False def _visible_text(self, selected_items): @@ -454,11 +454,11 @@ def _data_changed(self): def setEnabled(self, enable): """ - Overridden from QtGui.QWidget + Overridden from QtWidgets.QWidget Only highlight selector in red when widget is enabled """ - QtGui.QWidget.setEnabled(self, enable) + QtWidgets.QWidget.setEnabled(self, enable) self._update_highlight() def _update_highlight(self): @@ -472,17 +472,17 @@ def _update_from_current(self, qpd): if (not qpd.roi and self._include_nonrois) or (qpd.roi and self._include_rois): self.value = qpd.name -class ChoiceOption(Option, QtGui.QComboBox): +class ChoiceOption(Option, QtWidgets.QComboBox): """ Option which is chosen from a list of possible strings """ sig_changed = QtCore.Signal() def __init__(self, choices=(), return_values=None, default=None): - QtGui.QComboBox.__init__(self) + QtWidgets.QComboBox.__init__(self) self.setChoices(choices, return_values) # Bizarre hack to make the dropdown height adjust to the items added - self.setView(QtGui.QListView()) + self.setView(QtWidgets.QListView()) if default: self.value = default self.currentIndexChanged.connect(self._changed) @@ -540,14 +540,14 @@ def value(self, choice): def _changed(self): self.sig_changed.emit() -class TextOption(Option, QtGui.QLineEdit): +class TextOption(Option, QtWidgets.QLineEdit): """ Option which contains arbitrary text """ sig_changed = QtCore.Signal() def __init__(self, initial=""): - QtGui.QLineEdit.__init__(self, initial) + QtWidgets.QLineEdit.__init__(self, initial) self.editingFinished.connect(self._changed) @property @@ -582,14 +582,14 @@ def _reset(self): else: self.setText(self.initial) -class NumericOption(Option, QtGui.QWidget): +class NumericOption(Option, QtWidgets.QWidget): """ Numeric option chooser which uses a slider and two spin boxes """ sig_changed = QtCore.Signal() def __init__(self, minval=0, maxval=100, default=0, intonly=False, decimals=2, **kwargs): - QtGui.QWidget.__init__(self) + QtWidgets.QWidget.__init__(self) self.minval = minval self.maxval = maxval self.hardmin = kwargs.get("hardmin", False) @@ -605,15 +605,15 @@ def __init__(self, minval=0, maxval=100, default=0, intonly=False, decimals=2, * self.decimals = decimals self.slider_scale = 10**decimals - hbox = QtGui.QHBoxLayout() + hbox = QtWidgets.QHBoxLayout() hbox.setContentsMargins(0, 0, 0, 0) self.setLayout(hbox) - #self.min_edit = QtGui.QLineEdit(str(minval)) + #self.min_edit = QtWidgets.QLineEdit(str(minval)) #self.min_edit.editingFinished.connect(self_min_changed) #hbox.addWidget(self.min_edit) - self.slider = QtGui.QSlider(QtCore.Qt.Horizontal) + self.slider = QtWidgets.QSlider(QtCore.Qt.Horizontal) self.slider.setMaximum(maxval*self.slider_scale) self.slider.setMinimum(minval*self.slider_scale) self.slider.setValue(default*self.slider_scale) @@ -621,7 +621,7 @@ def __init__(self, minval=0, maxval=100, default=0, intonly=False, decimals=2, * if kwargs.get("slider", True): hbox.addWidget(self.slider) - self.val_edit = QtGui.QLineEdit(str(default)) + self.val_edit = QtWidgets.QLineEdit(str(default)) self.val_edit.editingFinished.connect(self._edit_changed) if kwargs.get("edit", True): hbox.addWidget(self.val_edit) @@ -698,7 +698,7 @@ def setLimits(self, minval=None, maxval=None): finally: self.blockSignals(False) -class BoolOption(Option, QtGui.QCheckBox): +class BoolOption(Option, QtWidgets.QCheckBox): """ Option used to specify a true or false value """ @@ -709,7 +709,7 @@ def __init__(self, default=False, invert=False): :param default: Initial value of ``value`` property :param invert: If True, ``value`` property is the opposite of the check state """ - QtGui.QCheckBox.__init__(self) + QtWidgets.QCheckBox.__init__(self) if invert: default = not default self.setChecked(default) @@ -733,7 +733,7 @@ def value(self, checked): def _changed(self): self.sig_changed.emit() -class MatrixOption(Option, QtGui.QTableView): +class MatrixOption(Option, QtWidgets.QTableView): """ Option which returns a 2D matrix of numbers """ @@ -742,7 +742,7 @@ class MatrixOption(Option, QtGui.QTableView): def __init__(self, initial, col_headers=None, row_headers=None, expandable=(True, True), fix_height=False, fix_width=False, readonly=False): - QtGui.QTableView.__init__(self) + QtWidgets.QTableView.__init__(self) self._model = QtGui.QStandardItemModel() self.setModel(self._model) @@ -759,12 +759,12 @@ def __init__(self, initial, col_headers=None, row_headers=None, expandable=(True self.setMatrix(initial, False, col_headers=col_headers, row_headers=row_headers) if readonly: - self.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers) + self.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) else: self.model().itemChanged.connect(self._item_changed) - self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) - #self.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents) + self.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) + #self.horizontalHeader().setResizeMode(QtWidgets.QHeaderView.ResizeToContents) self.itemDelegate().closeEditor.connect(self._expand_if_required, QtCore.Qt.QueuedConnection) self.setAcceptDrops(True) @@ -1040,29 +1040,29 @@ def _choose_row_col(self, vals): return None, r.leftColumn() return None, None -class NumberListOption(Option, QtGui.QWidget): +class NumberListOption(Option, QtWidgets.QWidget): """ A list of numbers which may be entered space or comma separated """ sig_changed = QtCore.Signal() def __init__(self, initial=(), intonly=False, load_btn=True, extras_btn=False, ivm=None): - QtGui.QWidget.__init__(self) + QtWidgets.QWidget.__init__(self) self._ivm = ivm self._value = [] - self._hbox = QtGui.QHBoxLayout() + self._hbox = QtWidgets.QHBoxLayout() self._hbox.setContentsMargins(0, 0, 0, 0) self.setLayout(self._hbox) - self._edit = QtGui.QLineEdit() + self._edit = QtWidgets.QLineEdit() self._edit.dropEvent = self.dropEvent self._hbox.addWidget(self._edit) - self._btn = QtGui.QPushButton("Load") + self._btn = QtWidgets.QPushButton("Load") self._btn.clicked.connect(self._load_clicked) if load_btn: self._hbox.addWidget(self._btn) - self._extras_btn = QtGui.QPushButton("Predefined") + self._extras_btn = QtWidgets.QPushButton("Predefined") self._extras_btn.clicked.connect(self._extras_clicked) if extras_btn: self._hbox.addWidget(self._extras_btn) @@ -1097,7 +1097,7 @@ def _edit_changed(self): self.sig_changed.emit() def _load_clicked(self): - filename, _ = QtGui.QFileDialog.getOpenFileName(dir=default_save_dir()) + filename, _ = QtWidgets.QFileDialog.getOpenFileName(dir=default_save_dir()) if filename: set_default_save_dir(os.path.dirname(filename)) @@ -1174,7 +1174,7 @@ def _choose_row_col(self, vals): return None, r.leftColumn() return None, None -class PickPointOption(Option, QtGui.QWidget): +class PickPointOption(Option, QtWidgets.QWidget): """ Option used to specify a single point in a data set """ @@ -1185,7 +1185,7 @@ def __init__(self, ivl, grid=None, intonly=True): :param grid: DataGrid instance - output position will be reported relative to this grid :param intonly: If True, positions will be rounded to nearest integer """ - QtGui.QWidget.__init__(self) + QtWidgets.QWidget.__init__(self) self._ivl = ivl self._grid = grid if intonly: @@ -1195,14 +1195,14 @@ def __init__(self, ivl, grid=None, intonly=True): self._rtype = float self._offset = 0 - hbox = QtGui.QHBoxLayout() + hbox = QtWidgets.QHBoxLayout() hbox.setContentsMargins(0, 0, 0, 0) self.setLayout(hbox) - self._edit = QtGui.QLineEdit() + self._edit = QtWidgets.QLineEdit() self._edit.editingFinished.connect(self._edit_changed) hbox.addWidget(self._edit) - self._btn = QtGui.QPushButton("Pick point") + self._btn = QtWidgets.QPushButton("Pick point") self._btn.clicked.connect(self._pick_point) hbox.addWidget(self._btn) @@ -1249,7 +1249,7 @@ def _set_point(self, point): self._edit.setText(" ".join([str(self._rtype(v+self._offset)) for v in point[:3]])) self._edit_changed() -class FileOption(Option, QtGui.QWidget): +class FileOption(Option, QtWidgets.QWidget): """ Option used to specify a file or directory """ @@ -1259,21 +1259,21 @@ def __init__(self, dirs=False, initial="", plot_btn=False): """ :param dirs: If True, allow only directories to be selected """ - QtGui.QWidget.__init__(self) + QtWidgets.QWidget.__init__(self) self._dirs = dirs - hbox = QtGui.QHBoxLayout() + hbox = QtWidgets.QHBoxLayout() hbox.setContentsMargins(0, 0, 0, 0) self.setLayout(hbox) - self._edit = QtGui.QLineEdit(initial) + self._edit = QtWidgets.QLineEdit(initial) hbox.addWidget(self._edit) - self._btn = QtGui.QPushButton("Choose") + self._btn = QtWidgets.QPushButton("Choose") self._btn.clicked.connect(self._clicked) hbox.addWidget(self._btn) if plot_btn: - plot_btn = QtGui.QPushButton("Plot") + plot_btn = QtWidgets.QPushButton("Plot") plot_btn.clicked.connect(self._plot) hbox.addWidget(plot_btn) @@ -1321,9 +1321,9 @@ def dropEvent(self, event): def _clicked(self): if self._dirs: - path = QtGui.QFileDialog.getExistingDirectory(parent=self, dir=self.value) + path = QtWidgets.QFileDialog.getExistingDirectory(parent=self, dir=self.value) else: - path, _ = QtGui.QFileDialog.getOpenFileName(parent=self, dir=os.path.dirname(self.value)) + path, _ = QtWidgets.QFileDialog.getOpenFileName(parent=self, dir=os.path.dirname(self.value)) self._edit.setText(path) self.sig_changed.emit() @@ -1342,16 +1342,16 @@ def _plot(self): plot_dialog = PlotDialog1d(self, arr, title=self.value) plot_dialog.exec_() -class RunButton(QtGui.QWidget): +class RunButton(QtWidgets.QWidget): """ A button which, when clicked, runs an analysis process """ def __init__(self, label="Run", callback=None): - QtGui.QWidget.__init__(self) - hbox = QtGui.QHBoxLayout() + QtWidgets.QWidget.__init__(self) + hbox = QtWidgets.QHBoxLayout() self.setLayout(hbox) - self.btn = QtGui.QPushButton(label) + self.btn = QtWidgets.QPushButton(label) self.btn.clicked.connect(callback) hbox.addWidget(self.btn) hbox.addStretch(1) diff --git a/quantiphyse/gui/plot.py b/quantiphyse/gui/plot.py index 8d3575f9..a0e8c15f 100644 --- a/quantiphyse/gui/plot.py +++ b/quantiphyse/gui/plot.py @@ -31,7 +31,7 @@ from quantiphyse.gui.colors import get_kelly_col from quantiphyse.utils import LogSource, get_icon, norecurse -class PlotOptions(QtGui.QDialog): +class PlotOptions(QtWidgets.QDialog): """ Options dialog for a line plot """ @@ -39,20 +39,20 @@ class PlotOptions(QtGui.QDialog): sig_options_changed = QtCore.Signal(object) def __init__(self, graph=None, **kwargs): - QtGui.QDialog.__init__(self, graph) + QtWidgets.QDialog.__init__(self, graph) self.graph = graph self.sig_enh = False self.smooth = False self.setWindowTitle('Plot options') - grid = QtGui.QGridLayout() + grid = QtWidgets.QGridLayout() self.setLayout(grid) row = 0 # Display mode if kwargs.get("display_mode", True): - grid.addWidget(QtGui.QLabel("Display mode"), row, 0) - mode_combo = QtGui.QComboBox() + grid.addWidget(QtWidgets.QLabel("Display mode"), row, 0) + mode_combo = QtWidgets.QComboBox() mode_combo.addItem("Signal") mode_combo.addItem("Signal Enhancement") mode_combo.currentIndexChanged.connect(self._mode_changed) @@ -60,19 +60,19 @@ def __init__(self, graph=None, **kwargs): row += 1 # Signal enhancement baseline - self.se_lbl = QtGui.QLabel('Signal enhancement: Use first') + self.se_lbl = QtWidgets.QLabel('Signal enhancement: Use first') self.se_lbl.setEnabled(False) grid.addWidget(self.se_lbl, row, 0) - hbox = QtGui.QHBoxLayout() - self._norm_frames_spin = QtGui.QSpinBox() + hbox = QtWidgets.QHBoxLayout() + self._norm_frames_spin = QtWidgets.QSpinBox() self._norm_frames_spin.setValue(3) self._norm_frames_spin.setMinimum(1) self._norm_frames_spin.setMaximum(100) self._norm_frames_spin.valueChanged.connect(self._changed) self._norm_frames_spin.setEnabled(False) hbox.addWidget(self._norm_frames_spin) - self.se_lbl2 = QtGui.QLabel('frames as baseline') + self.se_lbl2 = QtWidgets.QLabel('frames as baseline') self.se_lbl2.setEnabled(False) hbox.addWidget(self.se_lbl2) hbox.addStretch(1) @@ -81,26 +81,26 @@ def __init__(self, graph=None, **kwargs): # Y-axis scale if kwargs.get("y_scale", True): - hbox = QtGui.QHBoxLayout() - self.auto_y_cb = QtGui.QCheckBox('Automatic Y axis scale', self) + hbox = QtWidgets.QHBoxLayout() + self.auto_y_cb = QtWidgets.QCheckBox('Automatic Y axis scale', self) self.auto_y_cb.setChecked(True) self.auto_y_cb.stateChanged.connect(self._auto_y_changed) grid.addWidget(self.auto_y_cb, row, 0) - self.min_lbl = QtGui.QLabel("Min") + self.min_lbl = QtWidgets.QLabel("Min") self.min_lbl.setEnabled(False) hbox.addWidget(self.min_lbl) - self.min_spin = QtGui.QDoubleSpinBox() + self.min_spin = QtWidgets.QDoubleSpinBox() self.min_spin.setMinimum(-1e20) self.min_spin.setMaximum(1e20) self.min_spin.valueChanged.connect(self._changed) self.min_spin.setEnabled(False) hbox.addWidget(self.min_spin) - self.max_lbl = QtGui.QLabel("Max") + self.max_lbl = QtWidgets.QLabel("Max") self.max_lbl.setEnabled(False) hbox.addWidget(self.max_lbl) - self.max_spin = QtGui.QDoubleSpinBox() + self.max_spin = QtWidgets.QDoubleSpinBox() self.max_spin.setMinimum(-1e20) self.max_spin.setMaximum(1e20) self.max_spin.valueChanged.connect(self._changed) @@ -113,7 +113,7 @@ def __init__(self, graph=None, **kwargs): # Smoothing if kwargs.get("smoothing", True): - smooth_cb = QtGui.QCheckBox('Smooth curves', self) + smooth_cb = QtWidgets.QCheckBox('Smooth curves', self) smooth_cb.setChecked(self.smooth) smooth_cb.stateChanged.connect(self._smooth_changed) grid.addWidget(smooth_cb, row, 0) @@ -247,7 +247,7 @@ def _options_changed(self): if self.graphics_items: self.show() -class Plot(QtGui.QWidget): +class Plot(QtWidgets.QWidget): """ Widget for plotting graphs """ @@ -257,15 +257,15 @@ def __init__(self, parent=None, title="", **kwargs): :param qpo: Global options """ - QtGui.QWidget.__init__(self, parent) + QtWidgets.QWidget.__init__(self, parent) self.items = [] self.updating = False self.legend_pos = (30, 30) - vbox = QtGui.QVBoxLayout() + vbox = QtWidgets.QVBoxLayout() self.setLayout(vbox) - hbox = QtGui.QHBoxLayout() + hbox = QtWidgets.QHBoxLayout() hbox.addStretch(1) if kwargs.get("opts_btn", True): @@ -276,7 +276,7 @@ def __init__(self, parent=None, title="", **kwargs): if kwargs.get("clear_btn", False): clear_icon = QtGui.QIcon(get_icon("clear")) - self.clear_btn = QtGui.QPushButton(self) + self.clear_btn = QtWidgets.QPushButton(self) self.clear_btn.setIcon(clear_icon) self.clear_btn.setIconSize(QtCore.QSize(14, 14)) self.clear_btn.setToolTip("Clear curves") diff --git a/quantiphyse/gui/register.py b/quantiphyse/gui/register.py index 3efb3556..472e0961 100644 --- a/quantiphyse/gui/register.py +++ b/quantiphyse/gui/register.py @@ -60,40 +60,40 @@ def check_register(): # User got the license dialog but did not accept it sys.exit(-1) -class LicenseDialog(QtGui.QDialog): +class LicenseDialog(QtWidgets.QDialog): """ Dialog box which asks a first-time user to accept the license """ def __init__(self, parent=None): - QtGui.QDialog.__init__(self, parent) + QtWidgets.QDialog.__init__(self, parent) self.setWindowTitle("License Agreement") - layout = QtGui.QVBoxLayout() + layout = QtWidgets.QVBoxLayout() - hbox = QtGui.QHBoxLayout() + hbox = QtWidgets.QHBoxLayout() pixmap = QtGui.QPixmap(get_icon("quantiphyse_75.png")) - lpic = QtGui.QLabel(self) + lpic = QtWidgets.QLabel(self) lpic.setPixmap(pixmap) hbox.addWidget(lpic) hbox.addStretch(1) layout.addLayout(hbox) - layout.addWidget(QtGui.QLabel("")) + layout.addWidget(QtWidgets.QLabel("")) # Welcome - hbox = QtGui.QHBoxLayout() + hbox = QtWidgets.QHBoxLayout() hbox.addStretch(1) - hbox.addWidget(QtGui.QLabel("\nWelcome to Quantiphyse %s" % get_version())) + hbox.addWidget(QtWidgets.QLabel("\nWelcome to Quantiphyse %s" % get_version())) hbox.addStretch(1) layout.addLayout(hbox) - label = QtGui.QLabel("Quantiphyse is free for non-commercial use. If you are interested in using the software " + label = QtWidgets.QLabel("Quantiphyse is free for non-commercial use. If you are interested in using the software " "commercially, please contact the technology transfer company of the University: enquiries@innovation.ox.ac.uk") label.setWordWrap(True) layout.addWidget(label) # License agreement - edit = QtGui.QTextEdit() + edit = QtWidgets.QTextEdit() edit.setCurrentFont(QtGui.QFont("Monospace", 8)) edit.append(__license__) edit.append("") @@ -102,19 +102,19 @@ def __init__(self, parent=None): layout.addWidget(edit) # Acceptance section - self.agree_cb = QtGui.QCheckBox("I agree to abide by the terms of the Quantiphyse license") + self.agree_cb = QtWidgets.QCheckBox("I agree to abide by the terms of the Quantiphyse license") self.agree_cb.stateChanged.connect(self._agree_changed) layout.addWidget(self.agree_cb) # Buttons - self.button_box = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok|QtGui.QDialogButtonBox.Cancel) + self.button_box = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok|QtWidgets.QDialogButtonBox.Cancel) self.button_box.accepted.connect(self.accept) self.button_box.rejected.connect(self.reject) - self.button_box.button(QtGui.QDialogButtonBox.Ok).setEnabled(False) + self.button_box.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(False) layout.addWidget(self.button_box) self.setLayout(layout) self.setFixedSize(700, 800) def _agree_changed(self, state): - self.button_box.button(QtGui.QDialogButtonBox.Ok).setEnabled(state) + self.button_box.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(state) diff --git a/quantiphyse/gui/viewer/navigators.py b/quantiphyse/gui/viewer/navigators.py index a2284e27..497916bc 100644 --- a/quantiphyse/gui/viewer/navigators.py +++ b/quantiphyse/gui/viewer/navigators.py @@ -39,14 +39,14 @@ def __init__(self, ivl, label, axis, layout_grid, layout_ypos): self.data_grid = None self._pos = -1 - layout_grid.addWidget(QtGui.QLabel(label), layout_ypos, 0) - self.slider = QtGui.QSlider(QtCore.Qt.Horizontal) + layout_grid.addWidget(QtWidgets.QLabel(label), layout_ypos, 0) + self.slider = QtWidgets.QSlider(QtCore.Qt.Horizontal) self.slider.setFocusPolicy(QtCore.Qt.NoFocus) self.slider.setMinimumWidth(100) self.slider.valueChanged.connect(self._changed) layout_grid.addWidget(self.slider, layout_ypos, 1) - self.spin = QtGui.QSpinBox() + self.spin = QtWidgets.QSpinBox() self.spin.valueChanged.connect(self._changed) layout_grid.addWidget(self.spin, layout_ypos, 2) @@ -118,15 +118,15 @@ def _data_changed(self): self._set_size(max_num_vols) self._focus_changed() -class NavigationBox(QtGui.QGroupBox): +class NavigationBox(QtWidgets.QGroupBox): """ Box containing 4D navigators """ def __init__(self, ivl): - QtGui.QGroupBox.__init__(self) + QtWidgets.QGroupBox.__init__(self) self.ivl = ivl - grid = QtGui.QGridLayout() + grid = QtWidgets.QGridLayout() grid.setVerticalSpacing(2) grid.setContentsMargins(5, 5, 5, 5) self.setLayout(grid) diff --git a/quantiphyse/gui/viewer/pickers.py b/quantiphyse/gui/viewer/pickers.py index d6c9cd02..15c1fccd 100644 --- a/quantiphyse/gui/viewer/pickers.py +++ b/quantiphyse/gui/viewer/pickers.py @@ -441,7 +441,7 @@ def pick(self, win, pos): fx, fy = float(pos[self.view.xaxis]), float(pos[self.view.yaxis]) self._points.append((fx, fy)) - self.roisel = QtGui.QGraphicsPathItem() + self.roisel = QtWidgets.QGraphicsPathItem() pen = QtGui.QPen(QtCore.Qt.darkMagenta, 1, QtCore.Qt.SolidLine, QtCore.Qt.SquareCap, QtCore.Qt.BevelJoin) self.roisel.setPen(pen) diff --git a/quantiphyse/gui/viewer/slice_viewer.py b/quantiphyse/gui/viewer/slice_viewer.py index 3dbbd5b9..135c6e88 100644 --- a/quantiphyse/gui/viewer/slice_viewer.py +++ b/quantiphyse/gui/viewer/slice_viewer.py @@ -264,8 +264,8 @@ def __init__(self, ivl, ivm, ax_map, ax_labels): # Static labels for the view directions self._labels = [] for axis in [self.xaxis, self.yaxis]: - self._labels.append(QtGui.QLabel(ax_labels[axis][0], parent=self)) - self._labels.append(QtGui.QLabel(ax_labels[axis][1], parent=self)) + self._labels.append(QtWidgets.QLabel(ax_labels[axis][0], parent=self)) + self._labels.append(QtWidgets.QLabel(ax_labels[axis][1], parent=self)) for label in self._labels: label.setAttribute(QtCore.Qt.WA_TranslucentBackground) diff --git a/quantiphyse/gui/viewer/view_options_dialog.py b/quantiphyse/gui/viewer/view_options_dialog.py index 9cfeb261..dc2691ea 100644 --- a/quantiphyse/gui/viewer/view_options_dialog.py +++ b/quantiphyse/gui/viewer/view_options_dialog.py @@ -26,7 +26,7 @@ from quantiphyse.utils.enums import Orientation, DisplayOrder, Visibility from quantiphyse.gui.options import OptionBox, ChoiceOption -class ViewerOptions(QtGui.QDialog): +class ViewerOptions(QtWidgets.QDialog): """ Dialog box which controls viewer options """ @@ -36,8 +36,8 @@ def __init__(self, parent, ivl): self.setWindowTitle("View Options") self._ivl = ivl - vbox = QtGui.QVBoxLayout() - label = QtGui.QLabel('View Options') + vbox = QtWidgets.QVBoxLayout() + label = QtWidgets.QLabel('View Options') vbox.addWidget(label) self._optbox = OptionBox() diff --git a/quantiphyse/gui/viewer/view_params_widget.py b/quantiphyse/gui/viewer/view_params_widget.py index 60546e5b..6a7c991d 100644 --- a/quantiphyse/gui/viewer/view_params_widget.py +++ b/quantiphyse/gui/viewer/view_params_widget.py @@ -55,21 +55,21 @@ def __init__(self, ivl, rois=True, data=True): self._no_update = False self.grid.setVerticalSpacing(2) - self._view_btn = QtGui.QPushButton() + self._view_btn = QtWidgets.QPushButton() self._view_btn.setIcon(QtGui.QIcon(get_icon("visible.png"))) self._view_btn.setFixedSize(16, 16) self._view_btn.setToolTip("Visibility") self._view_btn.clicked.connect(self._view_btn_clicked) self._data = self.add("Data" if data else "ROI", DataOption(self.ivm, data=data, rois=rois, follow_current=True), self._view_btn, key="data") self._view_roi = self.add("View ROI", DataOption(self.ivm, data=False, rois=True), checked=True, key="view_roi") - self._levels_btn = QtGui.QPushButton() + self._levels_btn = QtWidgets.QPushButton() self._levels_btn.setIcon(QtGui.QIcon(get_icon("levels.png"))) self._levels_btn.setFixedSize(16, 16) self._levels_btn.setToolTip("Adjust colour map levels") self._levels_btn.clicked.connect(self._levels_clicked) self._cmap = self.add("Colour map", ChoiceOption(CMAPS, default=DEFAULT_CMAP), self._levels_btn, key="cmap") self._alpha = self.add("Alpha", NumericOption(minval=0, maxval=255, default=255, edit=False, intonly=True), key="alpha") - self._value_label = QtGui.QLabel() + self._value_label = QtWidgets.QLabel() self.add("Value", self._value_label) self.add("", stretch=2) @@ -192,7 +192,7 @@ def _get_visibility_icon(self): return QtGui.QIcon(get_icon(icon)) -class LevelsDialog(QtGui.QDialog): +class LevelsDialog(QtWidgets.QDialog): """ Dialog box used to set the colourmap max/min for a data view """ @@ -204,26 +204,26 @@ def __init__(self, parent, ivm, ivl, qpdata): self._qpdata = qpdata self.setWindowTitle("Levels for %s" % self._qpdata.name) - vbox = QtGui.QVBoxLayout() + vbox = QtWidgets.QVBoxLayout() - grid = QtGui.QGridLayout() + grid = QtWidgets.QGridLayout() self.min_spin = self._add_spin(grid, "Minimum", 0) self.max_spin = self._add_spin(grid, "Maximum", 1) - grid.addWidget(QtGui.QLabel("Percentage of data range"), 2, 0) - hbox = QtGui.QHBoxLayout() - self.percentile_spin = QtGui.QSpinBox() + grid.addWidget(QtWidgets.QLabel("Percentage of data range"), 2, 0) + hbox = QtWidgets.QHBoxLayout() + self.percentile_spin = QtWidgets.QSpinBox() self.percentile_spin.setMaximum(100) self.percentile_spin.setMinimum(1) self.percentile_spin.setValue(100) hbox.addWidget(self.percentile_spin) - btn = QtGui.QPushButton("Reset") + btn = QtWidgets.QPushButton("Reset") btn.clicked.connect(self._reset) hbox.addWidget(btn) grid.addLayout(hbox, 2, 1) - grid.addWidget(QtGui.QLabel("Values outside range are"), 4, 0) - self.combo = QtGui.QComboBox() + grid.addWidget(QtWidgets.QLabel("Values outside range are"), 4, 0) + self.combo = QtWidgets.QComboBox() self.combo.addItem("Transparent") self.combo.addItem("Clamped to max/min colour") self.combo.addItem("Transparent at lower, clamped at upper") @@ -233,15 +233,15 @@ def __init__(self, parent, ivm, ivl, qpdata): grid.addWidget(self.combo, 4, 1) vbox.addLayout(grid) - bbox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok) + bbox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok) bbox.accepted.connect(self.close) vbox.addWidget(bbox) self.setLayout(vbox) def _add_spin(self, grid, label, row): - grid.addWidget(QtGui.QLabel(label), row, 0) - spin = QtGui.QDoubleSpinBox() + grid.addWidget(QtWidgets.QLabel(label), row, 0) + spin = QtWidgets.QDoubleSpinBox() spin.setMaximum(1e20) spin.setMinimum(-1e20) spin.setValue(self._qpdata.view.cmap_range[row]) diff --git a/quantiphyse/gui/viewer/viewer.py b/quantiphyse/gui/viewer/viewer.py index 3750ff15..ff579c07 100644 --- a/quantiphyse/gui/viewer/viewer.py +++ b/quantiphyse/gui/viewer/viewer.py @@ -21,7 +21,7 @@ try: from PySide import QtGui, QtCore except ImportError: - from PySide2 import QtGui, QtCore + from PySide2 import QtGui, QtCore, QtWidgets import numpy as np @@ -92,7 +92,7 @@ def _hide_others(self, qpdata): if data.name != qpdata.name and data.roi == qpdata.roi and data.view.visible == Visibility.SHOW: data.view.visible = Visibility.HIDE -class Viewer(QtGui.QSplitter, LogSource): +class Viewer(QtWidgets.QSplitter, LogSource): """ Widget containing three orthogonal slice views, two histogram/LUT widgets plus navigation sliders and data summary view. @@ -131,7 +131,7 @@ class Viewer(QtGui.QSplitter, LogSource): def __init__(self, ivm): LogSource.__init__(self) - QtGui.QSplitter.__init__(self, QtCore.Qt.Vertical) + QtWidgets.QSplitter.__init__(self, QtCore.Qt.Vertical) self.ivm = ivm self._grid = DataGrid([1, 1, 1], np.identity(4)) @@ -167,8 +167,8 @@ def __init__(self, ivm): self.data_histogram = CurrentDataHistogramWidget(self) # Layout of the ortho slice viewers and histograms - gview = QtGui.QWidget() - self.layout_grid = QtGui.QGridLayout() + gview = QtWidgets.QWidget() + self.layout_grid = QtWidgets.QGridLayout() gview.setLayout(self.layout_grid) self.layout_grid.setHorizontalSpacing(2) @@ -186,14 +186,14 @@ def __init__(self, ivm): self.layout_grid.setRowStretch(1, 1) # Navigation controls layout - control_box = QtGui.QWidget() - vbox = QtGui.QVBoxLayout() + control_box = QtWidgets.QWidget() + vbox = QtWidgets.QVBoxLayout() vbox.setSpacing(5) control_box.setLayout(vbox) # Navigation sliders and the ROI/Overlay view controls #vbox.addWidget(DataSummary(self)) - hbox = QtGui.QHBoxLayout() + hbox = QtWidgets.QHBoxLayout() nav_box = NavigationBox(self) hbox.addWidget(nav_box) roi_box = ViewParamsWidget(self, rois=True, data=False) diff --git a/quantiphyse/gui/widgets.py b/quantiphyse/gui/widgets.py index 7c34e1c6..31751dcd 100644 --- a/quantiphyse/gui/widgets.py +++ b/quantiphyse/gui/widgets.py @@ -32,7 +32,7 @@ from quantiphyse.gui.dialogs import error_dialog, TextViewerDialog, MultiTextViewerDialog, MatrixViewerDialog import quantiphyse.gui.dialogs -class QpWidget(QtGui.QWidget, LogSource): +class QpWidget(QtWidgets.QWidget, LogSource): """ Base class for a Quantiphyse widget @@ -47,7 +47,7 @@ class QpWidget(QtGui.QWidget, LogSource): def __init__(self, **kwargs): LogSource.__init__(self) - QtGui.QWidget.__init__(self) + QtWidgets.QWidget.__init__(self) # Basic metadata self.name = kwargs.get("name", "") @@ -118,25 +118,25 @@ def processes(self): """ raise NotImplementedError("This widget does not support the batch process system") -class FingerTabBarWidget(QtGui.QTabBar): +class FingerTabBarWidget(QtWidgets.QTabBar): """ Vertical tab bar used for the analysis widget setSelectionMode """ def __init__(self, tab_widget, parent=None, *args, **kwargs): self.tab_size = QtCore.QSize(kwargs.pop('width', 100), kwargs.pop('height', 25)) - QtGui.QTabBar.__init__(self, parent, *args, **kwargs) + QtWidgets.QTabBar.__init__(self, parent, *args, **kwargs) self.close_icon = QtGui.QIcon(get_icon("close")) self.tab_widget = tab_widget def paintEvent(self, _): - painter = QtGui.QStylePainter(self) - option = QtGui.QStyleOptionTab() + painter = QtWidgets.QStylePainter(self) + option = QtWidgets.QStyleOptionTab() for index in range(self.count()): self.initStyleOption(option, index) tab_rect = self.tabRect(index) tab_rect.moveLeft(10) - painter.drawControl(QtGui.QStyle.CE_TabBarTabShape, option) + painter.drawControl(QtWidgets.QStyle.CE_TabBarTabShape, option) painter.drawText(tab_rect, QtCore.Qt.AlignVCenter | QtCore.Qt.AlignHCenter, self.tabText(index)) @@ -151,7 +151,7 @@ def paintEvent(self, _): painter.end() def mousePressEvent(self, evt): - QtGui.QTabBar.mousePressEvent(self, evt) + QtWidgets.QTabBar.mousePressEvent(self, evt) idx = self.tabAt(evt.pos()) if idx >= 0 and evt.button() == QtCore.Qt.LeftButton: tab_rect = self.tabRect(idx) @@ -167,18 +167,18 @@ def mousePressEvent(self, evt): def tabSizeHint(self, _): return self.tab_size -class FingerTabWidget(QtGui.QTabWidget): +class FingerTabWidget(QtWidgets.QTabWidget): """ A QTabWidget equivalent which uses our FingerTabBarWidget """ def __init__(self, parent, *args): - QtGui.QTabWidget.__init__(self, parent, *args) + QtWidgets.QTabWidget.__init__(self, parent, *args) self.setTabBar(FingerTabBarWidget(self, width=110, height=50)) - self.setTabPosition(QtGui.QTabWidget.West) + self.setTabPosition(QtWidgets.QTabWidget.West) self.setMovable(False) self.setIconSize(QtCore.QSize(16, 16)) -class HelpButton(QtGui.QPushButton): +class HelpButton(QtWidgets.QPushButton): """ A button for online help """ @@ -195,7 +195,7 @@ def __init__(self, parent, section=""): def _help_clicked(self): show_help(self.section) -class BatchButton(QtGui.QPushButton): +class BatchButton(QtWidgets.QPushButton): """ A button which displays the batch file code for the current analysis widget """ @@ -241,7 +241,7 @@ def show_batch_options(self): else: error_dialog("This widget does not provide a list of batch options") -class OverlayCombo(QtGui.QComboBox): +class OverlayCombo(QtWidgets.QComboBox): """ A combo box which gives a choice of data @@ -331,13 +331,13 @@ def __init__(self, ivm, *args, **kwargs): kwargs["data"] = False super(RoiCombo, self).__init__(ivm, *args, **kwargs) -class NumericOption(QtGui.QWidget): +class NumericOption(QtWidgets.QWidget): """ Option whose value must be a number (int or float) """ sig_changed = QtCore.Signal() def __init__(self, text, grid, ypos, xpos=0, minval=0, maxval=100, default=0, step=1, decimals=2, intonly=False, spin=True): - QtGui.QWidget.__init__(self) + QtWidgets.QWidget.__init__(self) self.use_spin = spin self.text = text self.minval = minval @@ -349,14 +349,14 @@ def __init__(self, text, grid, ypos, xpos=0, minval=0, maxval=100, default=0, st else: self.rtype = float - self.label = QtGui.QLabel(text) + self.label = QtWidgets.QLabel(text) grid.addWidget(self.label, ypos, xpos) if spin: if intonly: - self.spin = QtGui.QSpinBox() + self.spin = QtWidgets.QSpinBox() else: - self.spin = QtGui.QDoubleSpinBox() + self.spin = QtWidgets.QDoubleSpinBox() self.spin.setDecimals(decimals) self.spin.setMinimum(minval) self.spin.setMaximum(maxval) @@ -365,7 +365,7 @@ def __init__(self, text, grid, ypos, xpos=0, minval=0, maxval=100, default=0, st self.spin.valueChanged.connect(self._changed) grid.addWidget(self.spin, ypos, xpos+1) else: - self.edit = QtGui.QLineEdit(str(default)) + self.edit = QtWidgets.QLineEdit(str(default)) self.edit.editingFinished.connect(self._edit_changed) grid.addWidget(self.edit, ypos, xpos+1) @@ -391,14 +391,14 @@ def value(self): else: raise QpException("'%s' is not a valid number") -class NumericSlider(QtGui.QWidget): +class NumericSlider(QtWidgets.QWidget): """ Numeric option chooser which uses a slider and two spin boxes """ sig_changed = QtCore.Signal() def __init__(self, text, grid, ypos, xpos=0, minval=0, maxval=100, default=0, intonly=False, **kwargs): - QtGui.QWidget.__init__(self) + QtWidgets.QWidget.__init__(self) self.text = text self.minval = minval self.maxval = maxval @@ -411,24 +411,24 @@ def __init__(self, text, grid, ypos, xpos=0, minval=0, maxval=100, default=0, in else: self.rtype = float - self.label = QtGui.QLabel(text) + self.label = QtWidgets.QLabel(text) grid.addWidget(self.label, ypos, xpos) - hbox = QtGui.QHBoxLayout() + hbox = QtWidgets.QHBoxLayout() self.setLayout(hbox) - #self.min_edit = QtGui.QLineEdit(str(minval)) + #self.min_edit = QtWidgets.QLineEdit(str(minval)) #self.min_edit.editingFinished.connect(self_min_changed) #hbox.addWidget(self.min_edit) - self.slider = QtGui.QSlider(QtCore.Qt.Horizontal) + self.slider = QtWidgets.QSlider(QtCore.Qt.Horizontal) self.slider.setMaximum(100) self.slider.setMinimum(0) self.slider.setSliderPosition(int(100 * (default - minval) / (maxval - minval))) self.slider.valueChanged.connect(self._slider_changed) hbox.addWidget(self.slider) - self.val_edit = QtGui.QLineEdit(str(default)) + self.val_edit = QtWidgets.QLineEdit(str(default)) self.val_edit.editingFinished.connect(self._edit_changed) hbox.addWidget(self.val_edit) @@ -491,19 +491,19 @@ def setLimits(self, minval=None, maxval=None): finally: self.blockSignals(False) -class OptionalName(QtGui.QWidget): +class OptionalName(QtWidgets.QWidget): """ String option which can be enabled or disabled """ sig_changed = QtCore.Signal() def __init__(self, text, grid, ypos, xpos=0, default_on=False, default=""): - QtGui.QWidget.__init__(self) + QtWidgets.QWidget.__init__(self) - self.label = QtGui.QCheckBox(text) + self.label = QtWidgets.QCheckBox(text) self.label.setChecked(default_on) grid.addWidget(self.label, ypos, xpos) - self.edit = QtGui.QLineEdit(default) + self.edit = QtWidgets.QLineEdit(default) self.edit.editingFinished.connect(self._edit_changed) grid.addWidget(self.edit, ypos, xpos+1) @@ -523,26 +523,26 @@ def value(self): """ Return the current text entered """ return self.edit.text() -class ChoiceOption(QtGui.QWidget): +class ChoiceOption(QtWidgets.QWidget): """ Option which is chosen from a list of possible strings """ sig_changed = QtCore.Signal() def __init__(self, text, grid, ypos, xpos=0, choices=None): - QtGui.QWidget.__init__(self) + QtWidgets.QWidget.__init__(self) if choices is None: choices = [] self.choices = choices - self.label = QtGui.QLabel(text) + self.label = QtWidgets.QLabel(text) grid.addWidget(self.label, ypos, xpos) - self.combo = QtGui.QComboBox() + self.combo = QtWidgets.QComboBox() for c in choices: self.combo.addItem(c) self.combo.currentIndexChanged.connect(self._changed) # Bizarre hack to make the dropdown height adjust to the items added - self.combo.setView(QtGui.QListView()) + self.combo.setView(QtWidgets.QListView()) grid.addWidget(self.combo, ypos, xpos+1) def _changed(self): @@ -552,12 +552,12 @@ def value(self): """ Get currently selected text """ return self.combo.currentText() -class NumberList(QtGui.QTableWidget): +class NumberList(QtWidgets.QTableWidget): """ Horizontal list of numeric values """ def __init__(self, initial): - QtGui.QTableWidget.__init__(self, 1, 1) + QtWidgets.QTableWidget.__init__(self, 1, 1) self.horizontalHeader().hide() self.verticalHeader().hide() self.setValues(initial) @@ -586,15 +586,15 @@ def setValues(self, vals): try: self.setColumnCount(len(vals)+1) for c, val in enumerate(vals): - self.setItem(0, c, QtGui.QTableWidgetItem("%g" % val)) - self.setItem(0, self.columnCount()-1, QtGui.QTableWidgetItem("...")) + self.setItem(0, c, QtWidgets.QTableWidgetItem("%g" % val)) + self.setItem(0, self.columnCount()-1, QtWidgets.QTableWidgetItem("...")) self.resizeColumnsToContents() self.resizeRowsToContents() finally: self.blockSignals(False) def contextMenuEvent(self, event): - menu = QtGui.QMenu(self) + menu = QtWidgets.QMenu(self) insertAction = menu.addAction("Insert before") deleteAction = menu.addAction("Delete") item = self.itemAt(event.pos()) @@ -610,7 +610,7 @@ def deleteValue(self, col): try: for c in range(col, self.columnCount()-1): item = self.item(0, c+1) - self.setItem(0, c, QtGui.QTableWidgetItem(item.text())) + self.setItem(0, c, QtWidgets.QTableWidgetItem(item.text())) self.setColumnCount(self.columnCount()-1) self.resizeRowsToContents() finally: @@ -622,8 +622,8 @@ def insertValue(self, col, val): self.setColumnCount(self.columnCount()+1) for c in range(self.columnCount()-1, col, -1): item = self.item(0, c-1) - self.setItem(0, c, QtGui.QTableWidgetItem(item.text())) - self.setItem(0, col, QtGui.QTableWidgetItem("%g" % val)) + self.setItem(0, c, QtWidgets.QTableWidgetItem(item.text())) + self.setItem(0, col, QtWidgets.QTableWidgetItem("%g" % val)) self.resizeRowsToContents() finally: self.blockSignals(False) @@ -645,7 +645,7 @@ def _item_changed(self, item): self.blockSignals(True) try: self.setColumnCount(self.columnCount()+1) - self.setItem(0, self.columnCount()-1, QtGui.QTableWidgetItem("...")) + self.setItem(0, self.columnCount()-1, QtWidgets.QTableWidgetItem("...")) finally: self.blockSignals(False) self.resizeColumnsToContents() @@ -704,21 +704,21 @@ def _choose_row_col(self, vals): return None, r.leftColumn() return None, None -class LoadNumbers(QtGui.QPushButton): +class LoadNumbers(QtWidgets.QPushButton): """ PushButton which loads values into a NumberList """ def __init__(self, num_list, label="Load"): - QtGui.QPushButton.__init__(self, label) + QtWidgets.QPushButton.__init__(self, label) self.num_list = num_list self.clicked.connect(self._button_clicked) def _button_clicked(self): - filename = QtGui.QFileDialog.getOpenFileName()[0] + filename = QtWidgets.QFileDialog.getOpenFileName()[0] if filename: self.num_list.loadFromFile(filename) -class NumberGrid(QtGui.QTableView): +class NumberGrid(QtWidgets.QTableView): """ Table of numeric values """ @@ -727,7 +727,7 @@ class NumberGrid(QtGui.QTableView): def __init__(self, initial, col_headers=None, row_headers=None, expandable=(True, True), fix_height=False, fix_width=False, readonly=False): - QtGui.QTableView.__init__(self) + QtWidgets.QTableView.__init__(self) self._model = QtGui.QStandardItemModel() self.setModel(self._model) @@ -744,12 +744,12 @@ def __init__(self, initial, col_headers=None, row_headers=None, expandable=(True self.setValues(initial, False, col_headers=col_headers, row_headers=row_headers) if readonly: - self.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers) + self.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) else: self.model().itemChanged.connect(self._item_changed) - self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) - #self.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents) + self.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) + #self.horizontalHeader().setResizeMode(QtWidgets.QHeaderView.ResizeToContents) self.itemDelegate().closeEditor.connect(self._expand_if_required, QtCore.Qt.QueuedConnection) self.setAcceptDrops(True) @@ -980,23 +980,23 @@ def values(self): def setValues(self, values, validate=True): NumberGrid.setValues(self, [values,], validate) -class Citation(QtGui.QWidget): +class Citation(QtWidgets.QWidget): def __init__(self, title, author, journal): - QtGui.QWidget.__init__(self) + QtWidgets.QWidget.__init__(self) self.title, self.author, self.journal = title, author, journal - hbox = QtGui.QHBoxLayout() + hbox = QtWidgets.QHBoxLayout() self.setLayout(hbox) - btn = QtGui.QPushButton() + btn = QtWidgets.QPushButton() icon = QtGui.QIcon(get_icon("citation")) btn.setIcon(icon) - btn.setSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Maximum) + btn.setSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Maximum) btn.clicked.connect(self.lookup) hbox.addWidget(btn) hbox.setAlignment(btn, QtCore.Qt.AlignTop) text = "" + title + "
" + author + "
" + journal + "
" - label = QtGui.QLabel(text) + label = QtWidgets.QLabel(text) label.setWordWrap(True) hbox.addWidget(label) @@ -1007,17 +1007,17 @@ def lookup(self): url = "https://www.google.com/search?q=%s+%s+%s" % search_terms webbrowser.open(url, new=0, autoraise=True) -class OptionsButton(QtGui.QPushButton): +class OptionsButton(QtWidgets.QPushButton): def __init__(self, widget=None): - QtGui.QPushButton.__init__(self) + QtWidgets.QPushButton.__init__(self) self.setIcon(QtGui.QIcon(get_icon("options.png"))) self.setIconSize(QtCore.QSize(14, 14)) if widget: self.clicked.connect(widget.show_options) -class LicenseButton(QtGui.QPushButton): +class LicenseButton(QtWidgets.QPushButton): def __init__(self, license): - QtGui.QPushButton.__init__(self) + QtWidgets.QPushButton.__init__(self) self._license = license self.setIcon(QtGui.QIcon(get_icon("license.png"))) self.setIconSize(QtCore.QSize(14, 14)) @@ -1030,22 +1030,22 @@ def show_license(self): self.logview.show() self.logview.raise_() -class TitleWidget(QtGui.QWidget): +class TitleWidget(QtWidgets.QWidget): def __init__(self, widget, title=None, subtitle=None, help="", help_btn=True, batch_btn=True, opts_btn=False, lic_btn=True, icon=True): - QtGui.QWidget.__init__(self) + QtWidgets.QWidget.__init__(self) if title is None: title = widget.name if subtitle is None: subtitle = widget.description - vbox = QtGui.QVBoxLayout() + vbox = QtWidgets.QVBoxLayout() self.setLayout(vbox) - hbox = QtGui.QHBoxLayout() + hbox = QtWidgets.QHBoxLayout() if icon and hasattr(widget, "icon"): - icon = QtGui.QLabel() + icon = QtWidgets.QLabel() icon.setPixmap(widget.icon.pixmap(32, 32)) hbox.addWidget(icon) - hbox.addWidget(QtGui.QLabel('%s' % title)) + hbox.addWidget(QtWidgets.QLabel('%s' % title)) hbox.addStretch(1) if batch_btn: hbox.addWidget(BatchButton(widget)) if help_btn: hbox.addWidget(HelpButton(self, help)) @@ -1053,13 +1053,13 @@ def __init__(self, widget, title=None, subtitle=None, help="", help_btn=True, ba if lic_btn and widget.license: hbox.addWidget(LicenseButton(widget.license)) vbox.addLayout(hbox) - hbox = QtGui.QHBoxLayout() - hbox.addWidget(QtGui.QLabel(subtitle)) + hbox = QtWidgets.QHBoxLayout() + hbox.addWidget(QtWidgets.QLabel(subtitle)) hbox.addStretch(1) - hbox.addWidget(QtGui.QLabel(widget.version)) + hbox.addWidget(QtWidgets.QLabel(widget.version)) vbox.addLayout(hbox) -class RunBox(QtGui.QGroupBox, LogSource): +class RunBox(QtWidgets.QGroupBox, LogSource): sig_postrun = QtCore.Signal() @@ -1070,42 +1070,42 @@ class RunBox(QtGui.QGroupBox, LogSource): """ def __init__(self, get_process_fn=None, get_rundata_fn=None, widget=None, ivm=None, title="Run", btn_label="Run", save_option=False): LogSource.__init__(self) - QtGui.QGroupBox.__init__(self) + QtWidgets.QGroupBox.__init__(self) self.save_option = save_option self.setTitle(title) - self.setSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.MinimumExpanding) + self.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding) - vbox = QtGui.QVBoxLayout() + vbox = QtWidgets.QVBoxLayout() self.setLayout(vbox) - hbox = QtGui.QHBoxLayout() - self.runBtn = QtGui.QPushButton(btn_label, self) + hbox = QtWidgets.QHBoxLayout() + self.runBtn = QtWidgets.QPushButton(btn_label, self) self.runBtn.clicked.connect(self.start) hbox.addWidget(self.runBtn) - self.progress = QtGui.QProgressBar(self) + self.progress = QtWidgets.QProgressBar(self) hbox.addWidget(self.progress) - self.cancelBtn = QtGui.QPushButton('Cancel', self) + self.cancelBtn = QtWidgets.QPushButton('Cancel', self) self.cancelBtn.clicked.connect(self._cancel) self.cancelBtn.setEnabled(False) hbox.addWidget(self.cancelBtn) - self.logBtn = QtGui.QPushButton('View log', self) + self.logBtn = QtWidgets.QPushButton('View log', self) self.logBtn.clicked.connect(self._view_log) self.logBtn.setEnabled(False) hbox.addWidget(self.logBtn) vbox.addLayout(hbox) - self.step_label = QtGui.QLabel() + self.step_label = QtWidgets.QLabel() self.step_label.setVisible(False) vbox.addWidget(self.step_label) if self.save_option: - hbox = QtGui.QHBoxLayout() - self.save_cb = QtGui.QCheckBox("Save copy of output data") + hbox = QtWidgets.QHBoxLayout() + self.save_cb = QtWidgets.QCheckBox("Save copy of output data") hbox.addWidget(self.save_cb) - self.save_folder_edit = QtGui.QLineEdit() + self.save_folder_edit = QtWidgets.QLineEdit() hbox.addWidget(self.save_folder_edit) - btn = QtGui.QPushButton("Choose folder") + btn = QtWidgets.QPushButton("Choose folder") btn.clicked.connect(self._choose_output_folder) hbox.addWidget(btn) self.save_cb.stateChanged.connect(self.save_folder_edit.setEnabled) @@ -1188,11 +1188,11 @@ def _view_log(self): self.logview.raise_() def _choose_output_folder(self): - outputDir = QtGui.QFileDialog.getExistingDirectory(self, 'Choose directory to save output') + outputDir = QtWidgets.QFileDialog.getExistingDirectory(self, 'Choose directory to save output') if outputDir: self.save_folder_edit.setText(outputDir) -class RunButton(QtGui.QPushButton, LogSource): +class RunButton(QtWidgets.QPushButton, LogSource): """ Simple button to run the processing associated with a QpWidget @@ -1203,7 +1203,7 @@ class RunButton(QtGui.QPushButton, LogSource): def __init__(self, widget, label="Run"): LogSource.__init__(self) - QtGui.QPushButton.__init__(self, label) + QtWidgets.QPushButton.__init__(self, label) self.clicked.connect(self._start) self.widget = widget @@ -1229,7 +1229,7 @@ def _finished(self, status, log, exception): finally: self.sig_postrun.emit() -class RunWidget(QtGui.QGroupBox, LogSource): +class RunWidget(QtWidgets.QGroupBox, LogSource): """ Box containing a 'run' button, a progress bar, a 'cancel' button and a 'view log' button @@ -1240,41 +1240,41 @@ class RunWidget(QtGui.QGroupBox, LogSource): def __init__(self, widget, title="Run", btn_label="Run", save_option=False): LogSource.__init__(self) - QtGui.QGroupBox.__init__(self) + QtWidgets.QGroupBox.__init__(self) self.save_option = save_option self.setTitle(title) - self.setSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.MinimumExpanding) + self.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding) - vbox = QtGui.QVBoxLayout() + vbox = QtWidgets.QVBoxLayout() self.setLayout(vbox) - hbox = QtGui.QHBoxLayout() - self.runBtn = QtGui.QPushButton(btn_label, self) + hbox = QtWidgets.QHBoxLayout() + self.runBtn = QtWidgets.QPushButton(btn_label, self) self.runBtn.clicked.connect(self.start) hbox.addWidget(self.runBtn) - self.progress = QtGui.QProgressBar(self) + self.progress = QtWidgets.QProgressBar(self) hbox.addWidget(self.progress) - self.cancelBtn = QtGui.QPushButton('Cancel', self) + self.cancelBtn = QtWidgets.QPushButton('Cancel', self) self.cancelBtn.clicked.connect(self._cancel) self.cancelBtn.setEnabled(False) hbox.addWidget(self.cancelBtn) - self.logBtn = QtGui.QPushButton('View log', self) + self.logBtn = QtWidgets.QPushButton('View log', self) self.logBtn.clicked.connect(self._view_log) hbox.addWidget(self.logBtn) vbox.addLayout(hbox) - self.step_label = QtGui.QLabel() + self.step_label = QtWidgets.QLabel() self.step_label.setVisible(False) vbox.addWidget(self.step_label) if self.save_option: - hbox = QtGui.QHBoxLayout() - self.save_cb = QtGui.QCheckBox("Save copy of output data") + hbox = QtWidgets.QHBoxLayout() + self.save_cb = QtWidgets.QCheckBox("Save copy of output data") hbox.addWidget(self.save_cb) - self.save_folder_edit = QtGui.QLineEdit() + self.save_folder_edit = QtWidgets.QLineEdit() hbox.addWidget(self.save_folder_edit) - btn = QtGui.QPushButton("Choose folder") + btn = QtWidgets.QPushButton("Choose folder") btn.clicked.connect(self._choose_output_folder) hbox.addWidget(btn) self.save_cb.stateChanged.connect(self.save_folder_edit.setEnabled) @@ -1344,11 +1344,11 @@ def _view_log(self): self.logview.raise_() def _choose_output_folder(self): - outputDir = QtGui.QFileDialog.getExistingDirectory(self, 'Choose directory to save output') + outputDir = QtWidgets.QFileDialog.getExistingDirectory(self, 'Choose directory to save output') if outputDir: self.save_folder_edit.setText(outputDir) -class OrderList(QtGui.QListView): +class OrderList(QtWidgets.QListView): """ Vertical list of items which can be re-ordered but not changed directly """ @@ -1356,9 +1356,9 @@ class OrderList(QtGui.QListView): sig_changed = QtCore.Signal() def __init__(self, initial=(), col_headers=None): - QtGui.QListView.__init__(self) - self.setSelectionMode(QtGui.QAbstractItemView.SingleSelection) - #self.setSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) + QtWidgets.QListView.__init__(self) + self.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection) + #self.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) self.model = QtGui.QStandardItemModel() self.setModel(self.model) #if col_headers: @@ -1409,40 +1409,40 @@ def currentDown(self): self.setCurrentIndex(self.model.index(idx+1, 0)) self.sig_changed.emit() -class OrderListButtons(QtGui.QVBoxLayout): +class OrderListButtons(QtWidgets.QVBoxLayout): def __init__(self, orderlist): - QtGui.QVBoxLayout.__init__(self) + QtWidgets.QVBoxLayout.__init__(self) self.list = orderlist - self.up_btn = QtGui.QPushButton() + self.up_btn = QtWidgets.QPushButton() self.up_btn.setIcon(QtGui.QIcon(get_icon("up.png"))) self.up_btn.setFixedSize(16, 16) self.up_btn.clicked.connect(self.list.currentUp) self.addWidget(self.up_btn) - self.down_btn = QtGui.QPushButton() + self.down_btn = QtWidgets.QPushButton() self.down_btn.setIcon(QtGui.QIcon(get_icon("down.png"))) self.down_btn.setFixedSize(16, 16) self.down_btn.clicked.connect(self.list.currentDown) self.addWidget(self.down_btn) -class WarningBox(QtGui.QFrame): +class WarningBox(QtWidgets.QFrame): """ Widget which just displays a warning, e.g. when a QpWidget can't be used for some reason """ def __init__(self, text=""): - QtGui.QFrame.__init__(self) - hbox = QtGui.QHBoxLayout() + QtWidgets.QFrame.__init__(self) + hbox = QtWidgets.QHBoxLayout() hbox.setSpacing(0) hbox.setContentsMargins(0, 0, 0, 0) self.setLayout(hbox) #self.warn_icon = QtGui.QIcon.fromTheme("dialog-error") - self.icon = QtGui.QLabel() - self.warn_icon = self.icon.style().standardIcon(QtGui.QStyle.SP_MessageBoxWarning) + self.icon = QtWidgets.QLabel() + self.warn_icon = self.icon.style().standardIcon(QtWidgets.QStyle.SP_MessageBoxWarning) self.icon.setPixmap(self.warn_icon.pixmap(32, 32)) hbox.addWidget(self.icon) - self.text = QtGui.QLabel() + self.text = QtWidgets.QLabel() self.text.setWordWrap(True) hbox.addWidget(self.text) hbox.setStretchFactor(self.text, 2) @@ -1460,29 +1460,29 @@ def warn(self, text=""): def clear(self): self.setVisible(False) -class MultiExpander(QtGui.QWidget): +class MultiExpander(QtWidgets.QWidget): """ Generic expander widget, alternative to tab box which allows all to be 'closed' """ def __init__(self, widgets, parent=None, default_visible=None): super(MultiExpander, self).__init__(parent) - vbox = QtGui.QVBoxLayout() + vbox = QtWidgets.QVBoxLayout() - self.arrow_right = self.style().standardIcon(QtGui.QStyle.SP_ArrowRight) - self.arrow_down = self.style().standardIcon(QtGui.QStyle.SP_ArrowDown) + self.arrow_right = self.style().standardIcon(QtWidgets.QStyle.SP_ArrowRight) + self.arrow_down = self.style().standardIcon(QtWidgets.QStyle.SP_ArrowDown) self.widgets = widgets self.toggle_btns = {} - btn_hbox = QtGui.QHBoxLayout() - w_hbox = QtGui.QHBoxLayout() + btn_hbox = QtWidgets.QHBoxLayout() + w_hbox = QtWidgets.QHBoxLayout() for name, w in self.widgets.items(): if name == default_visible: w.setVisible(True) - self.toggle_btns[name] = QtGui.QPushButton(self.arrow_down, name) + self.toggle_btns[name] = QtWidgets.QPushButton(self.arrow_down, name) else: w.setVisible(False) - self.toggle_btns[name] = QtGui.QPushButton(self.arrow_right, name) + self.toggle_btns[name] = QtWidgets.QPushButton(self.arrow_right, name) self.toggle_btns[name].clicked.connect(self._toggle(name)) btn_hbox.addWidget(self.toggle_btns[name]) w_hbox.addWidget(w) @@ -1503,7 +1503,7 @@ def _cb(): w.setVisible(False) return _cb -class ElidedLabel(QtGui.QFrame): +class ElidedLabel(QtWidgets.QFrame): """ Equivalent to a QLabel but uses ellipsis to clip long text and prevents the label from growing beyond it's natural size @@ -1513,17 +1513,17 @@ class ElidedLabel(QtGui.QFrame): https://stackoverflow.com/questions/7381100/text-overflow-for-a-qlabel-s-text-rendering-in-qt """ def __init__(self, text="", parent=None): - QtGui.QFrame.__init__(self, parent) + QtWidgets.QFrame.__init__(self, parent) self._content = text self._elided = False - self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) + self.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) def setText(self, text): self._content = text self.update() def paintEvent(self, event): - QtGui.QFrame.paintEvent(self, event) + QtWidgets.QFrame.paintEvent(self, event) painter = QtGui.QPainter(self) metrics = painter.fontMetrics() line_spacing = metrics.lineSpacing() diff --git a/quantiphyse/packages/core/aif/widget.py b/quantiphyse/packages/core/aif/widget.py index ae3ac0c9..84bb099c 100644 --- a/quantiphyse/packages/core/aif/widget.py +++ b/quantiphyse/packages/core/aif/widget.py @@ -40,7 +40,7 @@ def __init__(self, **kwargs): self._aif_points = [] def init_ui(self): - vbox = QtGui.QVBoxLayout() + vbox = QtWidgets.QVBoxLayout() self.setLayout(vbox) title = TitleWidget(self) @@ -48,12 +48,12 @@ def init_ui(self): self._options = OptionBox("Options") self._options.add("Signal data", DataOption(self.ivm), key="data") - self._clear_btn = QtGui.QPushButton("Clear points") + self._clear_btn = QtWidgets.QPushButton("Clear points") self._options.add("Method", ChoiceOption(["Pick points", "Use existing ROI"], ["points", "roi"]), self._clear_btn, key="method") self._options.add("ROI", DataOption(self.ivm, data=False, rois=True), key="roi") - self._view_btn = QtGui.QPushButton("View") + self._view_btn = QtWidgets.QPushButton("View") self._view_btn.setEnabled(False) - self._save_btn = QtGui.QPushButton("Save") + self._save_btn = QtWidgets.QPushButton("Save") self._save_btn.setEnabled(False) self._options.add("AIF name", TextOption("aif"), self._view_btn, self._save_btn, key="output-name") self._options.option("method").sig_changed.connect(self._method_changed) diff --git a/quantiphyse/packages/core/analysis/tests.py b/quantiphyse/packages/core/analysis/tests.py index 6beb0172..057236fe 100644 --- a/quantiphyse/packages/core/analysis/tests.py +++ b/quantiphyse/packages/core/analysis/tests.py @@ -58,7 +58,7 @@ def testCopy(self): self.w.data.value = ["data_3d",] self.harmless_click(self.w.butgen) self.harmless_click(self.w.copy_btn) - cb = QtGui.QApplication.clipboard() + cb = QtWidgets.QApplication.clipboard() rows = [row.split("\t") for row in cb.text().split("\n")] self.assertEquals(rows[0][0], "") self.assertEquals(rows[0][1].strip(), "data_3d") diff --git a/quantiphyse/packages/core/analysis/widgets.py b/quantiphyse/packages/core/analysis/widgets.py index 76415b39..a22f49e1 100644 --- a/quantiphyse/packages/core/analysis/widgets.py +++ b/quantiphyse/packages/core/analysis/widgets.py @@ -53,7 +53,7 @@ def __init__(self, **kwargs): def init_ui(self): self.setStatusTip("Click points on the 4D volume to see data curve") - vbox = QtGui.QVBoxLayout() + vbox = QtWidgets.QVBoxLayout() self.setLayout(vbox) title = TitleWidget(self, "Multi-Voxel Visualisation", help="curve_compare", batch_btn=False) @@ -77,7 +77,7 @@ def init_ui(self): self.options.option("mean").sig_changed.connect(self._mean_changed) self.options.option("col").sig_changed.connect(self._col_changed) - hbox = QtGui.QHBoxLayout() + hbox = QtWidgets.QHBoxLayout() hbox.addWidget(self.options) hbox.addStretch() vbox.addLayout(hbox) @@ -202,17 +202,17 @@ def init_ui(self): self.process = DataStatisticsProcess(self.ivm) self.process_ss = DataStatisticsProcess(self.ivm) - main_vbox = QtGui.QVBoxLayout() + main_vbox = QtWidgets.QVBoxLayout() title = TitleWidget(self, help="overlay_stats", batch_btn=False) main_vbox.addWidget(title) - hbox = QtGui.QHBoxLayout() - hbox.addWidget(QtGui.QLabel("Data selection")) + hbox = QtWidgets.QHBoxLayout() + hbox.addWidget(QtWidgets.QLabel("Data selection")) self.data = DataOption(self.ivm, multi=True) self.data.sig_changed.connect(self.update_all) hbox.addWidget(self.data) - hbox.addWidget(QtGui.QLabel("ROI")) + hbox.addWidget(QtWidgets.QLabel("ROI")) self.roi = DataOption(self.ivm, data=False, rois=True, none_option=True) self.roi.sig_changed.connect(self.update_all) hbox.addWidget(self.roi) @@ -220,10 +220,10 @@ def init_ui(self): hbox.setStretch(3, 1) main_vbox.addLayout(hbox) - hbox = QtGui.QHBoxLayout() - self.current_vol = QtGui.QCheckBox("Current volume only") + hbox = QtWidgets.QHBoxLayout() + self.current_vol = QtWidgets.QCheckBox("Current volume only") hbox.addWidget(self.current_vol) - self.exact_median = QtGui.QCheckBox("Exact median") + self.exact_median = QtWidgets.QCheckBox("Exact median") self.exact_median.setToolTip("Computing an exact median can fail on extremely large data sets") hbox.addWidget(self.exact_median) hbox.addStretch(1) @@ -231,24 +231,24 @@ def init_ui(self): self.current_vol.stateChanged.connect(self.update_all) # Summary stats - stats_box = QtGui.QGroupBox() + stats_box = QtWidgets.QGroupBox() stats_box.setTitle('Summary Statistics') - vbox = QtGui.QVBoxLayout() + vbox = QtWidgets.QVBoxLayout() stats_box.setLayout(vbox) - hbox = QtGui.QHBoxLayout() - self.butgen = QtGui.QPushButton("Show") + hbox = QtWidgets.QHBoxLayout() + self.butgen = QtWidgets.QPushButton("Show") self.butgen.setToolTip("Show standard statistics for the data in each ROI") self.butgen.clicked.connect(self.show_stats) hbox.addWidget(self.butgen) - self.copy_btn = QtGui.QPushButton("Copy") + self.copy_btn = QtWidgets.QPushButton("Copy") self.copy_btn.clicked.connect(self.copy_stats) self.copy_btn.setVisible(False) hbox.addWidget(self.copy_btn) hbox.addStretch(1) vbox.addLayout(hbox) - self.stats_table = QtGui.QTableView() + self.stats_table = QtWidgets.QTableView() self.stats_table.resizeColumnsToContents() self.stats_table.setModel(self.process.model) self.stats_table.setVisible(False) @@ -258,35 +258,35 @@ def init_ui(self): # Summary stats (single slice) - stats_box_ss = QtGui.QGroupBox() + stats_box_ss = QtWidgets.QGroupBox() stats_box_ss.setTitle('Summary Statistics - Slice') - vbox = QtGui.QVBoxLayout() + vbox = QtWidgets.QVBoxLayout() stats_box_ss.setLayout(vbox) - hbox = QtGui.QHBoxLayout() - self.butgenss = QtGui.QPushButton("Show") + hbox = QtWidgets.QHBoxLayout() + self.butgenss = QtWidgets.QPushButton("Show") self.butgenss.setToolTip("Show standard statistics for the current slice") self.butgenss.clicked.connect(self.show_stats_current_slice) hbox.addWidget(self.butgenss) - self.slice_dir_label = QtGui.QLabel("Slice direction:") + self.slice_dir_label = QtWidgets.QLabel("Slice direction:") self.slice_dir_label.setVisible(False) hbox.addWidget(self.slice_dir_label) - self.sscombo = QtGui.QComboBox() + self.sscombo = QtWidgets.QComboBox() self.sscombo.addItem("Axial") self.sscombo.addItem("Coronal") self.sscombo.addItem("Sagittal") - self.sscombo.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) + self.sscombo.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContents) self.sscombo.currentIndexChanged.connect(self.focus_changed) self.sscombo.setVisible(False) hbox.addWidget(self.sscombo) - self.copy_btn_ss = QtGui.QPushButton("Copy") + self.copy_btn_ss = QtWidgets.QPushButton("Copy") self.copy_btn_ss.clicked.connect(self.copy_stats_ss) self.copy_btn_ss.setVisible(False) hbox.addWidget(self.copy_btn_ss) hbox.addStretch(1) vbox.addLayout(hbox) - self.stats_table_ss = QtGui.QTableView() + self.stats_table_ss = QtWidgets.QTableView() self.stats_table_ss.resizeColumnsToContents() self.stats_table_ss.setModel(self.process_ss.model) self.stats_table_ss.setVisible(False) @@ -389,31 +389,31 @@ def __init__(self, **kwargs): def init_ui(self): self.process = CalcVolumesProcess(self.ivm) - layout = QtGui.QVBoxLayout() + layout = QtWidgets.QVBoxLayout() self.setLayout(layout) title = TitleWidget(self, help="roi_analysis") layout.addWidget(title) - info = QtGui.QLabel("
Calculate size and volume of an ROI
") + info = QtWidgets.QLabel("
Calculate size and volume of an ROI
") info.setWordWrap(True) layout.addWidget(info) - hbox = QtGui.QHBoxLayout() - hbox.addWidget(QtGui.QLabel('ROI: ')) + hbox = QtWidgets.QHBoxLayout() + hbox.addWidget(QtWidgets.QLabel('ROI: ')) self.combo = RoiCombo(self.ivm) self.combo.currentIndexChanged.connect(self.update) hbox.addWidget(self.combo) hbox.addStretch(1) layout.addLayout(hbox) - self.table = QtGui.QTableView() + self.table = QtWidgets.QTableView() self.table.resizeColumnsToContents() self.table.setModel(self.process.model) layout.addWidget(self.table) - hbox = QtGui.QHBoxLayout() - self.copy_btn = QtGui.QPushButton("Copy") + hbox = QtWidgets.QHBoxLayout() + self.copy_btn = QtWidgets.QPushButton("Copy") self.copy_btn.clicked.connect(self.copy_stats) hbox.addWidget(self.copy_btn) hbox.addStretch(1) @@ -467,13 +467,13 @@ def __init__(self, **kwargs): group="Processing", **kwargs) def init_ui(self): - layout = QtGui.QVBoxLayout() + layout = QtWidgets.QVBoxLayout() self.setLayout(layout) title = TitleWidget(self, help="simple_maths") layout.addWidget(title) - info = QtGui.QLabel(MATHS_INFO) + info = QtWidgets.QLabel(MATHS_INFO) info.setWordWrap(True) layout.addWidget(info) @@ -484,7 +484,7 @@ def init_ui(self): self.optbox.add("Output is an ROI", BoolOption(), key="output-is-roi") layout.addWidget(self.optbox) - hbox = QtGui.QHBoxLayout() + hbox = QtWidgets.QHBoxLayout() self.go_btn = RunButton(self) hbox.addWidget(self.go_btn) hbox.addStretch(1) @@ -513,7 +513,7 @@ def __init__(self, **kwargs): self.updating = False def init_ui(self): - main_vbox = QtGui.QVBoxLayout() + main_vbox = QtWidgets.QVBoxLayout() self.setLayout(main_vbox) title = TitleWidget(self, title="Voxel analysis", help="modelfit", batch_btn=False) @@ -522,22 +522,22 @@ def init_ui(self): self.plot = Plot(twoaxis=True) main_vbox.addWidget(self.plot) - tabs = QtGui.QTabWidget() + tabs = QtWidgets.QTabWidget() main_vbox.addWidget(tabs) # Table showing RMS deviation self.rms_table = QtGui.QStandardItemModel() self.rms_table.itemChanged.connect(self._data_table_changed) - tview = QtGui.QTableView() + tview = QtWidgets.QTableView() tview.setModel(self.rms_table) - tview.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents) + tview.horizontalHeader().setResizeMode(QtWidgets.QHeaderView.ResizeToContents) tabs.addTab(tview, "Timeseries data") # Table showing value of model parameters self.values_table = QtGui.QStandardItemModel() - tview = QtGui.QTableView() + tview = QtWidgets.QTableView() tview.setModel(self.values_table) - tview.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents) + tview.horizontalHeader().setResizeMode(QtWidgets.QHeaderView.ResizeToContents) tabs.addTab(tview, 'Non-timeseries data') def activate(self): @@ -670,25 +670,25 @@ def __init__(self, **kwargs): self._mode = None def init_ui(self): - layout = QtGui.QVBoxLayout() + layout = QtWidgets.QVBoxLayout() self.setLayout(layout) title = TitleWidget(self) layout.addWidget(title) - box = QtGui.QGroupBox("Measurements") - vbox = QtGui.QVBoxLayout() + box = QtWidgets.QGroupBox("Measurements") + vbox = QtWidgets.QVBoxLayout() box.setLayout(vbox) - self._dist_btn = QtGui.QPushButton("Measure distance") + self._dist_btn = QtWidgets.QPushButton("Measure distance") self._dist_btn.clicked.connect(self._measure_dist) vbox.addWidget(self._dist_btn) - self._angle_btn = QtGui.QPushButton("Measure angle") + self._angle_btn = QtWidgets.QPushButton("Measure angle") self._angle_btn.clicked.connect(self._measure_angle) vbox.addWidget(self._angle_btn) - self._label = QtGui.QLabel() + self._label = QtWidgets.QLabel() vbox.addWidget(self._label) layout.addWidget(box) diff --git a/quantiphyse/packages/core/batch_builder/widget.py b/quantiphyse/packages/core/batch_builder/widget.py index e61d53c1..45a9611e 100644 --- a/quantiphyse/packages/core/batch_builder/widget.py +++ b/quantiphyse/packages/core/batch_builder/widget.py @@ -37,27 +37,27 @@ def __init__(self, **kwargs): self.process = BatchScript(self.ivm, stdout=open(os.devnull, "w"), quit_on_exit=False) def init_ui(self): - vbox = QtGui.QVBoxLayout() + vbox = QtWidgets.QVBoxLayout() self.setLayout(vbox) title = TitleWidget(self, title="Batch Builder", subtitle=self.description, batch_btn=False) vbox.addWidget(title) - self.proc_edit = QtGui.QPlainTextEdit() + self.proc_edit = QtWidgets.QPlainTextEdit() self.proc_edit.textChanged.connect(self._validate) vbox.addWidget(self.proc_edit, stretch=2) - hbox = QtGui.QHBoxLayout() - #self.new_case_btn = QtGui.QPushButton("New Case") + hbox = QtWidgets.QHBoxLayout() + #self.new_case_btn = QtWidgets.QPushButton("New Case") #hbox.addWidget(self.new_case_btn) #hbox.setAlignment(self.new_case_btn, QtCore.Qt.AlignTop) - self.reset_btn = QtGui.QPushButton("Reset") + self.reset_btn = QtWidgets.QPushButton("Reset") self.reset_btn.clicked.connect(self._reset) hbox.addWidget(self.reset_btn) hbox.addStretch(1) - self.save_btn = QtGui.QPushButton("Save") + self.save_btn = QtWidgets.QPushButton("Save") self.save_btn.clicked.connect(self._save) hbox.addWidget(self.save_btn) vbox.addLayout(hbox) @@ -65,7 +65,7 @@ def init_ui(self): self.run_box = RunBox(self._get_process, self._get_options) vbox.addWidget(self.run_box) - self.proc_warn = QtGui.QLabel("") + self.proc_warn = QtWidgets.QLabel("") self.proc_warn.setStyleSheet("QLabel { color : red; }") vbox.addWidget(self.proc_warn) @@ -88,10 +88,10 @@ def _update(self): def _reset(self): if self.changed and self.proc_edit.toPlainText().strip() != "": - btn = QtGui.QMessageBox.warning(self, "Reset to current data", + btn = QtWidgets.QMessageBox.warning(self, "Reset to current data", "Changes to batch file will be lost", - QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel) - if btn != QtGui.QMessageBox.Ok: + QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel) + if btn != QtWidgets.QMessageBox.Ok: return t = "" @@ -165,7 +165,7 @@ def _get_options(self): return {"yaml" : self.proc_edit.toPlainText()} def _save(self): - fname, _ = QtGui.QFileDialog.getSaveFileName(self, 'Save batch file', + fname, _ = QtWidgets.QFileDialog.getSaveFileName(self, 'Save batch file', dir=self.default_dir, filter="YAML files (*.yaml)") if fname != '': diff --git a/quantiphyse/packages/core/clustering/widgets.py b/quantiphyse/packages/core/clustering/widgets.py index 0b8ff0ec..6ce61781 100644 --- a/quantiphyse/packages/core/clustering/widgets.py +++ b/quantiphyse/packages/core/clustering/widgets.py @@ -44,7 +44,7 @@ def __init__(self, **kwargs): def init_ui(self): self.process = KMeansProcess(self.ivm) - layout = QtGui.QVBoxLayout() + layout = QtWidgets.QVBoxLayout() self.setLayout(layout) title = TitleWidget(self, help="cluster") @@ -54,23 +54,23 @@ def init_ui(self): Performs clustering of 3D or 4D data using the K-means algorithm. PCA reduction is used on 4D data to extract representative curves """ - desc = QtGui.QLabel(DESC) + desc = QtWidgets.QLabel(DESC) desc.setWordWrap(True) layout.addWidget(desc) - gbox = QtGui.QGroupBox() + gbox = QtWidgets.QGroupBox() gbox.setTitle('Clustering options') - grid = QtGui.QGridLayout() + grid = QtWidgets.QGridLayout() gbox.setLayout(grid) # Data to cluster - grid.addWidget(QtGui.QLabel("Data"), 0, 0) + grid.addWidget(QtWidgets.QLabel("Data"), 0, 0) self.data_combo = OverlayCombo(self.ivm) self.data_combo.currentIndexChanged.connect(self._data_changed) grid.addWidget(self.data_combo, 0, 1) - grid.addWidget(QtGui.QLabel("ROI"), 1, 0) + grid.addWidget(QtWidgets.QLabel("ROI"), 1, 0) self.roi_combo = RoiCombo(self.ivm, none_option=True) grid.addWidget(self.roi_combo, 1, 1) @@ -83,21 +83,21 @@ def init_ui(self): self.n_pca.spin.setToolTip("") # Output ROI name - grid.addWidget(QtGui.QLabel("Output name"), 2, 0) - self.output_name = QtGui.QLineEdit("clusters") + grid.addWidget(QtWidgets.QLabel("Output name"), 2, 0) + self.output_name = QtWidgets.QLineEdit("clusters") grid.addWidget(self.output_name, 2, 1) layout.addWidget(gbox) # Run clustering button - hbox = QtGui.QHBoxLayout() - self.run_btn = QtGui.QPushButton('Run', self) + hbox = QtWidgets.QHBoxLayout() + self.run_btn = QtWidgets.QPushButton('Run', self) self.run_btn.clicked.connect(self.run_clustering) hbox.addWidget(self.run_btn) hbox.addStretch(1) layout.addLayout(hbox) # Plot window, showing representative curves for 4D data - self.show_curves_btn = QtGui.QPushButton('Show representative curves', self) + self.show_curves_btn = QtWidgets.QPushButton('Show representative curves', self) self.show_curves_btn.clicked.connect(self._show_curves) layout.addWidget(self.show_curves_btn) self.plotwin = pg.GraphicsLayoutWidget() @@ -108,47 +108,47 @@ def init_ui(self): layout.addWidget(self.plotwin) # Statistics - self.show_count_btn = QtGui.QPushButton('Show voxel counts', self) + self.show_count_btn = QtWidgets.QPushButton('Show voxel counts', self) self.show_count_btn.clicked.connect(self._show_counts) layout.addWidget(self.show_count_btn) - self.stats_gbox = QtGui.QGroupBox() + self.stats_gbox = QtWidgets.QGroupBox() self.stats_gbox.setTitle('Voxel count') self.count_table = QtGui.QStandardItemModel() - self.count_view = QtGui.QTableView() + self.count_view = QtWidgets.QTableView() self.count_view.resizeColumnsToContents() self.count_view.setModel(self.count_table) - hbox = QtGui.QHBoxLayout() + hbox = QtWidgets.QHBoxLayout() hbox.addWidget(self.count_view) self.stats_gbox.setLayout(hbox) self.stats_gbox.setVisible(False) layout.addWidget(self.stats_gbox) # Merge regions - self.show_merge_btn = QtGui.QPushButton('Show merge options', self) + self.show_merge_btn = QtWidgets.QPushButton('Show merge options', self) self.show_merge_btn.clicked.connect(self._show_merge) layout.addWidget(self.show_merge_btn) - self.merge_gbox = QtGui.QGroupBox() + self.merge_gbox = QtWidgets.QGroupBox() self.merge_gbox.setTitle('Merge regions') - vbox = QtGui.QVBoxLayout() + vbox = QtWidgets.QVBoxLayout() self.merge_gbox.setLayout(vbox) - hbox = QtGui.QHBoxLayout() - self.merge_btn = QtGui.QPushButton('Merge', self) + hbox = QtWidgets.QHBoxLayout() + self.merge_btn = QtWidgets.QPushButton('Merge', self) self.merge_btn.clicked.connect(self._run_merge) hbox.addWidget(self.merge_btn) - hbox.addWidget(QtGui.QLabel('Merge region ')) - self.merge_region1 = QtGui.QLineEdit('1', self) + hbox.addWidget(QtWidgets.QLabel('Merge region ')) + self.merge_region1 = QtWidgets.QLineEdit('1', self) hbox.addWidget(self.merge_region1) - hbox.addWidget(QtGui.QLabel(' with ')) - self.merge_region2 = QtGui.QLineEdit('2', self) + hbox.addWidget(QtWidgets.QLabel(' with ')) + self.merge_region2 = QtWidgets.QLineEdit('2', self) hbox.addWidget(self.merge_region2) vbox.addLayout(hbox) - hbox = QtGui.QHBoxLayout() - self.auto_merge_btn = QtGui.QPushButton('AutoMerge', self) + hbox = QtWidgets.QHBoxLayout() + self.auto_merge_btn = QtWidgets.QPushButton('AutoMerge', self) self.auto_merge_btn.clicked.connect(self._run_automerge) hbox.addWidget(self.auto_merge_btn) hbox.addStretch(1) @@ -352,36 +352,36 @@ def __init__(self, **kwargs): desc="Replace data with its mean value within each ROI region", group="ROIs", **kwargs) - layout = QtGui.QVBoxLayout() + layout = QtWidgets.QVBoxLayout() title = TitleWidget(self, "Generate Mean Values Data", help="mean_values") layout.addWidget(title) - desc = QtGui.QLabel("This widget will convert the current data set into a " + desc = QtWidgets.QLabel("This widget will convert the current data set into a " "new data set in which each ROI region contains the mean " "value for that region.\n\nThis is generally only useful for " "multi-level ROIs such as clusters or supervoxels") desc.setWordWrap(True) layout.addWidget(desc) - hbox = QtGui.QHBoxLayout() - gbox = QtGui.QGroupBox() + hbox = QtWidgets.QHBoxLayout() + gbox = QtWidgets.QGroupBox() gbox.setTitle("Options") - grid = QtGui.QGridLayout() + grid = QtWidgets.QGridLayout() gbox.setLayout(grid) - grid.addWidget(QtGui.QLabel("Data"), 0, 0) + grid.addWidget(QtWidgets.QLabel("Data"), 0, 0) self.ovl = OverlayCombo(self.ivm) self.ovl.currentIndexChanged.connect(self._data_changed) grid.addWidget(self.ovl, 0, 1) - grid.addWidget(QtGui.QLabel("ROI regions"), 1, 0) + grid.addWidget(QtWidgets.QLabel("ROI regions"), 1, 0) self.roi = RoiCombo(self.ivm) grid.addWidget(self.roi, 1, 1) - grid.addWidget(QtGui.QLabel("Output name"), 2, 0) - self.output_name = QtGui.QLineEdit() + grid.addWidget(QtWidgets.QLabel("Output name"), 2, 0) + self.output_name = QtWidgets.QLineEdit() grid.addWidget(self.output_name, 2, 1) - btn = QtGui.QPushButton('Generate', self) + btn = QtWidgets.QPushButton('Generate', self) btn.clicked.connect(self._generate) grid.addWidget(btn, 2, 0) hbox.addWidget(gbox) @@ -407,10 +407,10 @@ def _generate(self): options = self.batch_options()[1] if not options["data"]: - QtGui.QMessageBox.warning(self, "No data selected", "Load data to generate mean values from", QtGui.QMessageBox.Close) + QtWidgets.QMessageBox.warning(self, "No data selected", "Load data to generate mean values from", QtWidgets.QMessageBox.Close) return if not options["roi"]: - QtGui.QMessageBox.warning(self, "No ROI selected", "Load an ROI for mean value regions", QtGui.QMessageBox.Close) + QtWidgets.QMessageBox.warning(self, "No ROI selected", "Load an ROI for mean value regions", QtWidgets.QMessageBox.Close) return process = MeanValuesProcess(self.ivm) diff --git a/quantiphyse/packages/core/compare/widget.py b/quantiphyse/packages/core/compare/widget.py index b1fe72c8..08da7594 100644 --- a/quantiphyse/packages/core/compare/widget.py +++ b/quantiphyse/packages/core/compare/widget.py @@ -36,52 +36,52 @@ def __init__(self, **kwargs): desc="Compare two data sets", group="Visualisation", **kwargs) def init_ui(self): - vbox = QtGui.QVBoxLayout() + vbox = QtWidgets.QVBoxLayout() self.setLayout(vbox) title = TitleWidget(self, batch_btn=False, help="compare") vbox.addWidget(title) - hbox = QtGui.QHBoxLayout() - hbox.addWidget(QtGui.QLabel("Compare ")) + hbox = QtWidgets.QHBoxLayout() + hbox.addWidget(QtWidgets.QLabel("Compare ")) self.d1_combo = OverlayCombo(self.ivm) self.d1_combo.currentIndexChanged.connect(self._update_data) hbox.addWidget(self.d1_combo) - hbox.addWidget(QtGui.QLabel(" with ")) + hbox.addWidget(QtWidgets.QLabel(" with ")) self.d2_combo = OverlayCombo(self.ivm) self.d2_combo.currentIndexChanged.connect(self._update_data) hbox.addWidget(self.d2_combo) hbox.addStretch(1) vbox.addLayout(hbox) - hbox = QtGui.QHBoxLayout() - hbox.addWidget(QtGui.QLabel("Within ROI ")) + hbox = QtWidgets.QHBoxLayout() + hbox.addWidget(QtWidgets.QLabel("Within ROI ")) self.roi_combo = OverlayCombo(self.ivm, rois=True, data=False, none_option=True) self.roi_combo.currentIndexChanged.connect(self._update_data) hbox.addWidget(self.roi_combo) hbox.addStretch(1) vbox.addLayout(hbox) - hbox = QtGui.QHBoxLayout() - gbox = QtGui.QGroupBox("Options") - grid = QtGui.QGridLayout() + hbox = QtWidgets.QHBoxLayout() + gbox = QtWidgets.QGroupBox("Options") + grid = QtWidgets.QGridLayout() gbox.setLayout(grid) - self.id_cb = QtGui.QCheckBox("Include identity line") + self.id_cb = QtWidgets.QCheckBox("Include identity line") grid.addWidget(self.id_cb, 0, 0) - self.sample_cb = QtGui.QCheckBox("Sample values") + self.sample_cb = QtWidgets.QCheckBox("Sample values") self.sample_cb.setChecked(True) self.sample_cb.stateChanged.connect(self._update_data) self.sample_cb.stateChanged.connect(self._update_gui) grid.addWidget(self.sample_cb, 1, 0) - self.sample_spin = QtGui.QSpinBox() + self.sample_spin = QtWidgets.QSpinBox() self.sample_spin.setMinimum(10) self.sample_spin.setMaximum(10000000) self.sample_spin.setSingleStep(100) self.sample_spin.setValue(1000) self.sample_spin.valueChanged.connect(self._update_data) grid.addWidget(self.sample_spin, 1, 1) - self.warn_label = QtGui.QLabel("WARNING: plotting all values may take a long time") + self.warn_label = QtWidgets.QLabel("WARNING: plotting all values may take a long time") self.warn_label.setStyleSheet("QLabel { color : red; }") self.warn_label.setVisible(False) grid.addWidget(self.warn_label, 2, 0) @@ -90,14 +90,14 @@ def init_ui(self): self.bins = NumericOption("Bins", grid, 3, xpos=2, minval=20, default=50, intonly=True) self.bins.label.setVisible(False) self.bins.spin.setVisible(False) - self.run_btn = QtGui.QPushButton("Update") + self.run_btn = QtWidgets.QPushButton("Update") self.run_btn.clicked.connect(self._run) grid.addWidget(self.run_btn, 4, 0) hbox.addWidget(gbox) hbox.addStretch(1) vbox.addLayout(hbox) - hbox = QtGui.QHBoxLayout() + hbox = QtWidgets.QHBoxLayout() win = pg.GraphicsLayoutWidget() win.setBackground(background=None) self.plot = win.addPlot(enableAutoRange=True) diff --git a/quantiphyse/packages/core/data/widgets.py b/quantiphyse/packages/core/data/widgets.py index 3ae6a860..d5fba84c 100644 --- a/quantiphyse/packages/core/data/widgets.py +++ b/quantiphyse/packages/core/data/widgets.py @@ -41,7 +41,7 @@ def __init__(self, **kwargs): group="Utilities", **kwargs) def init_ui(self): - vbox = QtGui.QVBoxLayout() + vbox = QtWidgets.QVBoxLayout() self.setLayout(vbox) vbox.addWidget(TitleWidget(self)) @@ -92,13 +92,13 @@ def __init__(self, **kwargs): self.ivm.sig_all_data.connect(self._all_data_changed) def init_ui(self): - vbox = QtGui.QVBoxLayout() + vbox = QtWidgets.QVBoxLayout() self.setLayout(vbox) title = TitleWidget(self) vbox.addWidget(title) - hbox = QtGui.QHBoxLayout() + hbox = QtWidgets.QHBoxLayout() self.options = OptionBox("Re-orient data") data = self.options.add("Data item", DataOption(self.ivm), key="data") data.sig_changed.connect(self._data_changed) @@ -119,8 +119,8 @@ def init_ui(self): self.gridview = GridView(self.ivm, self.ivl) vbox.addWidget(self.gridview) - hbox = QtGui.QHBoxLayout() - reset_btn = QtGui.QPushButton("Reset to original") + hbox = QtWidgets.QHBoxLayout() + reset_btn = QtWidgets.QPushButton("Reset to original") reset_btn.clicked.connect(self._reset) hbox.addWidget(reset_btn) hbox.addStretch(1) @@ -218,7 +218,7 @@ def _rotmtx_3d(self, axis, angle): self.debug("\n%s", rot3d) return rot3d -class GridView(QtGui.QWidget): +class GridView(QtWidgets.QWidget): COORD_LABELS = { 0 : "unknown", @@ -233,22 +233,22 @@ def __init__(self, ivm, ivl, readonly=False): self.data = None self._updating = False - QtGui.QWidget.__init__(self) - grid = QtGui.QGridLayout() + QtWidgets.QWidget.__init__(self) + grid = QtWidgets.QGridLayout() self.setLayout(grid) - grid.addWidget(QtGui.QLabel("Grid->World Transform"), 1, 0) + grid.addWidget(QtWidgets.QLabel("Grid->World Transform"), 1, 0) self.transform = NumberGrid(initial=np.identity(3), expandable=(False, False), fix_height=True, fix_width=True, readonly=readonly) self.transform.sig_changed.connect(self._changed) grid.addWidget(self.transform, 2, 0) - grid.addWidget(QtGui.QLabel("Origin"), 1, 1) + grid.addWidget(QtWidgets.QLabel("Origin"), 1, 1) self.origin = NumberGrid(initial=[[0],]*3, expandable=(False, False), fix_height=True, fix_width=True, readonly=readonly) self.origin.sig_changed.connect(self._changed) grid.addWidget(self.origin, 2, 1) - grid.addWidget(QtGui.QLabel("Co-ordinate system: "), 3, 0) - self.coord_label = QtGui.QLabel("unknown") + grid.addWidget(QtWidgets.QLabel("Co-ordinate system: "), 3, 0) + self.coord_label = QtWidgets.QLabel("unknown") grid.addWidget(self.coord_label, 3, 1) grid.setColumnStretch(3, 1) diff --git a/quantiphyse/packages/core/experimental/__init__.py b/quantiphyse/packages/core/experimental/__init__.py index 9c46540e..e5c4b778 100644 --- a/quantiphyse/packages/core/experimental/__init__.py +++ b/quantiphyse/packages/core/experimental/__init__.py @@ -31,16 +31,16 @@ def __init__(self, **kwargs): super(ImageExportWidget, self).__init__(name="Image Export", desc="Export images and animations", icon="image_export", **kwargs) def init_ui(self): - main_vbox = QtGui.QVBoxLayout() + main_vbox = QtWidgets.QVBoxLayout() - hbox = QtGui.QHBoxLayout() - hbox.addWidget(QtGui.QLabel('Export animation')) + hbox = QtWidgets.QHBoxLayout() + hbox.addWidget(QtWidgets.QLabel('Export animation')) hbox.addStretch(1) hbox.addWidget(HelpButton(self)) main_vbox.addLayout(hbox) - hbox = QtGui.QHBoxLayout() - b1 = QtGui.QPushButton('Generate', self) + hbox = QtWidgets.QHBoxLayout() + b1 = QtWidgets.QPushButton('Generate', self) b1.clicked.connect(self.run_time_window_capture) hbox.addWidget(b1) hbox.addStretch(1) @@ -61,7 +61,7 @@ def run_time_window_capture(self): shape = self.ivm.vol.shape # Choose a folder to save images - fname = QtGui.QFileDialog.getExistingDirectory(self, 'Choose folder to save images') + fname = QtWidgets.QFileDialog.getExistingDirectory(self, 'Choose folder to save images') if fname == '': return diff --git a/quantiphyse/packages/core/histogram/widget.py b/quantiphyse/packages/core/histogram/widget.py index 0a3f1c37..b5ab16b4 100644 --- a/quantiphyse/packages/core/histogram/widget.py +++ b/quantiphyse/packages/core/histogram/widget.py @@ -24,7 +24,7 @@ def __init__(self, **kwargs): self._updating = False def init_ui(self): - vbox = QtGui.QVBoxLayout() + vbox = QtWidgets.QVBoxLayout() self.setLayout(vbox) title = TitleWidget(self) diff --git a/quantiphyse/packages/core/overview/widget.py b/quantiphyse/packages/core/overview/widget.py index f862fb2e..698ec774 100644 --- a/quantiphyse/packages/core/overview/widget.py +++ b/quantiphyse/packages/core/overview/widget.py @@ -96,11 +96,11 @@ def __init__(self, **kwargs): group="DEFAULT", position=0, **kwargs) def init_ui(self): - layout = QtGui.QVBoxLayout() + layout = QtWidgets.QVBoxLayout() - hbox = QtGui.QHBoxLayout() + hbox = QtWidgets.QHBoxLayout() pixmap = QtGui.QPixmap(get_icon("quantiphyse_75.png")) - lpic = QtGui.QLabel(self) + lpic = QtWidgets.QLabel(self) lpic.setPixmap(pixmap) hbox.addWidget(lpic) hbox.addStretch(1) @@ -108,14 +108,14 @@ def init_ui(self): hbox.addWidget(help_btn) layout.addLayout(hbox) - summary_label = QtGui.QLabel(SUMMARY) + summary_label = QtWidgets.QLabel(SUMMARY) summary_label.setWordWrap(True) layout.addWidget(summary_label) - box = QtGui.QGroupBox() - hbox = QtGui.QHBoxLayout() + box = QtWidgets.QGroupBox() + hbox = QtWidgets.QHBoxLayout() box.setLayout(hbox) - disc = QtGui.QLabel(" Disclaimer: This software has been developed for research purposes only, and " + disc = QtWidgets.QLabel(" Disclaimer: This software has been developed for research purposes only, and " "should not be used as a diagnostic tool. The authors or distributors will not be " "responsible for any direct, indirect, special, incidental, or consequential damages " "arising of the use of this software. By using the this software you agree to this disclaimer." @@ -123,7 +123,7 @@ def init_ui(self): "Please read the Quantiphyse License for more information") disc.setWordWrap(True) hbox.addWidget(disc, 10) - license_btn = QtGui.QPushButton("License") + license_btn = QtWidgets.QPushButton("License") license_btn.clicked.connect(self._view_license) hbox.addWidget(license_btn) layout.addWidget(box) @@ -131,7 +131,7 @@ def init_ui(self): self.data_list = DataListWidget(self) layout.addWidget(self.data_list) - hbox = QtGui.QHBoxLayout() + hbox = QtWidgets.QHBoxLayout() self._up_btn = self._btn(hbox, QtGui.QIcon(get_icon("up.png")), "Raise data set in viewing order", self._up) self._down_btn = self._btn(hbox, QtGui.QIcon(get_icon("down.png")), "Lower data set in viewing order", self._down) @@ -151,7 +151,7 @@ def init_ui(self): self._toggle_single_multi() def _btn(self, hbox, icon, tooltip, callback): - btn = QtGui.QPushButton() + btn = QtWidgets.QPushButton() btn.setIcon(icon) btn.setToolTip(tooltip) btn.setStatusTip(tooltip) @@ -179,16 +179,16 @@ def _view_license(self): def _delete(self): if self.data_list.selected is not None: name = self.data_list.selected.name - btn = QtGui.QMessageBox.warning(self, "Delete data", "Delete '%s'?" % name, - QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel) - if btn == QtGui.QMessageBox.Ok: + btn = QtWidgets.QMessageBox.warning(self, "Delete data", "Delete '%s'?" % name, + QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel) + if btn == QtWidgets.QMessageBox.Ok: self.ivm.delete(name) def _rename(self): if self.data_list.selected is not None: name = self.data_list.selected.name - text, result = QtGui.QInputDialog.getText(self, "Renaming '%s'" % name, "New name", - QtGui.QLineEdit.Normal, name) + text, result = QtWidgets.QInputDialog.getText(self, "Renaming '%s'" % name, "New name", + QtWidgets.QLineEdit.Normal, name) if result: self.ivm.rename(name, text) @@ -200,7 +200,7 @@ def _save(self): fname = data.fname else: fname = os.path.join(default_save_dir(), name + ".nii") - fname, _ = QtGui.QFileDialog.getSaveFileName(self, 'Save file', dir=fname, + fname, _ = QtWidgets.QFileDialog.getSaveFileName(self, 'Save file', dir=fname, filter="NIFTI files (*.nii *.nii.gz)") if fname != '': save(self.ivm.data[name], fname) @@ -250,7 +250,7 @@ def _up(self): last_data.view.z_order = current_z last_data = data -class DataListWidget(QtGui.QTableView): +class DataListWidget(QtWidgets.QTableView): """ Table showing loaded volumes """ @@ -272,9 +272,9 @@ def __init__(self, parent): self.setModel(self.model) self._update_list() - self.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) - self.setSelectionMode(QtGui.QAbstractItemView.SingleSelection) - self.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers) + self.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) + self.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection) + self.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) self.setShowGrid(False) self.setTextElideMode(QtCore.Qt.ElideLeft) self.setAlternatingRowColors(True) @@ -350,9 +350,9 @@ def _update_list(self): self.model.setColumnCount(3) self.model.setHorizontalHeaderLabels(["", "Name", "File"]) self.model.setHeaderData(0, QtCore.Qt.Horizontal, self._vis_icon, QtCore.Qt.DecorationRole) - self.horizontalHeader().setResizeMode(0, QtGui.QHeaderView.ResizeToContents) - self.horizontalHeader().setResizeMode(1, QtGui.QHeaderView.ResizeToContents) - self.horizontalHeader().setResizeMode(2, QtGui.QHeaderView.Stretch) + self.horizontalHeader().setResizeMode(0, QtWidgets.QHeaderView.ResizeToContents) + self.horizontalHeader().setResizeMode(1, QtWidgets.QHeaderView.ResizeToContents) + self.horizontalHeader().setResizeMode(2, QtWidgets.QHeaderView.Stretch) for row, data in enumerate(sorted(self.ivm.data.values(), key=lambda x: -x.view.z_order)): self.model.appendRow(self._get_table_items(data)) diff --git a/quantiphyse/packages/core/pca/widget.py b/quantiphyse/packages/core/pca/widget.py index 9ae5c5a5..8f5b48bd 100644 --- a/quantiphyse/packages/core/pca/widget.py +++ b/quantiphyse/packages/core/pca/widget.py @@ -35,7 +35,7 @@ def __init__(self, **kwargs): desc="PCA reduction", group="Processing", **kwargs) def init_ui(self): - vbox = QtGui.QVBoxLayout() + vbox = QtWidgets.QVBoxLayout() self.setLayout(vbox) title = TitleWidget(self, title="PCA reduction", subtitle="Principal Component Analysis for 4D data") @@ -56,11 +56,11 @@ def init_ui(self): self.plot = Plot(qpo=None, parent=self, title="PCA modes") self.variance_model = QtGui.QStandardItemModel() - variance_table = QtGui.QTableView() + variance_table = QtWidgets.QTableView() variance_table.verticalHeader().hide() variance_table.setModel(self.variance_model) - tabs = QtGui.QTabWidget() + tabs = QtWidgets.QTabWidget() tabs.addTab(self.plot, "PCA modes") tabs.addTab(variance_table, "Explained variance") tabs.setCurrentWidget(self.plot) diff --git a/quantiphyse/packages/core/radialprofile/widget.py b/quantiphyse/packages/core/radialprofile/widget.py index 92ba1ab4..a4573fae 100644 --- a/quantiphyse/packages/core/radialprofile/widget.py +++ b/quantiphyse/packages/core/radialprofile/widget.py @@ -42,7 +42,7 @@ def __init__(self, **kwargs): self._updating = False def init_ui(self): - vbox = QtGui.QVBoxLayout() + vbox = QtWidgets.QVBoxLayout() self.setLayout(vbox) title = TitleWidget(self) diff --git a/quantiphyse/packages/core/registration/reg_method.py b/quantiphyse/packages/core/registration/reg_method.py index cf92a4af..b9f7f21c 100644 --- a/quantiphyse/packages/core/registration/reg_method.py +++ b/quantiphyse/packages/core/registration/reg_method.py @@ -194,9 +194,9 @@ def interface(self, generic_options): :param generic_options: Dictionary of generic registration options - this is provided so the method can customize the options offered depending on the registration mode. - :return: QtGui.QWidget() to allow options to be controlled + :return: QtWidgets.QWidget() to allow options to be controlled """ - return QtGui.QWidget() + return QtWidgets.QWidget() def options(self): """ diff --git a/quantiphyse/packages/core/registration/widget.py b/quantiphyse/packages/core/registration/widget.py index 7e13ac28..100180d9 100644 --- a/quantiphyse/packages/core/registration/widget.py +++ b/quantiphyse/packages/core/registration/widget.py @@ -44,14 +44,14 @@ def __init__(self, **kwargs): self.warn("Failed to create registration method: %s", method) def init_ui(self): - layout = QtGui.QVBoxLayout() + layout = QtWidgets.QVBoxLayout() self.setLayout(layout) title = TitleWidget(self, title="Registration and Motion Correction", help="reg") layout.addWidget(title) if not self.reg_methods: - layout.addWidget(QtGui.QLabel("No registration methods found")) + layout.addWidget(QtWidgets.QLabel("No registration methods found")) layout.addStretch(1) return @@ -77,10 +77,10 @@ def init_ui(self): # Create the options boxes for reg methods - only one visible at a time! self.opt_boxes = {} for method in self.reg_methods: - hbox = QtGui.QHBoxLayout() - opt_box = QtGui.QGroupBox() + hbox = QtWidgets.QHBoxLayout() + opt_box = QtWidgets.QGroupBox() opt_box.setTitle(method.display_name) - vbox = QtGui.QVBoxLayout() + vbox = QtWidgets.QVBoxLayout() opt_box.setLayout(vbox) vbox.addWidget(method.interface()) hbox.addWidget(opt_box) @@ -137,7 +137,7 @@ def processes(self): "Reg" : options, } -class TransformOption(Option, QtGui.QComboBox): +class TransformOption(Option, QtWidgets.QComboBox): """ Option for choosing previously calculated registration transforms. These may be stored as data sets or Extras @@ -145,7 +145,7 @@ class TransformOption(Option, QtGui.QComboBox): sig_changed = QtCore.Signal() def __init__(self, ivm): - QtGui.QComboBox.__init__(self) + QtWidgets.QComboBox.__init__(self) self.ivm = ivm self._data_changed() self.ivm.sig_all_data.connect(self._data_changed) @@ -188,29 +188,29 @@ def _data_changed(self): def _changed(self): self.sig_changed.emit() -class TransformDetails(QtGui.QGroupBox): +class TransformDetails(QtWidgets.QGroupBox): """ Widget displaying information about a selected transformation """ def __init__(self): - QtGui.QGroupBox.__init__(self, "Transform details") - grid = QtGui.QGridLayout() + QtWidgets.QGroupBox.__init__(self, "Transform details") + grid = QtWidgets.QGridLayout() self.setLayout(grid) - self._name = QtGui.QLineEdit() - grid.addWidget(QtGui.QLabel("Transform name"), 0, 0) + self._name = QtWidgets.QLineEdit() + grid.addWidget(QtWidgets.QLabel("Transform name"), 0, 0) grid.addWidget(self._name, 0, 1) - self._method = QtGui.QLineEdit() - grid.addWidget(QtGui.QLabel("Registration method"), 1, 0) + self._method = QtWidgets.QLineEdit() + grid.addWidget(QtWidgets.QLabel("Registration method"), 1, 0) grid.addWidget(self._method, 1, 1) - self._type = QtGui.QLineEdit() - grid.addWidget(QtGui.QLabel("Transform type"), 2, 0) + self._type = QtWidgets.QLineEdit() + grid.addWidget(QtWidgets.QLabel("Transform type"), 2, 0) grid.addWidget(self._type, 2, 1) - self._edit = QtGui.QPlainTextEdit() + self._edit = QtWidgets.QPlainTextEdit() self._edit.setReadOnly(True) grid.addWidget(self._edit, 3, 0, 1, 2) @@ -254,14 +254,14 @@ def __init__(self, **kwargs): self.warn("Failed to create registration method: %s", method) def init_ui(self): - layout = QtGui.QVBoxLayout() + layout = QtWidgets.QVBoxLayout() self.setLayout(layout) title = TitleWidget(self, help="reg") layout.addWidget(title) if not self.reg_methods: - layout.addWidget(QtGui.QLabel("No registration methods found")) + layout.addWidget(QtWidgets.QLabel("No registration methods found")) layout.addStretch(1) return diff --git a/quantiphyse/packages/core/roi_builder/tools.py b/quantiphyse/packages/core/roi_builder/tools.py index 5cedc578..24cdc9e6 100644 --- a/quantiphyse/packages/core/roi_builder/tools.py +++ b/quantiphyse/packages/core/roi_builder/tools.py @@ -67,8 +67,8 @@ def interface(self): :return: QtCore.QLayout suitable for embedding in toolbox """ - grid = QtGui.QGridLayout() - grid.addWidget(QtGui.QLabel(self.tooltip), 0, 0, 1, 2) + grid = QtWidgets.QGridLayout() + grid.addWidget(QtWidgets.QLabel(self.tooltip), 0, 0, 1, 2) return grid def _show_builder_roi(self): @@ -99,16 +99,16 @@ def selected(self): def interface(self): grid = Tool.interface(self) - btn = QtGui.QPushButton("Add") + btn = QtWidgets.QPushButton("Add") btn.clicked.connect(self._change(self.builder.ADD)) grid.addWidget(btn, 1, 0) - btn = QtGui.QPushButton("Erase") + btn = QtWidgets.QPushButton("Erase") btn.clicked.connect(self._change(self.builder.ERASE)) grid.addWidget(btn, 1, 1) - btn = QtGui.QPushButton("Mask") + btn = QtWidgets.QPushButton("Mask") btn.clicked.connect(self._change(self.builder.MASK)) grid.addWidget(btn, 2, 0) - btn = QtGui.QPushButton("Discard") + btn = QtWidgets.QPushButton("Discard") btn.clicked.connect(self.selected) grid.addWidget(btn, 2, 1) return grid @@ -206,20 +206,20 @@ def __init__(self): def interface(self): grid = Tool.interface(self) - grid.addWidget(QtGui.QLabel("Existing ROI"), 1, 0) + grid.addWidget(QtWidgets.QLabel("Existing ROI"), 1, 0) self.roi_combo = RoiCombo(self.ivm, none_option=True) self.roi_combo.currentIndexChanged.connect(self._existing_roi_changed) grid.addWidget(self.roi_combo, 1, 1) - self.ok_btn = QtGui.QPushButton("Accept") + self.ok_btn = QtWidgets.QPushButton("Accept") self.ok_btn.setEnabled(False) self.ok_btn.clicked.connect(self._accepted) grid.addWidget(self.ok_btn, 2, 0) - self.cancel_btn = QtGui.QPushButton("Cancel") + self.cancel_btn = QtWidgets.QPushButton("Cancel") self.cancel_btn.setEnabled(False) self.cancel_btn.clicked.connect(self._reset) grid.addWidget(self.cancel_btn, 2, 1) - self.done_btn = QtGui.QPushButton("Done") + self.done_btn = QtWidgets.QPushButton("Done") self.done_btn.setEnabled(False) self.done_btn.clicked.connect(self._show_builder_roi) grid.addWidget(self.done_btn, 2, 2) @@ -288,19 +288,19 @@ def __init__(self): def interface(self): grid = Tool.interface(self) - grid.addWidget(QtGui.QLabel("Source data: "), 1, 0) + grid.addWidget(QtWidgets.QLabel("Source data: "), 1, 0) self.ov_combo = OverlayCombo(self.ivm) grid.addWidget(self.ov_combo) - grid.addWidget(QtGui.QLabel("Click to select points: "), 2, 0) - self.pickmode_combo = QtGui.QComboBox() + grid.addWidget(QtWidgets.QLabel("Click to select points: "), 2, 0) + self.pickmode_combo = QtWidgets.QComboBox() self.pickmode_combo.addItem("Inside the ROI") self.pickmode_combo.addItem("Outside the ROI") self.pickmode_combo.currentIndexChanged.connect(self._pick_mode_changed) grid.addWidget(self.pickmode_combo, 2, 1) - grid.addWidget(QtGui.QLabel("Segmentation mode: "), 3, 0) - self.segmode_combo = QtGui.QComboBox() + grid.addWidget(QtWidgets.QLabel("Segmentation mode: "), 3, 0) + self.segmode_combo = QtWidgets.QComboBox() self.segmode_combo.addItem("Slice") self.segmode_combo.addItem("3D") self.segmode_combo.currentIndexChanged.connect(self._seg_mode_changed) @@ -308,10 +308,10 @@ def interface(self): self.beta = NumericOption("Diffusion difficulty", grid, 4, 0, intonly=True, maxval=20000, default=10000, step=1000) - btn = QtGui.QPushButton("Segment") + btn = QtWidgets.QPushButton("Segment") btn.clicked.connect(self._segment) grid.addWidget(btn, 5, 0) - btn = QtGui.QPushButton("Clear points") + btn = QtWidgets.QPushButton("Clear points") btn.clicked.connect(self._init) grid.addWidget(btn, 5, 1) @@ -424,8 +424,8 @@ def __init__(self): def interface(self): grid = Tool.interface(self) - #grid.addWidget(QtGui.QLabel("Segmentation mode: "), 3, 0) - #self.segmode_combo = QtGui.QComboBox() + #grid.addWidget(QtWidgets.QLabel("Segmentation mode: "), 3, 0) + #self.segmode_combo = QtWidgets.QComboBox() #self.segmode_combo.addItem("Slice") #self.segmode_combo.addItem("3D") #self.segmode_combo.currentIndexChanged.connect(self._dims_changed) @@ -438,16 +438,16 @@ def interface(self): self.max_tile_size = NumericSlider("Max distance (voxels)", grid, 6, 0, intonly=True, maxval=500, minval=1, default=100, hardmin=True) self.max_tile_size.sig_changed.connect(self._update_roi) - btn = QtGui.QPushButton("Add") + btn = QtWidgets.QPushButton("Add") btn.clicked.connect(self._add) grid.addWidget(btn, 7, 0) - btn = QtGui.QPushButton("Erase") + btn = QtWidgets.QPushButton("Erase") btn.clicked.connect(self._erase) grid.addWidget(btn, 7, 1) - btn = QtGui.QPushButton("Mask") + btn = QtWidgets.QPushButton("Mask") btn.clicked.connect(self._mask) grid.addWidget(btn, 8, 0) - btn = QtGui.QPushButton("Discard") + btn = QtWidgets.QPushButton("Discard") btn.clicked.connect(self._init) grid.addWidget(btn, 8, 1) return grid diff --git a/quantiphyse/packages/core/roi_builder/widget.py b/quantiphyse/packages/core/roi_builder/widget.py index 9524a184..e7be0313 100644 --- a/quantiphyse/packages/core/roi_builder/widget.py +++ b/quantiphyse/packages/core/roi_builder/widget.py @@ -61,13 +61,13 @@ def __init__(self, **kwargs): self.roiname = None def init_ui(self): - layout = QtGui.QVBoxLayout() + layout = QtWidgets.QVBoxLayout() title = TitleWidget(self, help="roibuilder", batch_btn=False) layout.addWidget(title) self.options = OptionBox("Options") - btn = QtGui.QPushButton("New") + btn = QtWidgets.QPushButton("New") btn.clicked.connect(self._new_roi) self.options.add("ROI", DataOption(self.ivm, rois=True, data=False), btn, key="roi") self.options.add("Current label", NumericOption(minval=1, slider=False, intonly=True), key="label") @@ -78,10 +78,10 @@ def init_ui(self): layout.addWidget(self.options) # Add toolbox buttons in a grid - hbox = QtGui.QHBoxLayout() - self._toolbox = QtGui.QGroupBox() + hbox = QtWidgets.QHBoxLayout() + self._toolbox = QtWidgets.QGroupBox() self._toolbox.setTitle("Toolbox") - self.tools_grid = QtGui.QGridLayout() + self.tools_grid = QtWidgets.QGridLayout() self._toolbox.setLayout(self.tools_grid) x, y, cols = 0, 0, 4 @@ -92,7 +92,7 @@ def init_ui(self): y += 1 x = 0 - self._undo_btn = QtGui.QPushButton() + self._undo_btn = QtWidgets.QPushButton() self._undo_btn.clicked.connect(self.undo) self._undo_btn.setEnabled(False) undo_icon = QtGui.QIcon(get_icon("undo")) @@ -107,8 +107,8 @@ def init_ui(self): layout.addLayout(hbox) # Tool options box - initially invisible - hbox = QtGui.QHBoxLayout() - self._tool_options = QtGui.QGroupBox() + hbox = QtWidgets.QHBoxLayout() + self._tool_options = QtWidgets.QGroupBox() self._tool_options.setVisible(False) hbox.addWidget(self._tool_options) @@ -281,9 +281,9 @@ def _roi_changed(self): self.roidata = roi.raw() def _new_roi(self): - dialog = QtGui.QDialog(self) + dialog = QtWidgets.QDialog(self) dialog.setWindowTitle("New ROI") - vbox = QtGui.QVBoxLayout() + vbox = QtWidgets.QVBoxLayout() dialog.setLayout(vbox) optbox = OptionBox() @@ -291,7 +291,7 @@ def _new_roi(self): optbox.add("Data space from", DataOption(self.ivm), key="grid") vbox.addWidget(optbox) - buttons = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel) + buttons = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel) buttons.accepted.connect(dialog.accept) buttons.rejected.connect(dialog.reject) vbox.addWidget(buttons) @@ -322,7 +322,7 @@ def _select(): self._tool.btn.setStyleSheet("border: 2px solid QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a);") # Replace the old tool options with the new one. Need to reparent the # existing layout to a temporary widget which will then get deleted - QtGui.QWidget().setLayout(self._tool_options.layout()) + QtWidgets.QWidget().setLayout(self._tool_options.layout()) self._tool_options.setLayout(self._tool.interface()) self._tool_options.setTitle(tool.name) self._tool_options.setVisible(True) @@ -334,7 +334,7 @@ def _add_tool(self, tool, x, y): tool.ivm = self.ivm tool.ivl = self.ivl tool.builder = self - btn = QtGui.QPushButton() + btn = QtWidgets.QPushButton() btn.setIcon(QtGui.QIcon(get_icon(tool.name.lower()))) btn.setToolTip(tool.tooltip) btn.setFixedSize(32, 32) diff --git a/quantiphyse/packages/core/simulation/widgets.py b/quantiphyse/packages/core/simulation/widgets.py index a45966e1..d55ed69e 100644 --- a/quantiphyse/packages/core/simulation/widgets.py +++ b/quantiphyse/packages/core/simulation/widgets.py @@ -35,7 +35,7 @@ def __init__(self, **kwargs): group="Simulation", **kwargs) def init_ui(self): - vbox = QtGui.QVBoxLayout() + vbox = QtWidgets.QVBoxLayout() self.setLayout(vbox) title = TitleWidget(self, title="Add Noise", help="noise") @@ -47,7 +47,7 @@ def init_ui(self): self.option_box.add("Output name", OutputNameOption(src_data=data, suffix="_noisy"), key="output-name") vbox.addWidget(self.option_box) - run_btn = QtGui.QPushButton('Run', self) + run_btn = QtWidgets.QPushButton('Run', self) run_btn.clicked.connect(self.run) vbox.addWidget(run_btn) @@ -71,7 +71,7 @@ def __init__(self, **kwargs): group="Simulation", **kwargs) def init_ui(self): - vbox = QtGui.QVBoxLayout() + vbox = QtWidgets.QVBoxLayout() self.setLayout(vbox) title = TitleWidget(self, title="Simulate Motion", help="sim_motion") @@ -86,7 +86,7 @@ def init_ui(self): self.option_box.add("Output name", OutputNameOption(src_data=data, suffix="_moving"), key="output-name") vbox.addWidget(self.option_box) - run_btn = QtGui.QPushButton('Run', self) + run_btn = QtWidgets.QPushButton('Run', self) run_btn.clicked.connect(self.run) vbox.addWidget(run_btn) diff --git a/quantiphyse/packages/core/smoothing/widget.py b/quantiphyse/packages/core/smoothing/widget.py index 7afd1dac..9cf102be 100644 --- a/quantiphyse/packages/core/smoothing/widget.py +++ b/quantiphyse/packages/core/smoothing/widget.py @@ -35,33 +35,33 @@ def __init__(self, **kwargs): desc="Gaussian smoothing", group="Processing", **kwargs) def init_ui(self): - vbox = QtGui.QVBoxLayout() + vbox = QtWidgets.QVBoxLayout() self.setLayout(vbox) title = TitleWidget(self, title="Data Smoothing", subtitle="Smooth data using a Gaussian kernel", help="smoothing") vbox.addWidget(title) - hbox = QtGui.QHBoxLayout() - gbox = QtGui.QGroupBox() + hbox = QtWidgets.QHBoxLayout() + gbox = QtWidgets.QGroupBox() gbox.setTitle("Options") - grid = QtGui.QGridLayout() + grid = QtWidgets.QGridLayout() gbox.setLayout(grid) - grid.addWidget(QtGui.QLabel("Data to smooth"), 0, 0) + grid.addWidget(QtWidgets.QLabel("Data to smooth"), 0, 0) self.data_combo = OverlayCombo(self.ivm) self.data_combo.currentIndexChanged.connect(self.data_changed) grid.addWidget(self.data_combo, 0, 1) self.sigma = NumericOption("Sigma (mm)", grid, xpos=0, ypos=1, minval=0, step=0.1, default=1.0) - grid.addWidget(QtGui.QLabel("Output name"), 2, 0) - self.output_name = QtGui.QLineEdit() + grid.addWidget(QtWidgets.QLabel("Output name"), 2, 0) + self.output_name = QtWidgets.QLineEdit() grid.addWidget(self.output_name, 2, 1) hbox.addWidget(gbox) hbox.addStretch(1) vbox.addLayout(hbox) - hbox = QtGui.QHBoxLayout() - self.run_btn = QtGui.QPushButton("Run") + hbox = QtWidgets.QHBoxLayout() + self.run_btn = QtWidgets.QPushButton("Run") self.run_btn.clicked.connect(self.run) hbox.addWidget(self.run_btn) hbox.addStretch(1) diff --git a/quantiphyse/qpmain.py b/quantiphyse/qpmain.py index ab058e0a..ef03a5d0 100755 --- a/quantiphyse/qpmain.py +++ b/quantiphyse/qpmain.py @@ -33,7 +33,7 @@ except ImportError: # Note that pyqtgraph actually writes all the contents of QtWidgets into # QtGui on import! This is sort-of nice because we don't need to switch - # existing PySide code that uses, e.g. QtGui.QMainWindow, but it's a bit + # existing PySide code that uses, e.g. QtWidgets.QMainWindow, but it's a bit # invasive compared with the 'nicer' option or importing PySide.QtGui # as QtWidgets. We will go with the pyqtgraph method for now but might # need to make changes if this causes problems later. @@ -116,17 +116,17 @@ def main(): if sys.platform.startswith("darwin") and PYSIDE1: # Required on Mac with Pyside 1 - QtGui.QApplication.setGraphicsSystem('native') + QtWidgets.QApplication.setGraphicsSystem('native') # Note that organization info is not up to date but we will # leave IBME in there as otherwise any previous QSettings (including # registration) will be lost. - app = QtGui.QApplication(sys.argv) + app = QtWidgets.QApplication(sys.argv) app.setStyle('plastique') QtCore.QCoreApplication.setOrganizationName("ibme-qubic") QtCore.QCoreApplication.setOrganizationDomain("eng.ox.ac.uk") QtCore.QCoreApplication.setApplicationName("Quantiphyse") - QtGui.QApplication.setWindowIcon(QtGui.QIcon(get_icon("main_icon.png"))) + QtWidgets.QApplication.setWindowIcon(QtGui.QIcon(get_icon("main_icon.png"))) if args.debug: import pyqtgraph as pg @@ -139,7 +139,7 @@ def main(): else: # Create window and start main loop pixmap = QtGui.QPixmap(get_icon("quantiphyse_splash.png")) - splash = QtGui.QSplashScreen(pixmap) + splash = QtWidgets.QSplashScreen(pixmap) splash.show() app.processEvents() diff --git a/quantiphyse/utils/__init__.py b/quantiphyse/utils/__init__.py index 17bf1b6c..870ca747 100644 --- a/quantiphyse/utils/__init__.py +++ b/quantiphyse/utils/__init__.py @@ -175,7 +175,7 @@ def table_to_extra(tabmod, name): def copy_table(tabmod): """ Copy a QT table model to the clipboard in a form suitable for paste into Excel etc """ - clipboard = QtGui.QApplication.clipboard() + clipboard = QtWidgets.QApplication.clipboard() tsv = str(table_to_extra(tabmod, "")) clipboard.setText(tsv)