Ejemplo n.º 1
0
 def load(self):
     self._langs = [(language_names.languageName(lang), lang, dic)
                    for lang, dic in findDicts().iteritems()]
     self._langs.sort()
     for name, lang, dic in self._langs:
         self.listWidget.addItem("{0}  ({1})".format(name, lang))
         
     def select():
         lastused = settings().value("lastused", "", type(""))
         if lastused:
             yield lastused
         try:
             lang = locale.getdefaultlocale()[0]
         except ValueError:
             pass
         else:
             yield lang
             yield lang.split('_')[0]
             
     langs = [item[1] for item in self._langs]
     for preselect in select():
         try:
             self.listWidget.setCurrentRow(langs.index(preselect))
             break
         except ValueError:
             continue
Ejemplo n.º 2
0
    def __init__(self, page):
        super(Browser, self).__init__(page)

        layout = QGridLayout()
        self.setLayout(layout)

        self.languagesLabel = QLabel()
        self.languages = QComboBox(currentIndexChanged=self.changed)
        layout.addWidget(self.languagesLabel, 0, 0)
        layout.addWidget(self.languages, 0, 1)

        items = ['', '']
        items.extend(
            language_names.languageName(l, l) for l in lilydoc.translations)
        self.languages.addItems(items)

        self.fontLabel = QLabel()
        self.fontChooser = QFontComboBox(currentFontChanged=self.changed)
        self.fontSize = QSpinBox(valueChanged=self.changed)
        self.fontSize.setRange(6, 32)
        self.fontSize.setSingleStep(1)

        layout.addWidget(self.fontLabel, 1, 0)
        layout.addWidget(self.fontChooser, 1, 1)
        layout.addWidget(self.fontSize, 1, 2)

        app.translateUI(self)
Ejemplo n.º 3
0
 def __init__(self, page):
     super(Browser, self).__init__(page)
     
     layout = QGridLayout()
     self.setLayout(layout)
     
     self.languagesLabel = QLabel()
     self.languages = QComboBox(currentIndexChanged=self.changed)
     layout.addWidget(self.languagesLabel, 0, 0)
     layout.addWidget(self.languages, 0, 1)
     
     items = ['', '']
     items.extend(language_names.languageName(l, l) for l in lilydoc.translations)
     self.languages.addItems(items)
     
     self.fontLabel = QLabel()
     self.fontChooser = QFontComboBox(currentFontChanged=self.changed)
     self.fontSize = QSpinBox(valueChanged=self.changed)
     self.fontSize.setRange(6, 32)
     self.fontSize.setSingleStep(1)
     
     layout.addWidget(self.fontLabel, 1, 0)
     layout.addWidget(self.fontChooser, 1, 1)
     layout.addWidget(self.fontSize, 1, 2)
     
     app.translateUI(self)
Ejemplo n.º 4
0
def credits():
    """Iterating over this should return paragraphs for the credits page."""
    yield _(
        "{appname} is written in {python} and uses the {qt} toolkit.").format(
        appname=info.appname,
        # L10N: the Python programming language
        python='<a href="http://www.python.org/">{0}</a>'.format(_("Python")),
        # L10N: the Qt4 application framework
        qt='<a href="http://qt.nokia.com/">{0}</a>'.format(_("Qt4")))
    yield _(
        "The Music View is powered by the {poppler} library by "
        "{authors} and others.").format(
        poppler='<a href="http://poppler.freedesktop.org/">{0}</a>'.format(
            # L10N: the Poppler PDF library
            _("Poppler")),
        authors='Kristian Høgsberg, Albert Astals Cid')
    yield _(
        "Most of the bundled icons are created by {tango}.").format(
        tango='<a href="http://tango.freedesktop.org/">{0}</a>'.format(_(
            "The Tango Desktop Project")))
    yield _(
        "{appname} is translated into the following languages:").format(
        appname=info.appname)
    lang = QSettings().value("language", "") or None
    langs = [(language_names.languageName(code, lang), names)
             for code, names in info.translators.items()]
    for lang, names in sorted(langs):
        yield lang + ": " + (', '.join(names))
Ejemplo n.º 5
0
def credits():
    """Iterating over this should return paragraphs for the credits page."""
    yield _(
        "{appname} is written in {python} and uses the {qt} toolkit.").format(
        appname=info.appname,
        # L10N: the Python programming language
        python='<a href="http://www.python.org/">{0}</a>'.format(_("Python")),
        # L10N: the Qt4 application framework
        qt='<a href="http://qt.nokia.com/">{0}</a>'.format(_("Qt4")))
    yield _(
        "The Music View is powered by the {poppler} library by "
        "{authors} and others.").format(
        poppler='<a href="http://poppler.freedesktop.org/">{0}</a>'.format(
            # L10N: the Poppler PDF library
            _("Poppler")),
        authors='Kristian Høgsberg, Albert Astals Cid')
    yield _(
        "Most of the bundled icons are created by {tango}.").format(
        tango='<a href="http://tango.freedesktop.org/">{0}</a>'.format(_(
            "The Tango Desktop Project")))
    
    yield _("The following people contributed to {appname}:").format(
        appname=info.appname)
    
    # list other credits here
    def author(name, *contributions):
        return "{author}: {contributions}".format(
            author = name,
            contributions = ", ".join(contributions))
            
    yield author("Richard Cognot", 
        _("Kinetic Scrolling for the Music View"),
        )
    
    yield author("Nicolas Malarmey",
        _("Improved highlighting and auto-completion of Scheme code"),
		)
	
    yield author("Urs Liska",
        _("Various contributions"),
		)
	
    yield author("Christopher Bryan",
        _("Modal Transpose"),
        )
	
    yield author("Peter Bjuhr",
        _("Quick Insert buttons for grace notes"),
        _("MusicXML import"),
        )
	
    # translations
    yield _(
        "{appname} is translated into the following languages:").format(
        appname=info.appname)
    lang = QSettings().value("language", "", type("")) or po.setup.current() or None
    langs = [(language_names.languageName(code, lang), names)
             for code, names in info.translators.items()]
    for lang, names in sorted(langs):
        yield lang + ": " + (', '.join(names))
Ejemplo n.º 6
0
 def translateUI(self):
     self.setTitle(_("Typographical Quotes"))
     self.languageLabel.setText(_("Quotes to use:"))
     self.primaryLabel.setText(_("Primary (double) quotes:"))
     self.secondaryLabel.setText(_("Secondary (single) quotes:"))
     curlang = po.setup.current()
     qformat = "{0}   {1.primary.left} {1.primary.right}    {1.secondary.left} {1.secondary.right}"
     self.languageCombo.setItemText(0, qformat.format(
         _("Current language"), lasptyqu.quotes(curlang) or lasptyqu.default()))
     self.languageCombo.setItemText(1, _("Custom quotes (enter below)"))
     for i, lang in enumerate(self._langs[2:], 2):
         self.languageCombo.setItemText(i, qformat.format(
             language_names.languageName(lang, curlang), lasptyqu.quotes(lang)))
Ejemplo n.º 7
0
 def translateUI(self):
     self.setTitle(_("Typographical Quotes"))
     self.languageLabel.setText(_("Quotes to use:"))
     self.primaryLabel.setText(_("Primary (double) quotes:"))
     self.secondaryLabel.setText(_("Secondary (single) quotes:"))
     curlang = po.setup.current()
     qformat = "{0}   {1.primary.left} {1.primary.right}    {1.secondary.left} {1.secondary.right}"
     self.languageCombo.setItemText(0, qformat.format(
         _("Current language"), lasptyqu.quotes(curlang) or lasptyqu.default()))
     self.languageCombo.setItemText(1, _("Custom quotes (enter below)"))
     for i, lang in enumerate(self._langs[2:], 2):
         self.languageCombo.setItemText(i, qformat.format(
             language_names.languageName(lang, curlang), lasptyqu.quotes(lang)))
Ejemplo n.º 8
0
    def __init__(self, page):
        super(General, self).__init__(page)

        grid = QGridLayout()
        self.setLayout(grid)

        self.langLabel = QLabel()
        self.lang = QComboBox(currentIndexChanged=self.changed)
        grid.addWidget(self.langLabel, 0, 0)
        grid.addWidget(self.lang, 0, 1)

        self.styleLabel = QLabel()
        self.styleCombo = QComboBox(currentIndexChanged=self.changed)
        grid.addWidget(self.styleLabel, 1, 0)
        grid.addWidget(self.styleCombo, 1, 1)

        self.systemIcons = QCheckBox(toggled=self.changed)
        grid.addWidget(self.systemIcons, 2, 0, 1, 3)
        self.tabsClosable = QCheckBox(toggled=self.changed)
        grid.addWidget(self.tabsClosable, 3, 0, 1, 3)
        self.splashScreen = QCheckBox(toggled=self.changed)
        grid.addWidget(self.splashScreen, 4, 0, 1, 3)
        self.allowRemote = QCheckBox(toggled=self.changed)
        grid.addWidget(self.allowRemote, 5, 0, 1, 3)

        grid.setColumnStretch(2, 1)

        # fill in the language combo
        self._langs = ["C", ""]
        self.lang.addItems(('', ''))
        langnames = [(language_names.languageName(lang, lang), lang)
                     for lang in po.available()]
        langnames.sort()
        for name, lang in langnames:
            self._langs.append(lang)
            self.lang.addItem(name)

        # fill in style combo
        self.styleCombo.addItem('')
        self.styleCombo.addItems(QStyleFactory.keys())

        app.translateUI(self)
Ejemplo n.º 9
0
 def __init__(self, page):
     super(General, self).__init__(page)
     
     grid = QGridLayout()
     self.setLayout(grid)
     
     self.langLabel = QLabel()
     self.lang = QComboBox(currentIndexChanged=self.changed)
     grid.addWidget(self.langLabel, 0, 0)
     grid.addWidget(self.lang, 0, 1)
     
     self.styleLabel = QLabel()
     self.styleCombo = QComboBox(currentIndexChanged=self.changed)
     grid.addWidget(self.styleLabel, 1, 0)
     grid.addWidget(self.styleCombo, 1, 1)
     
     self.systemIcons = QCheckBox(toggled=self.changed)
     grid.addWidget(self.systemIcons, 2, 0, 1, 3)
     self.tabsClosable = QCheckBox(toggled=self.changed)
     grid.addWidget(self.tabsClosable, 3, 0, 1, 3)
     self.splashScreen = QCheckBox(toggled=self.changed)
     grid.addWidget(self.splashScreen, 4, 0, 1, 3)
     self.allowRemote = QCheckBox(toggled=self.changed)
     grid.addWidget(self.allowRemote, 5, 0, 1, 3)
     
     grid.setColumnStretch(2, 1)
     
     # fill in the language combo
     self._langs = ["C", ""]
     self.lang.addItems(('', ''))
     langnames = [(language_names.languageName(lang, lang), lang) for lang in po.available()]
     langnames.sort()
     for name, lang in langnames:
         self._langs.append(lang)
         self.lang.addItem(name)
     
     # fill in style combo
     self.styleCombo.addItem('')
     self.styleCombo.addItems(QStyleFactory.keys())
     
     app.translateUI(self)
Ejemplo n.º 10
0
    def load(self):
        current = po.setup.current()
        self._langs = [(language_names.languageName(lang, current), lang, dic)
                       for lang, dic in findDicts().items()]
        self._langs.sort()
        for name, lang, dic in self._langs:
            self.listWidget.addItem("{0}  ({1})".format(name, lang))

        def select():
            lastused = settings().value("lastused", "", str)
            if lastused:
                yield lastused
            lang = po.setup.preferred()[0]
            yield lang
            yield lang.split('_')[0]

        langs = [item[1] for item in self._langs]
        for preselect in select():
            try:
                self.listWidget.setCurrentRow(langs.index(preselect))
                break
            except ValueError:
                continue
Ejemplo n.º 11
0
    def load(self):
        current = po.setup.current()
        self._langs = [(language_names.languageName(lang, current), lang, dic)
                       for lang, dic in findDicts().items()]
        self._langs.sort()
        for name, lang, dic in self._langs:
            self.listWidget.addItem("{0}  ({1})".format(name, lang))

        def select():
            lastused = settings().value("lastused", "", str)
            if lastused:
                yield lastused
            lang = po.setup.preferred()[0]
            yield lang
            yield lang.split('_')[0]

        langs = [item[1] for item in self._langs]
        for preselect in select():
            try:
                self.listWidget.setCurrentRow(langs.index(preselect))
                break
            except ValueError:
                continue
Ejemplo n.º 12
0
def make_page(lang):
    """Makes the HTML user guide for the given language."""

    html = []
    seen = set()

    def add(page, children=None, level=1):
        seen.add(page)
        html.append(
            '<h{1} id="help_{0}"><a name="help_{0}"></a>{2}</h{1}>\n'.format(
                page.name, min(5, level + 1), page.title()))
        html.append(help.helpimpl.markexternal(page.body()))

        if page.seealso():
            html.append('<p>')
            html.append(_("See also:") + " ")
            html.append(', '.join(p.link() for p in page.seealso()))
            html.append('</p>\n')

        for p in children or page.children():
            add(p, None, level + 1)

    set_language(lang)
    page = help.contents.contents
    # toc at start
    children = list(page.children())
    children.insert(0, children.pop())
    add(page, children)

    left = [
        page for page in help.helpimpl.all_pages.values()
        if page not in seen and page.name not in ('nohelp', 'page')
    ]

    # add pages not in the toc structure
    if left:
        html.append('\n\n<hr />\n\n')
        for page in left:
            add(page, None, 2)

    html = ''.join(html)

    # make image links work
    html = images_re.sub(
        lambda m: m.group(1) + 'images/' + images_prefix + m.group(2), html)

    # make help links work
    html = html.replace('<a href="help:', '<a href="#help_')

    others = []
    for l in export_languages:
        if l is not lang:
            others.append('<a href="{0}">{1}</a>'.format(
                make_filename('uguide.html', l),
                "English" if l == "C" else language_names.languageName(l, l),
            ))
    footer = ', '.join(others)
    footer += ' | '
    footer += _("Last Modified: {date}").format(date=time.strftime('%d %b %Y'))

    html = templates.get(lang, templates['C']).format(
        page_title=_("Frescobaldi Manual"),
        page_contents=html,
        page_address=footer)

    filename = os.path.join(output_dir, make_filename('uguide.html', lang))
    print 'Exporting to:', filename
    with open(filename, 'w') as f:
        f.write(html.encode('utf-8'))
Ejemplo n.º 13
0
def make_page(lang):
    """Makes the HTML user guide for the given language."""
    
    html = []
    seen = set()
    
    def add(page, children=None, level=1):
        seen.add(page)
        html.append(
            '<h{1} id="help_{0}"><a name="help_{0}"></a>{2}</h{1}>\n'
            .format(page.name, min(5, level+1), page.title()))
        html.append(help.helpimpl.markexternal(page.body()))
        
        if page.seealso():
            html.append('<p>')
            html.append(_("See also:") + " ")
            html.append(', '.join(p.link() for p in page.seealso()))
            html.append('</p>\n')
        
        for p in children or page.children():
            add(p, None, level+1)

    set_language(lang)
    page = help.contents.contents
    # toc at start
    children = list(page.children())
    children.insert(0, children.pop())
    add(page, children)
    
    left = [page for page in help.helpimpl.all_pages.values()
            if page not in seen and page.name not in ('nohelp', 'page')]
    
    # add pages not in the toc structure
    if left:
        html.append('\n\n<hr />\n\n')
        for page in left:
            add(page, None, 2)
    
    html = ''.join(html)
    
    # make image links work
    html = images_re.sub(
        lambda m: m.group(1) + 'images/' + images_prefix + m.group(2), html)
    
    # make help links work
    html = html.replace('<a href="help:', '<a href="#help_')
    
    others = []
    for l in export_languages:
        if l is not lang:
            others.append('<a href="{0}">{1}</a>'.format(
                make_filename('uguide.html', l),
                "English" if l == "C" else language_names.languageName(l, l),
            ))
    footer = ', '.join(others)
    footer += ' | '
    footer += _("Last Modified: {date}").format(date=time.strftime('%d %b %Y'))
    
    html = templates.get(lang, templates['C']).format(
        page_title = _("Frescobaldi Manual"),
        page_contents = html,
        page_address = footer)
    
    filename = os.path.join(output_dir, make_filename('uguide.html', lang))
    print 'Exporting to:', filename
    with open(filename, 'w') as f:
        f.write(html.encode('utf-8'))
Ejemplo n.º 14
0
 def handle_languagename(self, code):
     """Return a language name in the current language."""
     import po.setup
     import language_names
     return language_names.languageName(code, po.setup.current())
Ejemplo n.º 15
0
 def display(lang):
     if lang == 'C':
         return _("English (untranslated)")
     elif not lang:
         return _("Default")
     return language_names.languageName(lang, po.setup.current())
Ejemplo n.º 16
0
 def display(lang):
     if lang == 'C':
         return _("English (untranslated)")
     elif not lang:
         return _("Default")
     return language_names.languageName(lang, po.setup.current())
Ejemplo n.º 17
0
    def handle_languagename(self, code):
        """Return a language name in the current language."""
        import po.setup
        import language_names

        return language_names.languageName(code, po.setup.current())