Skip to content
Snippets Groups Projects
Commit 5c368858 authored by inso's avatar inso
Browse files

Working on preferences :

- International system of units option added
- Removed data validation option
- Added titles
- Fixed checkbox text in french to en_US
parent 09172ae1
Branches
Tags
No related merge requests found
...@@ -96,10 +96,17 @@ ...@@ -96,10 +96,17 @@
<item> <item>
<widget class="QStackedWidget" name="stackedWidget"> <widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="page"> <widget class="QWidget" name="page">
<layout class="QVBoxLayout" name="verticalLayout_7"> <layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:16pt; font-weight:600;&quot;&gt;General settings&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
...@@ -179,6 +186,13 @@ ...@@ -179,6 +186,13 @@
</widget> </widget>
<widget class="QWidget" name="page_2"> <widget class="QWidget" name="page_2">
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:16pt; font-weight:600;&quot;&gt;Display settings&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_6"> <layout class="QHBoxLayout" name="horizontalLayout_6">
<item> <item>
...@@ -265,6 +279,33 @@ ...@@ -265,6 +279,33 @@
</item> </item>
</layout> </layout>
</item> </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> <item>
<spacer name="verticalSpacer_2"> <spacer name="verticalSpacer_2">
<property name="orientation"> <property name="orientation">
...@@ -282,10 +323,17 @@ ...@@ -282,10 +323,17 @@
</widget> </widget>
<widget class="QWidget" name="page_3"> <widget class="QWidget" name="page_3">
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label_10">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:16pt; font-weight:600;&quot;&gt;Network settings&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QCheckBox" name="checkbox_proxy"> <widget class="QCheckBox" name="checkbox_proxy">
<property name="text"> <property name="text">
<string>Utiliser un serveur proxy</string> <string>Use a proxy server</string>
</property> </property>
</widget> </widget>
</item> </item>
...@@ -361,20 +409,6 @@ ...@@ -361,20 +409,6 @@
</property> </property>
</widget> </widget>
</item> </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> <item>
<spacer name="verticalSpacer_3"> <spacer name="verticalSpacer_3">
<property name="orientation"> <property name="orientation">
......
...@@ -64,7 +64,7 @@ class Application(QObject): ...@@ -64,7 +64,7 @@ class Application(QObject):
'proxy_type': "HTTP", 'proxy_type': "HTTP",
'proxy_address': "", 'proxy_address': "",
'proxy_port': 8080, 'proxy_port': 8080,
'data_validation': 2 'international_system_of_units': True
} }
@classmethod @classmethod
......
...@@ -6,7 +6,7 @@ Created on 11 mai 2015 ...@@ -6,7 +6,7 @@ Created on 11 mai 2015
from PyQt5.QtCore import QCoreApplication from PyQt5.QtCore import QCoreApplication
from ..core.account import Account from ..core import money
from . import toast from . import toast
from PyQt5.QtWidgets import QDialog from PyQt5.QtWidgets import QDialog
from PyQt5.QtGui import QIcon from PyQt5.QtGui import QIcon
...@@ -32,8 +32,8 @@ class PreferencesDialog(QDialog, Ui_PreferencesDialog): ...@@ -32,8 +32,8 @@ class PreferencesDialog(QDialog, Ui_PreferencesDialog):
for account_name in self.app.accounts.keys(): for account_name in self.app.accounts.keys():
self.combo_account.addItem(account_name) self.combo_account.addItem(account_name)
self.combo_account.setCurrentText(self.app.preferences['account']) self.combo_account.setCurrentText(self.app.preferences['account'])
for ref in Account.referentials: for ref in money.Referentials:
self.combo_referential.addItem(QCoreApplication.translate('Account', ref[4])) self.combo_referential.addItem(QCoreApplication.translate('Account', ref.translated_name()))
self.combo_referential.setCurrentIndex(self.app.preferences['ref']) self.combo_referential.setCurrentIndex(self.app.preferences['ref'])
for lang in ('en_GB', 'fr_FR'): for lang in ('en_GB', 'fr_FR'):
self.combo_language.addItem(lang) self.combo_language.addItem(lang)
...@@ -41,15 +41,13 @@ class PreferencesDialog(QDialog, Ui_PreferencesDialog): ...@@ -41,15 +41,13 @@ class PreferencesDialog(QDialog, Ui_PreferencesDialog):
self.checkbox_expertmode.setChecked(self.app.preferences.get('expert_mode', False)) self.checkbox_expertmode.setChecked(self.app.preferences.get('expert_mode', False))
self.checkbox_maximize.setChecked(self.app.preferences.get('maximized', False)) self.checkbox_maximize.setChecked(self.app.preferences.get('maximized', False))
self.checkbox_notifications.setChecked(self.app.preferences.get('notifications', True)) 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.setValue(self.app.preferences.get('digits_after_comma', 2))
self.spinbox_digits_comma.setMaximum(12) self.spinbox_digits_comma.setMaximum(12)
self.spinbox_digits_comma.setMinimum(1) self.spinbox_digits_comma.setMinimum(1)
self.button_app.clicked.connect(lambda: self.stackedWidget.setCurrentIndex(0)) self.button_app.clicked.connect(lambda: self.stackedWidget.setCurrentIndex(0))
self.button_display.clicked.connect(lambda: self.stackedWidget.setCurrentIndex(1)) self.button_display.clicked.connect(lambda: self.stackedWidget.setCurrentIndex(1))
self.button_network.clicked.connect(lambda: self.stackedWidget.setCurrentIndex(2)) 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.checkbox_proxy.setChecked(self.app.preferences.get('enable_proxy', False))
self.spinbox_proxy_port.setEnabled(self.checkbox_proxy.isChecked()) self.spinbox_proxy_port.setEnabled(self.checkbox_proxy.isChecked())
...@@ -78,7 +76,7 @@ class PreferencesDialog(QDialog, Ui_PreferencesDialog): ...@@ -78,7 +76,7 @@ class PreferencesDialog(QDialog, Ui_PreferencesDialog):
'proxy_type': self.combox_proxytype.currentText(), 'proxy_type': self.combox_proxytype.currentText(),
'proxy_address': self.edit_proxy_address.text(), 'proxy_address': self.edit_proxy_address.text(),
'proxy_port': self.spinbox_proxy_port.value(), '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) self.app.save_preferences(pref)
toast.display(self.tr("Preferences"), toast.display(self.tr("Preferences"),
self.tr("A restart is needed to apply your new preferences.")) self.tr("A restart is needed to apply your new preferences."))
......
...@@ -112,7 +112,8 @@ class TxFilterProxyModel(QSortFilterProxyModel): ...@@ -112,7 +112,8 @@ class TxFilterProxyModel(QSortFilterProxyModel):
if source_index.column() == model.columns_types.index('payment') or \ if source_index.column() == model.columns_types.index('payment') or \
source_index.column() == model.columns_types.index('deposit'): source_index.column() == model.columns_types.index('deposit'):
if source_data is not "": 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: if role == Qt.FontRole:
font = QFont() font = QFont()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment