Compare commits

..

10 Commits

Author SHA1 Message Date
Trumpet Cynthia
28b55a0e21 add: db ! not connect 2025-03-05 16:38:01 +03:00
Trumpet Cynthia
e1c8ce23c5 add: connect interface 2025-03-05 15:28:08 +03:00
trumpecy
6f2593d298 add: sceleton build 2025-03-04 23:16:49 +03:00
d452f436f4 rm: .vscode dir 2025-03-01 19:13:25 +03:00
5e81cfc343 add: ui files 2025-03-01 19:12:09 +03:00
d803766a42 ref: del calc year 2025-03-01 18:54:19 +03:00
a38c7c284f add: c library 2025-03-01 18:51:32 +03:00
0779292267 del: pycache 2024-12-08 19:49:44 +03:00
900a83be54 add: connection 2024-12-08 19:46:50 +03:00
79b8960e43 add: qt.ui files 2024-12-08 14:58:25 +03:00
65 changed files with 3927 additions and 424 deletions

5
.gitignore vendored
View File

@ -3,4 +3,7 @@
/build
/dist
Calc3D.spec
/releases
/releases
__pycache__
/.vscode
src/build/*

122
Calc3D.py
View File

@ -1,122 +0,0 @@
import datetime
import json
import os
import PySimpleGUI as Sgi
import gettext
import requests
from calculating import calculating, amortization, cost_prise
from setts import window_setts, language, currency_setts
from texts import calc, about, new_marge, ver, not_connect
from update import upd_check
now = datetime.datetime.now()
lang = gettext.translation('locale', localedir='locale', languages=[language()])
lang.install()
_ = lang.gettext
def create_window():
with open(os.path.expanduser('setts.json')) as f:
theme = json.load(f)['settings']['theme']
Sgi.theme(theme)
menu_def = [
[_('Файл'), [_('Настройки')], [_('Выход')]],
[_('Помощь'), [_('Как рассчитывается стоимость'), _('Обо мне'), _('Проверить обновления')]],
]
layout = [
[Sgi.Menu(menu_def)],
[Sgi.Txt('_' * 46)],
[Sgi.Text('0', size=(7, 1), font=('Consolas', 32),
text_color='white', key='result', auto_size_text=True, justification='right', expand_x=True),
Sgi.Text(currency_setts(), font=('Consolas', 32), text_color='white', key='result')],
[Sgi.Text(_('Себестоимость:'), font=12, text_color='white'),
Sgi.Text('0', size=(7, 1), font=12, text_color='white', key='cost', auto_size_text=True,
justification='right', expand_x=True),
Sgi.Text(currency_setts(), font=('Consolas', 12), text_color='white', key='cost')],
[Sgi.Txt('_' * 46, pad=(10, 5))],
[Sgi.Text(_('Время печати')), Sgi.Push(), Sgi.InputText('0', size=(5, 20)), Sgi.Text(_('ч.')),
Sgi.InputText('0', size=(5, 0)), Sgi.Text(_('мин. '))],
[Sgi.Text(_('Масса детали')), Sgi.Push(), Sgi.InputText('0', size=(10, 20), justification='right', ),
Sgi.Text(_('г. '))],
[Sgi.Text(_('Количество экземпляров')), Sgi.Push(), Sgi.InputText('1', size=(10, 20), justification='right', ),
Sgi.Text(_('шт. '))],
[Sgi.Txt('_' * 46)],
[Sgi.Text(_('Моделирование')), Sgi.Push(), Sgi.InputText('0', size=(10, 20), justification='right', ),
Sgi.Text(f'{currency_setts()} ')],
[Sgi.Text(_('Постобработка')), Sgi.Push(), Sgi.InputText('0', size=(10, 20), justification='right', ),
Sgi.Text(f'{currency_setts()} ')],
[Sgi.Txt('_' * 46)],
[Sgi.Txt(' ' * 15), Sgi.ReadFormButton(_('Рассчитать'), size=(10, 2)), Sgi.Cancel(_('Выход'), size=(10, 2))]
]
return Sgi.Window(f'Calc3D by Risen ver.{ver}', layout, icon='logo.ico')
def main():
window = create_window()
while True:
event, values = window.read()
if event == _("Настройки"):
window_setts()
window.close()
window = create_window()
elif event == _("Как рассчитывается стоимость"):
Sgi.popup_ok(calc)
elif event == _("Обо мне"):
Sgi.popup(about)
elif event == "Проверить обновления":
try:
upd_check()
except requests.exceptions.ConnectionError:
Sgi.popup_ok(not_connect)
elif event == _('Рассчитать'):
with open(os.path.expanduser('setts.json')) as f:
params = json.load(f)["settings"]
try:
hours = float(values[1])
except ValueError:
hours = 0
try:
minutes = float(values[2])
except ValueError:
minutes = 0
if minutes > 60:
hours = hours + minutes // 60
minutes = minutes % 60
t = hours * 60 + minutes
try:
md = values[3]
except ValueError:
md = 0
am = amortization(params['a'], t, params['spi'], now.year) # a, t, spi, year
cost = cost_prise(params['p'], t, params['h'], md, params['d'], params['st'], params['mk'], am,
values[6], values[4]) # p, t, h, md, d, st, mk, am, post, x
try:
result = calculating(abs(cost), values[5], params['marge']) # cost, mod, marg
except KeyError:
Sgi.popup_ok(new_marge)
result = 0
window.find_element('result').Update(result)
window.find_element('cost').Update(cost)
elif event in (Sgi.WIN_CLOSED, _('Выход')):
break
if __name__ == "__main__":
main()

View File

@ -1,38 +0,0 @@
# -*- mode: python ; coding: utf-8 -*-
a = Analysis(
['Calc3D.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
)
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
name='Calc3D',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon=['test.ico'],
)

View File

@ -3,56 +3,85 @@
исходя из стоимости пластика, веса, тарифа электроэнергии и прочего...
## Содержание
- [Wiki проекта](#wiki-проекта)
- [Формула расчета](#формула-расчета)
- [Как скачать](#как-скачать)
- [FAQ](#faq)
- [Зачем это всё](#почему-я-решил-реализовать-этот-проект?)
- [Команда проекта](#команда-проекта)
- [Лицензия](#лицензия)
- [Поддержать проект](#поддержать-проект)
## Wiki проекта
- [Как каклькулятор расчитывает стоимость](https://git.risenhome.xyz/risen/Calc3D_by_Risen/wiki/%D0%A4%D0%BE%D1%80%D0%BC%D1%83%D0%BB%D0%B0-%D1%80%D0%B0%D1%81%D1%87%D0%B5%D1%82%D0%B0)
-
## Формула расчета
```
S = ((p/1000*t/60*h)+(md*d*st/mk)+(a+post))*x+mod
```
где
```
S - стоимость печати, руб.
p - мощность принтера, Вт
t - время печати, мин.
h - тариф на электроэнергию, кВт/ч
md - вес детали, гр.
d - множитель отбраковки.
st - стоимость катушки пластика, руб.
mk - вес пластика в катушке, гр.
a - амортизация принтера, руб.
post - стоимость постобработки, руб.
х - количество печатаемых дубликатов, шт.
mod - стоимость моделирования, руб
```
## Как скачать
Переходим в раздел "Релизы" вверху страницы или по это ссылке: [релизы](https://git.risenhome.xyz/risen/Calc3D_by_Risen/releases)
Переходим в раздел "Релизы" по это ссылке: [релизы](https://git.risenhome.xyz/risen/Calc3D_by_Risen/releases)
Качаем последнюю версию, настраиваем свои параметры и пользуемся.
## FAQ
В этом разделе будут добавляться самые часты вопросы.
Раздел в процессе написания
## Почему я решил реализовать этот проект?
Не нашел в интернете таких калькуляторов офлайн. Решил сделать для себя, заодно потренироваться в программировании.
## Команда проекта
Вы можете написать мне в личку в телеграм, если у Вас есть какие-то вопросы по работе калькулятора.
Вы можете написать мне в личку в телеграм, если у Вас есть каие-то вопросы по работе калькулятора.
- [Risen (Colin Robinson)](tg://resolve?domain=RisenYT) — разработчик-любитель
## Лицензия
MIT
```
Copyright (c) <2024> <Risen>
Copyright (c) Risen (Colin Robinson)
Данная лицензия разрешает лицам, получившим копию данного программного обеспечения и сопутствующей документации
(далее — Программное обеспечение), безвозмездно использовать Программное обеспечение без ограничений, включая
неограниченное право на использование, копирование, изменение, слияние, публикацию, распространение, сублицензирование
и/или продажу копий Программного обеспечения, а также лицам, которым предоставляется данное Программное обеспечение,
при соблюдении следующих условий:
Указанное выше уведомление об авторском праве и данные условия должны быть включены во все копии или значимые части
данного Программного обеспечения.
## Поддержать проект
ДАННОЕ ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ ПРЕДОСТАВЛЯЕТСЯ «КАК ЕСТЬ», БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ, ЯВНО ВЫРАЖЕННЫХ ИЛИ ПОДРАЗУМЕВАЕМЫХ,
ВКЛЮЧАЯ ГАРАНТИИ ТОВАРНОЙ ПРИГОДНОСТИ, СООТВЕТСТВИЯ ПО ЕГО КОНКРЕТНОМУ НАЗНАЧЕНИЮ И ОТСУТСТВИЯ НАРУШЕНИЙ,
НО НЕ ОГРАНИЧИВАЯСЬ ИМИ. НИ В КАКОМ СЛУЧАЕ АВТОРЫ ИЛИ ПРАВООБЛАДАТЕЛИ НЕ НЕСУТ ОТВЕТСТВЕННОСТИ ПО КАКИМ-ЛИБО ИСКАМ,
ЗА УЩЕРБ ИЛИ ПО ИНЫМ ТРЕБОВАНИЯМ, В ТОМ ЧИСЛЕ, ПРИ ДЕЙСТВИИ КОНТРАКТА, ДЕЛИКТЕ ИЛИ ИНОЙ СИТУАЦИИ,
ВОЗНИКШИМ ИЗ-ЗА ИСПОЛЬЗОВАНИЯ ПРОГРАММНОГО ОБЕСПЕЧЕНИЯ ИЛИ ИНЫХ ДЕЙСТВИЙ С ПРОГРАММНЫМ ОБЕСПЕЧЕНИЕМ.
```
```
Copyright (c) <2024> <Risen>
Если вы хотите поддержать проект, то можете воспользоваться данными инструментами:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
[Ссылка на Т-банк](https://www.tinkoff.ru/cf/AzAcanQBWZx)
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
или qr-код:
<div id="header" align="left">
<img src="https://git.risenhome.xyz/risen/Calc3D_by_Risen/raw/branch/master/photo_2024-08-17_15-54-57.jpg" width="200" height=""/>
</div>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.```

View File

@ -1,49 +0,0 @@
def cost_prise(p, t, h, md, d, st, mk, am, post, x):
p = int(p) # номинальная мощность принтера
t = int(t) # время печати, в минутах!!!
h = float(h) # тариф электроэнергии
md = float(md) # вес детали
if float(d) < 1:
d = 1
else:
d = float(d) # коэффициент выбраковки
st = float(st) # стоимость катушки
mk = float(mk) # вес катушки
am = float(am) # амортизация
try:
post = float(post) # постобработка
except ValueError:
post = 0
try:
x = int(x) # количество экземпляров
except ValueError:
x = 1
result = ((abs(p) / 1000) * (abs(t) / 60) * abs(h) * abs(x)) + (abs(md) * abs(d) * (abs(st) / abs(mk) * abs(x)) + abs(am) + abs(post) * abs(x))
return round(result, 2)
def calculating(cost, mod, marg):
try:
mod = float(mod) # моделирование
except ValueError:
mod = 0
try:
margin = float(marg) # процент наценки
except ValueError:
margin = 0
result = (cost / 100 * margin + cost) + mod
return round(result, 2)
def amortization(a, t, spi, year):
if (year % 400 == 0) or (year % 100 != 0) and (year % 4 == 0):
minutes_in_year = 527040 / 2
else:
minutes_in_year = 525600 / 2
try:
year_norm = 100 / float(spi)
except ZeroDivisionError:
year_norm = 100 / 1
year_am = float(a) / 100 * round(year_norm, 1)
am_per_minute = year_am / minutes_in_year * t
return round(am_per_minute, 2)

View File

@ -1,26 +0,0 @@
themes_list = ['Black', 'BlueMono', 'BluePurple', 'BrightColors', 'BrownBlue', 'Dark', 'Dark2', 'DarkAmber',
'DarkBlack', 'DarkBlack1', 'DarkBlue', 'DarkBlue1', 'DarkBlue10', 'DarkBlue11', 'DarkBlue12',
'DarkBlue13', 'DarkBlue14', 'DarkBlue15', 'DarkBlue16', 'DarkBlue17', 'DarkBlue2', 'DarkBlue3',
'DarkBlue4', 'DarkBlue5', 'DarkBlue6', 'DarkBlue7', 'DarkBlue8', 'DarkBlue9', 'DarkBrown',
'DarkBrown1', 'DarkBrown2', 'DarkBrown3', 'DarkBrown4', 'DarkBrown5', 'DarkBrown6', 'DarkBrown7',
'DarkGreen', 'DarkGreen1', 'DarkGreen2', 'DarkGreen3', 'DarkGreen4', 'DarkGreen5', 'DarkGreen6',
'DarkGreen7', 'DarkGrey', 'DarkGrey1', 'DarkGrey10', 'DarkGrey11', 'DarkGrey12', 'DarkGrey13',
'DarkGrey14', 'DarkGrey15', 'DarkGrey2', 'DarkGrey3', 'DarkGrey4', 'DarkGrey5', 'DarkGrey6',
'DarkGrey7', 'DarkGrey8', 'DarkGrey9', 'DarkPurple', 'DarkPurple1', 'DarkPurple2', 'DarkPurple3',
'DarkPurple4', 'DarkPurple5', 'DarkPurple6', 'DarkPurple7', 'DarkRed', 'DarkRed1', 'DarkRed2',
'DarkTanBlue', 'DarkTeal', 'DarkTeal1', 'DarkTeal10', 'DarkTeal11', 'DarkTeal12', 'DarkTeal2',
'DarkTeal3', 'DarkTeal4', 'DarkTeal5', 'DarkTeal6', 'DarkTeal7', 'DarkTeal8', 'DarkTeal9', 'Default',
'Default1', 'DefaultNoMoreNagging', 'GrayGrayGray', 'Green', 'GreenMono', 'GreenTan', 'HotDogStand',
'Kayak', 'LightBlue', 'LightBlue1', 'LightBlue2', 'LightBlue3', 'LightBlue4', 'LightBlue5',
'LightBlue6', 'LightBlue7', 'LightBrown', 'LightBrown1', 'LightBrown10', 'LightBrown11',
'LightBrown12', 'LightBrown13', 'LightBrown2', 'LightBrown3', 'LightBrown4', 'LightBrown5',
'LightBrown6', 'LightBrown7', 'LightBrown8', 'LightBrown9', 'LightGray1', 'LightGreen',
'LightGreen1', 'LightGreen10', 'LightGreen2', 'LightGreen3', 'LightGreen4', 'LightGreen5',
'LightGreen6', 'LightGreen7', 'LightGreen8', 'LightGreen9', 'LightGrey', 'LightGrey1', 'LightGrey2',
'LightGrey3', 'LightGrey4', 'LightGrey5', 'LightGrey6', 'LightPurple', 'LightTeal', 'LightYellow',
'Material1', 'Material2', 'NeutralBlue', 'Purple', 'Python', 'PythonPlus', 'Reddit', 'Reds',
'SandyBeach', 'SystemDefault', 'SystemDefault1', 'SystemDefaultForReal', 'Tan', 'TanBlue',
'TealMono', 'Topanga']
lang_list = ['Русский', 'English']
currency_list = ['руб.', '$', '']

Binary file not shown.

Binary file not shown.

BIN
logo.ico

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

2
src/.clang-format Normal file
View File

@ -0,0 +1,2 @@
---
BasedOnStyle: Google

88
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,88 @@
cmake_minimum_required(VERSION 3.5)
project(Calc3D VERSION 0.1 LANGUAGES CXX)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -O2")
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Core)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Core)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Sql)
set(MAIN_SOURCES
main.cpp
view/main_window.cpp
view/main_window.h
view/about_dialog.cpp
view/formula_dialog.cpp
view/update_dialog.cpp
view/printer_settings.cpp
view/add_preset.cpp
view/delete_preset.cpp
view/edit_preset.cpp
view/ui/about.ui
view/ui/main_window.ui
view/ui/del_preset.ui
view/ui/edit_preset.ui
view/ui/formula.ui
view/ui/settings_preset.ui
view/ui/printer_settings.ui
view/ui/updates.ui
view/ui/add_preset.ui
logic/printer_db.cpp
logic/printer_db.h
)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(Calc3D
MANUAL_FINALIZATION
${MAIN_SOURCES}
)
else()
add_executable(Calc3D
${MAIN_SOURCES}
)
endif()
# qt_add_resources(Calc3D "app_resources"
# PREFIX "/"
# FILES
# view/resources.qrc
# )
target_link_libraries(Calc3D PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Sql)
# путь к бд в проекте, опционально
# configure_file(
# ${CMAKE_CURRENT_SOURCE_DIR}/printers.db
# ${CMAKE_CURRENT_BINARY_DIR}/printers.db
# COPYONLY
# )
set_target_properties(Calc3D PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
)
install(TARGETS Calc3D
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(Calc3D)
endif()

View File

@ -0,0 +1,50 @@
#include "calculating.h"
// Функция cost_prise
double cost_prise(double p, double t, double h, double md, double d, double st, double mk, double am, double post, int x) {
p = fabs(p); // номинальная мощность принтера
t = fabs(t); // время печати, в минутах
h = fabs(h); // тариф электроэнергии
md = fabs(md); // вес детали
d = (d < 1) ? 1 : fabs(d); // коэффициент выбраковки
st = fabs(st); // стоимость катушки
mk = fabs(mk); // вес катушки
am = fabs(am); // амортизация
post = fabs(post); // постобработка (обязательно проверить значение)
x = abs(x); // количество экземпляров
double result = ((p / 1000) * (t / 60) * h + (md * d * (st / mk)) + (am + post)) * x;
return round(result * 100) / 100; // округление до 2 знаков после запятой
}
// Функция calculating
double calculating(double cost, double mod, double marg) {
mod = fabs(mod); // моделирование
double margin = fabs(marg); // процент наценки
double result = (margin / 100 * cost + cost) + mod;
return round(result * 100) / 100; // округление до 2 знаков после запятой
}
// Функция amortization
double amortization(double a, double t, double spi) {
// количество минут в году
double minutes_in_year = 525600;
// Если СПИ установлен на 0, то присваеваем 1 (год)
double year_norm;
if (spi == 0) {
year_norm = 100 / 1;
} else {
year_norm = 100 / spi;
}
//Считаем годовую амортизациюcost
double year_am = a * year_norm / 100;
//Считаем амортизацию за минуту и умножаем на время печати
double am_per_minute = year_am / minutes_in_year * t;
return am_per_minute; // округление до 2 знаков после запятой
}

View File

@ -0,0 +1,12 @@
#ifndef CALCULATING_H
#define CALCULATING_H
#include <math.h>
#include <stdlib.h>
// Объявления функций
double cost_prise(double p, double t, double h, double md, double d, double st, double mk, double am, double post, int x);
double calculating(double cost, double mod, double marg);
double amortization(double a, double t, double spi);
#endif // CALCULATING_H

69
src/C_library/main.c Normal file
View File

@ -0,0 +1,69 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "calculating.h" // Подключаем заголовочный файл
// Загрузка настроек (заглушка, нужно заменить на чтение из БД)
void load_settings(double *p, double *h, double *d, double *st, double *mk, double *a, double *spi, double *marge) {
*p = 270; // номинальная мощность принтера
*h = 3; // тариф электроэнергии
*d = 1.5; // коэффициент выбраковки
*st = 1500; // стоимость катушки
*mk = 1000; // вес катушки
*a = 15000; // амортизация
*spi = 3; // срок полезного использования
*marge = 150; // наценка
}
int main() {
// Загрузка настроек
double p, h, d, st, mk, a, spi, marge;
load_settings(&p, &h, &d, &st, &mk, &a, &spi, &marge);
// Ввод данных от пользователя
printf("Введите параметры для расчета:\n");
double hours, minutes;
printf("Время печати (часы): ");
scanf("%lf", &hours);
printf("Время печати (минуты): ");
scanf("%lf", &minutes);
if (minutes > 60) {
hours += (int)(minutes / 60);
minutes = fmod(minutes, 60); // Используем fmod для остатка от деления
}
double t = hours * 60 + minutes; // Общее время в минутах
double md;
printf("Масса детали (г): ");
scanf("%lf", &md);
int x;
printf("Количество экземпляров (шт): ");
scanf("%d", &x);
double mod;
printf("Моделирование (руб): ");
scanf("%lf", &mod);
double post;
printf("Постобработка (руб): ");
scanf("%lf", &post);
// Расчет амортизации
double am = amortization(a, t, spi);
// Расчет себестоимости
double cost = cost_prise(p, t, h, md, d, st, mk, am, post, x);
// Расчет итоговой стоимости
double result = calculating(cost, mod, marge);
// Вывод результатов
printf("\nРезультаты расчета:\n");
printf("Себестоимость: %.2f руб.\n", cost);
printf("Итоговая стоимость: %.2f руб.\n", result);
return 0;
}

64
src/Makefile Normal file
View File

@ -0,0 +1,64 @@
# Dependencies: qt6-base-dev, doxygen
CXX = g++
# CXXFLAGS = -std=c++17 -I./model -I./include -DLOGGER_MAX_LOG_LEVEL_PRINTED=0
CPPCHECK_FLAGS = --enable=all --suppress=missingIncludeSystem --language=c++ \
--quiet --suppress=unusedFunction --suppress=unusedStructMember \
--suppress=shadowFunction --suppress=missingInclude --suppress=unknownMacro \
--suppress=unmatchedSuppression --suppress=missingInclude --suppress=checkersReport
BUILD_DIR = build
EXEC_NAME = Calc3D
# INSTALL_DIR = bin
#########################################
#----------- Build and run ------------#
#########################################
all:
rm -rf ./build
mkdir -p $(BUILD_DIR) && \
cd $(BUILD_DIR) && \
cmake ../../src && \
make
# valgrind -q -s --leak-check=full --trace-children=yes --track-origins=yes --log-file=./VALGRIND ./build/3DViewer
./$(BUILD_DIR)/$(EXEC_NAME)
#########################################
#----------- Installation --------------#
#########################################
.PHONY: install uninstall
install: clean all
uninstall:
cd ../ && rm -rf $(INSTALL_DIR)
#########################################
#----------- Documentation -------------#
#########################################
dvi:
# doxygen
# open docs/html/index.html
clean_dvi:
rm -rf ./docs
#########################################
#---------------- Checks ---------------#
#########################################
.PHONY: check
check:
find . \( -path "./build" -o -path "./include" \) -prune -o -type f -regex '.*\.cc' -print | xargs cppcheck $(CPPCHECK_FLAGS)
find . \( -path "./build" -o -path "./include" \) -prune -o -type f -regex '.*\.h' -print | xargs cppcheck $(CPPCHECK_FLAGS)
find . \( -path "./build" -o -path "./include" \) -prune -o -type f -regex '.*\.cc' -print -exec clang-format -style='{BasedOnStyle: Google}' -n {} \;
find . \( -path "./build" -o -path "./include" \) -prune -o -type f -regex '.*\.h' -print -exec clang-format -style='{BasedOnStyle: Google}' -n {} \;
.PHONY: check_fix
check_fix:
find . \( -path "./build" -o -path "./include" \) -prune -o -type f -regex '.*\.cc' -print | xargs cppcheck $(CPPCHECK_FLAGS)
find . \( -path "./build" -o -path "./include" \) -prune -o -type f -regex '.*\.h' -print | xargs cppcheck $(CPPCHECK_FLAGS)
find . \( -path "./build" -o -path "./include" \) -prune -o -type f -regex '.*\.cc' -print -exec clang-format -style='{BasedOnStyle: Google}' -i {} \;
find . \( -path "./build" -o -path "./include" \) -prune -o -type f -regex '.*\.h' -print -exec clang-format -style='{BasedOnStyle: Google}' -i {} \;
.PHONY: clean
clean:
cd ../ && rm -rf $(INSTALL_DIR)

48
src/logic/facade.h Normal file
View File

@ -0,0 +1,48 @@
#pragma once
#include <memory>
#include "printer_db.h"
class Facade {
public:
Facade(const Facade &other) = delete;
Facade(Facade &&other) = delete;
void operator=(const Facade &other) = delete;
~Facade() = default;
static std::shared_ptr<Facade> GetInstance() {
static auto instance = std::shared_ptr<Facade>(new Facade);
return instance;
}
bool addPrinter(const QString &name, double power, int age, double cost) {
return db.addPrinter(name, power, age, cost);
}
QList<QString> getPrinterList() { return db.getPrinterList(); }
bool deletePrinterByName(const QString &name) {
return db.deletePrinterByName(name);
}
bool Database::updatePrinter(const QString &name,
const QHash<QString, QVariant> &updates) {
return db.updatePrinter(name, updates);
}
private:
Database db;
Facade() {
//! TODO create if doesn't exist
QString dbPath =
QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) +
"/printers.db"; //! TODO name!
db(dbPath);
if (!db.init()) {
qFatal("Database initialization failed!");
// TODO make exc
}
}
};

83
src/logic/printer_db.cpp Normal file
View File

@ -0,0 +1,83 @@
#include "printer_db.h"
Database::Database(const QString &path) {
db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName(path);
}
bool Database::init() {
if (!db.open()) {
qWarning() << "Error opening database:" << db.lastError();
// TODO return ERROR
return false;
}
QSqlQuery query;
return query.exec(
"CREATE TABLE IF NOT EXISTS printers ("
"id INTEGER PRIMARY KEY AUTOINCREMENT,"
"name TEXT NOT NULL UNIQUE,"
"power REAL NOT NULL," //! int??
"age INTEGER NOT NULL,"
"cost REAL NOT NULL");
}
bool Database::addPrinter(const QString &name, double power, int age,
double cost) {
QSqlQuery query;
query.prepare(
"INSERT INTO printers (name, power, age, cost) VALUES (:name, :power, "
":age, :cost)");
query.bindValue(":name", name);
query.bindValue(":power", power);
query.bindValue(":age", age);
query.bindValue(":cost", cost);
return query.exec();
}
QList<QString> Database::getPrinterList() {
QList<QString> printers;
QSqlQuery query("SELECT name FROM printers");
while (query.next()) {
printers.append({query.value(0).toString()});
}
return printers;
}
bool Database::deletePrinterByName(const QString &name) {
QSqlQuery query;
query.prepare("DELETE FROM printers WHERE name = :name");
query.bindValue(":name", name);
if (!query.exec()) {
// TODO exc
qWarning() << "Delete failed:" << query.lastError().text();
return false;
}
// была ли удалена хотя бы одна запись?
return query.numRowsAffected() > 0;
}
bool Database::updatePrinter(const QString &name,
const QHash<QString, QVariant> &updates) {
QStringList setClauses;
QSqlQuery query;
for (auto it = updates.begin(); it != updates.end(); ++it) {
setClauses << QString("%1 = :%2").arg(it.key(), it.key());
query.bindValue(":" + it.key(), it.value());
}
query.prepare("UPDATE printers SET " + setClauses.join(", ") +
" WHERE name = :name");
query.bindValue(":name", name);
return query.exec();
//! Как создать новое из фасада:
// !проще забрать сразу все
// QHash<QString, QVariant> updates;
// updates["power"] = 350.0;
// updates["cost"] = 27000.0;
// db->updatePrinterPartial("MyPrinter", updates);
}

18
src/logic/printer_db.h Normal file
View File

@ -0,0 +1,18 @@
#include <QDebug>
#include <QSqlDatabase>
#include <QSqlError>
#include <QSqlQuery>
class Database {
public:
Database(const QString &path);
bool init();
bool addPrinter(const QString &name, double power, int age, double cost);
bool deletePrinterByName(const QString &name);
QList<QString> getPrinterList();
bool updatePrinter(const QString &name,
const QHash<QString, QVariant> &updates);
private:
QSqlDatabase db;
};

11
src/main.cpp Normal file
View File

@ -0,0 +1,11 @@
#include <QApplication>
#include "view/main_window.h"
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
// MainWindow window(s21::Controller::GetInstance());
MainWindow window;
window.show();
return app.exec();
}

10
src/view/about_dialog.cpp Normal file
View File

@ -0,0 +1,10 @@
#include "about_dialog.h"
#include "ui/ui_about.h"
AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::About) {
ui->setupUi(this);
setWindowIcon(QIcon("img/logo-1.png"));
}
AboutDialog::~AboutDialog() { delete ui; }

21
src/view/about_dialog.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef ABOUTDIALOG_H
#define ABOUTDIALOG_H
#include <QDialog>
namespace Ui {
class About;
}
class AboutDialog : public QDialog {
Q_OBJECT
public:
explicit AboutDialog(QWidget *parent = nullptr);
~AboutDialog();
private:
Ui::About *ui;
};
#endif // ABOUTDIALOG_H

28
src/view/add_preset.cpp Normal file
View File

@ -0,0 +1,28 @@
#include "add_preset.h"
#include "ui/ui_add_preset.h"
AddPresetDialog::AddPresetDialog(QWidget *parent)
: QDialog(parent), ui(new Ui::AddPrinter) {
ui->setupUi(this);
setWindowIcon(QIcon("img/logo-1.png"));
// TODO validators
// setupValidators();
connect(ui->pushButton, &QPushButton::clicked, this, [this]() {
// TODO save new printer settings
qDebug() << "SAVE SETTINGS";
});
connect(ui->pushButton_2, &QPushButton::clicked, this, &QDialog::reject);
}
AddPresetDialog::~AddPresetDialog() { delete ui; }
void AddPresetDialog::setupValidators() {
// TODO make validators
qDebug() << "SET VALIDATORS";
// ui->input_power_3->setValidator(SMTH); // Мощность
// ui->input_power->setValidator(SMTH); // Срок службы
// ui->input_power_2->setValidator(SMTH); // Стоимость
}

38
src/view/add_preset.h Normal file
View File

@ -0,0 +1,38 @@
#ifndef ADDPRINTERDIALOG_H
#define ADDPRINTERDIALOG_H
#include <QDialog>
#include <QDoubleValidator>
#include <QIntValidator>
#include "ui/ui_add_preset.h"
namespace Ui {
class AddPrinter;
}
class AddPresetDialog : public QDialog {
Q_OBJECT
public:
explicit AddPresetDialog(QWidget *parent = nullptr);
~AddPresetDialog();
QString getPresetName() const { return ui->textEdit->toPlainText(); }
int getPower() const { return ui->input_power_3->toPlainText().toInt(); }
int getLifespan() const { return ui->input_power->toPlainText().toInt(); }
double getPrinterCost() const {
return ui->input_power_2->toPlainText().toDouble();
}
private:
void setupValidators();
Ui::AddPrinter *ui;
// QIntValidator *intValidator;
// QDoubleValidator *doubleValidator;
};
#endif // ADDPRINTERDIALOG_H

View File

@ -0,0 +1,64 @@
#include "delete_preset.h"
#include "ui/ui_del_preset.h"
DeletePresetDialog::DeletePresetDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::DelPreset)
{
ui->setupUi(this);
setWindowIcon(QIcon("img/logo-1.png"));
setupTable();
connect(ui->pushButton_3, &QPushButton::clicked, this, &DeletePresetDialog::onDeleteClicked);
connect(ui->pushButton, &QPushButton::clicked, this, &DeletePresetDialog::onEditClicked);
connect(ui->pushButton_2, &QPushButton::clicked, this, &QDialog::reject);
}
DeletePresetDialog::~DeletePresetDialog() {
delete ui;
}
void DeletePresetDialog::setupTable() {
ui->tableWidget->setColumnCount(2);
ui->tableWidget->setHorizontalHeaderLabels({"Название", "Мощность"});
ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);
ui->tableWidget->horizontalHeader()->setStretchLastSection(true);
}
void DeletePresetDialog::loadPresets(const QList<QStringList> &data) {
ui->tableWidget->setRowCount(data.size());
for(int row = 0; row < data.size(); ++row) {
const QStringList &rowData = data[row];
for(int col = 0; col < rowData.size(); ++col) {
ui->tableWidget->setItem(row, col, new QTableWidgetItem(rowData[col]));
}
}
}
QString DeletePresetDialog::getSelectedPreset() const {
const int row = getSelectedRow();
return row >= 0 ? ui->tableWidget->item(row, 0)->text() : "";
}
int DeletePresetDialog::getSelectedRow() const {
return ui->tableWidget->currentRow();
}
void DeletePresetDialog::onDeleteClicked() {
const int row = getSelectedRow();
if(row >= 0) {
emit deleteRequested(row);
ui->tableWidget->removeRow(row);
}
}
void DeletePresetDialog::onEditClicked() {
const int row = getSelectedRow();
if(row >= 0) {
emit editRequested(row);
accept();
}
}

35
src/view/delete_preset.h Normal file
View File

@ -0,0 +1,35 @@
#ifndef DELPRESETDIALOG_H
#define DELPRESETDIALOG_H
#include <QDialog>
#include <QTableWidgetItem>
namespace Ui {
class DelPreset;
}
class DeletePresetDialog : public QDialog {
Q_OBJECT
public:
explicit DeletePresetDialog(QWidget *parent = nullptr);
~DeletePresetDialog();
void loadPresets(const QList<QStringList> &data);
QString getSelectedPreset() const;
int getSelectedRow() const;
signals:
void deleteRequested(int row);
void editRequested(int row);
private slots:
void onDeleteClicked();
void onEditClicked();
private:
void setupTable();
Ui::DelPreset *ui;
};
#endif // DELPRESETDIALOG_H

17
src/view/edit_preset.cpp Normal file
View File

@ -0,0 +1,17 @@
#include "edit_preset.h"
#include "ui/ui_edit_preset.h"
EditPresetDialog::EditPresetDialog(QWidget *parent)
: QDialog(parent), ui(new Ui::EditPreset) {
ui->setupUi(this);
setWindowIcon(QIcon("img/logo-1.png"));
connect(ui->pushButton, &QPushButton::clicked, this, [this]() {
// TODO save new printer settings
qDebug() << "SAVE SETTINGS";
});
connect(ui->pushButton_2, &QPushButton::clicked, this, &QDialog::reject);
}
EditPresetDialog::~EditPresetDialog() { delete ui; }

21
src/view/edit_preset.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef EDITPRESETDIALOG_H
#define EDITPRESETDIALOG_H
#include <QDialog>
namespace Ui {
class EditPreset;
}
class EditPresetDialog : public QDialog {
Q_OBJECT
public:
explicit EditPresetDialog(QWidget *parent = nullptr);
~EditPresetDialog();
private:
Ui::EditPreset *ui;
};
#endif // EDITPRESETDIALOG_H

View File

@ -0,0 +1,15 @@
#include "formula_dialog.h"
#include "ui/ui_formula.h"
FormulaDialog::FormulaDialog(QWidget *parent)
: QDialog(parent), ui(new Ui::Formula) {
ui->setupUi(this);
setWindowIcon(QIcon("img/logo-1.png"));
connect(ui->pushButton, &QPushButton::clicked, this, &FormulaDialog::close);
}
FormulaDialog::~FormulaDialog() { delete ui; }
void FormulaDialog::on_pushButton_clicked() { close(); }

24
src/view/formula_dialog.h Normal file
View File

@ -0,0 +1,24 @@
#ifndef FORMULADIALOG_H
#define FORMULADIALOG_H
#include <QDialog>
namespace Ui {
class Formula;
}
class FormulaDialog : public QDialog {
Q_OBJECT
public:
explicit FormulaDialog(QWidget *parent = nullptr);
~FormulaDialog();
private slots:
void on_pushButton_clicked();
private:
Ui::Formula *ui;
};
#endif // FORMULADIALOG_H

BIN
src/view/img/calc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

1
src/view/img/calc.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#D9D9D9"><path d="M320-240h60v-80h80v-60h-80v-80h-60v80h-80v60h80v80Zm200-30h200v-60H520v60Zm0-100h200v-60H520v60Zm44-152 56-56 56 56 42-42-56-58 56-56-42-42-56 56-56-56-42 42 56 56-56 58 42 42Zm-314-70h200v-60H250v60Zm-50 472q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"/></svg>

After

Width:  |  Height:  |  Size: 482 B

BIN
src/view/img/exit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

1
src/view/img/exit.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#D9D9D9"><path d="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"/></svg>

After

Width:  |  Height:  |  Size: 222 B

BIN
src/view/img/logo-1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

BIN
src/view/img/logo-2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
src/view/img/logo-3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
src/view/img/logo-4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

BIN
src/view/img/logo-5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
src/view/img/logo-6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
src/view/img/logo-7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
src/view/img/logo-8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 776 B

BIN
src/view/img/modeling.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
src/view/img/quantity.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
src/view/img/rubl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 993 B

BIN
src/view/img/time.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
src/view/img/weight.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

55
src/view/main_window.cpp Normal file
View File

@ -0,0 +1,55 @@
#include "main_window.h"
#include "ui/ui_main_window.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow) {
ui->setupUi(this);
setFixedSize(373, 471);
progInfo = new AboutDialog(this);
formulaInfo = new FormulaDialog(this);
updateInfo = new UpdatesDialog(this);
printerSettings = new PrinterSettingsDialog(this);
addPresetDialog = new AddPresetDialog(this);
deletePresetDialog = new DeletePresetDialog(this);
editPresetDialog = new EditPresetDialog(this);
// <!-- <property name="styleSheet"> // бледно серый для тепскта
// <string>color: rgb(146, 152, 159);</string>
// </property> -->
// Action with menu "Файл"
connect(ui->settings_2, &QAction::triggered, this,
[this]() { printerSettings->exec(); });
connect(ui->add_preset, &QAction::triggered, this,
[this]() { addPresetDialog->exec(); });
connect(ui->edit_printer, &QAction::triggered, this,
[this]() { editPresetDialog->exec(); });
connect(ui->del_printer, &QAction::triggered, this,
[this]() { deletePresetDialog->exec(); });
connect(ui->action_3, &QAction::triggered, this, [this]() {
//! smth will be saved?
qDebug() << "SMTH NEEDS TO SAVE?";
close();
});
// Action with menu "Помощь"
connect(ui->check_update, &QAction::triggered, this,
[this]() { updateInfo->exec(); });
connect(ui->formula, &QAction::triggered, this,
[this]() { formulaInfo->exec(); });
connect(ui->about, &QAction::triggered, this, [this]() { progInfo->exec(); });
// Action with buttons
connect(ui->get_result_btn, &QPushButton::clicked, this, [this]() {
// TODO отправляет на расчет
qDebug() << "SMTH COUNT";
});
connect(ui->exit_btn, &QPushButton::clicked, this, [this]() {
//! smth will be saved?
qDebug() << "SMTH NEEDS TO SAVE?";
close();
});
}
MainWindow::~MainWindow() { delete ui; }

39
src/view/main_window.h Normal file
View File

@ -0,0 +1,39 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QPushButton>
#include <memory>
#include "about_dialog.h"
#include "formula_dialog.h"
#include "update_dialog.h"
#include "printer_settings.h"
#include "delete_preset.h"
#include "add_preset.h"
#include "edit_preset.h"
QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE
class MainWindow : public QMainWindow {
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
private:
Ui::MainWindow *ui;
AboutDialog *progInfo;
FormulaDialog *formulaInfo;
UpdatesDialog *updateInfo;
PrinterSettingsDialog *printerSettings;
AddPresetDialog *addPresetDialog;
DeletePresetDialog *deletePresetDialog;
EditPresetDialog *editPresetDialog;
};
#endif // MAINWINDOW_H

View File

@ -0,0 +1,30 @@
#include "printer_settings.h"
#include "ui/ui_printer_settings.h"
PrinterSettingsDialog::PrinterSettingsDialog(QWidget *parent)
: QDialog(parent), ui(new Ui::PrinterSettingsDialog) {
ui->setupUi(this);
setWindowIcon(QIcon("img/logo-1.png"));
// TODO валидаторы
// setupValidators(SMTH);
connect(ui->save, &QPushButton::clicked, this, [this]() {
// TODO save new printer settings
qDebug() << "SAVE SETTINGS";
});
connect(ui->exit, &QPushButton::clicked, this, &QDialog::reject);
}
PrinterSettingsDialog::~PrinterSettingsDialog() { delete ui; }
void PrinterSettingsDialog::setupValidators() {
// TODO make validators
qDebug() << "SET VALIDATORS";
// ui->input_tarif->setValidator(SMTH);
// ui->input_q_trash->setValidator(SMTH);
// ui->input_price_pastik->setValidator(SMTH);
// ui->input_overprice->setValidator(SMTH);
}

View File

@ -0,0 +1,70 @@
#ifndef PrinterSettingsDialog_H
#define PrinterSettingsDialog_H
#include <QDialog>
#include <QDoubleValidator>
#include "ui/ui_printer_settings.h"
namespace Ui {
class PrinterSettingsDialog;
}
class PrinterSettingsDialog : public QDialog {
Q_OBJECT
public:
explicit PrinterSettingsDialog(QWidget *parent = nullptr);
~PrinterSettingsDialog();
// Методы доступа к данным
inline double getTariff() const {
return ui->input_tarif->toPlainText().toDouble();
}
inline double getRejectCoefficient() const {
return ui->input_q_trash->toPlainText().toDouble();
}
inline double getFilamentCost() const {
return ui->input_price_pastik->toPlainText().toDouble();
}
inline double getMarkupPercent() const {
return ui->input_overprice->toPlainText().toDouble();
}
inline int getFilamentWeight() const {
return ui->plastik_menu->currentText().toInt();
}
// Методы установки значений
inline void setTariff(double value) {
ui->input_tarif->setPlainText(QString::number(value));
}
inline void setRejectCoefficient(double value) {
ui->input_q_trash->setPlainText(QString::number(value));
}
inline void setFilamentCost(double value) {
ui->input_price_pastik->setPlainText(QString::number(value));
}
inline void setMarkupPercent(double value) {
ui->input_overprice->setPlainText(QString::number(value));
}
inline void setFilamentWeight(int value) {
int index = ui->plastik_menu->findText(QString::number(value));
if (index != -1) ui->plastik_menu->setCurrentIndex(index);
}
private:
Ui::PrinterSettingsDialog *ui;
// QDoubleValidator *doubleValidator;
void setupValidators();
};
#endif // PrinterSettingsDialog_H

15
src/view/resources.qrc Normal file
View File

@ -0,0 +1,15 @@
<RCC>
<qresource prefix="/">
<file>img/calc.png</file>
<file>img/exit.png</file>
<file>img/rubl.png</file>
<file>img/logo-1.png</file>
<file>img/logo-2.png</file>
<file>img/logo-3.png</file>
<file>img/logo-4.png</file>
<file>img/logo-5.png</file>
<file>img/logo-6.png</file>
<file>img/logo-7.png</file>
<file>img/logo-8.png</file>
</qresource>
</RCC>

60
src/view/ui/about.ui Normal file
View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>About</class>
<widget class="QDialog" name="progInfo">
<property name="styleSheet">
<string notr="true">
background-color: rgb(42, 45, 46);
color: white;
</string>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>365</width>
<height>97</height>
</rect>
</property>
<property name="windowTitle">
<string>О программе</string>
</property>
<property name="windowIcon">
<iconset>
<normaloff>img/logo-1.png</normaloff>img/logo-1.png</iconset>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>20</x>
<y>10</y>
<width>331</width>
<height>231</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Калькулятор Calc3D by Risen предназначен для быстрой оценки стоимости печати на 3D принтере,
исходя из стоимости пластика, веса, тарифа электроэнергии и прочего...</string>
</property>
<property name="textFormat">
<enum>Qt::AutoText</enum>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

433
src/view/ui/add_preset.ui Normal file
View File

@ -0,0 +1,433 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AddPrinter</class>
<widget class="QDialog" name="AddPrinter">
<property name="styleSheet">
<string notr="true">
background-color: rgb(42, 45, 46);
color: white;
</string>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>376</width>
<height>196</height>
</rect>
</property>
<property name="windowTitle">
<string>Добавление принтера</string>
</property>
<property name="windowIcon">
<iconset>
<normaloff>img/logo-1.png</normaloff>img/logo-1.png</iconset>
</property>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>160</y>
<width>341</width>
<height>27</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="pushButton">
<property name="styleSheet">
<string notr="true">background-color: rgb(0, 80, 0);</string>
</property>
<property name="text">
<string>Сохранить</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="styleSheet">
<string notr="true">background-color: rgb(0, 80, 0);</string>
</property>
<property name="text">
<string>Отмена</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QLabel" name="power_printer">
<property name="geometry">
<rect>
<x>20</x>
<y>90</y>
<width>261</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Срок полезного использования, лет</string>
</property>
</widget>
<widget class="QPlainTextEdit" name="input_power">
<property name="geometry">
<rect>
<x>290</x>
<y>90</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="toolTipDuration">
<number>0</number>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(77, 77, 77);</string>
</property>
<property name="inputMethodHints">
<set>Qt::ImhDigitsOnly</set>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum>
</property>
<property name="plainText">
<string notr="true"/>
</property>
<property name="tabStopDistance">
<double>80.000000000000000</double>
</property>
<property name="maximumBlockCount">
<number>3</number>
</property>
<property name="centerOnScroll">
<bool>false</bool>
</property>
<property name="placeholderText">
<string notr="true">0</string>
</property>
</widget>
<widget class="QLabel" name="power_printer_2">
<property name="geometry">
<rect>
<x>20</x>
<y>120</y>
<width>181</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Стоимость принетра, руб</string>
</property>
</widget>
<widget class="QPlainTextEdit" name="input_power_2">
<property name="geometry">
<rect>
<x>290</x>
<y>120</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="toolTipDuration">
<number>0</number>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(77, 77, 77);</string>
</property>
<property name="inputMethodHints">
<set>Qt::ImhDigitsOnly</set>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum>
</property>
<property name="plainText">
<string notr="true"/>
</property>
<property name="tabStopDistance">
<double>80.000000000000000</double>
</property>
<property name="maximumBlockCount">
<number>3</number>
</property>
<property name="centerOnScroll">
<bool>false</bool>
</property>
<property name="placeholderText">
<string notr="true">0</string>
</property>
</widget>
<widget class="QLabel" name="power_printer_3">
<property name="geometry">
<rect>
<x>20</x>
<y>60</y>
<width>181</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Мощность принтера, Вт</string>
</property>
</widget>
<widget class="QPlainTextEdit" name="input_power_3">
<property name="geometry">
<rect>
<x>290</x>
<y>60</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="toolTipDuration">
<number>0</number>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(77, 77, 77);</string>
</property>
<property name="inputMethodHints">
<set>Qt::ImhDigitsOnly</set>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum>
</property>
<property name="plainText">
<string notr="true"/>
</property>
<property name="tabStopDistance">
<double>80.000000000000000</double>
</property>
<property name="maximumBlockCount">
<number>3</number>
</property>
<property name="centerOnScroll">
<bool>false</bool>
</property>
<property name="placeholderText">
<string notr="true">0</string>
</property>
</widget>
<widget class="QLabel" name="power_printer_4">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>181</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Название пресета</string>
</property>
</widget>
<widget class="QTextEdit" name="textEdit">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>180</x>
<y>20</y>
<width>181</width>
<height>21</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<stylestrategy>PreferAntialias</stylestrategy>
<kerning>false</kerning>
</font>
</property>
<property name="tabletTracking">
<bool>false</bool>
</property>
<property name="acceptDrops">
<bool>true</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(77, 77, 77);</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="autoFormatting">
<set>QTextEdit::AutoBulletList</set>
</property>
<property name="tabChangesFocus">
<bool>true</bool>
</property>
<property name="documentTitle">
<string notr="true"/>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="lineWrapMode">
<enum>QTextEdit::WidgetWidth</enum>
</property>
<property name="markdown">
<string/>
</property>
<property name="acceptRichText">
<bool>false</bool>
</property>
<property name="cursorWidth">
<number>1</number>
</property>
<property name="textInteractionFlags">
<set>Qt::TextEditorInteraction</set>
</property>
<property name="placeholderText">
<string>Название принтера</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

84
src/view/ui/del_preset.ui Normal file
View File

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DelPreset</class>
<widget class="QDialog" name="DelPreset">
<property name="styleSheet">
<string notr="true">
background-color: rgb(42, 45, 46);
color: white;
</string>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>369</width>
<height>347</height>
</rect>
</property>
<property name="windowTitle">
<string>Настройки принтера</string>
</property>
<property name="windowIcon">
<iconset>
<normaloff>img/logo-1.png</normaloff>img/logo-1.png</iconset>
</property>
<widget class="QTableWidget" name="tableWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>321</width>
<height>271</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(36, 36, 36);</string>
</property>
</widget>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>23</x>
<y>310</y>
<width>321</width>
<height>27</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="pushButton">
<property name="styleSheet">
<string notr="true">background-color: rgb(0, 80, 0);</string>
</property>
<property name="text">
<string>Изменить</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_3">
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 0, 0);</string>
</property>
<property name="text">
<string>Удалить</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="styleSheet">
<string notr="true">background-color: rgb(0, 80, 0);</string>
</property>
<property name="text">
<string>Отмена</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EditPreset</class>
<widget class="QDialog" name="EditPreset">
<property name="styleSheet">
<string notr="true">
background-color: rgb(42, 45, 46);
color: white;
</string>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>369</width>
<height>169</height>
</rect>
</property>
<property name="windowTitle">
<string>Изменить пресет</string>
</property>
<property name="windowIcon">
<iconset>
<normaloff>img/logo-1.png</normaloff>img/logo-1.png</iconset>
</property>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>22</x>
<y>130</y>
<width>321</width>
<height>27</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="pushButton">
<property name="styleSheet">
<string notr="true">background-color: rgb(0, 80, 0);</string>
</property>
<property name="text">
<string>Сохранить</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="styleSheet">
<string notr="true">background-color: rgb(0, 80, 0);</string>
</property>
<property name="text">
<string>Закрыть</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>

152
src/view/ui/formula.ui Normal file
View File

@ -0,0 +1,152 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Formula</class>
<widget class="QDialog" name="Formula">
<property name="styleSheet">
<string notr="true">
background-color: rgb(42, 45, 46);
color: white;
</string>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>367</width>
<height>377</height>
</rect>
</property>
<property name="windowTitle">
<string>Формула расчета</string>
</property>
<property name="windowIcon">
<iconset>
<normaloff>img/logo-1.png</normaloff>img/logo-1.png</iconset>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>100</x>
<y>10</y>
<width>171</width>
<height>41</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: white;</string>
</property>
<property name="text">
<string>## Формула расчета</string>
</property>
<property name="textFormat">
<enum>Qt::MarkdownText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>30</x>
<y>50</y>
<width>341</width>
<height>21</height>
</rect>
</property>
<property name="font">
<font>
<family>Sans Serif</family>
<pointsize>10</pointsize>
<bold>true</bold>
<kerning>false</kerning>
</font>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="text">
<string>S = ((p/1000*t/60*h)+(md*d*st/mk)+(a+post))*x+mod</string>
</property>
<property name="textFormat">
<enum>Qt::MarkdownText</enum>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<width>341</width>
<height>281</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>где
```
S - стоимость печати, руб.
p - мощность принтера, Вт
t - время печати, мин.
h - тариф на электроэнергию, кВт/ч
md - вес детали, гр.
d - множитель отбраковки.
st - стоимость катушки пластика, руб.
mk - вес пластика в катушке, гр.
a - амортизация принтера, руб.
post - стоимость постобработки, руб.
х - количество печатаемых дубликатов, шт.
mod - стоимость моделирования, руб
```</string>
</property>
<property name="textFormat">
<enum>Qt::MarkdownText</enum>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>100</x>
<y>340</y>
<width>161</width>
<height>25</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(0, 80, 0);</string>
</property>
<property name="text">
<string>Закрыть</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

980
src/view/ui/main_window.ui Normal file
View File

@ -0,0 +1,980 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="Calc3DbyRisen">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>373</width>
<height>471</height>
</rect>
</property>
<property name="font">
<font>
<bold>true</bold>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="windowTitle">
<string>Calc3D by Risen v.1.0.0</string>
</property>
<property name="windowIcon">
<iconset>
<normaloff>img/logo-1.png</normaloff>img/logo-1.png</iconset>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="dockOptions">
<set>QMainWindow::DockOption::AllowTabbedDocks|QMainWindow::DockOption::AnimatedDocks</set>
</property>
<widget class="QWidget" name="centralwidget">
<property name="styleSheet">
<string notr="true">
background-color: rgb(42, 45, 46);
color: white;
</string>
</property>
<widget class="QLabel" name="quantity">
<property name="geometry">
<rect>
<x>20</x>
<y>270</y>
<width>171</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Количество экземпляров</string>
</property>
</widget>
<widget class="QLabel" name="weight">
<property name="geometry">
<rect>
<x>20</x>
<y>240</y>
<width>101</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Масса детали</string>
</property>
</widget>
<widget class="QLabel" name="time_print">
<property name="geometry">
<rect>
<x>20</x>
<y>210</y>
<width>101</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Время печати</string>
</property>
</widget>
<widget class="QLabel" name="printer">
<property name="geometry">
<rect>
<x>21</x>
<y>171</y>
<width>81</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Принтер</string>
</property>
</widget>
<widget class="QComboBox" name="printer_menu">
<property name="geometry">
<rect>
<x>181</x>
<y>170</y>
<width>171</width>
<height>25</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">alternate-background-color: rgb(77, 77, 77);</string>
</property>
<property name="acceptDrops">
<bool>true</bool>
</property>
<property name="styleSheet">
<string notr="true">alternate-background-color: rgb(77, 77, 77);</string>
</property>
<property name="currentText">
<string/>
</property>
<property name="currentIndex">
<number>-1</number>
</property>
<property name="insertPolicy">
<enum>QComboBox::InsertPolicy::NoInsert</enum>
</property>
<property name="placeholderText">
<string>Выбор принтера</string>
</property>
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>Checked</string>
</property>
</item>
</widget>
<widget class="QLCDNumber" name="lcd_result">
<property name="geometry">
<rect>
<x>20</x>
<y>10</y>
<width>301</width>
<height>71</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(36, 36, 36);</string>
</property>
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<property name="digitCount">
<number>10</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::SegmentStyle::Flat</enum>
</property>
</widget>
<widget class="QLCDNumber" name="lcd_result_2">
<property name="geometry">
<rect>
<x>180</x>
<y>90</y>
<width>141</width>
<height>41</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(36, 36, 36);</string>
</property>
<property name="digitCount">
<number>10</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::SegmentStyle::Flat</enum>
</property>
</widget>
<widget class="QLabel" name="cost_price">
<property name="geometry">
<rect>
<x>20</x>
<y>110</y>
<width>141</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Себестоимость</string>
</property>
</widget>
<widget class="QPlainTextEdit" name="input_hours">
<property name="geometry">
<rect>
<x>180</x>
<y>210</y>
<width>51</width>
<height>20</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="toolTipDuration">
<number>0</number>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(77, 77, 77);</string>
</property>
<property name="inputMethodHints">
<set>Qt::InputMethodHint::ImhDigitsOnly</set>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarPolicy::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarPolicy::ScrollBarAsNeeded</enum>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="lineWrapMode">
<enum>QPlainTextEdit::LineWrapMode::NoWrap</enum>
</property>
<property name="plainText">
<string notr="true"/>
</property>
<property name="tabStopDistance">
<double>80.000000000000000</double>
</property>
<property name="maximumBlockCount">
<number>3</number>
</property>
<property name="centerOnScroll">
<bool>false</bool>
</property>
<property name="placeholderText">
<string notr="true">0</string>
</property>
</widget>
<widget class="QLabel" name="text_time_hours">
<property name="geometry">
<rect>
<x>240</x>
<y>210</y>
<width>21</width>
<height>17</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(0, 0, 0);</string>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>ч.</string>
</property>
</widget>
<widget class="QPlainTextEdit" name="input_minutes">
<property name="geometry">
<rect>
<x>260</x>
<y>210</y>
<width>51</width>
<height>21</height>
</rect>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(77, 77, 77);</string>
</property>
<property name="inputMethodHints">
<set>Qt::InputMethodHint::ImhDigitsOnly</set>
</property>
<property name="maximumBlockCount">
<number>3</number>
</property>
<property name="centerOnScroll">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>0</string>
</property>
</widget>
<widget class="QLabel" name="text_time_minuts">
<property name="geometry">
<rect>
<x>320</x>
<y>210</y>
<width>31</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>мин.</string>
</property>
</widget>
<widget class="QPlainTextEdit" name="input_gram">
<property name="geometry">
<rect>
<x>230</x>
<y>240</y>
<width>81</width>
<height>20</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="toolTipDuration">
<number>0</number>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(77, 77, 77);</string>
</property>
<property name="inputMethodHints">
<set>Qt::InputMethodHint::ImhFormattedNumbersOnly</set>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarPolicy::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarPolicy::ScrollBarAsNeeded</enum>
</property>
<property name="plainText">
<string notr="true"/>
</property>
<property name="centerOnScroll">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>0</string>
</property>
</widget>
<widget class="QPlainTextEdit" name="input_things">
<property name="geometry">
<rect>
<x>230</x>
<y>270</y>
<width>81</width>
<height>20</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="toolTipDuration">
<number>0</number>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(77, 77, 77);</string>
</property>
<property name="inputMethodHints">
<set>Qt::InputMethodHint::ImhDigitsOnly</set>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarPolicy::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarPolicy::ScrollBarAsNeeded</enum>
</property>
<property name="plainText">
<string notr="true"/>
</property>
<property name="centerOnScroll">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>0</string>
</property>
</widget>
<widget class="QPlainTextEdit" name="input_mod">
<property name="geometry">
<rect>
<x>230</x>
<y>330</y>
<width>81</width>
<height>20</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="toolTipDuration">
<number>0</number>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(77, 77, 77);</string>
</property>
<property name="inputMethodHints">
<set>Qt::InputMethodHint::ImhDigitsOnly</set>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarPolicy::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarPolicy::ScrollBarAsNeeded</enum>
</property>
<property name="plainText">
<string notr="true"/>
</property>
<property name="centerOnScroll">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>0</string>
</property>
</widget>
<widget class="QPlainTextEdit" name="input_post">
<property name="geometry">
<rect>
<x>230</x>
<y>360</y>
<width>81</width>
<height>20</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="toolTipDuration">
<number>0</number>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(77, 77, 77);</string>
</property>
<property name="inputMethodHints">
<set>Qt::InputMethodHint::ImhDigitsOnly</set>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarPolicy::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarPolicy::ScrollBarAsNeeded</enum>
</property>
<property name="plainText">
<string notr="true"/>
</property>
<property name="centerOnScroll">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>0</string>
</property>
</widget>
<widget class="QLabel" name="text_gram">
<property name="geometry">
<rect>
<x>320</x>
<y>240</y>
<width>31</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>г.</string>
</property>
</widget>
<widget class="QLabel" name="text_things">
<property name="geometry">
<rect>
<x>320</x>
<y>270</y>
<width>31</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>шт.</string>
</property>
</widget>
<widget class="QLabel" name="text_rub_mod">
<property name="geometry">
<rect>
<x>320</x>
<y>330</y>
<width>31</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>руб.</string>
</property>
</widget>
<widget class="QLabel" name="text_rub_post">
<property name="geometry">
<rect>
<x>320</x>
<y>360</y>
<width>31</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>руб.</string>
</property>
</widget>
<widget class="QLabel" name="ico_rub">
<property name="geometry">
<rect>
<x>330</x>
<y>50</y>
<width>31</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap>img/rubl.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
<widget class="QFrame" name="frame">
<property name="geometry">
<rect>
<x>20</x>
<y>130</y>
<width>331</width>
<height>31</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::Shape::HLine</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<property name="lineWidth">
<number>2</number>
</property>
</widget>
<widget class="QFrame" name="frame_2">
<property name="geometry">
<rect>
<x>20</x>
<y>300</y>
<width>331</width>
<height>31</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::Shape::HLine</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<property name="lineWidth">
<number>2</number>
</property>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>400</y>
<width>331</width>
<height>41</height>
</rect>
</property>
<layout class="QHBoxLayout" name="buttons">
<item>
<widget class="QPushButton" name="get_result_btn">
<property name="font">
<font>
<pointsize>10</pointsize>
<italic>false</italic>
<bold>true</bold>
<stylestrategy>PreferAntialias</stylestrategy>
<kerning>true</kerning>
</font>
</property>
<property name="acceptDrops">
<bool>true</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(0, 80, 0);</string>
</property>
<property name="text">
<string>Рассчитать</string>
</property>
<property name="icon">
<iconset>
<normaloff>img/calc.png</normaloff>img/calc.png</iconset>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="exit_btn">
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(0, 80, 0);</string>
</property>
<property name="text">
<string>Выход</string>
</property>
<property name="icon">
<iconset>
<normaloff>img/exit.png</normaloff>img/exit.png</iconset>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QLabel" name="modeling">
<property name="geometry">
<rect>
<x>20</x>
<y>330</y>
<width>141</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Моделирование</string>
</property>
</widget>
<widget class="QLabel" name="post_print">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>20</x>
<y>360</y>
<width>121</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Постобработка</string>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>373</width>
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="settings">
<property name="title">
<string>Файл</string>
</property>
<widget class="QMenu" name="pressets">
<property name="title">
<string>Пресеты принтера</string>
</property>
<addaction name="add_preset"/>
<addaction name="edit_printer"/>
<addaction name="del_printer"/>
</widget>
<addaction name="settings_2"/>
<addaction name="pressets"/>
<addaction name="separator"/>
<addaction name="separator"/>
<addaction name="action_3"/>
</widget>
<widget class="QMenu" name="help">
<property name="contextMenuPolicy">
<enum>Qt::ContextMenuPolicy::DefaultContextMenu</enum>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="tearOffEnabled">
<bool>false</bool>
</property>
<property name="title">
<string>Помощь</string>
</property>
<property name="separatorsCollapsible">
<bool>false</bool>
</property>
<addaction name="check_update"/>
<addaction name="formula"/>
<addaction name="about"/>
</widget>
<addaction name="settings"/>
<addaction name="help"/>
</widget>
<action name="check_update">
<property name="checkable">
<bool>false</bool>
</property>
<property name="text">
<string>Проверить обновления</string>
</property>
</action>
<action name="formula">
<property name="text">
<string>Как расчитывается стоимость</string>
</property>
</action>
<action name="about">
<property name="text">
<string>О програме</string>
</property>
</action>
<action name="settings_2">
<property name="text">
<string>Настройки</string>
</property>
</action>
<action name="add_preset">
<property name="text">
<string>Добавить принтер</string>
</property>
</action>
<action name="edit_printer">
<property name="text">
<string>Редактировать принтер</string>
</property>
</action>
<action name="del_printer">
<property name="text">
<string>Удалить принтер</string>
</property>
</action>
<action name="action_3">
<property name="text">
<string>Выход</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::QuitRole</enum>
</property>
</action>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,538 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PrinterSettingsDialog</class>
<widget class="QDialog" name="PrinterSettingsDialog">
<property name="styleSheet">
<string notr="true">
background-color: rgb(42, 45, 46);
color: white;
</string>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>379</width>
<height>337</height>
</rect>
</property>
<property name="windowTitle">
<string>Настройки</string>
</property>
<property name="windowIcon">
<iconset>
<normaloff>img/logo-1.png</normaloff>img/logo-1.png</iconset>
</property>
<widget class="QPlainTextEdit" name="input_tarif">
<property name="geometry">
<rect>
<x>280</x>
<y>90</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="toolTipDuration">
<number>0</number>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(77, 77, 77);</string>
</property>
<property name="inputMethodHints">
<set>Qt::ImhDigitsOnly</set>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum>
</property>
<property name="plainText">
<string notr="true"/>
</property>
<property name="tabStopDistance">
<double>80.000000000000000</double>
</property>
<property name="maximumBlockCount">
<number>3</number>
</property>
<property name="centerOnScroll">
<bool>false</bool>
</property>
<property name="placeholderText">
<string notr="true">0</string>
</property>
</widget>
<widget class="QLabel" name="Tarif">
<property name="geometry">
<rect>
<x>20</x>
<y>90</y>
<width>221</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Тариф электроэнергии, кВТ/ч</string>
</property>
</widget>
<widget class="QPlainTextEdit" name="input_q_trash">
<property name="geometry">
<rect>
<x>280</x>
<y>130</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="toolTipDuration">
<number>0</number>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(77, 77, 77);</string>
</property>
<property name="inputMethodHints">
<set>Qt::ImhDigitsOnly</set>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum>
</property>
<property name="plainText">
<string notr="true"/>
</property>
<property name="tabStopDistance">
<double>80.000000000000000</double>
</property>
<property name="maximumBlockCount">
<number>3</number>
</property>
<property name="centerOnScroll">
<bool>false</bool>
</property>
<property name="placeholderText">
<string notr="true">0</string>
</property>
</widget>
<widget class="QLabel" name="Q_trash">
<property name="geometry">
<rect>
<x>20</x>
<y>130</y>
<width>201</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Коэффициент выбраковки</string>
</property>
</widget>
<widget class="QPlainTextEdit" name="input_price_pastik">
<property name="geometry">
<rect>
<x>280</x>
<y>170</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="toolTipDuration">
<number>0</number>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(77, 77, 77);</string>
</property>
<property name="inputMethodHints">
<set>Qt::ImhDigitsOnly</set>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum>
</property>
<property name="plainText">
<string notr="true"/>
</property>
<property name="tabStopDistance">
<double>80.000000000000000</double>
</property>
<property name="maximumBlockCount">
<number>3</number>
</property>
<property name="centerOnScroll">
<bool>false</bool>
</property>
<property name="placeholderText">
<string notr="true">0</string>
</property>
</widget>
<widget class="QLabel" name="Price_plastik">
<property name="geometry">
<rect>
<x>20</x>
<y>170</y>
<width>181</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Стоимость катушки, руб</string>
</property>
</widget>
<widget class="QPlainTextEdit" name="input_overprice">
<property name="geometry">
<rect>
<x>280</x>
<y>210</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="toolTipDuration">
<number>0</number>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(77, 77, 77);</string>
</property>
<property name="inputMethodHints">
<set>Qt::ImhDigitsOnly</set>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum>
</property>
<property name="plainText">
<string notr="true"/>
</property>
<property name="tabStopDistance">
<double>80.000000000000000</double>
</property>
<property name="maximumBlockCount">
<number>3</number>
</property>
<property name="centerOnScroll">
<bool>false</bool>
</property>
<property name="placeholderText">
<string notr="true">0</string>
</property>
</widget>
<widget class="QLabel" name="Over_price">
<property name="geometry">
<rect>
<x>20</x>
<y>210</y>
<width>181</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Наценка, %</string>
</property>
</widget>
<widget class="QLabel" name="weight_plastik">
<property name="geometry">
<rect>
<x>20</x>
<y>250</y>
<width>181</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Вес катушки, гр</string>
</property>
</widget>
<widget class="QComboBox" name="plastik_menu">
<property name="geometry">
<rect>
<x>280</x>
<y>250</y>
<width>71</width>
<height>25</height>
</rect>
</property>
<property name="acceptDrops">
<bool>true</bool>
</property>
<property name="toolTipDuration">
<number>-1</number>
</property>
<property name="styleSheet">
<string notr="true">alternate-background-color: rgb(77, 77, 77);</string>
</property>
<property name="currentText">
<string>1000</string>
</property>
<property name="currentIndex">
<number>2</number>
</property>
<property name="insertPolicy">
<enum>QComboBox::NoInsert</enum>
</property>
<property name="placeholderText">
<string/>
</property>
<item>
<property name="text">
<string>5000</string>
</property>
</item>
<item>
<property name="text">
<string>2500</string>
</property>
</item>
<item>
<property name="text">
<string>1000</string>
</property>
</item>
<item>
<property name="text">
<string>750</string>
</property>
</item>
<item>
<property name="text">
<string>500</string>
</property>
</item>
<item>
<property name="text">
<string>250</string>
</property>
</item>
</widget>
<widget class="QLabel" name="warning_text">
<property name="geometry">
<rect>
<x>30</x>
<y>10</y>
<width>311</width>
<height>51</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 0, 0);</string>
</property>
<property name="text">
<string>ВНИМАНИЕ! Перед установкой параметра &quot;Коэффициент выбраковки&quot; прочитайте раздел Помощь, с описанием формулы расчета!</string>
</property>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>300</y>
<width>331</width>
<height>27</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="save">
<property name="styleSheet">
<string notr="true">background-color: rgb(0, 80, 0);</string>
</property>
<property name="text">
<string>Сохранить</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="exit">
<property name="styleSheet">
<string notr="true">background-color: rgb(0, 80, 0);</string>
</property>
<property name="text">
<string>Отмена</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,433 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SettingsPreset</class>
<widget class="QDialog" name="SettingsPreset">
<property name="styleSheet">
<string notr="true">
background-color: rgb(42, 45, 46);
color: white;
</string>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>375</width>
<height>195</height>
</rect>
</property>
<property name="windowTitle">
<string>Настройки пресета принтера</string>
</property>
<property name="windowIcon">
<iconset>
<normaloff>../img/logo-1.png</normaloff>../img/logo-1.png</iconset>
</property>
<widget class="QLabel" name="price_printer">
<property name="geometry">
<rect>
<x>20</x>
<y>120</y>
<width>181</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Стоимость принетра, руб</string>
</property>
</widget>
<widget class="QPlainTextEdit" name="input_prise_printer">
<property name="geometry">
<rect>
<x>290</x>
<y>120</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="toolTipDuration">
<number>0</number>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(77, 77, 77);</string>
</property>
<property name="inputMethodHints">
<set>Qt::InputMethodHint::ImhDigitsOnly</set>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarPolicy::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarPolicy::ScrollBarAsNeeded</enum>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="lineWrapMode">
<enum>QPlainTextEdit::LineWrapMode::NoWrap</enum>
</property>
<property name="plainText">
<string notr="true"/>
</property>
<property name="tabStopDistance">
<double>80.000000000000000</double>
</property>
<property name="maximumBlockCount">
<number>3</number>
</property>
<property name="centerOnScroll">
<bool>false</bool>
</property>
<property name="placeholderText">
<string notr="true">0</string>
</property>
</widget>
<widget class="QLabel" name="power_printer">
<property name="geometry">
<rect>
<x>20</x>
<y>60</y>
<width>181</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Мощность принтера, Вт</string>
</property>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>160</y>
<width>341</width>
<height>27</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="save">
<property name="styleSheet">
<string notr="true">background-color: rgb(0, 80, 0);</string>
</property>
<property name="text">
<string>Сохранить</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancel">
<property name="styleSheet">
<string notr="true">background-color: rgb(0, 80, 0);</string>
</property>
<property name="text">
<string>Отмена</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QPlainTextEdit" name="input_time_to_use">
<property name="geometry">
<rect>
<x>290</x>
<y>90</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="toolTipDuration">
<number>0</number>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(77, 77, 77);</string>
</property>
<property name="inputMethodHints">
<set>Qt::InputMethodHint::ImhDigitsOnly</set>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarPolicy::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarPolicy::ScrollBarAsNeeded</enum>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="lineWrapMode">
<enum>QPlainTextEdit::LineWrapMode::NoWrap</enum>
</property>
<property name="plainText">
<string notr="true"/>
</property>
<property name="tabStopDistance">
<double>80.000000000000000</double>
</property>
<property name="maximumBlockCount">
<number>3</number>
</property>
<property name="centerOnScroll">
<bool>false</bool>
</property>
<property name="placeholderText">
<string notr="true">0</string>
</property>
</widget>
<widget class="QPlainTextEdit" name="input_power">
<property name="geometry">
<rect>
<x>290</x>
<y>60</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="toolTipDuration">
<number>0</number>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(77, 77, 77);</string>
</property>
<property name="inputMethodHints">
<set>Qt::InputMethodHint::ImhDigitsOnly</set>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarPolicy::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarPolicy::ScrollBarAsNeeded</enum>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="lineWrapMode">
<enum>QPlainTextEdit::LineWrapMode::NoWrap</enum>
</property>
<property name="plainText">
<string notr="true"/>
</property>
<property name="tabStopDistance">
<double>80.000000000000000</double>
</property>
<property name="maximumBlockCount">
<number>3</number>
</property>
<property name="centerOnScroll">
<bool>false</bool>
</property>
<property name="placeholderText">
<string notr="true">0</string>
</property>
</widget>
<widget class="QTextEdit" name="Input_name_printer">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>180</x>
<y>20</y>
<width>181</width>
<height>21</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<stylestrategy>PreferAntialias</stylestrategy>
<kerning>false</kerning>
</font>
</property>
<property name="tabletTracking">
<bool>false</bool>
</property>
<property name="acceptDrops">
<bool>true</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(77, 77, 77);</string>
</property>
<property name="frameShape">
<enum>QFrame::Shape::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Sunken</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarPolicy::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarPolicy::ScrollBarAlwaysOff</enum>
</property>
<property name="autoFormatting">
<set>QTextEdit::AutoFormattingFlag::AutoBulletList</set>
</property>
<property name="tabChangesFocus">
<bool>true</bool>
</property>
<property name="documentTitle">
<string notr="true"/>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="lineWrapMode">
<enum>QTextEdit::LineWrapMode::WidgetWidth</enum>
</property>
<property name="markdown">
<string/>
</property>
<property name="acceptRichText">
<bool>false</bool>
</property>
<property name="cursorWidth">
<number>1</number>
</property>
<property name="textInteractionFlags">
<set>Qt::TextInteractionFlag::TextEditorInteraction</set>
</property>
<property name="placeholderText">
<string>Название принтера</string>
</property>
</widget>
<widget class="QLabel" name="time_to_use">
<property name="geometry">
<rect>
<x>20</x>
<y>90</y>
<width>261</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Срок полезного использования, лет</string>
</property>
</widget>
<widget class="QLabel" name="name_printer">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>181</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Название пресета</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

135
src/view/ui/updates.ui Normal file
View File

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Updates</class>
<widget class="QDialog" name="Updates">
<property name="styleSheet">
<string notr="true">
background-color: rgb(42, 45, 46);
color: white;
</string>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>379</width>
<height>99</height>
</rect>
</property>
<property name="windowTitle">
<string>Updates</string>
</property>
<property name="windowIcon">
<iconset>
<normaloff>img/logo-1.png</normaloff>img/logo-1.png</iconset>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>73</x>
<y>0</y>
<width>191</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Ваша версия:</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>70</x>
<y>20</y>
<width>191</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Версия на сайте:</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>250</x>
<y>10</y>
<width>54</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>1.0.0</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>250</x>
<y>30</y>
<width>54</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>1.0.0</string>
</property>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>60</y>
<width>331</width>
<height>27</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="pushButton">
<property name="styleSheet">
<string notr="true">background-color: rgb(0, 80, 0);</string>
</property>
<property name="text">
<string>Перейти на сайт</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="styleSheet">
<string notr="true">background-color: rgb(0, 80, 0);</string>
</property>
<property name="text">
<string>Закрыть</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,36 @@
#include "update_dialog.h"
#include "ui/ui_updates.h"
#include <QDesktopServices>
UpdatesDialog::UpdatesDialog(QWidget *parent)
: QDialog(parent),
ui(new Ui::Updates)
{
ui->setupUi(this);
setWindowIcon(QIcon("img/logo-1.png"));
connect(ui->pushButton_2, &QPushButton::clicked, this, &UpdatesDialog::onCloseClicked);
connect(ui->pushButton, &QPushButton::clicked, this, &UpdatesDialog::onVisitWebsiteClicked);
}
UpdatesDialog::~UpdatesDialog() {
delete ui;
}
void UpdatesDialog::setCurrentVersion(const QString &version) {
ui->label_3->setText(version);
}
void UpdatesDialog::setLatestVersion(const QString &version) {
ui->label_4->setText(version);
}
void UpdatesDialog::onCloseClicked() {
close();
}
void UpdatesDialog::onVisitWebsiteClicked() {
// TODO занести сайт
QDesktopServices::openUrl(WEBSITE_URL);
}

31
src/view/update_dialog.h Normal file
View File

@ -0,0 +1,31 @@
#ifndef UPDATESDIALOG_H
#define UPDATESDIALOG_H
#include <QDialog>
#include <QUrl>
namespace Ui {
class Updates;
}
class UpdatesDialog : public QDialog {
Q_OBJECT
public:
explicit UpdatesDialog(QWidget *parent = nullptr);
~UpdatesDialog();
// Методы для обновления информации о версиях
void setCurrentVersion(const QString &version);
void setLatestVersion(const QString &version);
private slots:
void onCloseClicked();
void onVisitWebsiteClicked();
private:
Ui::Updates *ui;
const QUrl WEBSITE_URL = QUrl("https://your-update-website.com");
};
#endif // UPDATESDIALOG_H

View File

@ -1,76 +0,0 @@
import gettext
import json
import os
if not os.path.isfile('setts.json'):
with open('setts.json', 'w') as file:
data = {"settings": {"theme": "Dark",
"p": "270",
"h": "3",
"d": "1.5",
"st": "1500",
"mk": "1000",
"a": "0",
"spi": "3",
"marg": "0",
"locale": "Ru",
"currency": "руб."}}
json.dump(data, file, indent=2)
with open('setts.json') as file:
old_data = json.load(file)
if old_data['settings']["locale"] == 'English':
locale = 'en_US'
else:
locale = 'ru_RU'
lang = gettext.translation('locale', localedir='locale', languages=[locale])
lang.install()
_ = lang.gettext
calc = (_("Формула расчета стоимости печати выглядит так:\n\n"
"S = ((p/1000*t/60*h)+(md*d*st/mk)+am+post))*x+mod\n\n"
"где:\n"
"S - стоимость печати, руб.\n"
"p - мощность принтера, Вт\n"
"t - время печати, мин.\n"
"h - тариф на электроэнергию, кВт/ч\n"
"md - вес детали, гр.\n"
"st - стоимость катушки пластика, руб.\n"
"mk - вес пластика в катушке, гр.\n"
"d - коэффициент выбраковки\n"
"am - амортизация, руб.\n"
"post - стоимость постобработки, руб.\n"
"х - количество печатаемых дубликатов, шт.\n"
"mod - стоимость моделирования, руб.\n\n"
"При этом в расчете вес детали, умножается на 1.5,\n"
"это сделано для выбраковки и тестовой печати,"
"т.е. при калькуляции вес одной детали для печати\n"
"считается как 1,5 детали "
"Можете изменить этот пункт в настройках.\n\n"))
about = (_("По вопросам и предложениям писать в телеграм на @RisenYT\n\n"))
amortization_calc = (_('Как считается амортизация:\n\n'
'Отчисления записываются \n'
'частями в зависимости от времени \n'
'печати конкретного изделия\n'
'Рекомендую задавать СПИ (это время\n'
'окупаемости принтера) 3 года.\n'
'Калькулятор считает амортизацию в\n'
'минуту и умножает на количество минут,\n'
'которые принтер будет печатать.'))
not_connect = (_('Невозможно проверить обновление.\n\n'
'Отсутствует подключение к интернету\n'
'или программа заблокирована фаерволом.\n\n'
'Для продолжения работы нажмите "Ok"'))
new_sets = (_('Задайте стоимость принтера, \n'
'срок полезного использования\n'
'в настройках амортизации\n'))
new_marge = (_('Задайте процент желаемой наценки\n'
'в настройках (можно просто проставить ноль)'))
ver = '0.6.4'

View File

@ -1,90 +0,0 @@
import requests
import webbrowser
import json
import PySimpleGUI as Sgi
import gettext
from texts import ver
from setts import language
lang = gettext.translation('locale', localedir='locale', languages=[language()])
lang.install()
_ = lang.gettext
def upd_check():
with open('setts.json') as json_file:
data = json.load(json_file)
set_theme = data["settings"]["theme"]
version_new = requests.get('https://risenhome.xyz/feed/Risen.json').json()["version"]["ver"]
version_old = ver
if version_new > version_old:
Sgi.theme(set_theme)
layout = [
[Sgi.Text(_("Обновление"))],
[Sgi.Text(_("Вышла новая версия программы\nНужно обновиться"))],
[Sgi.Button(_(' Скачать ')), Sgi.Push(), Sgi.Button(_(' Отмена '))]
]
window = Sgi.Window(_("Проверка обновления"), layout, modal=True)
while True:
event, button = window.read()
if event == _(' Скачать '):
webbrowser.open('https://risenhome.xyz/calc.html', new=2, autoraise=True)
window.close()
elif event == _(' Отмена '):
window.close()
elif event == "Exit" or event == Sgi.WIN_CLOSED:
break
else:
Sgi.theme(set_theme)
layout = [
[Sgi.Text(_('Последняя версия: ')+f'{version_new}'+_('\nВаша версия: ')+f'{version_old}'+_('\n\n'
'Обновление не'
' требуется'))],
[Sgi.Button(_(' Закрыть '))]
]
window = Sgi.Window(_("Проверка обновления"), layout, modal=True)
while True:
event, button = window.read()
if event == _(' Закрыть '):
window.close()
elif event == "Exit" or event == Sgi.WIN_CLOSED:
break
# def upd_start():
# with open('setts.json') as json_file:
# data = json.load(json_file)
# set_theme = data["settings"]["theme"]
#
# version_new = requests.get('https://risenhome.xyz/feed/Risen.json').json()["version"]["ver"]
# version_old = ver
#
# if version_new > version_old:
#
# Sgi.theme(set_theme)
# layout = [
# [Sgi.Text(_("Обновление"))],
# [Sgi.Text(_("Вышла новая версия программы\nНужно обновиться"))],
# [Sgi.Button(_(' Скачать ')), Sgi.Push(), Sgi.Button(' Отмена ')]
# ]
#
# window = Sgi.Window(_("Вышла новая версия!"), layout, modal=True)
#
# while True:
# event, button = window.read()
# if event == _(' Скачать '):
# webbrowser.open('https://risenhome.xyz', new=2, autoraise=True)
# window.close()
# elif event == _(' Отмена '):
# window.close()
# elif event == "Exit" or event == Sgi.WIN_CLOSED:
# break