|
|
|
@ -2,11 +2,11 @@ import copy |
|
|
|
from decimal import Decimal |
|
|
|
from decimal import Decimal |
|
|
|
from typing import TYPE_CHECKING |
|
|
|
from typing import TYPE_CHECKING |
|
|
|
|
|
|
|
|
|
|
|
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject |
|
|
|
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject, QRegularExpression |
|
|
|
|
|
|
|
|
|
|
|
from electrum.i18n import set_language, languages |
|
|
|
from electrum.i18n import set_language, languages |
|
|
|
from electrum.logging import get_logger |
|
|
|
from electrum.logging import get_logger |
|
|
|
from electrum.util import DECIMAL_POINT_DEFAULT, format_satoshis |
|
|
|
from electrum.util import DECIMAL_POINT_DEFAULT, base_unit_name_to_decimal_point |
|
|
|
from electrum.invoices import PR_DEFAULT_EXPIRATION_WHEN_CREATING |
|
|
|
from electrum.invoices import PR_DEFAULT_EXPIRATION_WHEN_CREATING |
|
|
|
|
|
|
|
|
|
|
|
from .qetypes import QEAmount |
|
|
|
from .qetypes import QEAmount |
|
|
|
@ -82,6 +82,15 @@ class QEConfig(AuthMixin, QObject): |
|
|
|
self.config.set_base_unit(unit) |
|
|
|
self.config.set_base_unit(unit) |
|
|
|
self.baseUnitChanged.emit() |
|
|
|
self.baseUnitChanged.emit() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pyqtProperty('QRegularExpression', notify=baseUnitChanged) |
|
|
|
|
|
|
|
def btcAmountRegex(self): |
|
|
|
|
|
|
|
decimal_point = base_unit_name_to_decimal_point(self.config.get_base_unit()) |
|
|
|
|
|
|
|
exp = '[0-9]{0,8}' |
|
|
|
|
|
|
|
if decimal_point: |
|
|
|
|
|
|
|
exp += '\\.' |
|
|
|
|
|
|
|
exp += '[0-9]{0,%d}' % decimal_point |
|
|
|
|
|
|
|
return QRegularExpression(exp) |
|
|
|
|
|
|
|
|
|
|
|
thousandsSeparatorChanged = pyqtSignal() |
|
|
|
thousandsSeparatorChanged = pyqtSignal() |
|
|
|
@pyqtProperty(bool, notify=thousandsSeparatorChanged) |
|
|
|
@pyqtProperty(bool, notify=thousandsSeparatorChanged) |
|
|
|
def thousandsSeparator(self): |
|
|
|
def thousandsSeparator(self): |
|
|
|
|