コード例 #1
0
ファイル: amele.py プロジェクト: osa1/amele
    def __init__(self, parent):
        PAbstractBox.__init__(self, parent)

        self._form = Ui_AddCmdDialog()
        self._form.setupUi(self)

        self._animation = 2
        self._duration = 500

        self._shown = False
コード例 #2
0
ファイル: amele.py プロジェクト: osa1/amele
class CmdDialog(PAbstractBox):
    def __init__(self, parent):
        PAbstractBox.__init__(self, parent)

        self._form = Ui_AddCmdDialog()
        self._form.setupUi(self)

        self._animation = 2
        self._duration = 500

        self._shown = False

    def showBox(self, accept=None, reject=None):
        """Call accept/reject methods when dialog accepted/rejected.
        accept method must have 2 arguments, one for format field
        and one for command field."""
        self._shown = True
        self.animate(start=MIDCENTER, stop=MIDCENTER)
        self.accept = accept
        self.reject = reject

    def hideBox(self):
        if self._shown:
            self.animate(start=MIDCENTER, stop=BOTCENTER, direction=OUT)

    def accept(self):
        self.hideBox()
        format = self._form.formatField.text()
        cmd = self._form.cmdField.text()
        self._form.formatField.setText("")
        self._form.cmdField.setText("")
        if self.accept:
            self.accept(format, cmd)

    def reject(self):
        self.hideBox()
        self._form.formatField.setText("")
        self._form.cmdField.setText("")
        if self.reject:
            self.reject()