Ejemplo n.º 1
0
    def show_message_menu(self, id):
        message = self.get_message(id)
        folder = self.get_folder(message["folder"])

        menu = qMenu(folder["folder"], is_folder=True)

        if folder["subscribed"]:
            menu.add_option(qMenuOption("u", "Unsubscribe"))
        else:
            menu.add_option(qMenuOption("s", "Subscribe"))

        menu.add_option(qMenuOption("p", "Previous Message"))

        menu.add_option(qMenuOption("x", "eXit"))

        menu_continue = True

        while menu_continue:
            self.print_menu_text(menu, elapsed_time=True)

            c = self.stdscr.getch()

            if c == ord("x"):
                menu_continue = False
            elif c == ord("s"):
                self.subscribe(folder["folder"])
            elif c == ord("u"):
                self.unsubscribe(folder["folder"])
            elif c == ord("?"):
                self.print_menu_help(menu)
            else:
                self.unrecognised_command()
Ejemplo n.º 2
0
    def folder_list_menu(self):
        menu = qMenu("Folders")
        menu.add_option(qMenuOption("a", "All"))
        menu.add_option(qMenuOption("s", "Subscribed"))
        menu.add_option(qMenuOption("x", "eXit"))

        menu_continue = True

        while menu_continue:
            self.print_menu_text(menu)

            c = self.stdscr.getch()

            if c == ord("x"):
                menu_continue = False
            elif c == ord("a"):
                self.print_folder_list(self.get_folders())
                menu_continue = False
            elif c == ord("s"):
                self.print_folder_list(self.get_folders(subscribed_only=True))
                menu_continue = False
            elif c == ord("?"):
                self.print_menu_help(menu)
            else:
                self.unrecognised_command()
Ejemplo n.º 3
0
    def jump_folder_message_menu(self):
        menu = qMenu("Jump")
        menu.add_option(qMenuOption("f", "Folder"))
        menu.add_option(qMenuOption("m", "Message"))
        menu.add_option(qMenuOption("x", "eXit"))

        menu_continue = True

        while menu_continue:
            self.print_menu_text(menu)

            c = self.stdscr.getch()

            if c == ord("x"):
                menu_continue = False
                pass
            elif c == ord("f"):
                self.jump_folder_menu()
                menu_continue = False
            elif c == ord("m"):
                self.jump_message_menu()
                menu_continue = False
            elif c == ord("?"):
                self.print_menu_help(menu)
            else:
                self.unrecognised_command()
                menu_continue = False
Ejemplo n.º 4
0
    def folder_menu(self, folder_name):
        folder = self.get_folder(folder_name)

        if folder["subscribed"]:
            self.show_folder_menu(folder["folder"])
        else:
            menu = qMenu("Subscribe to " + folder["folder"] + "?")
            menu.add_option(qMenuOption("y", "Yes"))
            menu.add_option(qMenuOption("n", "No"))
            menu.add_option(qMenuOption("v", "View only"))

            menu_continue = True

            self.stdscr.addstr("\nYou are not subscribed. Subscribe now? ")
            self.stdscr.addstr("Y", self.colours["yellow_black_bold"])
            self.stdscr.addstr("es, ")
            self.stdscr.addstr("N", self.colours["yellow_black_bold"])
            self.stdscr.addstr("o, ")
            self.stdscr.addstr("V", self.colours["yellow_black_bold"])
            self.stdscr.addstr("iew only: ")
            self.stdscr.refresh()

            while menu_continue:
                c = self.stdscr.getch()

                if c == ord("y"):
                    # Subscribe, then redisplay folder menu
                    menu_continue = False
                    self.subscribe(folder["folder"])
                    self.show_folder_menu(folder["folder"])
                elif c == ord("v"):
                    # Show folder but do not subscribe
                    menu_continue = False
                    self.show_folder_menu(folder["folder"])
                elif c == ord("n"):
                    menu_continue = False
                elif c == ord("?"):
                    self.print_menu_help(menu)
                else:
                    self.unrecognised_command()

                if menu_continue:
                    self.print_menu_text(menu)
Ejemplo n.º 5
0
    def main_menu(self):
        menu = qMenu("Main")
        menu.add_option(qMenuOption("j", "Jump to folder / message"))
        menu.add_option(qMenuOption("l", "List of folders"))
        menu.add_option(qMenuOption("q", "Quit"))

        menu_continue = True

        while menu_continue:
            self.print_menu_text(menu, elapsed_time=True)

            c = self.stdscr.getch()

            if c == ord("q"):
                menu_continue = False
            elif c == ord("l"):
                self.folder_list_menu()
            elif c == ord("j"):
                self.jump_folder_message_menu()
            elif c == ord("?"):
                self.print_menu_help(menu)
            else:
                self.unrecognised_command()