File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -1736,12 +1736,23 @@ def __init_services_tab__(self):
17361736 self .service_line_edit .setEditText ("" )
17371737
17381738 def __init_notes_tab__ (self ):
1739+ self .notes .textChanged .connect (self .__notes_changed )
17391740 try :
17401741 self .notes .setPlainText (self .vm .get_notes ())
17411742 except qubesadmin .exc .QubesException :
17421743 self .notes .setPlainText ("Could not retrieve notes for this qube " )
17431744 self .notes .setEnabled (False )
17441745
1746+ def __notes_changed (self ):
1747+ length = len (self .notes .toPlainText ().encode ())
1748+ self .notes_count .setText (
1749+ "{} / 256000" .format (length )
1750+ )
1751+ self .notes_count .setStyleSheet (
1752+ "" if bool (length < 256000 )
1753+ else "QLabel#notes_count {color: red}"
1754+ )
1755+
17451756 def __apply_notes_tab__ (self ):
17461757 try :
17471758 if self .notes .isEnabled ():
Original file line number Diff line number Diff line change @@ -2022,6 +2022,16 @@ For user reference only.
20222022 </property >
20232023 </widget >
20242024 </item >
2025+ <item >
2026+ <widget class =" QLabel" name =" notes_count" >
2027+ <property name =" text" >
2028+ <string >0 of 256000</string >
2029+ </property >
2030+ <property name =" alignment" >
2031+ <set >Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set >
2032+ </property >
2033+ </widget >
2034+ </item >
20252035 </layout >
20262036 </item >
20272037 </layout >
You can’t perform that action at this time.
0 commit comments