Ejemplo n.º 1
0
    def __init__(self, parent=None, preamble=PREAMBLE):
        QtGui.QMainWindow.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.parent = parent
        self.preamble = unicode(preamble)
        self.setStatusBar(None)

        self.connect(self.ui.cancelButton, QtCore.SIGNAL("clicked()"), self.slot_cancel)

        self.connect(self.ui.saveButton, QtCore.SIGNAL("clicked()"), self.slot_save)
Ejemplo n.º 2
0
class PreambleWindow(QtGui.QMainWindow):
    """
    PreambleWindow allows for editing of the preamble.
    """

    def __init__(self, parent=None, preamble=PREAMBLE):
        QtGui.QMainWindow.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.parent = parent
        self.preamble = unicode(preamble)
        self.setStatusBar(None)

        self.connect(self.ui.cancelButton, QtCore.SIGNAL("clicked()"), self.slot_cancel)

        self.connect(self.ui.saveButton, QtCore.SIGNAL("clicked()"), self.slot_save)

    def slot_open(self):
        """
        Slot for opening PreambleWindow. It repopulates the window with the
        saved preamble.
        """
        self.preamble = self.parent.preamble
        self.ui.preambleTextEdit.setText(self.preamble)
        self.show()

    def slot_cancel(self):
        """ Slot for cancel button. Closes window without saving. """
        self.close()

    def slot_save(self):
        """
        Slot for save button. It stores the value in the preamble QTextEdit
        window.
        """
        self.preamble = unicode(self.ui.preambleTextEdit.toPlainText())
        self.parent.preamble = self.preamble
        self.close()