mirror of
https://github.com/RolandWH/SIPPCompare.git
synced 2025-05-10 08:41:49 +01:00
switch from un-used trade QComboBox to FastEditQSpinBox
This commit is contained in:
parent
2422395759
commit
78323c2ad8
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>420</width>
|
<width>420</width>
|
||||||
<height>240</height>
|
<height>243</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
@ -16,12 +16,6 @@
|
|||||||
<height>240</height>
|
<height>240</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>420</width>
|
|
||||||
<height>240</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>SIPPCompare</string>
|
<string>SIPPCompare</string>
|
||||||
</property>
|
</property>
|
||||||
@ -35,7 +29,7 @@
|
|||||||
<x>10</x>
|
<x>10</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>401</width>
|
<width>401</width>
|
||||||
<height>184</height>
|
<height>188</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
@ -145,18 +139,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
|
||||||
<widget class="QComboBox" name="fund_trades_combo">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<pointsize>11</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="editable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0" colspan="2">
|
<item row="5" column="0" colspan="2">
|
||||||
<widget class="QPushButton" name="calc_but">
|
<widget class="QPushButton" name="calc_but">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
@ -173,14 +155,35 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QComboBox" name="share_trades_combo">
|
<widget class="FastEditQSpinBox" name="share_trades_box">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<pointsize>11</pointsize>
|
<pointsize>11</pointsize>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="editable">
|
<property name="correctionMode">
|
||||||
<bool>true</bool>
|
<enum>QAbstractSpinBox::CorrectionMode::CorrectToNearestValue</enum>
|
||||||
|
</property>
|
||||||
|
<property name="prefix">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>999</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="FastEditQSpinBox" name="fund_trades_box">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>11</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="correctionMode">
|
||||||
|
<enum>QAbstractSpinBox::CorrectionMode::CorrectToNearestValue</enum>
|
||||||
|
</property>
|
||||||
|
<property name="prefix">
|
||||||
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -235,11 +238,16 @@
|
|||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>FastEditQSpinBox</class>
|
||||||
|
<extends>QSpinBox</extends>
|
||||||
|
<header>widgets/fastedit_spinbox</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>value_input</tabstop>
|
<tabstop>value_input</tabstop>
|
||||||
<tabstop>mix_slider</tabstop>
|
<tabstop>mix_slider</tabstop>
|
||||||
<tabstop>share_trades_combo</tabstop>
|
|
||||||
<tabstop>fund_trades_combo</tabstop>
|
|
||||||
<tabstop>calc_but</tabstop>
|
<tabstop>calc_but</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
@ -39,20 +39,16 @@ class SIPPCompare(QMainWindow):
|
|||||||
self.mix_slider.valueChanged.connect(self.update_slider_lab)
|
self.mix_slider.valueChanged.connect(self.update_slider_lab)
|
||||||
self.value_input.valueChanged.connect(self.check_valid)
|
self.value_input.valueChanged.connect(self.check_valid)
|
||||||
# Validate input
|
# Validate input
|
||||||
self.share_trades_combo.currentTextChanged.connect(self.check_valid)
|
self.share_trades_box.valueChanged.connect(self.check_valid)
|
||||||
self.fund_trades_combo.currentTextChanged.connect(self.check_valid)
|
self.fund_trades_box.valueChanged.connect(self.check_valid)
|
||||||
|
|
||||||
## Set validators
|
|
||||||
self.share_trades_combo.setValidator(QIntValidator(0, 999))
|
|
||||||
self.fund_trades_combo.setValidator(QIntValidator(0, 99))
|
|
||||||
|
|
||||||
## Restore last session
|
## Restore last session
|
||||||
prev_session_data = self.db.retrieve_user_details()
|
prev_session_data = self.db.retrieve_user_details()
|
||||||
if "NO_RECORD" not in prev_session_data:
|
if "NO_RECORD" not in prev_session_data:
|
||||||
self.value_input.setValue(prev_session_data["pension_val"])
|
self.value_input.setValue(prev_session_data["pension_val"])
|
||||||
self.mix_slider.setValue(prev_session_data["slider_val"])
|
self.mix_slider.setValue(prev_session_data["slider_val"])
|
||||||
self.share_trades_combo.setCurrentText(str(prev_session_data["share_trades"]))
|
self.share_trades_box.setValue(prev_session_data["share_trades"])
|
||||||
self.fund_trades_combo.setCurrentText(str(prev_session_data["fund_trades"]))
|
self.fund_trades_box.setValue(prev_session_data["fund_trades"])
|
||||||
self.calc_but.setFocus()
|
self.calc_but.setFocus()
|
||||||
|
|
||||||
# Display slider position as mix between two nums (funds/shares)
|
# Display slider position as mix between two nums (funds/shares)
|
||||||
@ -63,9 +59,7 @@ class SIPPCompare(QMainWindow):
|
|||||||
|
|
||||||
# Ensure that trade fields aren't blank and pension value > 0
|
# Ensure that trade fields aren't blank and pension value > 0
|
||||||
def check_valid(self):
|
def check_valid(self):
|
||||||
if self.share_trades_combo.currentText() != "" \
|
if self.value_input.value() != 0:
|
||||||
and self.fund_trades_combo.currentText() != "" \
|
|
||||||
and self.value_input.value() != 0:
|
|
||||||
self.calc_but.setEnabled(True)
|
self.calc_but.setEnabled(True)
|
||||||
else:
|
else:
|
||||||
self.calc_but.setEnabled(False)
|
self.calc_but.setEnabled(False)
|
||||||
@ -82,8 +76,8 @@ class SIPPCompare(QMainWindow):
|
|||||||
# Get user input
|
# Get user input
|
||||||
value_num = float(self.value_input.value())
|
value_num = float(self.value_input.value())
|
||||||
slider_val: int = self.mix_slider.value()
|
slider_val: int = self.mix_slider.value()
|
||||||
fund_trades_num = int(self.fund_trades_combo.currentText())
|
fund_trades_num = int(self.fund_trades_box.value())
|
||||||
share_trades_num = int(self.share_trades_combo.currentText())
|
share_trades_num = int(self.share_trades_box.value())
|
||||||
shares_value = (1 - (slider_val / 100)) * value_num
|
shares_value = (1 - (slider_val / 100)) * value_num
|
||||||
index = 0
|
index = 0
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user