This commit is contained in:
Иван 2025-03-01 18:24:42 +03:00
parent 900a83be54
commit d24a29b5ca
19 changed files with 139 additions and 1032 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@
Calc3D.spec
/releases
*.ui
__pycache__

View File

@ -1,17 +0,0 @@
import sys
from PySide6.QtWidgets import QApplication, QMainWindow
from calc3dui import Ui_Calc3DbyRisen
class App(QMainWindow):
def __init__(self):
super(App, self).__init__()
self.ui = Ui_Calc3DbyRisen()
self.ui.setupUi(self)
if __name__ == '__main__':
app = QApplication(sys.argv)
window = App()
window.show()
sys.exit(app.exec())

View File

@ -1,9 +0,0 @@
MIT License
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:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
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,87 +0,0 @@
# Calc3D by Risen
Калькулятор Calc3D by Risen предназначен для быстрой оценки стоимости печати на 3D принтере,
исходя из стоимости пластика, веса, тарифа электроэнергии и прочего...
## Содержание
- [Формула расчета](#формула-расчета)
- [Как скачать](#как-скачать)
- [FAQ](#faq)
- [Зачем это всё](#почему-я-решил-реализовать-этот-проект?)
- [Команда проекта](#команда-проекта)
- [Лицензия](#лицензия)
-
## Формула расчета
```
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)
Качаем последнюю версию, настраиваем свои параметры и пользуемся.
## FAQ
Раздел в процессе написания
## Почему я решил реализовать этот проект?
Не нашел в интернете таких калькуляторов офлайн. Решил сделать для себя, заодно потренироваться в программировании.
## Команда проекта
Вы можете написать мне в личку в телеграм, если у Вас есть каие-то вопросы по работе калькулятора.
- [Risen (Colin Robinson)](tg://resolve?domain=RisenYT) — разработчик-любитель
## Лицензия
MIT
```
Copyright (c) <2024> <Risen>
Данная лицензия разрешает лицам, получившим копию данного программного обеспечения и сопутствующей документации
(далее — Программное обеспечение), безвозмездно использовать Программное обеспечение без ограничений, включая
неограниченное право на использование, копирование, изменение, слияние, публикацию, распространение, сублицензирование
и/или продажу копий Программного обеспечения, а также лицам, которым предоставляется данное Программное обеспечение,
при соблюдении следующих условий:
Указанное выше уведомление об авторском праве и данные условия должны быть включены во все копии или значимые части
данного Программного обеспечения.
ДАННОЕ ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ ПРЕДОСТАВЛЯЕТСЯ «КАК ЕСТЬ», БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ, ЯВНО ВЫРАЖЕННЫХ ИЛИ ПОДРАЗУМЕВАЕМЫХ,
ВКЛЮЧАЯ ГАРАНТИИ ТОВАРНОЙ ПРИГОДНОСТИ, СООТВЕТСТВИЯ ПО ЕГО КОНКРЕТНОМУ НАЗНАЧЕНИЮ И ОТСУТСТВИЯ НАРУШЕНИЙ,
НО НЕ ОГРАНИЧИВАЯСЬ ИМИ. НИ В КАКОМ СЛУЧАЕ АВТОРЫ ИЛИ ПРАВООБЛАДАТЕЛИ НЕ НЕСУТ ОТВЕТСТВЕННОСТИ ПО КАКИМ-ЛИБО ИСКАМ,
ЗА УЩЕРБ ИЛИ ПО ИНЫМ ТРЕБОВАНИЯМ, В ТОМ ЧИСЛЕ, ПРИ ДЕЙСТВИИ КОНТРАКТА, ДЕЛИКТЕ ИЛИ ИНОЙ СИТУАЦИИ,
ВОЗНИКШИМ ИЗ-ЗА ИСПОЛЬЗОВАНИЯ ПРОГРАММНОГО ОБЕСПЕЧЕНИЯ ИЛИ ИНЫХ ДЕЙСТВИЙ С ПРОГРАММНЫМ ОБЕСПЕЧЕНИЕМ.
```
```
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:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
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.```

BIN
calc3d Normal file → Executable file

Binary file not shown.

View File

@ -1,371 +0,0 @@
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
QMetaObject, QObject, QPoint, QRect,
QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QAction, QBrush, QColor, QConicalGradient,
QCursor, QFont, QFontDatabase, QGradient,
QIcon, QImage, QKeySequence, QLinearGradient,
QPainter, QPalette, QPixmap, QRadialGradient,
QTransform)
from PySide6.QtWidgets import (QApplication, QComboBox, QFrame, QHBoxLayout,
QLCDNumber, QLabel, QMainWindow, QMenu,
QMenuBar, QPlainTextEdit, QPushButton, QSizePolicy,
QWidget)
class Ui_Calc3DbyRisen(object):
def setupUi(self, Calc3DbyRisen):
if not Calc3DbyRisen.objectName():
Calc3DbyRisen.setObjectName(u"Calc3DbyRisen")
Calc3DbyRisen.resize(373, 471)
font = QFont()
font.setBold(True)
Calc3DbyRisen.setFont(font)
Calc3DbyRisen.setAcceptDrops(False)
icon = QIcon()
icon.addFile(u"img/logo-1.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
Calc3DbyRisen.setWindowIcon(icon)
Calc3DbyRisen.setAutoFillBackground(True)
Calc3DbyRisen.setStyleSheet(u"")
Calc3DbyRisen.setDockOptions(QMainWindow.AllowTabbedDocks|QMainWindow.AnimatedDocks)
self.check_update = QAction(Calc3DbyRisen)
self.check_update.setObjectName(u"check_update")
self.check_update.setCheckable(False)
self.formula = QAction(Calc3DbyRisen)
self.formula.setObjectName(u"formula")
self.about = QAction(Calc3DbyRisen)
self.about.setObjectName(u"about")
self.settings_2 = QAction(Calc3DbyRisen)
self.settings_2.setObjectName(u"settings_2")
self.add_printer = QAction(Calc3DbyRisen)
self.add_printer.setObjectName(u"add_printer")
self.edit_printer = QAction(Calc3DbyRisen)
self.edit_printer.setObjectName(u"edit_printer")
self.del_printer = QAction(Calc3DbyRisen)
self.del_printer.setObjectName(u"del_printer")
self.centralwidget = QWidget(Calc3DbyRisen)
self.centralwidget.setObjectName(u"centralwidget")
self.quantity = QLabel(self.centralwidget)
self.quantity.setObjectName(u"quantity")
self.quantity.setGeometry(QRect(20, 270, 171, 17))
font1 = QFont()
font1.setPointSize(10)
font1.setBold(True)
self.quantity.setFont(font1)
self.quantity.setStyleSheet(u"color: rgb(255, 255, 255);")
self.weight = QLabel(self.centralwidget)
self.weight.setObjectName(u"weight")
self.weight.setGeometry(QRect(20, 240, 101, 17))
self.weight.setFont(font1)
self.weight.setStyleSheet(u"color: rgb(255, 255, 255);")
self.time_print = QLabel(self.centralwidget)
self.time_print.setObjectName(u"time_print")
self.time_print.setGeometry(QRect(20, 210, 101, 17))
self.time_print.setFont(font1)
self.time_print.setStyleSheet(u"color: rgb(255, 255, 255);")
self.printer = QLabel(self.centralwidget)
self.printer.setObjectName(u"printer")
self.printer.setGeometry(QRect(21, 171, 81, 17))
self.printer.setFont(font1)
self.printer.setStyleSheet(u"color: rgb(255, 255, 255);")
self.printer_menu = QComboBox(self.centralwidget)
self.printer_menu.addItem("")
self.printer_menu.addItem("")
self.printer_menu.setObjectName(u"printer_menu")
self.printer_menu.setGeometry(QRect(181, 170, 171, 25))
self.printer_menu.setAcceptDrops(True)
self.printer_menu.setStyleSheet(u"alternate-background-color: rgb(77, 77, 77);")
self.printer_menu.setInsertPolicy(QComboBox.NoInsert)
self.lcd_result = QLCDNumber(self.centralwidget)
self.lcd_result.setObjectName(u"lcd_result")
self.lcd_result.setGeometry(QRect(20, 10, 301, 71))
self.lcd_result.setFont(font1)
self.lcd_result.setAutoFillBackground(False)
self.lcd_result.setStyleSheet(u"background-color: rgb(36, 36, 36);")
self.lcd_result.setFrameShape(QFrame.StyledPanel)
self.lcd_result.setFrameShadow(QFrame.Raised)
self.lcd_result.setDigitCount(10)
self.lcd_result.setSegmentStyle(QLCDNumber.Flat)
self.lcd_result_2 = QLCDNumber(self.centralwidget)
self.lcd_result_2.setObjectName(u"lcd_result_2")
self.lcd_result_2.setGeometry(QRect(180, 90, 141, 41))
self.lcd_result_2.setStyleSheet(u"background-color: rgb(36, 36, 36);")
self.lcd_result_2.setDigitCount(10)
self.lcd_result_2.setSegmentStyle(QLCDNumber.Flat)
self.cost_price = QLabel(self.centralwidget)
self.cost_price.setObjectName(u"cost_price")
self.cost_price.setGeometry(QRect(20, 110, 141, 17))
font2 = QFont()
font2.setPointSize(12)
font2.setBold(True)
self.cost_price.setFont(font2)
self.cost_price.setStyleSheet(u"color: rgb(255, 255, 255);")
self.input_hours = QPlainTextEdit(self.centralwidget)
self.input_hours.setObjectName(u"input_hours")
self.input_hours.setGeometry(QRect(180, 210, 51, 20))
sizePolicy = QSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.input_hours.sizePolicy().hasHeightForWidth())
self.input_hours.setSizePolicy(sizePolicy)
font3 = QFont()
font3.setPointSize(10)
font3.setBold(True)
font3.setStyleStrategy(QFont.PreferAntialias)
self.input_hours.setFont(font3)
self.input_hours.setAcceptDrops(False)
self.input_hours.setToolTipDuration(0)
self.input_hours.setAutoFillBackground(False)
self.input_hours.setStyleSheet(u"background-color: rgb(77, 77, 77);")
self.input_hours.setInputMethodHints(Qt.ImhDigitsOnly)
self.input_hours.setLineWidth(0)
self.input_hours.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.input_hours.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
self.input_hours.setUndoRedoEnabled(False)
self.input_hours.setLineWrapMode(QPlainTextEdit.NoWrap)
self.input_hours.setPlainText(u"")
self.input_hours.setTabStopDistance(80.000000000000000)
self.input_hours.setMaximumBlockCount(3)
self.input_hours.setCenterOnScroll(False)
self.input_hours.setPlaceholderText(u"0")
self.text_time_hours = QLabel(self.centralwidget)
self.text_time_hours.setObjectName(u"text_time_hours")
self.text_time_hours.setGeometry(QRect(240, 210, 21, 17))
self.text_time_hours.setFont(font1)
self.text_time_hours.setStyleSheet(u"color: rgb(255, 255, 255);")
self.input_minutes = QPlainTextEdit(self.centralwidget)
self.input_minutes.setObjectName(u"input_minutes")
self.input_minutes.setGeometry(QRect(260, 210, 51, 21))
self.input_minutes.setAcceptDrops(False)
self.input_minutes.setStyleSheet(u"background-color: rgb(77, 77, 77);")
self.input_minutes.setInputMethodHints(Qt.ImhDigitsOnly)
self.input_minutes.setMaximumBlockCount(3)
self.input_minutes.setCenterOnScroll(True)
self.text_time_minuts = QLabel(self.centralwidget)
self.text_time_minuts.setObjectName(u"text_time_minuts")
self.text_time_minuts.setGeometry(QRect(320, 210, 31, 17))
self.text_time_minuts.setFont(font1)
self.text_time_minuts.setStyleSheet(u"color: rgb(255, 255, 255);")
self.input_gram = QPlainTextEdit(self.centralwidget)
self.input_gram.setObjectName(u"input_gram")
self.input_gram.setGeometry(QRect(230, 240, 81, 20))
sizePolicy.setHeightForWidth(self.input_gram.sizePolicy().hasHeightForWidth())
self.input_gram.setSizePolicy(sizePolicy)
self.input_gram.setFont(font3)
self.input_gram.setAcceptDrops(False)
self.input_gram.setToolTipDuration(0)
self.input_gram.setAutoFillBackground(False)
self.input_gram.setStyleSheet(u"background-color: rgb(77, 77, 77);")
self.input_gram.setInputMethodHints(Qt.ImhFormattedNumbersOnly)
self.input_gram.setLineWidth(0)
self.input_gram.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.input_gram.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
self.input_gram.setPlainText(u"")
self.input_gram.setCenterOnScroll(True)
self.input_things = QPlainTextEdit(self.centralwidget)
self.input_things.setObjectName(u"input_things")
self.input_things.setGeometry(QRect(230, 270, 81, 20))
sizePolicy.setHeightForWidth(self.input_things.sizePolicy().hasHeightForWidth())
self.input_things.setSizePolicy(sizePolicy)
self.input_things.setFont(font3)
self.input_things.setAcceptDrops(False)
self.input_things.setToolTipDuration(0)
self.input_things.setAutoFillBackground(False)
self.input_things.setStyleSheet(u"background-color: rgb(77, 77, 77);")
self.input_things.setInputMethodHints(Qt.ImhDigitsOnly)
self.input_things.setLineWidth(0)
self.input_things.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.input_things.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
self.input_things.setPlainText(u"")
self.input_things.setCenterOnScroll(True)
self.input_mod = QPlainTextEdit(self.centralwidget)
self.input_mod.setObjectName(u"input_mod")
self.input_mod.setGeometry(QRect(230, 330, 81, 20))
sizePolicy.setHeightForWidth(self.input_mod.sizePolicy().hasHeightForWidth())
self.input_mod.setSizePolicy(sizePolicy)
self.input_mod.setFont(font3)
self.input_mod.setAcceptDrops(False)
self.input_mod.setToolTipDuration(0)
self.input_mod.setAutoFillBackground(False)
self.input_mod.setStyleSheet(u"background-color: rgb(77, 77, 77);")
self.input_mod.setInputMethodHints(Qt.ImhDigitsOnly)
self.input_mod.setLineWidth(0)
self.input_mod.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.input_mod.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
self.input_mod.setPlainText(u"")
self.input_mod.setCenterOnScroll(True)
self.input_post = QPlainTextEdit(self.centralwidget)
self.input_post.setObjectName(u"input_post")
self.input_post.setGeometry(QRect(230, 360, 81, 20))
sizePolicy.setHeightForWidth(self.input_post.sizePolicy().hasHeightForWidth())
self.input_post.setSizePolicy(sizePolicy)
self.input_post.setFont(font3)
self.input_post.setAcceptDrops(False)
self.input_post.setToolTipDuration(0)
self.input_post.setAutoFillBackground(False)
self.input_post.setStyleSheet(u"background-color: rgb(77, 77, 77);")
self.input_post.setInputMethodHints(Qt.ImhDigitsOnly)
self.input_post.setLineWidth(0)
self.input_post.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.input_post.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
self.input_post.setPlainText(u"")
self.input_post.setCenterOnScroll(True)
self.text_gram = QLabel(self.centralwidget)
self.text_gram.setObjectName(u"text_gram")
self.text_gram.setGeometry(QRect(320, 240, 31, 17))
self.text_gram.setFont(font1)
self.text_gram.setStyleSheet(u"color: rgb(255, 255, 255);")
self.text_things = QLabel(self.centralwidget)
self.text_things.setObjectName(u"text_things")
self.text_things.setGeometry(QRect(320, 270, 31, 17))
self.text_things.setFont(font1)
self.text_things.setStyleSheet(u"color: rgb(255, 255, 255);")
self.text_rub_mod = QLabel(self.centralwidget)
self.text_rub_mod.setObjectName(u"text_rub_mod")
self.text_rub_mod.setGeometry(QRect(320, 330, 31, 17))
self.text_rub_mod.setFont(font1)
self.text_rub_mod.setStyleSheet(u"color: rgb(255, 255, 255);")
self.text_rub_post = QLabel(self.centralwidget)
self.text_rub_post.setObjectName(u"text_rub_post")
self.text_rub_post.setGeometry(QRect(320, 360, 31, 17))
self.text_rub_post.setFont(font1)
self.text_rub_post.setStyleSheet(u"color: rgb(255, 255, 255);")
self.ico_rub = QLabel(self.centralwidget)
self.ico_rub.setObjectName(u"ico_rub")
self.ico_rub.setGeometry(QRect(330, 50, 31, 31))
self.ico_rub.setPixmap(QPixmap(u"img/rubl.png"))
self.ico_rub.setScaledContents(True)
self.frame = QFrame(self.centralwidget)
self.frame.setObjectName(u"frame")
self.frame.setGeometry(QRect(20, 130, 331, 31))
self.frame.setFrameShape(QFrame.HLine)
self.frame.setFrameShadow(QFrame.Raised)
self.frame.setLineWidth(2)
self.frame_2 = QFrame(self.centralwidget)
self.frame_2.setObjectName(u"frame_2")
self.frame_2.setGeometry(QRect(20, 300, 331, 31))
self.frame_2.setFrameShape(QFrame.HLine)
self.frame_2.setFrameShadow(QFrame.Raised)
self.frame_2.setLineWidth(2)
self.layoutWidget = QWidget(self.centralwidget)
self.layoutWidget.setObjectName(u"layoutWidget")
self.layoutWidget.setGeometry(QRect(20, 400, 331, 41))
self.buttons = QHBoxLayout(self.layoutWidget)
self.buttons.setObjectName(u"buttons")
self.buttons.setContentsMargins(0, 0, 0, 0)
self.get_result_btn = QPushButton(self.layoutWidget)
self.get_result_btn.setObjectName(u"get_result_btn")
font4 = QFont()
font4.setPointSize(10)
font4.setBold(True)
font4.setItalic(False)
font4.setKerning(True)
font4.setStyleStrategy(QFont.PreferAntialias)
self.get_result_btn.setFont(font4)
self.get_result_btn.setAcceptDrops(True)
self.get_result_btn.setStyleSheet(u"background-color: rgb(0, 80, 0);")
icon1 = QIcon()
icon1.addFile(u"img/calc.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
self.get_result_btn.setIcon(icon1)
self.get_result_btn.setIconSize(QSize(20, 20))
self.buttons.addWidget(self.get_result_btn)
self.exit_btn = QPushButton(self.layoutWidget)
self.exit_btn.setObjectName(u"exit_btn")
self.exit_btn.setFont(font1)
self.exit_btn.setStyleSheet(u"background-color: rgb(0, 80, 0);")
icon2 = QIcon()
icon2.addFile(u"img/exit.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
self.exit_btn.setIcon(icon2)
self.exit_btn.setIconSize(QSize(20, 20))
self.buttons.addWidget(self.exit_btn)
self.modeling = QLabel(self.centralwidget)
self.modeling.setObjectName(u"modeling")
self.modeling.setGeometry(QRect(20, 330, 141, 17))
self.modeling.setFont(font1)
self.modeling.setStyleSheet(u"color: rgb(255, 255, 255);")
self.post_print = QLabel(self.centralwidget)
self.post_print.setObjectName(u"post_print")
self.post_print.setEnabled(False)
self.post_print.setGeometry(QRect(20, 360, 121, 17))
self.post_print.setFont(font1)
self.post_print.setStyleSheet(u"color: rgb(255, 255, 255);")
Calc3DbyRisen.setCentralWidget(self.centralwidget)
self.menubar = QMenuBar(Calc3DbyRisen)
self.menubar.setObjectName(u"menubar")
self.menubar.setGeometry(QRect(0, 0, 373, 22))
self.settings = QMenu(self.menubar)
self.settings.setObjectName(u"settings")
self.pressets = QMenu(self.settings)
self.pressets.setObjectName(u"pressets")
self.help = QMenu(self.menubar)
self.help.setObjectName(u"help")
self.help.setContextMenuPolicy(Qt.DefaultContextMenu)
self.help.setAutoFillBackground(False)
self.help.setTearOffEnabled(False)
self.help.setSeparatorsCollapsible(False)
Calc3DbyRisen.setMenuBar(self.menubar)
self.menubar.addAction(self.settings.menuAction())
self.menubar.addAction(self.help.menuAction())
self.settings.addAction(self.settings_2)
self.settings.addAction(self.pressets.menuAction())
self.pressets.addAction(self.add_printer)
self.pressets.addAction(self.edit_printer)
self.pressets.addAction(self.del_printer)
self.help.addAction(self.check_update)
self.help.addAction(self.formula)
self.help.addAction(self.about)
self.retranslateUi(Calc3DbyRisen)
self.printer_menu.setCurrentIndex(-1)
QMetaObject.connectSlotsByName(Calc3DbyRisen)
# setupUi
def retranslateUi(self, Calc3DbyRisen):
Calc3DbyRisen.setWindowTitle(QCoreApplication.translate("Calc3DbyRisen", u"Calc3D by Risen v.1.0.0", None))
self.check_update.setText(QCoreApplication.translate("Calc3DbyRisen", u"\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f", None))
self.formula.setText(QCoreApplication.translate("Calc3DbyRisen", u"\u041a\u0430\u043a \u0440\u0430\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c", None))
self.about.setText(QCoreApplication.translate("Calc3DbyRisen", u"\u041e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u0435", None))
self.settings_2.setText(QCoreApplication.translate("Calc3DbyRisen", u"\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438", None))
self.add_printer.setText(QCoreApplication.translate("Calc3DbyRisen", u"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u0438\u043d\u0442\u0435\u0440", None))
self.edit_printer.setText(QCoreApplication.translate("Calc3DbyRisen", u"\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043d\u0442\u0435\u0440", None))
self.del_printer.setText(QCoreApplication.translate("Calc3DbyRisen", u"\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u0440\u0438\u043d\u0442\u0435\u0440", None))
self.quantity.setText(QCoreApplication.translate("Calc3DbyRisen", u"\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432", None))
self.weight.setText(QCoreApplication.translate("Calc3DbyRisen", u"\u041c\u0430\u0441\u0441\u0430 \u0434\u0435\u0442\u0430\u043b\u0438", None))
self.time_print.setText(QCoreApplication.translate("Calc3DbyRisen", u"\u0412\u0440\u0435\u043c\u044f \u043f\u0435\u0447\u0430\u0442\u0438", None))
self.printer.setText(QCoreApplication.translate("Calc3DbyRisen", u"\u041f\u0440\u0438\u043d\u0442\u0435\u0440", None))
self.printer_menu.setItemText(0, QCoreApplication.translate("Calc3DbyRisen", u"Ender3/Ender3pro", None))
self.printer_menu.setItemText(1, QCoreApplication.translate("Calc3DbyRisen", u"FlyBeer", None))
self.printer_menu.setCurrentText("")
self.printer_menu.setPlaceholderText(QCoreApplication.translate("Calc3DbyRisen", u"\u0412\u044b\u0431\u043e \u043f\u0440\u0438\u043d\u0442\u0435\u0440\u0430", None))
self.cost_price.setText(QCoreApplication.translate("Calc3DbyRisen", u"\u0421\u0435\u0431\u0435\u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c", None))
#if QT_CONFIG(whatsthis)
self.input_hours.setWhatsThis("")
#endif // QT_CONFIG(whatsthis)
self.text_time_hours.setText(QCoreApplication.translate("Calc3DbyRisen", u"\u0447.", None))
self.input_minutes.setPlaceholderText(QCoreApplication.translate("Calc3DbyRisen", u"0", None))
self.text_time_minuts.setText(QCoreApplication.translate("Calc3DbyRisen", u"\u043c\u0438\u043d.", None))
self.input_gram.setPlaceholderText(QCoreApplication.translate("Calc3DbyRisen", u"0", None))
self.input_things.setPlaceholderText(QCoreApplication.translate("Calc3DbyRisen", u"0", None))
self.input_mod.setPlaceholderText(QCoreApplication.translate("Calc3DbyRisen", u"0", None))
self.input_post.setPlaceholderText(QCoreApplication.translate("Calc3DbyRisen", u"0", None))
self.text_gram.setText(QCoreApplication.translate("Calc3DbyRisen", u"\u0433.", None))
self.text_things.setText(QCoreApplication.translate("Calc3DbyRisen", u"\u0448\u0442.", None))
self.text_rub_mod.setText(QCoreApplication.translate("Calc3DbyRisen", u"\u0440\u0443\u0431.", None))
self.text_rub_post.setText(QCoreApplication.translate("Calc3DbyRisen", u"\u0440\u0443\u0431.", None))
self.ico_rub.setText("")
self.get_result_btn.setText(QCoreApplication.translate("Calc3DbyRisen", u"\u0420\u0430\u0441\u0447\u0438\u0442\u0430\u0442\u044c", None))
self.exit_btn.setText(QCoreApplication.translate("Calc3DbyRisen", u"\u0412\u044b\u0445\u043e\u0434", None))
self.modeling.setText(QCoreApplication.translate("Calc3DbyRisen", u"\u041c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435", None))
self.post_print.setText(QCoreApplication.translate("Calc3DbyRisen", u"\u041f\u043e\u0441\u0442\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430", None))
self.settings.setTitle(QCoreApplication.translate("Calc3DbyRisen", u"\u0424\u0430\u0439\u043b", None))
self.pressets.setTitle(QCoreApplication.translate("Calc3DbyRisen", u"\u041f\u0440\u0435\u0441\u0435\u0442\u044b \u043f\u0440\u0438\u043d\u0442\u0435\u0440\u0430", None))
self.help.setTitle(QCoreApplication.translate("Calc3DbyRisen", u"\u041f\u043e\u043c\u043e\u0449\u044c", None))
# retranslateUi

50
calculating.c Normal file
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, int year) {
// количество минут в году
double minutes_in_year = 525600;
// Если СПИ установлен на 0, то присваеваем 1 (год)
double year_norm;
if (spi == 0) {
year_norm = 100 / 1;
} else {
year_norm = 100 / spi;
}
//Считаем годовую амортизацию
double year_am = a * year_norm / 100;
//Считаем амортизацию за минуту и умножаем на время печати
double am_per_minute = year_am / minutes_in_year * (t*60);
return am_per_minute; // округление до 2 знаков после запятой
}

12
calculating.h Normal file
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, int year);
#endif // CALCULATING_H

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,46 +0,0 @@
from PySide6 import QtWidgets, QtSql
class Data:
def __init__(self):
super(Data, self).__init__()
def create_connection(self):
db = QtSql.QSqlDatabase.addDatabase('QSQLITE')
db.setDatabaseName('calc3d')
if not db.open():
QtWidgets.QMessageBox.critical(None, 'Error', 'Не найдена база данных калькулятора',
'Cancel',
QtWidgets.QMessageBox.Cancel)
return False
query = QtSql.QSqlQuery()
query.exec("CREATE TABLE IF NOT EXISTS printers (ID integer primary key autoincrement,"
"Printer_name VARCHAR(30) unique, Price_printer integer, Printer_power integer, kilowatt_price)")
return True
def execute_query_with_params(self, sql_query, query_values=None):
query = QtSql.QSqlQuery()
query.prepare(sql_query)
if query_values is not None:
for value in query_values:
query.addBindValue(query_values)
query.exec()
def add_settings(self, kilowatt_price, ):
pass
def add_printer(self, printer_name, printer_power, price_printer):
sql_query = "INSERT INTO printers (Printer_name, Printer_power, Price_printer) VALUES (?, ?, ?)"
self.execute_query_with_params(sql_query, [printer_name, printer_power, price_printer])
def edit_printer(self, id, printer_name, printer_power, price_printer):
sql_query = "UPDATE printers SET Printer_name=?, Printer_power=?, Price_printer=? WHERE ID=?"
self.execute_query_with_params(sql_query, [id, printer_name, printer_power, price_printer])
def delete_printer(self, id):
sql_query = "DELETE FROM printers WHERE ID=?"
self.execute_query_with_params(sql_query, [id])

View File

@ -1,63 +0,0 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'Del_preset.ui'
##
## Created by: Qt User Interface Compiler version 6.8.1
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
QMetaObject, QObject, QPoint, QRect,
QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QFont, QFontDatabase, QGradient, QIcon,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QApplication, QDialog, QHBoxLayout, QHeaderView,
QPushButton, QSizePolicy, QTableWidget, QTableWidgetItem,
QWidget)
class Ui_Dialog(object):
def setupUi(self, Dialog):
if not Dialog.objectName():
Dialog.setObjectName(u"Dialog")
Dialog.resize(369, 347)
icon = QIcon()
icon.addFile(u"img/logo-1.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
Dialog.setWindowIcon(icon)
self.tableWidget = QTableWidget(Dialog)
self.tableWidget.setObjectName(u"tableWidget")
self.tableWidget.setGeometry(QRect(20, 20, 321, 271))
self.tableWidget.setStyleSheet(u"background-color: rgb(36, 36, 36);")
self.widget = QWidget(Dialog)
self.widget.setObjectName(u"widget")
self.widget.setGeometry(QRect(12, 310, 331, 27))
self.horizontalLayout = QHBoxLayout(self.widget)
self.horizontalLayout.setObjectName(u"horizontalLayout")
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
self.pushButton = QPushButton(self.widget)
self.pushButton.setObjectName(u"pushButton")
self.pushButton.setStyleSheet(u"background-color: rgb(0, 80, 0);")
self.horizontalLayout.addWidget(self.pushButton)
self.pushButton_2 = QPushButton(self.widget)
self.pushButton_2.setObjectName(u"pushButton_2")
self.pushButton_2.setStyleSheet(u"background-color: rgb(0, 80, 0);")
self.horizontalLayout.addWidget(self.pushButton_2)
self.retranslateUi(Dialog)
QMetaObject.connectSlotsByName(Dialog)
# setupUi
def retranslateUi(self, Dialog):
Dialog.setWindowTitle(QCoreApplication.translate("Dialog", u"\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u0440\u0435\u0441\u0435\u0442", None))
self.pushButton.setText(QCoreApplication.translate("Dialog", u"\u0423\u0434\u0430\u043b\u0438\u0442\u044c", None))
self.pushButton_2.setText(QCoreApplication.translate("Dialog", u"\u0417\u0430\u043a\u0440\u044b\u0442\u044c", None))
# retranslateUi

View File

@ -1,58 +0,0 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'Edit_presset.ui'
##
## Created by: Qt User Interface Compiler version 6.8.1
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
QMetaObject, QObject, QPoint, QRect,
QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QFont, QFontDatabase, QGradient, QIcon,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QApplication, QDialog, QHBoxLayout, QPushButton,
QSizePolicy, QWidget)
class Ui_Dialog(object):
def setupUi(self, Dialog):
if not Dialog.objectName():
Dialog.setObjectName(u"Dialog")
Dialog.resize(369, 169)
icon = QIcon()
icon.addFile(u"img/logo-1.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
Dialog.setWindowIcon(icon)
self.widget = QWidget(Dialog)
self.widget.setObjectName(u"widget")
self.widget.setGeometry(QRect(22, 130, 321, 27))
self.horizontalLayout = QHBoxLayout(self.widget)
self.horizontalLayout.setObjectName(u"horizontalLayout")
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
self.pushButton = QPushButton(self.widget)
self.pushButton.setObjectName(u"pushButton")
self.pushButton.setStyleSheet(u"background-color: rgb(0, 80, 0);")
self.horizontalLayout.addWidget(self.pushButton)
self.pushButton_2 = QPushButton(self.widget)
self.pushButton_2.setObjectName(u"pushButton_2")
self.pushButton_2.setStyleSheet(u"background-color: rgb(0, 80, 0);")
self.horizontalLayout.addWidget(self.pushButton_2)
self.retranslateUi(Dialog)
QMetaObject.connectSlotsByName(Dialog)
# setupUi
def retranslateUi(self, Dialog):
Dialog.setWindowTitle(QCoreApplication.translate("Dialog", u"\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0440\u0435\u0441\u0435\u0442", None))
self.pushButton.setText(QCoreApplication.translate("Dialog", u"\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c", None))
self.pushButton_2.setText(QCoreApplication.translate("Dialog", u"\u0417\u0430\u043a\u0440\u044b\u0442\u044c", None))
# retranslateUi

View File

@ -1,93 +0,0 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'formula.ui'
##
## Created by: Qt User Interface Compiler version 6.8.1
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
QMetaObject, QObject, QPoint, QRect,
QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QFont, QFontDatabase, QGradient, QIcon,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QApplication, QDialog, QLabel, QPushButton,
QSizePolicy, QWidget)
class Ui_Dialog(object):
def setupUi(self, Dialog):
if not Dialog.objectName():
Dialog.setObjectName(u"Dialog")
Dialog.resize(367, 377)
icon = QIcon()
icon.addFile(u"img/logo-1.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
Dialog.setWindowIcon(icon)
self.label = QLabel(Dialog)
self.label.setObjectName(u"label")
self.label.setGeometry(QRect(100, 10, 171, 41))
font = QFont()
font.setPointSize(9)
self.label.setFont(font)
self.label.setTextFormat(Qt.MarkdownText)
self.label.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignTop)
self.label_2 = QLabel(Dialog)
self.label_2.setObjectName(u"label_2")
self.label_2.setGeometry(QRect(30, 50, 341, 21))
font1 = QFont()
font1.setFamilies([u"Sans Serif"])
font1.setPointSize(10)
font1.setBold(True)
font1.setKerning(False)
self.label_2.setFont(font1)
self.label_2.setAutoFillBackground(False)
self.label_2.setTextFormat(Qt.MarkdownText)
self.label_2.setScaledContents(True)
self.label_2.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignTop)
self.label_2.setWordWrap(False)
self.label_3 = QLabel(Dialog)
self.label_3.setObjectName(u"label_3")
self.label_3.setGeometry(QRect(10, 80, 341, 281))
font2 = QFont()
font2.setPointSize(10)
self.label_3.setFont(font2)
self.label_3.setTextFormat(Qt.MarkdownText)
self.label_3.setScaledContents(False)
self.label_3.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignTop)
self.label_3.setWordWrap(True)
self.pushButton = QPushButton(Dialog)
self.pushButton.setObjectName(u"pushButton")
self.pushButton.setGeometry(QRect(100, 340, 161, 25))
self.pushButton.setStyleSheet(u"background-color: rgb(0, 80, 0);")
self.retranslateUi(Dialog)
QMetaObject.connectSlotsByName(Dialog)
# setupUi
def retranslateUi(self, Dialog):
Dialog.setWindowTitle(QCoreApplication.translate("Dialog", u"\u0424\u043e\u0440\u043c\u0443\u043b\u0430 \u0440\u0430\u0441\u0447\u0435\u0442\u0430", None))
self.label.setText(QCoreApplication.translate("Dialog", u"## \u0424\u043e\u0440\u043c\u0443\u043b\u0430 \u0440\u0430\u0441\u0447\u0435\u0442\u0430", None))
self.label_2.setText(QCoreApplication.translate("Dialog", u"S = ((p/1000*t/60*h)+(md*d*st/mk)+(a+post))*x+mod", None))
self.label_3.setText(QCoreApplication.translate("Dialog", u"\u0433\u0434\u0435\n"
"```\n"
"S - \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u0435\u0447\u0430\u0442\u0438, \u0440\u0443\u0431.\n"
"p - \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438\u043d\u0442\u0435\u0440\u0430, \u0412\u0442\n"
"t - \u0432\u0440\u0435\u043c\u044f \u043f\u0435\u0447\u0430\u0442\u0438, \u043c\u0438\u043d.\n"
"h - \u0442\u0430\u0440\u0438\u0444 \u043d\u0430 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u044d\u043d\u0435\u0440\u0433\u0438\u044e, \u043a\u0412\u0442/\u0447\n"
"md - \u0432\u0435\u0441 \u0434\u0435\u0442\u0430\u043b\u0438, \u0433\u0440.\n"
"d - \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044c \u043e\u0442\u0431\u0440\u0430\u043a\u043e\u0432\u043a\u0438.\n"
"st - \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u043a\u0430\u0442\u0443\u0448\u043a\u0438 \u043f\u043b\u0430\u0441\u0442\u0438\u043a\u0430, \u0440\u0443\u0431.\n"
"mk - \u0432\u0435\u0441 \u043f\u043b\u0430\u0441\u0442\u0438\u043a\u0430 \u0432 \u043a\u0430\u0442\u0443\u0448"
"\u043a\u0435, \u0433\u0440.\n"
"a - \u0430\u043c\u043e\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0442\u0435\u0440\u0430, \u0440\u0443\u0431.\n"
"post - \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u043e\u0441\u0442\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u0440\u0443\u0431.\n"
"\u0445 - \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0435\u0447\u0430\u0442\u0430\u0435\u043c\u044b\u0445 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u0432, \u0448\u0442.\n"
"mod - \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0440\u0443\u0431\n"
"```", None))
self.pushButton.setText(QCoreApplication.translate("Dialog", u"\u0417\u0430\u043a\u0440\u044b\u0442\u044c", None))
# retranslateUi

75
main.c Normal file
View File

@ -0,0 +1,75 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.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);
// Получение текущего года
time_t now = time(NULL);
struct tm *local = localtime(&now);
int year = local->tm_year + 1900;
// Расчет амортизации
double am = amortization(a, t, spi, year);
// Расчет себестоимости
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;
}

View File

@ -1,43 +0,0 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'Settings.ui'
##
## Created by: Qt User Interface Compiler version 6.8.1
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
QMetaObject, QObject, QPoint, QRect,
QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QFont, QFontDatabase, QGradient, QIcon,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QApplication, QDialog, QPushButton, QSizePolicy,
QWidget)
class Ui_Dialog(object):
def setupUi(self, Dialog):
if not Dialog.objectName():
Dialog.setObjectName(u"Dialog")
Dialog.resize(369, 375)
icon = QIcon()
icon.addFile(u"img/logo-1.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
Dialog.setWindowIcon(icon)
self.pushButton = QPushButton(Dialog)
self.pushButton.setObjectName(u"pushButton")
self.pushButton.setGeometry(QRect(100, 340, 161, 25))
self.pushButton.setStyleSheet(u"background-color: rgb(0, 80, 0);")
self.retranslateUi(Dialog)
QMetaObject.connectSlotsByName(Dialog)
# setupUi
def retranslateUi(self, Dialog):
Dialog.setWindowTitle(QCoreApplication.translate("Dialog", u"\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438", None))
self.pushButton.setText(QCoreApplication.translate("Dialog", u"\u0417\u0430\u043a\u0440\u044b\u0442\u044c", None))
# retranslateUi

View File

@ -1,15 +0,0 @@
{
"settings": {
"theme": "Dark",
"p": "270",
"h": "3",
"d": "0",
"st": "1500",
"mk": "1000",
"a": "0",
"spi": "0",
"marge": "0",
"locale": "Ru",
"currency": "\u0440\u0443\u0431."
}
}

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,21 +0,0 @@
import requests
import webbrowser
import json
import gettext
from texts import ver
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

View File

@ -1,83 +0,0 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'Updates.ui'
##
## Created by: Qt User Interface Compiler version 6.8.1
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
QMetaObject, QObject, QPoint, QRect,
QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QFont, QFontDatabase, QGradient, QIcon,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QApplication, QDialog, QHBoxLayout, QLabel,
QPushButton, QSizePolicy, QWidget)
class Ui_Dialog(object):
def setupUi(self, Dialog):
if not Dialog.objectName():
Dialog.setObjectName(u"Dialog")
Dialog.resize(368, 99)
icon = QIcon()
icon.addFile(u"img/logo-1.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
Dialog.setWindowIcon(icon)
self.label = QLabel(Dialog)
self.label.setObjectName(u"label")
self.label.setGeometry(QRect(73, 0, 191, 31))
font = QFont()
font.setPointSize(10)
self.label.setFont(font)
self.label_2 = QLabel(Dialog)
self.label_2.setObjectName(u"label_2")
self.label_2.setGeometry(QRect(70, 20, 191, 31))
self.label_2.setFont(font)
self.label_3 = QLabel(Dialog)
self.label_3.setObjectName(u"label_3")
self.label_3.setGeometry(QRect(250, 10, 54, 17))
font1 = QFont()
font1.setPointSize(10)
font1.setBold(True)
self.label_3.setFont(font1)
self.label_4 = QLabel(Dialog)
self.label_4.setObjectName(u"label_4")
self.label_4.setGeometry(QRect(250, 30, 54, 17))
self.label_4.setFont(font1)
self.layoutWidget = QWidget(Dialog)
self.layoutWidget.setObjectName(u"layoutWidget")
self.layoutWidget.setGeometry(QRect(20, 60, 331, 27))
self.horizontalLayout = QHBoxLayout(self.layoutWidget)
self.horizontalLayout.setObjectName(u"horizontalLayout")
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
self.pushButton = QPushButton(self.layoutWidget)
self.pushButton.setObjectName(u"pushButton")
self.pushButton.setStyleSheet(u"background-color: rgb(0, 80, 0);")
self.horizontalLayout.addWidget(self.pushButton)
self.pushButton_2 = QPushButton(self.layoutWidget)
self.pushButton_2.setObjectName(u"pushButton_2")
self.pushButton_2.setStyleSheet(u"background-color: rgb(0, 80, 0);")
self.horizontalLayout.addWidget(self.pushButton_2)
self.retranslateUi(Dialog)
QMetaObject.connectSlotsByName(Dialog)
# setupUi
def retranslateUi(self, Dialog):
Dialog.setWindowTitle(QCoreApplication.translate("Dialog", u"Updates", None))
self.label.setText(QCoreApplication.translate("Dialog", u"\u0412\u0430\u0448\u0430 \u0432\u0435\u0440\u0441\u0438\u044f:", None))
self.label_2.setText(QCoreApplication.translate("Dialog", u"\u0412\u0435\u0440\u0441\u0438\u044f \u043d\u0430 \u0441\u0430\u0439\u0442\u0435:", None))
self.label_3.setText(QCoreApplication.translate("Dialog", u"1.0.0", None))
self.label_4.setText(QCoreApplication.translate("Dialog", u"1.0.0", None))
self.pushButton.setText(QCoreApplication.translate("Dialog", u"\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442", None))
self.pushButton_2.setText(QCoreApplication.translate("Dialog", u"\u0417\u0430\u043a\u0440\u044b\u0442\u044c", None))
# retranslateUi