Skip to content

Commit

Permalink
dialog adjustmenet
Browse files Browse the repository at this point in the history
  • Loading branch information
VitorVieiraZ committed Nov 21, 2024
1 parent f3d6f77 commit f1ea460
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 79 deletions.
16 changes: 2 additions & 14 deletions Mergin/monthly_contributors_error_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,8 @@ def set_dialog_style(self):
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 {
border: none;
text-align: center;
}
QProgressBar::chunk {
background-color: rgb(0, 76, 69);
}
"""
)
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()))
Expand Down
4 changes: 2 additions & 2 deletions Mergin/projects_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def create_project(self, project_name, project_dir, is_public, namespace):
# User friendly error messages
if e.http_error == 409:
msg = f'Project named "{project_name}" already exists in the workspace "{namespace}".\nPlease try renaming the project.'
elif e.http_error == 422:
elif e.server_code == ErrorCode.MonthlyContributorsLimitHit.value:
dlg = MonthlyContributorsErrorDialog(e)
dlg.exec()
return False
Expand Down Expand Up @@ -379,7 +379,7 @@ def sync_project(self, project_dir, project_name=None):
if dlg.exception.http_error == 400 and "Another process" in dlg.exception.detail:
# To note we check for a string since error in flask doesn't return server error code
msg = "Somebody else is syncing, please try again later"
elif dlg.exception.http_error == 422:
elif dlg.exception.server_code == ErrorCode.MonthlyContributorsLimitHit.value:
dlg = MonthlyContributorsErrorDialog(dlg.exception)
dlg.exec()
return
Expand Down
75 changes: 12 additions & 63 deletions Mergin/ui/ui_monthly_contributors_error_dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,60 +6,32 @@
<rect>
<x>0</x>
<y>0</y>
<width>366</width>
<height>212</height>
<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="3" column="0">
<widget class="QProgressBar" name="plan_quota_progress_bar">
<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>0</width>
<height>15</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>15</height>
</size>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<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 Expand Up @@ -105,29 +77,6 @@ for the limit to reset.</string>
</property>
</widget>
</item>
<item row="4" 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>
</layout>
</widget>
<resources/>
Expand Down

0 comments on commit f1ea460

Please sign in to comment.