Skip to content

Commit

Permalink
Merge pull request #21 from liuxsdev/morekey
Browse files Browse the repository at this point in the history
支持多个天地图key
  • Loading branch information
liuxspro authored Jan 16, 2024
2 parents 1c5ab0d + 9aca09f commit 1a65f0c
Show file tree
Hide file tree
Showing 12 changed files with 358 additions and 150 deletions.
2 changes: 1 addition & 1 deletion run.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
cwd = Path.cwd()
source_dir = cwd.joinpath("tianditu_tools")
dist_dir = cwd.joinpath("dist")
dist_source_dir = dist_dir.joinpath("tianditu-tools")
dist_source_dir = dist_dir.joinpath("tianditu_tools")

# Other necessary files
other_files = ["README.md", "LICENSE"]
Expand Down
7 changes: 5 additions & 2 deletions tianditu_tools/metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@ name=TianDiTu Tools
qgisMinimumVersion=3.4
description=天地图底图加载
about=QGIS 天地图工具,方便进行天地图瓦片底图的添加以及简单实现了部分天地图 Web 服务 API(地名搜索、地理编码查询、逆地理编码查询)
version=0.3.1
version=0.4.0
tags=basemap, xyz, tianditu, geocoder, 天地图
icon=images/icon.png
experimental=False
deprecated=False
author=liuxspro
[email protected]
homepage=https://github.com/liuxsdev/qgis-plugin-tianditu
homepage=https://qgis-plugin-tianditu.liuxs.pro/
tracker=https://github.com/liuxsdev/qgis-plugin-tianditu/issues
repository=https://github.com/liuxsdev/qgis-plugin-tianditu
changelog=
Version 0.4.0 2024/01/16:
* ✨ 新增功能: 支持多个天地图key
* ✨ 新增功能: 地图管理和更新
Version 0.3.1 2023/11/17:
* 🐛 修复3.34版本上无法加载地图
Version 0.3.0 2023/7/1:
Expand Down
2 changes: 1 addition & 1 deletion tianditu_tools/ui/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Form implementation generated from reading ui file 'search.ui'
#
# Created by: PyQt5 UI code generator 5.15.9
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
Expand Down
76 changes: 52 additions & 24 deletions tianditu_tools/ui/setting.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ def setupUi(self, SettingDialog):
self.mLineEdit_key.setShowLockIcon(False)
self.mLineEdit_key.setObjectName("mLineEdit_key")
self.horizontalLayout.addWidget(self.mLineEdit_key)
self.pushButton = QtWidgets.QPushButton(self.groupBox)
self.pushButton.setObjectName("pushButton")
self.horizontalLayout.addWidget(self.pushButton)
self.saveButton = QtWidgets.QPushButton(self.groupBox)
self.saveButton.setObjectName("saveButton")
self.horizontalLayout.addWidget(self.saveButton)
self.horizontalLayout.setStretch(0, 1)
self.horizontalLayout.setStretch(1, 10)
self.horizontalLayout.setStretch(2, 2)
Expand All @@ -58,9 +58,26 @@ def setupUi(self, SettingDialog):
self.label_2 = QtWidgets.QLabel(self.groupBox)
self.label_2.setObjectName("label_2")
self.horizontalLayout_2.addWidget(self.label_2)
self.label_keystatus = QtWidgets.QLabel(self.groupBox)
self.label_keystatus.setObjectName("label_keystatus")
self.horizontalLayout_2.addWidget(self.label_keystatus)
self.keyComboBox = QtWidgets.QComboBox(self.groupBox)
font = QtGui.QFont()
font.setFamily("Consolas")
self.keyComboBox.setFont(font)
self.keyComboBox.setObjectName("keyComboBox")
self.horizontalLayout_2.addWidget(self.keyComboBox)
self.checkBox_key_rand = QtWidgets.QCheckBox(self.groupBox)
self.checkBox_key_rand.setObjectName("checkBox_key_rand")
self.horizontalLayout_2.addWidget(self.checkBox_key_rand)
self.pushButton_copy = QtWidgets.QPushButton(self.groupBox)
self.pushButton_copy.setMaximumSize(QtCore.QSize(50, 16777215))
self.pushButton_copy.setObjectName("pushButton_copy")
self.horizontalLayout_2.addWidget(self.pushButton_copy)
self.pushButton_delete = QtWidgets.QPushButton(self.groupBox)
self.pushButton_delete.setMaximumSize(QtCore.QSize(50, 16777215))
self.pushButton_delete.setObjectName("pushButton_delete")
self.horizontalLayout_2.addWidget(self.pushButton_delete)
self.horizontalLayout_2.setStretch(0, 1)
self.horizontalLayout_2.setStretch(1, 10)
self.horizontalLayout_2.setStretch(4, 2)
self.verticalLayout_2.addLayout(self.horizontalLayout_2)
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
Expand All @@ -69,16 +86,16 @@ def setupUi(self, SettingDialog):
self.horizontalLayout_3.addWidget(self.label_3)
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_3.addItem(spacerItem)
self.checkBox_2 = QtWidgets.QCheckBox(self.groupBox)
self.checkBox_2.setObjectName("checkBox_2")
self.horizontalLayout_3.addWidget(self.checkBox_2)
self.comboBox = QtWidgets.QComboBox(self.groupBox)
self.comboBox.setMinimumSize(QtCore.QSize(90, 0))
self.comboBox.setBaseSize(QtCore.QSize(200, 0))
self.comboBox.setCurrentText("")
self.comboBox.setInsertPolicy(QtWidgets.QComboBox.InsertAtTop)
self.comboBox.setObjectName("comboBox")
self.horizontalLayout_3.addWidget(self.comboBox)
self.subdomainComboBox = QtWidgets.QComboBox(self.groupBox)
self.subdomainComboBox.setMinimumSize(QtCore.QSize(80, 0))
self.subdomainComboBox.setBaseSize(QtCore.QSize(200, 0))
self.subdomainComboBox.setCurrentText("")
self.subdomainComboBox.setInsertPolicy(QtWidgets.QComboBox.InsertAtTop)
self.subdomainComboBox.setObjectName("subdomainComboBox")
self.horizontalLayout_3.addWidget(self.subdomainComboBox)
self.checkBox_domain_rand = QtWidgets.QCheckBox(self.groupBox)
self.checkBox_domain_rand.setObjectName("checkBox_domain_rand")
self.horizontalLayout_3.addWidget(self.checkBox_domain_rand)
self.verticalLayout_2.addLayout(self.horizontalLayout_3)
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
Expand All @@ -89,6 +106,15 @@ def setupUi(self, SettingDialog):
self.verticalLayout_2.addWidget(self.label_4)
spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.verticalLayout_2.addItem(spacerItem1)
self.info_status = QtWidgets.QLabel(self.groupBox)
font = QtGui.QFont()
font.setFamily("微软雅黑")
font.setPointSize(8)
self.info_status.setFont(font)
self.info_status.setStyleSheet("color: rgb(128, 128, 128);")
self.info_status.setText("")
self.info_status.setObjectName("info_status")
self.verticalLayout_2.addWidget(self.info_status)
self.verticalLayout_4.addWidget(self.groupBox)
self.tabWidget.addTab(self.tab_keyset, "")
self.tab_map = QtWidgets.QWidget()
Expand Down Expand Up @@ -117,15 +143,17 @@ def retranslateUi(self, SettingDialog):
_translate = QtCore.QCoreApplication.translate
SettingDialog.setWindowTitle(_translate("SettingDialog", "设置"))
self.groupBox.setTitle(_translate("SettingDialog", "Key 设置"))
self.label.setText(_translate("SettingDialog", "Key:"))
self.label.setText(_translate("SettingDialog", "添加 Key:"))
self.mLineEdit_key.setPlaceholderText(_translate("SettingDialog", "输入天地图key"))
self.pushButton.setText(_translate("SettingDialog", "保存并检查有效性"))
self.label_2.setText(_translate("SettingDialog", "Key状态:"))
self.label_keystatus.setText(_translate("SettingDialog", "未知"))
self.label_3.setText(_translate("SettingDialog", "子域:"))
self.checkBox_2.setToolTip(_translate("SettingDialog", "<html><head/><body><p><span style=\" font-size:10pt;\">添加底图时随机选择子域名,可减轻服务器压力,</span>提高可用性。</p></body></html>"))
self.checkBox_2.setText(_translate("SettingDialog", "随机"))
self.label_4.setText(_translate("SettingDialog", "<html><head/><body><p><span style=\" font-size:8pt;\">没有Key?</span><a href=\"https://console.tianditu.gov.cn/api/key\"><span style=\" font-size:8pt; text-decoration: underline; color:#0000ff;\">点击此处去申请</span></a></p></body></html>"))
self.saveButton.setText(_translate("SettingDialog", "保存"))
self.label_2.setText(_translate("SettingDialog", "选择 Key:"))
self.checkBox_key_rand.setText(_translate("SettingDialog", "随机"))
self.pushButton_copy.setText(_translate("SettingDialog", "复制"))
self.pushButton_delete.setText(_translate("SettingDialog", "删除"))
self.label_3.setText(_translate("SettingDialog", "子域 Subdomain:"))
self.checkBox_domain_rand.setToolTip(_translate("SettingDialog", "<html><head/><body><p><span style=\" font-size:10pt;\">添加底图时随机选择子域名,可减轻服务器压力,</span>提高可用性。</p></body></html>"))
self.checkBox_domain_rand.setText(_translate("SettingDialog", "随机"))
self.label_4.setText(_translate("SettingDialog", "<html><head/><body><p><span style=\" font-weight:600; color:#808080;\">没有Key?</span><a href=\"https://console.tianditu.gov.cn/api/key\"><span style=\" font-weight:600; text-decoration: underline; color:#808080;\">点击此处去申请</span></a></p></body></html>"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_keyset), _translate("SettingDialog", "天地图设置"))
self.pushButton_2.setText(_translate("SettingDialog", "检查更新"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_map), _translate("SettingDialog", "地图管理"))
Expand Down
93 changes: 72 additions & 21 deletions tianditu_tools/ui/setting.ui
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Key:</string>
<string>添加 Key:</string>
</property>
</widget>
</item>
Expand All @@ -68,27 +68,62 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<widget class="QPushButton" name="saveButton">
<property name="text">
<string>保存并检查有效性</string>
<string>保存</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="1,10,0,0,2">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Key状态:</string>
<string>选择 Key:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_keystatus">
<widget class="QComboBox" name="keyComboBox">
<property name="font">
<font>
<family>Consolas</family>
</font>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_key_rand">
<property name="text">
<string>随机</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_copy">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>复制</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_delete">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>未知</string>
<string>删除</string>
</property>
</widget>
</item>
Expand All @@ -99,7 +134,7 @@
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>子域:</string>
<string>子域 Subdomain:</string>
</property>
</widget>
</item>
Expand All @@ -117,20 +152,10 @@
</spacer>
</item>
<item>
<widget class="QCheckBox" name="checkBox_2">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;添加底图时随机选择子域名,可减轻服务器压力,&lt;/span&gt;提高可用性。&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>随机</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox">
<widget class="QComboBox" name="subdomainComboBox">
<property name="minimumSize">
<size>
<width>90</width>
<width>80</width>
<height>0</height>
</size>
</property>
Expand All @@ -148,6 +173,16 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_domain_rand">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;添加底图时随机选择子域名,可减轻服务器压力,&lt;/span&gt;提高可用性。&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>随机</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
Expand All @@ -156,7 +191,7 @@
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;没有Key?&lt;/span&gt;&lt;a href=&quot;https://console.tianditu.gov.cn/api/key&quot;&gt;&lt;span style=&quot; font-size:8pt; text-decoration: underline; color:#0000ff;&quot;&gt;点击此处去申请&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; color:#808080;&quot;&gt;没有Key?&lt;/span&gt;&lt;a href=&quot;https://console.tianditu.gov.cn/api/key&quot;&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline; color:#808080;&quot;&gt;点击此处去申请&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
Expand All @@ -176,6 +211,22 @@
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="info_status">
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>8</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(128, 128, 128);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down
Loading

0 comments on commit 1a65f0c

Please sign in to comment.