mirror of
https://github.com/RolandWH/SIPPCompare.git
synced 2025-06-07 13:51:33 +01:00
Compare commits
No commits in common. "c151b19a3cb6a51de8ab22e4ac92c5398def83b8" and "348b027ede3e5df319f5e7b4b9f2871673ff0449" have entirely different histories.
c151b19a3c
...
348b027ede
@ -5,7 +5,7 @@ a = Analysis(
|
|||||||
['src\\main.py'],
|
['src\\main.py'],
|
||||||
pathex=[],
|
pathex=[],
|
||||||
binaries=[],
|
binaries=[],
|
||||||
datas=[('gui/*.ui', 'gui'), ('gui/dialogs/*.ui', 'gui/dialogs'), ('icon2.ico', '.')],
|
datas=[('gui/*.ui', 'gui'), ('icon2.ico', '.')],
|
||||||
hiddenimports=[],
|
hiddenimports=[],
|
||||||
hookspath=[],
|
hookspath=[],
|
||||||
hooksconfig={},
|
hooksconfig={},
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1330</width>
|
<width>1330</width>
|
||||||
<height>685</height>
|
<height>630</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -23,85 +23,6 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QPushButton" name="save_graph_but">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>1231</x>
|
|
||||||
<y>642</y>
|
|
||||||
<width>91</width>
|
|
||||||
<height>31</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<pointsize>10</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Save graph</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QSlider" name="time_slider">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>370</x>
|
|
||||||
<y>635</y>
|
|
||||||
<width>581</width>
|
|
||||||
<height>41</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="minimum">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>20</number>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Orientation::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="tickPosition">
|
|
||||||
<enum>QSlider::TickPosition::TicksAbove</enum>
|
|
||||||
</property>
|
|
||||||
<property name="tickInterval">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QPushButton" name="save_csv_but">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>1134</x>
|
|
||||||
<y>642</y>
|
|
||||||
<width>91</width>
|
|
||||||
<height>31</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<pointsize>10</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Save CSV</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QLabel" name="time_lab">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>10</x>
|
|
||||||
<y>640</y>
|
|
||||||
<width>341</width>
|
|
||||||
<height>31</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<pointsize>11</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Fees over 1 year(s) (assuming no change in value)</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
@ -133,7 +133,7 @@ class SIPPCompare(QMainWindow):
|
|||||||
# Show the output window - this func is called from calculate_fee()
|
# Show the output window - this func is called from calculate_fee()
|
||||||
def show_output_win(self):
|
def show_output_win(self):
|
||||||
# Refresh the results when new fees are calculated
|
# Refresh the results when new fees are calculated
|
||||||
self.output_win.display_output(self.results, 1)
|
self.output_win.display_output(self.results)
|
||||||
self.output_win.show()
|
self.output_win.show()
|
||||||
|
|
||||||
def show_platform_list(self):
|
def show_platform_list(self):
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
|
import datetime
|
||||||
import os
|
import os
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
from PyQt6 import uic
|
from PyQt6 import uic
|
||||||
from PyQt6.QtGui import QIcon
|
from PyQt6.QtGui import QIcon
|
||||||
from PyQt6.QtWidgets import QWidget, QFileDialog
|
from PyQt6.QtWidgets import QWidget
|
||||||
|
|
||||||
import resource_finder
|
import resource_finder
|
||||||
from widgets.mpl_widget import MplWidget
|
|
||||||
|
|
||||||
|
|
||||||
class OutputWindow(QWidget):
|
class OutputWindow(QWidget):
|
||||||
@ -16,43 +15,17 @@ class OutputWindow(QWidget):
|
|||||||
uic.loadUi(resource_finder.get_res_path("gui/output_window.ui"), self)
|
uic.loadUi(resource_finder.get_res_path("gui/output_window.ui"), self)
|
||||||
self.setWindowIcon(QIcon(resource_finder.get_res_path("icon2.ico")))
|
self.setWindowIcon(QIcon(resource_finder.get_res_path("icon2.ico")))
|
||||||
|
|
||||||
# Define class variables
|
def display_output(self, results: list):
|
||||||
self.canvas = self.graphWidget.canvas
|
ax = self.graphWidget.canvas.axes
|
||||||
self.ax = self.canvas.axes
|
ax.clear()
|
||||||
self.fig = self.canvas.figure
|
ax.cla()
|
||||||
self.results = []
|
self.graphWidget.canvas.draw_idle()
|
||||||
|
|
||||||
# Handle events
|
|
||||||
self.save_graph_but.clicked.connect(self.save_graph)
|
|
||||||
self.time_slider.valueChanged.connect(self.change_time)
|
|
||||||
|
|
||||||
def display_output(self, results: list, years: int):
|
|
||||||
self.results = results
|
|
||||||
self.ax.clear()
|
|
||||||
self.ax.cla()
|
|
||||||
self.canvas.draw_idle()
|
|
||||||
|
|
||||||
names = []
|
names = []
|
||||||
values = []
|
values = []
|
||||||
for result in results:
|
for result in results:
|
||||||
names.append(result[4])
|
names.append(result[4])
|
||||||
values.append(sum(result[:4]) * years)
|
values.append(sum(result[:4]))
|
||||||
|
|
||||||
h_bars = self.ax.barh(names, values)
|
h_bars = ax.barh(names, values)
|
||||||
self.ax.bar_label(h_bars, label_type='center', labels=[f"£{x:,.2f}" for x in h_bars.datavalues])
|
ax.bar_label(h_bars, label_type='center', labels=[f"£{x:,.2f}" for x in h_bars.datavalues])
|
||||||
|
|
||||||
def save_graph(self):
|
|
||||||
file_picker = QFileDialog(self)
|
|
||||||
file_picker.setFileMode(QFileDialog.FileMode.Directory)
|
|
||||||
folder_path = ""
|
|
||||||
if file_picker.exec():
|
|
||||||
folder_path = file_picker.selectedFiles()[0]
|
|
||||||
|
|
||||||
cur_time = datetime.now()
|
|
||||||
filename_str = f"{folder_path}/SIPPCompare-{cur_time.year}.{cur_time.month}.{cur_time.day}.png"
|
|
||||||
self.fig.savefig(filename_str, dpi=150)
|
|
||||||
|
|
||||||
def change_time(self):
|
|
||||||
years: int = self.time_slider.value()
|
|
||||||
self.time_lab.setText(f"Fees over {years} year(s) (assuming no change in value)")
|
|
||||||
self.display_output(self.results, years)
|
|
||||||
|
@ -6,8 +6,8 @@ from PyQt6.QtWidgets import QWidget, QVBoxLayout
|
|||||||
class MplWidget(QWidget):
|
class MplWidget(QWidget):
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
self.canvas = FigureCanvasQTAgg(Figure(figsize=(15, 8), dpi=100))
|
self.canvas = FigureCanvasQTAgg(Figure(figsize=(10, 10), dpi=100))
|
||||||
vertical_layout = QVBoxLayout()
|
vertical_layout = QVBoxLayout()
|
||||||
vertical_layout.addWidget(self.canvas)
|
vertical_layout.addWidget(self.canvas)
|
||||||
self.canvas.axes = self.canvas.figure.add_subplot(1, 1, 1)
|
self.canvas.axes = self.canvas.figure.add_subplot(1, 1, 1)
|
||||||
self.setLayout(vertical_layout)
|
self.setLayout(vertical_layout)
|
Loading…
x
Reference in New Issue
Block a user