Example #1
0
    def __init__(self, parent=None, ui_file="input_widget.ui"):
        QtGui.QWidget.__init__(self, parent=parent)
        uic.loadUi(ui_file, self)
        self.wavelength.setValidator(QtGui.QDoubleValidator())
        self.energy.setValidator(QtGui.QDoubleValidator())
        self.pixel1.setValidator(QtGui.QDoubleValidator())
        self.pixel2.setValidator(QtGui.QDoubleValidator())

        self.all_detectors = pyFAI.detectors.ALL_DETECTORS.keys()
        self.all_detectors.sort()
        self.detector.addItems([i.capitalize() for i in self.all_detectors])
        self.detector.setCurrentIndex(self.all_detectors.index("detector"))

        self.connect(self.detector, SIGNAL("currentIndexChanged(int)"), self.detector_changed)
        self.connect(self.wavelength, SIGNAL("editingFinished ()"), self.wavelength_changed)
        self.connect(self.energy, SIGNAL("editingFinished ()"), self.energy_changed)

        # connect file selection windows
        self.connect(self.file_detectorfile, SIGNAL("clicked()"), self.select_detectorfile)
        self.connect(self.file_data, SIGNAL("clicked()"), self.select_datafile)
        self.connect(self.file_mask_file, SIGNAL("clicked()"), self.select_maskfile)
        self.connect(self.file_dark_current, SIGNAL("clicked()"), self.select_darkcurrent)
        self.connect(self.file_flat_field, SIGNAL("clicked()"), self.select_flatfield)
        self.connect(self.file_dspacing, SIGNAL("clicked()"), self.select_dspacing)
        self.connect(self.path_data_hdf5, SIGNAL("clicked()"), self.select_data_hdf5)
        self.connect(self.path_mask_hdf5, SIGNAL("clicked()"), self.select_mask_hdf5)
        self.connect(self.path_dark_hdf5, SIGNAL("clicked()"), self.select_dark_hdf5)
        self.connect(self.path_flat_hdf5, SIGNAL("clicked()"), self.select_flat_hdf5)

        self.all_calibrants = ["User defined"] + pyFAI.calibrant.ALL_CALIBRANTS.keys()
        self.calibrant.addItems(self.all_calibrants)
        self.calibrant.setCurrentIndex(self.all_calibrants.index("LaB6"))
Example #2
0
 def __init__(self,):
     QtGui.QWidget.__init__(self)
     uic.loadUi("calibration_main.ui", self)
     self.connect(self.actionAbout_calibrate, SIGNAL("triggered()"), self.on_about)
     self.dpi = 100
     self.fig = self.canvas = self.mpl_toolbar = self.pix_coords_label = None
     self.axes = None
     # ar is for artists: plot, images or labels...
     self.ar_data = self.ar_mask = self.ar_massif = self.ar_contour = self.ar_solidangle = self.ar_points = None
     self.data = self.massif = self.solid_angle = self.mask = None
     self.display_checks = {}
     self.display_widget = None
     self.input_widget = None
     self.build_right_frame()
     self.build_input_tab()
Example #3
0
    def __init__(self, parent=None, ui_file="input_widget.ui"):
        QtGui.QWidget.__init__(self, parent=parent)
        uic.loadUi(ui_file, self)
        self.wavelength.setValidator(QtGui.QDoubleValidator())
        self.energy.setValidator(QtGui.QDoubleValidator())
        self.pixel1.setValidator(QtGui.QDoubleValidator())
        self.pixel2.setValidator(QtGui.QDoubleValidator())

        self.all_detectors = pyFAI.detectors.ALL_DETECTORS.keys()
        self.all_detectors.sort()
        self.detector.addItems([i.capitalize() for i in self.all_detectors])
        self.detector.setCurrentIndex(self.all_detectors.index("detector"))

        self.connect(self.detector, SIGNAL("currentIndexChanged(int)"),
                     self.detector_changed)
        self.connect(self.wavelength, SIGNAL("editingFinished ()"),
                     self.wavelength_changed)
        self.connect(self.energy, SIGNAL("editingFinished ()"),
                     self.energy_changed)

        # connect file selection windows
        self.connect(self.file_detectorfile, SIGNAL("clicked()"),
                     self.select_detectorfile)
        self.connect(self.file_data, SIGNAL("clicked()"), self.select_datafile)
        self.connect(self.file_mask_file, SIGNAL("clicked()"),
                     self.select_maskfile)
        self.connect(self.file_dark_current, SIGNAL("clicked()"),
                     self.select_darkcurrent)
        self.connect(self.file_flat_field, SIGNAL("clicked()"),
                     self.select_flatfield)
        self.connect(self.file_dspacing, SIGNAL("clicked()"),
                     self.select_dspacing)
        self.connect(self.path_data_hdf5, SIGNAL("clicked()"),
                     self.select_data_hdf5)
        self.connect(self.path_mask_hdf5, SIGNAL("clicked()"),
                     self.select_mask_hdf5)
        self.connect(self.path_dark_hdf5, SIGNAL("clicked()"),
                     self.select_dark_hdf5)
        self.connect(self.path_flat_hdf5, SIGNAL("clicked()"),
                     self.select_flat_hdf5)

        self.all_calibrants = ["User defined"
                               ] + pyFAI.calibrant.ALL_CALIBRANTS.keys()
        self.calibrant.addItems(self.all_calibrants)
        self.calibrant.setCurrentIndex(self.all_calibrants.index("LaB6"))
Example #4
0
    def build_right_frame(self):
        "build the right frame that contains matplotlib widgets"

        self.fig = Figure(dpi=self.dpi)
        self.canvas = FigureCanvas(self.fig)
        self.canvas.setParent(self.image_frame)

        # Create the navigation toolbar, tied to the canvas
        self.mpl_toolbar = NavigationToolbar(self.canvas, self.image_frame, coordinates=False)

        self.axes = self.fig.add_subplot(111)
        self.axes.set_visible(False)
        # Bind the 'pick' event for clicking on one of the bars
        self.canvas.mpl_connect('motion_notify_event', self.on_pick)

        self.pix_coords_label = QtGui.QLabel("x= None , y= None , i= None ", self)
        self.mpl_toolbar.addWidget(self.pix_coords_label)

        self.display_widget = uic.loadUi("display_widget.ui")

        vbox = QtGui.QVBoxLayout()
        vbox.addWidget(self.mpl_toolbar, alignment=QtCore.Qt.AlignTop)
        vbox.addWidget(self.canvas)
        vbox.addWidget(self.display_widget, alignment=QtCore.Qt.AlignBottom)
        self.image_frame.setLayout(vbox)

        # Enforce the size Policy of sub-widgets
        pol = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
        self.mpl_toolbar.setSizePolicy(pol)
        self.display_widget.setSizePolicy(pol)
        self.canvas.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding))

        # few signals about those new widgets:
        self.display_checks = {"data": self.display_widget.show_data,
                               "mask": self.display_widget.show_mask,
                               "massif": self.display_widget.show_massif,
                               "points": self.display_widget.show_points,
                               "contour": self.display_widget.show_contour,
                               "solidangle": self.display_widget.show_solidangle}
        for v in self.display_checks.itervalues():
            self.connect(v, SIGNAL("stateChanged(int)"), self.toggle_show)