예제 #1
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()
예제 #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('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()
예제 #3
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()
예제 #4
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)
예제 #5
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)
예제 #6
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()
예제 #7
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()