# Path: ss/settings.py
# class Settings(object):
#     DEFAULT_TIMEOUT = 300
#     _LOCK = RLock()
#     def __init__(self):
#     def __getitem__(self, name):
#     def __setitem__(self, name, val):
#     def get(self, name, default=None):
#     def __contains__(self, name):
#     def update(self, config):
#     def dict(self):
#     def __repr__(self):
# 
# Path: ss/utils.py
# PY2 = sys.version_info[0] == 2
# def compat_ord(s):
# def compat_chr(d):
# def to_bytes(s):
# def to_str(s):
# def inet_ntop(family, ipstr):
# def inet_pton(family, addr):
# def is_ip(address):
# def patch_socket():
# def pack_addr(address):
# def errno_from_exception(e):
# def get_sock_error(sock):
# def merge_prefix(deque, size):
# 
# Path: ss/encrypt.py
# CIPHERS_TO_TEST = [
#     'aes-128-cfb',
#     'aes-256-cfb',
#     'rc4-md5',
#     'salsa20',
#     'chacha20',
#     'table',
# ]


import json
import os
import sys
import base64
import tkinter as tk
    import tkMessageBox as messagebox
    import logging
from tkinter import ttk
from functools import partial
from threading import Thread
from ss.settings import settings
from ss import utils
from ss.encrypt import CIPHERS_TO_TEST
    from urllib import urlopen, urlencode
    from tkinter import messagebox
    from urllib.request import urlopen
    from urllib.parse import urlencode
                from ss.config import set_proxy_mode
        from ss.wrapper import onexit_callbacks
        from ss.cli import parse_cli
        from ss.management import run_local
        from ss.ioloop import IOLoop, TIMEOUT_PRECISION
        from ss.watcher import Pac
        self.label = label
        self.widget = widget
        self.bindvar = bindvar

class Event(object):
    def __init__(self, event, callback):
        self.event = event
        self.callback = callback

class Form(object):
    
    def __init__(self):
        self.rows = []
        self._index = {}    # name, position in rows
        super(Form, self).__init__()

    def add_row(self, name, row):
        self._index[name] = len(self.rows)
        self.rows.append( (name, row) )

    def get_bindvar_by_name(self, name):
        index = self._index[name]
        row = self.rows[index]
        return row[1].bindvar

    def get_label_by_name(self, name):
        index = self._index[name]
        row = self.rows[index]
        return row[1].label


# Path: ss/settings.py
# class Settings(object):
#     DEFAULT_TIMEOUT = 300
#     _LOCK = RLock()
#     def __init__(self):
#     def __getitem__(self, name):
#     def __setitem__(self, name, val):
#     def get(self, name, default=None):
#     def __contains__(self, name):
#     def update(self, config):
#     def dict(self):
#     def __repr__(self):
# 
# Path: ss/utils.py
# PY2 = sys.version_info[0] == 2
# def compat_ord(s):
# def compat_chr(d):
# def to_bytes(s):
# def to_str(s):
# def inet_ntop(family, ipstr):
# def inet_pton(family, addr):
# def is_ip(address):
# def patch_socket():
# def pack_addr(address):
# def errno_from_exception(e):
# def get_sock_error(sock):
# def merge_prefix(deque, size):
# 
# Path: ss/encrypt.py
# CIPHERS_TO_TEST = [
#     'aes-128-cfb',
#     'aes-256-cfb',
#     'rc4-md5',
#     'salsa20',
#     'chacha20',
#     'table',
# ]


# Path: ss/gui/app.py
import json
import os
import sys
import base64
import tkinter as tk
    import tkMessageBox as messagebox
    import logging
from tkinter import ttk
from functools import partial
from threading import Thread
from ss.settings import settings
from ss import utils
from ss.encrypt import CIPHERS_TO_TEST
    from urllib import urlopen, urlencode
    from tkinter import messagebox
    from urllib.request import urlopen
    from urllib.parse import urlencode
                from ss.config import set_proxy_mode
        from ss.wrapper import onexit_callbacks
        from ss.cli import parse_cli
        from ss.management import run_local
        from ss.ioloop import IOLoop, TIMEOUT_PRECISION
        from ss.watcher import Pac

        self.label = label
        self.widget = widget
        self.bindvar = bindvar

class Event(object):
    def __init__(self, event, callback):
        self.event = event
        self.callback = callback

class Form(object):
    
    def __init__(self):
        self.rows = []
        self._index = {}    # name, position in rows
        super(Form, self).__init__()

    def add_row(self, name, row):
        self._index[name] = len(self.rows)
        self.rows.append( (name, row) )

    def get_bindvar_by_name(self, name):
        index = self._index[name]
        row = self.rows[index]
        return row[1].bindvar

    def get_label_by_name(self, name):
        index = self._index[name]
        row = self.rows[index]
        return row[1].label


    @property