Example #1
0
 def __init__(self, parent, *moduleClasses):
     QFrame.__init__(self, parent)
     layout = QVBoxLayout(self)
     layout.setMargin(4)
     tab = QTabWidget(self)
     tab.setMargin(4)
     defaultsButton = KPushButton(KStdGuiItem.defaults(), self)
     applyButton = KPushButton(KStdGuiItem.apply(), self)
     resetButton = KPushButton(KStdGuiItem.reset(), self)
     layout.addWidget(tab)
     hbox = QHBoxLayout()
     hbox.addWidget(defaultsButton)
     hbox.addStretch(1)
     hbox.addWidget(applyButton)
     hbox.addWidget(resetButton)
     layout.addLayout(hbox)
     self.setMinimumHeight(240)
     self.setMinimumWidth(400)
     QObject.connect(defaultsButton, SIGNAL("clicked()"), self.defaults)
     QObject.connect(applyButton, SIGNAL("clicked()"), self.saveSettings)
     QObject.connect(resetButton, SIGNAL("clicked()"), self.loadSettings)
     # instantiate all modules
     self.modules = [m(tab) for m in moduleClasses]
     self.loadSettings()
Example #2
0
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.setCaption(_("Rumor Settings"))
        layout = QGridLayout(self, 8, 2, 8, 4)
        # MIDI input and output.
        # Get the list of available OSS and ALSA devices
        oslist = [('oss:%d' % i, _("OSS device %d") % i )
            for i in range(getOSSnrMIDIs())]
        i = oslist + parseAconnect('i') + [("keyboard", _("Keyboard"))]
        o = oslist + parseAconnect('o')
        self.ilist, ititles = map(list, zip(*i))
        self.olist, otitles = map(list, zip(*o))

        # input
        layout.addWidget(QLabel(_("MIDI input:"), self), 1, 0)
        self.ibut = QComboBox(self)
        self.ibut.insertStringList(py2qstringlist(ititles))
        QToolTip.add(self.ibut, _("MIDI input to use. Choose 'Keyboard' if "
            "you want to play on the keyboard of your computer."))
        layout.addWidget(self.ibut, 1, 1)

        # output
        layout.addWidget(QLabel(_("MIDI output:"), self), 2, 0)
        self.obut = QComboBox(self)
        self.obut.insertStringList(py2qstringlist(otitles))
        QToolTip.add(self.obut, _("MIDI output to use."))
        layout.addWidget(self.obut, 2, 1)

        # Language
        layout.addWidget(QLabel(_("Language:"), self), 3, 0)
        self.lang = QComboBox(self)
        self.lang.insertStringList(py2qstringlist((
            AUTO, 'ne', 'en', 'en-short', 'de', 'no', 'sv', 'it', 'ca', 'es')))
        QToolTip.add(self.lang, _("The LilyPond language you want Rumor to "
            "output the pitches in."))
        layout.addWidget(self.lang, 3, 1)

        hb = QHBoxLayout()
        layout.addMultiCellLayout(hb, 4, 4, 0, 1)
        # explicit durations
        self.explDur = QCheckBox(_("Explicit durations"), self)
        QToolTip.add(self.explDur, _(
            "Add a duration after every note, even if it is the same as the "
            "preceding note."))
        hb.addWidget(self.explDur)

        # absolute pitches
        self.absPitches = QCheckBox(_("Absolute pitch"), self)
        QToolTip.add(self.absPitches, _(
            "Use absolute pitches instead of relative."))
        hb.addWidget(self.absPitches)

        hb = QHBoxLayout()
        layout.addMultiCellLayout(hb, 5, 5, 0, 1)
        # No Barlines
        self.noBar = QCheckBox(_("No barlines"), self)
        QToolTip.add(self.noBar, _(
            "Filter the barlines out of Rumor's output."))
        hb.addWidget(self.noBar)

        # No dots
        self.noDots = QCheckBox(_("No dots"), self)
        QToolTip.add(self.noDots, _(
            "Do not use dotted notes, but ties instead."))
        hb.addWidget(self.noDots)

        # Legato
        self.legato = QCheckBox(_("Legato"), self)
        QToolTip.add(self.legato, _("Do not use rests, but give all notes "
            "the maximum length."))
        hb.addWidget(self.legato)

        # Strip rests
        self.stripRests = QCheckBox(_("Strip rests"), self)
        QToolTip.add(self.stripRests, _(
            "Strip leading and trialing rests from output."))
        hb.addWidget(self.stripRests)

        layout.addMultiCellWidget(QLabel(_(
            "Guile scripts to load:"), self), 6, 6, 0, 1)

        # Guile scripts listview
        self.scripts = QListView(self)
        self.scripts.addColumn(_("Name"))
        self.scripts.addColumn(_("Description"))
        QToolTip.add(self.scripts, _(
            "Here you can select which Guile scripts you want Rumor to load. "
            "Check \"What's this\" for more information."))
        QWhatsThis.add(self.scripts, _(
            "Here you can select which Guile scripts you want Rumor to load. "
            "You can add your own scripts by putting them in %s. "
            "If the first line of your script starts with a semicolon (;) "
            "that line will be shown as description.") %
                "~/.kde/share/apps/lilykde/rumor/")
        layout.addMultiCellWidget(self.scripts, 7, 7, 0, 1)

        # Ok, Cancel
        hb = QHBoxLayout()
        layout.addLayout(hb, 8,1)
        ok = KPushButton(KStdGuiItem.ok(), self)
        can = KPushButton(KStdGuiItem.cancel(), self)
        QObject.connect(ok, SIGNAL("clicked()"), self.accept)
        QObject.connect(can, SIGNAL("clicked()"), self.reject)
        hb.addWidget(ok)
        hb.addWidget(can)

        self.loadSettings()
        self.exec_loop()