Skip to content

Commit 07e3c5e

Browse files
committed
fix #44 problems with domain changes
1 parent 18b35a1 commit 07e3c5e

File tree

4 files changed

+20
-14
lines changed

4 files changed

+20
-14
lines changed

CartoDBPlugin.py

+14-8
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
This script initializes the plugin, making it known to QGIS.
2121
"""
2222
# Import the PyQt and QGIS libraries
23-
from PyQt4.QtCore import *
24-
from PyQt4.QtGui import *
23+
from PyQt4.QtCore import Qt, QCoreApplication, QObject, QSettings, QTranslator, qDebug, qVersion
24+
from PyQt4.QtGui import QMenu, QIcon, QAction, QProgressBar
2525

2626
from qgis.core import QgsMessageLog, QgsPluginLayerRegistry, QgsMapLayerRegistry
2727
from osgeo import gdal
@@ -48,7 +48,7 @@ class CartoDBPlugin(QObject):
4848
PLUGIN_DIR = os.path.dirname(os.path.abspath(__file__))
4949

5050
def __init__(self, iface):
51-
super(QObject, self).__init__()
51+
QObject.__init__(self)
5252
QgsMessageLog.logMessage('GDAL Version: ' + str(gdal.VersionInfo('VERSION_NUM')), 'CartoDB Plugin', QgsMessageLog.INFO)
5353

5454
# Save reference to the QGIS interface
@@ -78,6 +78,15 @@ def __init__(self, iface):
7878
self.countLoadingLayers = 0
7979
self.countLoadedLayers = 0
8080

81+
self._cdbMenu = None
82+
self._mainAction = None
83+
self._loadDataAction = None
84+
self._createVizAction = None
85+
self._addSQLAction = None
86+
self.toolbar = CartoDBToolbar()
87+
self._toolbarAction = None
88+
self._menu = None
89+
8190
def initGui(self):
8291
self._cdbMenu = QMenu("CartoDB plugin", self.iface.mainWindow())
8392
self._cdbMenu.setIcon(QIcon(":/plugins/qgis-cartodb/images/icon.png"))
@@ -90,7 +99,6 @@ def initGui(self):
9099
self._addSQLAction = QAction(self.tr('Add SQL CartoDB Layer'), self.iface.mainWindow())
91100
self._addSQLAction.setIcon(QIcon(":/plugins/qgis-cartodb/images/icons/sql.png"))
92101

93-
self.toolbar = CartoDBToolbar()
94102
self.toolbar.setClick(self.connectionManager)
95103
self.toolbar.error.connect(self.toolbarError)
96104
self._toolbarAction = self.iface.addWebToolBarWidget(self.toolbar)
@@ -251,14 +259,12 @@ def addLayer(fileName, tableName):
251259

252260
dlg.addedLayer.connect(addLayer)
253261
dlg.show()
254-
255-
result = dlg.exec_()
262+
dlg.exec_()
256263

257264
def createNewMap(self):
258265
dlg = CartoDBPluginCreateViz(self.toolbar, self.iface)
259266
dlg.show()
260-
261-
result = dlg.exec_()
267+
dlg.exec_()
262268

263269
def addLoadingMsg(self, countLayers, barText='Downloading datasets'):
264270
barText = self.tr(barText)

cartodb/cartodb.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class CartoDBBase(object):
4747
""" basic client to access cartodb api """
4848
MAX_GET_QUERY_LEN = 2048
4949

50-
def __init__(self, cartodb_domain, host='cartodb.com', protocol='https', api_version='v2'):
50+
def __init__(self, cartodb_domain, host='carto.com', protocol='https', api_version='v2'):
5151
self.resource_url = RESOURCE_URL % {'user': cartodb_domain, 'domain': host, 'protocol': protocol, 'api_version': api_version}
5252

5353
def req(self, url, http_method="GET", http_headers=None, body=''):
@@ -95,7 +95,7 @@ class CartoDBOAuth(CartoDBBase):
9595
"""
9696
This client allows to auth in cartodb using oauth.
9797
"""
98-
def __init__(self, key, secret, email, password, cartodb_domain, host='cartodb.com', protocol='https', proxy_info=None, *args, **kwargs):
98+
def __init__(self, key, secret, email, password, cartodb_domain, host='carto.com', protocol='https', proxy_info=None, *args, **kwargs):
9999
super(CartoDBOAuth, self).__init__(cartodb_domain, host, protocol, *args, **kwargs)
100100

101101
self.consumer_key = key
@@ -132,11 +132,11 @@ def req(self, url, http_method="GET", http_headers=None, body=''):
132132

133133
class CartoDBAPIKey(CartoDBBase):
134134
"""
135-
this class provides you access to auth CartoDB API using your API. You can find your API key in https://USERNAME.cartodb.com/your_apps/api_key.
135+
this class provides you access to auth CartoDB API using your API. You can find your API key in https://USERNAME.carto.com/your_apps/api_key.
136136
this method is easier than use the oauth authentification but if less secure, it is recommended to use only using the https endpoint
137137
"""
138138

139-
def __init__(self, api_key, cartodb_domain, host='cartodb.com', protocol='https', proxy_info=None, *args, **kwargs):
139+
def __init__(self, api_key, cartodb_domain, host='carto.com', protocol='https', proxy_info=None, *args, **kwargs):
140140
super(CartoDBAPIKey, self).__init__(cartodb_domain, host, protocol, *args, **kwargs)
141141
self.api_key = api_key
142142

cartodb/cartodbapi.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class CartoDBApi(QObject):
1616
progress = pyqtSignal(int, int)
1717
error = pyqtSignal(object)
1818

19-
def __init__(self, cartodbUser, apiKey, multiuser=False, hostname='cartodb.com'):
19+
def __init__(self, cartodbUser, apiKey, multiuser=False, hostname='carto.com'):
2020
QObject.__init__(self)
2121
self.multiuser = multiuser
2222
self.apiKey = apiKey

pylintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[MASTER]
2-
extension-pkg-whitelist=PyQt4,qgis
2+
extension-pkg-whitelist=PyQt4,qgis,QgisCartoDB
33

44
[BASIC]
55
# Good names for variables

0 commit comments

Comments
 (0)