Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Commit

Permalink
v1.0.0-ALPHA (#4)
Browse files Browse the repository at this point in the history
* changed reminders dialog by adding input from the UI

* Finished v1 ALPHA of the app!!! 🎉 🎉 🎉!

Bugs:
- everything is printed 3 times

---------

Co-authored-by: N-Coder82 <redacted/private>
  • Loading branch information
N-coder82 authored Dec 23, 2023
1 parent 5d009f0 commit 7e5c55b
Show file tree
Hide file tree
Showing 11 changed files with 255 additions and 173 deletions.
20 changes: 10 additions & 10 deletions UI Files/Mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,6 @@
<normaloff>../../../../../../Downloads/logo-09e4a95d.svg</normaloff>../../../../../../Downloads/logo-09e4a95d.svg</iconset>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QColumnView" name="reminders_display">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>521</width>
<height>381</height>
</rect>
</property>
</widget>
<widget class="QGroupBox" name="gpt_input">
<property name="geometry">
<rect>
Expand Down Expand Up @@ -217,6 +207,16 @@ p, li { white-space: pre-wrap; }
<string>Create Reminder</string>
</property>
</widget>
<widget class="QTextBrowser" name="reminders_display">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>521</width>
<height>381</height>
</rect>
</property>
</widget>
</widget>
</widget>
<resources/>
Expand Down
36 changes: 18 additions & 18 deletions UI Files/remindersdialog.ui
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<class>RemindersDialog</class>
<widget class="QMainWindow" name="RemindersDialog">
<property name="geometry">
<rect>
<x>0</x>
Expand Down Expand Up @@ -32,7 +32,7 @@
<property name="geometry">
<rect>
<x>840</x>
<y>130</y>
<y>120</y>
<width>161</width>
<height>131</height>
</rect>
Expand Down Expand Up @@ -184,7 +184,7 @@
<x>830</x>
<y>260</y>
<width>201</width>
<height>141</height>
<height>121</height>
</rect>
</property>
<property name="title">
Expand All @@ -194,7 +194,7 @@
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<y>70</y>
<width>71</width>
<height>16</height>
</rect>
Expand All @@ -203,38 +203,38 @@
<string>Description:</string>
</property>
</widget>
<widget class="QTextEdit" name="desc_input_box">
<widget class="QLabel" name="title_label">
<property name="geometry">
<rect>
<x>10</x>
<y>110</y>
<width>181</width>
<height>31</height>
<y>20</y>
<width>49</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Title:</string>
</property>
</widget>
<widget class="QTextEdit" name="title_input_box">
<widget class="QLineEdit" name="title_input_box">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>181</width>
<height>31</height>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="title_label">
<widget class="QLineEdit" name="desc_input_box">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>49</width>
<height>16</height>
<y>90</y>
<width>181</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Title:</string>
</property>
</widget>
</widget>
<widget class="QLabel" name="summary_label">
Expand Down
8 changes: 8 additions & 0 deletions remindersdialog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Form implementation generated from reading ui file 'remindersdialog.ui'
#
# Created by: PyQt6 UI code generator 6.6.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.


1 change: 1 addition & 0 deletions source/TODO.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Current TO-DOs
- figure out why its printing output 3 times in reminders.py
- reconfigure dropdown to match dropdown index
119 changes: 119 additions & 0 deletions source/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
from PyQt6 import QtWidgets, QtCore
import sys
from ui import Ui_Chi
from remindersdialog import Ui_RemindersDialog
import controller


def print_dict(dct):
return_string = ""
for name, item in dct.items():
return_string = return_string + f"{str(name)}: {str(item)}<br>"
return return_string


class RemindersPopup(QtWidgets.QMainWindow, Ui_RemindersDialog):
def __init__(self):
super().__init__()
self.setupUi(self)
self.create_button.clicked.connect(self.on_create_button_clicked)

def on_create_button_clicked(self):
# Get all data from all inputs and process into a single write request in controller
date_selected = self.date_box.text()
time_selected = self.time_box.text()
raw_time = time_selected.split(" ")[0]
h, m = raw_time.split(":")
time_selected = h + "." + m
priority_selected = self.priority_dropdown.currentText()
place_selected = self.place_input_box.text()
title_selected = self.title_input_box.text()
desc_selected = self.desc_input_box.text()
day_repeat_selected = self.day_repeat_input_box.text()
year_repeat_selected = self.year_repeat_input_box.text()
repeat_bool = self.repeat_checkbox.isChecked()
flagged_bool = self.flagged_checkbox.isChecked()
summary_dict = {
"date": date_selected,
"time": time_selected,
"priority index": priority_selected,
"place": place_selected,
"title": title_selected,
"desc": desc_selected,
"day repeating?": repeat_bool,
"day repeat": day_repeat_selected,
"year repeat": year_repeat_selected,
"flagged?": flagged_bool,
}
self.summary_display_box.setHtml(f"<h3>{print_dict(summary_dict)}</h3>")
controller.write(
"reminders.chi",
title_selected,
desc_selected,
date_selected,
time_selected,
repeat_bool,
day_repeat_selected,
year_repeat_selected,
place_selected,
priority_selected,
flagged_bool,
)


class MainWindow(QtWidgets.QMainWindow, Ui_Chi):
def __init__(self):
super().__init__()
self.setupUi(self)
self.reminderspopup = None
self.gpt_send_button.clicked.connect(self.on_gpt_send_clicked)
self.create_reminder_button.clicked.connect(
self.on_create_reminder_button_clicked
)
city, temp, condition = controller.weather_data("10001")
self.weather_text_display.setHtml(
f"<h3>City: {city}<br>Temp: {temp}<br>Conditions: {condition}</h3>"
)
currentreminders = ""
linecount = 0
with open("reminders.chi", "r") as file:
data = file.readlines()
for line in data:
linecount += 1
linecount = linecount - 2
i = 0
for i in range(linecount):
current_reminders_dict = controller.read("reminders.chi", str(i + 1))
currentreminders += print_dict(current_reminders_dict)
currentreminders += "<br>=======================================<br>"

self.reminders_display.setHtml(currentreminders)
self.timer = QtCore.QTimer(self)
self.timer.timeout.connect(self.update_time)
self.timer.start(1000)
self.show()

def update_time(self):
current_time = QtCore.QTime.currentTime()
minutes = current_time.toString("mm")
hours = current_time.toString("hh")
self.hours_lcd.setProperty("value", hours)
self.minutes_lcd.setProperty("value", minutes)

def on_gpt_send_clicked(self):
# Add your code here to respond to the button click
chatgptQues = self.gpt_input_box.text()
GPTanswer = controller.chatbot(chatgptQues)
self.gpt_text_display.setHtml(f"<h3>{GPTanswer}</h3>")

def on_create_reminder_button_clicked(self):
if self.reminderspopup is None:
self.reminderspopup = RemindersPopup()
self.reminderspopup.show()


if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
window = MainWindow()
window.show()
sys.exit(app.exec())
Loading

0 comments on commit 7e5c55b

Please sign in to comment.