diff --git a/Mergin/help.py b/Mergin/help.py index 951da21..4c3989d 100644 --- a/Mergin/help.py +++ b/Mergin/help.py @@ -1,11 +1,13 @@ -HELP_ROOT = "https://merginmaps.com/docs" - +MAIN_ROOT = "https://merginmaps.com/" class MerginHelp: """Class for generating Mergin plugin help URLs.""" def howto_attachment_widget(self): - return f"{HELP_ROOT}/layer/settingup_forms/" + return f"{MAIN_ROOT}/docs/layer/settingup_forms/" def howto_background_maps(self): - return f"{HELP_ROOT}/gis/settingup_background_map/" + return f"{MAIN_ROOT}/docs/gis/settingup_background_map/" + + def mergin_subscription_link(self): + return f"{MAIN_ROOT}/pricing/" diff --git a/Mergin/monthly_contributors_error_dialog.py b/Mergin/monthly_contributors_error_dialog.py index c4bbe44..d95bb2a 100644 --- a/Mergin/monthly_contributors_error_dialog.py +++ b/Mergin/monthly_contributors_error_dialog.py @@ -1,11 +1,12 @@ import os from qgis.PyQt import uic -from qgis.PyQt.QtWidgets import QDialog +from qgis.PyQt.QtWidgets import QDialog, QDialogButtonBox from qgis.PyQt.QtCore import QUrl from qgis.PyQt.QtGui import QDesktopServices -ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), "ui", "ui_monthly_contributors_error_dialog.ui") +from .help import MerginHelp +ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), "ui", "ui_monthly_contributors_error_dialog.ui") class MonthlyContributorsErrorDialog(QDialog): def __init__(self, e, parent=None): @@ -14,15 +15,18 @@ def __init__(self, e, parent=None): self.server_response = e.server_response self.set_dialog_style() - - self.cancel_btn.clicked.connect(self.reject) - self.upgrade_plan_btn.clicked.connect(self.open_upgrade_link) + + self.buttonBox.accepted.connect(self.open_upgrade_link) + self.buttonBox.rejected.connect(self.reject) def set_dialog_style(self): + upgrade_button = self.buttonBox.button(QDialogButtonBox.Ok) + upgrade_button.setText("Upgrade") + quota = self.server_response.get("contributors_quota", "#NA") quota_text = f"{quota}/{quota}" - self.plan_quota_progress_bar.setFormat(quota_text) + self.plan_quota_progress_bar.setStyleSheet( """ QProgressBar { @@ -32,9 +36,8 @@ def set_dialog_style(self): QProgressBar::chunk { background-color: rgb(0, 76, 69); } - """ - ) + """) def open_upgrade_link(self): - QDesktopServices.openUrl(QUrl("https://www.merginmaps.com/pricing")) + QDesktopServices.openUrl(QUrl(MerginHelp().mergin_subscription_link())) self.accept() diff --git a/Mergin/ui/ui_monthly_contributors_error_dialog.ui b/Mergin/ui/ui_monthly_contributors_error_dialog.ui index 280fe94..a3b8c33 100644 --- a/Mergin/ui/ui_monthly_contributors_error_dialog.ui +++ b/Mergin/ui/ui_monthly_contributors_error_dialog.ui @@ -6,43 +6,14 @@ 0 0 - 367 + 366 212 - Monthly Contributors Error + Monthly Contributors Limit Hit - - - - - 0 - 0 - - - - - 16 - 75 - true - - - - You've reached the maximum number of active monthly contributors for your current subscription. - - - Qt::AutoText - - - Qt::AlignCenter - - - true - - - @@ -77,10 +48,10 @@ - - + + - + 0 @@ -88,51 +59,41 @@ - Cancel - - - - - - - true - - - - 0 - 0 - - - - - 100 - 0 - - - - - 200 - 16777215 - - - - - true - - - - Upgrade - - - true - - - false + Monthly Contributors + + + + + 0 + 0 + + + + + 16 + 75 + true + + + + You've reached the maximum number of active monthly contributors for your current subscription. + + + Qt::AutoText + + + Qt::AlignCenter + + + true + + + @@ -144,18 +105,24 @@ for the limit to reset. - - + + - + 0 0 - - Monthly Contributors + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + true