def __init__(self, parent=None, name="xrf_spectrum_parameters_widget"): QtGui.QWidget.__init__(self, parent) if name is not None: self.setObjectName(name) # Hardware objects ---------------------------------------------------- self.xrf_spectrum_hwobj = None # Internal variables -------------------------------------------------- self.xrf_spectrum_model = queue_model_objects.XRFSpectrum() self._tree_view_item = None # Graphic elements ---------------------------------------------------- _top_widget = QtGui.QWidget(self) _parameters_widget = QtGui.QWidget(_top_widget) self.data_path_widget = DataPathWidget(_parameters_widget) self.other_parameters_gbox = QtGui.QGroupBox("Other parameters", _parameters_widget) self.count_time_label = QtGui.QLabel("Count time:", self.other_parameters_gbox) self.count_time_ledit = QtGui.QLineEdit(self.other_parameters_gbox) self.count_time_ledit.setFixedWidth(50) self.adjust_transmission_cbox = QtGui.QCheckBox("Adjust transmission", \ self.other_parameters_gbox) self.adjust_transmission_cbox.hide() _snapshot_widget = QtGui.QWidget(self) self.position_widget = uic.loadUi( os.path.join(os.path.dirname(__file__), 'ui_files/Qt4_snapshot_widget_layout.ui')) self.mca_spectrum_widget = McaSpectrumWidget(self) # Layout ------------------------------------------------------------- _other_parameters_gbox_hlayout = QtGui.QHBoxLayout( self.other_parameters_gbox) _other_parameters_gbox_hlayout.addWidget(self.count_time_label) _other_parameters_gbox_hlayout.addWidget(self.count_time_ledit) _other_parameters_gbox_hlayout.addWidget(self.adjust_transmission_cbox) _other_parameters_gbox_hlayout.addStretch(0) _other_parameters_gbox_hlayout.setSpacing(2) _other_parameters_gbox_hlayout.setContentsMargins(3, 3, 3, 3) _parameters_widget_layout = QtGui.QVBoxLayout(_parameters_widget) _parameters_widget_layout.addWidget(self.data_path_widget) _parameters_widget_layout.addWidget(self.other_parameters_gbox) _parameters_widget_layout.addStretch(0) _parameters_widget_layout.setSpacing(2) _parameters_widget_layout.setContentsMargins(0, 0, 0, 0) _snapshots_vlayout = QtGui.QVBoxLayout(_snapshot_widget) _snapshots_vlayout.addWidget(self.position_widget) _snapshots_vlayout.setContentsMargins(0, 0, 0, 0) _snapshots_vlayout.setSpacing(2) _snapshots_vlayout.addStretch(0) _top_widget_layout = QtGui.QHBoxLayout(_top_widget) _top_widget_layout.addWidget(_parameters_widget) _top_widget_layout.addWidget(_snapshot_widget) _top_widget_layout.setSpacing(2) _top_widget_layout.addStretch(0) _top_widget_layout.setContentsMargins(0, 0, 0, 0) _main_vlayout = QtGui.QVBoxLayout(self) _main_vlayout.addWidget(_top_widget) _main_vlayout.addWidget(self.mca_spectrum_widget) _main_vlayout.setSpacing(2) _main_vlayout.setContentsMargins(0, 0, 0, 0) # SizePolicies ------------------------------------------------------- self.position_widget.setFixedSize(457, 350) self.mca_spectrum_widget.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) _top_widget.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) # Qt signal/slot connections ------------------------------------------ self.data_path_widget.data_path_layout.prefix_ledit.\ textChanged.connect(self._prefix_ledit_change) self.data_path_widget.data_path_layout.run_number_ledit.\ textChanged.connect(self._run_number_ledit_change) self.count_time_ledit.textChanged.connect( self._count_time_ledit_change)
def __init__(self, parent = None, name = "xrf_scan_tab_widget"): QtGui.QWidget.__init__(self, parent) if name is not None: self.setObjectName(name) # Hardware objects ---------------------------------------------------- self.xrf_scan_hwobj = None # Internal variables -------------------------------------------------- self.xrf_scan_model = queue_model_objects.XRFScan() self._tree_view_item = None # Graphic elements ---------------------------------------------------- _top_widget = QtGui.QWidget(self) _parameters_widget = QtGui.QWidget(_top_widget) self.data_path_widget = DataPathWidget(_parameters_widget) self.other_parameters_gbox = QtGui.QGroupBox("Other parameters", _parameters_widget) self.count_time_label = QtGui.QLabel("Count time:", self.other_parameters_gbox) self.count_time_ledit = QtGui.QLineEdit(self.other_parameters_gbox) self.count_time_ledit.setFixedWidth(50) self.position_widget = uic.loadUi(os.path.join(os.path.dirname(__file__), 'ui_files/Qt4_snapshot_widget_layout.ui')) self.mca_spectrum_widget = McaSpectrumWidget(self) # Layout ------------------------------------------------------------- self.other_parameters_gbox_layout = QtGui.QHBoxLayout(self) self.other_parameters_gbox_layout.addWidget(self.count_time_label) self.other_parameters_gbox_layout.addWidget(self.count_time_ledit) self.other_parameters_gbox_layout.addStretch(0) self.other_parameters_gbox_layout.setSpacing(2) self.other_parameters_gbox_layout.setContentsMargins(3, 3, 3, 3) self.other_parameters_gbox.setLayout(self.other_parameters_gbox_layout) _parameters_widget_layout = QtGui.QVBoxLayout() _parameters_widget_layout.addWidget(self.data_path_widget) _parameters_widget_layout.addWidget(self.other_parameters_gbox) _parameters_widget_layout.addStretch(0) _parameters_widget_layout.setSpacing(2) _parameters_widget_layout.setContentsMargins(0, 0, 0, 0) _parameters_widget.setLayout(_parameters_widget_layout) _top_widget_layout = QtGui.QHBoxLayout(_top_widget) _top_widget_layout.addWidget(_parameters_widget) _top_widget_layout.addWidget(self.position_widget) _top_widget_layout.setSpacing(2) _top_widget_layout.setContentsMargins(0, 0, 0, 0) _top_widget.setLayout(_top_widget_layout) _main_vlayout = QtGui.QVBoxLayout(self) _main_vlayout.addWidget(_top_widget) _main_vlayout.addWidget(self.mca_spectrum_widget) _main_vlayout.setSpacing(2) _main_vlayout.setContentsMargins(0, 0, 0, 0) self.setLayout(_main_vlayout) # SizePolicies ------------------------------------------------------- self.position_widget.setFixedSize(457, 350) self.mca_spectrum_widget.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) _top_widget.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) #self.mca_spectrum_widget.setMinimumHeight(800) #self.setSizePolicy(QtGui.QSizePolicy.Expanding, # QtGui.QSizePolicy.Fixed) # Qt signal/slot connections ------------------------------------------ self.data_path_widget.data_path_layout.prefix_ledit.\ textChanged.connect(self._prefix_ledit_change) self.data_path_widget.data_path_layout.run_number_ledit.\ textChanged.connect(self._run_number_ledit_change) self.count_time_ledit.textChanged.connect(self._count_time_ledit_change) #QtCore.QObject.connect(.qApp, qt.PYSIGNAL('tab_changed'), # self.tab_changed) # Other --------------------------------------------------------------- Qt4_widget_colors.set_widget_color(self.other_parameters_gbox, Qt4_widget_colors.GROUP_BOX_GRAY) Qt4_widget_colors.set_widget_color(self.data_path_widget, Qt4_widget_colors.GROUP_BOX_GRAY) Qt4_widget_colors.set_widget_color(self.position_widget, Qt4_widget_colors.GROUP_BOX_GRAY)