Ejemplo n.º 1
0
 def group_box(title):
     box = QtWidgets.QGroupBox(title)
     box.setFlat(True)
     lay = QtWidgets.QVBoxLayout()
     lay.setContentsMargins(0, 0, 0, 0)
     box.setLayout(lay)
     return box
Ejemplo n.º 2
0
    def __init__(self,
                 parent: OWWidget = None,
                 title=None,
                 column_count=2,
                 column_headers=["x", "y"]):
        QtWidgets.QWidget.__init__(self, parent)
        OWComponent.__init__(self, parent)

        # GUI
        self.table = gui.table(self, 0, column_count)
        # selection multiline and row
        self.table.setSelectionMode(
            QtWidgets.QAbstractItemView.SelectionMode.MultiSelection)
        self.table.setSelectionBehavior(
            QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows)
        # set headers labels
        self.table.setHorizontalHeaderLabels(column_headers)
        # columns shapes
        self.table.horizontalHeader().setResizeMode(
            QtWidgets.QHeaderView.Stretch)

        vbox = QtWidgets.QVBoxLayout()
        if title is not None:
            vbox.addWidget(gui.label(self, parent, title))
        vbox.addWidget(self.table)
        self.setLayout(vbox)
Ejemplo n.º 3
0
 def initUIParent(self):
     parent = self.parent()
     if parent is None:
         return
     layout = parent.layout()
     if layout is None:
         layout = QtWidgets.QVBoxLayout()
         parent.setLayout(layout)
     layout.addWidget(self)
Ejemplo n.º 4
0
    def __init__(self):
        QtWidgets.QMainWindow.__init__(self)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        self.setWindowTitle("application main window")
        self.main_widget = QtWidgets.QWidget(self)

        vbox = QtWidgets.QVBoxLayout(self.main_widget)

        self.canvas = MyMplCanvas(self.main_widget, width=5, height=4,
                                  dpi=100)  # attention###
        vbox.addWidget(self.canvas)

        hbox = QtWidgets.QHBoxLayout(self.main_widget)
        self.start_button = QPushButton("start", self)
        self.stop_button = QPushButton("stop", self)
        self.exit_button = QPushButton("exit", self)

        self.start_button.clicked.connect(self.on_start)
        self.stop_button.clicked.connect(self.on_stop)
        self.exit_button.clicked.connect(self.on_exit)

        hbox.addWidget(self.start_button)
        hbox.addWidget(self.stop_button)
        hbox.addWidget(self.exit_button)

        vbox.addLayout(hbox)
        self.setLayout(vbox)

        self.main_widget.setFocus()
        self.setCentralWidget(self.main_widget)

        global n_drops
        global scat
        global rain_drops
        rain_drops = np.zeros(n_drops, dtype=[('position', float, 2)])
        self.scat = self.canvas.axes.scatter(rain_drops['position'][:, 0],
                                             rain_drops['position'][:, 1],
                                             s=10,
                                             lw=0.5)
Ejemplo n.º 5
0
    def __init__(self, parent=None, **kwargs):
        super().__init__(parent, **kwargs)
        self.__model = None
        self.__selectionMode = QtWidgets.QListView.ExtendedSelection

        self.__currentIndex = -1
        self.__selections = {}

        layout = QtWidgets.QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)

        def group_box(title):
            box = QtWidgets.QGroupBox(title)
            box.setFlat(True)
            lay = QtWidgets.QVBoxLayout()
            lay.setContentsMargins(0, 0, 0, 0)
            box.setLayout(lay)
            return box

        self.labels_combo = QtWidgets.QComboBox()
        self.values_view = QtWidgets.QListView(
            selectionMode=self.__selectionMode)

        self.labels_combo.currentIndexChanged.connect(
            self.__onCurrentIndexChanged)

        l_box = group_box(self.tr("Label"))
        v_box = group_box(self.tr("Values"))

        l_box.layout().addWidget(self.labels_combo)
        v_box.layout().addWidget(self.values_view)

        layout.addWidget(l_box)
        layout.addWidget(v_box)

        self.setLayout(layout)

        self.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                           QtWidgets.QSizePolicy.Expanding)