This commit is contained in:
Egor Deev 2021-12-01 20:21:19 +07:00 committed by GitHub
parent 0106d7bbff
commit 9bbeb9e1fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 497 additions and 227 deletions

35
main.py
View file

@ -4,7 +4,6 @@ import sys
from PyQt5 import QtCore, QtWidgets, QtGui, uic from PyQt5 import QtCore, QtWidgets, QtGui, uic
from PyQt5.QtWidgets import QApplication, QMessageBox, QMainWindow, QTableWidgetItem from PyQt5.QtWidgets import QApplication, QMessageBox, QMainWindow, QTableWidgetItem
from PyQt5.QtWidgets import QWidget, QTableView, QTableWidget, QComboBox
if hasattr(QtCore.Qt, 'AA_EnableHighDpiScaling'): if hasattr(QtCore.Qt, 'AA_EnableHighDpiScaling'):
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True) QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True)
@ -30,6 +29,9 @@ class MyWidget(QMainWindow): # Ui_MainWindow
self.check_but2.clicked.connect(self.check) self.check_but2.clicked.connect(self.check)
self.check_but3.clicked.connect(self.check) self.check_but3.clicked.connect(self.check)
# ЗАМЕТКИ
self.complete.clicked.connect(self.add_notes) # ДОБАВЛЕНИЕ
# ДАННЫЕ ТАБЛИЦЫ # ДАННЫЕ ТАБЛИЦЫ
self.table() self.table()
@ -52,7 +54,7 @@ class MyWidget(QMainWindow): # Ui_MainWindow
obj = "" obj = ""
subjects.append((obj, )) subjects.append((obj, ))
day.setColumnCount(1) day.setColumnCount(1)
day.setHorizontalHeaderLabels(["Предмет"]) day.horizontalHeader().setVisible(False)
day.setRowCount(0) day.setRowCount(0)
for i, row in enumerate(subjects): for i, row in enumerate(subjects):
@ -76,6 +78,29 @@ class MyWidget(QMainWindow): # Ui_MainWindow
except Exception: except Exception:
pass pass
# ЗАПОЛНЕНИЕ ВЫПАДАЮЩИХ СПИСКОВ CHOOSE 1 / 2
try:
with self.connection:
notes = self.cursor.execute('SELECT `note` FROM `notes`').fetchall()
notes = [i[0] for i in notes]
for choose_obj in [self.choose, self.choose_2]:
choose_obj.clear()
if self.choose == choose_obj:
choose_obj.insertItem(0, "Все за этот день!")
choose_obj.insertItems(1, notes)
else:
choose_obj.insertItems(0, notes)
except Exception:
pass
# НАСТРОЙКА ДИСПЛЕЕВ ДАТ
now = QtCore.QDateTime.currentDateTime()
for date in [self.date_1, self.date_2, self.date_3]:
date.setDateTime(now)
date.setDateRange(QtCore.QDate.currentDate().addDays(-365), QtCore.QDate.currentDate().addDays(365))
if self.date_1 == date:
date.setDisplayFormat("dd.MM.yyyy")
# ВСЕ ЗАМЕТКИ # ВСЕ ЗАМЕТКИ
with self.connection: with self.connection:
note = self.cursor.execute("SELECT `date`, `note` FROM notes").fetchall() note = self.cursor.execute("SELECT `date`, `note` FROM notes").fetchall()
@ -115,6 +140,7 @@ class MyWidget(QMainWindow): # Ui_MainWindow
except Exception: except Exception:
QMessageBox.about(self, 'Ошибка!', "Таблица данных не найдена!") QMessageBox.about(self, 'Ошибка!', "Таблица данных не найдена!")
# РАСПИСАНИЕ
def add(self): def add(self):
day = self.weekday1.currentIndex() day = self.weekday1.currentIndex()
obj = self.object1.currentIndex() obj = self.object1.currentIndex()
@ -227,7 +253,10 @@ class MyWidget(QMainWindow): # Ui_MainWindow
else: else:
self.table() self.table()
def notes(self): # ЗАМЕТКИ
def add_notes(self):
ind = self.choose.currentIndex()
if ind:
pass pass
def closeEvent(self, event): def closeEvent(self, event):

489
rasp.ui
View file

@ -54,6 +54,8 @@
<property name="font"> <property name="font">
<font> <font>
<pointsize>14</pointsize> <pointsize>14</pointsize>
<weight>75</weight>
<bold>true</bold>
</font> </font>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
@ -62,17 +64,38 @@
<property name="text"> <property name="text">
<string>Вторник</string> <string>Вторник</string>
</property> </property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QTableWidget" name="Tue_school"/> <widget class="QTableWidget" name="Tue_school">
<property name="minimumSize">
<size>
<width>0</width>
<height>242</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>242</height>
</size>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
</item> </item>
<item> <item>
<widget class="QTableWidget" name="Tue_note"> <widget class="QTableWidget" name="Tue_note">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>16777215</width>
<height>80</height> <height>16777215</height>
</size> </size>
</property> </property>
</widget> </widget>
@ -94,6 +117,8 @@
<property name="font"> <property name="font">
<font> <font>
<pointsize>14</pointsize> <pointsize>14</pointsize>
<weight>75</weight>
<bold>true</bold>
</font> </font>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
@ -102,17 +127,38 @@
<property name="text"> <property name="text">
<string>Среда</string> <string>Среда</string>
</property> </property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QTableWidget" name="Wed_school"/> <widget class="QTableWidget" name="Wed_school">
<property name="minimumSize">
<size>
<width>0</width>
<height>242</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>242</height>
</size>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
</item> </item>
<item> <item>
<widget class="QTableWidget" name="Wed_note"> <widget class="QTableWidget" name="Wed_note">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>16777215</width>
<height>80</height> <height>16777215</height>
</size> </size>
</property> </property>
</widget> </widget>
@ -134,6 +180,8 @@
<property name="font"> <property name="font">
<font> <font>
<pointsize>14</pointsize> <pointsize>14</pointsize>
<weight>75</weight>
<bold>true</bold>
</font> </font>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
@ -142,17 +190,38 @@
<property name="text"> <property name="text">
<string>Четверг</string> <string>Четверг</string>
</property> </property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QTableWidget" name="Thu_school"/> <widget class="QTableWidget" name="Thu_school">
<property name="minimumSize">
<size>
<width>0</width>
<height>242</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>242</height>
</size>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
</item> </item>
<item> <item>
<widget class="QTableWidget" name="Thu_note"> <widget class="QTableWidget" name="Thu_note">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>16777215</width>
<height>80</height> <height>16777215</height>
</size> </size>
</property> </property>
</widget> </widget>
@ -174,6 +243,8 @@
<property name="font"> <property name="font">
<font> <font>
<pointsize>14</pointsize> <pointsize>14</pointsize>
<weight>75</weight>
<bold>true</bold>
</font> </font>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
@ -182,17 +253,38 @@
<property name="text"> <property name="text">
<string>Суббота</string> <string>Суббота</string>
</property> </property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QTableWidget" name="Sat_school"/> <widget class="QTableWidget" name="Sat_school">
<property name="minimumSize">
<size>
<width>0</width>
<height>242</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>242</height>
</size>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
</item> </item>
<item> <item>
<widget class="QTableWidget" name="Sat_note"> <widget class="QTableWidget" name="Sat_note">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>16777215</width>
<height>80</height> <height>16777215</height>
</size> </size>
</property> </property>
</widget> </widget>
@ -214,6 +306,8 @@
<property name="font"> <property name="font">
<font> <font>
<pointsize>14</pointsize> <pointsize>14</pointsize>
<weight>75</weight>
<bold>true</bold>
</font> </font>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
@ -222,17 +316,50 @@
<property name="text"> <property name="text">
<string>Понедельник</string> <string>Понедельник</string>
</property> </property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QTableWidget" name="Mon_school"/> <widget class="QTableWidget" name="Mon_school">
<property name="minimumSize">
<size>
<width>0</width>
<height>242</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>242</height>
</size>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="showGrid">
<bool>true</bool>
</property>
<property name="gridStyle">
<enum>Qt::SolidLine</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="cornerButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item> </item>
<item> <item>
<widget class="QTableWidget" name="Mon_note"> <widget class="QTableWidget" name="Mon_note">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>16777215</width>
<height>80</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="baseSize"> <property name="baseSize">
@ -445,6 +572,8 @@ QPushButton:hover{
<property name="font"> <property name="font">
<font> <font>
<pointsize>14</pointsize> <pointsize>14</pointsize>
<weight>75</weight>
<bold>true</bold>
</font> </font>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
@ -453,17 +582,38 @@ QPushButton:hover{
<property name="text"> <property name="text">
<string>Пятница</string> <string>Пятница</string>
</property> </property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QTableWidget" name="Fri_school"/> <widget class="QTableWidget" name="Fri_school">
<property name="minimumSize">
<size>
<width>0</width>
<height>242</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>242</height>
</size>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
</item> </item>
<item> <item>
<widget class="QTableWidget" name="Fri_note"> <widget class="QTableWidget" name="Fri_note">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>16777215</width>
<height>80</height> <height>16777215</height>
</size> </size>
</property> </property>
</widget> </widget>
@ -1084,23 +1234,41 @@ QPushButton:hover{
</font> </font>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>2</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="Doing"> <widget class="QWidget" name="Doing">
<attribute name="title"> <attribute name="title">
<string>Сделать</string> <string>Сделать</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QWidget" name="widget_2" native="true">
<property name="minimumSize">
<size>
<width>231</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>231</width>
<height>16777215</height>
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout_13">
<item> <item>
<widget class="QWidget" name="default1" native="true">
<widget class="QPushButton" name="complete"> <widget class="QPushButton" name="complete">
<property name="geometry"> <property name="minimumSize">
<rect> <size>
<x>10</x>
<y>10</y>
<width>211</width> <width>211</width>
<height>51</height> <height>51</height>
</rect> </size>
</property>
<property name="maximumSize">
<size>
<width>211</width>
<height>51</height>
</size>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">QPushButton { <string notr="true">QPushButton {
@ -1124,31 +1292,68 @@ QPushButton:hover{
<string>Выполнено</string> <string>Выполнено</string>
</property> </property>
</widget> </widget>
</item>
<item>
<widget class="QDateTimeEdit" name="date_1"> <widget class="QDateTimeEdit" name="date_1">
<property name="geometry"> <property name="minimumSize">
<rect> <size>
<x>10</x>
<y>70</y>
<width>211</width> <width>211</width>
<height>51</height> <height>51</height>
</rect> </size>
</property>
<property name="maximumSize">
<size>
<width>211</width>
<height>51</height>
</size>
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<pointsize>12</pointsize> <pointsize>12</pointsize>
<weight>50</weight>
<bold>false</bold>
</font> </font>
</property> </property>
</widget> <property name="layoutDirection">
<widget class="QComboBox" name="choose"> <enum>Qt::LeftToRight</enum>
<property name="geometry"> </property>
<rect> <property name="alignment">
<x>240</x> <set>Qt::AlignCenter</set>
<y>10</y> </property>
<width>411</width> <property name="buttonSymbols">
<height>51</height> <enum>QAbstractSpinBox::UpDownArrows</enum>
</rect>
</property> </property>
</widget> </widget>
</item>
<item>
<widget class="QWidget" name="fake4" native="true"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_4" native="true">
<layout class="QVBoxLayout" name="verticalLayout_17">
<item>
<widget class="QComboBox" name="choose">
<property name="minimumSize">
<size>
<width>0</width>
<height>51</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>51</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="fake6" native="true"/>
</item>
</layout>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -1162,18 +1367,31 @@ QPushButton:hover{
<widget class="QWidget" name="default2" native="true"> <widget class="QWidget" name="default2" native="true">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>233</width> <width>231</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QPushButton" name="added"> <widget class="QPushButton" name="added">
<property name="geometry"> <property name="minimumSize">
<rect> <size>
<x>10</x>
<y>10</y>
<width>211</width> <width>211</width>
<height>51</height> <height>51</height>
</rect> </size>
</property>
<property name="maximumSize">
<size>
<width>211</width>
<height>51</height>
</size>
</property>
<property name="font">
<font>
<pointsize>-1</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">QPushButton { <string notr="true">QPushButton {
@ -1197,21 +1415,37 @@ QPushButton:hover{
<string>Добавить</string> <string>Добавить</string>
</property> </property>
</widget> </widget>
</item>
<item>
<widget class="QDateTimeEdit" name="date_2"> <widget class="QDateTimeEdit" name="date_2">
<property name="geometry"> <property name="minimumSize">
<rect> <size>
<x>10</x>
<y>70</y>
<width>211</width> <width>211</width>
<height>51</height> <height>51</height>
</rect> </size>
</property>
<property name="maximumSize">
<size>
<width>211</width>
<height>51</height>
</size>
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<pointsize>12</pointsize> <pointsize>12</pointsize>
<weight>50</weight>
<bold>false</bold>
</font> </font>
</property> </property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget> </widget>
</item>
<item>
<widget class="QWidget" name="fake7" native="true"/>
</item>
</layout>
</widget> </widget>
</item> </item>
<item> <item>
@ -1228,18 +1462,31 @@ QPushButton:hover{
<widget class="QWidget" name="default3" native="true"> <widget class="QWidget" name="default3" native="true">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>233</width> <width>231</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_19">
<item>
<widget class="QPushButton" name="update"> <widget class="QPushButton" name="update">
<property name="geometry"> <property name="minimumSize">
<rect> <size>
<x>10</x>
<y>10</y>
<width>211</width> <width>211</width>
<height>51</height> <height>51</height>
</rect> </size>
</property>
<property name="maximumSize">
<size>
<width>211</width>
<height>51</height>
</size>
</property>
<property name="font">
<font>
<pointsize>-1</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">QPushButton { <string notr="true">QPushButton {
@ -1263,31 +1510,53 @@ QPushButton:hover{
<string>Обновить</string> <string>Обновить</string>
</property> </property>
</widget> </widget>
</item>
<item>
<widget class="QDateTimeEdit" name="date_3"> <widget class="QDateTimeEdit" name="date_3">
<property name="geometry"> <property name="minimumSize">
<rect> <size>
<x>10</x>
<y>70</y>
<width>211</width> <width>211</width>
<height>51</height> <height>51</height>
</rect> </size>
</property>
<property name="maximumSize">
<size>
<width>211</width>
<height>51</height>
</size>
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<pointsize>12</pointsize> <pointsize>12</pointsize>
<weight>50</weight>
<bold>false</bold>
</font> </font>
</property> </property>
</widget> <property name="alignment">
<widget class="QComboBox" name="choose_2"> <set>Qt::AlignCenter</set>
<property name="geometry">
<rect>
<x>10</x>
<y>130</y>
<width>211</width>
<height>51</height>
</rect>
</property> </property>
</widget> </widget>
</item>
<item>
<widget class="QComboBox" name="choose_2">
<property name="minimumSize">
<size>
<width>211</width>
<height>51</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>211</width>
<height>51</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="fake8" native="true"/>
</item>
</layout>
</widget> </widget>
</item> </item>
<item> <item>
@ -1324,48 +1593,20 @@ QPushButton:hover{
<property name="alignment"> <property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property> </property>
<widget class="QWidget" name="default4" native="true"> <layout class="QVBoxLayout" name="verticalLayout_20">
<property name="geometry"> <item>
<rect>
<x>10</x>
<y>20</y>
<width>241</width>
<height>221</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QPushButton {
padding:10px;
color: #fffff;
font-size: 18px;
border-radius: 10px;
border: 1px solid #3873d9;
background-color: white; }
QPushButton:before {
content:'';
position: absolute;
top: 0;
left: 0;
width: 0;
height: 42px;
background: rgba(255,255,255,0.3);
border-radius: 5px;
transition: all 2s ease;
}
QPushButton:hover:before {
width: 100%;
}</string>
</property>
<widget class="QComboBox" name="choosedate"> <widget class="QComboBox" name="choosedate">
<property name="geometry"> <property name="minimumSize">
<rect> <size>
<x>10</x> <width>0</width>
<y>10</y>
<width>221</width>
<height>31</height> <height>31</height>
</rect> </size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>31</height>
</size>
</property> </property>
<property name="font"> <property name="font">
<font> <font>
@ -1381,33 +1622,32 @@ QPushButton:hover:before {
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>За месяц</string> <string>На месяц</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>За неделю</string> <string>На неделю</string>
</property>
</item>
<item>
<property name="text">
<string>На опред. дату</string>
</property>
</item>
<item>
<property name="text">
<string>На опред. время</string>
</property> </property>
</item> </item>
</widget> </widget>
</item>
<item>
<widget class="QWidget" name="fake9" native="true"/>
</item>
<item>
<widget class="QPushButton" name="showing"> <widget class="QPushButton" name="showing">
<property name="geometry"> <property name="minimumSize">
<rect> <size>
<x>10</x> <width>0</width>
<y>170</y>
<width>221</width>
<height>41</height> <height>41</height>
</rect> </size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>41</height>
</size>
</property> </property>
<property name="font"> <property name="font">
<font> <font>
@ -1436,7 +1676,8 @@ QPushButton:hover{
<string>Показать</string> <string>Показать</string>
</property> </property>
</widget> </widget>
</widget> </item>
</layout>
</widget> </widget>
</item> </item>
</layout> </layout>

BIN
table.db

Binary file not shown.