Rename python-chordpro to igitar
This commit is contained in:
parent
54e0af1915
commit
0d2010d05f
@ -2,7 +2,7 @@
|
||||
from functools import partial
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
from chordpro.renderers.html import get_options, get_option_groups
|
||||
from igitar.renderers.html import get_options, get_option_groups
|
||||
|
||||
from ukatali.util import coerce_bool, convert_units
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import re
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets, Qsci
|
||||
from chordpro.constants import KNOWN_DIRECTIVES, KNOWN_VERSE_TYPES
|
||||
from igitar.constants import KNOWN_DIRECTIVES, KNOWN_VERSE_TYPES
|
||||
|
||||
PALETTE_ROLES = {
|
||||
'window': QtGui.QPalette.WindowText,
|
||||
|
@ -2,8 +2,8 @@
|
||||
from pathlib import Path
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets, QtWebEngineWidgets, Qsci, QtPrintSupport
|
||||
from chordpro import Song
|
||||
from chordpro.renderers.html import render, get_options
|
||||
from igitar import Song
|
||||
from igitar.renderers.html import render, get_options
|
||||
|
||||
from ukatali.configuredialog import ConfigureDialog
|
||||
from ukatali.lexer import ChordProLexer
|
||||
@ -345,13 +345,16 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||
options = self._get_render_options(self.is_lyrics_mode)
|
||||
text = self.file_editor.text()
|
||||
song = Song()
|
||||
try:
|
||||
song.parse(text)
|
||||
return render(song, options, extra_styles)
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
def on_text_changed(self):
|
||||
"""Update the preview when the text changes"""
|
||||
# self.setWindowModified(True)
|
||||
html = self._render_song()
|
||||
if html:
|
||||
self.preview_view.setHtml(html)
|
||||
|
||||
def on_export_pdf_clicked(self):
|
||||
@ -404,9 +407,14 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||
# Export to HTML
|
||||
try:
|
||||
with filename.open('w') as html_file:
|
||||
html_file.write(self._render_song())
|
||||
html = self._render_song()
|
||||
if html:
|
||||
html_file.write(html)
|
||||
QtWidgets.QMessageBox.information(self, 'Export to HTML Successful',
|
||||
'Successfully exported to "{}"'.format(filename.name))
|
||||
else:
|
||||
QtWidgets.QMessageBox.critical(self, 'Error Exporting to HTML',
|
||||
'There was an error while exporting to HTML')
|
||||
except Exception as e:
|
||||
QtWidgets.QMessageBox.critical(self, 'Error Exporting to HTML',
|
||||
'There was an error while exporting to HTML:\n{e}'.format(e=e))
|
||||
|
Loading…
Reference in New Issue
Block a user