We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Maps not properly sized in some cases
Some users get

![geomap](https://cloud.githubusercontent.com/assets/684364/8672710/4290e938-2a31-11e5-88ed-aac5fd26a36c.png)
![geomap](https://cloud.githubusercontent.com/assets/684364/8672721/5ae99bec-2a31-11e5-9441-5166337bc06b.png)

> pognal owgeomap.py file: pokaze svet raztegnjen cez celo sirino okna (visina ni cela), ce zamenjam na europe dobim majhno slikico, po resize-u okna se malo izboljsa (slika 2).

Qt\* version likely not culprit.

cc: @BlazZupan @lanzagar

Maps not properly sized in some cases
Some users get

![geomap](https://cloud.githubusercontent.com/assets/684364/8672710/4290e938-2a31-11e5-88ed-aac5fd26a36c.png)
![geomap](https://cloud.githubusercontent.com/assets/684364/8672721/5ae99bec-2a31-11e5-9441-5166337bc06b.png)

> pognal owgeomap.py file: pokaze svet raztegnjen cez celo sirino okna (visina ni cela), ce zamenjam na europe dobim majhno slikico, po resize-u okna se malo izboljsa (slika 2).

Qt\* version likely not culprit.

cc: @BlazZupan @lanzagar


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `orangecontrib/text/widgets/owgeomap.py`
Content:
```
1 # coding: utf-8
2 from collections import OrderedDict
3 from os import path
4 from math import pi as PI
5 
6 import numpy as np
7 
8 from PyQt4 import QtCore, QtGui
9 
10 from Orange.widgets import widget, gui, settings
11 from Orange.data import Table
12 from orangecontrib.text.country_codes import \
13     CC_EUROPE, INV_CC_EUROPE, SET_CC_EUROPE, \
14     CC_WORLD, INV_CC_WORLD, \
15     CC_USA, INV_CC_USA, SET_CC_USA
16 
17 
18 class Map:
19     WORLD = 'world_mill_en'
20     EUROPE = 'europe_mill_en'
21     USA = 'us_aea_en'
22     all = (('World',  WORLD),
23            ('Europe', EUROPE),
24            ('USA',    USA))
25 
26 
27 class OWGeoMap(widget.OWWidget):
28     name = "GeoMap"
29     priority = 20000
30     icon = "icons/GeoMap.svg"
31     inputs = [("Data", Table, "on_data")]
32     outputs = [('Data', Table)]
33 
34     want_main_area = False
35 
36     selected_attr = settings.Setting(0)
37     selected_map = settings.Setting(0)
38     regions = settings.Setting([])
39 
40     def __init__(self):
41         super().__init__()
42         self._create_layout()
43 
44     @QtCore.pyqtSlot(str, result=str)
45     def region_selected(self, regions):
46         """Called from JavaScript"""
47         if not regions:
48             return self.send('Data', None)
49         self.regions = regions.split(',')
50         from Orange.data.filter import FilterStringList
51         # TODO, FIXME: make this work for discrete attrs also
52         filter = FilterStringList(self.metas[self.selected_attr], self.regions)
53         self.send('Data', self.data._filter_values(filter))
54 
55     def _create_layout(self):
56         box = gui.widgetBox(self.controlArea,
57                             orientation='horizontal')
58         self.attr_combo = gui.comboBox(box, self, 'selected_attr',
59                                        orientation='horizontal',
60                                        label='Region attribute:',
61                                        callback=self.on_attr_change)
62         self.map_combo = gui.comboBox(box, self, 'selected_map',
63                                       orientation='horizontal',
64                                       label='Map type:',
65                                       callback=self.on_map_change,
66                                       items=Map.all)
67         hexpand = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
68                                     QtGui.QSizePolicy.Fixed)
69         self.attr_combo.setSizePolicy(hexpand)
70         self.map_combo.setSizePolicy(hexpand)
71         html = '''
72 <!DOCTYPE html>
73 <html>
74 <head>
75 <meta charset="utf-8">
76 <style>
77 html, body, #map {margin:0px;padding:0px;width:100%;height:100%;}
78 </style>
79 <link  href="resources/jquery-jvectormap-2.0.2.css" rel="stylesheet">
80 </head>
81 <body>
82 <div id="map"></div>
83 </body>
84 </html>'''
85         self.webview = gui.WebviewWidget(self.controlArea, self, debug=True)
86         self.webview.setHtml(html, 'file://{}/'.format(path.dirname(__file__)))
87         for script in ('jquery-2.1.4.min.js',
88                        'jquery-jvectormap-2.0.2.min.js',
89                        'jquery-jvectormap-world-mill-en.js',
90                        'jquery-jvectormap-europe-mill-en.js',
91                        'jquery-jvectormap-us-aea-en.js',
92                        'geomap-script.js'):
93             self.webview.evalJS(open(path.join(path.dirname(__file__), 'resources', script), encoding='utf-8').read())
94         self.webview.evalJS('REGIONS = {};'.format({Map.WORLD: CC_WORLD,
95                                                     Map.EUROPE: CC_EUROPE,
96                                                     Map.USA: CC_USA}))
97 
98     def _repopulate_attr_combo(self, data):
99         from itertools import chain
100         self.metas = [a for a in chain(data.domain.metas,
101                                        data.domain.attributes,
102                                        data.domain.class_vars)
103                       # Filter string variables
104                       if (a.is_discrete and a.values and isinstance(a.values[0], str) and not a.ordered or
105                           a.is_string)] if data else []
106         self.attr_combo.clear()
107         self.selected_attr = 0
108         for i, var in enumerate(self.metas):
109             self.attr_combo.addItem(gui.attributeIconDict[var], var.name)
110             # Select default attribute
111             if var.name.lower() == 'country':
112                 self.selected_attr = i
113         if self.metas:
114             self.attr_combo.setCurrentIndex(self.attr_combo.findText(self.metas[self.selected_attr].name))
115 
116     def on_data(self, data):
117         self.data = data
118         self._repopulate_attr_combo(data)
119         if not data:
120             self.region_selected('')
121             self.webview.evalJS('DATA = {}; renderMap();')
122         else:
123             self.on_attr_change()
124 
125 
126     def on_map_change(self, map_code=''):
127         if map_code:
128             self.map_combo.setCurrentIndex(self.map_combo.findData(map_code))
129         else:
130             map_code = map_code or self.map_combo.itemData(self.selected_map)
131         self.webview.evalJS('MAP_CODE = "{}";'.format(map_code))
132         self.webview.evalJS('SELECTED_REGIONS = {};'.format(self.regions))
133         self.webview.evalJS('renderMap();')
134 
135     def on_attr_change(self):
136         attr = self.metas[self.selected_attr]
137         from collections import Counter, defaultdict
138         counts = Counter(self.data.get_column_view(self.data.domain.index(attr))[0])
139         # Auto-select region map
140         values = set(counts)
141         if 0 == len(values - SET_CC_USA):
142             cc_map, inv_cc_map, map_code = CC_USA, INV_CC_USA, Map.USA
143         elif 0 == len(values - SET_CC_EUROPE):
144             cc_map, inv_cc_map, map_code = CC_EUROPE, INV_CC_EUROPE, Map.EUROPE
145         else:
146             cc_map, inv_cc_map, map_code = CC_WORLD, INV_CC_WORLD, Map.WORLD
147         data = defaultdict(int)
148         for cc in counts:
149             data[inv_cc_map.get(cc, cc)] += counts[cc]
150         self.webview.evalJS('DATA = {};'.format(dict(data)))
151         self.on_map_change(map_code)
152 
153 
154 def main():
155     from Orange.data import Table, Domain, ContinuousVariable, StringVariable
156 
157     words = np.column_stack([
158         'Slovenia Slovenia SVN USA Iraq Iraq Iraq Iraq France FR'.split(),
159         'Slovenia Slovenia SVN France FR Austria NL GB GB GB'.split(),
160         'Alabama AL Texas TX TX TX MS Montana US-MT MT'.split(),
161     ])
162     metas = [
163         StringVariable('World'),
164         StringVariable('Europe'),
165         StringVariable('USA'),
166     ]
167     domain = Domain([], metas=metas)
168     table = Table.from_numpy(domain,
169                              X=np.zeros((len(words), 0)),
170                              metas=words)
171     app = QtGui.QApplication([''])
172     w = OWGeoMap()
173     w.on_data(table)
174     w.show()
175     app.exec()
176 
177 
178 if __name__ == "__main__":
179     main()
180
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/orangecontrib/text/widgets/owgeomap.py b/orangecontrib/text/widgets/owgeomap.py
--- a/orangecontrib/text/widgets/owgeomap.py
+++ b/orangecontrib/text/widgets/owgeomap.py
@@ -73,17 +73,18 @@
 <html>
 <head>
 <meta charset="utf-8">
+<base href="file://{}/"/>
 <style>
-html, body, #map {margin:0px;padding:0px;width:100%;height:100%;}
+html, body, #map {{margin:0px;padding:0px;width:100%;height:100%;}}
 </style>
 <link  href="resources/jquery-jvectormap-2.0.2.css" rel="stylesheet">
 </head>
 <body>
 <div id="map"></div>
 </body>
-</html>'''
+</html>'''.format(path.abspath(path.dirname(__file__)))
         self.webview = gui.WebviewWidget(self.controlArea, self, debug=True)
-        self.webview.setHtml(html, 'file://{}/'.format(path.dirname(__file__)))
+        self.webview.setHtml(html)
         for script in ('jquery-2.1.4.min.js',
                        'jquery-jvectormap-2.0.2.min.js',
                        'jquery-jvectormap-world-mill-en.js',

{"golden_diff": "diff --git a/orangecontrib/text/widgets/owgeomap.py b/orangecontrib/text/widgets/owgeomap.py\n--- a/orangecontrib/text/widgets/owgeomap.py\n+++ b/orangecontrib/text/widgets/owgeomap.py\n@@ -73,17 +73,18 @@\n <html>\n <head>\n <meta charset=\"utf-8\">\n+<base href=\"file://{}/\"/>\n <style>\n-html, body, #map {margin:0px;padding:0px;width:100%;height:100%;}\n+html, body, #map {{margin:0px;padding:0px;width:100%;height:100%;}}\n </style>\n <link  href=\"resources/jquery-jvectormap-2.0.2.css\" rel=\"stylesheet\">\n </head>\n <body>\n <div id=\"map\"></div>\n </body>\n-</html>'''\n+</html>'''.format(path.abspath(path.dirname(__file__)))\n         self.webview = gui.WebviewWidget(self.controlArea, self, debug=True)\n-        self.webview.setHtml(html, 'file://{}/'.format(path.dirname(__file__)))\n+        self.webview.setHtml(html)\n         for script in ('jquery-2.1.4.min.js',\n                        'jquery-jvectormap-2.0.2.min.js',\n                        'jquery-jvectormap-world-mill-en.js',\n", "issue": "Maps not properly sized in some cases\nSome users get\n\n![geomap](https://cloud.githubusercontent.com/assets/684364/8672710/4290e938-2a31-11e5-88ed-aac5fd26a36c.png)\n![geomap](https://cloud.githubusercontent.com/assets/684364/8672721/5ae99bec-2a31-11e5-9441-5166337bc06b.png)\n\n> pognal owgeomap.py file: pokaze svet raztegnjen cez celo sirino okna (visina ni cela), ce zamenjam na europe dobim majhno slikico, po resize-u okna se malo izboljsa (slika 2).\n\nQt\\* version likely not culprit.\n\ncc: @BlazZupan @lanzagar\n\nMaps not properly sized in some cases\nSome users get\n\n![geomap](https://cloud.githubusercontent.com/assets/684364/8672710/4290e938-2a31-11e5-88ed-aac5fd26a36c.png)\n![geomap](https://cloud.githubusercontent.com/assets/684364/8672721/5ae99bec-2a31-11e5-9441-5166337bc06b.png)\n\n> pognal owgeomap.py file: pokaze svet raztegnjen cez celo sirino okna (visina ni cela), ce zamenjam na europe dobim majhno slikico, po resize-u okna se malo izboljsa (slika 2).\n\nQt\\* version likely not culprit.\n\ncc: @BlazZupan @lanzagar\n\n", "before_files": [{"content": "# coding: utf-8\nfrom collections import OrderedDict\nfrom os import path\nfrom math import pi as PI\n\nimport numpy as np\n\nfrom PyQt4 import QtCore, QtGui\n\nfrom Orange.widgets import widget, gui, settings\nfrom Orange.data import Table\nfrom orangecontrib.text.country_codes import \\\n    CC_EUROPE, INV_CC_EUROPE, SET_CC_EUROPE, \\\n    CC_WORLD, INV_CC_WORLD, \\\n    CC_USA, INV_CC_USA, SET_CC_USA\n\n\nclass Map:\n    WORLD = 'world_mill_en'\n    EUROPE = 'europe_mill_en'\n    USA = 'us_aea_en'\n    all = (('World',  WORLD),\n           ('Europe', EUROPE),\n           ('USA',    USA))\n\n\nclass OWGeoMap(widget.OWWidget):\n    name = \"GeoMap\"\n    priority = 20000\n    icon = \"icons/GeoMap.svg\"\n    inputs = [(\"Data\", Table, \"on_data\")]\n    outputs = [('Data', Table)]\n\n    want_main_area = False\n\n    selected_attr = settings.Setting(0)\n    selected_map = settings.Setting(0)\n    regions = settings.Setting([])\n\n    def __init__(self):\n        super().__init__()\n        self._create_layout()\n\n    @QtCore.pyqtSlot(str, result=str)\n    def region_selected(self, regions):\n        \"\"\"Called from JavaScript\"\"\"\n        if not regions:\n            return self.send('Data', None)\n        self.regions = regions.split(',')\n        from Orange.data.filter import FilterStringList\n        # TODO, FIXME: make this work for discrete attrs also\n        filter = FilterStringList(self.metas[self.selected_attr], self.regions)\n        self.send('Data', self.data._filter_values(filter))\n\n    def _create_layout(self):\n        box = gui.widgetBox(self.controlArea,\n                            orientation='horizontal')\n        self.attr_combo = gui.comboBox(box, self, 'selected_attr',\n                                       orientation='horizontal',\n                                       label='Region attribute:',\n                                       callback=self.on_attr_change)\n        self.map_combo = gui.comboBox(box, self, 'selected_map',\n                                      orientation='horizontal',\n                                      label='Map type:',\n                                      callback=self.on_map_change,\n                                      items=Map.all)\n        hexpand = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,\n                                    QtGui.QSizePolicy.Fixed)\n        self.attr_combo.setSizePolicy(hexpand)\n        self.map_combo.setSizePolicy(hexpand)\n        html = '''\n<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"utf-8\">\n<style>\nhtml, body, #map {margin:0px;padding:0px;width:100%;height:100%;}\n</style>\n<link  href=\"resources/jquery-jvectormap-2.0.2.css\" rel=\"stylesheet\">\n</head>\n<body>\n<div id=\"map\"></div>\n</body>\n</html>'''\n        self.webview = gui.WebviewWidget(self.controlArea, self, debug=True)\n        self.webview.setHtml(html, 'file://{}/'.format(path.dirname(__file__)))\n        for script in ('jquery-2.1.4.min.js',\n                       'jquery-jvectormap-2.0.2.min.js',\n                       'jquery-jvectormap-world-mill-en.js',\n                       'jquery-jvectormap-europe-mill-en.js',\n                       'jquery-jvectormap-us-aea-en.js',\n                       'geomap-script.js'):\n            self.webview.evalJS(open(path.join(path.dirname(__file__), 'resources', script), encoding='utf-8').read())\n        self.webview.evalJS('REGIONS = {};'.format({Map.WORLD: CC_WORLD,\n                                                    Map.EUROPE: CC_EUROPE,\n                                                    Map.USA: CC_USA}))\n\n    def _repopulate_attr_combo(self, data):\n        from itertools import chain\n        self.metas = [a for a in chain(data.domain.metas,\n                                       data.domain.attributes,\n                                       data.domain.class_vars)\n                      # Filter string variables\n                      if (a.is_discrete and a.values and isinstance(a.values[0], str) and not a.ordered or\n                          a.is_string)] if data else []\n        self.attr_combo.clear()\n        self.selected_attr = 0\n        for i, var in enumerate(self.metas):\n            self.attr_combo.addItem(gui.attributeIconDict[var], var.name)\n            # Select default attribute\n            if var.name.lower() == 'country':\n                self.selected_attr = i\n        if self.metas:\n            self.attr_combo.setCurrentIndex(self.attr_combo.findText(self.metas[self.selected_attr].name))\n\n    def on_data(self, data):\n        self.data = data\n        self._repopulate_attr_combo(data)\n        if not data:\n            self.region_selected('')\n            self.webview.evalJS('DATA = {}; renderMap();')\n        else:\n            self.on_attr_change()\n\n\n    def on_map_change(self, map_code=''):\n        if map_code:\n            self.map_combo.setCurrentIndex(self.map_combo.findData(map_code))\n        else:\n            map_code = map_code or self.map_combo.itemData(self.selected_map)\n        self.webview.evalJS('MAP_CODE = \"{}\";'.format(map_code))\n        self.webview.evalJS('SELECTED_REGIONS = {};'.format(self.regions))\n        self.webview.evalJS('renderMap();')\n\n    def on_attr_change(self):\n        attr = self.metas[self.selected_attr]\n        from collections import Counter, defaultdict\n        counts = Counter(self.data.get_column_view(self.data.domain.index(attr))[0])\n        # Auto-select region map\n        values = set(counts)\n        if 0 == len(values - SET_CC_USA):\n            cc_map, inv_cc_map, map_code = CC_USA, INV_CC_USA, Map.USA\n        elif 0 == len(values - SET_CC_EUROPE):\n            cc_map, inv_cc_map, map_code = CC_EUROPE, INV_CC_EUROPE, Map.EUROPE\n        else:\n            cc_map, inv_cc_map, map_code = CC_WORLD, INV_CC_WORLD, Map.WORLD\n        data = defaultdict(int)\n        for cc in counts:\n            data[inv_cc_map.get(cc, cc)] += counts[cc]\n        self.webview.evalJS('DATA = {};'.format(dict(data)))\n        self.on_map_change(map_code)\n\n\ndef main():\n    from Orange.data import Table, Domain, ContinuousVariable, StringVariable\n\n    words = np.column_stack([\n        'Slovenia Slovenia SVN USA Iraq Iraq Iraq Iraq France FR'.split(),\n        'Slovenia Slovenia SVN France FR Austria NL GB GB GB'.split(),\n        'Alabama AL Texas TX TX TX MS Montana US-MT MT'.split(),\n    ])\n    metas = [\n        StringVariable('World'),\n        StringVariable('Europe'),\n        StringVariable('USA'),\n    ]\n    domain = Domain([], metas=metas)\n    table = Table.from_numpy(domain,\n                             X=np.zeros((len(words), 0)),\n                             metas=words)\n    app = QtGui.QApplication([''])\n    w = OWGeoMap()\n    w.on_data(table)\n    w.show()\n    app.exec()\n\n\nif __name__ == \"__main__\":\n    main()\n", "path": "orangecontrib/text/widgets/owgeomap.py"}], "after_files": [{"content": "# coding: utf-8\nfrom collections import OrderedDict\nfrom os import path\nfrom math import pi as PI\n\nimport numpy as np\n\nfrom PyQt4 import QtCore, QtGui\n\nfrom Orange.widgets import widget, gui, settings\nfrom Orange.data import Table\nfrom orangecontrib.text.country_codes import \\\n    CC_EUROPE, INV_CC_EUROPE, SET_CC_EUROPE, \\\n    CC_WORLD, INV_CC_WORLD, \\\n    CC_USA, INV_CC_USA, SET_CC_USA\n\n\nclass Map:\n    WORLD = 'world_mill_en'\n    EUROPE = 'europe_mill_en'\n    USA = 'us_aea_en'\n    all = (('World',  WORLD),\n           ('Europe', EUROPE),\n           ('USA',    USA))\n\n\nclass OWGeoMap(widget.OWWidget):\n    name = \"GeoMap\"\n    priority = 20000\n    icon = \"icons/GeoMap.svg\"\n    inputs = [(\"Data\", Table, \"on_data\")]\n    outputs = [('Data', Table)]\n\n    want_main_area = False\n\n    selected_attr = settings.Setting(0)\n    selected_map = settings.Setting(0)\n    regions = settings.Setting([])\n\n    def __init__(self):\n        super().__init__()\n        self._create_layout()\n\n    @QtCore.pyqtSlot(str, result=str)\n    def region_selected(self, regions):\n        \"\"\"Called from JavaScript\"\"\"\n        if not regions:\n            return self.send('Data', None)\n        self.regions = regions.split(',')\n        from Orange.data.filter import FilterStringList\n        # TODO, FIXME: make this work for discrete attrs also\n        filter = FilterStringList(self.metas[self.selected_attr], self.regions)\n        self.send('Data', self.data._filter_values(filter))\n\n    def _create_layout(self):\n        box = gui.widgetBox(self.controlArea,\n                            orientation='horizontal')\n        self.attr_combo = gui.comboBox(box, self, 'selected_attr',\n                                       orientation='horizontal',\n                                       label='Region attribute:',\n                                       callback=self.on_attr_change)\n        self.map_combo = gui.comboBox(box, self, 'selected_map',\n                                      orientation='horizontal',\n                                      label='Map type:',\n                                      callback=self.on_map_change,\n                                      items=Map.all)\n        hexpand = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,\n                                    QtGui.QSizePolicy.Fixed)\n        self.attr_combo.setSizePolicy(hexpand)\n        self.map_combo.setSizePolicy(hexpand)\n        html = '''\n<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"utf-8\">\n<base href=\"file://{}/\"/>\n<style>\nhtml, body, #map {{margin:0px;padding:0px;width:100%;height:100%;}}\n</style>\n<link  href=\"resources/jquery-jvectormap-2.0.2.css\" rel=\"stylesheet\">\n</head>\n<body>\n<div id=\"map\"></div>\n</body>\n</html>'''.format(path.abspath(path.dirname(__file__)))\n        self.webview = gui.WebviewWidget(self.controlArea, self, debug=True)\n        self.webview.setHtml(html)\n        for script in ('jquery-2.1.4.min.js',\n                       'jquery-jvectormap-2.0.2.min.js',\n                       'jquery-jvectormap-world-mill-en.js',\n                       'jquery-jvectormap-europe-mill-en.js',\n                       'jquery-jvectormap-us-aea-en.js',\n                       'geomap-script.js'):\n            self.webview.evalJS(open(path.join(path.dirname(__file__), 'resources', script), encoding='utf-8').read())\n        self.webview.evalJS('REGIONS = {};'.format({Map.WORLD: CC_WORLD,\n                                                    Map.EUROPE: CC_EUROPE,\n                                                    Map.USA: CC_USA}))\n\n    def _repopulate_attr_combo(self, data):\n        from itertools import chain\n        self.metas = [a for a in chain(data.domain.metas,\n                                       data.domain.attributes,\n                                       data.domain.class_vars)\n                      # Filter string variables\n                      if (a.is_discrete and a.values and isinstance(a.values[0], str) and not a.ordered or\n                          a.is_string)] if data else []\n        self.attr_combo.clear()\n        self.selected_attr = 0\n        for i, var in enumerate(self.metas):\n            self.attr_combo.addItem(gui.attributeIconDict[var], var.name)\n            # Select default attribute\n            if var.name.lower() == 'country':\n                self.selected_attr = i\n        if self.metas:\n            self.attr_combo.setCurrentIndex(self.attr_combo.findText(self.metas[self.selected_attr].name))\n\n    def on_data(self, data):\n        self.data = data\n        self._repopulate_attr_combo(data)\n        if not data:\n            self.region_selected('')\n            self.webview.evalJS('DATA = {}; renderMap();')\n        else:\n            self.on_attr_change()\n\n\n    def on_map_change(self, map_code=''):\n        if map_code:\n            self.map_combo.setCurrentIndex(self.map_combo.findData(map_code))\n        else:\n            map_code = map_code or self.map_combo.itemData(self.selected_map)\n        self.webview.evalJS('MAP_CODE = \"{}\";'.format(map_code))\n        self.webview.evalJS('SELECTED_REGIONS = {};'.format(self.regions))\n        self.webview.evalJS('renderMap();')\n\n    def on_attr_change(self):\n        attr = self.metas[self.selected_attr]\n        from collections import Counter, defaultdict\n        counts = Counter(self.data.get_column_view(self.data.domain.index(attr))[0])\n        # Auto-select region map\n        values = set(counts)\n        if 0 == len(values - SET_CC_USA):\n            cc_map, inv_cc_map, map_code = CC_USA, INV_CC_USA, Map.USA\n        elif 0 == len(values - SET_CC_EUROPE):\n            cc_map, inv_cc_map, map_code = CC_EUROPE, INV_CC_EUROPE, Map.EUROPE\n        else:\n            cc_map, inv_cc_map, map_code = CC_WORLD, INV_CC_WORLD, Map.WORLD\n        data = defaultdict(int)\n        for cc in counts:\n            data[inv_cc_map.get(cc, cc)] += counts[cc]\n        self.webview.evalJS('DATA = {};'.format(dict(data)))\n        self.on_map_change(map_code)\n\n\ndef main():\n    from Orange.data import Table, Domain, ContinuousVariable, StringVariable\n\n    words = np.column_stack([\n        'Slovenia Slovenia SVN USA Iraq Iraq Iraq Iraq France FR'.split(),\n        'Slovenia Slovenia SVN France FR Austria NL GB GB GB'.split(),\n        'Alabama AL Texas TX TX TX MS Montana US-MT MT'.split(),\n    ])\n    metas = [\n        StringVariable('World'),\n        StringVariable('Europe'),\n        StringVariable('USA'),\n    ]\n    domain = Domain([], metas=metas)\n    table = Table.from_numpy(domain,\n                             X=np.zeros((len(words), 0)),\n                             metas=words)\n    app = QtGui.QApplication([''])\n    w = OWGeoMap()\n    w.on_data(table)\n    w.show()\n    app.exec()\n\n\nif __name__ == \"__main__\":\n    main()\n", "path": "orangecontrib/text/widgets/owgeomap.py"}]}