示例#1
0
    def __init__(self, parent):
        super(AboutDialog, self).__init__(parent)
        self.setWindowTitle("About")
        self.setWindowIcon(qt.QIcon(ICONPATHR))

        self.parseq_pypi_version = self.check_pypi_version(
        )  # pypi_ver, cur_ver  # noqa

        self.tabBar = qt.QTabBar(parent=self)
        self.tabBar.setIconSize(qt.QSize(32, 32))
        self.tabBar.setStyleSheet("QTabBar {font: bold 10pt;}")
        # "QTabBar::tab { height: 100px; width: 400px; }")
        self.tabNames = ['ParSeq', csi.pipelineName]
        self.iconPaths = [ICONPATHP, csi.appIconPath]
        for tabName, iconPath in zip(self.tabNames, self.iconPaths):
            icon = qt.QIcon(iconPath) if iconPath else qt.QIcon()
            self.tabBar.addTab(icon, tabName)
        self.tabBar.currentChanged.connect(self.changePage)
        self.makeWebView()

        # self.webView.page().mainFrame().setScrollBarPolicy(
        #     qt.Qt.Vertical, qt.Qt.ScrollBarAlwaysOff)
        # self.webView.page().mainFrame().setScrollBarPolicy(
        #     qt.Qt.Horizontal, qt.Qt.ScrollBarAlwaysOff)

        layout = qt.QVBoxLayout()
        layout.addWidget(self.tabBar)
        layout.setSpacing(0)
        layout.addWidget(self.webView)
        self.setLayout(layout)
        self.resize(0, 0)
示例#2
0
    def __createCompoundIcon(self, backgroundIcon, foregroundIcon):
        icon = qt.QIcon()

        sizes = backgroundIcon.availableSizes()
        sizes = sorted(sizes, key=lambda s: s.height())
        sizes = filter(lambda s: s.height() < 100, sizes)
        sizes = list(sizes)
        if len(sizes) > 0:
            baseSize = sizes[-1]
        else:
            baseSize = qt.QSize(32, 32)

        modes = [qt.QIcon.Normal, qt.QIcon.Disabled]
        for mode in modes:
            pixmap = qt.QPixmap(baseSize)
            pixmap.fill(qt.Qt.transparent)
            painter = qt.QPainter(pixmap)
            painter.drawPixmap(0, 0, backgroundIcon.pixmap(baseSize,
                                                           mode=mode))
            painter.drawPixmap(0, 0, foregroundIcon.pixmap(baseSize,
                                                           mode=mode))
            painter.end()
            icon.addPixmap(pixmap, mode=mode)

        return icon
示例#3
0
 def __init__(self, parent):
     super(MenuItem, self).__init__(parent)
     self.__text = None
     self.__icon = qt.QIcon()
     self.__warningIcon = None
     self.__warnings = None
     self.__mode = self.TextMode
示例#4
0
 def _setButtonIcon(self, show):
     style = qt.QApplication.instance().style()
     # return a QIcon
     icon = style.standardIcon(self._BUTTON_ICON)
     if show is False:
         pixmap = icon.pixmap(32, 32).transformed(qt.QTransform().scale(-1, 1))
         icon = qt.QIcon(pixmap)
     self._toggleButton.setIcon(icon)
示例#5
0
    def __init__(self, parent=None):
        super(MainWindowParSeq, self).__init__(parent)
        selfDir = os.path.dirname(__file__)
        self.iconDir = os.path.join(selfDir, '_images')
        self.runIcon = qt.QIcon(os.path.join(self.iconDir, 'parseq.ico'))
        # self.emptyIcon = qt.QIcon(qt.QPixmap.fromImage(qt.QImage.fromData(
        #     b'<svg version="1.1" viewBox="0 0  32"'
        #     b' xmlns="http://www.w3.org/2000/svg"></svg>')))
        # self.emptyIcon = qt.QIcon()

        transformThread = qt.QThread(self)
        csi.transformer = Transformer()
        csi.transformer.moveToThread(transformThread)
        transformThread.started.connect(
            partial(self.displayStatusMessage, u'calculating…'))
        transformThread.started.connect(csi.transformer.run)
        csi.transformer.ready.connect(
            partial(self.displayStatusMessage, u'ready'))
        csi.mainWindow = self
        self.setWindowTitle(u"ParSeq  \u2014  " + csi.pipelineName)

        self.initTabs()

        # self.settings = qt.QSettings('parseq.ini', qt.QSettings.IniFormat)
        self.setWindowIcon(qt.QIcon(os.path.join(self.iconDir, 'parseq.ico')))
        self.setWindowFlags(qt.Qt.Window)

        self.statusBar = self.statusBar()
        #        self.statusBar.setStyleSheet("QStatusBar {min-height: 20;}")

        self.statusBarLeft = qt.QLabel("ready")
        self.statusBarRight = qt.QLabel("")
        self.statusBar.addWidget(self.statusBarLeft)
        self.statusBar.addPermanentWidget(self.statusBarRight)

        self.restore_perspective()

        self.initToolbar()

        self.beforeTransformSignal.connect(partial(self.updateTabStatus, 1))
        self.afterTransformSignal.connect(partial(self.updateTabStatus, 0))
        self.beforeDataTransformSignal.connect(self.updateItemView)
        self.afterDataTransformSignal.connect(self.updateItemView)

        self.dataChanged()
示例#6
0
 def _warningIcon(self):
     if self._cacheWarningIcon is None:
         icon = icons.getQIcon("pyfai:gui/icons/warning")
         pixmap = icon.pixmap(64)
         coloredIcon = qt.QIcon()
         coloredIcon.addPixmap(pixmap, qt.QIcon.Normal)
         coloredIcon.addPixmap(pixmap, qt.QIcon.Disabled)
         self._cacheWarningIcon = coloredIcon
     return self._cacheWarningIcon
示例#7
0
    def __init__(self, node, parent=None):
        super(NodeWidget, self).__init__(parent)
        self.mainWindow = parent
        #        self.setContentsMargins(0, 0, 0, 0)
        self.node = node
        self.helpFile = ''
        node.widget = self
        self.pendingPropDialog = None
        self.pendingFile = None
        self.wasNeverPlotted = True
        self.onTransform = False

        self.makeSplitters()

        self.fillSplitterFiles()
        self.fillSplitterData()
        self.fillSplitterPlot()
        self.makeTransformWidget(self.splitterTransform)
        self.fillSplitterTransform()
        self.makeSplitterButtons()
        self.splitter.setStretchFactor(0, 0.1)
        self.splitter.setStretchFactor(1, 0.1)
        self.splitter.setStretchFactor(2, 1)
        self.splitter.setStretchFactor(3, 0.1)

        # if not osp.exists(self.helpFile):
        if True:
            self.splitterTransform.setSizes([1, 0])
        self.splitterButtons['files && containers'].clicked.emit()
        self.splitterButtons['transform'].clicked.emit()

        # self.splitter.setSizes([1, 1, 1, 1])  # set in MainWindowParSeq
        if len(csi.selectedItems) > 0:
            self.updateNodeForSelectedItems()
            self.replot()

        if node.plotDimension is None:
            self.dimIcon = qt.QIcon()
        elif node.plotDimension < 4:
            name = 'icon-item-{0}dim'.format(node.plotDimension)
        else:
            name = 'icon-item-ndim'
        self.iconDir = osp.join(osp.dirname(__file__), '_images')
        self.dimIcon = qt.QIcon(osp.join(self.iconDir, name + '.png'))
 def __init__(self, plot, parent=None):
     PlotAction.__init__(
         self,
         plot,
         icon=qt.QIcon(my_icon),
         text='FFT',
         tooltip='Perform Fast Fourier Transform on all curves',
         triggered=self.fftAllCurves,
         checkable=True,
         parent=parent)
示例#9
0
 def getIcon(*identifiyers):
     for i in identifiyers:
         if isinstance(i, str):
             if qt.QIcon.hasThemeIcon(i):
                 return qt.QIcon.fromTheme(i)
         elif isinstance(i, qt.QIcon):
             return i
         else:
             return style.standardIcon(i)
     return qt.QIcon()
示例#10
0
 def populateRedoMenu(self, menu):
     # menu = self.sender()
     for action in menu.actions():
         menu.removeAction(action)
     for ientry, entry in reversed(list(enumerate(csi.redo))):
         text = gur.getStrRepr(entry)
         subAction = qt.QAction(
             qt.QIcon(os.path.join(self.iconDir, "icon-redo.png")), text,
             self)
         subAction.triggered.connect(partial(self.slotRedo, ientry))
         menu.addAction(subAction)
示例#11
0
    def setDataset(self, dataset):
        """Set the dataset stored in this item.

        :param Union[numpy.ndarray,h5py.Dataset,silx.io.commonh5.Dataset] dataset:
            The dataset to store.
        """
        self.__dataset = dataset
        if self.__dataset is not None:
            name = self.__dataset.name

            if silx.io.is_dataset(dataset):
                type_ = self.getDefaultFormatter().humanReadableType(dataset)
                shape = self.getDefaultFormatter().humanReadableShape(dataset)

                if dataset.shape is None:
                    icon_name = "item-none"
                elif len(dataset.shape) < 4:
                    icon_name = "item-%ddim" % len(dataset.shape)
                else:
                    icon_name = "item-ndim"
                icon = icons.getQIcon(icon_name)
            else:
                type_ = ""
                shape = ""
                icon = qt.QIcon()
        else:
            name = ""
            type_ = ""
            shape = ""
            icon = qt.QIcon()

        self.__icon = icon
        self.__name.setText(name)
        self.__name.setDragEnabled(self.__dataset is not None)
        self.__name.setIcon(self.__icon)
        self.__type.setText(type_)
        self.__shape.setText(shape)

        parent = self.parent()
        if parent is not None:
            self.parent()._datasetUpdated()
示例#12
0
 def __updateVisualizationMenu(self):
     """Update the state of the action containing visualization menu.
     """
     selectedAction = self.__visualizationGroup.checkedAction()
     if selectedAction is not None:
         self.__visualizationAction.setText(selectedAction.text())
         self.__visualizationAction.setIcon(selectedAction.icon())
         self.__visualizationAction.setToolTip(selectedAction.toolTip())
     else:
         self.__visualizationAction.setText("")
         self.__visualizationAction.setIcon(qt.QIcon())
         self.__visualizationAction.setToolTip("")
示例#13
0
 def __updateAlignmentMenu(self):
     """Update the state of the action containing alignment menu.
     """
     selectedAction = self.__alignmentGroup.checkedAction()
     if selectedAction is not None:
         self.__alignmentAction.setText(selectedAction.text())
         self.__alignmentAction.setIcon(selectedAction.icon())
         self.__alignmentAction.setToolTip(selectedAction.toolTip())
     else:
         self.__alignmentAction.setText("")
         self.__alignmentAction.setIcon(qt.QIcon())
         self.__alignmentAction.setToolTip("")
示例#14
0
 def _setAnimatedIcon(self, icon):
     if self.__animatedIcon is not None:
         self.__animatedIcon.unregister(self)
         self.__animatedIcon.iconChanged.disconnect(self.__updateIcon)
     self.__animatedIcon = icon
     if self.__animatedIcon is not None:
         self.__animatedIcon.register(self)
         self.__animatedIcon.iconChanged.connect(self.__updateIcon)
         i = self.__animatedIcon.currentIcon()
     else:
         i = qt.QIcon()
     super(AnimatedToolButton, self).setIcon(i)
示例#15
0
    def __init__(self, plot, parent=None):

        qt.QToolButton.__init__(self, parent)
        self.setIcon(qt.QIcon(qt.QPixmap(IconDict["plugin"])))
        self.setToolTip("Call/Load 1D Plugins")

        # fill attr pluginList and pluginInstanceDict with existing plugins
        PluginLoader.__init__(self, method='getPlugin1DInstance')

        # plugins expect a legacy API, not the silx Plot API
        self.plot = weakref.proxy(plot, self._ooPlotDestroyed)

        self.clicked.connect(self._pluginClicked)
示例#16
0
    def __init__(self, *args, **kwargs):
        super(QColorEditor, self).__init__(*args, **kwargs)
        layout = qt.QHBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        button = qt.QToolButton()
        icon = qt.QIcon(qt.QPixmap(32, 32))
        button.setIcon(icon)
        layout.addWidget(button)
        button.clicked.connect(self.__showColorDialog)
        layout.addStretch(1)

        self.__color = None
        self.__previousColor = None
示例#17
0
    def createIconPanel(self, parent):
        panel = qt.QWidget(parent)
        layout = qt.QGridLayout()
        # layout.setSizeConstraint(qt.QLayout.SetMinAndMaxSize)
        panel.setLayout(layout)

        self.tools = []

        # Sort together animated and non animated icons
        fix_icons = self.getAllAvailableIcons()
        animated_icons = self.getAllAvailableAnimatedIcons()
        icons = []
        icons.extend([(i, "_") for i in fix_icons])
        icons.extend([(i, "anim") for i in animated_icons])
        icons = sorted(icons)

        for i, icon_info in enumerate(icons):
            icon_name, icon_kind = icon_info
            col, line = i // 10, i % 10
            if icon_kind == "anim":
                tool = AnimatedToolButton(panel)
                try:
                    icon = silx.gui.icons.getAnimatedIcon(icon_name)
                except ValueError:
                    icon = qt.QIcon()
                tool.setToolTip("Animated icon '%s'" % icon_name)
            else:
                tool = qt.QToolButton(panel)
                try:
                    icon = silx.gui.icons.getQIcon(icon_name)
                except ValueError:
                    icon = qt.QIcon()
                tool.setToolTip("Icon '%s'" % icon_name)
            tool.setIcon(icon)
            tool.setIconSize(qt.QSize(32, 32))
            layout.addWidget(tool, col, line)
            self.tools.append(tool)

        return panel
示例#18
0
    def __init__(self, parent, modeId=None, icon=None, label=None):
        """Constructor

        :param qt.QWidget parent: Parent of the hold widget
        """
        self.__parent = parent
        self.__widget = None
        self.__modeId = modeId
        if label is None:
            label = self.__class__.__name__
        self.__label = label
        if icon is None:
            icon = qt.QIcon()
        self.__icon = icon
示例#19
0
 def icon(self):
     pixmap = qt.QPixmap(2, 2)
     painter = qt.QPainter(pixmap)
     painter.setPen(qt.QColor(255, 0, 0))
     painter.drawPoint(qt.QPoint(0, 0))
     painter.setPen(qt.QColor(255, 255, 0))
     painter.drawPoint(qt.QPoint(1, 0))
     painter.setPen(qt.QColor(0, 255, 0))
     painter.drawPoint(qt.QPoint(0, 1))
     painter.setPen(qt.QColor(0, 255, 255))
     painter.drawPoint(qt.QPoint(1, 1))
     painter.end()
     pixmap = pixmap.scaled(32, 32, qt.Qt.IgnoreAspectRatio, qt.Qt.FastTransformation)
     return qt.QIcon(pixmap)
示例#20
0
 def updateNextStepStatus(self):
     if not hasattr(self, "_nextStep"):
         return
     warning = self.nextStepWarning()
     if warning is None:
         icon = qt.QIcon()
         self._nextStep.setIcon(icon)
         self._nextStep.setToolTip(None)
         self._nextStep.setEnabled(True)
     else:
         self._nextStep.setIcon(self._warningIcon())
         self._nextStep.setToolTip(warning)
         self._nextStep.setEnabled(False)
     self.warningUpdated.emit()
示例#21
0
def getQIcon(name):
    """Create a QIcon from its name.

    :param str name: Name of the icon, in one of the defined icons
                     in this module.
    :return: Corresponding QIcon
    :raises: ValueError when name is not known
    """
    if name not in _cached_icons:
        qfile = getQFile(name)
        icon = qt.QIcon(qfile.fileName())
        _cached_icons[name] = icon
    else:
        icon = _cached_icons[name]
    return icon
示例#22
0
 def initStyleOption(self, option):
     """
     :param qt.QStyleOptionComboBox option: Option to initialize
     """
     qt.QComboBox.initStyleOption(self, option)
     dataCallback = self.__displayedDataCallback
     if dataCallback is not None:
         index = self.currentIndex()
         text = dataCallback(self, index, role=qt.Qt.DisplayRole)
         if text is None:
             text = ""
         icon = dataCallback(self, index, role=qt.Qt.DecorationRole)
         if icon is None:
             icon = qt.QIcon()
         option.currentText = text
         option.currentIcon = icon
示例#23
0
 def data(self, index=qt.QModelIndex(), role=qt.Qt.DisplayRole):
     peakModel = self.__peakSelectionModel[index.row()]
     column = index.column()
     if role == qt.Qt.DecorationRole:
         if column == 0:
             color = peakModel.color()
             pixmap = qt.QPixmap(16, 16)
             pixmap.fill(color)
             icon = qt.QIcon(pixmap)
             return icon
         else:
             return None
     if role == qt.Qt.DisplayRole or role == qt.Qt.EditRole:
         if column == 0:
             return peakModel.name()
         if column == 1:
             return len(peakModel.coords())
         if column == 2:
             return peakModel.ringNumber()
     return None
示例#24
0
    def _createRoiActions(self):

        if self._roiActions:
            return self._roiActions

        # roi shapes
        self._roiActionGroup = roiActionGroup = qt.QActionGroup(self)

        self._roiActions = roiActions = OrderedDict()

        for name, klass in self._klassInfos.items():

            try:
                qIcon = icons.getQIcon(klass.actionIcon)
            except:
                qIcon = qt.QIcon()

            text = klass.actionText
            if text is None:
                text = klass.roiName

            action = qt.QAction(qIcon, text, None)
            action.setCheckable(True)
            toolTip = klass.actionToolTip
            if toolTip is not None:
                action.setToolTip(toolTip)
            roiActions[name] = action
            roiActionGroup.addAction(action)

            if klass.roiName == self._currentKlass:
                action.setChecked(True)
            else:
                action.setChecked(False)

        roiActionGroup.triggered.connect(self._roiActionTriggered,
                                         qt.Qt.QueuedConnection)

        return roiActions
示例#25
0
    def _pluginClicked(self):
        actionNames = []
        menu = qt.QMenu(self)
        menu.addAction("Reload Plugins")
        actionNames.append("Reload Plugins")
        menu.addAction("Set User Plugin Directory")
        actionNames.append("Set User Plugin Directory")

        if _logger.getEffectiveLevel() == logging.DEBUG:
            text = "Toggle DEBUG mode OFF"
        else:
            text = "Toggle DEBUG mode ON"

        menu.addAction(text)
        menu.addSeparator()
        actionNames.append(text)
        callableKeys = ["Dummy0", "Dummy1", "Dummy2"]
        pluginInstances = self.pluginInstanceDict
        for pluginName in self.pluginList:
            if pluginName in ["PyMcaPlugins.Plugin1DBase", "Plugin1DBase"]:
                continue
            module = sys.modules[pluginName]
            if hasattr(module, 'MENU_TEXT'):
                text = module.MENU_TEXT
            else:
                text = os.path.basename(module.__file__)
                if text.endswith('.pyc'):
                    text = text[:-4]
                elif text.endswith('.py'):
                    text = text[:-3]

            methods = pluginInstances[pluginName].getMethods(
                plottype=self.plot._plotType)
            if not len(methods):
                continue
            elif len(methods) == 1:
                pixmap = pluginInstances[pluginName].getMethodPixmap(
                    methods[0])
                tip = pluginInstances[pluginName].getMethodToolTip(methods[0])
                if pixmap is not None:
                    action = qt.QAction(qt.QIcon(qt.QPixmap(pixmap)), text,
                                        self)
                else:
                    action = qt.QAction(text, self)
                if tip is not None:
                    action.setToolTip(tip)
                menu.addAction(action)
            else:
                menu.addAction(text)
            actionNames.append(text)
            callableKeys.append(pluginName)
        menu.hovered.connect(self._actionHovered)
        a = menu.exec_(qt.QCursor.pos())
        if a is None:
            return None

        idx = actionNames.index(a.text())
        if a.text() == "Reload Plugins":
            n, message = self.getPlugins(exceptions=True)
            if n < 1:
                msg = qt.QMessageBox(self)
                msg.setIcon(qt.QMessageBox.Information)
                msg.setWindowTitle("No plugins")
                msg.setInformativeText(" Problem loading plugins ")
                msg.setDetailedText(message)
                msg.exec_()
            return
        if a.text() == "Set User Plugin Directory":
            dirName = qt.QFileDialog.getExistingDirectory(
                self, "Enter user plugins directory", os.getcwd())
            if len(dirName):
                pluginsDir = self.getPluginDirectoryList()
                pluginsDirList = [pluginsDir[0], dirName]
                self.setPluginDirectoryList(pluginsDirList)
            return
        if "Toggle DEBUG mode" in a.text():
            _toggleLogger()
        key = callableKeys[idx]

        methods = pluginInstances[key].getMethods(plottype=self.plot._plotType)
        if len(methods) == 1:
            idx = 0
        else:
            actionNames = []
            # allow the plugin designer to specify the order
            #methods.sort()
            menu = qt.QMenu(self)
            for method in methods:
                text = method
                pixmap = pluginInstances[key].getMethodPixmap(method)
                tip = pluginInstances[key].getMethodToolTip(method)
                if pixmap is not None:
                    action = qt.QAction(qt.QIcon(qt.QPixmap(pixmap)), text,
                                        self)
                else:
                    action = qt.QAction(text, self)
                if tip is not None:
                    action.setToolTip(tip)
                menu.addAction(action)
                actionNames.append((text, pixmap, tip, action))
            #qt.QObject.connect(menu, qt.SIGNAL("hovered(QAction *)"), self._actionHovered)
            menu.hovered.connect(self._actionHovered)
            a = menu.exec_(qt.QCursor.pos())
            if a is None:
                return None
            idx = -1
            for action in actionNames:
                if a.text() == action[0]:
                    idx = actionNames.index(action)
        try:
            pluginInstances[key].applyMethod(methods[idx])
        except:
            msg = qt.QMessageBox(self)
            msg.setIcon(qt.QMessageBox.Critical)
            msg.setWindowTitle("Plugin error")
            msg.setText("An error has occured while executing the plugin:")
            msg.setInformativeText(str(sys.exc_info()[1]))
            msg.setDetailedText(traceback.format_exc())
            msg.exec_()
示例#26
0
 def __maximizeMenu(self):
     self._setListMode(MenuItem.TextMode)
     self._help.setIcon(qt.QIcon())
     self._help.setText(self._helpText)
示例#27
0
    def initToolbar(self):
        self.loadAction = qt.QAction(
            qt.QIcon(os.path.join(self.iconDir, "icon-load-proj.png")),
            "Load project (Ctrl+O)", self)
        self.loadAction.setShortcut('Ctrl+O')
        self.loadAction.triggered.connect(self.slotLoadProject)

        self.saveAction = qt.QAction(
            qt.QIcon(os.path.join(self.iconDir, "icon-save-proj.png")),
            "Save project, data and plots (Ctrl+S)", self)
        self.saveAction.setShortcut('Ctrl+S')
        self.saveAction.triggered.connect(self.slotSaveProject)
        self.saveAction.setEnabled(False)

        self.undoAction = qt.QAction(
            qt.QIcon(os.path.join(self.iconDir, "icon-undo.png")),
            "Undo last action (Ctrl+Z)", self)
        self.undoAction.setShortcut('Ctrl+Z')
        self.undoAction.triggered.connect(partial(self.slotUndo, -1))
        undoMenu = qt.QMenu()
        subAction = qt.QAction('group sequential changes of same parameter',
                               self)
        subAction.setCheckable(True)
        subAction.setChecked(csi.undoGrouping)
        subAction.triggered.connect(self.undoGroup)
        undoMenu.addAction(subAction)
        undoMenu.addSeparator()
        undoMenu.nHeaderActions = len(undoMenu.actions())
        self.undoAction.setMenu(undoMenu)
        menu = self.undoAction.menu()
        menu.aboutToShow.connect(partial(self.populateUndoMenu, menu))

        self.redoAction = qt.QAction(
            qt.QIcon(os.path.join(self.iconDir, "icon-redo.png")),
            "Redo last undone action (Ctrl+Shift+Z)", self)
        self.redoAction.setShortcut('Ctrl+Shift+Z')
        self.redoAction.triggered.connect(partial(self.slotRedo, -1))
        redoMenu = qt.QMenu()
        self.redoAction.setMenu(redoMenu)
        menu = self.redoAction.menu()
        menu.aboutToShow.connect(partial(self.populateRedoMenu, menu))
        self.setEnableUredoRedo()

        infoAction = qt.QAction(
            qt.QIcon(os.path.join(self.iconDir, "icon-info.png")),
            "About ParSeq…", self)
        infoAction.setShortcut('Ctrl+I')
        infoAction.triggered.connect(self.slotAbout)

        helpAction = qt.QAction(
            qt.QIcon(os.path.join(self.iconDir, "icon-help.png")), "Help…",
            self)
        helpAction.setShortcut('Ctrl+?')
        helpAction.triggered.connect(self.slotAbout)

        self.toolbar = self.addToolBar("Toolbar")
        self.toolbar.setIconSize(qt.QSize(32, 32))
        self.toolbar.addAction(self.loadAction)
        self.toolbar.addAction(self.saveAction)
        self.toolbar.addSeparator()
        self.toolbar.addAction(self.undoAction)
        self.toolbar.addAction(self.redoAction)
        self.toolbar.addSeparator()
        self.toolbar.addAction(infoAction)
        self.toolbar.addAction(helpAction)
示例#28
0
        """Clear the zoom history of the plot"""
        self.plot._limitsHistory.clear()

    def clear_graph(self):
        for idx in range(10):
            _submit(self.plot.removeCurve, "Data " + str(idx))


if __name__ == '__main__':
    warnings.filterwarnings("ignore",
                            message="invalid value encountered in log")
    warnings.filterwarnings("ignore",
                            message="divide by zero encountered in log")
    warnings.filterwarnings(
        "ignore", message="divide by zero encountered in double_scalars")

    font = qt.QFont()
    font.setFamily('DejaVu Sans')
    font.setPointSize(10)

    app = qt.QApplication([])
    app.setFont(font)
    viewer = DataViewer()
    viewer.setWindowIcon(qt.QIcon('icon/viewer.png'))

    mon = qt.QDesktopWidget().screenGeometry(0)
    viewer.move(mon.left(), mon.top())
    viewer.resize(2400, 1300)
    viewer.show()
    sys.exit(app.exec_())
示例#29
0
 def _setColor(self, qColor):
     button = self.findChild(qt.QToolButton)
     pixmap = qt.QPixmap(32, 32)
     pixmap.fill(qColor)
     button.setIcon(qt.QIcon(pixmap))
     self.__color = qColor
示例#30
0
        try:
            main.dataViewerProc.kill()
        except:
            ...


main = Main(RE=RE,
            plan_funcs=[
                exafs_scan, multi_exafs_scan_with_cleanup,
                fly_scan_with_cleanup, scan, tweak_custom,
                delay_scan_with_cleanup, bpp.monitor_during_wrapper, bp.fly,
                mv_and_wait, bps.wait, bps.mv, stop_and_mv, sleep_and_count
            ],
            db=db,
            dets=[scaler, preset_time, I0, It, If, Ir],
            motors=[dcm, dcm.energy, dcm.theta, dcm_etc, dcm_etc.theta2, slit],
            devices=[
                I0_amp, It_amp, If_amp, Ir_amp, ENC_fly_counter,
                I0_fly_counter, It_fly_counter, If_fly_counter, Ir_fly_counter,
                energyFlyer, accelerator
            ])

mon = qt.QDesktopWidget().screenGeometry(1)

main.move(mon.left(), mon.top())
main.setWindowIcon(qt.QIcon('icon/control.png'))
main.closed.connect(quit)

main.show()