Ejemplo n.º 1
0
 def setupButtons(self) -> None:
     bb = self.form.buttonBox
     ar = QDialogButtonBox.ActionRole
     # add
     self.addButton = bb.addButton(tr.actions_add(), ar)
     qconnect(self.addButton.clicked, self.add_current_note)
     self.addButton.setShortcut(QKeySequence("Ctrl+Return"))
     self.addButton.setToolTip(
         shortcut(tr.adding_add_shortcut_ctrlandenter()))
     # close
     self.closeButton = QPushButton(tr.actions_close())
     self.closeButton.setAutoDefault(False)
     bb.addButton(self.closeButton, QDialogButtonBox.RejectRole)
     # help
     self.helpButton = QPushButton(
         tr.actions_help(), clicked=self.helpRequested)  # type: ignore
     self.helpButton.setAutoDefault(False)
     bb.addButton(self.helpButton, QDialogButtonBox.HelpRole)
     # history
     b = bb.addButton(f"{tr.adding_history()} {downArrow()}", ar)
     if isMac:
         sc = "Ctrl+Shift+H"
     else:
         sc = "Ctrl+H"
     b.setShortcut(QKeySequence(sc))
     b.setToolTip(tr.adding_shortcut(val=shortcut(sc)))
     qconnect(b.clicked, self.onHistory)
     b.setEnabled(False)
     self.historyButton = b
Ejemplo n.º 2
0
    def setupButtons(self) -> None:
        l = self.buttons = QHBoxLayout()
        help = QPushButton(tr.actions_help())
        help.setAutoDefault(False)
        l.addWidget(help)
        qconnect(help.clicked, self.onHelp)
        l.addStretch()
        self.add_field_button = QPushButton(tr.fields_add_field())
        self.add_field_button.setAutoDefault(False)
        l.addWidget(self.add_field_button)
        qconnect(self.add_field_button.clicked, self.onAddField)
        if not self._isCloze():
            flip = QPushButton(tr.card_templates_flip())
            flip.setAutoDefault(False)
            l.addWidget(flip)
            qconnect(flip.clicked, self.onFlip)
        l.addStretch()
        save = QPushButton(tr.actions_save())
        save.setAutoDefault(False)
        save.setShortcut(QKeySequence("Ctrl+Return"))
        l.addWidget(save)
        qconnect(save.clicked, self.accept)

        close = QPushButton(tr.actions_cancel())
        close.setAutoDefault(False)
        l.addWidget(close)
        qconnect(close.clicked, self.reject)