示例#1
0
    def __init__(self, fig_params):
        super().__init__()
        self._layout = QtWidgets.QVBoxLayout(self)
        self._layout.setContentsMargins(0, 0, 0, 0)

        self.top_button_widget = QtWidgets.QWidget()
        self._top_button_widget_layout = QtWidgets.QHBoxLayout()
        self._top_button_widget_layout.setContentsMargins(0, 0, 0, 0)
        self.top_button_widget.setLayout(self._top_button_widget_layout)

        self._layout.addWidget(self.top_button_widget)

        self.fig = plotWindow(*fig_params)
        self._layout.addWidget(self.fig)
        self.cursor_fast = QLabel()
        self.cursor_fast.setFixedWidth(70)
        self.cursor = QLabel()
        self.cursor.setFixedWidth(70)
        self.cursor_widget = QWidget()
        self._cursor_widget_layout = QtWidgets.QHBoxLayout()
        self._cursor_widget_layout.setContentsMargins(0, 0, 0, 0)
        self._cursor_widget_layout.addSpacerItem(HorizontalSpacerItem())
        self._cursor_widget_layout.addWidget(self.cursor_fast)
        self._cursor_widget_layout.addWidget(self.cursor)
        self._cursor_widget_layout.addSpacerItem(HorizontalSpacerItem())
        self.cursor_widget.setLayout(self._cursor_widget_layout)
        self._layout.addWidget(self.cursor_widget)
        self.button_widget = QtWidgets.QWidget()
        self._button_widget_layout = QtWidgets.QHBoxLayout()
        self._button_widget_layout.setContentsMargins(0, 0, 0, 0)

        self.button_widget.setLayout(self._button_widget_layout)
        self._layout.addWidget(self.button_widget)
        self.setLayout(self._layout)
        self.create_connections()
示例#2
0
    def setupUi(self):
        self._layout = QtWidgets.QVBoxLayout()
        self.setWindowTitle(self.title)
        self.button_widget = QtWidgets.QWidget(self)
        self.button_widget.setObjectName('options_control_button_widget')
        self._button_layout = QtWidgets.QHBoxLayout()
        self._button_layout.setContentsMargins(0, 0, 0, 0)
        self._button_layout.setSpacing(15)
        self.apply_btn = FlatButton('Apply')
        self.apply_btn.clicked.connect(self.apply)
        self._button_layout.addWidget(self.apply_btn, 0)
        #self._button_layout.addWidget(VerticalLine())
        self._button_layout.addSpacerItem(HorizontalSpacerItem())
        #self._button_layout.addWidget(VerticalLine())
        self.button_widget.setLayout(self._button_layout)

        self.parameter_widget = QtWidgets.QWidget()
        self._parameter_layout = QtWidgets.QGridLayout()
        self._parameter_layout.addWidget(QtWidgets.QLabel('Color'), 0, 1)

        self.opt_controls = {}

        i = 1
        for opt in self.opts_fields:
            self._parameter_layout.addWidget(
                QtWidgets.QLabel(self.opts_fields[opt]['label']), i, 0)
            cb = FlatButton()
            cb.setObjectName(opt + "_control")
            color = self.opts_fields[opt]['val']
            set_btn_color(cb, color)
            self._parameter_layout.addWidget(cb)
            self.opt_controls[opt] = {'control': cb}
            cb.clicked.connect(partial(self.color_btn_clicked, cb))
            self._parameter_layout.addItem(HorizontalSpacerItem(), i, 4)
            i += 1

        self._parameter_layout.addItem(VerticalSpacerItem(), i, 0)
        self.parameter_widget.setLayout(self._parameter_layout)
        self._body_layout = QtWidgets.QHBoxLayout()
        self._body_layout.addWidget(self.parameter_widget, 0)
        self._layout.addLayout(self._body_layout)
        self._layout.addWidget(HorizontalLine())
        self._layout.addWidget(self.button_widget)
        self.setLayout(self._layout)

        self.style_widgets()
示例#3
0
 def initUI(self):
     self.setWindowTitle('SXDM')
     #self.main_widget = QtWidgets.QWidget()
     self.layout = QtWidgets.QVBoxLayout()
     self.make_img_plot()
     self.layout.addWidget(self.win)
     self.bottom_layout = QtWidgets.QHBoxLayout()
     self.btn1 = QtWidgets.QPushButton('btn 1')
     self.btn2 = QtWidgets.QPushButton('btn 2')
     self.btn3 = QtWidgets.QPushButton('btn 3')
     self.bottom_layout.addWidget(self.btn1)
     self.bottom_layout.addWidget(self.btn2)
     self.bottom_layout.addWidget(self.btn3)
     self.bottom_layout.addSpacerItem(HorizontalSpacerItem())
     self.layout.addLayout(self.bottom_layout)
     self.setLayout(self.layout)
示例#4
0
 def add_row_number_field(self, parent, option, text, value):
     button_widget = QtWidgets.QWidget(parent)
     button_widget.setObjectName(option)
     _button_layout = QtWidgets.QHBoxLayout()
     _button_layout.setContentsMargins(5, 5, 5, 5)
     #_button_layout.setSpacing(5)
     option_lbl = QtWidgets.QLabel(text)
     _button_layout.addSpacerItem(HorizontalSpacerItem())
     value_control = DoubleSpinBoxAlignRight()
     value_control.setMinimumWidth(120)
     value_control.setMaximum(10000)
     value_control.setDecimals(0)
     value_control.setValue(value)
     _button_layout.addWidget(option_lbl)
     _button_layout.addWidget(value_control)
     button_widget.setLayout(_button_layout)
     return [button_widget, value_control]
示例#5
0
    def __init__(self,file_use, filename ):
        super().__init__()

        
        self.show_cb = QtWidgets.QCheckBox()
        self.show_cb.setChecked(file_use)
        
        self.show_cb.setStyleSheet("background-color: transparent")
      
        self.file_label = QLabel(filename)
        self.file_label.setStyleSheet("background-color: transparent")

        self._layout = QtWidgets.QHBoxLayout()
        self._layout.setContentsMargins(1,1,1,1)
        self._layout.addWidget(self.show_cb)
        self._layout.addWidget(self.file_label)
        self._layout.addSpacerItem(HorizontalSpacerItem())
        self.setLayout(self._layout)
示例#6
0
    def __init__(self,color, text ):
        super().__init__()

        self.color_button = FlatButton()
        self.color_button.setStyleSheet("background-color: " + color)
        self.color_button.setMaximumHeight(18)
        self.color_button.setMinimumWidth(18)
        self.color_button.setMaximumWidth(18)
        
        self.tthItem = QtWidgets.QLabel(text)
        self.tthItem.setStyleSheet("background-color: transparent")
        self._layout = QtWidgets.QHBoxLayout()
        self._layout.setContentsMargins(1,1,1,1)
        self._layout.addWidget(self.color_button)
        self._layout.addWidget(self.tthItem)
        self._layout.addSpacerItem(HorizontalSpacerItem())
        self.setLayout(self._layout)

        self.setAcceptDrops(True) 
示例#7
0
 def add_row(self, parent, option, text, value):
     button_widget = QtWidgets.QWidget(parent)
     button_widget.setObjectName(option)
     _button_layout = QtWidgets.QHBoxLayout()
     _button_layout.setContentsMargins(5, 5, 5, 5)
     _button_layout.setSpacing(12)
     option_lbl = QtWidgets.QLabel(text)
     _button_layout.addSpacerItem(HorizontalSpacerItem())
     no_btn = QtWidgets.QRadioButton('No')
     yes_btn = QtWidgets.QRadioButton('Yes')
     if value == 0 or value == False:
         no_btn.setChecked(True)
     elif value == 1 or value == True:
         yes_btn.setChecked(True)
     _button_layout.addWidget(option_lbl)
     _button_layout.addWidget(no_btn)
     _button_layout.addWidget(yes_btn)
     button_widget.setLayout(_button_layout)
     return [button_widget, yes_btn]
示例#8
0
    def __init__(self):
        super().__init__()
        self._layout = QtWidgets.QVBoxLayout()
        self.setWindowTitle('Atoms control')
        self.button_widget = QtWidgets.QWidget(self)
        self.button_widget.setObjectName('atom_control_button_widget')
        self._button_layout = QtWidgets.QHBoxLayout()
        self._button_layout.setContentsMargins(0, 0, 0, 0)
        self._button_layout.setSpacing(15)

        self.add_btn = FlatButton('Add')
        self.delete_btn = FlatButton('Delete')
        self.clear_btn = FlatButton('Clear')

        self._button_layout.addWidget(self.add_btn)
        self._button_layout.addWidget(self.delete_btn)
        self._button_layout.addWidget(self.clear_btn)
        self._button_layout.addSpacerItem(HorizontalSpacerItem())
        '''
        self._button_layout.addWidget(VerticalLine())
        
        self._button_layout.addWidget(VerticalLine())
        self._button_layout.addWidget(self.save_btn)
        '''

        self.button_widget.setLayout(self._button_layout)
        self._layout.addWidget(self.button_widget)
        self._body_layout = QtWidgets.QHBoxLayout()
        self.atom_tw = ListTableWidget(columns=4)
        self._body_layout.addWidget(self.atom_tw, 10)
        self._layout.addLayout(self._body_layout)

        self.button_2_widget = QtWidgets.QWidget(self)
        self.button_2_widget.setObjectName('options_control_button_2_widget')
        self._button_2_layout = QtWidgets.QHBoxLayout()
        self._button_2_layout.setContentsMargins(0, 0, 0, 0)
        self._button_2_layout.setSpacing(6)
        self.apply_btn = FlatButton('Apply')

        self._button_2_layout.addWidget(self.apply_btn, 0)
        #self._button_2_layout.addWidget(VerticalLine())
        self._button_2_layout.addSpacerItem(HorizontalSpacerItem())
        #self._button_2_layout.addWidget(VerticalLine())
        self.button_2_widget.setLayout(self._button_2_layout)
        self._layout.addWidget(HorizontalLine())
        self._layout.addWidget(self.button_2_widget)

        self.setLayout(self._layout)

        self.style_widgets()

        self.name_items = []
        self.index_items = []
        self.fract_items = []
        self.show_parameter_in_pattern = True
        header_view = QtWidgets.QHeaderView(QtCore.Qt.Horizontal, self.atom_tw)
        self.atom_tw.setHorizontalHeader(header_view)
        header_view.setSectionResizeMode(
            0, QtWidgets.QHeaderView.ResizeToContents)

        header_view.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch)
        header_view.setSectionResizeMode(2, QtWidgets.QHeaderView.Stretch)
        header_view.setSectionResizeMode(3, QtWidgets.QHeaderView.Stretch)
        self.default_header = ['#', 'Atom', 'Note', 'Fraction', 'ind']
        self.header = copy.deepcopy(self.default_header)
        self.atom_tw.setHorizontalHeaderLabels(self.header)

        self.atom_tw.setItemDelegate(NoRectDelegate())

        self.ap = aEDXDAtomicParameters()
        self.sq_pars = []
        self.make_connections()
示例#9
0
    def setupUi(self):
        self._layout = QtWidgets.QVBoxLayout()
        #self._layout.setSpacing(5)
        self.setWindowTitle('EDXD Files Input Control')
        self.button_widget = QtWidgets.QWidget(self)
        self.button_widget.setObjectName('files_control_button_widget')
        self._button_layout = QtWidgets.QHBoxLayout()
        self._button_grid_layout = QtWidgets.QGridLayout()
        self._button_layout.setContentsMargins(0, 0, 0, 0)
        #self._button_layout.set
        self.add_tth_btn = FlatButton('+ '+f'2\N{GREEK SMALL LETTER THETA}')
        self._button_grid_layout.addWidget(self.add_tth_btn, 0,1)
        self.add_btn = FlatButton('+ EDXD')
        self._button_grid_layout.addWidget(self.add_btn,1,1)
        self.add_all_btn = FlatButton('+ All EDXD')
        self._button_grid_layout.addWidget(self.add_all_btn,1,0)
        self.add_scan = FlatButton(f'+ All 2\N{GREEK SMALL LETTER THETA}')
        self._button_grid_layout.addWidget(self.add_scan,0,0)
        self.del_btn = FlatButton('Delete')
        self._button_grid_layout.addWidget(self.del_btn,0,2)
        self.clear_btn = FlatButton('Clear')
        self._button_grid_layout.addWidget(self.clear_btn,0,3)
        self.expand_btn = FlatButton('Expand')
        self._button_grid_layout.addWidget(self.expand_btn,1,2)
        self.collapse_btn = FlatButton('Collapse')
        self._button_grid_layout.addWidget(self.collapse_btn,1,3)
        self._button_layout.addLayout(self._button_grid_layout)
        self._button_layout.addSpacerItem(HorizontalSpacerItem())
        #self.from_config_btn = QtWidgets.QPushButton('From config.')
        #self._button_layout.addWidget(self.from_config_btn,0)
        #self._button_layout.addWidget(VerticalLine())
        #self._button_layout.addSpacerItem(HorizontalSpacerItem())
        #self._button_layout.addWidget(VerticalLine())
        self.button_widget.setLayout(self._button_layout)
        self._body_layout = QtWidgets.QHBoxLayout()
        '''self.file_tw = ListTableWidget(columns=4)
        header_view = QtWidgets.QHeaderView(QtCore.Qt.Horizontal, self.file_tw)
        self.file_tw.setHorizontalHeader(header_view)
        header_view.setResizeMode(0, QtWidgets.QHeaderView.ResizeToContents)
        header_view.setResizeMode(1, QtWidgets.QHeaderView.ResizeToContents)
        header_view.setResizeMode(2, QtWidgets.QHeaderView.Stretch)
        header_view.setResizeMode(3, QtWidgets.QHeaderView.ResizeToContents)'''
        self.file_trw = treeWidget()
        
        #self.file_trw.setHeaderLabels([' ' + f'  2\N{GREEK SMALL LETTER THETA}'])
        self.file_trw.setHeaderHidden(True)
        #self.file_trw.setAlternatingRowColors(True)
        #self.file_trw.setItemDelegate(NoRectDelegate())
        
        header = self.file_trw.header()
        header.setResizeMode(QtWidgets.QHeaderView.Fixed)
        self._body_layout.addWidget(self.file_trw )
        
        self._layout.addWidget(self.button_widget)
        self._layout.addLayout(self._body_layout)

        
        self.button_2_widget = QtWidgets.QWidget(self)
        self.button_2_widget.setObjectName('files_control_button_2_widget')
        self._button_2_layout = QtWidgets.QHBoxLayout()
        self._button_2_layout.setContentsMargins(0, 0, 0, 0)
        self._button_2_layout.setSpacing(6)
        self.apply_btn = FlatButton('Apply')
        self._button_2_layout.addWidget(self.apply_btn,0)
        #self._button_2_layout.addWidget(VerticalLine())
        self._button_2_layout.addSpacerItem(HorizontalSpacerItem())
        #self._button_2_layout.addWidget(VerticalLine())
        self.button_2_widget.setLayout(self._button_2_layout)
        self._layout.addWidget(HorizontalLine())
        self._layout.addWidget(self.button_2_widget)
        

        

        self.setLayout(self._layout)
        self.retranslateUi(self)
        self.style_widgets()

        self.del_btn.clicked.connect(self.delete_clicked)
示例#10
0
    def __init__(self):
        super(PhaseWidget, self).__init__()

        self._layout = QtWidgets.QVBoxLayout()
        self.setWindowTitle('Phase control')
        self.button_widget = QtWidgets.QWidget(self)
        self.button_widget.setObjectName('phase_control_button_widget')
        self._button_layout = QtWidgets.QHBoxLayout()
        self._button_layout.setContentsMargins(0, 0, 0, 0)
        self._button_layout.setSpacing(6)

        self.add_btn = QtWidgets.QPushButton('Add')
        self.edit_btn = QtWidgets.QPushButton('Edit')
        self.delete_btn = QtWidgets.QPushButton('Delete')
        self.clear_btn = QtWidgets.QPushButton('Clear')
        self.rois_btn = QtWidgets.QPushButton('Add ROIs')
        self.save_list_btn = QtWidgets.QPushButton('Save List')
        self.load_list_btn = QtWidgets.QPushButton('Load List')

        self._button_layout.addWidget(self.add_btn, 0)
        self._button_layout.addWidget(self.edit_btn, 0)
        self._button_layout.addWidget(self.delete_btn, 0)
        self._button_layout.addWidget(self.clear_btn, 0)
        self._button_layout.addWidget(self.rois_btn, 0)
        self._button_layout.addWidget(VerticalLine())
        self._button_layout.addSpacerItem(HorizontalSpacerItem())
        self._button_layout.addWidget(VerticalLine())
        self._button_layout.addWidget(self.save_list_btn, 0)
        self._button_layout.addWidget(self.load_list_btn, 0)
        self.button_widget.setLayout(self._button_layout)
        self._layout.addWidget(self.button_widget)

        self.parameter_widget = QtWidgets.QWidget()

        self._parameter_layout = QtWidgets.QGridLayout()
        self.pressure_sb = DoubleSpinBoxAlignRight()
        self.temperature_sb = DoubleSpinBoxAlignRight()
        self.pressure_step_msb = DoubleMultiplySpinBoxAlignRight()
        self.temperature_step_msb = DoubleMultiplySpinBoxAlignRight()
        self.apply_to_all_cb = QtWidgets.QCheckBox('Apply to all phases')
        self.show_in_pattern_cb = QtWidgets.QCheckBox('Show in Pattern')
        self.tth_lbl = DoubleSpinBoxAlignRight()

        self.tth_step = DoubleMultiplySpinBoxAlignRight()

        self.get_tth_btn = QtWidgets.QPushButton('Get')

        self._parameter_layout.addWidget(QtWidgets.QLabel('Parameter'), 0, 1)
        self._parameter_layout.addWidget(QtWidgets.QLabel('Step'), 0, 3)
        self._parameter_layout.addWidget(QtWidgets.QLabel('P:'), 1, 0)
        self._parameter_layout.addWidget(QtWidgets.QLabel('T:'), 2, 0)
        self._parameter_layout.addWidget(QtWidgets.QLabel('GPa'), 1, 2)
        self._parameter_layout.addWidget(QtWidgets.QLabel('K'), 2, 2)

        self._parameter_layout.addWidget(self.pressure_sb, 1, 1)
        self._parameter_layout.addWidget(self.pressure_step_msb, 1, 3)
        self._parameter_layout.addWidget(self.temperature_sb, 2, 1)
        self._parameter_layout.addWidget(self.temperature_step_msb, 2, 3)

        self._parameter_layout.addWidget(self.apply_to_all_cb, 3, 0, 1, 5)
        #self._parameter_layout.addWidget(self.show_in_pattern_cb, 4, 0, 1, 5)
        self._parameter_layout.addWidget(HorizontalLine(), 5, 0, 1, 5)
        self._parameter_layout.addItem(VerticalSpacerItem(), 6, 0)
        self._parameter_layout.addWidget(HorizontalLine(), 7, 0, 1, 5)
        self._parameter_layout.addWidget(QtWidgets.QLabel(u'2θ:'), 8, 0)
        self._parameter_layout.addWidget(self.tth_lbl, 8, 1)
        self._parameter_layout.addWidget(QtWidgets.QLabel('deg'), 8, 2)
        self._parameter_layout.addWidget(self.tth_step, 8, 3)
        self._parameter_layout.addWidget(self.get_tth_btn, 8, 4)

        self.parameter_widget.setLayout(self._parameter_layout)

        self._body_layout = QtWidgets.QHBoxLayout()
        self.phase_tw = ListTableWidget(columns=5)
        self._body_layout.addWidget(self.phase_tw)
        self._body_layout.addWidget(self.parameter_widget, 0)

        self._layout.addLayout(self._body_layout)

        self.setLayout(self._layout)

        self.style_widgets()

        self.phase_show_cbs = []
        self.phase_color_btns = []
        #self.phase_roi_btns = [] #add ROIs (RH)
        self.show_parameter_in_pattern = True
        header_view = QtWidgets.QHeaderView(QtCore.Qt.Horizontal,
                                            self.phase_tw)
        self.phase_tw.setHorizontalHeader(header_view)

        #header_view.setResizeMode(1, QtWidgets.QHeaderView.ResizeToContents)
        header_view.setResizeMode(2, QtWidgets.QHeaderView.Stretch)
        header_view.setResizeMode(3, QtWidgets.QHeaderView.ResizeToContents)
        header_view.setResizeMode(4, QtWidgets.QHeaderView.ResizeToContents)
        header_view.hide()
        self.phase_tw.setItemDelegate(NoRectDelegate())

        self.pressure_sb.valueChanged.connect(self.pressure_sb_changed)
        self.temperature_sb.valueChanged.connect(self.temperature_sb_changed)

        self.setAcceptDrops(True)
示例#11
0
    def __init__(self, parent=None):
        super(JcpdsEditorWidget, self).__init__(parent)

        self.setWindowTitle('JCPDS Editor')

        self._layout = QtWidgets.QVBoxLayout()

        self._file_layout = QtWidgets.QGridLayout()
        self._file_layout.addWidget(LabelAlignRight('Filename:'), 0, 0)
        self._file_layout.addWidget(LabelAlignRight('Comment:'), 1, 0)

        self.filename_txt = QtWidgets.QLineEdit('')
        self.comments_txt = QtWidgets.QLineEdit('')
        self._file_layout.addWidget(self.filename_txt, 0, 1)
        self._file_layout.addWidget(self.comments_txt, 1, 1)
        self._layout.addLayout((self._file_layout))

        self.lattice_parameters_gb = QtWidgets.QGroupBox('Lattice Parameters')
        self._lattice_parameters_layout = QtWidgets.QVBoxLayout()

        self._symmetry_layout = QtWidgets.QHBoxLayout()
        self._symmetry_layout.addWidget(LabelAlignRight('Symmetry'))
        self.symmetry_cb = CleanLooksComboBox()
        self.symmetries = [
            'cubic', 'tetragonal', 'hexagonal', 'trigonal', 'rhombohedral',
            'orthorhombic', 'monoclinic', 'triclinic'
        ]
        self.symmetry_cb.addItems(self.symmetries)
        self._symmetry_layout.addWidget(self.symmetry_cb)
        self._symmetry_layout.addSpacerItem(HorizontalSpacerItem())
        self._lattice_parameters_layout.addLayout(self._symmetry_layout)

        self._parameters_layout = QtWidgets.QGridLayout()

        self.lattice_a_sb = DoubleSpinBoxAlignRight()
        self.lattice_a_sb.setSingleStep(0.01)
        self.lattice_a_sb.setMinimum(0)
        self.lattice_a_sb.setMaximum(99999)
        self.lattice_a_sb.setDecimals(4)
        self.lattice_b_sb = DoubleSpinBoxAlignRight()
        self.lattice_b_sb.setMinimum(0)
        self.lattice_b_sb.setMaximum(99999)
        self.lattice_b_sb.setDecimals(4)
        self.lattice_b_sb.setSingleStep(0.01)
        self.lattice_c_sb = DoubleSpinBoxAlignRight()
        self.lattice_c_sb.setMinimum(0)
        self.lattice_c_sb.setMaximum(99999)
        self.lattice_c_sb.setDecimals(4)
        self.lattice_c_sb.setSingleStep(0.01)
        self.lattice_length_step_txt = NumberTextField('0.01')

        self.add_field(self._parameters_layout, self.lattice_a_sb,
                       'a<sub>0</sub>:', u"Å", 0, 0)
        self.add_field(self._parameters_layout, self.lattice_b_sb,
                       'b<sub>0</sub>:', u"Å", 0, 3)
        self.add_field(self._parameters_layout, self.lattice_c_sb,
                       'c<sub>0</sub>:', u"Å", 0, 6)
        self.add_field(self._parameters_layout, self.lattice_length_step_txt,
                       'st:', u"Å", 0, 9)

        self.lattice_eos_a_txt = NumberTextField()
        self.lattice_eos_b_txt = NumberTextField()
        self.lattice_eos_c_txt = NumberTextField()

        self.add_field(self._parameters_layout, self.lattice_eos_a_txt, 'a:',
                       u"Å", 1, 0)
        self.add_field(self._parameters_layout, self.lattice_eos_b_txt, 'b:',
                       u"Å", 1, 3)
        self.add_field(self._parameters_layout, self.lattice_eos_c_txt, 'c:',
                       u"Å", 1, 6)

        self.lattice_alpha_sb = DoubleSpinBoxAlignRight()
        self.lattice_alpha_sb.setMaximum(180)
        self.lattice_beta_sb = DoubleSpinBoxAlignRight()
        self.lattice_beta_sb.setMaximum(180)
        self.lattice_gamma_sb = DoubleSpinBoxAlignRight()
        self.lattice_gamma_sb.setMaximum(180)
        self.lattice_angle_step_txt = NumberTextField('1')

        self.add_field(self._parameters_layout, self.lattice_alpha_sb, u'α:',
                       u"°", 2, 0)
        self.add_field(self._parameters_layout, self.lattice_beta_sb, u'β:',
                       u"°", 2, 3)
        self.add_field(self._parameters_layout, self.lattice_gamma_sb, u'γ:',
                       u"°", 2, 6)
        self.add_field(self._parameters_layout, self.lattice_angle_step_txt,
                       u'st:', u"°", 2, 9)

        self.lattice_ab_sb = DoubleSpinBoxAlignRight()
        self.lattice_ab_sb.setDecimals(4)
        self.lattice_ca_sb = DoubleSpinBoxAlignRight()
        self.lattice_ca_sb.setDecimals(4)
        self.lattice_cb_sb = DoubleSpinBoxAlignRight()
        self.lattice_cb_sb.setDecimals(4)
        self.lattice_ratio_step_txt = NumberTextField('0.01')

        self.add_field(self._parameters_layout, self.lattice_ab_sb, 'a/b:',
                       None, 3, 0)
        self.add_field(self._parameters_layout, self.lattice_ca_sb, 'c/a:',
                       None, 3, 3)
        self.add_field(self._parameters_layout, self.lattice_cb_sb, 'c/b:',
                       None, 3, 6)
        self.add_field(self._parameters_layout, self.lattice_ratio_step_txt,
                       'st:', None, 3, 9)

        self.lattice_volume_txt = NumberTextField()
        self.lattice_eos_volume_txt = NumberTextField()
        self.lattice_eos_molar_volume_txt = NumberTextField()
        self.lattice_eos_z_txt = NumberTextField()

        self.add_field(self._parameters_layout, self.lattice_volume_txt,
                       'V<sub>0</sub>:', u'ų', 4, 0)
        self.add_field(self._parameters_layout, self.lattice_eos_volume_txt,
                       'V:', u'ų', 4, 3)

        self.add_field(self._parameters_layout,
                       self.lattice_eos_molar_volume_txt, 'V<sub>m</sub>:',
                       u'm³/mol', 5, 3)
        self.add_field(self._parameters_layout, self.lattice_eos_z_txt, 'Z:',
                       u'', 5, 0)

        self._lattice_parameters_layout.addLayout(self._parameters_layout)
        self.lattice_parameters_gb.setLayout(self._lattice_parameters_layout)

        self.eos_widget = EosGroupbox()

        self.reflections_gb = QtWidgets.QGroupBox('Reflections')
        self._reflection_layout = QtWidgets.QGridLayout()
        self.reflection_table_view = QtWidgets.QTableView()
        self.reflection_table_model = ReflectionTableModel()
        self.reflection_table_view.setModel(self.reflection_table_model)
        #self.reflection_table.setColumnCount(8)
        self.reflections_add_btn = FlatButton('Add')
        self.reflections_delete_btn = FlatButton('Delete')
        self.reflections_clear_btn = FlatButton('Clear')

        self._reflection_layout.addWidget(self.reflection_table_view, 0, 0, 1,
                                          3)
        self._reflection_layout.addWidget(self.reflections_add_btn, 1, 0)
        self._reflection_layout.addWidget(self.reflections_delete_btn, 1, 1)
        self._reflection_layout.addWidget(self.reflections_clear_btn, 1, 2)

        self.reflections_gb.setLayout(self._reflection_layout)

        self._body_layout = QtWidgets.QGridLayout()
        self._body_layout.addWidget(self.eos_widget, 0, 0)
        self._body_layout.addItem(VerticalSpacerItem(), 1, 0)
        self._body_layout.addWidget(self.reflections_gb, 0, 1, 2, 1)

        self._button_layout = QtWidgets.QHBoxLayout()
        self.save_as_btn = FlatButton('Save As')
        self.reload_file_btn = FlatButton('Reload File')

        self._button_layout.addWidget(self.save_as_btn)
        self._button_layout.addWidget(self.reload_file_btn)
        self._button_layout.addSpacerItem(HorizontalSpacerItem())

        self._layout.addWidget(self.lattice_parameters_gb)
        self._layout.addLayout(self._body_layout)
        self._layout.addLayout(self._button_layout)
        self.setLayout(self._layout)

        self.style_widgets()
示例#12
0
 def add_top_button_widget_spacer(self):
     self._top_button_widget_layout.addSpacerItem(HorizontalSpacerItem())
示例#13
0
    def __init__(self, plotWidget, plotContoller, roiController, mca):
        super().__init__()

        self.set_mca(mca) # in future change to get cal. from  plot model
        
        self.x_scale = 'E'
        
        
        self.pattern_widget = plotWidget
        self.roi_controller = roiController
        self.plotController = plotContoller
        self.log_scale = self.plotController.logMode
        self._layout = QtWidgets.QVBoxLayout()  
        self.setWindowTitle('XRF control')
        self.button_widget = QtWidgets.QWidget(self)
        self.button_widget.setObjectName('xrfs_control_button_widget')
        self._button_layout = QtWidgets.QHBoxLayout()
        self._button_layout.setContentsMargins(0, 0, 0, 0)
        self._button_layout.setSpacing(6)
        self.add_btn = QtWidgets.QPushButton('Add ROIs')
        self.add_btn.clicked.connect(self.rois_btn_click_callback)

        self.clear_btn = QtWidgets.QPushButton('Clear')
        self.clear_btn.clicked.connect(self.clear_xrf)
        self._button_layout.addWidget(QtWidgets.QLabel('Search:'),0)
        self.search_item = s =  QtWidgets.QLineEdit('')
        s.textChanged.connect(lambda:self.search_by_symbol(s.text()))
        self._button_layout.addWidget(self.search_item, 0)
        self._button_layout.addSpacerItem(HorizontalSpacerItem())
        self._button_layout.addWidget(self.add_btn,0)
        self._button_layout.addWidget(self.clear_btn,0)
        self.button_widget.setLayout(self._button_layout)
        self._layout.addWidget(self.button_widget)
        self._body_layout = QtWidgets.QHBoxLayout()
        self.header = ['Z', 'Symbol']
        self.cols = len(self.header)
        self.xrf_tw = ListTableWidget(columns=self.cols)
        self._body_layout.addWidget(self.xrf_tw)

        self.k_lines_tags = ['Ka','Ka1', 'Ka2','Kb', 'Kb1', 'Kb2']
        self.l_lines_tags = ['La1', 'Lb1', 'Lb2', 'Lg1', 'Lg2', 'Lg3', 'Lg4', 'Ll']
        self.g_lines_tags = ['G1','G2', 'G3']

        self.parameter_widget = QtWidgets.QWidget()
        self._parameter_layout = QtWidgets.QGridLayout()

        self.k_cbs = dict()
        for k in self.k_lines_tags:
            k_line = QtWidgets.QCheckBox(k)
            k_line.setEnabled(False)
            k_line.toggled.connect(partial(self.cbs_changed, k_line))
            self._parameter_layout.addWidget(k_line, 0, self.k_lines_tags.index(k)+2)
            self.k_cbs[k]=k_line
        
        self.l_cbs = dict()
        for l in self.l_lines_tags:
            l_line = QtWidgets.QCheckBox(l)
            l_line.setEnabled(False)
            l_line.toggled.connect(partial(self.cbs_changed, l_line))
            self._parameter_layout.addWidget(l_line,1, self.l_lines_tags.index(l)+2)
            self.l_cbs[l]=l_line

        self.g_cbs = dict()
        for g in self.g_lines_tags:
            g_line = QtWidgets.QCheckBox(g)
            g_line.setEnabled(False)
            g_line.toggled.connect(partial(self.cbs_changed, g_line))
            self._parameter_layout.addWidget(g_line,2, self.g_lines_tags.index(g)+2)
            self.g_cbs[g]=g_line
        
        self.parameter_widget.setLayout(self._parameter_layout)
        self._body_layout.addWidget(self.parameter_widget, 0)
        self._layout.addLayout(self._body_layout)
        self.setLayout(self._layout)
        self.style_widgets()
        self.xrf_show_cbs = []
        self.name_items = []
        self.index_items = []
        self.kl_cbs = dict()
        self.kl_cbs.update(self.k_cbs) 
        self.kl_cbs.update(self.l_cbs)
        self.kl_cbs.update(self.g_cbs)
        self.xrf = []

        self.atoms = dict()

        #self.show_parameter_in_pattern = True
        header_view = QtWidgets.QHeaderView(QtCore.Qt.Horizontal, self.xrf_tw)
        self.xrf_tw.setHorizontalHeader(header_view)

        header_view.setResizeMode(0, QtWidgets.QHeaderView.Stretch)
        header_view.setResizeMode(1, QtWidgets.QHeaderView.Stretch)  
        
        self.xrf_tw.setHorizontalHeaderLabels(self.header)
        #header_view.hide()
        self.xrf_tw.setItemDelegate(NoRectDelegate())
        #self.xrf_tw.itemChanged.connect(self.xrf_name_item_changed)

        for atom in Xrf.atomic_symbols:
            self.add_xrf_row(Xrf.atomic_number(atom),atom)
        #self.xrf_tw.selectRow(Xrf.atomic_symbols.index(None))

        color = self.add_xrf_plot()
        self.xrf_tw.currentCellChanged.connect(self.selection_changed)
        #self.xrf_tw.setColumnWidth(0, 35)

        self.plotController.unitUpdated.connect(self.update_x_scale)
        self.plotController.dataPlotUpdated.connect(self.update_all_xrf_lines)
示例#14
0
    def __init__(self):
        super().__init__()
        self._layout = QtWidgets.QVBoxLayout()  
        self.setWindowTitle('Cut regions control')
        self.button_widget = QtWidgets.QWidget(self)
        self.button_widget.setObjectName('rois_control_button_widget')
        self._button_layout = QtWidgets.QHBoxLayout()
        self._button_layout.setContentsMargins(0, 0, 0, 0)
        self._button_layout.setSpacing(15)
        #self.add_btn = FlatButton('Add')
        #self.edit_btn = FlatButton('Edit')
        self.delete_btn = FlatButton('Delete')
        self.clear_btn = FlatButton('Clear')
        #self.show_fit_btn = FlatButton('Show')
        self.edit_btn = FlatButton('Edit')
        self.filter_btn = FlatButton(f'Filter 2\N{GREEK SMALL LETTER THETA}')
        self.filter_btn.setCheckable(True)
        self.filter_btn.setChecked(True)

        
        self._button_layout.addWidget(self.edit_btn)
        self._button_layout.addWidget(self.delete_btn)
        self._button_layout.addWidget(self.clear_btn)
        self._button_layout.addWidget(self.filter_btn)
        self._button_layout.addSpacerItem(HorizontalSpacerItem())

        self.button_widget.setLayout(self._button_layout)
        self._layout.addWidget(self.button_widget)
        self._body_layout = QtWidgets.QHBoxLayout()
        self.roi_tw = ListTableWidget(columns=3)
        self._body_layout.addWidget(self.roi_tw, 10)


####  Start peak parameters widget

        self.baseline_params = QtWidgets.QWidget()
        self.baseline_params_layout = QtWidgets.QGridLayout()

        self.baseline_params_V_layout = QtWidgets.QVBoxLayout()

        self.cut_peak_Wn = DoubleSpinBoxAlignRight()
        self.cut_peak_Wn.setMinimumWidth(90)
        self.cut_peak_Wn.setMinimum(0.001)
        self.cut_peak_Wn.setMaximum(1)
        self.cut_peak_Wn.setValue(0.2)
        self.cut_peak_Wn.setDecimals(3)
        #self.cut_peak_Wn.setSingleStep(0.1)

        
        self.cut_peak_iter = DoubleSpinBoxAlignRight()
        self.cut_peak_iter.setMinimumWidth(90)
        self.cut_peak_iter.setMinimum(1)
        self.cut_peak_iter.setMaximum(50)
        self.cut_peak_iter.setValue(50)
        self.cut_peak_iter.setDecimals(0)
        #self.cut_peak_iter.setSingleStep(5)

        self.cut_peak_Wn_step = DoubleMultiplySpinBoxAlignRight()
        self.cut_peak_Wn_step.setDecimals(3)
        self.cut_peak_Wn_step.setMinimumWidth(70)
        self.cut_peak_iter_step = DoubleMultiplySpinBoxAlignRight()
        self.cut_peak_iter_step.setDecimals(0)
        self.cut_peak_iter_step.setMinimumWidth(70)

        self.cut_peak_Wn_step.valueChanged.connect(partial(self.update_step, \
                                                    self.cut_peak_Wn,self.cut_peak_Wn_step))

        self.cut_peak_iter_step.valueChanged.connect(partial(self.update_step, \
                                                    self.cut_peak_iter,self.cut_peak_iter_step))

        self.cut_peak_Wn_step.setValue(0.1)
        self.cut_peak_iter_step.setValue(5)

        self.cut_peak_method_spline_choice = QtWidgets.QRadioButton(text="Spline")
        self.cut_peak_method_baseline_choice = QtWidgets.QRadioButton(text="Baseline")
        self.cut_peak_method_baseline_choice.setChecked(True)
        

        self.cut_peak_label = QtWidgets.QLabel("Peak cutting parameters")
        self.cut_peak_Wn_label = QtWidgets.QLabel("W<sub>n</sub>")
        self.cut_peak_iter_label = QtWidgets.QLabel("Iterations")
        self.cut_peak_method_label = QtWidgets.QLabel("Method")

        
        self.baseline_params_layout.addWidget(self.cut_peak_label,0,0,1,2)
        self.baseline_params_layout.addWidget(self.cut_peak_method_label,1,0)
        self.baseline_params_layout.addWidget(self.cut_peak_method_baseline_choice,1,1)
        self.baseline_params_layout.addWidget(self.cut_peak_method_spline_choice,1,2)

        self.baseline_params_layout.addWidget(self.cut_peak_Wn_label,2,0)
        self.baseline_params_layout.addWidget(self.cut_peak_iter_label,3,0)
        self.baseline_params_layout.addWidget(self.cut_peak_Wn,2,1)
        self.baseline_params_layout.addWidget(self.cut_peak_iter,3,1)
        self.baseline_params_layout.addWidget(self.cut_peak_Wn_step,2,2)
        self.baseline_params_layout.addWidget(self.cut_peak_iter_step,3,2)

        self.baseline_params_apply_all = QtWidgets.QCheckBox('Apply to all')
        self.baseline_params_apply_all.setChecked(False)
        #self.baseline_params_layout.addWidget(self.baseline_params_apply_all,3,0,1,2)
        

        self.baseline_params.setLayout(self.baseline_params_layout)
        self.baseline_params_V_layout.addWidget(self.baseline_params)
        self.baseline_params_V_layout.addSpacerItem(VerticalSpacerItem())

        # End peak parameters widget

        self._body_layout.addLayout(self.baseline_params_V_layout)



        self._layout.addLayout(self._body_layout)

        
        self.button_2_widget = QtWidgets.QWidget(self)
        self.button_2_widget.setObjectName('rois_control_button_2_widget')
        self._button_2_layout = QtWidgets.QHBoxLayout()
        self._button_2_layout.setContentsMargins(0, 0, 0, 0)
        self._button_2_layout.setSpacing(6)
        self.apply_btn = FlatButton('Apply')
        self._button_2_layout.addWidget(self.apply_btn,0)
        #self._button_2_layout.addWidget(VerticalLine())
        self._button_2_layout.addSpacerItem(HorizontalSpacerItem())
        #self._button_2_layout.addWidget(VerticalLine())
        self.button_2_widget.setLayout(self._button_2_layout)
        self._layout.addWidget(HorizontalLine())
        self._layout.addWidget(self.button_2_widget)
        

        


        self.setLayout(self._layout)

        self.style_widgets()
        self.roi_show_cbs = []
        self.name_items = []
        self.tth_items = []
       
        self.show_parameter_in_pattern = True
        header_view = QtWidgets.QHeaderView(QtCore.Qt.Horizontal, self.roi_tw)
        self.roi_tw.setHorizontalHeader(header_view)
        header_view.setResizeMode(0, QtWidgets.QHeaderView.ResizeToContents)
        header_view.setResizeMode(1, QtWidgets.QHeaderView.Stretch)
        
        self.default_header = [' Cut ', 'E range', f'2\N{GREEK SMALL LETTER THETA}']
        self.header = copy.deepcopy(self.default_header)
        self.roi_tw.setHorizontalHeaderLabels(self.header)
        #header_view.hide()
        self.roi_tw.setItemDelegate(NoRectDelegate())
        self.create_connections()
示例#15
0
 def setupUi(self):
     
     self._layout = QtWidgets.QVBoxLayout()
     self.setWindowTitle(self.title)
     self.button_widget = QtWidgets.QWidget(self)
     self.button_widget.setObjectName('options_control_button_widget')
     self._button_layout = QtWidgets.QHBoxLayout()
     self._button_layout.setContentsMargins(0, 0, 0, 0)
     self._button_layout.setSpacing(15)
     self.apply_btn = FlatButton('Apply')
     self.apply_btn.clicked.connect(self.apply)
     self._button_layout.addWidget(self.apply_btn,0)
     #self._button_layout.addWidget(VerticalLine())
     self._button_layout.addSpacerItem(HorizontalSpacerItem())
     #self._button_layout.addWidget(VerticalLine())
     self.button_widget.setLayout(self._button_layout)
     
     self.parameter_widget = QtWidgets.QWidget()
     self._parameter_layout = QtWidgets.QGridLayout()
     self._parameter_layout.addWidget(QtWidgets.QLabel('Parameter'), 0, 1)
     self._parameter_layout.addWidget(QtWidgets.QLabel('Step'), 0, 3)
     self.opt_controls = {}
     
     i = 1
     for opt in self.opts_fields:
         self._parameter_layout.addWidget(QtWidgets.QLabel(self.opts_fields[opt]['label']), i, 0)
         self._parameter_layout.addWidget(QtWidgets.QLabel(self.opts_fields[opt]['unit']), i, 2)
         val=self.opts_fields[opt]['val']
         e = is_e(val)
         if e:
             o = NumberTextField()
         else:
             o = DoubleSpinBoxAlignRight()
         o.setObjectName(opt+"_control")
         o.setValue(val)
         o.setToolTip(self.opts_fields[opt]['desc'])
         o.setMinimum (self.opts_fields[opt]['step']) 
         o.setMinimumWidth(100)
         if not e:
             o.setSingleStep (self.opts_fields[opt]['step'])
             o_step = DoubleMultiplySpinBoxAlignRight()
             o_step.setObjectName(opt+"_control_step")
             o_step.setMinimum (0)
             step = self.opts_fields[opt]['step']
             o_step.setValue(self.opts_fields[opt]['step']) 
         if isinstance( self.opts_fields[opt]['val'], int):
             o.setDecimals(0)
             o.setMinimum(1)
             if not e:
                 o_step.setMinimum(1)
                 o_step.setDecimals(0)
         o_step.valueChanged.connect(partial(self.update_step, opt))
         self.opt_controls[opt]= {'val':o,'step':o_step}
         self._parameter_layout.addWidget(o, i, 1)
         self._parameter_layout.addWidget(o_step, i, 3)
         self._parameter_layout.addItem(HorizontalSpacerItem(), i, 4)
         i += 1
     self._parameter_layout.addItem(VerticalSpacerItem(), i, 0)
     self.parameter_widget.setLayout(self._parameter_layout)
     self._body_layout = QtWidgets.QHBoxLayout()
     self._body_layout.addWidget(self.parameter_widget, 0)
     self._layout.addLayout(self._body_layout)
     self._layout.addWidget(HorizontalLine())
     self._layout.addWidget(self.button_widget)
     self.setLayout(self._layout)
     self.retranslateUi(self)
     self.style_widgets()
示例#16
0
    def __init__(self, model):
        super(hklGenWidget, self).__init__()
        self.model = model
        self._layout = QtWidgets.QVBoxLayout()  
        self.setWindowTitle('Space Group control')
        self.button_widget = QtWidgets.QWidget(self)
        self.button_widget.setObjectName('cell_control_button_widget')
        self._button_layout = QtWidgets.QHBoxLayout()
        self._button_layout.setContentsMargins(0, 0, 0, 0)
        self._button_layout.setSpacing(6)

        self.add_btn = QtWidgets.QPushButton('New')
        self.edit_btn = QtWidgets.QPushButton('Edit')
        self.delete_btn = QtWidgets.QPushButton('Delete')
        self.clear_btn = QtWidgets.QPushButton('Clear')
        self.rois_btn = QtWidgets.QPushButton('Add ROIs')
        self.save_list_btn = QtWidgets.QPushButton('Save List')
        self.load_list_btn = QtWidgets.QPushButton('Load List')

        # 2th
        self.tth_lbl = DoubleSpinBoxAlignRight()
        self.tth_step = DoubleMultiplySpinBoxAlignRight()
        self.get_tth_btn = QtWidgets.QPushButton('Get')

        self._button_layout.addWidget(self.add_btn,0)
        #self._button_layout.addWidget(self.edit_btn,0)
        self._button_layout.addWidget(self.delete_btn,0)
        self._button_layout.addWidget(self.clear_btn,0)
        self._button_layout.addWidget(self.rois_btn,0)
        #self._button_layout.addWidget(VerticalLine())
        self._button_layout.addSpacerItem(HorizontalSpacerItem())
        #self._button_layout.addWidget(VerticalLine())
        #self._button_layout.addWidget(self.save_list_btn,0)
        #self._button_layout.addWidget(self.load_list_btn,0)
        self.button_widget.setLayout(self._button_layout)
        self._layout.addWidget(self.button_widget)


        self.symmetry_widget = QtWidgets.QWidget()
        self._symmetry_layout = QtWidgets.QVBoxLayout()
        self._symmetry_layout.setContentsMargins(0, 0, 0, 0)
        self.symmetry_opts = {}
        self.symmetry_parameters = ('CUBIC',
                                'TETRAGONAL',
                                'ORTHORHOMBIC',
                                'HEXAGONAL',
                                "TRIGONAL",
                                'RHOMBOHEDRAL',
                                'MONOCLINIC',
                                'TRICLINIC')
        for s in self.symmetry_parameters:
            o = s[0]+s[1:].lower()
            opt = QtWidgets.QRadioButton(o)
            opt.clicked.connect(partial(self.symmetry_edited_callback,o))
            self.symmetry_opts[s] = opt
            self._symmetry_layout.addWidget(opt)
        self.symmetry_widget.setLayout(self._symmetry_layout)

        self.lattice_widget = QtWidgets.QWidget()
        self._lattice_layout = QtWidgets.QVBoxLayout()
        self.spgrp_widget = QtWidgets.QWidget()
        self._spgrp_layout = QtWidgets.QHBoxLayout()
        self._spgrp_layout.setContentsMargins(0, 0, 0, 0)
        self.spgrp_lbl = QtWidgets.QLabel('Space Group:')
        self.spgrp_tb = QtWidgets.QLineEdit('P 2 3')
        self.spgrp_tb.setMaximumWidth(80)
        self.spgrp_tb.setMinimumWidth(80)
        self._spgrp_layout.addWidget(self.spgrp_lbl)
        self._spgrp_layout.addWidget(self.spgrp_tb)
        self._spgrp_layout.addSpacerItem(HorizontalSpacerItem())
        self.spgrp_widget.setLayout(self._spgrp_layout)
        self._lattice_layout.addWidget(self.spgrp_widget)
        self.lattice_opts = {}
        self.lattice_opts_steps = {}
        self.lattice_parameters = ('a','b','c',
                                'alpha',"beta",'gamma')
        default_step = 0.1
        default_decimals = 4
        for s in self.lattice_parameters:
            lattice_opt = QtWidgets.QWidget()
            _lattice_opt_layout = QtWidgets.QHBoxLayout()
            _lattice_opt_layout.setContentsMargins(0, 0, 0, 0)
            opt_lbl = QtWidgets.QLabel(s)
            opt = DoubleSpinBoxAlignRight()
            opt.setDecimals(default_decimals)
            opt.setValue(0.)
            opt.setSingleStep(default_step)
            opt.setMinimumWidth(90)
            opt.setMaximum(1000)
            opt.valueChanged.connect(partial(self.lattice_parameter_edited_callback, s))
            opt_step = DoubleMultiplySpinBoxAlignRight()
            opt_step.setDecimals(default_decimals)
            opt_step.setMinimumWidth(60)
            opt_step.setValue(default_step)
            opt_step.editingFinished.connect(partial(self.update_lattice_param_step, s))
            _lattice_opt_layout.addWidget(opt_lbl)
            _lattice_opt_layout.addWidget(opt)
            _lattice_opt_layout.addWidget(opt_step)
            lattice_opt.setLayout(_lattice_opt_layout)
            self.lattice_opts[s] = opt
            self.lattice_opts_steps[s] = opt_step
            self._lattice_layout.addWidget(lattice_opt)


        self.tth_widget = QtWidgets.QWidget()
        self._tth_layout = QtWidgets.QGridLayout()
        self._tth_layout.addWidget(QtWidgets.QLabel(u'2θ:'), 0, 0)
        self._tth_layout.addWidget(self.tth_lbl, 0, 1)
        self._tth_layout.addWidget(QtWidgets.QLabel('deg'), 0, 2)
        self._tth_layout.addWidget(self.tth_step, 0, 3)
        self._tth_layout.addWidget(self.get_tth_btn, 0, 4)
        self.tth_widget.setLayout(self._tth_layout)
        self._lattice_layout.addWidget(self.tth_widget)

        self.lattice_widget.setLayout(self._lattice_layout)

        



        self._body_layout = QtWidgets.QHBoxLayout()


        self.cell_tw = TreeView()
        #self._tm=self.model

        #self.cell_tw.setSortingEnabled(True)
        self.cell_tw.setModel(self.model)

        #self.setSelectionMode(QAbstractItemView.ExtendedSelection)  # <- optional
        selection_model = self.cell_tw.selectionModel()
        selection_model.selectionChanged.connect(self.cell_selection_changed)

        self.cell_tw.setColumnWidth(0, 50)
        self.cell_tw.setColumnWidth(1, 25)
        self.cell_tw.setColumnWidth(2, 50)
        self.cell_tw.header().hide()
        
        self.cell_tw.setMaximumWidth(175)

        self._body_layout.addWidget(self.cell_tw )


        self._body_layout.addWidget(self.symmetry_widget)
        self._body_layout.addWidget(self.lattice_widget)

        self.hkl_widget = QtWidgets.QTextEdit()
        self.hkl_widget.setMaximumWidth(175)
        self._body_layout.addWidget(self.hkl_widget)

        self._layout.addLayout(self._body_layout)

        self.setLayout(self._layout)
        
        self.style_widgets()

        self.cell_show_cbs = []
        self.cell_color_btns = []
        self.cell_roi_btns = [] #add ROIs 
        self.show_parameter_in_pattern = True
        #header_view = QtWidgets.QHeaderView(QtCore.Qt.Horizontal, self.cell_tw)
        #self.cell_tw.setHorizontalHeader(header_view)
        
        
        #header_view.hide()
        s#elf.cell_tw.setItemDelegate(NoRectDelegate())

        
     
        self.setAcceptDrops(True) 
示例#17
0
    def __init__(self, multiangle_model):
        super().__init__()
        self.multiangle_model = multiangle_model
        self.parameter_widget = parameterWidget()
        self._layout = QtWidgets.QVBoxLayout()
        self.setWindowTitle('Multiangle control')
        self.button_widget = QtWidgets.QWidget(self)
        self.button_widget.setObjectName('control_button_widget')
        self._button_layout = QtWidgets.QHBoxLayout()
        self._button_layout.setContentsMargins(0, 0, 0, 0)
        self._button_layout.setSpacing(15)
        self.new_btn = FlatButton('Setup')
        self.load_btn = FlatButton('Load')
        self.save_btn = FlatButton('Save')
        self.delete_btn = FlatButton('Delete')
        self.clear_btn = FlatButton('Clear')
        self.add_btn = FlatButton('Add')
        self.plot_btn = FlatButton('Plot')
        self._button_layout.addWidget(self.new_btn)
        self._button_layout.addWidget(self.load_btn)
        self._button_layout.addWidget(self.save_btn)
        self._button_layout.addWidget(self.add_btn)
        self._button_layout.addWidget(self.delete_btn)
        self._button_layout.addWidget(self.clear_btn)
        self._button_layout.addWidget(self.plot_btn)

        self._button_layout.addSpacerItem(HorizontalSpacerItem())
        '''
        self._button_layout.addWidget(VerticalLine())
        self._button_layout.addWidget(VerticalLine())
        self._button_layout.addWidget(self.save_btn)
        '''
        self.button_widget.setLayout(self._button_layout)
        self._layout.addWidget(self.button_widget)
        self._body_layout = QtWidgets.QHBoxLayout()
        self.tth_tv = QtWidgets.QTreeView()
        self.tth_tv.sortByColumn(0, 0)
        self.tth_tv.setSortingEnabled(True)
        self.tth_tv.setModel(self.multiangle_model)

        self._body_layout.addWidget(self.tth_tv, 10)

        self.make_beam_parameter_widget()

        self._body_layout.addWidget(self.beam_parameter_widget)

        self._layout.addLayout(self._body_layout)
        self.button_2_widget = QtWidgets.QWidget(self)
        self.button_2_widget.setObjectName('options_control_button_2_widget')
        self._button_2_layout = QtWidgets.QHBoxLayout()
        self._button_2_layout.setContentsMargins(0, 0, 0, 0)
        self._button_2_layout.setSpacing(15)
        self.iterations_lbl = QtWidgets.QLabel('Iterations:')
        self._button_2_layout.addWidget(self.iterations_lbl)
        self.iterations_control = QtWidgets.QLineEdit()
        self.iterations_control.setText('1')
        self._button_2_layout.addWidget(self.iterations_control)
        self.run_btn = FlatButton('Run')
        self._button_2_layout.addWidget(self.run_btn, 0)
        self.stop_btn = FlatButton('Stop')
        self._button_2_layout.addWidget(self.stop_btn, 0)
        self.test_btn = FlatButton('Test')
        self._button_2_layout.addWidget(self.test_btn, 0)
        self.setup_btn = FlatButton('Setup')
        self._button_2_layout.addWidget(self.setup_btn, 0)

        #self._button_2_layout.addWidget(VerticalLine())
        self._button_2_layout.addSpacerItem(HorizontalSpacerItem())
        #self._button_2_layout.addWidget(VerticalLine())
        self.button_2_widget.setLayout(self._button_2_layout)
        self._layout.addWidget(HorizontalLine())
        self._layout.addWidget(self.button_2_widget)

        self.setLayout(self._layout)
        self.style_widgets()

        self.show_parameter_in_pattern = True
        #self.tth_tv.setItemDelegate(NoRectDelegate())
        columns = self.multiangle_model.columnCount()
        self.tth_tv.resizeColumnToContents(0)
        header = self.tth_tv.header()
        for ind in range(columns):
            header.setSectionResizeMode(ind, QtWidgets.QHeaderView.Stretch)

        self.make_connections()