Skip to content

Commit

Permalink
changes for readonly notes
Browse files Browse the repository at this point in the history
  • Loading branch information
radyshenkya committed Oct 23, 2022
1 parent 811610a commit 83e6e87
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions client/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ def open_file(self):

self.update_current_path_label()

self.edit_panel.setVisible(
not self.note.readonly if not self.note is None else True
)

def save_file_as(self):
file_name = QFileDialog.getSaveFileName(
self, "Сохранить как", "", "Markdown Format (*.md);;All Files (*)"
Expand All @@ -62,6 +66,13 @@ def save_file(self):
if self.note is None:
self.save_file_as()
return

if self.note.readonly:
alert_message_box(
"Ошибка!",
"Данная запись предназначена только для чтения. Если вы хотите ее редактировать, нажмите на кнопку SAVE AS.",
)
return
self.note.set_text(self.edit_panel.toPlainText())
self.note.save()

Expand Down

0 comments on commit 83e6e87

Please sign in to comment.