test(subscription): suspend client access checks
This commit is contained in:
+14
-2
@@ -20,6 +20,8 @@ from .workers import SubscriptionCheckWorker
|
||||
PREFERRED_WINDOW_SIZE = (1180, 760)
|
||||
MIN_WINDOW_SIZE = (960, 640)
|
||||
WINDOW_SCREEN_MARGIN = 40
|
||||
# 订阅服务仍在联调期,暂不让客户端检查或限制本地工作流。
|
||||
SUBSCRIPTION_CHECK_ENABLED = False
|
||||
|
||||
|
||||
def _screen_available_geometry():
|
||||
@@ -132,7 +134,12 @@ class MainWindow(QMainWindow):
|
||||
self._header_title_label.setStyleSheet(
|
||||
"font-size: 15px; font-weight: 600; color: #24292f;"
|
||||
)
|
||||
self._subscription_label = QLabel("会员:正在验证")
|
||||
subscription_label_text = (
|
||||
"会员:正在验证"
|
||||
if SUBSCRIPTION_CHECK_ENABLED
|
||||
else "会员:订阅检测已暂停"
|
||||
)
|
||||
self._subscription_label = QLabel(subscription_label_text)
|
||||
self._subscription_label.setObjectName("subscriptionStatusLabel")
|
||||
self._subscription_label.setAccessibleName("会员状态")
|
||||
self._subscription_label.setStyleSheet("color: #0969da;")
|
||||
@@ -232,7 +239,6 @@ class MainWindow(QMainWindow):
|
||||
widget.refresh_gateway_state()
|
||||
label = "自定义网关" if str(backend) == "direct" else "默认网关"
|
||||
self.show_status("设置已保存,当前使用%s" % label, level="success")
|
||||
self.begin_subscription_check()
|
||||
|
||||
@property
|
||||
def subscription_status(self):
|
||||
@@ -241,6 +247,10 @@ class MainWindow(QMainWindow):
|
||||
def begin_subscription_check(self):
|
||||
"""Refresh membership state without blocking the Qt GUI thread."""
|
||||
|
||||
if not SUBSCRIPTION_CHECK_ENABLED:
|
||||
self._set_product_access(True)
|
||||
self._set_subscription_label("会员:订阅检测已暂停", "muted")
|
||||
return
|
||||
self._subscription_request_token += 1
|
||||
token = self._subscription_request_token
|
||||
if self._subscription_worker is not None:
|
||||
@@ -272,6 +282,8 @@ class MainWindow(QMainWindow):
|
||||
def ensure_subscription_for_new_submit(self, action_name="生成"):
|
||||
"""Return whether a new product request may start from the current UI."""
|
||||
|
||||
if not SUBSCRIPTION_CHECK_ENABLED:
|
||||
return True
|
||||
status = self._subscription_status
|
||||
if status.allows_product_workflows:
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user