def __init__(self, parent=None): super(ImportDialog, self).__init__(parent) self.accepted = False from nexpy.gui.consoleapp import _mainwindow self.default_directory = _mainwindow.default_directory self.import_file = None # must set in self.get_data() self.spec = None # progress bar is updated via calls to pdate_progress() self.progress_bar = QtGui.QProgressBar() self.progress_bar.setVisible(False) status_layout = QtGui.QHBoxLayout() status_layout.addWidget(self.progress_bar) status_layout.addStretch() status_layout.addWidget(self.close_buttons()) self.layout = QtGui.QVBoxLayout() self.layout.addLayout(self.filebox()) self.layout.addLayout(self.scanbox()) self.layout.addLayout(status_layout) self.setLayout(self.layout) self.setWindowTitle("Import " + str(filetype))
def __init__(self, parent=None): super(ImportDialog, self).__init__(parent) self.layout = QtGui.QVBoxLayout() self.layout.addLayout(self.directorybox()) self.filter_box = self.make_filterbox() self.layout.addWidget(self.filter_box) self.rangebox = self.make_rangebox() self.layout.addWidget(self.rangebox) status_layout = QtGui.QHBoxLayout() self.progress_bar = QtGui.QProgressBar() status_layout.addWidget(self.progress_bar) self.progress_bar.setVisible(False) status_layout.addStretch() status_layout.addWidget(self.buttonbox()) self.layout.addLayout(status_layout) self.setLayout(self.layout) self.setWindowTitle("Import " + str(filetype))
def data(self, index, role): if not index.isValid(): return None elif role == QtCore.Qt.ToolTipRole: row, col = index.row(), index.column() peak = self.peak_list[row][0] return str(self.parent.rings[self.parent.refine.rp[peak]]) elif role == QtCore.Qt.DisplayRole: row, col = index.row(), index.column() value = self.peak_list[row][col] if col < 4: return str(value) elif col == 6: return "%5.3g" % value elif col == 10: return "%.3f" % value else: return "%.2f" % value elif role == QtCore.Qt.TextAlignmentRole: return int(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) elif role == QtCore.Qt.BackgroundRole: row, col = index.row(), index.column() peak = self.peak_list[row][0] if peak == self.parent.refine.primary or \ peak == self.parent.refine.secondary: return QtGui.QColor(QtCore.Qt.lightGray) elif self.peak_list[row][10] > self.parent.refine.hkl_tolerance: return QtGui.QColor(QtCore.Qt.red) else: return None return None
def initialize_parameter_grid(self): grid_layout = QtGui.QVBoxLayout() scroll_area = QtGui.QScrollArea() scroll_area.setWidgetResizable(True) scroll_widget = QtGui.QWidget() self.parameter_grid = QtGui.QGridLayout() self.parameter_grid.setSpacing(10) headers = [ 'Function', 'Np', 'Name', 'Value', '', 'Min', 'Max', 'Fixed' ] width = [100, 50, 100, 100, 100, 100, 100, 50, 100] column = 0 for header in headers: label = QtGui.QLabel() label.setFont(self.header_font) label.setAlignment(QtCore.Qt.AlignHCenter) label.setText(header) self.parameter_grid.addWidget(label, 0, column) self.parameter_grid.setColumnMinimumWidth(column, width[column]) column += 1 scroll_widget.setLayout(self.parameter_grid) scroll_area.setWidget(scroll_widget) scroll_area.setMinimumHeight(200) grid_layout.addWidget(scroll_area) return grid_layout
def report_fit(self): message_box = QtGui.QMessageBox() message_box.setText("Fit Results") if self.fit.result.success: summary = 'Fit Successful' else: summary = 'Fit Failed' if self.fit.result.errorbars: errors = 'Uncertainties estimated' else: errors = 'Uncertainties not estimated' text = '%s\n' % summary +\ '%s\n' % self.fit.result.message +\ '%s\n' % self.fit.result.lmdif_message +\ 'scipy.optimize.leastsq error value = %s\n' % self.fit.result.ier +\ 'Chi^2 = %s\n' % self.fit.result.chisqr +\ 'Reduced Chi^2 = %s\n' % self.fit.result.redchi +\ '%s\n' % errors +\ 'No. of Function Evaluations = %s\n' % self.fit.result.nfev +\ 'No. of Variables = %s\n' % self.fit.result.nvarys +\ 'No. of Data Points = %s\n' % self.fit.result.ndata +\ 'No. of Degrees of Freedom = %s\n' % self.fit.result.nfree +\ '%s' % self.fit.fit_report() message_box.setInformativeText(text) message_box.setStandardButtons(QtGui.QMessageBox.Ok) spacer = QtGui.QSpacerItem(500, 0, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) layout = message_box.layout() layout.addItem(spacer, layout.rowCount(), 0, 1, layout.columnCount()) message_box.exec_()
def select_normalization(self, text='Normalization: '): layout = QtGui.QHBoxLayout() # dividend box = QtGui.QComboBox() box.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) sdds = ['PFY_SDD1', 'PFY_SDD2', 'PFY_SDD3', 'PFY_SDD4'] for sdd in sorted(sdds): box.addItem(sdd) self.select_dividend_box = box # self.select_abs_layout = layout # divisor box2 = QtGui.QComboBox() box2.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) sdds2 = ['I0', 'TEY', 'DIODE'] for sdd2 in sorted(sdds2): box2.addItem(sdd2) box2.setCurrentIndex(1) self.select_divisor_box = box2 layout.addWidget(QtGui.QLabel(text)) layout.addWidget(box) layout.addWidget(box2) layout.addStretch() return layout
def __init__(self, parent=None): super(NXScriptWindow, self).__init__(parent) layout = QtGui.QVBoxLayout() self.tabs = QtGui.QTabWidget(self) layout.addWidget(self.tabs) self.setLayout(layout) self.setWindowTitle('Script Editor') self.tabs.currentChanged.connect(self.update)
def __init__(self, node=None): self.node = node if isinstance(self.node, NXlink): self._linked = QtGui.QIcon( pkg_resources.resource_filename('nexpy.gui', 'resources/link-icon.png')) elif isinstance(self.node, NXroot): self._locked = QtGui.QIcon( pkg_resources.resource_filename('nexpy.gui', 'resources/lock-icon.png')) self._unlocked = QtGui.QIcon( pkg_resources.resource_filename('nexpy.gui', 'resources/unlock-icon.png')) super(NXTreeItem, self).__init__(self.node.nxname)
def roi_peak_slider(self, text='ROI Peak :'): roi_peak_layout = QtGui.QHBoxLayout() roi_peak_layout.addWidget(QtGui.QLabel(text)) self.roi_peak = QtGui.QSlider(Qt.Horizontal) self.pLabel = QtGui.QLabel('800 eV') self.roi_peak.setMinimum(0) self.roi_peak.setMaximum(256) self.roi_peak.setValue(80) self.roi_peak.setTickPosition(QtGui.QSlider.TicksBelow) self.roi_peak.setTickInterval(1) roi_peak_layout.addWidget(self.roi_peak) self.roi_peak.valueChanged.connect(self.setRoi) roi_peak_layout.addWidget(self.pLabel) return roi_peak_layout
def add_parameter_rows(self, f): row = self.parameter_grid.rowCount() name = self.expanded_name(f.name) f.rows = [] f.label_box = QtGui.QLabel(name) self.parameter_grid.addWidget(f.label_box, row, 0) for p in f.parameters: p.parameter_index = row p.parameter_box = QtGui.QLabel(str(p.parameter_index)) p.value_box = QtGui.QLineEdit() p.value_box.setAlignment(QtCore.Qt.AlignRight) p.error_box = QtGui.QLabel() p.min_box = QtGui.QLineEdit('-inf') p.min_box.setAlignment(QtCore.Qt.AlignRight) p.max_box = QtGui.QLineEdit('inf') p.max_box.setAlignment(QtCore.Qt.AlignRight) p.fixed_box = QtGui.QCheckBox() # p.bound_box = QtGui.QLineEdit() self.parameter_grid.addWidget(p.parameter_box, row, 1, alignment=QtCore.Qt.AlignHCenter) self.parameter_grid.addWidget(QtGui.QLabel(p.name), row, 2) self.parameter_grid.addWidget(p.value_box, row, 3) self.parameter_grid.addWidget(p.error_box, row, 4) self.parameter_grid.addWidget(p.min_box, row, 5) self.parameter_grid.addWidget(p.max_box, row, 6) self.parameter_grid.addWidget(p.fixed_box, row, 7, alignment=QtCore.Qt.AlignHCenter) # self.parameter_grid.addWidget(p.bound_box, row, 8) f.rows.append(row) row += 1 self.parameter_grid.setRowStretch(self.parameter_grid.rowCount(), 10)
def roi_width_slider(self, text='ROI Width :'): roi_width_layout = QtGui.QHBoxLayout() roi_width_layout.addWidget(QtGui.QLabel(text)) self.roi_width = QtGui.QSlider(Qt.Horizontal) self.wLabel = QtGui.QLabel('200 eV') self.roi_width.setMinimum(2) self.roi_width.setMaximum(100) self.roi_width.setValue(20) self.roi_width.setTickPosition(QtGui.QSlider.TicksBelow) self.roi_peak.setTickInterval(1) roi_width_layout.addWidget(self.roi_width) self.roi_width.valueChanged.connect(self.setRoi) roi_width_layout.addWidget(self.wLabel) return roi_width_layout
def select_sdd(self, text='Select SDD :'): layout = QtGui.QHBoxLayout() box = QtGui.QComboBox() box.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) sdds = ['SDD1', 'SDD2', 'SDD3', 'SDD4'] for sdd in sorted(sdds): box.addItem(sdd) self.select_sdd_box = box self.select_sdd_layout = layout layout.addWidget(QtGui.QLabel(text)) layout.addWidget(box) layout.addStretch() return layout
def init_gui(self): """Initialize the GUI.""" self.app = guisupport.get_app_qt4() self.window = MainWindow(self.app, self.tree, config=self.config) self.window.log = self.log global _mainwindow _mainwindow = self.window if 'svg' in QtGui.QImageReader.supportedImageFormats(): self.app.icon = QtGui.QIcon( pkg_resources.resource_filename('nexpy.gui', 'resources/icon/NeXpy.svg')) else: self.app.icon = QtGui.QIcon( pkg_resources.resource_filename('nexpy.gui', 'resources/icon/NeXpy.png')) QtGui.QApplication.setWindowIcon(self.app.icon)
def scanbox(self): '''create widgets for specifying scan range to import''' scanminlabel = QtGui.QLabel("Min. Scan") self.scanmin = QtGui.QLineEdit() self.scanmin.setFixedWidth(100) self.scanmin.setAlignment(QtCore.Qt.AlignRight) scanmaxlabel = QtGui.QLabel("Max. Scan") self.scanmax = QtGui.QLineEdit() self.scanmax.setFixedWidth(100) self.scanmax.setAlignment(QtCore.Qt.AlignRight) scanbox = QtGui.QHBoxLayout() scanbox.addWidget(scanminlabel) scanbox.addWidget(self.scanmin) scanbox.addWidget(scanmaxlabel) scanbox.addWidget(self.scanmax) return scanbox
def __init__(self, task_id, task): super(ExecOutput, self).__init__() self.task = task self.setWindowTitle("NeXpy: Output: (%i)" % task_id) labelHost = QtGui.QLabel() labelHost.setText("hostname: " + task.ssh.host) self.editor = QtGui.QTextEdit(self) self.editor.setFixedWidth(750) self.editor.setFixedHeight(500) self.refresher = QtGui.QPushButton('Refresh') self.refresher.clicked.connect(self.refresh) layout = QtGui.QVBoxLayout() layout.addWidget(labelHost) layout.addWidget(self.editor) layout.addWidget(self.refresher) self.setLayout(layout)
def select_eem_entry(self, text='Select entry :'): layout = QtGui.QHBoxLayout() box = QtGui.QComboBox() box.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) entries = [] for entry in range(len(self.root.NXentry)): entries.append(entry) for entry in sorted(entries): box.addItem(str(entry + 1)) self.select_eem_entry_box = box self.select_eem_entry_layout = layout layout.addWidget(QtGui.QLabel(text)) layout.addWidget(box) layout.addStretch() return layout
def __init__(self, parent): super(NXPlainTextEdit, self).__init__() self.setFont(QtGui.QFont('Courier')) self.setMinimumWidth(700) self.setMinimumHeight(600) self.setWordWrapMode(QtGui.QTextOption.NoWrap) self.parent = parent self.blockCountChanged.connect(self.parent.update_line_numbers)
def popMenu(self, node): menu = QtGui.QMenu(self) try: if node.is_plottable(): menu.addAction(self.plot_data_action) if ((isinstance(node, NXgroup) and node.nxsignal and node.nxsignal.plot_rank == 1) or (isinstance(node, NXfield) and node.plot_rank == 1)): menu.addAction(self.plot_line_action) if self.mainwindow.plotview.ndim == 1: menu.addAction(self.overplot_data_action) menu.addAction(self.overplot_line_action) if ((isinstance(node, NXgroup) and node.plottable_data and node.plottable_data.nxsignal and node.plottable_data.nxsignal.plot_rank > 2) or (isinstance(node, NXfield) and node.plot_rank > 2)): menu.addAction(self.plot_image_action) menu.addSeparator() except Exception: pass menu.addAction(self.add_action) if not isinstance(node, NXroot): if isinstance(node, NXgroup): menu.addAction(self.initialize_action) menu.addAction(self.rename_action) if isinstance(node, NXroot) and not node.nxfilemode: menu.addAction(self.delete_action) elif not isinstance(node, NXroot): menu.addAction(self.delete_action) menu.addSeparator() if not isinstance(node, NXroot): menu.addAction(self.copy_action) if isinstance(node, NXgroup) and self.mainwindow.copied_node: menu.addAction(self.paste_action) menu.addAction(self.pastelink_action) if isinstance(node, NXlink): menu.addSeparator() menu.addAction(self.link_action) if not isinstance(node, NXroot): menu.addSeparator() if isinstance(node, NXgroup): menu.addAction(self.fit_action) menu.addSeparator() menu.addAction(self.signal_action) menu.addSeparator() menu.addAction(self.savefile_action) if isinstance(node, NXroot) and node.nxfilemode: menu.addAction(self.duplicate_action) menu.addSeparator() if node.nxfilemode == 'r': menu.addAction(self.unlockfile_action) else: menu.addAction(self.lockfile_action) menu.addSeparator() menu.addAction(self.remove_action) if node.nxfilemode: menu.addAction(self.reload_action) return menu
def __init__(self, mgr): super(ExecWindow, self).__init__() self.mgr = mgr self.outputViews = {} self.label = QtGui.QLabel() self.combobox = QtGui.QComboBox() self.combobox.SizeAdjustPolicy = \ QtGui.QComboBox.AdjustToContents button_layout = QtGui.QHBoxLayout() self.refresher = QtGui.QPushButton('Refresh') self.refresher.clicked.connect(self.refresh) self.outviewer = QtGui.QPushButton('Show Output') self.outviewer.clicked.connect(self.outview) self.killer = QtGui.QPushButton('Kill') self.killer.clicked.connect(self.kill_task) button_layout.addWidget(self.refresher) button_layout.addWidget(self.outviewer) button_layout.addWidget(self.killer) button_layout.addStretch() layout = QtGui.QVBoxLayout() layout.addWidget(self.label) layout.addWidget(self.combobox) layout.addLayout(button_layout) self.setLayout(layout) self.setWindowTitle("Execution list") self.refresh()
def ssh_box(self): pyro_layout = QtGui.QHBoxLayout() user_label = QtGui.QLabel('Remote user:'******'USER')) self.user_box.setMinimumWidth(100) port_label = QtGui.QLabel('Local port:') self.port_box = QtGui.QLineEdit('8801') self.port_box.setMinimumWidth(100) self.ssh_start_button = QtGui.QPushButton("Start SSH") self.ssh_stop_button = QtGui.QPushButton("Stop SSH") if self.globus.ssh_session is not None: self.ssh_start_button.setEnabled(False) self.ssh_stop_button.setEnabled(True) else: self.ssh_start_button.setEnabled(True) self.ssh_stop_button.setEnabled(False) self.ssh_start_button.clicked.connect(self.ssh_start) self.ssh_stop_button.clicked.connect(self.ssh_stop) pyro_layout.addStretch() pyro_layout.addWidget(user_label) pyro_layout.addWidget(self.user_box) pyro_layout.addWidget(port_label) pyro_layout.addWidget(self.port_box) pyro_layout.addWidget(self.ssh_start_button) pyro_layout.addWidget(self.ssh_stop_button) pyro_layout.addStretch() return pyro_layout
def confirm_action(self, query, information=None): message_box = QtGui.QMessageBox() message_box.setText(query) if information: message_box.setInformativeText(information) message_box.setStandardButtons(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel) message_box.setDefaultButton(QtGui.QMessageBox.Ok) return message_box.exec_()
def get_members(self): if self.member_combo is None: member_layout = QtGui.QHBoxLayout() self.member_combo = QtGui.QComboBox() self.member_combo.setSizeAdjustPolicy( QtGui.QComboBox.AdjustToContents) self.member_combo.currentIndexChanged.connect(self.get_member) member_layout.addWidget(QtGui.QLabel('Member: ')) member_layout.addWidget(self.member_combo) member_layout.addStretch() self.layout.insertLayout(2, member_layout) else: self.member_combo.clear() for member in self.globus.get_members(self.dataset): try: self.member_combo.addItem(member['data_uri']) except: pass
def __init__(self, defaults=(None, None)): super(RemoteDialog, self).__init__() token_file = os.path.join(os.path.expanduser('~'), '.nexpy', 'globusonline', 'gotoken.txt') self.globus = GlobusCatalog(token_file) catalog_layout = QtGui.QHBoxLayout() self.catalog_combo = QtGui.QComboBox() for catalog in self.globus.get_catalogs(): try: self.catalog_combo.addItem(catalog['config']['name']) except: pass self.catalog_combo.setSizeAdjustPolicy( QtGui.QComboBox.AdjustToContents) self.catalog_combo.currentIndexChanged.connect(self.get_datasets) catalog_layout.addWidget(QtGui.QLabel('Catalog: ')) catalog_layout.addWidget(self.catalog_combo) catalog_layout.addStretch() self.layout = QtGui.QVBoxLayout() self.layout.addLayout(catalog_layout) self.layout.addWidget(self.close_buttons()) self.setLayout(self.layout) self.dataset_combo = None self.member_combo = None self.ssh_controls = False # SSH controls not yet constructed catalog, dataset = defaults if catalog: try: idx = self.catalog_combo.findText(catalog) self.catalog_combo.setCurrentIndex(idx) self.get_datasets() if dataset: idx = self.dataset_combo.findText(dataset) self.dataset_combo.setCurrentIndex(idx) self.get_members() except: pass self.setWindowTitle("Open Remote File")
def __init__(self, parent=None): super(ImportDialog, self).__init__(parent) skippedbox = QtGui.QHBoxLayout() skippedlabel = QtGui.QLabel("No. of skipped rows") self.skiprows = QtGui.QLineEdit() self.skiprows.setText('0') self.skiprows.setFixedWidth(20) skippedbox.addWidget(skippedlabel) skippedbox.addWidget(self.skiprows) layout = QtGui.QVBoxLayout() layout.addLayout(self.filebox()) layout.addLayout(skippedbox) layout.addWidget(self.buttonbox()) self.setLayout(layout) self.setWindowTitle("Import " + str(filetype))
def __init__(self, parent=None): super(ImportDialog, self).__init__(parent) layout = QtGui.QVBoxLayout() layout.addLayout(self.filebox()) layout.addWidget(self.buttonbox()) self.setLayout(layout) self.setWindowTitle("Import " + str(filetype))
def select_abs(self, text='Select Detector :'): layout = QtGui.QHBoxLayout() box = QtGui.QComboBox() box.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) sdds = [ 'TEY', 'I0', 'DIODE', 'PFY_SDD1', 'PFY_SDD2', 'PFY_SDD3', 'PFY_SDD4' ] for sdd in sorted(sdds): box.addItem(sdd) box.setCurrentIndex(2) self.select_abs_box = box self.select_abs_layout = layout layout.addWidget(QtGui.QLabel(text)) layout.addWidget(box) layout.addStretch() return layout
def get_datasets(self): if self.dataset_combo is None: dataset_layout = QtGui.QHBoxLayout() self.dataset_combo = QtGui.QComboBox() self.dataset_combo.setSizeAdjustPolicy( QtGui.QComboBox.AdjustToContents) self.dataset_combo.currentIndexChanged.connect(self.get_members) dataset_layout.addWidget(QtGui.QLabel('Dataset: ')) dataset_layout.addWidget(self.dataset_combo) dataset_layout.addStretch() self.layout.insertLayout(1, dataset_layout) else: self.dataset_combo.clear() if self.member_combo is not None: self.member_combo.clear() for dataset in self.globus.get_datasets(self.catalog): try: self.dataset_combo.addItem(dataset['name']) except: pass
def select_entry_num(self, text='Select Entry :', other=False): layout = QtGui.QHBoxLayout() box = QtGui.QComboBox() box.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) entries = [] for entry in range(len(self.root.NXentry)): entries.append(entry) for entry in sorted(entries): box.addItem(str(entry + 1)) layout.addWidget(QtGui.QLabel(text)) layout.addWidget(box) layout.addStretch() if not other: self.entry_num_box = box self.entry_num_layout = layout else: self.other_entry_num_box = box self.other_entry_num_layout = layout return layout
def __init__(self, parent=None): super(TransformDialog, self).__init__(parent) self.select_entry(self.initialize_grid) self.refine = NXRefine() grid = QtWidgets.QGridLayout() grid.setSpacing(10) header_font = QtGui.QFont() header_font.setBold(True) start_label = QtWidgets.QLabel('Start') start_label.setFont(header_font) grid.addWidget(start_label, 0, 1) step_label = QtWidgets.QLabel('Step') step_label.setFont(header_font) grid.addWidget(step_label, 0, 2) stop_label = QtWidgets.QLabel('Stop') stop_label.setFont(header_font) grid.addWidget(stop_label, 0, 3) grid.addWidget(QtWidgets.QLabel('H:'), 1, 0) grid.addWidget(QtWidgets.QLabel('K:'), 2, 0) grid.addWidget(QtWidgets.QLabel('L:'), 3, 0) self.start_h_box = QtWidgets.QLineEdit() self.step_h_box = QtWidgets.QLineEdit() self.stop_h_box = QtWidgets.QLineEdit() grid.addWidget(self.start_h_box, 1, 1) grid.addWidget(self.step_h_box, 1, 2) grid.addWidget(self.stop_h_box, 1, 3) self.start_k_box = QtWidgets.QLineEdit() self.step_k_box = QtWidgets.QLineEdit() self.stop_k_box = QtWidgets.QLineEdit() grid.addWidget(self.start_k_box, 2, 1) grid.addWidget(self.step_k_box, 2, 2) grid.addWidget(self.stop_k_box, 2, 3) self.start_l_box = QtWidgets.QLineEdit() self.step_l_box = QtWidgets.QLineEdit() self.stop_l_box = QtWidgets.QLineEdit() grid.addWidget(self.start_l_box, 3, 1) grid.addWidget(self.step_l_box, 3, 2) grid.addWidget(self.stop_l_box, 3, 3) self.set_layout( self.entry_layout, grid, self.checkboxes( ('copy', 'Copy to all entries', True), ('mask', 'Create masked transform group', True), ('overwrite', 'Overwrite existing transforms', False)), self.close_buttons(save=True)) self.setWindowTitle('Transforming Data') try: self.initialize_grid() except Exception: pass
def make_filterbox(self): filterbox = QtGui.QWidget() layout = QtGui.QGridLayout() layout.setSpacing(10) prefix_label = QtGui.QLabel('File Prefix') self.prefix_box = QtGui.QLineEdit() self.prefix_box.editingFinished.connect(self.set_range) suffix_label = QtGui.QLabel('File Suffix') self.suffix_box = QtGui.QLineEdit('') self.suffix_box.editingFinished.connect(self.get_prefixes) extension_label = QtGui.QLabel('File Extension') self.extension_box = QtGui.QLineEdit() self.extension_box.editingFinished.connect(self.set_extension) layout.addWidget(prefix_label, 0, 0) layout.addWidget(self.prefix_box, 0, 1) layout.addWidget(suffix_label, 0, 2) layout.addWidget(self.suffix_box, 0, 3) layout.addWidget(extension_label, 0, 4) layout.addWidget(self.extension_box, 0, 5) self.prefix_combo = QtGui.QComboBox() self.prefix_combo.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) self.prefix_combo.activated.connect(self.choose_prefix) self.extension_combo = QtGui.QComboBox() self.extension_combo.setSizeAdjustPolicy( QtGui.QComboBox.AdjustToContents) self.extension_combo.activated.connect(self.choose_extension) layout.addWidget(self.prefix_combo, 1, 1, alignment=QtCore.Qt.AlignHCenter) layout.addWidget(self.extension_combo, 1, 5, alignment=QtCore.Qt.AlignHCenter) filterbox.setLayout(layout) filterbox.setVisible(False) return filterbox