Skip to content

Commit

Permalink
post review updates
Browse files Browse the repository at this point in the history
  • Loading branch information
VitorVieiraZ committed Nov 15, 2024
1 parent 1e1253e commit 4491267
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 92 deletions.
10 changes: 6 additions & 4 deletions Mergin/help.py
Original file line number Diff line number Diff line change
@@ -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/"
21 changes: 12 additions & 9 deletions Mergin/monthly_contributors_error_dialog.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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 {
Expand All @@ -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()
125 changes: 46 additions & 79 deletions Mergin/ui/ui_monthly_contributors_error_dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,14 @@
<rect>
<x>0</x>
<y>0</y>
<width>367</width>
<width>366</width>
<height>212</height>
</rect>
</property>
<property name="windowTitle">
<string>Monthly Contributors Error</string>
<string>Monthly Contributors Limit Hit</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>16</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>You've reached the maximum number of active monthly contributors for your current subscription.</string>
</property>
<property name="textFormat">
<enum>Qt::AutoText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QProgressBar" name="plan_quota_progress_bar">
<property name="enabled">
Expand Down Expand Up @@ -77,62 +48,52 @@
</property>
</widget>
</item>
<item row="5" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="cancel_btn">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="upgrade_plan_btn">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>Upgrade</string>
</property>
<property name="default">
<bool>true</bool>
</property>
<property name="flat">
<bool>false</bool>
<string>Monthly Contributors</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>16</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>You've reached the maximum number of active monthly contributors for your current subscription.</string>
</property>
<property name="textFormat">
<enum>Qt::AutoText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
Expand All @@ -144,18 +105,24 @@ for the limit to reset.</string>
</property>
</widget>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item row="4" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Monthly Contributors</string>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
<property name="centerButtons">
<bool>true</bool>
</property>
</widget>
</item>
Expand Down

0 comments on commit 4491267

Please sign in to comment.