Compare commits

...

2 Commits

Author SHA1 Message Date
900a83be54 add: connection 2024-12-08 19:46:50 +03:00
79b8960e43 add: qt.ui files 2024-12-08 14:58:25 +03:00
36 changed files with 774 additions and 263 deletions

1
.gitignore vendored
View File

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

131
Calc3D.py
View File

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

View File

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

View File

@ -18,27 +18,16 @@ 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 - стоимость моделирования, руб
```

Binary file not shown.

Binary file not shown.

BIN
calc3d Normal file

Binary file not shown.

371
calc3dui.py Normal file
View File

@ -0,0 +1,371 @@
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

46
connection.py Normal file
View File

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

63
del-preset.py Normal file
View File

@ -0,0 +1,63 @@
# -*- 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

58
edit-preset.py Normal file
View File

@ -0,0 +1,58 @@
# -*- 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

93
formula.py Normal file
View File

@ -0,0 +1,93 @@
# -*- 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

BIN
img/calc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

1
img/calc.svg Normal file
View File

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

After

Width:  |  Height:  |  Size: 482 B

BIN
img/exit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

1
img/exit.svg Normal file
View File

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

After

Width:  |  Height:  |  Size: 222 B

BIN
img/logo-1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

BIN
img/logo-2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
img/logo-3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
img/logo-4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

BIN
img/logo-5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
img/logo-6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
img/logo-7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
img/logo-8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 776 B

BIN
img/modeling.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
img/quantity.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
img/rubl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 993 B

BIN
img/time.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
img/weight.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

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

Binary file not shown.

Binary file not shown.

BIN
logo.ico

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 KiB

43
settings.py Normal file
View File

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

83
updates.py Normal file
View File

@ -0,0 +1,83 @@
# -*- 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