@@ -189,7 +189,7 @@ def rgb2hex(r, g, b):
|
189 | 189 | [sg.Multiline(font=(DEFAULT_FONT_NAME, 12),
|
190 | 190 | size=(WINDOW_WIDTH, WINDOW_HEIGHT),
|
191 | 191 | 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), |
193 | 193 | pad=(0, 0), text_color='white', relief=sg.RELIEF_FLAT,
|
194 | 194 | justification='right', visible=True, key='status_bar')]]
|
195 | 195 |
|
@@ -219,7 +219,7 @@ def open_file() -> str:
|
219 | 219 | try:
|
220 | 220 | file_name = sg.popup_get_file('Open File', no_window=True)
|
221 | 221 | except: # pylint: disable=bare-except
|
222 |
| -return |
| 222 | +return '' |
223 | 223 | if file_name not in (None, '') and not isinstance(file_name, tuple):
|
224 | 224 | with open(file_name, 'r') as f:
|
225 | 225 | WINDOW['-BODY-'].update(value=f.read())
|
@@ -238,7 +238,7 @@ def save_file(file_name: str):
|
238 | 238 | WINDOW['-FILE_INFO-'].update(value=file_name)
|
239 | 239 | else:
|
240 | 240 | f.write(text_to_save)
|
241 |
| -
|
| 241 | + |
242 | 242 | # this is needed to control the displaying of the user prompt while closing.
|
243 | 243 | # If the user closes the document just before closing the document,
|
244 | 244 | # we do not want to display the prompt for save changes.
|
@@ -363,15 +363,18 @@ def about():
|
363 | 363 | # Get the filename if already saved in the same session.
|
364 | 364 | file_name = WINDOW['-FILE_INFO-'].DisplayText
|
365 | 365 |
|
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: |
367 | 369 | # display a user prompt incase the note is not yet saved asking the
|
368 | 370 | # user 'Do you want to save changes to Untitled?'
|
369 | 371 | user_prompt_msg: str = ''
|
370 | 372 | if file_name == 'New File:':
|
371 | 373 | user_prompt_msg = 'Untitled'
|
372 | 374 | else:
|
373 | 375 | 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 + "?", |
375 | 378 | title='NotepayPy+', modal=True,
|
376 | 379 | icon=APPLICATION_ICON)
|
377 | 380 |
|
@@ -458,13 +461,14 @@ def about():
|
458 | 461 | else:
|
459 | 462 | WINDOW['status_bar'].update(visible=False)
|
460 | 463 | WINDOW['status_bar'].ParentRowFrame.pack_forget()
|
461 |
| -
|
| 464 | + |
462 | 465 | # Re-design the menu layout to show the updated
|
463 | 466 | # toggle effect for show/hide status bar button.
|
464 | 467 | # Supporting Conversation @ https://.com/PySimpleGUI/PySimpleGUI/issues/1510
|
465 | 468 | WINDOW_MENU.Update(show_status_menu_layout)
|
466 | 469 | STATUS_BAR_SWITCH = True
|
467 | 470 |
|
| 471 | +Column += 1 |
468 | 472 | # record the text after each event to ensure the
|
469 | 473 | # file/text is saved.
|
470 | 474 | try:
|
|
0 commit comments