File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def rgb2hex(r, g, b):
189189
[sg.Multiline(font=(DEFAULT_FONT_NAME, 12),
190190
size=(WINDOW_WIDTH, WINDOW_HEIGHT),
191191
key='-BODY-', reroute_cprint=True, enable_events=True)],
192-
[sg.StatusBar(text=f'| Ln{Line},Col{Column}', size=(WINDOW_WIDTH, 1),
192+
[sg.StatusBar(text=f'| Ln {Line}, Col {Column}', size=(WINDOW_WIDTH, 1),
193193
pad=(0, 0), text_color='white', relief=sg.RELIEF_FLAT,
194194
justification='right', visible=True, key='status_bar')]]
195195

@@ -219,7 +219,7 @@ def open_file() -> str:
219219
try:
220220
file_name = sg.popup_get_file('Open File', no_window=True)
221221
except: # pylint: disable=bare-except
222-
return
222+
return ''
223223
if file_name not in (None, '') and not isinstance(file_name, tuple):
224224
with open(file_name, 'r') as f:
225225
WINDOW['-BODY-'].update(value=f.read())
@@ -238,7 +238,7 @@ def save_file(file_name: str):
238238
WINDOW['-FILE_INFO-'].update(value=file_name)
239239
else:
240240
f.write(text_to_save)
241-
241+
242242
# this is needed to control the displaying of the user prompt while closing.
243243
# If the user closes the document just before closing the document,
244244
# we do not want to display the prompt for save changes.
@@ -363,15 +363,18 @@ def about():
363363
# Get the filename if already saved in the same session.
364364
file_name = WINDOW['-FILE_INFO-'].DisplayText
365365

366-
if file_name not in (None, '') and text_to_save.rstrip() != '' and text_last_saved_manually != text_to_save:
366+
if file_name not in (None, '') and \
367+
text_to_save.rstrip() != '' and \
368+
text_last_saved_manually != text_to_save:
367369
# display a user prompt incase the note is not yet saved asking the
368370
# user 'Do you want to save changes to Untitled?'
369371
user_prompt_msg: str = ''
370372
if file_name == 'New File:':
371373
user_prompt_msg = 'Untitled'
372374
else:
373375
user_prompt_msg = file_name
374-
user_prompt_action = sg.popup_yes_no('Do you want to save changes to ' + user_prompt_msg + "?",
376+
user_prompt_action = sg.popup_yes_no('Do you want to save changes to ' +
377+
user_prompt_msg + "?",
375378
title='NotepayPy+', modal=True,
376379
icon=APPLICATION_ICON)
377380

@@ -458,13 +461,14 @@ def about():
458461
else:
459462
WINDOW['status_bar'].update(visible=False)
460463
WINDOW['status_bar'].ParentRowFrame.pack_forget()
461-
464+
462465
# Re-design the menu layout to show the updated
463466
# toggle effect for show/hide status bar button.
464467
# Supporting Conversation @ https://.com/PySimpleGUI/PySimpleGUI/issues/1510
465468
WINDOW_MENU.Update(show_status_menu_layout)
466469
STATUS_BAR_SWITCH = True
467470

471+
Column += 1
468472
# record the text after each event to ensure the
469473
# file/text is saved.
470474
try:

0 commit comments

Comments
 (0)