예제 #1
0
    def __init__(self, parent=None, node=None):
        super(ColumnFormatWidget, self).__init__(parent, node)
        self.shouldRemoveNonesFromProps = True

        self.tabWidget = qt.QTabWidget(self)
        self.tabWidget.setStyleSheet(
            # "QTabBar::tab:selected {background: palette(window);}"
            "QTabWidget>QWidget>QWidget{background: palette(window);}")
        self.headerTab = self.makeHeaderTab()
        self.tabWidget.addTab(self.headerTab, 'header')
        self.dataLocationTab = self.makeDataLocationTab()
        ind = self.tabWidget.addTab(self.dataLocationTab, 'arrays')
        self.tabWidget.setTabToolTip(
            ind, "for HDF5/SPEC datasets: use context menu on data arrays\n"
            "for column files: use expressions of variables `Col1`, `Col2`, …"
            "\nor give a zero-based int column index")
        self.conversionTab = self.makeConversionTab()
        ind = self.tabWidget.addTab(self.conversionTab, 'conversion')
        self.tabWidget.setTabToolTip(
            ind, "give either a float factor,\n"
            "a new str unit (not for abscissa) or\n"
            "leave empty (no conversion)")
        layout = qt.QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self.tabWidget)
        layout.addStretch()
        self.setLayout(layout)

        self.tabWidget.setCurrentIndex(1)
        self.registerPropGroup(
            self, [self.headerTab, self.dataLocationTab], 'data format')
예제 #2
0
    def __init__(self, parent=None):
        qt.QDialog.__init__(self, parent)
        self.tabWidget = qt.QTabWidget(self)

        layout = qt.QVBoxLayout(self)
        layout.addWidget(self.tabWidget)

        layout2 = qt.QHBoxLayout(None)

        # self.buttonHelp = qt.QPushButton(self)
        # self.buttonHelp.setText("Help")
        # layout2.addWidget(self.buttonHelp)

        self.buttonDefault = qt.QPushButton(self)
        self.buttonDefault.setText("Undo changes")
        layout2.addWidget(self.buttonDefault)

        spacer = qt.QSpacerItem(20, 20, qt.QSizePolicy.Expanding,
                                qt.QSizePolicy.Minimum)
        layout2.addItem(spacer)

        self.buttonOk = qt.QPushButton(self)
        self.buttonOk.setText("OK")
        layout2.addWidget(self.buttonOk)

        self.buttonCancel = qt.QPushButton(self)
        self.buttonCancel.setText("Cancel")
        layout2.addWidget(self.buttonCancel)

        layout.addLayout(layout2)

        self.buttonOk.clicked.connect(self.accept)
        self.buttonCancel.clicked.connect(self.reject)
예제 #3
0
    def __init__(self, parent=None, mode=None):
        qt.QMainWindow.__init__(self, parent)
        self.plot = Plot2D()
        self.setCentralWidget(self.plot)

        # 1D roi management
        self._curveRoiWidget = self.plot.getCurvesRoiDockWidget().widget()
        # hide last columns which are of no use now
        for index in (5, 6, 7, 8):
            self._curveRoiWidget.roiTable.setColumnHidden(index, True)

        # 2D - 3D roi manager
        self._regionManager = RegionOfInterestManager(parent=self.plot)

        # Create the table widget displaying
        self._2DRoiWidget = RegionOfInterestTableWidget()
        self._2DRoiWidget.setRegionOfInterestManager(self._regionManager)

        # tabWidget for displaying the rois
        self._roisTabWidget = qt.QTabWidget(parent=self)
        if hasattr(self._roisTabWidget, 'setTabBarAutoHide'):
            self._roisTabWidget.setTabBarAutoHide(True)

        # widget for displaying stats results and update mode
        self._statsWidget = _RoiStatsWidget(parent=self, plot=self.plot)

        # create Dock widgets
        self._roisTabWidgetDockWidget = qt.QDockWidget(parent=self)
        self._roisTabWidgetDockWidget.setWidget(self._roisTabWidget)
        self.addDockWidget(qt.Qt.RightDockWidgetArea,
                           self._roisTabWidgetDockWidget)

        # create Dock widgets
        self._roiStatsWindowDockWidget = qt.QDockWidget(parent=self)
        self._roiStatsWindowDockWidget.setWidget(self._statsWidget)
        # move the docker contain in the parent widget
        self.addDockWidget(qt.Qt.RightDockWidgetArea,
                           self._statsWidget._docker)
        self.addDockWidget(qt.Qt.RightDockWidgetArea,
                           self._roiStatsWindowDockWidget)

        # expose API
        self.setUpdateMode = self._statsWidget.setUpdateMode
예제 #4
0
    def __init__(self, parent, node, activeTab=None):
        super(LineProps, self).__init__(parent)
        self.setWindowTitle("Line properties of...")

        self.isGroupSelected = False
        self.isTopGroupSelected = False
        for topItem in csi.selectedTopItems:
            if topItem.child_count() == 0:
                break
        else:
            self.isGroupSelected = True  # all selected items are groups

        lsi = len(csi.selectedTopItems)
        if self.isGroupSelected:
            if lsi == 1:
                group = csi.selectedTopItems[0]
                txt = '...group <b>{0}</b> with {1} item{2}'.format(
                    group.alias, group.child_count(),
                    's' if group.child_count() > 1 else '')
            elif lsi > 1:
                txt = "...{0} selected groups".format(lsi)
            else:
                txt = ''
        else:
            if csi.selectedTopItems == csi.dataRootItem.get_nongroups():
                self.isTopGroupSelected = True
                txt = "...all top level data"
            elif len(csi.allLoadedItems) == len(csi.selectedItems):
                txt = "...all data"
            else:
                if lsi == 1:
                    txt = "...1 selected item ({0})".format(
                        csi.selectedItems[0].alias)
                else:
                    txt = "...{0} selected items".format(lsi)
        nSpectraLabel = qt.QLabel(txt)

        self.color = self.color1 = self.color2 = 'k'
        self.colorSeq = 0  # controls which color to edit 1 or 2 for Gradient
        self.colorPolicy = gco.COLOR_POLICY_LOOP1
        groupColor = self.makeColorGroup()

        self.tabWidget = qt.QTabWidget(parent=self)
        self.tabs = []
        self.node = node
        yNs = node.getPropList('qLabel', role='y')
        for yN in yNs:
            tab = self.makeTab()
            self.tabWidget.addTab(tab, yN)
            self.tabs.append(tab)
        if activeTab is not None:
            self.tabWidget.setCurrentIndex(activeTab)

        mainLayout = qt.QVBoxLayout()
        mainLayout.addWidget(nSpectraLabel)
        mainLayout.addWidget(groupColor)
        mainLayout.addWidget(self.tabWidget)
        buttonBox = qt.QDialogButtonBox(qt.QDialogButtonBox.Ok
                                        | qt.QDialogButtonBox.Cancel)
        buttonBox.accepted.connect(self.accept)  # OK button
        buttonBox.rejected.connect(self.reject)  # Cancel button
        mainLayout.addStretch()
        mainLayout.addWidget(buttonBox)
        self.setLayout(mainLayout)
        self.setSizePolicy(qt.QSizePolicy.Minimum, qt.QSizePolicy.Minimum)

        self.setUIFromData()
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
# ###########################################################################*/
"""This script is a simple example of how to use the periodic table widgets,
select elements and connect signals.
"""
import sys
from silx.gui import qt
from silx.gui.widgets import PeriodicTable

a = qt.QApplication(sys.argv)
sys.excepthook = qt.exceptionHandler
a.lastWindowClosed.connect(a.quit)

w = qt.QTabWidget()

pt = PeriodicTable.PeriodicTable(w, selectable=True)
pc = PeriodicTable.PeriodicCombo(w)
pl = PeriodicTable.PeriodicList(w)

pt.setSelection(['Fe', 'Si', 'Mt'])
pl.setSelectedElements(['H', 'Be', 'F'])
pc.setSelection("Li")


def change_list(items):
    print("New list selection:", [item.symbol for item in items])


def change_combo(item):