def __init__(self, parent=None, name=None, fl=0): CreateTaskBase.__init__(self, parent, name, fl, "XRF-spectrum") self.count_time = None # Data attributes self.init_models() xrfspectrum_model = queue_model_objects.XRFSpectrum() self.xrfspectrum_mib = DataModelInputBinder(xrfspectrum_model) # Layout v_layout = qt.QVBoxLayout(self, 2, 6, "main_v_layout") self._data_path_gbox = qt.QVGroupBox("Data location", self, "data_path_gbox") self._data_path_widget = DataPathWidget( self._data_path_gbox, data_model=self._path_template, layout="vertical" ) parameters_hor_gbox = qt.QHGroupBox("Parameters", self) self.count_time_label = qt.QLabel("Count time", parameters_hor_gbox) self.count_time_label.setFixedWidth(83) self.count_time_ledit = qt.QLineEdit( "1.0", parameters_hor_gbox, "count_time_ledit" ) self.count_time_ledit.setFixedWidth(50) self.xrfspectrum_mib.bind_value_update( "count_time", self.count_time_ledit, float ) # , spacer = qt.QWidget(parameters_hor_gbox) spacer.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed) v_layout.addWidget(self._data_path_gbox) v_layout.addWidget(parameters_hor_gbox) v_layout.addStretch() self.connect( self._data_path_widget.data_path_widget_layout.child("run_number_ledit"), qt.SIGNAL("textChanged(const QString &)"), self._run_number_ledit_change, ) self.connect( self._data_path_widget.data_path_widget_layout.child("prefix_ledit"), qt.SIGNAL("textChanged(const QString &)"), self._prefix_ledit_change, ) self.connect( self._data_path_widget, qt.PYSIGNAL("path_template_changed"), self.handle_path_conflict, )
def __init__(self, parent=None): super(ConfigurationPage, self).__init__(parent) configGroup = qt.QHGroupBox("Server configuration", self) serverLabel = qt.QLabel("Server:", configGroup) serverCombo = qt.QComboBox(configGroup) serverCombo.insertItem("Trolltech (Australia)") serverCombo.insertItem("Trolltech (Germany)") serverCombo.insertItem("Trolltech (Norway)") serverCombo.insertItem("Trolltech (People's Republic of China)") serverCombo.insertItem("Trolltech (USA)")
def _getLabeledFrame(w, label="", etchedBorder=0): """Utility function to create a labeled frame""" box = qt.QHGroupBox(w, label) box.setSizePolicy(_ANCHOR) box.setTitle(label) if not etchedBorder: box.setFrameShadow(qt.QFrame.Plain) box.setLineWidth(0) return box
def __init__(self, *args): BlissWidget.__init__(self, *args) self.addProperty("mnemonic", "string", "") self.addProperty("icons", "string", "") self.addProperty("formatString", "formatString", "###.##") self.beamstop_hwobj = None self.top_gbox = qt.QHGroupBox("Beamstop distance", self) self.top_gbox.setInsideMargin(4) self.top_gbox.setInsideSpacing(2) self.params_widget = qt.QWidget(self.top_gbox) qt.QGridLayout(self.params_widget, 2, 3, 0, 2) label1 = qt.QLabel("Current:", self.params_widget) label1.setFixedWidth(70) self.params_widget.layout().addWidget(label1, 0, 0) self.current_position_ledit = qt.QLineEdit(self.params_widget) self.current_position_ledit.setReadOnly(True) self.params_widget.layout().addWidget(self.current_position_ledit, 0, 1) label2 = qt.QLabel("Set to:", self.params_widget) label2.setFixedWidth(70) self.params_widget.layout().addWidget(label2, 1, 0) self.new_position_ledit = qt.QLineEdit(self.params_widget) self.new_position_ledit.setAlignment(qt.QWidget.AlignRight) self.params_widget.layout().addWidget(self.new_position_ledit, 1, 1) self.new_position_ledit.setValidator(qt.QDoubleValidator(self)) self.new_position_ledit.setPaletteBackgroundColor( BeamstopDistanceBrick.CONNECTED_COLOR) qt.QObject.connect(self.new_position_ledit, qt.SIGNAL("returnPressed()"), self.change_position) qt.QObject.connect( self.new_position_ledit, qt.SIGNAL("textChanged(const QString &)"), self.input_field_changed, ) self.instanceSynchronize("new_position_ledit") qt.QVBoxLayout(self) self.layout().addWidget(self.top_gbox)
def __init__(self, parent=None, name=None, fl=0): CreateTaskBase.__init__(self, parent, name, fl, "Energy-scan") # Data attributes self.init_models() # Layout v_layout = qt.QVBoxLayout(self, 2, 5, "main_v_layout") h_box = qt.QHGroupBox("Available elements", self) self.periodic_table = PeriodicTableBrick(h_box) font = self.periodic_table.font() font.setPointSize(8) self.periodic_table.setFont(font) h_box.setMaximumWidth(470) h_box.setMaximumHeight(310) self._data_path_gbox = qt.QVGroupBox("Data location", self, "data_path_gbox") self._data_path_widget = DataPathWidget( self._data_path_gbox, data_model=self._path_template, layout="vertical" ) v_layout.addWidget(h_box) v_layout.addWidget(self._data_path_gbox) v_layout.addStretch() self.connect( self._data_path_widget.data_path_widget_layout.child("prefix_ledit"), qt.SIGNAL("textChanged(const QString &)"), self._prefix_ledit_change, ) self.connect( self._data_path_widget.data_path_widget_layout.child("run_number_ledit"), qt.SIGNAL("textChanged(const QString &)"), self._run_number_ledit_change, ) self.connect( self._data_path_widget, qt.PYSIGNAL("path_template_changed"), self.handle_path_conflict, ) qt.QObject.connect( self.periodic_table, qt.PYSIGNAL("edgeSelected"), self.element_clicked )
def __init__(self, parent=None, name="energy_scan_tab_widget"): qt.QWidget.__init__(self, parent, name) # Data Attributes self.energy_scan = queue_model_objects.EnergyScan() self._tree_view_item = None # Layout h_layout = qt.QHBoxLayout(self, 0, 0, "main_v_layout") col_one_vlayout = qt.QVBoxLayout(h_layout, 0, "row_one") periodic_table_gbox = qt.QHGroupBox("Available Elements", self) self.periodic_table = PeriodicTableBrick(periodic_table_gbox) #QPeriodicTable.QPeriodicTable(periodic_table_gbox) self.periodic_table.setFixedHeight(341) self.periodic_table.setFixedWidth(650) #font = periodic_table.font() #font.setPointSize(8) #periodic_table.setFont(font) #scan_plot_gbox = qt.QHGroupBox("Scan plot", self) #spec_scan_plot_brick = SpecScanPlotBrick(scan_plot_gbox) self.data_path_widget = DataPathWidget(self) self.data_path_widget.data_path_widget_layout.child( 'file_name_label').setText('') self.data_path_widget.data_path_widget_layout.child( 'file_name_value_label').hide() col_one_vlayout.add(periodic_table_gbox) col_one_vlayout.add(self.data_path_widget) col_one_vlayout.addStretch(10) qt.QObject.connect(self.periodic_table, qt.PYSIGNAL('edgeSelected'), self.element_clicked) qt.QObject.connect( self.data_path_widget.data_path_widget_layout.child( 'prefix_ledit'), qt.SIGNAL("textChanged(const QString &)"), self._prefix_ledit_change) qt.QObject.connect( self.data_path_widget.data_path_widget_layout.child( 'run_number_ledit'), qt.SIGNAL("textChanged(const QString &)"), self._run_number_ledit_change) qt.QObject.connect(qt.qApp, qt.PYSIGNAL('tab_changed'), self.tab_changed)
def __init__(self, parent=None): super(UpdatePage, self).__init__(parent) updateGroup = qt.QVGroupBox("Package selection", self) systemCheckBox = qt.QCheckBox("Update system", updateGroup) appsCheckBox = qt.QCheckBox("Update applications", updateGroup) docsCheckBox = qt.QCheckBox("Update documentation", updateGroup) packageGroup = qt.QHGroupBox("Existing packages", self) packageList = qt.QListView(packageGroup) packageList.addColumn("") packageList.setColumnWidthMode(0, qt.QListView.Maximum) packageList.setColumnWidth(0, packageList.width()) qtItem = qt.QListViewItem(packageList) qtItem.setText(0, "Qt") qsaItem = qt.QListViewItem(packageList) qsaItem.setText(0, "QSA") teamBuilderItem = qt.QListViewItem(packageList) teamBuilderItem.setText(0, "Teambuilder") self.setSpacing(12) startUpdateButton = qt.QPushButton("Start update", self)
def __init__(self, *args): BlissWidget.__init__(self, *args) self.collect_hwobj = None self.addProperty("mnemonic", "string", "") self.addProperty("appearance", "combo", ("simple", "normal"), "normal") self.addProperty("title", "string", "") self.addProperty("timeFormat", "string", "%H:%M:%S") self.executing = None self.time_total_sec = 0 self.time_remaining_sec = 0 self.time_format = None self.progress_task = None self.container_hbox = qt.QHGroupBox(self) self.container_hbox.setInsideMargin(4) self.container_hbox.setInsideSpacing(2) self.time_total_label = qt.QLabel("Total:", self.container_hbox) self.time_total_value_label = qt.QLabel("??:??:??", self.container_hbox) self.progressBar = qt.QProgressBar(self.container_hbox) self.progressBar.setCenterIndicator(True) self.time_remaining_label = qt.QLabel("Remaining:", self.container_hbox) self.time_remaining_value_label = qt.QLabel("??:??:??", self.container_hbox) qt.QVBoxLayout(self) self.setSizePolicy(qt.QSizePolicy.MinimumExpanding, qt.QSizePolicy.Fixed) self.layout().addWidget(self.container_hbox) self.setEnabled(False) self.instanceSynchronize("")
def __init__(self, *args): BlissWidget.__init__(self, *args) self.collect_hwobj = None self.addProperty('mnemonic', 'string', '') self.addProperty('appearance', 'combo', ('simple', 'normal'), 'normal') self.addProperty('title', 'string', '') self.addProperty('timeFormat', 'string', '%H:%M:%S') self.executing = None self.time_total_sec = 0 self.time_remaining_sec = 0 self.time_format = None self.progress_task = None self.container_hbox = qt.QHGroupBox(self) self.container_hbox.setInsideMargin(4) self.container_hbox.setInsideSpacing(2) self.time_total_label = qt.QLabel('Total:', self.container_hbox) self.time_total_value_label = qt.QLabel('??:??:??', self.container_hbox) self.progressBar = qt.QProgressBar(self.container_hbox) self.progressBar.setCenterIndicator(True) self.time_remaining_label = qt.QLabel('Remaining:', self.container_hbox) self.time_remaining_value_label = qt.QLabel('??:??:??', self.container_hbox) qt.QVBoxLayout(self) self.setSizePolicy(qt.QSizePolicy.MinimumExpanding, qt.QSizePolicy.Fixed) self.layout().addWidget(self.container_hbox) self.setEnabled(False) self.instanceSynchronize("")
def __init__(self, topText = None, bottomText = None, \ parent = None, name = "TextEditor", modal = 1, fl = 0): """ Constructor method topText .. : text appearing in the top of the item (title ?) bottomText : text appearing in the bottom of the item (legend ?) parent ... : name ..... : name of the dialog widget modal .... : is the dialog modal ? fl ....... : qt flag """ qt.QDialog.__init__(self, parent, name, modal, fl) self.setCaption(name) # placing layout = qt.QVBoxLayout(self) gridg = qt.QHGroupBox(self) gridw = qt.QWidget(gridg) grid = qt.QGridLayout(gridw, 2, 4) grid.setColStretch(1, 4) # Top Text topLabel = qt.QLabel("Top Text", gridw) # self. ? self.topText = qt.QLineEdit(gridw) if topText is not None: self.topText.setText(topText[0]) self.topFont = topText[1] self.topColor = topText[2] else: self.topFont = self.topText.font() self.topColor = self.topText.paletteForegroundColor() topFontButton = qt.QPushButton("Font" , gridw) self.topColorButton = QubColorToolButton (gridw) self.topColorButton.setAutoRaise(False) self.topColorButton.setIconColor(self.topColor) self.connect(topFontButton , qt.SIGNAL("clicked()"), self.__topFont) self.connect(self.topColorButton, qt.PYSIGNAL("colorSelected"), self.__setTopColor) grid.addWidget(topLabel, 0, 0) grid.addWidget(self.topText, 0, 1) grid.addWidget(topFontButton, 0, 2) grid.addWidget(self.topColorButton, 0, 3) # Bottom Text botLabel = qt.QLabel("Bottom Text", gridw) self.botText = qt.QLineEdit(gridw) if bottomText is not None: self.botText.setText(bottomText[0]) self.botFont = bottomText[1] self.botColor = bottomText[2] else: self.botFont = self.botText.font() self.botColor = self.botText.paletteForegroundColor() botFontButton = qt.QPushButton("Font", gridw) self.botColorButton = QubColorToolButton (gridw) self.botColorButton.setAutoRaise(False) self.botColorButton.setIconColor(self.botColor) self.connect(botFontButton, qt.SIGNAL("clicked()"), self.__botFont) self.connect(self.botColorButton, qt.PYSIGNAL("colorSelected"), self.__setBotColor) grid.addWidget(botLabel, 1, 0) grid.addWidget(self.botText, 1, 1) grid.addWidget(botFontButton, 1, 2) grid.addWidget(self.botColorButton, 1, 3) # dialog buttons butw = qt.QHButtonGroup(self) cancelBut = qt.QPushButton("Cancel", butw) okBut = qt.QPushButton("OK", butw) okBut.setDefault(1) self.connect(cancelBut, qt.SIGNAL("clicked()"), self.reject) self.connect(okBut, qt.SIGNAL("clicked()"), self.accept) layout.addWidget(gridg) layout.addWidget(butw)
def __init__(self, parent=None, name="xrf_spectrum_tab_widget"): qt.QWidget.__init__(self, parent, name) # Data Attributes self.xrf_spectrum_hwobj = None self.xrf_spectrum = queue_model_objects.XRFSpectrum() self._tree_view_item = None self.data_path_widget = DataPathWidget(self) self.other_parameters_gbox = qt.QHGroupBox("Other parameters", self) self.count_time_label = qt.QLabel("Count time:", self.other_parameters_gbox) self.count_time_ledit = qt.QLineEdit( self.other_parameters_gbox, "count_time_ledit" ) self.count_time_ledit.setFixedWidth(50) spacer = qt.QWidget(self.other_parameters_gbox) spacer.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed) widget_ui = os.path.join( os.path.dirname(__file__), "ui_files/snapshot_widget_layout.ui" ) widget = qtui.QWidgetFactory.create(widget_ui) widget.reparent(self, qt.QPoint(0, 0)) self.position_widget = widget self.position_widget.setFixedSize(457, 350) # self.position_widget.setSizePolicy(qt.QSizePolicy.Fixed, qt.QSizePolicy.Fixed) self.mca_spectrum = McaSpectrumBrick(self) self.mca_spectrum.setSizePolicy( qt.QSizePolicy.Expanding, qt.QSizePolicy.Expanding ) self.mca_spectrum.setMinimumHeight(700) v_layout = qt.QVBoxLayout(self) rone_hlayout = qt.QHBoxLayout(v_layout) rone_vlayout = qt.QVBoxLayout(rone_hlayout) rone_sv_layout = qt.QVBoxLayout(rone_hlayout) rone_vlayout.addWidget(self.data_path_widget) rone_vlayout.addWidget(self.other_parameters_gbox) rone_vlayout.addStretch() rone_sv_layout.addWidget(self.position_widget) rone_sv_layout.addStretch() v_layout.addWidget(self.mca_spectrum) v_layout.addStretch() qt.QObject.connect( self.data_path_widget.data_path_widget_layout.child("prefix_ledit"), qt.SIGNAL("textChanged(const QString &)"), self._prefix_ledit_change, ) qt.QObject.connect( self.data_path_widget.data_path_widget_layout.child("run_number_ledit"), qt.SIGNAL("textChanged(const QString &)"), self._run_number_ledit_change, ) qt.QObject.connect( self.count_time_ledit, qt.SIGNAL("textChanged(const QString &)"), self._count_time_ledit_change, ) qt.QObject.connect(qt.qApp, qt.PYSIGNAL("tab_changed"), self.tab_changed)
def __init__(self, *args): BlissWidget.__init__(self, *args) self.diffractometer_hwobj = None self.addProperty("mnemonic", "string", "") self.addProperty("label", "string", "") self.addProperty("showLabel", "boolean", True) self.addProperty("showBox", "boolean", True) self.addProperty("showStop", "boolean", True) self.addProperty("showPosition", "boolean", True) self.addProperty("icons", "string", "") self.container_hbox = qt.QHGroupBox(self) self.container_hbox.setSizePolicy(qt.QSizePolicy.Minimum, qt.QSizePolicy.Fixed) self.label_hbox = qt.QHBox(self.container_hbox) self.motor_hbox = qt.QHBox(self.container_hbox) self.label = qt.QLabel(self.label_hbox) self.kappa_value_edit = qt.QLineEdit(self.motor_hbox) self.kappa_value_edit.setFixedSize(qt.QSize(55, 25)) self.kappa_value_edit.setValidator(qt.QDoubleValidator(0, 180, 2, self)) self.kappa_value_edit.setPaletteBackgroundColor(widget_colors.LIGHT_GREEN) self.kappa_value_edit.setAlignment(qt.QWidget.AlignRight) self.phi_value_edit = qt.QLineEdit(self.motor_hbox) self.phi_value_edit.setFixedSize(qt.QSize(55, 25)) self.phi_value_edit.setValidator(qt.QDoubleValidator(0, 180, 2, self)) self.phi_value_edit.setPaletteBackgroundColor(widget_colors.LIGHT_GREEN) self.phi_value_edit.setAlignment(qt.QWidget.AlignRight) self.move_motors_button = qt.QPushButton("Apply", self.motor_hbox) self.stop_motors_button = qt.QPushButton(self.motor_hbox) self.stop_motors_button.setPixmap(Icons.load("stop_small")) self.stop_motors_button.setEnabled(False) self.connect( self.kappa_value_edit, qt.SIGNAL("textChanged(const QString &)"), self.kappa_edit_input_changed, ) self.connect( self.phi_value_edit, qt.SIGNAL("textChanged(const QString &)"), self.phi_edit_input_changed, ) self.connect( self.move_motors_button, qt.SIGNAL("clicked()"), self.move_motors_button_clicked, ) self.connect( self.stop_motors_button, qt.SIGNAL("clicked()"), self.stop_motors_button_clicked, ) self.stop_motors_button.setSizePolicy( qt.QSizePolicy.Fixed, qt.QSizePolicy.Minimum ) self.setSizePolicy(qt.QSizePolicy.Minimum, qt.QSizePolicy.Fixed) qt.QVBoxLayout(self) self.layout().addWidget(self.container_hbox)