コード例 #1
0
    def __init__(self, orentation=Qt.Vertical, parent=None):
        super(TriColorChannel, self).__init__(parent)
        self._red_bar = ColorChannelBar("#FF0000")
        self._green_bar = ColorChannelBar("#00FF00")
        self._blue_bar = ColorChannelBar("#0000FF")
        self._red_spin = QSpinBox()
        self._green_spin = QSpinBox()
        self._blue_spin = QSpinBox()
        self._hex_edit = ColorHexEdit()
        self._red_box = VBox(self._red_bar, self._red_spin)
        self._green_box = VBox(self._green_bar, self._green_spin)
        self._blue_box = VBox(self._blue_bar, self._blue_spin)
        self._tri_box = HBox(self._red_box, self._green_box, self._blue_box)
        self._main_box = VBox(self._hex_edit, self._tri_box)
        self._bar_width = None
        self._orentation = None
        self._spin_width = None
        self._value = None

        self._red_spin.setRange(0, 255)
        self._green_spin.setRange(0, 255)
        self._blue_spin.setRange(0, 255)
        self.bind_data()

        self.spin_width = 40
        self.bar_width = 18
        self.orentation = orentation
        self.value = [255, 255, 255]

        self.setLayout(self._main_box)
コード例 #2
0
 def __init__(self, parent=None):
     super(general_control, self).__init__(parent)
     self.prj_control = prj_control()
     self.map_control = map_control()
     self.shot_control = prj_control()
     self.next_pb = PushButtonPlus("Next >")
     self.prev_pb = PushButtonPlus("<")
     self.prev_pb.setFixedWidth(30)
     self.step_indicator = StepEditPlus()
     self.setAutoFillBackground(True)
     self.control_page = VBox(self.prj_control, self.map_control,
                              self.shot_control, -1).setSpacing(20)
     self.setLayout(
         VBox(self.control_page, HBox(self.prev_pb, self.next_pb),
              self.step_indicator))
     self.step_indicator.setValue(1)
     self.map_control.hide()
     self.shot_control.hide()
     self.next_pb.clicked.connect(self.next_page)
     self.prev_pb.clicked.connect(self.prev_page)
     self.load_stylesheet()
     self.resize(450, 800)
     self.setFixedWidth(400)
     self._current_page_index = 0
     self._page_count = 3
コード例 #3
0
    def __init__(self, parent=None):
        super(DistributionWidget, self).__init__(parent)
        self._plot_widget1 = DistributionChartWidget()
        self._plot_widget2 = DistributionChartWidget()
        self._spec_h = QLineEdit()
        self._spec_tgt = QLineEdit()
        self._spec_l = QLineEdit()
        self._pb1 = QPushButton("set")

        self._bar_width = QLineEdit()
        self._pb2 = QPushButton("set")

        self._bar_offset = QLineEdit()
        self._pb3 = QPushButton("set")

        self._pb4 = QPushButton("set")

        self.setLayout(
            VBox(
                HBox(self._plot_widget1),  #, self._plot_widget2),
                HBox(self._spec_h, self._spec_tgt, self._spec_l, self._pb1),
                HBox(self._bar_width, self._pb2),
                HBox(self._bar_offset, self._pb3),
                HBox(self._pb4)))
        self._pb1.clicked.connect(self.setSpec)
        self._pb2.clicked.connect(self.setBarWidth)
        self._pb3.clicked.connect(self.setBarSpacing)
        self._pb4.clicked.connect(self.setCrosshair)

        csv = pd.read_csv(r'C:\Users\rawr\Downloads\MOCK_DATA (4).csv')
        h, l = 45, 10
        s1 = Statistic(data=csv.iloc[:, 3], spec_high=h, spec_low=l)
        s2 = Statistic(data=csv.iloc[:, 2], spec_high=h, spec_low=l)
        s3 = Statistic(data=csv.iloc[:, 1], spec_high=h, spec_low=l)
        s4 = Statistic(data=csv.iloc[:, 0], spec_high=h, spec_low=l)
        popt, pcov = self.f(s1)
        scale = 10
        x = [i / scale for i in range(0 * scale, 50 * scale, 1)]

        self._plot_widget1.AddBarChart(self.g(s1))
        self._plot_widget1.AddBarChart(self.g(s2))
        self._plot_widget1.AddBarChart(self.g(s3))
        self._plot_widget1.AddBarChart(self.g(s4))

        self._plot_widget1.AddScatterCurveChart(
            [x, self.gauss_function(x, *popt)])
コード例 #4
0
 def __init__(self, parent=None):
     super(ColorHexEdit, self).__init__(parent)
     self._text = None
     self._value = None
     self._edit = ColorTextEdit()
     self._border_pen = QPen(QColor("#DD3399"))
     self._border_pen.setWidth(3)
     self.setLayout(HBox(self._edit))
     self.setFixedSize(80, 80)
     self._edit.textChanged.connect(self.setText)
コード例 #5
0
    def __init__(self,  parent=None):
        super(SelectDialog, self).__init__(parent)    
        b = BrushSelectDrop()
        l = LineSelectDrop()
        f = FontSelectDrop()
        s = SizeSelectDrop()

        b.valueChanged.connect(lambda x : print(x))
        b.buttonClicked.connect(lambda  : print("main clicked"))
        b.dropClicked.connect(lambda    : print("drop clicked"))
        l.valueChanged.connect(lambda x : print(x))
        f.valueChanged.connect(lambda x : print(x))
        s.valueChanged.connect(lambda x : print(x))
        self.setLayout(VBox(
            HBox(QLabel("Brush:"), b),
            HBox(QLabel("Line:"),  l),
            HBox(QLabel("Font:"),  f),
            HBox(QLabel("Size:"),  s)
        ))
コード例 #6
0
 def __init__(self,  parent=None):
     super(ColorPopWidget, self).__init__(parent)
     k = QPushButton(">")
     k.setFixedSize(QSize(20, 20))
     self.setLayout(VBox(
         ColorPalletLite(), 
         HBox(
             ColorPalletCustom(), 
             ColorTextEdit("FFAADA"),
             5,
             k,
             10
         ).setContentsMargins(0, 0, 0, 0).setSpacing(0),
         -1
     ).setContentsMargins(0, 0, 0, 0))
     self.resize(200, 200)
コード例 #7
0
ファイル: generator.py プロジェクト: s910324/WaferMap
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)

        self.shot_view = DiagramView()
        self.wafer_view = DiagramView()
        self.shot_scene = GraphicScene(self.shot_view)
        self.wafer_scene = GraphicScene(self.wafer_view)
        self.control = general_control()
        self.control_dock = QDockWidget()

        self.control_dock.setAllowedAreas(Qt.LeftDockWidgetArea
                                          | Qt.RightDockWidgetArea)
        self.control_dock.setWidget(self.control)
        self.control_dock.setFeatures(QDockWidget.NoDockWidgetFeatures)
        self.control_dock.setTitleBarWidget(QWidget())
        self.addDockWidget(Qt.LeftDockWidgetArea, self.control_dock)
        self.shot_scene.setSceneRect(-wafer_rad, -wafer_rad, 2 * wafer_rad,
                                     2 * wafer_rad)
        self.wafer_scene.setSceneRect(-wafer_rad, -wafer_rad, 2 * wafer_rad,
                                      2 * wafer_rad)

        self.control.next_pb.clicked.connect(self.m)
        self.control.prev_pb.clicked.connect(self.n)
        self.shot_view.setScene(self.shot_scene)
        self.wafer_view.setScene(self.wafer_scene)
        w = QWidget()
        w.setLayout(HBox(self.shot_view, self.wafer_view))
        self.setCentralWidget(w)
        self.shot_view.show()
        self.wafer_view.hide()

        self.wafer = None
        self.shot = None
        self.control.prj_control.valueChanged.connect(self.n)
        self.n()
        self.shot_view.centerOn(0, 0)
        self.shot_view.setRenderHints(QPainter.HighQualityAntialiasing
                                      | QPainter.SmoothPixmapTransform)
        self.wafer_view.centerOn(0, 0)
        self.wafer_view.setRenderHints(QPainter.HighQualityAntialiasing
                                       | QPainter.SmoothPixmapTransform)

        self.setWindowTitle("Fake Wafer Map")
        self.resize(1250, 700)
コード例 #8
0
    def __init__(self, parent=None):
        super(ColorDialog, self).__init__(parent)
        self._value = None
        self.color_selector = ColorSelector()
        self.tri_color_channel = TriColorChannel(orentation=Qt.Horizontal)
        self.confirm_pb = QPushButton("OK")
        self.cancel_pb = QPushButton("Cancle")

        v1 = VBox(self.color_selector, self.tri_color_channel)
        h1 = HBox(-1, self.confirm_pb, self.cancel_pb)
        v2 = VBox(v1, h1)

        self.color_selector.valueChanged.connect(self.setValue)
        self.tri_color_channel.valueChanged.connect(self.setValue)
        self.valueChanged.connect(self.tri_color_channel.setValue)
        self.confirm_pb.clicked.connect(self.close)
        self.cancel_pb.clicked.connect(self.close)

        self.setLayout(v2)
        self.resize(400, 500)
コード例 #9
0
class TriColorChannel(QWidget):
    valueChanged = pyqtSignal(list)

    def __init__(self, orentation=Qt.Vertical, parent=None):
        super(TriColorChannel, self).__init__(parent)
        self._red_bar = ColorChannelBar("#FF0000")
        self._green_bar = ColorChannelBar("#00FF00")
        self._blue_bar = ColorChannelBar("#0000FF")
        self._red_spin = QSpinBox()
        self._green_spin = QSpinBox()
        self._blue_spin = QSpinBox()
        self._hex_edit = ColorHexEdit()
        self._red_box = VBox(self._red_bar, self._red_spin)
        self._green_box = VBox(self._green_bar, self._green_spin)
        self._blue_box = VBox(self._blue_bar, self._blue_spin)
        self._tri_box = HBox(self._red_box, self._green_box, self._blue_box)
        self._main_box = VBox(self._hex_edit, self._tri_box)
        self._bar_width = None
        self._orentation = None
        self._spin_width = None
        self._value = None

        self._red_spin.setRange(0, 255)
        self._green_spin.setRange(0, 255)
        self._blue_spin.setRange(0, 255)
        self.bind_data()

        self.spin_width = 40
        self.bar_width = 18
        self.orentation = orentation
        self.value = [255, 255, 255]

        self.setLayout(self._main_box)

    def bind_data(self):
        self.valueChanged.connect(lambda val: self._red_spin.setValue(val[0]))
        self.valueChanged.connect(
            lambda val: self._green_spin.setValue(val[1]))
        self.valueChanged.connect(lambda val: self._blue_spin.setValue(val[2]))
        self.valueChanged.connect(lambda val: self._hex_edit.setValue(val))

        self._hex_edit.valueChanged.connect(lambda val: self.setValue(val))

        self._red_spin.valueChanged.connect(lambda val: self.setRed(val))
        self._green_spin.valueChanged.connect(lambda val: self.setGreen(val))
        self._blue_spin.valueChanged.connect(lambda val: self.setBlue(val))

        self._red_spin.valueChanged.connect(
            lambda val: self._red_bar.setValue(val / 255))
        self._green_spin.valueChanged.connect(
            lambda val: self._green_bar.setValue(val / 255))
        self._blue_spin.valueChanged.connect(
            lambda val: self._blue_bar.setValue(val / 255))

        self._red_bar.valueChanged.connect(
            lambda val: self._red_spin.setValue(int(val * 255)))
        self._green_bar.valueChanged.connect(
            lambda val: self._green_spin.setValue(int(val * 255)))
        self._blue_bar.valueChanged.connect(
            lambda val: self._blue_spin.setValue(int(val * 255)))

    def setValue(self, value):
        self.value = value

    def setRed(self, r):
        self.red = r

    def setGreen(self, g):
        self.green = g

    def setBlue(self, b):
        self.blue = b

    @property
    def value(self):
        return self._value

    @value.setter
    def value(self, vals):
        if len(vals) == 3 and all([0 <= val <= 255 for val in vals]):
            if not (vals == self._value):
                self._value = vals
                self.valueChanged.emit(vals)
        self.update()

    @property
    def red(self):
        return self.value[0]

    @red.setter
    def red(self, r):
        self.value = [r, self.value[1], self.value[2]]

    @property
    def green(self):
        return self.value[1]

    @green.setter
    def green(self, g):
        self.value = [self.value[0], g, self.value[2]]

    @property
    def blue(self):
        return self.value[2]

    @blue.setter
    def blue(self, b):
        self.value = [self.value[0], self.value[1], b]

    @property
    def orentation(self):
        return self._orentation

    @orentation.setter
    def orentation(self, orentation):
        if orentation in [Qt.Vertical, Qt.Horizontal]:
            if not (orentation == self._orentation):
                if orentation == Qt.Vertical:
                    self._red_bar.orentation = Qt.Vertical
                    self._green_bar.orentation = Qt.Vertical
                    self._blue_bar.orentation = Qt.Vertical
                    self._red_box.setDirection(QBoxLayout.TopToBottom)
                    self._green_box.setDirection(QBoxLayout.TopToBottom)
                    self._blue_box.setDirection(QBoxLayout.TopToBottom)
                    self._tri_box.setDirection(QBoxLayout.LeftToRight)
                    self._main_box.setDirection(QBoxLayout.TopToBottom)
                    self._red_box.setAlignment(self._red_bar, Qt.AlignHCenter)
                    self._green_box.setAlignment(self._green_bar,
                                                 Qt.AlignHCenter)
                    self._blue_box.setAlignment(self._blue_bar,
                                                Qt.AlignHCenter)
                    self._main_box.setAlignment(self._hex_edit,
                                                Qt.AlignHCenter)
                    self.setSizePolicy(QSizePolicy.Fixed,
                                       QSizePolicy.MinimumExpanding)

                elif orentation == Qt.Horizontal:
                    self._red_bar.orentation = Qt.Horizontal
                    self._green_bar.orentation = Qt.Horizontal
                    self._blue_bar.orentation = Qt.Horizontal
                    self._red_box.setDirection(QBoxLayout.LeftToRight)
                    self._green_box.setDirection(QBoxLayout.LeftToRight)
                    self._blue_box.setDirection(QBoxLayout.LeftToRight)
                    self._tri_box.setDirection(QBoxLayout.TopToBottom)
                    self._main_box.setDirection(QBoxLayout.LeftToRight)
                    self._red_box.setAlignment(self._red_bar, Qt.AlignVCenter)
                    self._green_box.setAlignment(self._green_bar,
                                                 Qt.AlignVCenter)
                    self._blue_box.setAlignment(self._blue_bar,
                                                Qt.AlignVCenter)
                    self._main_box.setAlignment(self._hex_edit,
                                                Qt.AlignVCenter)
                    self.setSizePolicy(QSizePolicy.MinimumExpanding,
                                       QSizePolicy.Fixed)
                self._orentation = orentation
                self.bar_width = self._bar_width
        self.update()

    @property
    def bar_width(self):
        return self._bar_width

    @bar_width.setter
    def bar_width(self, width):
        if (isinstance(width, numbers.Number) and width > 0):
            bars = [self._red_bar, self._green_bar, self._blue_bar]
            _ = [bar.resize(bar.sizeHint()) for bar in bars]
            self._red_bar.adjustSize()
            if self._orentation == Qt.Vertical:
                _ = [bar.setFixedWidth(width) for bar in bars]
            elif self._orentation == Qt.Horizontal:
                _ = [bar.setFixedHeight(width) for bar in bars]

            self._bar_width = width
        else:
            raise TypeError("%s TypeError: %s" %
                            (inspect.stack()[1].function, width))

    @property
    def spin_width(self):
        return self._spin_width

    @spin_width.setter
    def spin_width(self, width):
        if (isinstance(width, numbers.Number) and width > 0):
            spins = [self._red_spin, self._green_spin, self._blue_spin]
            _ = [spin.setFixedWidth(width) for spin in spins]
            self._spin_width = width
        else:
            raise TypeError("%s TypeError: %s" %
                            (inspect.stack()[1].function, width))