Example #1
0
        def _(event):
            handle = None

            if pcs.menu == "sp":
                handle = pcs.sp
                choice = "1"
            elif pcs.menu == "bs":
                handle = pcs.bs
                choice = "2"
            if not handle == None and pcs.menu_lvl in [
                    "1", "2", "1-1", "1-2", "1-3", "1-3-b", "1-3-e", "1-4",
                    "1-4-b", "1-5", "1-m", "1-e"
            ]:
                if pcs.menu_lvl in ["1-m", "1-4-b"]:
                    event.app.editor.focus(BOOKLIST_WINDOW)
                    pcs._event.current_window.buffer.go_to_prev_state()
                    pcs.menu_lvl = pcs.prev_menu_lvl
                    handle.book_repo = pcs._event.current_window.buffer._files
                    handle.total_books = pcs._event.current_window.buffer.prev_total_books

                if pcs.menu_lvl in ["1-3-e", "1-3-b"]:
                    pcs.menu_lvl == "1-3"
                    pcs._event.current_window.buffer.reset()
                    pcs.get_user_input(event.app, pcs.search_menu_lst)

                else:
                    try:
                        event.app.editor.focus(BOOKLIST_WINDOW)
                        pcs._event.current_window.buffer._files = downloaded_files(
                        )
                        pcs._event.current_window.buffer.reset()
                        pcs.choice_selection(event, choice)
                    except Exception as e:
                        event.app.editor.error(' %r ' % e)
Example #2
0
    def __init__(self, name='', text=''):
        BufferBase.__init__(self, name)

        self._text = text
        self._files = downloaded_files()
        self.lvl = 0
        self.index = 0
Example #3
0
 def _(event):
     try:
         event.app.editor.focus(BOOKLIST_WINDOW)
         event.current_window.buffer._files = downloaded_files()
         event.current_window.buffer.reset()
         event.current_window.buffer.emit(EventType.TEXT_CHANGED)
     except Exception as e:
         event.app.editor.error('unknown error %r' % e)
Example #4
0
    def __init__(self, name='', text=''):
        BufferBase.__init__(self, name)

        self._text = text

        #        _files=downloaded_files()
        #        if _files==[]:
        #            self._files=[["No Books in Download"]]
        #        else:
        #            self._files = _files

        self._files = downloaded_files()
        self.lvl = 0
        self.index = 0
Example #5
0
    def _(event):
        #        global pcs
        #        if  not pcs.sp==None and (pcs.menu_lvl=="1-1" or "1-2" or "1-5"):
        if not pcs.sp == None and pcs.menu_lvl in [
                "1-1", "1-2", "1-3", "1-4", "1-4-b", "1-5"
        ]:

            from local_books import downloaded_files

            try:
                pcs._event.current_window.buffer._files = downloaded_files()
                pcs._event.current_window.buffer.reset()
                choice = "1"
                pcs.choice_selection(event, choice)

            except Exception as e:
                event.app.editor.error(' %r ' % e)
Example #6
0
 def _(event):
     handle = None
     if pcs.menu == "sp":
         handle = pcs.sp
         choice = "1"
     elif pcs.menu == "bs":
         handle = pcs.bs
         choice = "2"
     if not handle == None and pcs.menu_lvl in [
             "1-1", "1-2", "1-3", "1-4", "1-4-b", "1-5", "1-m"
     ]:
         if pcs.menu_lvl == "1-m":
             pcs._event.current_window.buffer.go_to_prev_state()
         else:
             from local_books import downloaded_files
             try:
                 pcs._event.current_window.buffer._files = downloaded_files(
                 )
                 pcs._event.current_window.buffer.reset()
                 pcs.choice_selection(event, choice)
             except Exception as e:
                 event.app.editor.error(' %r ' % e)
Example #7
0
        def _(event):
            handle = None
            if pcs.menu == "sp":
                handle = pcs.sp
                choice = "1"
            elif pcs.menu == "bs":
                handle = pcs.bs
                choice = "2"

            if not handle == None and pcs.menu_lvl in ["1-4"]:
                handle.c_page_index = 1
                try:
                    event.app.editor.focus(BOOKLIST_WINDOW)
                    #                    handle.book_repo_temp=handle.book_repo
                    lvl = pcs._event.current_window.buffer.lvl
                    handle.category_name = handle.book_repo[lvl][-1].split(
                        "(")[0].strip()
                    handle.book_repo = []
                    handle.c_book_repo = []
                    #                    pcs._event.current_window.buffer.reset()
                    handle.category_book_search(handle.category_name)
                except Exception as e:
                    event.app.editor.error(' %r ' % e)

            if pcs.menu_lvl in ["1-3-e"]:
                pcs.menu_lvl == "1-3"
                pcs.get_user_input(event.app, pcs.search_menu_lst)

            if not handle == None and pcs.menu_lvl in ["1-e"]:
                #            from local_books import downloaded_files

                try:
                    event.app.editor.focus(BOOKLIST_WINDOW)
                    pcs._event.current_window.buffer._files = downloaded_files(
                    )
                    pcs._event.current_window.buffer.reset()
                    pcs.choice_selection(event, choice)
                except Exception as e:
                    event.app.editor.error(' %r ' % e)

            if not handle == None and pcs.menu_lvl in ["1-m"]:
                #            from local_books import downloaded_files
                try:
                    event.app.editor.focus(BOOKLIST_WINDOW)
                    pcs._event.current_window.buffer.go_to_prev_state()
                    pcs.menu_lvl = pcs.prev_menu_lvl
    ##                pcs._event.current_window.buffer._files= downloaded_files()
    ##                pcs._event.current_window.buffer.reset()
    #                pcs.choice_selection(event, choice)
                except Exception as e:
                    event.app.editor.error(' %r ' % str(e)[0:60])
            if handle == None:
                try:
                    import os
                    current_directory = os.getcwd()
                    _dir = os.path.join(current_directory, r'Downloads')
                    event.app.editor.focus(BOOKLIST_WINDOW)
                    lvl = event.current_window.buffer.lvl
                    f = event.current_window.buffer._files[lvl][0]
                    path = os.path.join(_dir, f)
                    event.current_window.buffer.enter(path)
                except Exception as e:
                    event.app.editor.error(' %r ' % str(e)[0:60])