diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml
index 3ab85068..54cb39e0 100644
--- a/.github/workflows/continuous_integration.yml
+++ b/.github/workflows/continuous_integration.yml
@@ -110,16 +110,16 @@ jobs:
--osgeo-password ${OSGEO_PASSWORD} \
--asset-path qfieldsync/libqfieldsync.whl
- - name: Release
+ - name: Package
if: ${{ github.event_name == 'pull_request' }}
run: |
- qgis-plugin-ci package dev \
+ qgis-plugin-ci package 0.1 \
--asset-path qfieldsync/libqfieldsync.whl
- uses: actions/upload-artifact@v3
with:
name: qfieldsync-plugin
- path: qfieldsync.dev.zip
+ path: qfieldsync.0.1.zip
package:
runs-on: ubuntu-22.04
env:
diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml
new file mode 100644
index 00000000..64398cfd
--- /dev/null
+++ b/.github/workflows/documentation.yml
@@ -0,0 +1,27 @@
+---
+name: 📜 Documentation
+on:
+ pull_request_target:
+ types:
+ - closed
+ - labeled
+jobs:
+ backport:
+ runs-on: ubuntu-latest
+ name: Create documentation task
+ if: contains(github.event.pull_request.labels.*.name, 'needs documentation')
+ steps:
+ - name: Create task
+ run: |
+ curl -i -X POST \
+ 'https://api.clickup.com/api/v2/list/900400532890/task' \
+ -H 'Authorization: ${{ secrets.CLICKUP_TOKEN}}' \
+ -H 'Content-Type: application/json' \
+ -d '{
+ "name": "${{ github.context.payload.pull_request.title }}",
+ "description": "Coming from pull request ${{ github.context.payload.pull_request.url }}",
+ "tags": [
+ "qfield"
+ ],
+ "status": "Open"
+ }'
diff --git a/qfieldsync/core/preferences.py b/qfieldsync/core/preferences.py
index 92990dd8..cfec8de8 100644
--- a/qfieldsync/core/preferences.py
+++ b/qfieldsync/core/preferences.py
@@ -23,6 +23,7 @@ def __init__(self):
self.add_setting(
String("importDirectory", Scope.Global, str(home.joinpath("QField/import")))
)
+ self.add_setting(Bool("showPackagingActions", Scope.Global, False))
self.add_setting(String("importDirectoryProject", Scope.Project, None))
self.add_setting(Dictionary("dirsToCopy", Scope.Project, {}))
self.add_setting(Stringlist("attachmentDirs", Scope.Project, ["DCIM"]))
diff --git a/qfieldsync/gui/preferences_widget.py b/qfieldsync/gui/preferences_widget.py
index a33e820d..fda428f6 100644
--- a/qfieldsync/gui/preferences_widget.py
+++ b/qfieldsync/gui/preferences_widget.py
@@ -35,7 +35,8 @@
class PreferencesWidget(WidgetUi, QgsOptionsPageWidget, SettingDialog):
- def __init__(self, parent=None):
+ def __init__(self, qfieldSync, parent=None):
+ self.qfieldSync = qfieldSync
preferences = Preferences()
SettingDialog.__init__(self, setting_manager=preferences)
super().__init__(parent, setting_manager=preferences)
@@ -54,3 +55,4 @@ def __init__(self, parent=None):
def apply(self):
self.set_values_from_widgets()
+ self.qfieldSync.update_button_visibility()
diff --git a/qfieldsync/qfield_sync.py b/qfieldsync/qfield_sync.py
index 8a653385..f4c7d1df 100644
--- a/qfieldsync/qfield_sync.py
+++ b/qfieldsync/qfield_sync.py
@@ -64,8 +64,9 @@ def createWidget(self, parent):
class QFieldSyncOptionsFactory(QgsOptionsWidgetFactory):
- def __init__(self):
+ def __init__(self, qfieldSync):
super(QgsOptionsWidgetFactory, self).__init__()
+ self.qfieldSync = qfieldSync
def icon(self):
return QIcon(
@@ -73,7 +74,7 @@ def icon(self):
)
def createWidget(self, parent):
- return PreferencesWidget(parent)
+ return PreferencesWidget(self.qfieldSync, parent)
class QFieldSync(object):
@@ -125,15 +126,15 @@ def __init__(self, iface):
self.offline_editing = QgsOfflineEditing()
self.preferences = Preferences()
- QgsProject.instance().readProject.connect(self.update_button_enabled_status)
- QgsProject.instance().cleared.connect(self.update_button_enabled_status)
+ QgsProject.instance().readProject.connect(self.update_action_enabled_status)
+ QgsProject.instance().cleared.connect(self.update_action_enabled_status)
# store warnings from last run
self.last_action_warnings = []
self.network_manager = CloudNetworkAccessManager(self.iface.mainWindow())
self.network_manager.projects_cache.projects_updated.connect(
- self.update_button_enabled_status
+ self.update_action_enabled_status
)
self.cloud_item_provider = QFieldCloudItemProvider(self.network_manager)
@@ -264,19 +265,36 @@ def initGui(self):
parent=self.iface.mainWindow(),
)
- self.push_action = self.add_action(
+ self.push_action_toolbar = self.add_action(
+ QIcon(os.path.join(os.path.dirname(__file__), "resources/package.svg")),
+ text=self.tr("Package for QField"),
+ callback=self.show_package_dialog,
+ parent=self.iface.mainWindow(),
+ separator_before=True,
+ add_to_menu=False,
+ )
+ self.push_action_menu = self.add_action(
QIcon(os.path.join(os.path.dirname(__file__), "resources/package.svg")),
text=self.tr("Package for QField"),
callback=self.show_package_dialog,
parent=self.iface.mainWindow(),
separator_before=True,
+ add_to_toolbar=False,
)
- self.sync_action = self.add_action(
+ self.sync_action_toolbar = self.add_action(
+ QIcon(os.path.join(os.path.dirname(__file__), "resources/synchronize.svg")),
+ text=self.tr("Synchronize from QField"),
+ callback=self.show_synchronize_dialog,
+ parent=self.iface.mainWindow(),
+ add_to_menu=False,
+ )
+ self.sync_action_menu = self.add_action(
QIcon(os.path.join(os.path.dirname(__file__), "resources/synchronize.svg")),
text=self.tr("Synchronize from QField"),
callback=self.show_synchronize_dialog,
parent=self.iface.mainWindow(),
+ add_to_toolbar=False,
)
self.add_action(
@@ -288,7 +306,6 @@ def initGui(self):
text=self.tr("Configure Current Project"),
callback=self.show_project_configuration_dialog,
parent=self.iface.mainWindow(),
- separator_before=True,
)
self.add_action(
@@ -315,11 +332,12 @@ def initGui(self):
self.iface.registerProjectPropertiesWidgetFactory(
self.project_properties_factory
)
- self.options_factory = QFieldSyncOptionsFactory()
+ self.options_factory = QFieldSyncOptionsFactory(self)
self.options_factory.setTitle(self.tr("QField"))
self.iface.registerOptionsWidgetFactory(self.options_factory)
- self.update_button_enabled_status()
+ self.update_button_visibility()
+ self.update_action_enabled_status()
def unload(self):
"""Removes the plugin menu item and icon from QGIS GUI."""
@@ -396,7 +414,7 @@ def show_package_dialog(self):
self.push_dlg.show()
self.push_dlg.finished.connect(self.push_dialog_finished)
- self.update_button_enabled_status()
+ self.update_action_enabled_status()
def show_project_configuration_dialog(self):
"""
@@ -453,17 +471,28 @@ def clear_last_action_warnings(self):
def push_dialog_finished(self):
"""
When the push dialog is closed, make sure it's no longer
- enabled before entering update_button_enabled_status()
+ enabled before entering update_action_enabled_status()
"""
try:
self.push_dlg.setEnabled(False)
except RuntimeError:
pass
- self.update_button_enabled_status()
+ self.update_action_enabled_status()
+
+ def update_button_visibility(self):
+ """
+ Will update the plugin toolbar buttons according to open dialog and project properties.
+ """
+ self.push_action_toolbar.setVisible(
+ self.preferences.value("showPackagingActions")
+ )
+ self.sync_action_toolbar.setVisible(
+ self.preferences.value("showPackagingActions")
+ )
- def update_button_enabled_status(self):
+ def update_action_enabled_status(self):
"""
- Will update the plugin buttons according to open dialog and project properties.
+ Will update the plugin actions according to open dialog and project properties.
"""
if self.network_manager.projects_cache.is_currently_open_project_cloud_local:
self.cloud_synchronize_action.setEnabled(True)
@@ -476,9 +505,11 @@ def update_button_enabled_status(self):
dialog_is_enabled = False
if self.offline_editing.isOfflineProject() or dialog_is_enabled:
- self.push_action.setEnabled(False)
+ self.push_action_toolbar.setEnabled(False)
+ self.push_action_menu.setEnabled(False)
else:
- self.push_action.setEnabled(True)
+ self.push_action_toolbar.setEnabled(True)
+ self.push_action_menu.setEnabled(True)
def get_qfield_action(self) -> QAction:
actions = self.iface.pluginMenu().actions()
diff --git a/qfieldsync/ui/preferences_widget.ui b/qfieldsync/ui/preferences_widget.ui
index 7b1d52f0..433c93f8 100644
--- a/qfieldsync/ui/preferences_widget.ui
+++ b/qfieldsync/ui/preferences_widget.ui
@@ -95,6 +95,16 @@
-
+ -
+
+
+ Show packaging actions in the toolbar
+
+
+ Store QFieldCloud credentials and automatically sign in on QGIS startup.
+
+
+