MCPcopy Create free account
hub / github.com/dedsec1121fk/DedSec / main_menu

Function main_menu

Scripts/Developer Base/Smart Notes.py:724–796  ·  view source on GitHub ↗
(stdscr)

Source from the content-addressed store, hash-verified

722
723# Main menu
724def main_menu(stdscr):
725 curses.noecho()
726 curses.cbreak()
727 stdscr.keypad(True)
728 try:
729 curses.curs_set(0)
730 except Exception:
731 pass
732 while True:
733 notes = load_notes()
734 options = ['Add Note','Search Note','Calendar / Reminders','Settings (country/timezone)','Exit']
735 idx = 0
736 try:
737 while True:
738 stdscr.erase()
739 h, w = stdscr.getmaxyx()
740 centered_addstr(stdscr, 1, ' Smart Notes — Termux ')
741 total_h = len(options) * 2
742 start_y = max(3, (h - total_h) // 2)
743 for i, opt in enumerate(options):
744 y = start_y + i*2
745 attr = curses.A_REVERSE if i == idx else 0
746 centered_addstr(stdscr, y, f" {opt} ", attr)
747 stdscr.refresh()
748 ch = stdscr.getch()
749 if ch in (curses.KEY_UP,):
750 idx = (idx - 1) % len(options)
751 elif ch in (curses.KEY_DOWN,):
752 idx = (idx + 1) % len(options)
753 elif ch in (10,13):
754 choice = options[idx]
755 if choice == 'Add Note':
756 add_note_curses(stdscr)
757 break
758 elif choice == 'Search Note':
759 key = curses_search(stdscr, notes)
760 if key:
761 action_for_note(stdscr, key, notes)
762 break
763 elif choice == 'Calendar / Reminders':
764 curses_reminders_menu(stdscr)
765 break
766 elif choice == 'Settings (country/timezone)':
767 sel_country = curses_select_from_list(stdscr, 'Select country (ESC to cancel)', COUNTRIES + ['Custom'])
768 if sel_country is None:
769 break
770 if sel_country == 'Custom':
771 sel_country = curses_input(stdscr, 'Enter country name:')
772 if sel_country is None:
773 break
774 sel_tz = curses_select_from_list(stdscr, 'Select timezone (ESC to cancel)', TIMEZONES + ['Custom'])
775 if sel_tz is None:
776 break
777 if sel_tz == 'Custom':
778 sel_tz = curses_input(stdscr, 'Enter timezone (e.g. Europe/Athens):')
779 if sel_tz is None:
780 break
781 cfg = load_config()

Callers

nothing calls this directly

Calls 11

load_notesFunction · 0.70
centered_addstrFunction · 0.70
add_note_cursesFunction · 0.70
curses_searchFunction · 0.70
action_for_noteFunction · 0.70
curses_reminders_menuFunction · 0.70
curses_select_from_listFunction · 0.70
curses_inputFunction · 0.70
load_configFunction · 0.70
save_configFunction · 0.70
log_exceptionFunction · 0.70

Tested by

no test coverage detected