Skip to content

Commit

Permalink
Merge pull request #112 from Samweli/fix_windows_folder_opening
Browse files Browse the repository at this point in the history
Fix error when opening reports
  • Loading branch information
Samweli committed Oct 18, 2024
2 parents 53d1470 + 206d704 commit 9f6650a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
16 changes: 11 additions & 5 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"general": {
"name" : "QGIS GEA afforestation tool",
"name": "QGIS GEA afforestation tool",
"qgisMinimumVersion": 3.20,
"qgisMaximumVersion": 3.99,
"icon": "icon.png",
Expand All @@ -9,14 +9,20 @@
"homepage": "https://github.com/kartoza/qgis-gea-plugin",
"tracker": "https://github.com/kartoza/qgis-gea-plugin/issues",
"repository": "https://github.com/kartoza/qgis-gea-plugin",
"tags": ["gea", "maps", "afforestation"],
"category": ["plugins"],
"tags": [
"gea",
"maps",
"afforestation"
],
"category": [
"plugins"
],
"hasProcessingProvider": "no",
"about": "Adds functionality inside QGIS to enable GEA afforestation visualization and analysis.",
"author": "Kartoza",
"email": "[email protected]",
"description": "View, browse and navigate through imagery.",
"version": "0.0.1",
"version": "1.0.1",
"changelog": ""
}
}
}
20 changes: 11 additions & 9 deletions src/qgis_gea_plugin/gui/report_progress_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,17 @@ def _on_open_pdf_folder(self):
if os.path.exists(str(self.report_output_dir)):
current_os = platform.system()

if current_os == "Windows":
os.startfile(self.report_output_dir)
elif current_os == "Darwin": # macOS
subprocess.run(['open', self.report_output_dir])
elif current_os == "Linux":
subprocess.run(['xdg-open', self.report_output_dir])
else:
log(f"Unsupported OS: {current_os}")
subprocess.run(['xdg-open', self.report_output_dir])
try:
if current_os == "Windows":
os.startfile(self.report_output_dir)
elif current_os == "Darwin": # macOS
subprocess.run(['open', self.report_output_dir])
elif current_os == "Linux":
subprocess.run(['xdg-open', self.report_output_dir])
else:
log(f"Unsupported OS: {current_os}")
except Exception as e:
log(f"Exception occurred when opening pdf folder, {e}")
else:
log("Folder path doesn't exist")
else:
Expand Down

0 comments on commit 9f6650a

Please sign in to comment.