Skip to content

Commit

Permalink
Adding suggestion on code styling and some air
Browse files Browse the repository at this point in the history
  • Loading branch information
SeqLaz committed Oct 24, 2024
1 parent a6645f6 commit 23c07fb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
6 changes: 2 additions & 4 deletions libqfieldsync/offline_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def __init__(
export_type: ExportType = ExportType.Cable,
create_basemap: bool = True,
dirs_to_copy: Optional[Dict[str, bool]] = None,
export_title: Optional[str] = None,
export_title: str = "",
):
super(OfflineConverter, self).__init__(parent=None)
self.__max_task_progress = 0
Expand Down Expand Up @@ -276,9 +276,7 @@ def _convert(self, project: QgsProject) -> None:
elif layer_action == SyncAction.REMOVE:
project.removeMapLayer(layer)

export_project_filename = self._export_filename.parent.joinpath(
f"{self._export_filename.stem}.qgs"
)
export_project_filename = self._export_filename

# save the original project path
self.project_configuration.original_project_path = str(self.original_filename)
Expand Down
4 changes: 3 additions & 1 deletion libqfieldsync/offliners.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,12 +460,14 @@ class LayerInfo(NamedTuple):
project_title = exported_project_title
else:
project_title = project.title()

if not project_title:
project_title = QFileInfo(project.fileName()).baseName()

project_title += f"{project_title} (offline)"
project.setTitle(project_title)

project.setTitle(project_title)

project.writeEntry(
PROJECT_ENTRY_SCOPE_OFFLINE,
PROJECT_ENTRY_KEY_OFFLINE_DB_PATH,
Expand Down
4 changes: 1 addition & 3 deletions libqfieldsync/utils/qgis.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ def open_project(filename: str, filename_to_read: Optional[str] = None) -> bool:
return is_success


def make_temp_qgis_file(
project: QgsProject,
) -> str:
def make_temp_qgis_file(project: QgsProject) -> str:
project_backup_dir = tempfile.mkdtemp()
original_filename = project.fileName()
backup_filename = os.path.join(project_backup_dir, f"{project.baseName()}.qgs")
Expand Down

0 comments on commit 23c07fb

Please sign in to comment.