Package GChartWrapper :: Module constants
[hide private]
[frames] | no frames]

Source Code for Module GChartWrapper.constants

  1  import sys 
  2   
3 -def _print(*args):
4 for arg in args: 5 sys.stdout.write('%s '%arg) 6 sys.stdout.write('\n')
7 8 if sys.version.startswith('3'): 9 PY_VER = '3.x' 10 from urllib.parse import quote_plus,parse_qsl 11 from urllib.request import Request, urlopen, urlretrieve 12 from hashlib import sha1 13 new_sha = lambda s: sha1(bytes(s,'utf-8')) 14 else: 15 PY_VER = '2.x' 16 from urllib import quote_plus,urlretrieve 17 from urllib2 import urlopen, Request, URLError, HTTPError 18 from cgi import parse_qsl 19 try: # >= 2.5 20 from hashlib import sha1 as new_sha 21 except ImportError: # < 2.5 22 from sha import new as new_sha 23
24 -def quote(s):
25 try: 26 return quote_plus(s.encode('utf-8'),'+.,:|/?&$=') 27 except: 28 return quote_plus(s,'+.,:|/?&$=')
29
30 -def smart_str(s):
31 try: 32 s = quote(s) 33 except: 34 pass 35 if PY_VER == '2.x': 36 return unicode(s).encode('utf-8') # Py2K 37 return str(s)#.encode('utf-8') # Py3K
38 39 APIPARAMS = ('chxtc', 'chxt', 'chxp', 'chxs', 'chxr', 'chco', 'chtm', 'chld', 40 'chts', 'chtt', 'chxl', 'chd', 'chf', 'chg', 'chl', 'chm', 'chp', 'chs', 41 'cht', 'chls', 'chdlp', 'chds', 'chbh', 'chdl', 'choe', 'chst', 'chma') 42 43 MARKERS = 'acdostvVhxrRbBDF' 44 45 TYPES = ('bvs', 'p3', 'qr', 'lc', 'p', 'bhg', 'pc', 's', 'r', 'rs', 'bvg', 't', 46 'v', 'lxy', 'bhs', 'gom', 'ls') 47 48 IMGATTRS = ('title','alt','align','border','height','width','ismap','longdesc', 49 'usemap','id','class','style','lang','xml:lang','onclick','ondblclick','onmousedown', 50 'onmouseup','onmouseover','onmousemove','onmouseout','onkeypress','onkeydown','onkeyup') 51 52 GEO = ('africa','asia','europe','middle_east','south_america','usa','world') 53 54 TTAGSATTRS = ('label','title','color','line','grid','bar','marker','fill','legend','axes', 55 'encoding','scale','size','type','dataset','img','map','bar_width_spacing', 56 'legend_pos','output_encoding','level_data') 57 58 APIURL = 'http://chart.apis.google.com/chart?' 59 60 COLOR_MAP = { 61 'aliceblue': 'F0F8FF', 62 'antiquewhite': 'FAEBD7', 63 'aqua': '00FFFF', 64 'aquamarine': '7FFFD4', 65 'azure': 'F0FFFF', 66 'beige': 'F5F5DC', 67 'bisque': 'FFE4C4', 68 'black': '000000', 69 'blanchedalmond': 'FFEBCD', 70 'blue': '0000FF', 71 'blueviolet': '8A2BE2', 72 'brown': 'A52A2A', 73 'burlywood': 'DEB887', 74 'cadetblue': '5F9EA0', 75 'chartreuse': '7FFF00', 76 'chocolate': 'D2691E', 77 'coral': 'FF7F50', 78 'cornflowerblue': '6495ED', 79 'cornsilk': 'FFF8DC', 80 'crimson': 'DC143C', 81 'cyan': '00FFFF', 82 'darkblue': '00008B', 83 'darkcyan': '008B8B', 84 'darkgoldenrod': 'B8860B', 85 'darkgray': 'A9A9A9', 86 'darkgreen': '006400', 87 'darkkhaki': 'BDB76B', 88 'darkmagenta': '8B008B', 89 'darkolivegreen': '556B2F', 90 'darkorange': 'FF8C00', 91 'darkorchid': '9932CC', 92 'darkred': '8B0000', 93 'darksalmon': 'E9967A', 94 'darkseagreen': '8FBC8F', 95 'darkslateblue': '483D8B', 96 'darkslategray': '2F4F4F', 97 'darkturquoise': '00CED1', 98 'darkviolet': '9400D3', 99 'deeppink': 'FF1493', 100 'deepskyblue': '00BFFF', 101 'dimgray': '696969', 102 'dodgerblue': '1E90FF', 103 'firebrick': 'B22222', 104 'floralwhite': 'FFFAF0', 105 'forestgreen': '228B22', 106 'fuchsia': 'FF00FF', 107 'gainsboro': 'DCDCDC', 108 'ghostwhite': 'F8F8FF', 109 'gold': 'FFD700', 110 'goldenrod': 'DAA520', 111 'gray': '808080', 112 'green': '008000', 113 'greenyellow': 'ADFF2F', 114 'honeydew': 'F0FFF0', 115 'hotpink': 'FF69B4', 116 'indianred ': 'CD5C5C', 117 'indigo ': '4B0082', 118 'ivory': 'FFFFF0', 119 'khaki': 'F0E68C', 120 'lavender': 'E6E6FA', 121 'lavenderblush': 'FFF0F5', 122 'lawngreen': '7CFC00', 123 'lemonchiffon': 'FFFACD', 124 'lightblue': 'ADD8E6', 125 'lightcoral': 'F08080', 126 'lightcyan': 'E0FFFF', 127 'lightgoldenrodyellow': 'FAFAD2', 128 'lightgrey': 'D3D3D3', 129 'lightgreen': '90EE90', 130 'lightpink': 'FFB6C1', 131 'lightsalmon': 'FFA07A', 132 'lightseagreen': '20B2AA', 133 'lightskyblue': '87CEFA', 134 'lightslategray': '778899', 135 'lightsteelblue': 'B0C4DE', 136 'lightyellow': 'FFFFE0', 137 'lime': '00FF00', 138 'limegreen': '32CD32', 139 'linen': 'FAF0E6', 140 'magenta': 'FF00FF', 141 'maroon': '800000', 142 'mediumaquamarine': '66CDAA', 143 'mediumblue': '0000CD', 144 'mediumorchid': 'BA55D3', 145 'mediumpurple': '9370D8', 146 'mediumseagreen': '3CB371', 147 'mediumslateblue': '7B68EE', 148 'mediumspringgreen': '00FA9A', 149 'mediumturquoise': '48D1CC', 150 'mediumvioletred': 'C71585', 151 'midnightblue': '191970', 152 'mintcream': 'F5FFFA', 153 'mistyrose': 'FFE4E1', 154 'moccasin': 'FFE4B5', 155 'navajowhite': 'FFDEAD', 156 'navy': '000080', 157 'oldlace': 'FDF5E6', 158 'olive': '808000', 159 'olivedrab': '6B8E23', 160 'orange': 'FFA500', 161 'orangered': 'FF4500', 162 'orchid': 'DA70D6', 163 'palegoldenrod': 'EEE8AA', 164 'palegreen': '98FB98', 165 'paleturquoise': 'AFEEEE', 166 'palevioletred': 'D87093', 167 'papayawhip': 'FFEFD5', 168 'peachpuff': 'FFDAB9', 169 'peru': 'CD853F', 170 'pink': 'FFC0CB', 171 'plum': 'DDA0DD', 172 'powderblue': 'B0E0E6', 173 'purple': '800080', 174 'red': 'FF0000', 175 'rosybrown': 'BC8F8F', 176 'royalblue': '4169E1', 177 'saddlebrown': '8B4513', 178 'salmon': 'FA8072', 179 'sandybrown': 'F4A460', 180 'seagreen': '2E8B57', 181 'seashell': 'FFF5EE', 182 'sienna': 'A0522D', 183 'silver': 'C0C0C0', 184 'skyblue': '87CEEB', 185 'slateblue': '6A5ACD', 186 'slategray': '708090', 187 'snow': 'FFFAFA', 188 'springgreen': '00FF7F', 189 'steelblue': '4682B4', 190 'tan': 'D2B48C', 191 'teal': '008080', 192 'thistle': 'D8BFD8', 193 'tomato': 'FF6347', 194 'turquoise': '40E0D0', 195 'violet': 'EE82EE', 196 'wheat': 'F5DEB3', 197 'white': 'FFFFFF', 198 'whitesmoke': 'F5F5F5', 199 'yellow': 'FFFF00', 200 'yellowgreen': '9ACD32' 201 } 202 PIN_TYPES = ('pin_letter','pin_icon','xpin_letter','xpin_icon','spin') 203 PIN_ICONS = ('home', 'home', 'WC', 'WCfemale', 'WCmale', 'accomm', 'airport', 204 'baby', 'bar', 'bicycle', 'bus', 'cafe', 'camping', 'car', 'caution', 'cinema', 205 'computer', 'corporate', 'dollar', 'euro', 'fire', 'flag', 'floral', 'helicopter', 206 'home', 'info', 'landslide', 'legal', 'location', 'locomotive', 'medical', 207 'mobile', 'motorcycle', 'music', 'parking', 'pet', 'petrol', 'phone', 'picnic', 208 'postal', 'pound', 'repair', 'restaurant', 'sail', 'school', 'scissors', 'ship', 209 'shoppingbag', 'shoppingcart', 'ski', 'snack', 'snow', 'sport', 'swim', 'taxi', 210 'train', 'truck', 'wheelchair', 'yen') 211 PIN_SHAPES = ('pin','star','sleft','sright') 212 NOTE_TYPES = ('note_title','note','weather') 213 NOTE_IMAGES = ('arrow_d', 'balloon', 'pinned_c', 'sticky_y', 'taped_y', 'thought') 214 NOTE_WEATHERS = ('clear-night-moon', 'cloudy-heavy', 'cloudy-sunny', 'cloudy', 215 'rain', 'rainy-sunny', 'snow', 'snowflake', 'snowy-sunny', 'sunny-cloudy', 216 'sunny', 'thermometer-cold', 'thermometer-hot', 'thunder', 'windy') 217 BUBBLE_TYPES = ('icon_text_small','icon_text_big','icon_texts_big','texts_big') 218 BUBBLE_SICONS = ('WC', 'WCfemale', 'WCmale', 'accomm', 'airport', 'baby', 'bar', 219 'bicycle', 'bus', 'cafe', 'camping', 'car', 'caution', 'cinema', 'computer', 220 'corporate', 'dollar', 'euro', 'fire', 'flag', 'floral', 'helicopter', 'home', 221 'info', 'landslide', 'legal', 'location', 'locomotive', 'medical', 'mobile', 222 'motorcycle', 'music', 'parking', 'pet', 'petrol', 'phone', 'picnic', 'postal', 223 'pound', 'repair', 'restaurant', 'sail', 'school', 'scissors', 'ship', 'shoppingbag', 224 'shoppingcart', 'ski', 'snack', 'snow', 'sport', 'swim', 'taxi', 'train', 225 'truck', 'wheelchair', 'yen') 226 BUBBLE_LICONS = ('beer', 'bike', 'car', 'house', 'petrol', 'ski', 'snack') 227 LEGEND_POSITIONS = ('b','t','r','l','bv','tv') 228