Skip to content

Commit

Permalink
feat(refactor): remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
jmkerloch committed Sep 20, 2024
1 parent ae4bdc2 commit bfa80bf
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 413 deletions.
18 changes: 0 additions & 18 deletions menu_from_project/logic/qgs_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 +59,6 @@ def is_absolute(doc: QtXml.QDomDocument) -> bool:
return absolute


def get_project_title(doc: QtXml.QDomDocument) -> str:
"""Return the project title defined in the XML document.
:param doc: The QGIS project as XML document. Default to None.
:type doc: QDomDocument
:return: The title or None.
:rtype: string
"""
tags = doc.elementsByTagName("qgis")
if tags.count():
node = tags.at(0)
title_node = node.namedItem("title")
return title_node.firstChild().toText().data()

return None


@lru_cache()
def read_from_file(uri: str) -> Tuple[QtXml.QDomDocument, str]:
"""Read a QGIS project (.qgs and .qgz) from a file path and returns d
Expand Down
33 changes: 0 additions & 33 deletions menu_from_project/logic/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,39 +61,6 @@ def icon_per_storage_type(type_storage: str) -> str:
return QgsApplication.iconPath("mIconFile.svg")


@lru_cache()
def icon_per_geometry_type(geometry_type: str):
"""Return the icon for a geometry type.
If not found, it will return the default icon.
:param geometry_type: The geometry as a string.
:type geometry_type: basestring
:return: The icon.
:rtype: QIcon
"""
geometry_type = geometry_type.lower()
if geometry_type == "raster":
return QgsLayerItem.iconRaster()
elif geometry_type == "mesh":
return QgsLayerItem.iconMesh()
elif geometry_type == "vector-tile":
return QgsLayerItem.iconVectorTile()
elif geometry_type == "point-cloud":
return QgsLayerItem.iconPointCloud()
elif geometry_type == "point":
return QgsLayerItem.iconPoint()
elif geometry_type == "line":
return QgsLayerItem.iconLine()
elif geometry_type == "polygon":
return QgsLayerItem.iconPolygon()
elif geometry_type == "no geometry":
return QgsLayerItem.iconTable()
else:
return QgsLayerItem.iconDefault()


@lru_cache()
def icon_per_layer_type(
is_spatial: bool,
Expand Down
15 changes: 0 additions & 15 deletions menu_from_project/logic/xml_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,3 @@ def getFirstChildByTagNameValue(elt, tagName, key, value):
return node

return None


def getFirstChildByAttrValue(elt, tagName, key, value):
if isinstance(elt, QDomNode):
elt = elt.toElement()
nodes = elt.elementsByTagName(tagName)
for node in (nodes.at(i) for i in range(nodes.size())):
if (
node.toElement().hasAttribute(key)
and node.toElement().attribute(key) == value
):
# layer founds
return node

return None
Loading

0 comments on commit bfa80bf

Please sign in to comment.