Beispiel #1
0
 def widgets(self, p):
     QLabel('<p>%s</p><p><i>(%s)</i></p>' % (
         _("Please select the voices for the choir. "
         "Use the letters S, A, T, or B. A hyphen denotes a new staff."),
         _("Tip: For a double choir you can use two choir parts.")), p)
     h = QHBox(p)
     l = QLabel(_("Voicing:"), h)
     self.voicing = QComboBox(True, h)
     l.setBuddy(self.voicing)
     for i in (
         'SA-TB', 'S-A-T-B',
         'SA', 'S-A', 'SS-A',
         'TB', 'T-B', 'TT-B',
         'SS-A-T-B', 'SS-A-TT-B',
         'S-S-A-T-T-B', 'S-S-A-A-T-T-B-B'
         ):
         self.voicing.insertItem(i)
     b = QVButtonGroup(_("Lyrics"), p)
     self.lyrAllSame = QRadioButton(_("All voices same lyrics"), b)
     self.lyrAllSame.setChecked(True)
     QToolTip.add(self.lyrAllSame, _(
         "One set of the same lyrics is placed between all staves."))
     self.lyrEachSame = QRadioButton(_("Every voice same lyrics"), b)
     QToolTip.add(self.lyrEachSame, _(
         "Every voice gets its own lyrics, using the same text as the "
         "other voices."))
     self.lyrEachDiff = QRadioButton(_("Every voice different lyrics"), b)
     QToolTip.add(self.lyrEachDiff, _(
         "Every voice gets a different set of lyrics."))
     self.stanzaWidget(b)
     self.ambitusWidget(p)
Beispiel #2
0
 def __init__(self, parent, callback):
     QPushButton.__init__(self, _("Tap"), parent)
     self.tapTime = 0.0
     def tap():
         self.tapTime, t = time(), self.tapTime
         callback(int(60.0 / (self.tapTime - t)))
     QObject.connect(self, SIGNAL("pressed()"), tap)
     QToolTip.add(self, _("Click this button a few times to set the tempo."))
Beispiel #3
0
 def widgets(self, p):
     super(Organ, self).widgets(p)
     h = QHBox(p)
     l = QLabel(_("Pedal:"), h)
     self.pedalVoices = QSpinBox(0, 4, 1, h)
     l.setBuddy(self.pedalVoices)
     self.pedalVoices.setValue(1)
     QToolTip.add(self.pedalVoices, _(
         "Set to 0 to disable the pedal altogether."))
Beispiel #4
0
 def widgetsTuning(self, p):
     """ Implement widgets related to tuning """
     h = QHBox(p)
     l = QLabel(_("Tuning:"), h)
     self.tuningSel = QComboBox(False, h)
     l.setBuddy(self.tuningSel)
     self.tuningSel.insertItem(_("Default"))
     for t in self.tunings:
         self.tuningSel.insertItem(t[0])
Beispiel #5
0
 def __init__(self, parent):
     QFrame.__init__(self, parent)
     parent.addTab(self, _("Hyphenation"))
     QVBoxLayout(self).setAutoAdd(True)
     QLabel('<p>%s</p>' % htmlescape (_(
         "Paths to search for hyphenation dictionaries of OpenOffice.org, "
         "Scribus, KOffice, etc, one per line. "
         "If you leave out the starting slash, the prefixes from the "
         "KDEDIRS environment variable are prepended.")), self)
     self.pathList = QTextEdit(self)
Beispiel #6
0
 def run(self, preview=False):
     self.preview = preview
     args = ["--pdf", "-o", self.f.basename]
     if preview:
         mode = _("preview mode")
     else:
         mode = _("publish mode")
         args.append("-dno-point-and-click")
     args.append(self.f.ly)
     self._run(args, mode)
Beispiel #7
0
 def widgets(self, p):
     QLabel('<p><i>%s</i></p>' % _(
         "The Lead Sheet provides a staff with chord names above "
         "and lyrics below it. A second staff is optional."), p)
     self.accomp = QCheckBox(_("Add accompaniment staff"), p)
     QToolTip.add(self.accomp, _(
         "Adds an accompaniment staff and also puts an accompaniment "
         "voice in the upper staff."))
     Chords.widgets(self, p)
     _VocalBase.widgets(self, p)
Beispiel #8
0
 def __init__(self, parent):
     QFrame.__init__(self, parent)
     parent.addTab(self, _("Commands"))
     layout = QGridLayout(self)
     self.commands = []
     for name, default, title, lineedit, tooltip in (
         ('lilypond', 'lilypond', "LilyPond:", ExecLineEdit,
             _("Name or full path of the LilyPond program.")),
         ('convert-ly', 'convert-ly', "Convert-ly:", ExecLineEdit,
             _("Name or full path of the convert-ly program.")),
         ('lpr', 'lpr', _("Printcommand:"), ExecArgsLineEdit,
             _("Command to print a PDF file, for example lpr or "
               "kprinter. You may add some arguments, e.g. "
               "lpr -P myprinter.")),
         ('rumor', 'rumor', "Rumor:", ExecLineEdit,
             _("Name or full path of the Rumor program.")),
         ('aconnect', 'aconnect', "Aconnect:", ExecLineEdit,
             _("Name or full path of the aconnect program (part of ALSA, "
               "for MIDI input and playback using Rumor).")),
         ('timidity', 'timidity -iA -B2,8 -Os -EFreverb=0', "Timidity:",
             ExecArgsLineEdit,
             _("Full command to start Timidity (or any other program) "
               "as an ALSA MIDI client.")),
         ('pdftk', 'pdftk', "Pdftk:", ExecLineEdit,
             _("Name or full path of the pdftk program (see %s).") %
                 "www.accesspdf.com/pdftk"),
     ):
         label = QLabel(title, self)
         widget = lineedit(self)
         QToolTip.add(label, tooltip)
         QToolTip.add(widget, tooltip)
         layout.addWidget(label, len(self.commands), 0)
         layout.addWidget(widget, len(self.commands), 1)
         self.commands.append((name, widget, default))
Beispiel #9
0
 def _run(self, args, mode=None):
     if config("preferences")["delete intermediate files"] == "1":
         args.insert(0, "-ddelete-intermediate-files")
     args = [a.encode(sys.getfilesystemencoding() or "utf-8") for a in args]
     self.setArguments(args)
     a = dict(filename=self.f.ly, mode=mode)
     if mode:
         self.log.msg(_("LilyPond [$filename] starting ($mode)...").args(a))
     else:
         self.log.msg(_("LilyPond [$filename] starting...").args(a))
     self.start() or self.log.fail(_("Could not start LilyPond."))
Beispiel #10
0
 def widgets(self, p):
     QLabel('<p>%s <i>(%s)</i></p>' % (
         _("Adjust how many separate voices you want on each staff."),
         _("This is primarily useful when you write polyphonic music "
         "like a fuge.")), p)
     h = QHBox(p)
     l = QLabel(_("Right hand:"), h)
     self.rightVoices = QSpinBox(1, 4, 1, h)
     l.setBuddy(self.rightVoices)
     h = QHBox(p)
     l = QLabel(_("Left hand:"), h)
     self.leftVoices = QSpinBox(1, 4, 1, h)
     l.setBuddy(self.leftVoices)
Beispiel #11
0
    def __init__(self, parent):
        QFrame.__init__(self, parent)
        parent.addTab(self, _("Actions"))
        QVBoxLayout(self).setAutoAdd(True)
        QLabel('<p>%s</p>' % htmlescape (_(
            "Check the actions you want to display (if applicable) after "
            "LilyPond has successfully compiled your document.")), self)

        self.actions = []
        from lilykde.actions import actions
        for name, default, title, tooltip in actions:
            widget = QCheckBox(title, self)
            QToolTip.add(widget, tooltip)
            self.actions.append((name, widget, default))
 def __init__(self, files, log, numFailed=0):
     if files:
         self.numFailed = numFailed
         self.f = File(files[0])
         self.files = files[1:]
         LyJob.__init__(self, self.f, log)
         self._run(['--pdf', self.f.ly])
     else:
         if numFailed:
             log.fail(_("One document failed.",
                        "$count documents failed.",
                        numFailed).args(count = numFailed))
         else:
             log.ok(_("All documents successfully converted."))
         log.setCaption('%s (%s)' % (PROGRAMNAME, _("Finished")))
Beispiel #13
0
 def assignDrums(self, name, node):
     s = DrumMode(self.doc)
     Identifier(s, 'global')
     Newline(s)
     Comment(s, ' '+_("Drums follow here."))
     Newline(s)
     self.assignGeneric(name, node, s)
Beispiel #14
0
    def __init__(self, parent):
        self.p = parent.addPage(_("Titles and Headers"))

        l = QHBoxLayout(self.p)
        # The html view with the score layout example
        t = KTextBrowser(self.p, None, True)
        t.setLinkUnderline(False)
        t.setText(html)
        t.setMinimumWidth(t.contentsWidth() + 10)
        t.setMinimumHeight(t.contentsHeight() + 5)
        l.addWidget(t)
        QObject.connect(t, SIGNAL("urlClick(const QString &)"), self.focus)

        l.addSpacing(6)

        g = QGridLayout(len(headers), 2, 0)
        g.setColSpacing(1, 200)
        l.addLayout(g)

        for c, h in enumerate(headers):
            name, title = h
            l = QLabel(title + ":", self.p)
            e = KLineEdit(self.p, name)
            l.setBuddy(e)
            g.addWidget(l, c, 0)
            g.addWidget(e, c, 1)
            # set completion items
            parent.complete(e)
Beispiel #15
0
 def widgets(self, p):
     h = QHBox(p)
     l = QLabel(_("Staff type:"), h)
     self.staffType = QComboBox(False, h)
     l.setBuddy(self.staffType)
     for i in (
             _("Normal staff"),
             _("Tablature"),
             _("Both"),
         ):
         self.staffType.insertItem(i)
     if self.tunings:
         QObject.connect(self.staffType, SIGNAL("activated(int)"),
             self.slotTabEnable)
         self.widgetsTuning(p)
         self.slotTabEnable(0)
Beispiel #16
0
 def _finish(self):
     self.stdout.close()
     self.stderr.close()
     success = False
     a = dict(filename=self.f.ly, signal=self.exitSignal(), retcode=self.exitStatus())
     if self.signalled():
         self.log.fail(_("LilyPond [$filename] was terminated by signal $signal.").args(a))
     elif self.normalExit():
         if self.exitStatus() != 0:
             self.log.fail(_("LilyPond [$filename] exited with return code $retcode.").args(a))
         else:
             self.log.ok(_("LilyPond [$filename] finished.").args(a))
             success = True
     else:
         self.log.fail(_("LilyPond [$filename] exited abnormally.").args(a))
     self.completed(success)
Beispiel #17
0
 def finish():
     shutil.copy(temp, pdf)
     os.remove(temp)
     log.ok(_(
         "Embedded file %s in PDF.",
         "Embedded files %s in PDF.",
         len(files)
         ) % '[%s]' % ', '.join(files))
Beispiel #18
0
 def assignLyrics(self, name, node, verse = 0):
     l = LyricMode(self.doc)
     if verse:
         name = name + nums(verse)
         Text(l, '\\set stanza = "%d."\n' % verse)
     Comment(l, ' ' + _("Lyrics follow here."))
     Newline(l)
     self.assignGeneric(name, node, l)
Beispiel #19
0
    def widgets(self):
        layout = QGridLayout(self, 18, 5, 2, 0)
        row = 0
        cols = 5

        self.shorthands = QCheckBox(_("Allow shorthands"), self)
        self.shorthands.setChecked(True)
        layout.addMultiCellWidget(self.shorthands, row, row, 0, cols - 1)
        QToolTip.add(self.shorthands, _(
            "Use short notation for some articulations like staccato."))
        row += 1

        h = QHBox(self)
        layout.addMultiCellWidget(h, row, row, 0, cols - 1)
        l = QLabel(_("Direction:"), h)
        self.direction = QComboBox(h)
        for s in (_("Up"), _("Neutral"), _("Down")):
            self.direction.insertItem(s)
        self.direction.setCurrentItem(1)
        l.setBuddy(self.direction)
        QToolTip.add(h, _("The direction to use for the articulations."))
        row += 1

        for title, group in articulation_groups:
            layout.addMultiCellWidget(
                QLabel('<u>%s</u>:' % title, self), row, row, 0, cols - 1)
            row += 1
            col = 0
            for sign, title in group:
                b = QToolButton(self)
                b.setAutoRaise(True)
                b.setIconSet(QIconSet(
                    QPixmap.fromMimeSource('articulation_%s.png' % sign)))
                QToolTip.add(b, '%s (\\%s)' % (title, sign))
                QObject.connect(b, SIGNAL("clicked()"),
                    lambda sign = sign: self.writeSign(sign))
                layout.addWidget(b, row, col)
                col += 1
                if col >= cols:
                    col = 0
                    row += 1
            if col != 0:
                row += 1

        # help text
        l = QLabel("<p><i>%s</i></p><p><i>%s</i></p>" % (
            _("Click an articulation sign to add it to your document."),
            _("If you select some music first, the articulation will "
              "be added to all notes in the selection.")), self)
        l.setMaximumWidth(160)
        layout.addMultiCellWidget(l, row, row + 4, 0, cols - 1)
Beispiel #20
0
 def selFunc():
     text = selectedText()
     if text:
         repl = func(text)
         if repl is not None:
             replaceSelectionWith(repl)
     else:
         sorry(_("Please select some text first."))
Beispiel #21
0
    def __init__(self, parent):
        self.p = parent.addPage(_("Parts"))

        # We have three main panes:
        # all part types (in a treeview),
        # selected parts (in a list view)
        # part settings of the selected part.

        p = QSplitter(self.p)
        QHBoxLayout(self.p).addWidget(p)

        # all parts
        w = QVBox(p)
        QLabel('<b>%s</b>' % _("Available parts:"), w)
        self.all = QListView(w)
        b = KPushButton(KStdGuiItem.add(), w)
        QToolTip.add(b, _("Add selected part to your score."))
        QObject.connect(self.all, SIGNAL(
            "doubleClicked(QListViewItem *, const QPoint &, int)"), self.add)
        QObject.connect(self.all, SIGNAL("clicked(QListViewItem *)"),
            lambda item: item and item.setOpen(not item.isOpen()))
        QObject.connect(b, SIGNAL("clicked()"), self.add)
        self.all.setSorting(-1)
        self.all.setResizeMode(QListView.AllColumns)
        self.all.setSelectionMode(QListView.Extended)
        self.all.setRootIsDecorated(True)
        self.all.addColumn("")
        self.all.header().hide()

        from lilykde.parts import categories
        # reversed because QListView by default inserts new items at the top.
        for name, partTypes in reversed(categories):
            cat = QListViewItem(self.all, name)
            cat.setSelectable(False)
            #cat.setOpen(True)
            for partType in reversed(partTypes):
                part = QListViewItem(cat, partType.name)
                part.partType = partType

        # score
        w = QVBox(p)
        QLabel('<b>%s</b>' % _("Score:"), w)
        self.score = QListBox(w)
        self.score.setSelectionMode(QListBox.Extended)
        QObject.connect(self.score, SIGNAL("highlighted(QListBoxItem*)"),
            self.select)
        w = QHBox(w)
        b = KPushButton(KStdGuiItem.remove(), w)
        QToolTip.add(b, _("Remove selected part from your score."))
        QObject.connect(b, SIGNAL("clicked()"), self.remove)

        up = QToolButton(Qt.UpArrow, w)
        down = QToolButton(Qt.DownArrow, w)
        QToolTip.add(up, _("Move selected part up."))
        QToolTip.add(down, _("Move selected part down."))
        QObject.connect(up, SIGNAL("clicked()"), self.moveUp)
        QObject.connect(down, SIGNAL("clicked()"), self.moveDown)

        # part config
        self.part = QWidgetStack(p)
Beispiel #22
0
def init():
    global version
    lilypond = config("commands").get("lilypond", "lilypond")
    try:
        match = re.search(r"(\d+)\.(\d+)(?:\.(\d+))?", Popen((lilypond, "-v"),
            stdout=PIPE).communicate()[0].splitlines()[0])
    except OSError, e:
        match = None
        error(_("Could not start LilyPond: %s") % e)
Beispiel #23
0
 def setName(self, name):
     """
     Change the name of our part type, both in the Score listbox, and in the
     title of the QVGroupBox with the preferences.
     """
     self.name = name
     self.l.setText(name)
     self.l.listBox().updateItem(self.l) # seems necessary
     self.w.setTitle(_("Configure %s") % name)
Beispiel #24
0
 def __init__(self, parent):
     KDialogBase.__init__(self, KDialogBase.Tabbed,
         "LilyKDE " + _("Score Setup Wizard"),
         KDialogBase.Ok | KDialogBase.Cancel | KDialogBase.Default,
         KDialogBase.Ok, parent, "", False)
     self.completableWidgets = []
     self.titles = Titles(self)
     self.parts = Parts(self)
     self.settings = Settings(self)
     self.loadCompletions()
Beispiel #25
0
def askLanguage():
    """
    Ask the user which language to use.
    Returns None if the user cancels the dialog.
    """
    conf = config("hyphenation")
    lang = conf["lastused"] or ""
    langs = list(sorted(hyphdicts.keys()))
    index = lang in langs and langs.index(lang) or 0
    lang, ok = KInputDialog.getItem(
        _("Language selection"),
        _("Please select a language:"),
        py2qstringlist(langs), index, False,
        editor.topLevelWidget()
    )
    if ok:
        lang = unicode(lang)
        conf["lastused"] = lang
        return lang
Beispiel #26
0
 def saveSettings(self):
     """ Saves the settings to lilykderc """
     conf = config("rumor")
     conf["tempo"] = self.tempo.tempo()
     conf["quantize"] = self.quantize.currentText()
     conf["step"] = int(self.step.isChecked())
     conf["mono"] = int(self.mono.isChecked())
     conf["meter"] = autofy(self.meter.currentText())
     conf["keysig"] = autofy(self.keysig.currentText())
     conf["timidity"] = int(self.timidity.isRunning())
     self.status.message(_("Settings have been saved."), 2000)
Beispiel #27
0
def insertVersion():
    """ insert LilyPond version in the current document """
    global version
    match, pos, length = editor.search("\\version", (0, 0))
    if match:
        sorry(_("Your document has already a LilyPond version statement."))
        editor.setPos(pos)
    else:
        versionLine = '\\version "%d.%d.%d"' % version
        editor.insertLine(0, versionLine)
        editor.setPos(0, len(versionLine))
Beispiel #28
0
 def widgets(self, p):
     h = QHBox(p)
     l = QLabel(_("Voices:"), h)
     self.drumVoices = QSpinBox(1, 4, 1, h)
     l.setBuddy(self.drumVoices)
     QToolTip.add(h, _("How many drum voices to put in this staff."))
     h = QHBox(p)
     l = QLabel(_("Style:"), h)
     self.drumStyle = QComboBox(False, h)
     l.setBuddy(self.drumStyle)
     for i in (
             _("Drums (5 lines, default)"),
             _("Timbales-style (2 lines)"),
             _("Congas-style (2 lines)"),
             _("Bongos-style (2 lines)"),
             _("Percussion-style (1 line)"),
         ):
         self.drumStyle.insertItem(i)
     self.drumStems = QCheckBox(_("Remove stems"), p)
     QToolTip.add(self.drumStems, _("Remove the stems from the drum notes."))
Beispiel #29
0
 def build(self):
     p = FiguredBass(self.doc)
     s = FigureMode(self.doc)
     Identifier(s, 'global')
     Newline(s)
     Comment(s, ' ' + _("Figures follow here."))
     Newline(s)
     self.assignGeneric('figBass', p, s)
     self.addPart(p)
     if self.useExtenderLines.isChecked():
         p.getWith()['useBassFigureExtenders'] = Scheme(self.doc, '#t')
Beispiel #30
0
 def __init__(self, parent):
     self.spinbox = QSpinBox(self.minBPM, self.maxBPM, 1, parent)
     self.slider = QSlider(
         self.minBPM, self.maxBPM, 4, 100, Qt.Horizontal, parent)
     self.tapButton = TapButton(parent, self.tap)
     # setup signals
     QObject.connect(self.slider, SIGNAL("valueChanged(int)"),
         self.spinbox.setValue)
     QObject.connect(self.spinbox, SIGNAL("valueChanged(int)"),
         self.slider.setValue)
     self.slider.setMinimumWidth(200)
     QToolTip.add(self.spinbox, _(
         "The tempo in beats per minute."))