Skip to content

Commit

Permalink
Ensuring the filename have the .qgs extension
Browse files Browse the repository at this point in the history
  • Loading branch information
SeqLaz committed Oct 24, 2024
1 parent 5118656 commit f60f4d7
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion qfieldsync/gui/package_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def __init__(self, iface, project, offline_editing, parent=None):
self.__project_configuration = ProjectConfiguration(self.project)
self.button_box.button(QDialogButtonBox.Save).setText(self.tr("Create"))
self.button_box.button(QDialogButtonBox.Save).clicked.connect(
self.package_project
self.run_package_project
)
self.button_box.button(QDialogButtonBox.Reset).setText(
self.tr("Configure current project...")
Expand Down Expand Up @@ -163,6 +163,20 @@ def show_package_page(self):
self.button_box.setVisible(True)
self.stackedWidget.setCurrentWidget(self.packagePage)

def run_package_project(self):
export_packaged_project = Path(self.packagedProjectFileWidget.filePath())

if export_packaged_project.suffix != ".qgs":
QMessageBox.critical(
self,
self.tr("Invalid File"),
self.tr('The filename must have a ".qgs" extension.'),
)
return

else:
self.package_project()

def package_project(self):
self.button_box.button(QDialogButtonBox.Save).setEnabled(False)

Expand Down

0 comments on commit f60f4d7

Please sign in to comment.