diff --git a/.gitignore b/.gitignore index 5529b62..5075585 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ Calc3D.spec /releases __pycache__ -/.vscode \ No newline at end of file +/.vscode +src/build/* \ No newline at end of file diff --git a/Calc3D.py b/Calc3D.py deleted file mode 100644 index 64cc273..0000000 --- a/Calc3D.py +++ /dev/null @@ -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()) diff --git a/calc3d b/calc3d deleted file mode 100755 index 86b06f7..0000000 Binary files a/calc3d and /dev/null differ diff --git a/calc3dui.py b/calc3dui.py deleted file mode 100644 index 4f5f21c..0000000 --- a/calc3dui.py +++ /dev/null @@ -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 - diff --git a/calculating.py b/calculating.py deleted file mode 100644 index 5f968ee..0000000 --- a/calculating.py +++ /dev/null @@ -1,53 +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) diff --git a/connection.py b/connection.py deleted file mode 100644 index 6c9297f..0000000 --- a/connection.py +++ /dev/null @@ -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]) diff --git a/del-preset.py b/del-preset.py deleted file mode 100644 index 726acc1..0000000 --- a/del-preset.py +++ /dev/null @@ -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 - diff --git a/edit-preset.py b/edit-preset.py deleted file mode 100644 index 6c3c907..0000000 --- a/edit-preset.py +++ /dev/null @@ -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 - diff --git a/formula.py b/formula.py deleted file mode 100644 index 7ef5716..0000000 --- a/formula.py +++ /dev/null @@ -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 - diff --git a/settings.py b/settings.py deleted file mode 100644 index adadaa0..0000000 --- a/settings.py +++ /dev/null @@ -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 - diff --git a/src/.clang-format b/src/.clang-format new file mode 100644 index 0000000..9f3e95c --- /dev/null +++ b/src/.clang-format @@ -0,0 +1,2 @@ +--- +BasedOnStyle: Google diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..96be5db --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,64 @@ +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) + +set(MAIN_SOURCES + main.cpp + + view/main_window.cpp + view/main_window.h + + 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/settings.ui + view/ui/updates.ui + view/ui/add_printer.ui +) + + +if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) + qt_add_executable(Calc3D + MANUAL_FINALIZATION + ${MAIN_SOURCES} +) +else() + add_executable(Calc3D + ${MAIN_SOURCES} +) +endif() + +target_link_libraries(Calc3D PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Core) + +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() \ No newline at end of file diff --git a/C_library/calculating.c b/src/C_library/calculating.c similarity index 100% rename from C_library/calculating.c rename to src/C_library/calculating.c diff --git a/C_library/calculating.h b/src/C_library/calculating.h similarity index 100% rename from C_library/calculating.h rename to src/C_library/calculating.h diff --git a/C_library/main.c b/src/C_library/main.c similarity index 100% rename from C_library/main.c rename to src/C_library/main.c diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..d45834e --- /dev/null +++ b/src/Makefile @@ -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) \ No newline at end of file diff --git a/src/controller/controller.h b/src/controller/controller.h new file mode 100644 index 0000000..fb1739c --- /dev/null +++ b/src/controller/controller.h @@ -0,0 +1,23 @@ +#pragma once + +#include + +#include "../model/facade.h" + +class Controller { + public: + Controller(const Controller &other) = delete; + Controller(Controller &&other) = delete; + void operator=(const Controller &other) = delete; + ~Controller() = default; + + static std::shared_ptr GetInstance() { + static auto instance = std::shared_ptr(new Controller); + return instance; + } + + private: + std::shared_ptr facade; + + Controller() { facade_ = s21::Facade::GetInstance(); } +}; \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..64caa53 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,11 @@ +#include + +#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(); +} diff --git a/src/model/facade.h b/src/model/facade.h new file mode 100644 index 0000000..0354713 --- /dev/null +++ b/src/model/facade.h @@ -0,0 +1,19 @@ +#pragma once + +#include + +class Facade { + public: + Facade(const Facade &other) = delete; + Facade(Facade &&other) = delete; + void operator=(const Facade &other) = delete; + ~Facade() = default; + + static std::shared_ptr GetInstance() { + static auto instance = std::shared_ptr(new Facade); + return instance; + } + + private: + Facade() {} +}; \ No newline at end of file diff --git a/img/calc.png b/src/view/img/calc.png similarity index 100% rename from img/calc.png rename to src/view/img/calc.png diff --git a/img/calc.svg b/src/view/img/calc.svg similarity index 100% rename from img/calc.svg rename to src/view/img/calc.svg diff --git a/img/exit.png b/src/view/img/exit.png similarity index 100% rename from img/exit.png rename to src/view/img/exit.png diff --git a/img/exit.svg b/src/view/img/exit.svg similarity index 100% rename from img/exit.svg rename to src/view/img/exit.svg diff --git a/img/logo-1.png b/src/view/img/logo-1.png similarity index 100% rename from img/logo-1.png rename to src/view/img/logo-1.png diff --git a/img/logo-2.png b/src/view/img/logo-2.png similarity index 100% rename from img/logo-2.png rename to src/view/img/logo-2.png diff --git a/img/logo-3.png b/src/view/img/logo-3.png similarity index 100% rename from img/logo-3.png rename to src/view/img/logo-3.png diff --git a/img/logo-4.png b/src/view/img/logo-4.png similarity index 100% rename from img/logo-4.png rename to src/view/img/logo-4.png diff --git a/img/logo-5.png b/src/view/img/logo-5.png similarity index 100% rename from img/logo-5.png rename to src/view/img/logo-5.png diff --git a/img/logo-6.png b/src/view/img/logo-6.png similarity index 100% rename from img/logo-6.png rename to src/view/img/logo-6.png diff --git a/img/logo-7.png b/src/view/img/logo-7.png similarity index 100% rename from img/logo-7.png rename to src/view/img/logo-7.png diff --git a/img/logo-8.png b/src/view/img/logo-8.png similarity index 100% rename from img/logo-8.png rename to src/view/img/logo-8.png diff --git a/img/modeling.png b/src/view/img/modeling.png similarity index 100% rename from img/modeling.png rename to src/view/img/modeling.png diff --git a/img/quantity.png b/src/view/img/quantity.png similarity index 100% rename from img/quantity.png rename to src/view/img/quantity.png diff --git a/img/rubl.png b/src/view/img/rubl.png similarity index 100% rename from img/rubl.png rename to src/view/img/rubl.png diff --git a/img/time.png b/src/view/img/time.png similarity index 100% rename from img/time.png rename to src/view/img/time.png diff --git a/img/weight.png b/src/view/img/weight.png similarity index 100% rename from img/weight.png rename to src/view/img/weight.png diff --git a/src/view/main_window.cpp b/src/view/main_window.cpp new file mode 100644 index 0000000..e21cfdf --- /dev/null +++ b/src/view/main_window.cpp @@ -0,0 +1,40 @@ +#include "main_window.h" + +#include "ui/ui_about.h" +#include "ui/ui_add_printer.h" +#include "ui/ui_del_preset.h" +#include "ui/ui_edit_preset.h" +#include "ui/ui_formula.h" +#include "ui/ui_main_window.h" +#include "ui/ui_settings.h" +#include "ui/ui_settings_preset.h" +#include "ui/ui_updates.h" + +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent) + , ui(new Ui::MainWindow) +{ + setWindowTitle("Calc3D"); + setFixedSize(373, 471); + // menu_window = new MenuWindow(this); + // game_window = new GameWindow(this); + // controller = new s21::GameController(); + + // lay_out = new QStackedLayout(this); + // setLayout(lay_out); + // lay_out->addWidget(menu_window); + // lay_out->addWidget(game_window); + + // menu_window->setFocus(); + + // connect(menu_window, &MenuWindow::signalGame, this, + // &DesktopView::slotShowGame); connect(menu_window, &MenuWindow::signalExit, + // this, &DesktopView::slotExit); connect(game_window, + // &GameWindow::signalExit, this, &DesktopView::slotShowMenu); + ui->setupUi(this); +} + +MainWindow::~MainWindow() +{ + delete ui; +} diff --git a/src/view/main_window.h b/src/view/main_window.h new file mode 100644 index 0000000..f7a3da3 --- /dev/null +++ b/src/view/main_window.h @@ -0,0 +1,23 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +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; +}; +#endif // MAINWINDOW_H diff --git a/UI/about.ui b/src/view/ui/about.ui similarity index 100% rename from UI/about.ui rename to src/view/ui/about.ui diff --git a/UI/Add_printer.ui b/src/view/ui/add_printer.ui similarity index 99% rename from UI/Add_printer.ui rename to src/view/ui/add_printer.ui index c532af1..494fa66 100644 --- a/UI/Add_printer.ui +++ b/src/view/ui/add_printer.ui @@ -1,7 +1,7 @@ - Dialog - + AddPrinter + 0 diff --git a/UI/Del_preset.ui b/src/view/ui/del_preset.ui similarity index 96% rename from UI/Del_preset.ui rename to src/view/ui/del_preset.ui index df77984..ef02ff1 100644 --- a/UI/Del_preset.ui +++ b/src/view/ui/del_preset.ui @@ -1,7 +1,7 @@ - Dialog - + DelPreset + 0 diff --git a/UI/Edit_presset.ui b/src/view/ui/edit_preset.ui similarity index 94% rename from UI/Edit_presset.ui rename to src/view/ui/edit_preset.ui index cb71bcb..8f37cd2 100644 --- a/UI/Edit_presset.ui +++ b/src/view/ui/edit_preset.ui @@ -1,7 +1,7 @@ - Dialog - + EditPreset + 0 diff --git a/UI/formula.ui b/src/view/ui/formula.ui similarity index 98% rename from UI/formula.ui rename to src/view/ui/formula.ui index 5642c4d..961a2ff 100644 --- a/UI/formula.ui +++ b/src/view/ui/formula.ui @@ -1,7 +1,7 @@ - Dialog - + Formula + 0 diff --git a/UI/Calc3d.ui b/src/view/ui/main_window.ui similarity index 99% rename from UI/Calc3d.ui rename to src/view/ui/main_window.ui index 76c622c..b5e8bc8 100644 --- a/UI/Calc3d.ui +++ b/src/view/ui/main_window.ui @@ -1,6 +1,6 @@ - Calc3DbyRisen + MainWindow diff --git a/UI/Settings.ui b/src/view/ui/settings.ui similarity index 99% rename from UI/Settings.ui rename to src/view/ui/settings.ui index f7e1d49..15b81d5 100644 --- a/UI/Settings.ui +++ b/src/view/ui/settings.ui @@ -1,7 +1,7 @@ - Dialog - + Settings + 0 diff --git a/UI/preset_settings.ui b/src/view/ui/settings_preset.ui similarity index 99% rename from UI/preset_settings.ui rename to src/view/ui/settings_preset.ui index 37849c3..0f7a701 100644 --- a/UI/preset_settings.ui +++ b/src/view/ui/settings_preset.ui @@ -1,7 +1,7 @@ - addprinter - + SettingsPreset + 0 diff --git a/UI/Updates.ui b/src/view/ui/updates.ui similarity index 97% rename from UI/Updates.ui rename to src/view/ui/updates.ui index b87383b..1bc97a2 100644 --- a/UI/Updates.ui +++ b/src/view/ui/updates.ui @@ -1,7 +1,7 @@ - Dialog - + Updates + 0 diff --git a/texts.py b/texts.py deleted file mode 100644 index 4cb6843..0000000 --- a/texts.py +++ /dev/null @@ -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' diff --git a/update.py b/update.py deleted file mode 100644 index 76f42eb..0000000 --- a/update.py +++ /dev/null @@ -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 - - diff --git a/updates.py b/updates.py deleted file mode 100644 index 1990915..0000000 --- a/updates.py +++ /dev/null @@ -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 -