diff --git a/.gitignore b/.gitignore
index d84d3f3..9658d7a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,4 +3,5 @@
/build
/dist
Calc3D.spec
-/releases
\ No newline at end of file
+/releases
+*.ui
\ No newline at end of file
diff --git a/Add_printer.ui b/Add_printer.ui
deleted file mode 100644
index 4841760..0000000
--- a/Add_printer.ui
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
- Dialog
-
-
-
- 0
- 0
- 376
- 169
-
-
-
- Создать пресет
-
-
-
- img/logo-1.pngimg/logo-1.png
-
-
-
-
- 22
- 130
- 331
- 27
-
-
-
- -
-
-
- background-color: rgb(0, 80, 0);
-
-
- Сохранить
-
-
-
- -
-
-
- background-color: rgb(0, 80, 0);
-
-
- Закрыть
-
-
-
-
-
-
-
-
-
diff --git a/Calc3d.ui b/Calc3d.ui
deleted file mode 100644
index c233c29..0000000
--- a/Calc3d.ui
+++ /dev/null
@@ -1,957 +0,0 @@
-
-
- Calc3DbyRisen
-
-
-
- 0
- 0
- 373
- 471
-
-
-
-
- true
-
-
-
- false
-
-
- Calc3D by Risen v.1.0.0
-
-
-
- img/logo-1.pngimg/logo-1.png
-
-
- true
-
-
-
-
-
- QMainWindow::AllowTabbedDocks|QMainWindow::AnimatedDocks
-
-
-
-
-
- 20
- 270
- 171
- 17
-
-
-
-
- 10
- true
-
-
-
- color: rgb(255, 255, 255);
-
-
- Количество экземпляров
-
-
-
-
-
- 20
- 240
- 101
- 17
-
-
-
-
- 10
- true
-
-
-
- color: rgb(255, 255, 255);
-
-
- Масса детали
-
-
-
-
-
- 20
- 210
- 101
- 17
-
-
-
-
- 10
- true
-
-
-
- color: rgb(255, 255, 255);
-
-
- Время печати
-
-
-
-
-
- 21
- 171
- 81
- 17
-
-
-
-
- 10
- true
-
-
-
- color: rgb(255, 255, 255);
-
-
- Принтер
-
-
-
-
-
- 181
- 170
- 171
- 25
-
-
-
- true
-
-
- alternate-background-color: rgb(77, 77, 77);
-
-
-
-
-
- -1
-
-
- QComboBox::NoInsert
-
-
- Выбо принтера
-
- -
-
- Ender3/Ender3pro
-
-
- -
-
- FlyBeer
-
-
-
-
-
-
- 20
- 10
- 301
- 71
-
-
-
-
- 10
- true
-
-
-
- false
-
-
- background-color: rgb(36, 36, 36);
-
-
- QFrame::StyledPanel
-
-
- QFrame::Raised
-
-
- 10
-
-
- QLCDNumber::Flat
-
-
-
-
-
- 180
- 90
- 141
- 41
-
-
-
- background-color: rgb(36, 36, 36);
-
-
- 10
-
-
- QLCDNumber::Flat
-
-
-
-
-
- 20
- 110
- 141
- 17
-
-
-
-
- 12
- true
-
-
-
- color: rgb(255, 255, 255);
-
-
- Себестоимость
-
-
-
-
-
- 180
- 210
- 51
- 20
-
-
-
-
- 0
- 0
-
-
-
-
- 10
- true
- PreferAntialias
-
-
-
- false
-
-
- 0
-
-
-
-
-
- false
-
-
- background-color: rgb(77, 77, 77);
-
-
- Qt::ImhDigitsOnly
-
-
- 0
-
-
- Qt::ScrollBarAlwaysOff
-
-
- Qt::ScrollBarAsNeeded
-
-
- false
-
-
- QPlainTextEdit::NoWrap
-
-
-
-
-
- 80.000000000000000
-
-
- 3
-
-
- false
-
-
- 0
-
-
-
-
-
- 240
- 210
- 21
- 17
-
-
-
-
- 10
- true
-
-
-
- color: rgb(255, 255, 255);
-
-
- ч.
-
-
-
-
-
- 260
- 210
- 51
- 21
-
-
-
- false
-
-
- background-color: rgb(77, 77, 77);
-
-
- Qt::ImhDigitsOnly
-
-
- 3
-
-
- true
-
-
- 0
-
-
-
-
-
- 320
- 210
- 31
- 17
-
-
-
-
- 10
- true
-
-
-
- color: rgb(255, 255, 255);
-
-
- мин.
-
-
-
-
-
- 230
- 240
- 81
- 20
-
-
-
-
- 0
- 0
-
-
-
-
- 10
- true
- PreferAntialias
-
-
-
- false
-
-
- 0
-
-
- false
-
-
- background-color: rgb(77, 77, 77);
-
-
- Qt::ImhFormattedNumbersOnly
-
-
- 0
-
-
- Qt::ScrollBarAlwaysOff
-
-
- Qt::ScrollBarAsNeeded
-
-
-
-
-
- true
-
-
- 0
-
-
-
-
-
- 230
- 270
- 81
- 20
-
-
-
-
- 0
- 0
-
-
-
-
- 10
- true
- PreferAntialias
-
-
-
- false
-
-
- 0
-
-
- false
-
-
- background-color: rgb(77, 77, 77);
-
-
- Qt::ImhDigitsOnly
-
-
- 0
-
-
- Qt::ScrollBarAlwaysOff
-
-
- Qt::ScrollBarAsNeeded
-
-
-
-
-
- true
-
-
- 0
-
-
-
-
-
- 230
- 330
- 81
- 20
-
-
-
-
- 0
- 0
-
-
-
-
- 10
- true
- PreferAntialias
-
-
-
- false
-
-
- 0
-
-
- false
-
-
- background-color: rgb(77, 77, 77);
-
-
- Qt::ImhDigitsOnly
-
-
- 0
-
-
- Qt::ScrollBarAlwaysOff
-
-
- Qt::ScrollBarAsNeeded
-
-
-
-
-
- true
-
-
- 0
-
-
-
-
-
- 230
- 360
- 81
- 20
-
-
-
-
- 0
- 0
-
-
-
-
- 10
- true
- PreferAntialias
-
-
-
- false
-
-
- 0
-
-
- false
-
-
- background-color: rgb(77, 77, 77);
-
-
- Qt::ImhDigitsOnly
-
-
- 0
-
-
- Qt::ScrollBarAlwaysOff
-
-
- Qt::ScrollBarAsNeeded
-
-
-
-
-
- true
-
-
- 0
-
-
-
-
-
- 320
- 240
- 31
- 17
-
-
-
-
- 10
- true
-
-
-
- color: rgb(255, 255, 255);
-
-
- г.
-
-
-
-
-
- 320
- 270
- 31
- 17
-
-
-
-
- 10
- true
-
-
-
- color: rgb(255, 255, 255);
-
-
- шт.
-
-
-
-
-
- 320
- 330
- 31
- 17
-
-
-
-
- 10
- true
-
-
-
- color: rgb(255, 255, 255);
-
-
- руб.
-
-
-
-
-
- 320
- 360
- 31
- 17
-
-
-
-
- 10
- true
-
-
-
- color: rgb(255, 255, 255);
-
-
- руб.
-
-
-
-
-
- 330
- 50
- 31
- 31
-
-
-
-
-
-
- img/rubl.png
-
-
- true
-
-
-
-
-
- 20
- 130
- 331
- 31
-
-
-
- QFrame::HLine
-
-
- QFrame::Raised
-
-
- 2
-
-
-
-
-
- 20
- 300
- 331
- 31
-
-
-
- QFrame::HLine
-
-
- QFrame::Raised
-
-
- 2
-
-
-
-
-
- 20
- 400
- 331
- 41
-
-
-
- -
-
-
-
- 10
- false
- true
- PreferAntialias
- true
-
-
-
- true
-
-
- background-color: rgb(0, 80, 0);
-
-
- Расчитать
-
-
-
- img/calc.pngimg/calc.png
-
-
-
- 20
- 20
-
-
-
-
- -
-
-
-
- 10
- true
-
-
-
- background-color: rgb(0, 80, 0);
-
-
- Выход
-
-
-
- img/exit.pngimg/exit.png
-
-
-
- 20
- 20
-
-
-
-
-
-
-
-
-
- 20
- 330
- 141
- 17
-
-
-
-
- 10
- true
-
-
-
- color: rgb(255, 255, 255);
-
-
- Моделирование
-
-
-
-
- false
-
-
-
- 20
- 360
- 121
- 17
-
-
-
-
- 10
- true
-
-
-
- color: rgb(255, 255, 255);
-
-
- Постобработка
-
-
-
-
-
-
- false
-
-
- Проверить обновления
-
-
-
-
- Как расчитывается стоимость
-
-
-
-
- О програме
-
-
-
-
- Настройки
-
-
-
-
- Добавить принтер
-
-
-
-
- Редактировать принтер
-
-
-
-
- Удалить принтер
-
-
-
-
-
-
diff --git a/Del_preset.ui b/Del_preset.ui
deleted file mode 100644
index 2aff6fb..0000000
--- a/Del_preset.ui
+++ /dev/null
@@ -1,68 +0,0 @@
-
-
- Dialog
-
-
-
- 0
- 0
- 369
- 347
-
-
-
- Удалить пресет
-
-
-
- img/logo-1.pngimg/logo-1.png
-
-
-
-
- 20
- 20
- 321
- 271
-
-
-
- background-color: rgb(36, 36, 36);
-
-
-
-
-
- 12
- 310
- 331
- 27
-
-
-
- -
-
-
- background-color: rgb(0, 80, 0);
-
-
- Удалить
-
-
-
- -
-
-
- background-color: rgb(0, 80, 0);
-
-
- Закрыть
-
-
-
-
-
-
-
-
-
diff --git a/Edit_presset.ui b/Edit_presset.ui
deleted file mode 100644
index cb71bcb..0000000
--- a/Edit_presset.ui
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
- Dialog
-
-
-
- 0
- 0
- 369
- 169
-
-
-
- Изменить пресет
-
-
-
- img/logo-1.pngimg/logo-1.png
-
-
-
-
- 22
- 130
- 321
- 27
-
-
-
- -
-
-
- background-color: rgb(0, 80, 0);
-
-
- Сохранить
-
-
-
- -
-
-
- background-color: rgb(0, 80, 0);
-
-
- Закрыть
-
-
-
-
-
-
-
-
-
diff --git a/Settings.ui b/Settings.ui
deleted file mode 100644
index 8547af1..0000000
--- a/Settings.ui
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
- Dialog
-
-
-
- 0
- 0
- 369
- 375
-
-
-
- Настройки
-
-
-
- img/logo-1.pngimg/logo-1.png
-
-
-
-
- 100
- 340
- 161
- 25
-
-
-
- background-color: rgb(0, 80, 0);
-
-
- Закрыть
-
-
-
-
-
-
diff --git a/Updates.ui b/Updates.ui
deleted file mode 100644
index cae78e5..0000000
--- a/Updates.ui
+++ /dev/null
@@ -1,129 +0,0 @@
-
-
- Dialog
-
-
-
- 0
- 0
- 368
- 99
-
-
-
- Updates
-
-
-
- img/logo-1.pngimg/logo-1.png
-
-
-
-
- 73
- 0
- 191
- 31
-
-
-
-
- 10
-
-
-
- Ваша версия:
-
-
-
-
-
- 70
- 20
- 191
- 31
-
-
-
-
- 10
-
-
-
- Версия на сайте:
-
-
-
-
-
- 250
- 10
- 54
- 17
-
-
-
-
- 10
- true
-
-
-
- 1.0.0
-
-
-
-
-
- 250
- 30
- 54
- 17
-
-
-
-
- 10
- true
-
-
-
- 1.0.0
-
-
-
-
-
- 20
- 60
- 331
- 27
-
-
-
- -
-
-
- background-color: rgb(0, 80, 0);
-
-
- Перейти на сайт
-
-
-
- -
-
-
- background-color: rgb(0, 80, 0);
-
-
- Закрыть
-
-
-
-
-
-
-
-
-
diff --git a/__pycache__/calc3dui.cpython-311.pyc b/__pycache__/calc3dui.cpython-311.pyc
index d23a933..b2aeecd 100644
Binary files a/__pycache__/calc3dui.cpython-311.pyc and b/__pycache__/calc3dui.cpython-311.pyc differ
diff --git a/about.ui b/about.ui
deleted file mode 100644
index f91c186..0000000
--- a/about.ui
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
- About
-
-
-
- 0
- 0
- 365
- 97
-
-
-
- О прграмме
-
-
-
- img/logo-1.pngimg/logo-1.png
-
-
-
-
- 20
- 10
- 331
- 231
-
-
-
-
- 10
-
-
-
- Калькулятор Calc3D by Risen предназначен для быстрой оценки стоимости печати на 3D принтере,
-исходя из стоимости пластика, веса, тарифа электроэнергии и прочего...
-
-
- Qt::AutoText
-
-
- false
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
-
-
- true
-
-
-
-
-
-
diff --git a/calc3d b/calc3d
new file mode 100644
index 0000000..efd0556
Binary files /dev/null and b/calc3d differ
diff --git a/connection.py b/connection.py
new file mode 100644
index 0000000..6c9297f
--- /dev/null
+++ b/connection.py
@@ -0,0 +1,46 @@
+from PySide6 import QtWidgets, QtSql
+
+
+class Data:
+ def __init__(self):
+ super(Data, self).__init__()
+
+ def create_connection(self):
+ db = QtSql.QSqlDatabase.addDatabase('QSQLITE')
+ db.setDatabaseName('calc3d')
+
+ if not db.open():
+ QtWidgets.QMessageBox.critical(None, 'Error', 'Не найдена база данных калькулятора',
+ 'Cancel',
+ QtWidgets.QMessageBox.Cancel)
+ return False
+
+ query = QtSql.QSqlQuery()
+ query.exec("CREATE TABLE IF NOT EXISTS printers (ID integer primary key autoincrement,"
+ "Printer_name VARCHAR(30) unique, Price_printer integer, Printer_power integer, kilowatt_price)")
+ return True
+
+ def execute_query_with_params(self, sql_query, query_values=None):
+ query = QtSql.QSqlQuery()
+ query.prepare(sql_query)
+
+ if query_values is not None:
+ for value in query_values:
+ query.addBindValue(query_values)
+ query.exec()
+
+
+ def add_settings(self, kilowatt_price, ):
+ pass
+
+ def add_printer(self, printer_name, printer_power, price_printer):
+ sql_query = "INSERT INTO printers (Printer_name, Printer_power, Price_printer) VALUES (?, ?, ?)"
+ self.execute_query_with_params(sql_query, [printer_name, printer_power, price_printer])
+
+ def edit_printer(self, id, printer_name, printer_power, price_printer):
+ sql_query = "UPDATE printers SET Printer_name=?, Printer_power=?, Price_printer=? WHERE ID=?"
+ self.execute_query_with_params(sql_query, [id, printer_name, printer_power, price_printer])
+
+ def delete_printer(self, id):
+ sql_query = "DELETE FROM printers WHERE ID=?"
+ self.execute_query_with_params(sql_query, [id])
diff --git a/db.py b/db.py
deleted file mode 100644
index ec7608e..0000000
--- a/db.py
+++ /dev/null
@@ -1,78 +0,0 @@
-import sqlite3
-
-
-def sqlite_connect():
- conn = sqlite3.connect("db/database.db", check_same_thread=False)
- conn.execute("pragma journal_mode=wal;")
- return conn
-
-
-def init_sqlite():
- conn = sqlite_connect()
- cursor = conn.cursor()
- try:
- # Начинаем транзакцию
- cursor.execute('BEGIN')
- # Выполняем операции
- cursor.execute('''CREATE TABLE IF NOT EXISTS users (
- id INTEGER PRIMARY KEY AUTOINCREMENT,
- tg_id INTEGER NOT NULL UNIQUE ,
- school_nik TEXT NOT NULL UNIQUE,
- username TEXT UNIQUE,
- number_quest INTEGER,
- city TEXT)''')
-
- cursor.execute('''CREATE INDEX IF NOT EXISTS usrid ON users (number_quest)''')
-
- cursor.execute('''CREATE TABLE IF NOT EXISTS flags (
- id INTEGER PRIMARY KEY AUTOINCREMENT,
- flags TEXT NOT NULL UNIQUE)''')
-
- cursor.execute('''CREATE TABLE IF NOT EXISTS token (
- id INTEGER PRIMARY KEY AUTOINCREMENT,
- token TEXT NOT NULL UNIQUE)''')
- cursor.execute('COMMIT')
- except Exception as e:
- print(e)
- cursor.execute('ROLLBACK')
- conn.close()
-
-def registration(user_id, school_nik, uname, number_quest, city, class_name, end_14):
- conn = sqlite_connect()
- cursor = conn.cursor()
- try:
- cursor.execute('BEGIN')
- cursor.execute('INSERT INTO users (tg_id, school_nik, username, number_quest, city, class_name, end_14)'
- ' VALUES (?, ?, ?, ?, ?, ?, ?)',
- (user_id, school_nik, uname, number_quest, city, class_name, end_14))
- cursor.execute('COMMIT')
- except Exception as e:
- print(e)
- cursor.execute('ROLLBACK')
- conn.close()
-
-
-def quest_1(tg_id, date_begin):
- conn = sqlite_connect()
- cursor = conn.cursor()
- try:
- cursor.execute('BEGIN')
- cursor.execute(f'UPDATE users SET date_begin=(?) WHERE tg_id=(?)', (date_begin, tg_id,))
- cursor.execute('COMMIT')
- except Exception as e:
- print(e)
- cursor.execute('ROLLBACK')
- conn.close()
-
-def get_time(username):
- conn = sqlite_connect()
- cursor = conn.cursor()
- try:
- cursor.execute('BEGIN')
- time = cursor.execute('SELECT date_begin, end_13 FROM users WHERE school_nik = (?)', (username,)).fetchone()
- return time
- except Exception as e:
- print(e)
- cursor.execute('ROLLBACK')
- conn.close()
-
diff --git a/formula.ui b/formula.ui
deleted file mode 100644
index 5642c4d..0000000
--- a/formula.ui
+++ /dev/null
@@ -1,143 +0,0 @@
-
-
- Dialog
-
-
-
- 0
- 0
- 367
- 377
-
-
-
- Формула расчета
-
-
-
- img/logo-1.pngimg/logo-1.png
-
-
-
-
- 100
- 10
- 171
- 41
-
-
-
-
- 9
-
-
-
- ## Формула расчета
-
-
- Qt::MarkdownText
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
-
-
-
-
-
- 30
- 50
- 341
- 21
-
-
-
-
- Sans Serif
- 10
- true
- false
-
-
-
- false
-
-
- S = ((p/1000*t/60*h)+(md*d*st/mk)+(a+post))*x+mod
-
-
- Qt::MarkdownText
-
-
- true
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
-
-
- false
-
-
-
-
-
- 10
- 80
- 341
- 281
-
-
-
-
- 10
-
-
-
- где
-```
-S - стоимость печати, руб.
-p - мощность принтера, Вт
-t - время печати, мин.
-h - тариф на электроэнергию, кВт/ч
-md - вес детали, гр.
-d - множитель отбраковки.
-st - стоимость катушки пластика, руб.
-mk - вес пластика в катушке, гр.
-a - амортизация принтера, руб.
-post - стоимость постобработки, руб.
-х - количество печатаемых дубликатов, шт.
-mod - стоимость моделирования, руб
-```
-
-
- Qt::MarkdownText
-
-
- false
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
-
-
- true
-
-
-
-
-
- 100
- 340
- 161
- 25
-
-
-
- background-color: rgb(0, 80, 0);
-
-
- Закрыть
-
-
-
-
-
-