Skip to content

Commit

Permalink
Merge pull request #142 from Josh-Voyles/packaging
Browse files Browse the repository at this point in the history
Packaging
  • Loading branch information
Josh-Voyles authored Jul 6, 2024
2 parents 47c757d + 01dcb6e commit 8c2239e
Show file tree
Hide file tree
Showing 6 changed files with 35,124 additions and 31 deletions.
14 changes: 7 additions & 7 deletions home-choice-pro/docs/user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,44 +53,44 @@ Step 1:

When you open the application, the calculator defaults to the 'Calculate' tabs allowing estimation of your home affordability.

![Calculate](images/hcp1.png)
![Calculate](../images/hcp1.png)


Step 2:

Enter your desired monthly payment. This should be the maximum amount you can afford per month in housing expenses. In general, it should be no more than 28 percent of your total income.

![Budget](images/hcp2.png)
![Budget](../images/hcp2.png)

Step 3:

Enter estimated mortgage details.

![Details](images/hcp3.png)
![Details](../images/hcp3.png)

Step 4:

Calculate your maximum budget for a house. Down payment percentage and loan details are displayed too.

![Process](images/hcp4.png)
![Process](../images/hcp4.png)

Step 5:

Reset all details if you need to start over.

![Reset](images/hcp5.png)
![Reset](../images/hcp5.png)

Step 6:

View this user guide in the application if you need further assistance.

![Guide](images/hcp6.png)
![Guide](../images/hcp6.png)

Step 7:

Quit the application when you're finished.

![Quit](images/hcp7.png)
![Quit](../images/hcp7.png)


## FAQ
Expand Down
35,073 changes: 35,073 additions & 0 deletions home-choice-pro/images/hcp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion home-choice-pro/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@
os.environ["QT_SCALE_FACTOR"] = "1"

if __name__ == '__main__':
app = QApplication(sys.argv)
app = QtWidgets.QApplication(sys.argv)

path = "images/hcp.svg"
if getattr(sys, 'frozen', False):
resolved_path = os.path.abspath(os.path.join(sys._MEIPASS, path))
else:
resolved_path = os.path.abspath(os.path.join(os.getcwd(), path))
app.setWindowIcon(QtGui.QIcon(resolved_path))

window = MainWindow()
window.show()
Expand Down
26 changes: 16 additions & 10 deletions home-choice-pro/resources/main_window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -388,11 +388,11 @@ QPushButton:hover {
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<width>60</width>
<height>20</height>
</size>
</property>
Expand Down Expand Up @@ -454,7 +454,7 @@ QPushButton:hover {
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand Down Expand Up @@ -517,11 +517,11 @@ QPushButton:hover {
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>100</width>
<width>25</width>
<height>20</height>
</size>
</property>
Expand All @@ -543,6 +543,12 @@ QPushButton:hover {
</property>
<item>
<widget class="QLabel" name="downPaymentHeaderLabel">
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">font: 0 italic 11pt &quot;Ubuntu Sans&quot;;</string>
</property>
Expand Down Expand Up @@ -685,7 +691,7 @@ QPushButton:hover {
<rect>
<x>0</x>
<y>0</y>
<width>645</width>
<width>646</width>
<height>600</height>
</rect>
</property>
Expand Down Expand Up @@ -1003,7 +1009,7 @@ QPushButton:hover {
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="placeholderText">
<string>80000</string>
<string>85000</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -1686,7 +1692,7 @@ QPushButton:hover {
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="placeholderText">
<string>1.01</string>
<string>0.00</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -2104,8 +2110,8 @@ QPushButton:pressed {
<rect>
<x>0</x>
<y>0</y>
<width>83</width>
<height>53</height>
<width>84</width>
<height>52</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
Expand Down
18 changes: 12 additions & 6 deletions home-choice-pro/views/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""

import re
import os
import os, sys
from PyQt5.QtWidgets import QMainWindow, QMessageBox
from PyQt5.QtGui import QRegExpValidator
from PyQt5.QtCore import QRegExp
Expand All @@ -25,12 +25,12 @@
PATH_TO_GUIDE = os.path.join(os.path.dirname(__file__), "..", "docs", "user_guide.md")

DEFAULT_MONTLY = 3000
DEFAULT_DOWN_PAYMENT = 80000
DEFAULT_DOWN_PAYMENT = 85000
DEFAULT_INTEREST_RATE = 6.125
DEFAULT_HOA = 350
DEFAULT_PROPERTY_TAX = 0.74
DEFAULT_HOME_INSURANCE = 0.74
DEFAULT_PMI = 1.01
DEFAULT_PMI = 0.00
RECCOMENDED_DP_PERCENTAGE = 20

CALCULATOR_WINDOW = 0
Expand Down Expand Up @@ -159,14 +159,21 @@ def reset(self) -> None:
self.ui.interestLabelNumber.setText("$0")
self.ui.downPaymentHeaderLabel.setText("-")

def open_guide(self) -> None:

def open_guide(self):
"""returns user guide text or error for Github issue"""
path = "docs/user_guide.md"
try:
with open(PATH_TO_GUIDE, "r") as file:
if getattr(sys, 'frozen', False):
resolved_path = os.path.abspath(os.path.join(sys._MEIPASS, path))
else:
resolved_path = os.path.abspath(os.path.join(os.getcwd(), path))
with open(resolved_path, "r") as file:
return file.read()
except FileNotFoundError:
return "File Not Found: Please open an issue -> https://github.com/Josh-Voyles/Home-Choice-Pro/issues"


def display_calculator_page(self) -> None:
"""Set stacked widgeted index to show calculator"""
self.ui.stackedWidget.setCurrentIndex(CALCULATOR_WINDOW)
Expand All @@ -178,7 +185,6 @@ def display_user_guide(self) -> None:
def display_PMI_warning(self) -> None:
# assumes PMI is the last parameter, should write a test for correct order
if not self.is_pmi_warned and self.parameters[-1] <= 0:
print(self.parameters[-1])
message = "Private Mortage Insurance typically required with down payments less than 20 percent"
QMessageBox.warning(self, "PMI Error", message)
self.is_pmi_warned = True
15 changes: 8 additions & 7 deletions home-choice-pro/views/main_window_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def setupUi(self, MainWindow):
self.mainHeaderLayoutH = QtWidgets.QHBoxLayout()
self.mainHeaderLayoutH.setSpacing(6)
self.mainHeaderLayoutH.setObjectName("mainHeaderLayoutH")
spacerItem3 = QtWidgets.QSpacerItem(0, 20, QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Minimum)
spacerItem3 = QtWidgets.QSpacerItem(60, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
self.mainHeaderLayoutH.addItem(spacerItem3)
self.headerFirstColumnLayoutV = QtWidgets.QVBoxLayout()
self.headerFirstColumnLayoutV.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint)
Expand All @@ -178,7 +178,7 @@ def setupUi(self, MainWindow):
self.totalCostLabelNumber.setObjectName("totalCostLabelNumber")
self.headerFirstColumnLayoutV.addWidget(self.totalCostLabelNumber, 0, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter)
self.mainHeaderLayoutH.addLayout(self.headerFirstColumnLayoutV)
spacerItem5 = QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
spacerItem5 = QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
self.mainHeaderLayoutH.addItem(spacerItem5)
self.headerSecondColumnLayoutV = QtWidgets.QVBoxLayout()
self.headerSecondColumnLayoutV.setSpacing(0)
Expand All @@ -196,14 +196,15 @@ def setupUi(self, MainWindow):
self.principalLabelNumber.setObjectName("principalLabelNumber")
self.headerSecondColumnLayoutV.addWidget(self.principalLabelNumber, 0, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter)
self.mainHeaderLayoutH.addLayout(self.headerSecondColumnLayoutV)
spacerItem7 = QtWidgets.QSpacerItem(100, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
spacerItem7 = QtWidgets.QSpacerItem(25, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
self.mainHeaderLayoutH.addItem(spacerItem7)
self.headerThirdColumnLayoutV = QtWidgets.QVBoxLayout()
self.headerThirdColumnLayoutV.setSizeConstraint(QtWidgets.QLayout.SetNoConstraint)
self.headerThirdColumnLayoutV.setContentsMargins(0, -1, 0, -1)
self.headerThirdColumnLayoutV.setSpacing(0)
self.headerThirdColumnLayoutV.setObjectName("headerThirdColumnLayoutV")
self.downPaymentHeaderLabel = QtWidgets.QLabel(self.headerWidget)
self.downPaymentHeaderLabel.setMinimumSize(QtCore.QSize(200, 0))
self.downPaymentHeaderLabel.setStyleSheet("font: 0 italic 11pt \"Ubuntu Sans\";")
self.downPaymentHeaderLabel.setAlignment(QtCore.Qt.AlignCenter)
self.downPaymentHeaderLabel.setObjectName("downPaymentHeaderLabel")
Expand Down Expand Up @@ -258,7 +259,7 @@ def setupUi(self, MainWindow):
self.calcScrollArea.setObjectName("calcScrollArea")
self.scrollAreaWidgetContents = QtWidgets.QWidget()
self.scrollAreaWidgetContents.setEnabled(True)
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 645, 600))
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 646, 600))
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
Expand Down Expand Up @@ -684,7 +685,7 @@ def setupUi(self, MainWindow):
self.guideScrollArea.setWidgetResizable(True)
self.guideScrollArea.setObjectName("guideScrollArea")
self.guideScrollContents = QtWidgets.QWidget()
self.guideScrollContents.setGeometry(QtCore.QRect(0, 0, 83, 53))
self.guideScrollContents.setGeometry(QtCore.QRect(0, 0, 84, 52))
self.guideScrollContents.setObjectName("guideScrollContents")
self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.guideScrollContents)
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
Expand Down Expand Up @@ -743,7 +744,7 @@ def retranslateUi(self, MainWindow):
self.monthlyPaymentEdit.setPlaceholderText(_translate("MainWindow", "3000"))
self.dollarSignLabel.setText(_translate("MainWindow", "$"))
self.downPaymentLabel.setText(_translate("MainWindow", "Down Payment:"))
self.dpEdit.setPlaceholderText(_translate("MainWindow", "80000"))
self.dpEdit.setPlaceholderText(_translate("MainWindow", "85000"))
self.dpDollarLabel.setText(_translate("MainWindow", "$"))
self.interestRateLabel.setText(_translate("MainWindow", "Interest Rate:"))
self.interestRateEdit.setPlaceholderText(_translate("MainWindow", "6.125"))
Expand All @@ -759,7 +760,7 @@ def retranslateUi(self, MainWindow):
self.propertyTaxEdit.setPlaceholderText(_translate("MainWindow", "0.74"))
self.propertyTaxPercentLabel.setText(_translate("MainWindow", "%/yr"))
self.PMILabel.setText(_translate("MainWindow", "Private Mortgage Insurance:"))
self.PMIEdit.setPlaceholderText(_translate("MainWindow", "1.01"))
self.PMIEdit.setPlaceholderText(_translate("MainWindow", "0.00"))
self.PMIPercentLabel.setText(_translate("MainWindow", "%"))
self.insuranceLabel.setText(_translate("MainWindow", "Homeowner\'s Insurance"))
self.insuranceEdit.setPlaceholderText(_translate("MainWindow", "0.74"))
Expand Down

0 comments on commit 8c2239e

Please sign in to comment.