up
This commit is contained in:
parent
4ee7f50d65
commit
deb80bc9b2
@ -3,7 +3,7 @@ import platform
|
||||
import uuid
|
||||
import requests
|
||||
from datetime import datetime
|
||||
from typing import Optional, Dict
|
||||
from typing import Dict
|
||||
from PyQt6.QtCore import QObject, pyqtSignal
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
@ -173,11 +173,11 @@ class LicenseManager(QObject):
|
||||
"""Retourne le type de licence (free, premium, etc.)"""
|
||||
# Si le système de licence est désactivé, retourner "free"
|
||||
if not self.licensing_enabled:
|
||||
return "free"
|
||||
return None
|
||||
|
||||
if not self.license_data:
|
||||
return "free"
|
||||
return self.license_data.get("type", "free")
|
||||
return None
|
||||
return self.license_data.get("type", None)
|
||||
|
||||
def is_feature_available(self, feature_id: str) -> bool:
|
||||
"""
|
||||
@ -192,7 +192,7 @@ class LicenseManager(QObject):
|
||||
|
||||
# Si pas de licence, vérifier dans la config des features gratuites
|
||||
if not self.is_activated():
|
||||
free_features = self.settings_manager.get_config("features_by_license").get("free", [])
|
||||
free_features = self.settings_manager.get_config("features_by_license").get(None, [])
|
||||
return feature_id in free_features
|
||||
|
||||
# Vérifier les features autorisées par la licence
|
||||
@ -200,13 +200,13 @@ class LicenseManager(QObject):
|
||||
features_by_type = self.settings_manager.get_config("features_by_license")
|
||||
allowed_features = features_by_type.get(license_type, [])
|
||||
|
||||
return feature_id in allowed_features or feature_id in self.settings_manager.get_config("free_features")
|
||||
return feature_id in allowed_features
|
||||
|
||||
def get_license_info(self) -> Dict:
|
||||
"""Retourne les informations de la licence"""
|
||||
if not self.license_data:
|
||||
return {
|
||||
"type": "free",
|
||||
"type": None,
|
||||
"status": "inactive",
|
||||
"expires_at": None
|
||||
}
|
||||
|
||||
@ -150,7 +150,7 @@ class ActivationWindow(QWidget):
|
||||
self.key_input.setEnabled(False)
|
||||
self.activate_btn.setEnabled(False)
|
||||
else:
|
||||
status_text = f"{self.language_manager.get_text('license_free_mode')}"
|
||||
status_text = f"{self.language_manager.get_text('no_license')}"
|
||||
self.status_label.setText(status_text)
|
||||
|
||||
def format_license_key(self, text):
|
||||
|
||||
@ -9,16 +9,15 @@
|
||||
"git_repo": "https://gitea.louismazin.ovh/LouisMazin/PythonApplicationTemplate",
|
||||
"enable_licensing": true,
|
||||
"features_by_license": {
|
||||
"free": [
|
||||
"basic_features"
|
||||
"basic": [
|
||||
"support"
|
||||
],
|
||||
"premium": [
|
||||
"basic_features",
|
||||
"priority_support"
|
||||
],
|
||||
"enterprise": [
|
||||
"basic_features",
|
||||
"priority_support"
|
||||
"priority_support",
|
||||
"unlimited_key_uses"
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -42,22 +42,23 @@
|
||||
"activate": "Activate",
|
||||
"buy_license": "Buy License",
|
||||
"comparaisons": "Version Comparison",
|
||||
"free_version": "Free Version",
|
||||
"basic_version": "Basic Version",
|
||||
"premium_version": "Premium Version",
|
||||
"enterprise_version": "Enterprise Version",
|
||||
"basic_features": "Basic features",
|
||||
"support": "Support",
|
||||
"priority_support": "Priority support",
|
||||
"unlimited_key_uses": "Unlimited key uses",
|
||||
"license_active": "License active",
|
||||
"license_type": "Type",
|
||||
"license_email": "Email",
|
||||
"license_expires": "Expires on",
|
||||
"license_free_mode": "Free mode - Activate a license for more features",
|
||||
"license_basic_mode": "Basic mode - Activate a license for more features",
|
||||
"invalid_license_key": "Invalid license key. It must contain at least 16 characters.",
|
||||
"premium_feature": "Premium Feature",
|
||||
"premium_feature_message": "The feature '{feature}' requires a Premium or Enterprise license.",
|
||||
"upgrade_prompt": "Would you like to upgrade your license?",
|
||||
"buy_now": "Buy Now",
|
||||
"cancel": "Cancel",
|
||||
"activation_required": "Activation is required to continue.",
|
||||
"compare_versions": "Compare Versions"
|
||||
"compare_versions": "Compare Versions",
|
||||
"no_license": "No License"
|
||||
}
|
||||
@ -42,16 +42,17 @@
|
||||
"activate": "Activer",
|
||||
"buy_license": "Acheter une licence",
|
||||
"comparaisons": "Comparaison des versions",
|
||||
"free_version": "Version Gratuite",
|
||||
"basic_version": "Version Basique",
|
||||
"premium_version": "Version Premium",
|
||||
"enterprise_version": "Version Enterprise",
|
||||
"basic_features": "Fonctionnalités de base",
|
||||
"support": "Support",
|
||||
"priority_support": "Support prioritaire",
|
||||
"unlimited_key_uses": "Utilisations de clé illimitées",
|
||||
"license_active": "Licence active",
|
||||
"license_type": "Type",
|
||||
"license_email": "Email",
|
||||
"license_expires": "Expire le",
|
||||
"license_free_mode": "Mode gratuit - Activez une licence pour plus de fonctionnalités",
|
||||
"license_basic_mode": "Mode basique - Activez une licence pour plus de fonctionnalités",
|
||||
"invalid_license_key": "Clé de licence invalide. Elle doit contenir au moins 16 caractères.",
|
||||
"premium_feature": "Fonctionnalité Premium",
|
||||
"premium_feature_message": "La fonctionnalité '{feature}' nécessite une licence Premium ou Enterprise.",
|
||||
@ -59,5 +60,6 @@
|
||||
"buy_now": "Acheter maintenant",
|
||||
"cancel": "Annuler",
|
||||
"activation_required": "L'activation est requise pour continuer.",
|
||||
"compare_versions": "Comparer les versions"
|
||||
"compare_versions": "Comparer les versions",
|
||||
"no_license": "Pas de licence"
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user