# Path: Managers/TypeManager.py
# class TypeManager (object):
# 	def __init__(self, typeIconPath):
# 		self.typeIconPath = typeIconPath
# 		self.types = self.__setup()
# 		
# 	def __setup(self):
# 		with open('types.json') as json_data:
# 			data = json.load(json_data)
# 			types = []
# 			for ty in data:
# 				t = Type()
# 				t.name = ty['name']
# 				t.plural = ty['plural']
# 				if 'aliases' in ty:
# 					t.aliases = ty['aliases']
# 				t.icon = self.__getTypeIconWithName(ty['name'])
# 				types.append(t)
# 			return types
# 			
# 	def __getTypeIconWithName(self, name):
# 		imgPath = os.path.join(os.path.abspath('.'), self.typeIconPath, name+'.png')
# 		if not os.path.exists(imgPath):
# 			imgPath = os.path.join(os.path.abspath('.'), self.typeIconPath, 'Unknown.png')
# 		return ui.Image.named(imgPath)
# 	
# 	def getTypeForName(self, name):
# 		for type in self.types:
# 			if type.name == name:
# 				return type
# 		for type in self.types:
# 			if name in type.aliases:
# 				return type


import os
import sqlite3
import urllib
import requests
import ui
from PIL import Image
from Managers import TypeManager


class WebSearchManager (object):
	def __init__(self, typeIconPath):
		self.docsetFolder = 'Docsets/WebSearch'
		self.docsetIndexFileName = os.path.join(self.docsetFolder, 'WebSearch.db')

# Path: Managers/TypeManager.py
# class TypeManager (object):
# 	def __init__(self, typeIconPath):
# 		self.typeIconPath = typeIconPath
# 		self.types = self.__setup()
# 		
# 	def __setup(self):
# 		with open('types.json') as json_data:
# 			data = json.load(json_data)
# 			types = []
# 			for ty in data:
# 				t = Type()
# 				t.name = ty['name']
# 				t.plural = ty['plural']
# 				if 'aliases' in ty:
# 					t.aliases = ty['aliases']
# 				t.icon = self.__getTypeIconWithName(ty['name'])
# 				types.append(t)
# 			return types
# 			
# 	def __getTypeIconWithName(self, name):
# 		imgPath = os.path.join(os.path.abspath('.'), self.typeIconPath, name+'.png')
# 		if not os.path.exists(imgPath):
# 			imgPath = os.path.join(os.path.abspath('.'), self.typeIconPath, 'Unknown.png')
# 		return ui.Image.named(imgPath)
# 	
# 	def getTypeForName(self, name):
# 		for type in self.types:
# 			if type.name == name:
# 				return type
# 		for type in self.types:
# 			if name in type.aliases:
# 				return type


# Path: Managers/WebSearchManager.py
import os
import sqlite3
import urllib
import requests
import ui
from PIL import Image
from Managers import TypeManager



class WebSearchManager (object):
	def __init__(self, typeIconPath):
		self.docsetFolder = 'Docsets/WebSearch'
		self.docsetIndexFileName = os.path.join(self.docsetFolder, 'WebSearch.db')

		self.typeManager = TypeManager.TypeManager(typeIconPath)