Skip to content

Commit

Permalink
Fix: extra map dont show
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxspro committed Jan 16, 2024
1 parent 02ebd3f commit 9aca09f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 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
5 changes: 4 additions & 1 deletion tianditu_tools/widgets/AddMap/extra_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ def add_extra_map_menu(parent_menu: QMenu):
maps = extra_maps.keys()
extra_maps_status = conf.get_extra_maps_status()
for map_name in maps:
if map_name in extra_maps_status["tianditu_province"]:
if (
map_name in extra_maps_status["tianditu_province"]
or map_name in extra_maps_status["extra"]
):
map_data = extra_maps[map_name]
sub_menu = extra_root_menu.addAction(icons["other"], map_name)
sub_sub_menu = QMenu()
Expand Down
16 changes: 7 additions & 9 deletions tianditu_tools/widgets/Setting/mapmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ class MapManager(QTreeWidget):
"""

def __init__(
self,
map_folder: Path,
parent=None,
self,
map_folder: Path,
parent=None,
):
super().__init__(parent)
self.map_folder = map_folder
self.font = QFont()
self.font.setFamily("微软雅黑")
self.font.setPointSize(8)
self.setFont(self.font)
self.update_host = "https://maps-tan-phi.vercel.app/dist/"
self.update_host = "https://maps.liuxs.pro/dist/"
self.update_url = f"{self.update_host}summary.yml"
self.conf = PluginConfig()
# self.check_update()
Expand Down Expand Up @@ -57,9 +57,7 @@ def get_summary(self):
return load_yaml(summary_path)

def get_map_id_by_name(self, name):
"""
通过地图名称获取id
"""
"""通过地图名称获取 id"""
summary = self.get_summary()
for item in summary.values():
if item["name"] == name:
Expand Down Expand Up @@ -117,7 +115,7 @@ def download_map_conf(self, map_id):
summary_data = got(self.update_url)
if summary_data.ok:
with open(
self.map_folder.joinpath("summary.yml"), "w", encoding="utf-8"
self.map_folder.joinpath("summary.yml"), "w", encoding="utf-8"
) as f:
f.write(summary_data.text)
conf_data = got(download_url)
Expand All @@ -139,7 +137,6 @@ def check_update(self):

def update_map_enable_state(self):
top_level_item_count = self.topLevelItemCount()
checked_item = []
current_status = {}
for i in range(top_level_item_count):
top_level_item = self.topLevelItem(i)
Expand All @@ -148,6 +145,7 @@ def update_map_enable_state(self):
# 获取子项的数量
child_count = top_level_item.childCount()
# 遍历子项
checked_item = []
for j in range(child_count):
child_item = top_level_item.child(j)
if child_item.checkState(0) == 2:
Expand Down

0 comments on commit 9aca09f

Please sign in to comment.