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.QtWidgets import QApplication, QMessageBox, QMainWindow, QTableWidgetItem
from PyQt5.QtWidgets import QWidget, QTableView, QTableWidget, QComboBox
if hasattr(QtCore.Qt, 'AA_EnableHighDpiScaling'):
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_but3.clicked.connect(self.check)
# ЗАМЕТКИ
self.complete.clicked.connect(self.add_notes) # ДОБАВЛЕНИЕ
# ДАННЫЕ ТАБЛИЦЫ
self.table()
@ -52,7 +54,7 @@ class MyWidget(QMainWindow): # Ui_MainWindow
obj = ""
subjects.append((obj, ))
day.setColumnCount(1)
day.setHorizontalHeaderLabels(["Предмет"])
day.horizontalHeader().setVisible(False)
day.setRowCount(0)
for i, row in enumerate(subjects):
@ -76,6 +78,29 @@ class MyWidget(QMainWindow): # Ui_MainWindow
except Exception:
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:
note = self.cursor.execute("SELECT `date`, `note` FROM notes").fetchall()
@ -115,6 +140,7 @@ class MyWidget(QMainWindow): # Ui_MainWindow
except Exception:
QMessageBox.about(self, 'Ошибка!', "Таблица данных не найдена!")
# РАСПИСАНИЕ
def add(self):
day = self.weekday1.currentIndex()
obj = self.object1.currentIndex()
@ -227,7 +253,10 @@ class MyWidget(QMainWindow): # Ui_MainWindow
else:
self.table()
def notes(self):
# ЗАМЕТКИ
def add_notes(self):
ind = self.choose.currentIndex()
if ind:
pass
def closeEvent(self, event):

489
rasp.ui
View file

@ -54,6 +54,8 @@
<property name="font">
<font>
<pointsize>14</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
@ -62,17 +64,38 @@
<property name="text">
<string>Вторник</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</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>
<widget class="QTableWidget" name="Tue_note">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>80</height>
<height>16777215</height>
</size>
</property>
</widget>
@ -94,6 +117,8 @@
<property name="font">
<font>
<pointsize>14</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
@ -102,17 +127,38 @@
<property name="text">
<string>Среда</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</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>
<widget class="QTableWidget" name="Wed_note">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>80</height>
<height>16777215</height>
</size>
</property>
</widget>
@ -134,6 +180,8 @@
<property name="font">
<font>
<pointsize>14</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
@ -142,17 +190,38 @@
<property name="text">
<string>Четверг</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</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>
<widget class="QTableWidget" name="Thu_note">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>80</height>
<height>16777215</height>
</size>
</property>
</widget>
@ -174,6 +243,8 @@
<property name="font">
<font>
<pointsize>14</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
@ -182,17 +253,38 @@
<property name="text">
<string>Суббота</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</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>
<widget class="QTableWidget" name="Sat_note">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>80</height>
<height>16777215</height>
</size>
</property>
</widget>
@ -214,6 +306,8 @@
<property name="font">
<font>
<pointsize>14</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
@ -222,17 +316,50 @@
<property name="text">
<string>Понедельник</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</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>
<widget class="QTableWidget" name="Mon_note">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>80</height>
<height>16777215</height>
</size>
</property>
<property name="baseSize">
@ -445,6 +572,8 @@ QPushButton:hover{
<property name="font">
<font>
<pointsize>14</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
@ -453,17 +582,38 @@ QPushButton:hover{
<property name="text">
<string>Пятница</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</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>
<widget class="QTableWidget" name="Fri_note">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>80</height>
<height>16777215</height>
</size>
</property>
</widget>
@ -1084,23 +1234,41 @@ QPushButton:hover{
</font>
</property>
<property name="currentIndex">
<number>2</number>
<number>0</number>
</property>
<widget class="QWidget" name="Doing">
<attribute name="title">
<string>Сделать</string>
</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>
<widget class="QWidget" name="default1" native="true">
<widget class="QPushButton" name="complete">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<property name="minimumSize">
<size>
<width>211</width>
<height>51</height>
</rect>
</size>
</property>
<property name="maximumSize">
<size>
<width>211</width>
<height>51</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QPushButton {
@ -1124,31 +1292,68 @@ QPushButton:hover{
<string>Выполнено</string>
</property>
</widget>
</item>
<item>
<widget class="QDateTimeEdit" name="date_1">
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<property name="minimumSize">
<size>
<width>211</width>
<height>51</height>
</rect>
</size>
</property>
<property name="maximumSize">
<size>
<width>211</width>
<height>51</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
</widget>
<widget class="QComboBox" name="choose">
<property name="geometry">
<rect>
<x>240</x>
<y>10</y>
<width>411</width>
<height>51</height>
</rect>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::UpDownArrows</enum>
</property>
</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>
</item>
</layout>
@ -1162,18 +1367,31 @@ QPushButton:hover{
<widget class="QWidget" name="default2" native="true">
<property name="minimumSize">
<size>
<width>233</width>
<width>231</width>
<height>0</height>
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QPushButton" name="added">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<property name="minimumSize">
<size>
<width>211</width>
<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 name="styleSheet">
<string notr="true">QPushButton {
@ -1197,21 +1415,37 @@ QPushButton:hover{
<string>Добавить</string>
</property>
</widget>
</item>
<item>
<widget class="QDateTimeEdit" name="date_2">
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<property name="minimumSize">
<size>
<width>211</width>
<height>51</height>
</rect>
</size>
</property>
<property name="maximumSize">
<size>
<width>211</width>
<height>51</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="fake7" native="true"/>
</item>
</layout>
</widget>
</item>
<item>
@ -1228,18 +1462,31 @@ QPushButton:hover{
<widget class="QWidget" name="default3" native="true">
<property name="minimumSize">
<size>
<width>233</width>
<width>231</width>
<height>0</height>
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout_19">
<item>
<widget class="QPushButton" name="update">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<property name="minimumSize">
<size>
<width>211</width>
<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 name="styleSheet">
<string notr="true">QPushButton {
@ -1263,31 +1510,53 @@ QPushButton:hover{
<string>Обновить</string>
</property>
</widget>
</item>
<item>
<widget class="QDateTimeEdit" name="date_3">
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<property name="minimumSize">
<size>
<width>211</width>
<height>51</height>
</rect>
</size>
</property>
<property name="maximumSize">
<size>
<width>211</width>
<height>51</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
</widget>
<widget class="QComboBox" name="choose_2">
<property name="geometry">
<rect>
<x>10</x>
<y>130</y>
<width>211</width>
<height>51</height>
</rect>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</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>
</item>
<item>
@ -1324,48 +1593,20 @@ QPushButton:hover{
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<widget class="QWidget" name="default4" native="true">
<property name="geometry">
<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>
<layout class="QVBoxLayout" name="verticalLayout_20">
<item>
<widget class="QComboBox" name="choosedate">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>221</width>
<property name="minimumSize">
<size>
<width>0</width>
<height>31</height>
</rect>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>31</height>
</size>
</property>
<property name="font">
<font>
@ -1381,33 +1622,32 @@ QPushButton:hover:before {
</item>
<item>
<property name="text">
<string>За месяц</string>
<string>На месяц</string>
</property>
</item>
<item>
<property name="text">
<string>За неделю</string>
</property>
</item>
<item>
<property name="text">
<string>На опред. дату</string>
</property>
</item>
<item>
<property name="text">
<string>На опред. время</string>
<string>На неделю</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QWidget" name="fake9" native="true"/>
</item>
<item>
<widget class="QPushButton" name="showing">
<property name="geometry">
<rect>
<x>10</x>
<y>170</y>
<width>221</width>
<property name="minimumSize">
<size>
<width>0</width>
<height>41</height>
</rect>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>41</height>
</size>
</property>
<property name="font">
<font>
@ -1436,7 +1676,8 @@ QPushButton:hover{
<string>Показать</string>
</property>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
</layout>

BIN
table.db

Binary file not shown.