Skip to content

Commit

Permalink
Adding changes and improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
SeqLaz committed Oct 21, 2024
1 parent 068880f commit 5766a85
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 4 additions & 3 deletions libqfieldsync/offline_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,15 @@ class OfflineConverter(QObject):
def __init__(
self,
project: QgsProject,
export_folder: str,
export_filename: str,
export_title: Optional[str] = None,
area_of_interest_wkt: str,
area_of_interest_crs: Union[str, QgsCoordinateReferenceSystem],
attachment_dirs: List[str],
offliner: BaseOffliner,
export_type: ExportType = ExportType.Cable,
create_basemap: bool = True,
dirs_to_copy: Optional[Dict[str, bool]] = None,
export_title: Optional[str] = None,
):
super(OfflineConverter, self).__init__(parent=None)
self.__max_task_progress = 0
Expand Down Expand Up @@ -278,7 +277,9 @@ def _convert(self, project: QgsProject) -> None:
elif layer_action == SyncAction.REMOVE:
project.removeMapLayer(layer)

export_project_filename = self._export_filename
export_project_filename = Path(self.export_folder).joinpath(
f"{self._export_filename}.qgs"
)

# save the original project path
self.project_configuration.original_project_path = str(self.original_filename)
Expand Down
7 changes: 3 additions & 4 deletions libqfieldsync/utils/qgis.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"""

import logging
import os
import tempfile
from pathlib import Path
from typing import List, Optional, Union
Expand Down Expand Up @@ -54,9 +53,9 @@ def make_temp_qgis_file(
exported_project_title: Optional[str] = None,
) -> str:
project_backup_dir = tempfile.mkdtemp()
original_filename = project.fileName()
project.write(exported_filename)
project.setFileName(exported_filename)
backup_filename = str(Path(project_backup_dir).joinpath(f"{exported_filename}.qgs"))
project.write(backup_filename)
project.setFileName(backup_filename)

if exported_project_title:
project.setTitle(exported_project_title)
Expand Down

0 comments on commit 5766a85

Please sign in to comment.