Exemplo n.º 1
0
    def __init__(self, log_enable=None):
        QtGui.QMenu.__init__(self)
        self.setTitle('Y Axis')

        # range
        self.range = QtGui.QMenu()
        self.range.setTitle('Range')
        self.range_group = QtGui.QActionGroup(self)
        self.range_group.setExclusive(True)
        self.range_auto = QtGui.QAction(
            '&Auto',
            self.range_group,
            checkable=True,
            toolTip=
            'Automatically adjust the y-axis range to show all visible data.')
        self.range_auto.setChecked(True)
        self.range.addAction(self.range_auto)
        self.range_group.addAction(self.range_auto)
        self.range_manual = QtGui.QAction(
            '&Manual',
            self.range_group,
            checkable=True,
            toolTip='Manually zoom and pan the y-axis range.')
        self.range.addAction(self.range_manual)
        self.range_group.addAction(self.range_manual)
        self.addMenu(self.range)

        self.scale = QtGui.QMenu()
        self.scale.setTitle('Scale')
        self.scale_group = QtGui.QActionGroup(self)
        self.scale_group.setExclusive(True)

        self.scale_linear = QtGui.QAction(
            '&Linear',
            self.scale_group,
            checkable=True,
            toolTip='Use a "normal" linear y-axis scale.')
        self.scale_linear.setChecked(True)
        self.scale.addAction(self.scale_linear)
        self.scale_group.addAction(self.scale_linear)

        self.scale_logarithmic = QtGui.QAction(
            'Lo&garithmic',
            self.scale_group,
            checkable=True,
            toolTip='Use a logarithmic y-axis scale.')
        self.scale.addAction(self.scale_logarithmic)
        self.scale_group.addAction(self.scale_logarithmic)
        if log_enable:
            self.addMenu(self.scale)

        self.hide_request = QtGui.QAction('&Hide', self)
        self.hide_request.setToolTip('Hide this signal.')
        self.addAction(self.hide_request)
Exemplo n.º 2
0
    def createActions(self):
        self.addImagesAct = QtGui.QAction("&Add Images...",
                                          self,
                                          shortcut="Ctrl+A",
                                          triggered=self.addImage)

        self.removeAllImagesAct = QtGui.QAction("&Remove All Images",
                                                self,
                                                shortcut="Ctrl+R",
                                                triggered=self.removeAllImages)

        self.exitAct = QtGui.QAction("&Quit",
                                     self,
                                     shortcut="Ctrl+Q",
                                     triggered=self.close)

        self.styleActionGroup = QtGui.QActionGroup(self)
        for styleName in QtGui.QStyleFactory.keys():
            action = QtGui.QAction(self.styleActionGroup,
                                   text="%s Style" % styleName,
                                   checkable=True,
                                   triggered=self.changeStyle)
            action.setData(styleName)

        self.guessModeStateAct = QtGui.QAction("&Guess Image Mode/State",
                                               self,
                                               checkable=True,
                                               checked=True)

        self.aboutAct = QtGui.QAction("&About", self, triggered=self.about)

        self.aboutQtAct = QtGui.QAction("About &Qt",
                                        self,
                                        triggered=QtGui.qApp.aboutQt)
Exemplo n.º 3
0
 def __init__(self):
     loader = QUiLoader()
     filePath = os.path.join(os.path.dirname(__file__), 'bug_426.ui')
     self.widget = loader.load(filePath)
     self.group = QtGui.QActionGroup(self.widget)
     self.widget.show()
     QtCore.QTimer.singleShot(0, self.widget.close)
Exemplo n.º 4
0
    def createActions(self):
        self.newAct = QtGui.QAction("&New", self,
                shortcut=QtGui.QKeySequence.New,
                statusTip="Create a new file", triggered=self.newFile)

        self.openAct = QtGui.QAction("&Open...", self,
                shortcut=QtGui.QKeySequence.Open,
                statusTip="Open an existing file", triggered=self.open)

        self.saveAct = QtGui.QAction("&Save", self,
                shortcut=QtGui.QKeySequence.Save,
                statusTip="Save the document to disk", triggered=self.save)

        self.printAct = QtGui.QAction("&Print...", self,
                shortcut=QtGui.QKeySequence.Print,
                statusTip="Print the document", triggered=self.print_)

        self.exitAct = QtGui.QAction("E&xit", self, shortcut="Ctrl+Q",
                statusTip="Exit the application", triggered=self.close)

        self.undoAct = QtGui.QAction("&Undo", self,
                shortcut=QtGui.QKeySequence.Undo,
                statusTip="Undo the last operation", triggered=self.undo)

        self.redoAct = QtGui.QAction("&Redo", self,
                shortcut=QtGui.QKeySequence.Redo,
                statusTip="Redo the last operation", triggered=self.redo)

        self.cutAct = QtGui.QAction("Cu&t", self,
                shortcut=QtGui.QKeySequence.Cut,
                statusTip="Cut the current selection's contents to the clipboard",
                triggered=self.cut)

        self.copyAct = QtGui.QAction("&Copy", self,
                shortcut=QtGui.QKeySequence.Copy,
                statusTip="Copy the current selection's contents to the clipboard",
                triggered=self.copy)

        self.pasteAct = QtGui.QAction("&Paste", self,
                shortcut=QtGui.QKeySequence.Paste,
                statusTip="Paste the clipboard's contents into the current selection",
                triggered=self.paste)

        self.boldAct = QtGui.QAction("&Bold", self, checkable=True,
                shortcut="Ctrl+B", statusTip="Make the text bold",
                triggered=self.bold)

        boldFont = self.boldAct.font()
        boldFont.setBold(True)
        self.boldAct.setFont(boldFont)

        self.italicAct = QtGui.QAction("&Italic", self, checkable=True,
                shortcut="Ctrl+I", statusTip="Make the text italic",
                triggered=self.italic)

        italicFont = self.italicAct.font()
        italicFont.setItalic(True)
        self.italicAct.setFont(italicFont)

        self.setLineSpacingAct = QtGui.QAction("Set &Line Spacing...", self,
                statusTip="Change the gap between the lines of a paragraph",
                triggered=self.setLineSpacing)

        self.setParagraphSpacingAct = QtGui.QAction(
                "Set &Paragraph Spacing...", self,
                statusTip="Change the gap between paragraphs",
                triggered=self.setParagraphSpacing)

        self.aboutAct = QtGui.QAction("&About", self,
                statusTip="Show the application's About box",
                triggered=self.about)

        self.aboutQtAct = QtGui.QAction("About &Qt", self,
                statusTip="Show the Qt library's About box",
                triggered=self.aboutQt)
        self.aboutQtAct.triggered.connect(QtGui.qApp.aboutQt)

        self.leftAlignAct = QtGui.QAction("&Left Align", self, checkable=True,
                shortcut="Ctrl+L", statusTip="Left align the selected text",
                triggered=self.leftAlign)

        self.rightAlignAct = QtGui.QAction("&Right Align", self,
                checkable=True, shortcut="Ctrl+R",
                statusTip="Right align the selected text",
                triggered=self.rightAlign)

        self.justifyAct = QtGui.QAction("&Justify", self, checkable=True,
                shortcut="Ctrl+J", statusTip="Justify the selected text",
                triggered=self.justify)

        self.centerAct = QtGui.QAction("&Center", self, checkable=True,
                shortcut="Ctrl+C", statusTip="Center the selected text",
                triggered=self.center)

        self.alignmentGroup = QtGui.QActionGroup(self)
        self.alignmentGroup.addAction(self.leftAlignAct)
        self.alignmentGroup.addAction(self.rightAlignAct)
        self.alignmentGroup.addAction(self.justifyAct)
        self.alignmentGroup.addAction(self.centerAct)
        self.leftAlignAct.setChecked(True)