Example #1
0
    def _init_ui(self):
        # Widgets
        model = self._CompositionModel()

        self._table = QTableView()
        self._table.setModel(model)
        self._table.setItemDelegate(self._CompositionDelegate(self))
        self._table.horizontalHeader().setStretchLastSection(True)

        self._toolbar = QToolBar()
        action_add = self._toolbar.addAction(getIcon("list-add"), "Add layer")
        action_remove = self._toolbar.addAction(getIcon("list-remove"), "Remove layer")

        # Layouts
        layout = _CompositionWidget._init_ui(self)
        layout.addRow(self._table)
        layout.addRow(self._toolbar)

        # Signals
        action_add.triggered.connect(self._on_add)
        action_remove.triggered.connect(self._on_remove)

        model.dataChanged.connect(self.edited)
        model.rowsInserted.connect(self.edited)
        model.rowsRemoved.connect(self.edited)

        return layout
Example #2
0
    def testgetIcon(self):
        icon = getIcon('document-new')
        self.assertFalse(icon.isNull())

        with warnings.catch_warnings(record=True) as ws:
            icon = getIcon('document-newwwww')
            self.assertTrue(icon.isNull())
            self.assertEqual(1, len(ws))
Example #3
0
 def _init_toolbar(self):
     a = QAction(getIcon('ruler'), 'Scale bar', self)
     a.setToolTip('Add scale bar')
     a.setCheckable(True)
     a.triggered.connect(self.scalebar)
     self._actions['scalebar'] = a
     self.insertAction(self._actions['configure_subplots'], a)
Example #4
0
 def _init_toolbar(self):
     a = QAction(getIcon('color-wheel'), 'Color bar', self)
     a.setToolTip('Add color bar')
     a.setCheckable(True)
     a.triggered.connect(self.colorbar)
     self._actions['colorbar'] = a
     self.insertAction(self._actions['configure_subplots'], a)
Example #5
0
 def _init_toolbar(self):
     a = QAction(getIcon('snap'), 'Snap', self)
     a.setCheckable(True)
     a.setToolTip('Snap to data')
     a.triggered.connect(self.snap)
     self._actions['snap'] = a
     self.insertAction(self._actions['pan'], a)
Example #6
0
    def _init_ui(self):
        # Widgets
        self._table = QTableView()
        self._table.setModel(self._SpecimenPositionModel())
        self._table.setItemDelegate(self._SpecimenPositionDelegate(self))
        self._table.horizontalHeader().setStretchLastSection(True)

        self._toolbar = QToolBar()
        action_add = self._toolbar.addAction(getIcon("list-add"), "Add layer")
        action_remove = self._toolbar.addAction(getIcon("list-remove"), "Remove layer")

        # Layouts
        layout = ParameterWidget._init_ui(self)
        layout.addRow(self._table)
        layout.addRow(self._toolbar)

        # Signals
        action_add.triggered.connect(self._on_add)
        action_remove.triggered.connect(self._on_remove)

        return layout