def call_region_window(self): """ Invokes the Region Selection dialog. """ try: country_codes = get_regions() except URLError: error_message = "Unable to retrieve region data from the Battlelog. Please check your network connection." QtGui.QMessageBox.warning(self, "Network Error", error_message) return dialog = RegionDialog(country_codes, self.countries_full) if dialog.exec_(): checked_countries = [] for region in dialog.cc_check_boxes: for check_box in region: if check_box.isChecked(): checked_countries.append(check_box.text()) self.countries_full = checked_countries if len(checked_countries): region_label_text = "Regions: " + ', '.join(checked_countries) self.region_label.setText(region_label_text) self.countries = [y.lower() for x in checked_countries for y, z in COUNTRY.iteritems() if z == x.upper()] else: self.region_label.setText("Region: None") self.countries = []
from __future__ import print_function, division import numpy as np import pandas as pd import thinkstats2 import matplotlib.pyplot as plt import random import string import statsmodels.formula.api as smf from iso_country_codes import COUNTRY for k, v in COUNTRY.items(): COUNTRY[k] = v.title() COUNTRY['RU'] = 'Russia' COUNTRY['GB'] = 'UK' COUNTRY['CZ'] = 'Czech Rep' def get_country(code): return COUNTRY[code] # colors by colorbrewer2.org BLUE1 = '#a6cee3' BLUE2 = '#1f78b4' GREEN1 = '#b2df8a' GREEN2 = '#33a02c'
from __future__ import print_function, division import numpy as np import pandas as pd import thinkstats2 import matplotlib.pyplot as plt import random import string import statsmodels.formula.api as smf from iso_country_codes import COUNTRY for k, v in COUNTRY.items(): COUNTRY[k] = v.title() COUNTRY['RU'] = 'Russia' COUNTRY['GB'] = 'UK' COUNTRY['CZ'] = 'Czech Rep' def get_country(code): return COUNTRY[code] # colors by colorbrewer2.org BLUE1 = '#a6cee3' BLUE2 = '#1f78b4' GREEN1 = '#b2df8a' GREEN2 = '#33a02c' PINK = '#fb9a99' RED = '#e31a1c'