Compare commits
No commits in common. "ee45264ebdeb954f02f3799809187503c078b625" and "d6b77e13b61eeb22bf7d055202faf2d8c7734555" have entirely different histories.
ee45264ebd
...
d6b77e13b6
@ -183,7 +183,6 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
self.cut_action.triggered.connect(self.file_editor.cut)
|
self.cut_action.triggered.connect(self.file_editor.cut)
|
||||||
self.copy_action.triggered.connect(self.file_editor.copy)
|
self.copy_action.triggered.connect(self.file_editor.copy)
|
||||||
self.paste_action.triggered.connect(self.file_editor.paste)
|
self.paste_action.triggered.connect(self.file_editor.paste)
|
||||||
self.new_action.triggered.connect(self.on_new_clicked)
|
|
||||||
self.open_action.triggered.connect(self.on_open_clicked)
|
self.open_action.triggered.connect(self.on_open_clicked)
|
||||||
self.save_action.triggered.connect(self.on_save_clicked)
|
self.save_action.triggered.connect(self.on_save_clicked)
|
||||||
self.save_as_action.triggered.connect(self.on_save_as_clicked)
|
self.save_as_action.triggered.connect(self.on_save_as_clicked)
|
||||||
@ -196,7 +195,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
|
|
||||||
def retranslate_ui(self):
|
def retranslate_ui(self):
|
||||||
_translate = QtCore.QCoreApplication.translate
|
_translate = QtCore.QCoreApplication.translate
|
||||||
self.setWindowTitle(_translate('MainWindow', 'Untitled') + '[*] - Ukatali')
|
self.setWindowTitle(_translate('MainWindow', 'Ukatali'))
|
||||||
self.file_menu.setTitle(_translate('MainWindow', '&File'))
|
self.file_menu.setTitle(_translate('MainWindow', '&File'))
|
||||||
self.edit_menu.setTitle(_translate('MainWindow', '&Edit'))
|
self.edit_menu.setTitle(_translate('MainWindow', '&Edit'))
|
||||||
self.settings_menu.setTitle(_translate('MainWindow', '&Settings'))
|
self.settings_menu.setTitle(_translate('MainWindow', '&Settings'))
|
||||||
@ -247,19 +246,6 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
self.exit_action.setToolTip(_translate('MainWindow', 'Quit Ukatali'))
|
self.exit_action.setToolTip(_translate('MainWindow', 'Quit Ukatali'))
|
||||||
self.exit_action.setShortcut(_translate('MainWindow', 'Alt+F4'))
|
self.exit_action.setShortcut(_translate('MainWindow', 'Alt+F4'))
|
||||||
|
|
||||||
def on_new_clicked(self):
|
|
||||||
"""Start a new file"""
|
|
||||||
if self.file_editor.isModified() and QtWidgets.QMessageBox.question(self, 'Save file?',
|
|
||||||
'The current file is not saved, do you '
|
|
||||||
'want to save it now?') \
|
|
||||||
== QtWidgets.QMessageBox.Yes:
|
|
||||||
self.on_save_clicked()
|
|
||||||
self.file_editor.setText('')
|
|
||||||
self.file_editor.setModified(False)
|
|
||||||
self.filename = ''
|
|
||||||
self.setWindowTitle('Untitled[*] - Ukatali')
|
|
||||||
self.setWindowModified(False)
|
|
||||||
|
|
||||||
def on_open_clicked(self):
|
def on_open_clicked(self):
|
||||||
"""Open the file"""
|
"""Open the file"""
|
||||||
if self.settings.value('files/last-directory'):
|
if self.settings.value('files/last-directory'):
|
||||||
@ -277,8 +263,6 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
if file_path.exists():
|
if file_path.exists():
|
||||||
self.settings.setValue('files/last-directory', str(file_path.parent))
|
self.settings.setValue('files/last-directory', str(file_path.parent))
|
||||||
self.file_editor.setText(file_path.open().read())
|
self.file_editor.setText(file_path.open().read())
|
||||||
self.setWindowTitle('{}[*] - Ukatali'.format(file_path.name))
|
|
||||||
self.setWindowModified(False)
|
|
||||||
|
|
||||||
def on_save_clicked(self):
|
def on_save_clicked(self):
|
||||||
"""Save the file"""
|
"""Save the file"""
|
||||||
@ -287,8 +271,6 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
else:
|
else:
|
||||||
with open(self.filename, 'w') as fd:
|
with open(self.filename, 'w') as fd:
|
||||||
fd.write(self.file_editor.text())
|
fd.write(self.file_editor.text())
|
||||||
self.setWindowTitle('{}[*] - Ukatali'.format(Path(self.filename).name))
|
|
||||||
self.setWindowModified(False)
|
|
||||||
|
|
||||||
def on_save_as_clicked(self):
|
def on_save_as_clicked(self):
|
||||||
"""Save the file"""
|
"""Save the file"""
|
||||||
@ -342,7 +324,6 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
|
|
||||||
def on_text_changed(self):
|
def on_text_changed(self):
|
||||||
"""Update the preview when the text changes"""
|
"""Update the preview when the text changes"""
|
||||||
# self.setWindowModified(True)
|
|
||||||
html = self._render_song()
|
html = self._render_song()
|
||||||
self.preview_view.setHtml(html)
|
self.preview_view.setHtml(html)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user