diff --git a/res/ui/preferences.ui b/res/ui/preferences.ui index fb22b90836b734d2052cd1ba1906de1759353a9d..cd29dddabdc898f26ca91d8e1dff81829b53cd5b 100644 --- a/res/ui/preferences.ui +++ b/res/ui/preferences.ui @@ -96,10 +96,17 @@ <item> <widget class="QStackedWidget" name="stackedWidget"> <property name="currentIndex"> - <number>0</number> + <number>1</number> </property> <widget class="QWidget" name="page"> <layout class="QVBoxLayout" name="verticalLayout_7"> + <item> + <widget class="QLabel" name="label_7"> + <property name="text"> + <string><html><head/><body><p><span style=" font-size:16pt; font-weight:600;">General settings</span></p></body></html></string> + </property> + </widget> + </item> <item> <layout class="QHBoxLayout" name="horizontalLayout"> <item> @@ -179,6 +186,13 @@ </widget> <widget class="QWidget" name="page_2"> <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QLabel" name="label_9"> + <property name="text"> + <string><html><head/><body><p><span style=" font-size:16pt; font-weight:600;">Display settings</span></p></body></html></string> + </property> + </widget> + </item> <item> <layout class="QHBoxLayout" name="horizontalLayout_6"> <item> @@ -265,6 +279,33 @@ </item> </layout> </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_10"> + <property name="topMargin"> + <number>6</number> + </property> + <item> + <spacer name="horizontalSpacer_5"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QCheckBox" name="checkbox_international_system"> + <property name="text"> + <string>Use International System of Units</string> + </property> + </widget> + </item> + </layout> + </item> <item> <spacer name="verticalSpacer_2"> <property name="orientation"> @@ -282,10 +323,17 @@ </widget> <widget class="QWidget" name="page_3"> <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="QLabel" name="label_10"> + <property name="text"> + <string><html><head/><body><p><span style=" font-size:16pt; font-weight:600;">Network settings</span></p></body></html></string> + </property> + </widget> + </item> <item> <widget class="QCheckBox" name="checkbox_proxy"> <property name="text"> - <string>Utiliser un serveur proxy</string> + <string>Use a proxy server</string> </property> </widget> </item> @@ -361,20 +409,6 @@ </property> </widget> </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_10"> - <item> - <widget class="QLabel" name="label_7"> - <property name="text"> - <string>Requested data validation : </string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="spinbox_data_validation"/> - </item> - </layout> - </item> <item> <spacer name="verticalSpacer_3"> <property name="orientation"> diff --git a/src/cutecoin/core/app.py b/src/cutecoin/core/app.py index 4cb7c3cae5df9794282da3b226e8daebc81e63da..625f4a893823bdd8eea9398eae2c552919107ad3 100644 --- a/src/cutecoin/core/app.py +++ b/src/cutecoin/core/app.py @@ -64,7 +64,7 @@ class Application(QObject): 'proxy_type': "HTTP", 'proxy_address': "", 'proxy_port': 8080, - 'data_validation': 2 + 'international_system_of_units': True } @classmethod diff --git a/src/cutecoin/gui/preferences.py b/src/cutecoin/gui/preferences.py index bd5b6f529e0fa38277c34ff6119b1b33f54bf816..0372232d729004eaa1215f7da98e50eba0392aa8 100644 --- a/src/cutecoin/gui/preferences.py +++ b/src/cutecoin/gui/preferences.py @@ -6,7 +6,7 @@ Created on 11 mai 2015 from PyQt5.QtCore import QCoreApplication -from ..core.account import Account +from ..core import money from . import toast from PyQt5.QtWidgets import QDialog from PyQt5.QtGui import QIcon @@ -32,8 +32,8 @@ class PreferencesDialog(QDialog, Ui_PreferencesDialog): for account_name in self.app.accounts.keys(): self.combo_account.addItem(account_name) self.combo_account.setCurrentText(self.app.preferences['account']) - for ref in Account.referentials: - self.combo_referential.addItem(QCoreApplication.translate('Account', ref[4])) + for ref in money.Referentials: + self.combo_referential.addItem(QCoreApplication.translate('Account', ref.translated_name())) self.combo_referential.setCurrentIndex(self.app.preferences['ref']) for lang in ('en_GB', 'fr_FR'): self.combo_language.addItem(lang) @@ -41,15 +41,13 @@ class PreferencesDialog(QDialog, Ui_PreferencesDialog): self.checkbox_expertmode.setChecked(self.app.preferences.get('expert_mode', False)) self.checkbox_maximize.setChecked(self.app.preferences.get('maximized', False)) self.checkbox_notifications.setChecked(self.app.preferences.get('notifications', True)) + self.checkbox_international_system.setChecked(self.app.preferences.get('international_system_of_units', True)) self.spinbox_digits_comma.setValue(self.app.preferences.get('digits_after_comma', 2)) self.spinbox_digits_comma.setMaximum(12) self.spinbox_digits_comma.setMinimum(1) self.button_app.clicked.connect(lambda: self.stackedWidget.setCurrentIndex(0)) self.button_display.clicked.connect(lambda: self.stackedWidget.setCurrentIndex(1)) self.button_network.clicked.connect(lambda: self.stackedWidget.setCurrentIndex(2)) - self.spinbox_data_validation.setValue(self.app.preferences.get('data_validation', 2)) - self.spinbox_data_validation.setMinimum(0) - self.spinbox_data_validation.setMaximum(100) self.checkbox_proxy.setChecked(self.app.preferences.get('enable_proxy', False)) self.spinbox_proxy_port.setEnabled(self.checkbox_proxy.isChecked()) @@ -78,7 +76,7 @@ class PreferencesDialog(QDialog, Ui_PreferencesDialog): 'proxy_type': self.combox_proxytype.currentText(), 'proxy_address': self.edit_proxy_address.text(), 'proxy_port': self.spinbox_proxy_port.value(), - 'data_validation': self.spinbox_data_validation.value()} + 'international_system_of_units': self.checkbox_international_system.isChecked()} self.app.save_preferences(pref) toast.display(self.tr("Preferences"), self.tr("A restart is needed to apply your new preferences.")) diff --git a/src/cutecoin/models/txhistory.py b/src/cutecoin/models/txhistory.py index eb6cf90ced4fa2df6e4fdce40f6ca590f0d34c7f..41c6131787f697c69fd9b7068427b4aebd3ae56b 100644 --- a/src/cutecoin/models/txhistory.py +++ b/src/cutecoin/models/txhistory.py @@ -112,7 +112,8 @@ class TxFilterProxyModel(QSortFilterProxyModel): if source_index.column() == model.columns_types.index('payment') or \ source_index.column() == model.columns_types.index('deposit'): if source_data is not "": - return self.account.current_ref(source_data, self.community, self.app).diff_localized(international_system=True) + return self.account.current_ref(source_data, self.community, self.app)\ + .diff_localized(international_system=self.app.preferences['international_system_of_units']) if role == Qt.FontRole: font = QFont()