mirror of
https://github.com/RolandWH/SIPPCompare.git
synced 2025-04-20 00:11:48 +01:00
Compare commits
No commits in common. "cc5686d3d78236595cc20e2a6487c2bc841c37ac" and "fca1b384bd7a98c471af1cd1358a45ccb87afc19" have entirely different histories.
cc5686d3d7
...
fca1b384bd
@ -35,7 +35,7 @@
|
||||
<x>10</x>
|
||||
<y>0</y>
|
||||
<width>401</width>
|
||||
<height>176</height>
|
||||
<height>171</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
@ -53,11 +53,6 @@
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="value_lab">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Pension value</string>
|
||||
</property>
|
||||
@ -65,11 +60,6 @@
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="value_input">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="frame">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@ -92,11 +82,6 @@
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QLabel" name="mix_lab">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Investment mix (funds 50% / shares 50%)</string>
|
||||
</property>
|
||||
@ -123,11 +108,6 @@
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="share_trades_lab">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Annual share trades</string>
|
||||
</property>
|
||||
@ -135,11 +115,6 @@
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="fund_trades_lab">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Annual fund trades</string>
|
||||
</property>
|
||||
@ -147,11 +122,6 @@
|
||||
</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>
|
||||
@ -162,11 +132,6 @@
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Calculate</string>
|
||||
</property>
|
||||
@ -174,11 +139,6 @@
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="share_trades_combo">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@ -191,11 +151,6 @@
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
@ -206,17 +161,7 @@
|
||||
<height>33</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuPlatforms">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>File</string>
|
||||
</property>
|
||||
@ -228,11 +173,6 @@
|
||||
<property name="text">
|
||||
<string>Edit Platforms</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<tabstops>
|
||||
|
@ -34,11 +34,6 @@
|
||||
<height>250</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="res_ok_but">
|
||||
<property name="geometry">
|
||||
@ -49,11 +44,6 @@
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>OK</string>
|
||||
</property>
|
||||
@ -67,11 +57,6 @@
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
|
@ -6,20 +6,32 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>630</width>
|
||||
<height>567</height>
|
||||
<width>498</width>
|
||||
<height>303</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>498</width>
|
||||
<height>303</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>498</width>
|
||||
<height>303</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Platform Editor</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="gridLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
<width>611</width>
|
||||
<height>241</height>
|
||||
<width>461</width>
|
||||
<height>243</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
@ -63,11 +75,6 @@
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
</property>
|
||||
@ -85,7 +92,7 @@
|
||||
<item row="2" column="3">
|
||||
<widget class="QCheckBox" name="fund_deal_fee_check">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
@ -94,11 +101,6 @@
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="FastEditQDoubleSpinBox" name="share_deal_fee_box">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
</property>
|
||||
@ -115,11 +117,6 @@
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<widget class="QLabel" name="share_deal_reduce_trades_lab">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Share dealing discount # of trades</string>
|
||||
</property>
|
||||
@ -130,11 +127,6 @@
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QLabel" name="share_plat_max_fee_lab">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Share platform monthly fee cap</string>
|
||||
</property>
|
||||
@ -142,11 +134,6 @@
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="FastEditQDoubleSpinBox" name="fund_deal_fee_box">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
</property>
|
||||
@ -163,11 +150,6 @@
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QLabel" name="share_deal_fee_lab">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Share dealing fee*</string>
|
||||
</property>
|
||||
@ -178,11 +160,6 @@
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
</property>
|
||||
@ -209,11 +186,6 @@
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QLabel" name="fund_deal_fee_lab">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fund dealing fee*</string>
|
||||
</property>
|
||||
@ -223,21 +195,10 @@
|
||||
<widget class="QCheckBox" name="share_plat_max_fee_check"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLineEdit" name="plat_name_box">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="plat_name_box"/>
|
||||
</item>
|
||||
<item row="9" column="0" colspan="2">
|
||||
<widget class="QLabel" name="share_deal_reduce_amount_lab">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Share dealing discount amount</string>
|
||||
</property>
|
||||
@ -245,11 +206,6 @@
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QLabel" name="share_plat_fee_lab">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Share platform fee*</string>
|
||||
</property>
|
||||
@ -257,11 +213,6 @@
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="FastEditQDoubleSpinBox" name="share_plat_fee_box">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
</property>
|
||||
@ -278,11 +229,6 @@
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="plat_name_lab">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Platform name</string>
|
||||
</property>
|
||||
@ -293,11 +239,6 @@
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
</property>
|
||||
@ -320,17 +261,12 @@
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>482</x>
|
||||
<y>534</y>
|
||||
<x>350</x>
|
||||
<y>270</y>
|
||||
<width>141</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
@ -338,8 +274,8 @@
|
||||
<widget class="QLabel" name="req_field_lab">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>8</x>
|
||||
<y>262</y>
|
||||
<x>10</x>
|
||||
<y>280</y>
|
||||
<width>191</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
@ -351,7 +287,7 @@
|
||||
<widget class="QLabel" name="active_lab">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>577</x>
|
||||
<x>437</x>
|
||||
<y>10</y>
|
||||
<width>61</width>
|
||||
<height>16</height>
|
||||
@ -364,147 +300,6 @@
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="gridLayoutWidget_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>11</x>
|
||||
<y>309</y>
|
||||
<width>611</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="3">
|
||||
<widget class="FastEditQDoubleSpinBox" name="first_tier_fee_box">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
</property>
|
||||
<property name="correctionMode">
|
||||
<enum>QAbstractSpinBox::CorrectionMode::CorrectToNearestValue</enum>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string>%</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>100.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="first_tier_lab">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>on the first</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="first_tier_fee_lab">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>the fee is</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="FastEditQDoubleSpinBox" name="first_tier_box">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::ButtonSymbols::NoButtons</enum>
|
||||
</property>
|
||||
<property name="correctionMode">
|
||||
<enum>QAbstractSpinBox::CorrectionMode::CorrectToNearestValue</enum>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string>£</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>9999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="add_row_but">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>532</x>
|
||||
<y>481</y>
|
||||
<width>91</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add row</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="del_row_but">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>440</x>
|
||||
<y>481</y>
|
||||
<width>91</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove row</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="val_above_lab">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>6</x>
|
||||
<y>479</y>
|
||||
<width>421</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>on the value above £ there is no charge</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
@ -526,6 +321,7 @@
|
||||
<tabstop>share_deal_fee_box</tabstop>
|
||||
<tabstop>share_deal_reduce_trades_box</tabstop>
|
||||
<tabstop>share_deal_reduce_amount_box</tabstop>
|
||||
<tabstop>save_but</tabstop>
|
||||
<tabstop>plat_name_check</tabstop>
|
||||
<tabstop>fund_deal_fee_check</tabstop>
|
||||
<tabstop>share_plat_fee_check</tabstop>
|
||||
@ -533,11 +329,6 @@
|
||||
<tabstop>share_deal_fee_check</tabstop>
|
||||
<tabstop>share_deal_reduce_trades_check</tabstop>
|
||||
<tabstop>share_deal_reduce_amount_check</tabstop>
|
||||
<tabstop>first_tier_box</tabstop>
|
||||
<tabstop>first_tier_fee_box</tabstop>
|
||||
<tabstop>del_row_but</tabstop>
|
||||
<tabstop>add_row_but</tabstop>
|
||||
<tabstop>save_but</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
|
@ -66,6 +66,7 @@ class SIPPCompare(QMainWindow):
|
||||
def init_variables(self):
|
||||
self.optional_boxes = self.platform_win.get_optional_boxes()
|
||||
self.fund_plat_fee = self.platform_win.get_fund_plat_fee()
|
||||
self.fund_deal_fee = self.platform_win.get_fund_deal_fee()
|
||||
self.share_plat_fee = self.platform_win.get_share_plat_fee()
|
||||
self.share_deal_fee = self.platform_win.get_share_deal_fee()
|
||||
|
||||
@ -76,21 +77,16 @@ class SIPPCompare(QMainWindow):
|
||||
self.plat_name = None
|
||||
|
||||
if self.optional_boxes[1]:
|
||||
self.fund_deal_fee = self.platform_win.get_fund_deal_fee()
|
||||
else:
|
||||
self.fund_deal_fee = None
|
||||
|
||||
if self.optional_boxes[2]:
|
||||
self.share_plat_max_fee = self.platform_win.get_share_plat_max_fee()
|
||||
else:
|
||||
self.share_plat_max_fee = None
|
||||
|
||||
if self.optional_boxes[3]:
|
||||
if self.optional_boxes[2]:
|
||||
self.share_deal_reduce_trades = self.platform_win.get_share_deal_reduce_trades()
|
||||
else:
|
||||
self.share_deal_reduce_trades = None
|
||||
|
||||
if self.optional_boxes[4]:
|
||||
if self.optional_boxes[3]:
|
||||
self.share_deal_reduce_amount = self.platform_win.get_share_deal_reduce_amount()
|
||||
else:
|
||||
self.share_deal_reduce_amount = None
|
||||
@ -105,7 +101,6 @@ class SIPPCompare(QMainWindow):
|
||||
slider_val: int = self.mix_slider.value()
|
||||
funds_value = (slider_val / 100) * value_num
|
||||
fund_trades_num = int(self.fund_trades_combo.currentText())
|
||||
if self.fund_deal_fee is not None:
|
||||
self.fund_deal_fees = fund_trades_num * self.fund_deal_fee
|
||||
|
||||
for i in range(1, len(self.fund_plat_fee[0])):
|
||||
|
@ -1,9 +1,8 @@
|
||||
from PyQt6.QtCore import QRegularExpression
|
||||
from PyQt6.QtGui import QRegularExpressionValidator, QFont
|
||||
from PyQt6.QtWidgets import QWidget, QLabel
|
||||
from PyQt6.QtGui import QRegularExpressionValidator
|
||||
from PyQt6.QtWidgets import QWidget
|
||||
from PyQt6 import uic
|
||||
|
||||
from widgets.fastedit_spinbox import FastEditQDoubleSpinBox
|
||||
import main_window
|
||||
|
||||
|
||||
@ -17,7 +16,11 @@ class PlatformEdit(QWidget):
|
||||
# Create main window object, passing this instance as param
|
||||
self.main_win = main_window.SIPPCompare(self)
|
||||
|
||||
self.fund_plat_fee = []
|
||||
# TODO: Make fund_plat_fee user-defined
|
||||
self.fund_plat_fee = [
|
||||
[0, 250000, 1000000, 2000000],
|
||||
[0, 0.25, 0.1, 0.05]
|
||||
]
|
||||
self.plat_name = ""
|
||||
self.fund_deal_fee = 0.0
|
||||
self.share_plat_fee = 0.0
|
||||
@ -25,22 +28,19 @@ class PlatformEdit(QWidget):
|
||||
self.share_deal_fee = 0.0
|
||||
self.share_deal_reduce_trades = 0.0
|
||||
self.share_deal_reduce_amount = 0.0
|
||||
self.widgets_list_list = []
|
||||
|
||||
self.fund_fee_rows = 1
|
||||
# Debugging feature: set with "--DEBUG_AUTOFILL" cmd argument
|
||||
self.autofill = autofill
|
||||
if autofill:
|
||||
self.save_but.setEnabled(True)
|
||||
|
||||
self.required_fields = [
|
||||
self.fund_deal_fee_box,
|
||||
self.share_plat_fee_box,
|
||||
self.share_deal_fee_box
|
||||
]
|
||||
|
||||
self.optional_fields = [
|
||||
self.plat_name_box,
|
||||
self.fund_deal_fee_box,
|
||||
self.share_plat_max_fee_box,
|
||||
self.share_deal_reduce_trades_box,
|
||||
self.share_deal_reduce_amount_box
|
||||
@ -48,14 +48,12 @@ class PlatformEdit(QWidget):
|
||||
|
||||
self.optional_check_boxes = [
|
||||
self.plat_name_check,
|
||||
self.fund_deal_fee_check,
|
||||
self.share_plat_max_fee_check,
|
||||
self.share_deal_reduce_trades_check,
|
||||
self.share_deal_reduce_amount_check
|
||||
]
|
||||
|
||||
self.check_boxes_ticked = [
|
||||
True,
|
||||
True,
|
||||
False,
|
||||
False,
|
||||
@ -76,14 +74,8 @@ class PlatformEdit(QWidget):
|
||||
for check_box in self.optional_check_boxes:
|
||||
check_box.checkStateChanged.connect(self.check_valid)
|
||||
|
||||
self.first_tier_box.valueChanged.connect(self.check_valid)
|
||||
self.first_tier_fee_box.valueChanged.connect(self.check_valid)
|
||||
self.first_tier_box.valueChanged.connect(self.update_tier_labels)
|
||||
|
||||
# NOTE: Signal defined in UI file to close window when save button clicked
|
||||
self.save_but.clicked.connect(self.init_variables)
|
||||
self.add_row_but.clicked.connect(self.add_row)
|
||||
self.del_row_but.clicked.connect(self.remove_row)
|
||||
|
||||
# Set validators
|
||||
# Regex accepts any characters that match [a-Z], [0-9] or _
|
||||
@ -91,28 +83,11 @@ class PlatformEdit(QWidget):
|
||||
QRegularExpressionValidator(QRegularExpression("\\w*"))
|
||||
)
|
||||
|
||||
def create_plat_fee_struct(self):
|
||||
plat_fee_struct = [[0], [0]]
|
||||
plat_fee_struct[0].append(self.first_tier_box.value())
|
||||
plat_fee_struct[1].append(self.first_tier_fee_box.value())
|
||||
|
||||
for i in range(len(self.widgets_list_list)):
|
||||
band = self.widgets_list_list[i][1].value()
|
||||
fee = self.widgets_list_list[i][3].value()
|
||||
plat_fee_struct[0].append(band)
|
||||
plat_fee_struct[1].append(fee)
|
||||
|
||||
return plat_fee_struct
|
||||
|
||||
# Get fee structure variables from user input when "Save" clicked
|
||||
def init_variables(self):
|
||||
# If debugging, save time by hardcoding
|
||||
if self.autofill:
|
||||
self.plat_name = "AJBell"
|
||||
self.fund_plat_fee = [
|
||||
[0, 250000, 1000000, 2000000],
|
||||
[0, 0.25, 0.1, 0.05]
|
||||
]
|
||||
self.fund_deal_fee = 1.50
|
||||
self.share_plat_fee = 0.0025
|
||||
self.share_plat_max_fee = 3.50
|
||||
@ -121,7 +96,6 @@ class PlatformEdit(QWidget):
|
||||
self.share_deal_reduce_amount = 3.50
|
||||
else:
|
||||
self.plat_name = self.plat_name_box.text()
|
||||
self.fund_plat_fee = self.create_plat_fee_struct()
|
||||
self.fund_deal_fee = float(self.fund_deal_fee_box.value())
|
||||
self.share_plat_fee = float(self.share_plat_fee_box.value()) / 100
|
||||
self.share_plat_max_fee = float(self.share_plat_max_fee_box.value())
|
||||
@ -142,7 +116,6 @@ class PlatformEdit(QWidget):
|
||||
# It's also called when any field emits a textChanged() or valueChanged() signal
|
||||
def check_valid(self):
|
||||
valid = True
|
||||
tiers_valid = True
|
||||
|
||||
# Check all required fields have a non-zero value
|
||||
for field in self.required_fields:
|
||||
@ -172,118 +145,11 @@ class PlatformEdit(QWidget):
|
||||
input_box_item.setEnabled(False)
|
||||
self.check_boxes_ticked[i] = False
|
||||
|
||||
if self.first_tier_fee_box.value() == 0:
|
||||
tiers_valid = False
|
||||
|
||||
if self.fund_fee_rows > 1:
|
||||
if self.widgets_list_list[0][1].value() <= self.first_tier_box.value():
|
||||
tiers_valid = False
|
||||
if self.widgets_list_list[0][3].value() == 0:
|
||||
tiers_valid = False
|
||||
|
||||
for i in range(len(self.widgets_list_list) - 1, 0, -1):
|
||||
if self.widgets_list_list[i][1].value() <= self.widgets_list_list[i-1][1].value():
|
||||
tiers_valid = False
|
||||
if self.widgets_list_list[i][3].value() == 0:
|
||||
tiers_valid = False
|
||||
|
||||
if tiers_valid and self.fund_fee_rows < 6:
|
||||
self.add_row_but.setEnabled(True)
|
||||
else:
|
||||
self.add_row_but.setEnabled(False)
|
||||
|
||||
if valid and tiers_valid:
|
||||
if valid:
|
||||
self.save_but.setEnabled(True)
|
||||
else:
|
||||
self.save_but.setEnabled(False)
|
||||
|
||||
def update_tier_labels(self):
|
||||
if self.fund_fee_rows > 1:
|
||||
prev_value = self.first_tier_box.value()
|
||||
self.widgets_list_list[0][0].setText(f"between £{int(prev_value)} and")
|
||||
|
||||
for i in range(len(self.widgets_list_list) - 1, 0, -1):
|
||||
prev_value = self.widgets_list_list[i-1][1].value()
|
||||
self.widgets_list_list[i][0].setText(f"between £{int(prev_value)} and")
|
||||
|
||||
if self.fund_fee_rows > 1:
|
||||
max_band = self.widgets_list_list[self.fund_fee_rows - 2][1].value()
|
||||
else:
|
||||
max_band = self.first_tier_box.value()
|
||||
self.val_above_lab.setText(f"on the value above £{int(max_band)} there is no charge")
|
||||
|
||||
def add_row(self):
|
||||
widgets = []
|
||||
font = QFont()
|
||||
font.setPointSize(11)
|
||||
|
||||
widgets.append(QLabel(self.gridLayoutWidget_2))
|
||||
widgets[0].setFont(font)
|
||||
|
||||
widgets.append(FastEditQDoubleSpinBox(self.gridLayoutWidget_2))
|
||||
widgets[1].setPrefix("£")
|
||||
widgets[1].setMaximum(9999999)
|
||||
widgets[1].setButtonSymbols(FastEditQDoubleSpinBox.ButtonSymbols.NoButtons)
|
||||
widgets[1].setFont(font)
|
||||
widgets[1].valueChanged.connect(self.check_valid)
|
||||
widgets[1].valueChanged.connect(self.update_tier_labels)
|
||||
|
||||
widgets.append(QLabel(self.gridLayoutWidget_2))
|
||||
widgets[2].setText(f"the fee is")
|
||||
widgets[2].setFont(font)
|
||||
|
||||
widgets.append(FastEditQDoubleSpinBox(self.gridLayoutWidget_2))
|
||||
widgets[3].setSuffix("%")
|
||||
widgets[3].setMaximum(100)
|
||||
widgets[3].setButtonSymbols(FastEditQDoubleSpinBox.ButtonSymbols.NoButtons)
|
||||
widgets[3].setFont(font)
|
||||
widgets[3].valueChanged.connect(self.check_valid)
|
||||
|
||||
# TODO: why 28.5?
|
||||
self.gridLayoutWidget_2.setGeometry(11, 309, 611, int(round(28.5 * (self.fund_fee_rows + 1), 0)))
|
||||
for i in range(len(widgets)):
|
||||
self.gridLayout_2.addWidget(widgets[i], self.fund_fee_rows, i, 1, 1)
|
||||
|
||||
self.fund_fee_rows += 1
|
||||
|
||||
self.widgets_list_list.append(widgets)
|
||||
cur_label_idx = self.gridLayout_2.indexOf(widgets[0])
|
||||
cur_box_idx = self.gridLayout_2.indexOf(widgets[1])
|
||||
cur_label_pos = list(self.gridLayout_2.getItemPosition(cur_label_idx))[:2]
|
||||
cur_box_pos = list(self.gridLayout_2.getItemPosition(cur_box_idx))[:2]
|
||||
|
||||
prev_box_row = cur_box_pos[0] - 1
|
||||
prev_box_item = self.gridLayout_2.itemAtPosition(prev_box_row, cur_box_pos[1]).widget()
|
||||
cur_label_item = self.gridLayout_2.itemAtPosition(cur_label_pos[0], cur_label_pos[1]).widget()
|
||||
cur_label_item.setText(f"between £{int(prev_box_item.value())} and")
|
||||
|
||||
if self.fund_fee_rows > 1:
|
||||
self.del_row_but.setEnabled(True)
|
||||
|
||||
if self.fund_fee_rows > 5:
|
||||
self.add_row_but.setEnabled(False)
|
||||
|
||||
self.check_valid()
|
||||
|
||||
# TODO: Tab order
|
||||
|
||||
def remove_row(self):
|
||||
for widget in self.widgets_list_list[self.fund_fee_rows - 2]:
|
||||
self.gridLayout_2.removeWidget(widget)
|
||||
widget.hide()
|
||||
self.widgets_list_list.pop()
|
||||
self.fund_fee_rows -= 1
|
||||
self.gridLayoutWidget_2.setGeometry(11, 309, 611, int(round(28.5 * self.fund_fee_rows, 0)))
|
||||
|
||||
if self.fund_fee_rows < 2:
|
||||
self.del_row_but.setEnabled(False)
|
||||
|
||||
if self.fund_fee_rows < 6:
|
||||
self.add_row_but.setEnabled(True)
|
||||
|
||||
self.check_valid()
|
||||
self.update_tier_labels()
|
||||
|
||||
# Getter functions (is this necessary? maybe directly reading class vars would be best...)
|
||||
def get_optional_boxes(self):
|
||||
return self.check_boxes_ticked
|
||||
|
Loading…
x
Reference in New Issue
Block a user