Python nltk.compat.HTTPError() Examples

The following are code examples for showing how to use nltk.compat.HTTPError(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

Example 1
Project: razzy-spinner   Author: rafasashi   File: downloader.py    GNU General Public License v3.0 5 votes vote down vote up
def run(self):
        print('NLTK Downloader')
        while True:
            self._simple_interactive_menu(
                'd) Download', 'l) List', ' u) Update', 'c) Config', 'h) Help', 'q) Quit')
            user_input = compat.raw_input('Downloader> ').strip()
            if not user_input: print(); continue
            command = user_input.lower().split()[0]
            args = user_input.split()[1:]
            try:
                if command == 'l':
                    print()
                    self._ds.list(self._ds.download_dir, header=False,
                                  more_prompt=True)
                elif command == 'h':
                    self._simple_interactive_help()
                elif command == 'c':
                    self._simple_interactive_config()
                elif command in ('q', 'x'):
                    return
                elif command == 'd':
                    self._simple_interactive_download(args)
                elif command == 'u':
                    self._simple_interactive_update()
                else:
                    print('Command %r unrecognized' % user_input)
            except compat.HTTPError as e:
                print('Error reading from server: %s'%e)
            except compat.URLError as e:
                print('Error connecting to server: %s'%e.reason)
            # try checking if user_input is a package name, &
            # downloading it?
            print() 
Example 2
Project: razzy-spinner   Author: rafasashi   File: downloader.py    GNU General Public License v3.0 5 votes vote down vote up
def _refresh(self):
        self._ds.clear_status_cache()
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason)
        self._table.select(0) 
Example 3
Project: razzy-spinner   Author: rafasashi   File: downloader.py    GNU General Public License v3.0 5 votes vote down vote up
def _set_download_dir(self, download_dir):
        if self._ds.download_dir == download_dir: return
        # check if the dir exists, and if not, ask if we should create it?

        # Clear our status cache, & re-check what's installed
        self._ds.download_dir = download_dir
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason)
        self._show_info() 
Example 4
Project: razzy-spinner   Author: rafasashi   File: downloader.py    GNU General Public License v3.0 5 votes vote down vote up
def _prev_tab(self, *e):
        for i, tab in enumerate(self._tab_names):
            if tab.lower() == self._tab and i > 0:
                self._tab = self._tab_names[i-1].lower()
                try:
                    return self._fill_table()
                except compat.HTTPError as e:
                    showerror('Error reading from server', e)
                except compat.URLError as e:
                    showerror('Error connecting to server', e.reason) 
Example 5
Project: razzy-spinner   Author: rafasashi   File: downloader.py    GNU General Public License v3.0 5 votes vote down vote up
def _select_tab(self, event):
        self._tab = event.widget['text'].lower()
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason) 
Example 6
Project: OpenBottle   Author: xiaozhuchacha   File: downloader.py    MIT License 5 votes vote down vote up
def run(self):
        print('NLTK Downloader')
        while True:
            self._simple_interactive_menu(
                'd) Download', 'l) List', ' u) Update', 'c) Config', 'h) Help', 'q) Quit')
            user_input = compat.raw_input('Downloader> ').strip()
            if not user_input: print(); continue
            command = user_input.lower().split()[0]
            args = user_input.split()[1:]
            try:
                if command == 'l':
                    print()
                    self._ds.list(self._ds.download_dir, header=False,
                                  more_prompt=True)
                elif command == 'h':
                    self._simple_interactive_help()
                elif command == 'c':
                    self._simple_interactive_config()
                elif command in ('q', 'x'):
                    return
                elif command == 'd':
                    self._simple_interactive_download(args)
                elif command == 'u':
                    self._simple_interactive_update()
                else:
                    print('Command %r unrecognized' % user_input)
            except compat.HTTPError as e:
                print('Error reading from server: %s'%e)
            except compat.URLError as e:
                print('Error connecting to server: %s'%e.reason)
            # try checking if user_input is a package name, &
            # downloading it?
            print() 
Example 7
Project: OpenBottle   Author: xiaozhuchacha   File: downloader.py    MIT License 5 votes vote down vote up
def _refresh(self):
        self._ds.clear_status_cache()
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason)
        self._table.select(0) 
Example 8
Project: OpenBottle   Author: xiaozhuchacha   File: downloader.py    MIT License 5 votes vote down vote up
def _set_download_dir(self, download_dir):
        if self._ds.download_dir == download_dir: return
        # check if the dir exists, and if not, ask if we should create it?

        # Clear our status cache, & re-check what's installed
        self._ds.download_dir = download_dir
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason)
        self._show_info() 
Example 9
Project: OpenBottle   Author: xiaozhuchacha   File: downloader.py    MIT License 5 votes vote down vote up
def _prev_tab(self, *e):
        for i, tab in enumerate(self._tab_names):
            if tab.lower() == self._tab and i > 0:
                self._tab = self._tab_names[i-1].lower()
                try:
                    return self._fill_table()
                except compat.HTTPError as e:
                    showerror('Error reading from server', e)
                except compat.URLError as e:
                    showerror('Error connecting to server', e.reason) 
Example 10
Project: OpenBottle   Author: xiaozhuchacha   File: downloader.py    MIT License 5 votes vote down vote up
def _select_tab(self, event):
        self._tab = event.widget['text'].lower()
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason) 
Example 11
Project: OpenBottle   Author: xiaozhuchacha   File: downloader.py    MIT License 5 votes vote down vote up
def run(self):
        print('NLTK Downloader')
        while True:
            self._simple_interactive_menu(
                'd) Download', 'l) List', ' u) Update', 'c) Config', 'h) Help', 'q) Quit')
            user_input = compat.raw_input('Downloader> ').strip()
            if not user_input: print(); continue
            command = user_input.lower().split()[0]
            args = user_input.split()[1:]
            try:
                if command == 'l':
                    print()
                    self._ds.list(self._ds.download_dir, header=False,
                                  more_prompt=True)
                elif command == 'h':
                    self._simple_interactive_help()
                elif command == 'c':
                    self._simple_interactive_config()
                elif command in ('q', 'x'):
                    return
                elif command == 'd':
                    self._simple_interactive_download(args)
                elif command == 'u':
                    self._simple_interactive_update()
                else:
                    print('Command %r unrecognized' % user_input)
            except compat.HTTPError as e:
                print('Error reading from server: %s'%e)
            except compat.URLError as e:
                print('Error connecting to server: %s'%e.reason)
            # try checking if user_input is a package name, &
            # downloading it?
            print() 
Example 12
Project: OpenBottle   Author: xiaozhuchacha   File: downloader.py    MIT License 5 votes vote down vote up
def _refresh(self):
        self._ds.clear_status_cache()
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason)
        self._table.select(0) 
Example 13
Project: OpenBottle   Author: xiaozhuchacha   File: downloader.py    MIT License 5 votes vote down vote up
def _set_download_dir(self, download_dir):
        if self._ds.download_dir == download_dir: return
        # check if the dir exists, and if not, ask if we should create it?

        # Clear our status cache, & re-check what's installed
        self._ds.download_dir = download_dir
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason)
        self._show_info() 
Example 14
Project: OpenBottle   Author: xiaozhuchacha   File: downloader.py    MIT License 5 votes vote down vote up
def _next_tab(self, *e):
        for i, tab in enumerate(self._tab_names):
            if tab.lower() == self._tab and i < (len(self._tabs)-1):
                self._tab = self._tab_names[i+1].lower()
                try:
                    return self._fill_table()
                except compat.HTTPError as e:
                    showerror('Error reading from server', e)
                except compat.URLError as e:
                    showerror('Error connecting to server', e.reason) 
Example 15
Project: OpenBottle   Author: xiaozhuchacha   File: downloader.py    MIT License 5 votes vote down vote up
def _select_tab(self, event):
        self._tab = event.widget['text'].lower()
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason) 
Example 16
Project: FancyWord   Author: EastonLee   File: downloader.py    GNU General Public License v3.0 5 votes vote down vote up
def run(self):
        print('NLTK Downloader')
        while True:
            self._simple_interactive_menu(
                'd) Download', 'l) List', ' u) Update', 'c) Config', 'h) Help', 'q) Quit')
            user_input = compat.raw_input('Downloader> ').strip()
            if not user_input: print(); continue
            command = user_input.lower().split()[0]
            args = user_input.split()[1:]
            try:
                if command == 'l':
                    print()
                    self._ds.list(self._ds.download_dir, header=False,
                                  more_prompt=True)
                elif command == 'h':
                    self._simple_interactive_help()
                elif command == 'c':
                    self._simple_interactive_config()
                elif command in ('q', 'x'):
                    return
                elif command == 'd':
                    self._simple_interactive_download(args)
                elif command == 'u':
                    self._simple_interactive_update()
                else:
                    print('Command %r unrecognized' % user_input)
            except compat.HTTPError as e:
                print('Error reading from server: %s'%e)
            except compat.URLError as e:
                print('Error connecting to server: %s'%e.reason)
            # try checking if user_input is a package name, &
            # downloading it?
            print() 
Example 17
Project: FancyWord   Author: EastonLee   File: downloader.py    GNU General Public License v3.0 5 votes vote down vote up
def _refresh(self):
        self._ds.clear_status_cache()
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason)
        self._table.select(0) 
Example 18
Project: FancyWord   Author: EastonLee   File: downloader.py    GNU General Public License v3.0 5 votes vote down vote up
def _set_download_dir(self, download_dir):
        if self._ds.download_dir == download_dir: return
        # check if the dir exists, and if not, ask if we should create it?

        # Clear our status cache, & re-check what's installed
        self._ds.download_dir = download_dir
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason)
        self._show_info() 
Example 19
Project: FancyWord   Author: EastonLee   File: downloader.py    GNU General Public License v3.0 5 votes vote down vote up
def _prev_tab(self, *e):
        for i, tab in enumerate(self._tab_names):
            if tab.lower() == self._tab and i > 0:
                self._tab = self._tab_names[i-1].lower()
                try:
                    return self._fill_table()
                except compat.HTTPError as e:
                    showerror('Error reading from server', e)
                except compat.URLError as e:
                    showerror('Error connecting to server', e.reason) 
Example 20
Project: FancyWord   Author: EastonLee   File: downloader.py    GNU General Public License v3.0 5 votes vote down vote up
def _select_tab(self, event):
        self._tab = event.widget['text'].lower()
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason) 
Example 21
Project: honours_project   Author: JFriel   File: downloader.py    GNU General Public License v3.0 5 votes vote down vote up
def run(self):
        print('NLTK Downloader')
        while True:
            self._simple_interactive_menu(
                'd) Download', 'l) List', ' u) Update', 'c) Config', 'h) Help', 'q) Quit')
            user_input = compat.raw_input('Downloader> ').strip()
            if not user_input: print(); continue
            command = user_input.lower().split()[0]
            args = user_input.split()[1:]
            try:
                if command == 'l':
                    print()
                    self._ds.list(self._ds.download_dir, header=False,
                                  more_prompt=True)
                elif command == 'h':
                    self._simple_interactive_help()
                elif command == 'c':
                    self._simple_interactive_config()
                elif command in ('q', 'x'):
                    return
                elif command == 'd':
                    self._simple_interactive_download(args)
                elif command == 'u':
                    self._simple_interactive_update()
                else:
                    print('Command %r unrecognized' % user_input)
            except compat.HTTPError as e:
                print('Error reading from server: %s'%e)
            except compat.URLError as e:
                print('Error connecting to server: %s'%e.reason)
            # try checking if user_input is a package name, &
            # downloading it?
            print() 
Example 22
Project: honours_project   Author: JFriel   File: downloader.py    GNU General Public License v3.0 5 votes vote down vote up
def _refresh(self):
        self._ds.clear_status_cache()
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason)
        self._table.select(0) 
Example 23
Project: honours_project   Author: JFriel   File: downloader.py    GNU General Public License v3.0 5 votes vote down vote up
def _set_download_dir(self, download_dir):
        if self._ds.download_dir == download_dir: return
        # check if the dir exists, and if not, ask if we should create it?

        # Clear our status cache, & re-check what's installed
        self._ds.download_dir = download_dir
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason)
        self._show_info() 
Example 24
Project: honours_project   Author: JFriel   File: downloader.py    GNU General Public License v3.0 5 votes vote down vote up
def _prev_tab(self, *e):
        for i, tab in enumerate(self._tab_names):
            if tab.lower() == self._tab and i > 0:
                self._tab = self._tab_names[i-1].lower()
                try:
                    return self._fill_table()
                except compat.HTTPError as e:
                    showerror('Error reading from server', e)
                except compat.URLError as e:
                    showerror('Error connecting to server', e.reason) 
Example 25
Project: honours_project   Author: JFriel   File: downloader.py    GNU General Public License v3.0 5 votes vote down vote up
def _select_tab(self, event):
        self._tab = event.widget['text'].lower()
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason) 
Example 26
Project: honours_project   Author: JFriel   File: downloader.py    GNU General Public License v3.0 5 votes vote down vote up
def run(self):
        print('NLTK Downloader')
        while True:
            self._simple_interactive_menu(
                'd) Download', 'l) List', ' u) Update', 'c) Config', 'h) Help', 'q) Quit')
            user_input = compat.raw_input('Downloader> ').strip()
            if not user_input: print(); continue
            command = user_input.lower().split()[0]
            args = user_input.split()[1:]
            try:
                if command == 'l':
                    print()
                    self._ds.list(self._ds.download_dir, header=False,
                                  more_prompt=True)
                elif command == 'h':
                    self._simple_interactive_help()
                elif command == 'c':
                    self._simple_interactive_config()
                elif command in ('q', 'x'):
                    return
                elif command == 'd':
                    self._simple_interactive_download(args)
                elif command == 'u':
                    self._simple_interactive_update()
                else:
                    print('Command %r unrecognized' % user_input)
            except compat.HTTPError as e:
                print('Error reading from server: %s'%e)
            except compat.URLError as e:
                print('Error connecting to server: %s'%e.reason)
            # try checking if user_input is a package name, &
            # downloading it?
            print() 
Example 27
Project: honours_project   Author: JFriel   File: downloader.py    GNU General Public License v3.0 5 votes vote down vote up
def _refresh(self):
        self._ds.clear_status_cache()
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason)
        self._table.select(0) 
Example 28
Project: honours_project   Author: JFriel   File: downloader.py    GNU General Public License v3.0 5 votes vote down vote up
def _set_download_dir(self, download_dir):
        if self._ds.download_dir == download_dir: return
        # check if the dir exists, and if not, ask if we should create it?

        # Clear our status cache, & re-check what's installed
        self._ds.download_dir = download_dir
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason)
        self._show_info() 
Example 29
Project: honours_project   Author: JFriel   File: downloader.py    GNU General Public License v3.0 5 votes vote down vote up
def _next_tab(self, *e):
        for i, tab in enumerate(self._tab_names):
            if tab.lower() == self._tab and i < (len(self._tabs)-1):
                self._tab = self._tab_names[i+1].lower()
                try:
                    return self._fill_table()
                except compat.HTTPError as e:
                    showerror('Error reading from server', e)
                except compat.URLError as e:
                    showerror('Error connecting to server', e.reason) 
Example 30
Project: honours_project   Author: JFriel   File: downloader.py    GNU General Public License v3.0 5 votes vote down vote up
def _select_tab(self, event):
        self._tab = event.widget['text'].lower()
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason) 
Example 31
Project: serverless-chatbots-workshop   Author: datteswararao   File: downloader.py    Apache License 2.0 5 votes vote down vote up
def run(self):
        print('NLTK Downloader')
        while True:
            self._simple_interactive_menu(
                'd) Download', 'l) List', ' u) Update', 'c) Config', 'h) Help', 'q) Quit')
            user_input = compat.raw_input('Downloader> ').strip()
            if not user_input: print(); continue
            command = user_input.lower().split()[0]
            args = user_input.split()[1:]
            try:
                if command == 'l':
                    print()
                    self._ds.list(self._ds.download_dir, header=False,
                                  more_prompt=True)
                elif command == 'h':
                    self._simple_interactive_help()
                elif command == 'c':
                    self._simple_interactive_config()
                elif command in ('q', 'x'):
                    return
                elif command == 'd':
                    self._simple_interactive_download(args)
                elif command == 'u':
                    self._simple_interactive_update()
                else:
                    print('Command %r unrecognized' % user_input)
            except compat.HTTPError as e:
                print('Error reading from server: %s'%e)
            except compat.URLError as e:
                print('Error connecting to server: %s'%e.reason)
            # try checking if user_input is a package name, &
            # downloading it?
            print() 
Example 32
Project: serverless-chatbots-workshop   Author: datteswararao   File: downloader.py    Apache License 2.0 5 votes vote down vote up
def _refresh(self):
        self._ds.clear_status_cache()
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason)
        self._table.select(0) 
Example 33
Project: serverless-chatbots-workshop   Author: datteswararao   File: downloader.py    Apache License 2.0 5 votes vote down vote up
def _set_download_dir(self, download_dir):
        if self._ds.download_dir == download_dir: return
        # check if the dir exists, and if not, ask if we should create it?

        # Clear our status cache, & re-check what's installed
        self._ds.download_dir = download_dir
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason)
        self._show_info() 
Example 34
Project: serverless-chatbots-workshop   Author: datteswararao   File: downloader.py    Apache License 2.0 5 votes vote down vote up
def _prev_tab(self, *e):
        for i, tab in enumerate(self._tab_names):
            if tab.lower() == self._tab and i > 0:
                self._tab = self._tab_names[i-1].lower()
                try:
                    return self._fill_table()
                except compat.HTTPError as e:
                    showerror('Error reading from server', e)
                except compat.URLError as e:
                    showerror('Error connecting to server', e.reason) 
Example 35
Project: serverless-chatbots-workshop   Author: datteswararao   File: downloader.py    Apache License 2.0 5 votes vote down vote up
def _select_tab(self, event):
        self._tab = event.widget['text'].lower()
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason) 
Example 36
Project: serverless-chatbots-workshop   Author: datteswararao   File: downloader.py    Apache License 2.0 5 votes vote down vote up
def run(self):
        print('NLTK Downloader')
        while True:
            self._simple_interactive_menu(
                'd) Download', 'l) List', ' u) Update', 'c) Config', 'h) Help', 'q) Quit')
            user_input = compat.raw_input('Downloader> ').strip()
            if not user_input: print(); continue
            command = user_input.lower().split()[0]
            args = user_input.split()[1:]
            try:
                if command == 'l':
                    print()
                    self._ds.list(self._ds.download_dir, header=False,
                                  more_prompt=True)
                elif command == 'h':
                    self._simple_interactive_help()
                elif command == 'c':
                    self._simple_interactive_config()
                elif command in ('q', 'x'):
                    return
                elif command == 'd':
                    self._simple_interactive_download(args)
                elif command == 'u':
                    self._simple_interactive_update()
                else:
                    print('Command %r unrecognized' % user_input)
            except compat.HTTPError as e:
                print('Error reading from server: %s'%e)
            except compat.URLError as e:
                print('Error connecting to server: %s'%e.reason)
            # try checking if user_input is a package name, &
            # downloading it?
            print() 
Example 37
Project: serverless-chatbots-workshop   Author: datteswararao   File: downloader.py    Apache License 2.0 5 votes vote down vote up
def _refresh(self):
        self._ds.clear_status_cache()
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason)
        self._table.select(0) 
Example 38
Project: serverless-chatbots-workshop   Author: datteswararao   File: downloader.py    Apache License 2.0 5 votes vote down vote up
def _set_download_dir(self, download_dir):
        if self._ds.download_dir == download_dir: return
        # check if the dir exists, and if not, ask if we should create it?

        # Clear our status cache, & re-check what's installed
        self._ds.download_dir = download_dir
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason)
        self._show_info() 
Example 39
Project: serverless-chatbots-workshop   Author: datteswararao   File: downloader.py    Apache License 2.0 5 votes vote down vote up
def _next_tab(self, *e):
        for i, tab in enumerate(self._tab_names):
            if tab.lower() == self._tab and i < (len(self._tabs)-1):
                self._tab = self._tab_names[i+1].lower()
                try:
                    return self._fill_table()
                except compat.HTTPError as e:
                    showerror('Error reading from server', e)
                except compat.URLError as e:
                    showerror('Error connecting to server', e.reason) 
Example 40
Project: serverless-chatbots-workshop   Author: datteswararao   File: downloader.py    Apache License 2.0 5 votes vote down vote up
def _select_tab(self, event):
        self._tab = event.widget['text'].lower()
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason) 
Example 41
Project: razzy-spinner   Author: rafasashi   File: downloader.py    GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, dataserver, use_threads=True):
        self._ds = dataserver
        self._use_threads = use_threads

        # For the threaded downloader:
        self._download_lock = threading.Lock()
        self._download_msg_queue = []
        self._download_abort_queue = []
        self._downloading = False

        # For tkinter after callbacks:
        self._afterid = {}

        # A message log.
        self._log_messages = []
        self._log_indent = 0
        self._log('NLTK Downloader Started!')

        # Create the main window.
        top = self.top = Tk()
        top.geometry('+50+50')
        top.title('NLTK Downloader')
        top.configure(background=self._BACKDROP_COLOR[1])

        # Set up some bindings now, in case anything goes wrong.
        top.bind('<Control-q>', self.destroy)
        top.bind('<Control-x>', self.destroy)
        self._destroyed = False

        self._column_vars = {}

        # Initialize the GUI.
        self._init_widgets()
        self._init_menu()
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason)

        self._show_info()
        self._select_columns()
        self._table.select(0)

        # Make sure we get notified when we're destroyed, so we can
        # cancel any download in progress.
        self._table.bind('<Destroy>', self._destroy) 
Example 42
Project: OpenBottle   Author: xiaozhuchacha   File: downloader.py    MIT License 4 votes vote down vote up
def __init__(self, dataserver, use_threads=True):
        self._ds = dataserver
        self._use_threads = use_threads

        # For the threaded downloader:
        self._download_lock = threading.Lock()
        self._download_msg_queue = []
        self._download_abort_queue = []
        self._downloading = False

        # For tkinter after callbacks:
        self._afterid = {}

        # A message log.
        self._log_messages = []
        self._log_indent = 0
        self._log('NLTK Downloader Started!')

        # Create the main window.
        top = self.top = Tk()
        top.geometry('+50+50')
        top.title('NLTK Downloader')
        top.configure(background=self._BACKDROP_COLOR[1])

        # Set up some bindings now, in case anything goes wrong.
        top.bind('<Control-q>', self.destroy)
        top.bind('<Control-x>', self.destroy)
        self._destroyed = False

        self._column_vars = {}

        # Initialize the GUI.
        self._init_widgets()
        self._init_menu()
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason)

        self._show_info()
        self._select_columns()
        self._table.select(0)

        # Make sure we get notified when we're destroyed, so we can
        # cancel any download in progress.
        self._table.bind('<Destroy>', self._destroy) 
Example 43
Project: OpenBottle   Author: xiaozhuchacha   File: downloader.py    MIT License 4 votes vote down vote up
def __init__(self, dataserver, use_threads=True):
        self._ds = dataserver
        self._use_threads = use_threads

        # For the threaded downloader:
        self._download_lock = threading.Lock()
        self._download_msg_queue = []
        self._download_abort_queue = []
        self._downloading = False

        # For tkinter after callbacks:
        self._afterid = {}

        # A message log.
        self._log_messages = []
        self._log_indent = 0
        self._log('NLTK Downloader Started!')

        # Create the main window.
        top = self.top = Tk()
        top.geometry('+50+50')
        top.title('NLTK Downloader')
        top.configure(background=self._BACKDROP_COLOR[1])

        # Set up some bindings now, in case anything goes wrong.
        top.bind('<Control-q>', self.destroy)
        top.bind('<Control-x>', self.destroy)
        self._destroyed = False

        self._column_vars = {}

        # Initialize the GUI.
        self._init_widgets()
        self._init_menu()
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason)

        self._show_info()
        self._select_columns()
        self._table.select(0)

        # Make sure we get notified when we're destroyed, so we can
        # cancel any download in progress.
        self._table.bind('<Destroy>', self._destroy) 
Example 44
Project: FancyWord   Author: EastonLee   File: downloader.py    GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, dataserver, use_threads=True):
        self._ds = dataserver
        self._use_threads = use_threads

        # For the threaded downloader:
        self._download_lock = threading.Lock()
        self._download_msg_queue = []
        self._download_abort_queue = []
        self._downloading = False

        # For tkinter after callbacks:
        self._afterid = {}

        # A message log.
        self._log_messages = []
        self._log_indent = 0
        self._log('NLTK Downloader Started!')

        # Create the main window.
        top = self.top = Tk()
        top.geometry('+50+50')
        top.title('NLTK Downloader')
        top.configure(background=self._BACKDROP_COLOR[1])

        # Set up some bindings now, in case anything goes wrong.
        top.bind('<Control-q>', self.destroy)
        top.bind('<Control-x>', self.destroy)
        self._destroyed = False

        self._column_vars = {}

        # Initialize the GUI.
        self._init_widgets()
        self._init_menu()
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason)

        self._show_info()
        self._select_columns()
        self._table.select(0)

        # Make sure we get notified when we're destroyed, so we can
        # cancel any download in progress.
        self._table.bind('<Destroy>', self._destroy) 
Example 45
Project: honours_project   Author: JFriel   File: downloader.py    GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, dataserver, use_threads=True):
        self._ds = dataserver
        self._use_threads = use_threads

        # For the threaded downloader:
        self._download_lock = threading.Lock()
        self._download_msg_queue = []
        self._download_abort_queue = []
        self._downloading = False

        # For tkinter after callbacks:
        self._afterid = {}

        # A message log.
        self._log_messages = []
        self._log_indent = 0
        self._log('NLTK Downloader Started!')

        # Create the main window.
        top = self.top = Tk()
        top.geometry('+50+50')
        top.title('NLTK Downloader')
        top.configure(background=self._BACKDROP_COLOR[1])

        # Set up some bindings now, in case anything goes wrong.
        top.bind('<Control-q>', self.destroy)
        top.bind('<Control-x>', self.destroy)
        self._destroyed = False

        self._column_vars = {}

        # Initialize the GUI.
        self._init_widgets()
        self._init_menu()
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason)

        self._show_info()
        self._select_columns()
        self._table.select(0)

        # Make sure we get notified when we're destroyed, so we can
        # cancel any download in progress.
        self._table.bind('<Destroy>', self._destroy) 
Example 46
Project: honours_project   Author: JFriel   File: downloader.py    GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, dataserver, use_threads=True):
        self._ds = dataserver
        self._use_threads = use_threads

        # For the threaded downloader:
        self._download_lock = threading.Lock()
        self._download_msg_queue = []
        self._download_abort_queue = []
        self._downloading = False

        # For tkinter after callbacks:
        self._afterid = {}

        # A message log.
        self._log_messages = []
        self._log_indent = 0
        self._log('NLTK Downloader Started!')

        # Create the main window.
        top = self.top = Tk()
        top.geometry('+50+50')
        top.title('NLTK Downloader')
        top.configure(background=self._BACKDROP_COLOR[1])

        # Set up some bindings now, in case anything goes wrong.
        top.bind('<Control-q>', self.destroy)
        top.bind('<Control-x>', self.destroy)
        self._destroyed = False

        self._column_vars = {}

        # Initialize the GUI.
        self._init_widgets()
        self._init_menu()
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason)

        self._show_info()
        self._select_columns()
        self._table.select(0)

        # Make sure we get notified when we're destroyed, so we can
        # cancel any download in progress.
        self._table.bind('<Destroy>', self._destroy) 
Example 47
Project: serverless-chatbots-workshop   Author: datteswararao   File: downloader.py    Apache License 2.0 4 votes vote down vote up
def __init__(self, dataserver, use_threads=True):
        self._ds = dataserver
        self._use_threads = use_threads

        # For the threaded downloader:
        self._download_lock = threading.Lock()
        self._download_msg_queue = []
        self._download_abort_queue = []
        self._downloading = False

        # For tkinter after callbacks:
        self._afterid = {}

        # A message log.
        self._log_messages = []
        self._log_indent = 0
        self._log('NLTK Downloader Started!')

        # Create the main window.
        top = self.top = Tk()
        top.geometry('+50+50')
        top.title('NLTK Downloader')
        top.configure(background=self._BACKDROP_COLOR[1])

        # Set up some bindings now, in case anything goes wrong.
        top.bind('<Control-q>', self.destroy)
        top.bind('<Control-x>', self.destroy)
        self._destroyed = False

        self._column_vars = {}

        # Initialize the GUI.
        self._init_widgets()
        self._init_menu()
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason)

        self._show_info()
        self._select_columns()
        self._table.select(0)

        # Make sure we get notified when we're destroyed, so we can
        # cancel any download in progress.
        self._table.bind('<Destroy>', self._destroy) 
Example 48
Project: serverless-chatbots-workshop   Author: datteswararao   File: downloader.py    Apache License 2.0 4 votes vote down vote up
def __init__(self, dataserver, use_threads=True):
        self._ds = dataserver
        self._use_threads = use_threads

        # For the threaded downloader:
        self._download_lock = threading.Lock()
        self._download_msg_queue = []
        self._download_abort_queue = []
        self._downloading = False

        # For tkinter after callbacks:
        self._afterid = {}

        # A message log.
        self._log_messages = []
        self._log_indent = 0
        self._log('NLTK Downloader Started!')

        # Create the main window.
        top = self.top = Tk()
        top.geometry('+50+50')
        top.title('NLTK Downloader')
        top.configure(background=self._BACKDROP_COLOR[1])

        # Set up some bindings now, in case anything goes wrong.
        top.bind('<Control-q>', self.destroy)
        top.bind('<Control-x>', self.destroy)
        self._destroyed = False

        self._column_vars = {}

        # Initialize the GUI.
        self._init_widgets()
        self._init_menu()
        try:
            self._fill_table()
        except compat.HTTPError as e:
            showerror('Error reading from server', e)
        except compat.URLError as e:
            showerror('Error connecting to server', e.reason)

        self._show_info()
        self._select_columns()
        self._table.select(0)

        # Make sure we get notified when we're destroyed, so we can
        # cancel any download in progress.
        self._table.bind('<Destroy>', self._destroy)