-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Monthly Contributors Error Dialog #640
Open
VitorVieiraZ
wants to merge
15
commits into
master
Choose a base branch
from
enhancement/newProjectLimitHitDialog
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
2707841
new dialog impl
VitorVieiraZ b187b78
dialog exec
VitorVieiraZ 0edb653
new code adjustments
VitorVieiraZ cf27787
last adjustments before review - dialog and code
VitorVieiraZ c75fa81
dialog title update
VitorVieiraZ 8b102b5
last code adjustments
VitorVieiraZ c28c7c2
updating to MonthlyContributorsError
VitorVieiraZ 0af5e53
code layout adjustment
VitorVieiraZ 94d7e78
fixing dialog
VitorVieiraZ 1e1253e
finalizing dialog usage
VitorVieiraZ 4491267
post review updates
VitorVieiraZ c88c027
code formatting
VitorVieiraZ f3d6f77
reverting dot
VitorVieiraZ f1ea460
dialog adjustmenet
VitorVieiraZ 193de9a
code formatting
VitorVieiraZ File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
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/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import os | ||
from qgis.PyQt import uic | ||
from qgis.PyQt.QtWidgets import QDialog, QDialogButtonBox | ||
from qgis.PyQt.QtCore import QUrl | ||
from qgis.PyQt.QtGui import QDesktopServices | ||
|
||
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): | ||
QDialog.__init__(self, parent) | ||
self.ui = uic.loadUi(ui_file, self) | ||
|
||
self.server_response = e.server_response | ||
self.set_dialog_style() | ||
|
||
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"You've reached the maximum number of active monthly contributors ({quota}) for your current subscription." | ||
) | ||
self.label.setText(quota_text) | ||
|
||
def open_upgrade_link(self): | ||
QDesktopServices.openUrl(QUrl(MerginHelp().mergin_subscription_link())) | ||
self.accept() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>Dialog</class> | ||
<widget class="QDialog" name="Dialog"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>367</width> | ||
<height>163</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Monthly Contributors Limit Hit</string> | ||
</property> | ||
<layout class="QGridLayout" name="gridLayout"> | ||
<item row="2" column="0"> | ||
<layout class="QHBoxLayout" name="horizontalLayout_3"> | ||
<item> | ||
<widget class="QDialogButtonBox" name="buttonBox"> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> | ||
<horstretch>0</horstretch> | ||
<verstretch>0</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<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> | ||
</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> | ||
VitorVieiraZ marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</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"> | ||
<string>Upgrade your subscription or wait until next month | ||
for the limit to reset.</string> | ||
</property> | ||
<property name="alignment"> | ||
<set>Qt::AlignCenter</set> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some nit picking - this might seem more friendly for users in case we have issues reading the quota