Skip to content

Commit

Permalink
hide message icon when message length is 0 and not editable
Browse files Browse the repository at this point in the history
  • Loading branch information
sulincix committed Feb 1, 2024
1 parent a1d1612 commit d412c26
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/module/notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,21 @@ def module_init():
loginwindow.o("ui_popover_notes").set_size_request(width/3, height/3)
if get("text-file","","notes") != "":
with open(get("text-file","","notes"),"r") as f:
loginwindow.o("ui_textview_notes").get_buffer().set_text(f.read())
content = f.read().strip()
if len(content) > 0:
loginwindow.o("ui_textview_notes").get_buffer().set_text(content)
else:
loginwindow.o("ui_button_note").hide()
return
loginwindow.o("ui_textview_notes").set_editable(False)
loginwindow.o("ui_textview_notes").set_can_focus(False)
return
loginwindow.o("ui_textview_notes").get_buffer().set_text(gsettings_get("note-text"))
loginwindow.o("ui_textview_notes").set_can_focus(get("editable", True, "notes"))
loginwindow.o("ui_textview_notes").set_editable(get("editable", True, "notes"))
content = gsettings_get("note-text").strip()
editable = get("editable", True, "notes")
if not editable and len(content) == 0:
loginwindow.o("ui_button_note").hide()
return
loginwindow.o("ui_textview_notes").get_buffer().set_text(content)
loginwindow.o("ui_textview_notes").set_can_focus(editable)
loginwindow.o("ui_textview_notes").set_editable(editable)
loginwindow.o("ui_textview_notes").get_buffer().connect("changed", _save_note_text)

0 comments on commit d412c26

Please sign in to comment.