Compare commits

...

10 Commits

11 changed files with 147 additions and 44 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/venv
/.idea
/build

View File

@ -8,7 +8,7 @@ import requests
from calculating import calculating, amortization, cost_prise from calculating import calculating, amortization, cost_prise
from setts import window_setts, language, currency_setts from setts import window_setts, language, currency_setts
from texts import calc, about, new_marge, ver, not_connect from texts import calc, about, new_marge, ver, not_connect
from update import upd_check, upd_start from update import upd_check
now = datetime.datetime.now() now = datetime.datetime.now()
@ -19,7 +19,7 @@ _ = lang.gettext
def create_window(): def create_window():
with open('setts.json') as f: with open(os.path.expanduser('setts.json')) as f:
theme = json.load(f)['settings']['theme'] theme = json.load(f)['settings']['theme']
Sgi.theme(theme) Sgi.theme(theme)
menu_def = [ menu_def = [
@ -57,7 +57,6 @@ def create_window():
def main(): def main():
upd_start()
window = create_window() window = create_window()
while True: while True:
@ -81,7 +80,7 @@ def main():
Sgi.popup_ok(not_connect) Sgi.popup_ok(not_connect)
elif event == _('Рассчитать'): elif event == _('Рассчитать'):
with open('setts.json') as f: with open(os.path.expanduser('setts.json')) as f:
params = json.load(f)["settings"] params = json.load(f)["settings"]
try: try:
hours = float(values[1]) hours = float(values[1])

38
Calc3D.spec Normal file
View File

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

View File

@ -3,6 +3,9 @@ def cost_prise(p, t, h, md, d, st, mk, am, post, x):
t = int(t) # время печати, в минутах!!! t = int(t) # время печати, в минутах!!!
h = float(h) # тариф электроэнергии h = float(h) # тариф электроэнергии
md = float(md) # вес детали md = float(md) # вес детали
if float(d) < 1:
d = 1
else:
d = float(d) # коэффициент выбраковки d = float(d) # коэффициент выбраковки
st = float(st) # стоимость катушки st = float(st) # стоимость катушки
mk = float(mk) # вес катушки mk = float(mk) # вес катушки
@ -15,7 +18,7 @@ def cost_prise(p, t, h, md, d, st, mk, am, post, x):
x = int(x) # количество экземпляров x = int(x) # количество экземпляров
except ValueError: except ValueError:
x = 1 x = 1
result = (abs(p) / 1000 * abs(t) / 60 * abs(h)) + (abs(md) * abs(d) * (abs(st) / abs(mk)) + abs(am) + abs(post)) * abs(x) 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) return round(result, 2)

BIN
dist/Calc3D.exe vendored Executable file

Binary file not shown.

33
dist/Calc3D.exe.ppdb vendored Normal file
View File

@ -0,0 +1,33 @@
#!/usr/bin/env bash
#Author: risen
#Calc3D.exe
#Rating=1-5
#####################examples###########################
##export PW_WINDOWS_VER=10 # Set windows version 10, 7 or XP
##export PW_DLL_INSTALL="vcrun2017" # Install DLL in port prefix (used winetricks)
##export WINEDLLOVERRIDES="blabla=n,b"
##export LAUNCH_PARAMETERS="+com_skipIntroVideo 1 +com_skipSignInManager 1" # Additional launch options
export PW_VULKAN_USE="2"
##export PW_VULKAN_NO_ASYNC=1 # Disabled ASYNC for VULKAN
##export PW_OLD_GL_STRING=1
##export PW_HIDE_NVIDIA_GPU=1
##export PW_FORCE_USE_VSYNC=0 # Vsync: 0-FORCE_OFF, 1-FORCE_ON, 2-BY_DEFAULT
##export PW_VIRTUAL_DESKTOP=1
##export VKD3D_CONFIG=force_bindless_texel_buffer,multi_queue
##export ENABLE_VKBASALT=1
##export PW_VKBASALT_EFFECTS="FakeHDR:cas" # Use Reshade in others games (dx9-12 to vulkan only)
##export PW_VKBASALT_FFX_CAS="0.75" # FidelityFX Contrast Adaptive Sharpening (min 0 - max 1)
##export PW_NO_FSYNC=1 # Do not use futex-based in-process synchronization primitives. (Automatically disabled on systems with no FUTEX_WAIT_MULTIPLE support.
##export PW_NO_ESYNC=0 # Do not use eventfd-based in-process synchronization primitives
##export PW_USE_GSTREAMER=1 # 0 - disabled use winegstreamer
##export PW_REDUCE_PULSE_LATENCY=1 # Fix crackling audio in games
##export PW_NO_WRITE_WATCH=1 # Disable support for memory write watches in ntdll. This is a very dangerous hack and should only be applied if you have verified that the game can operate without write watches. This improves performance for some very specific games (e.g. CoreRT-based games).
##export PW_HEAP_DELAY_FREE=1
##export WINEARCH=win32 # defaut = win64
##export WINEPREFIX=
##export PW_USE_TERMINAL=1 # Force run in terminal
##export PW_GUI_DISABLED_CS=1 # 1 = disabled GUI
##export PATH_TO_GAME=
##add_in_start_portwine () { commands ; }
export PW_WINE_USE="PROTON_LG_9-2"
export PW_PREFIX_NAME="DEFAULT"

Binary file not shown.

15
setts.json Normal file
View File

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

View File

@ -8,7 +8,7 @@ from lists import themes_list, lang_list, currency_list
def language(): def language():
with open('setts.json') as file: with open(os.path.expanduser('setts.json')) as file:
old_data = json.load(file) old_data = json.load(file)
if old_data['settings']["locale"] == 'English': if old_data['settings']["locale"] == 'English':
locale = 'en_US' locale = 'en_US'
@ -25,12 +25,19 @@ _ = lang.gettext
def currency_setts(): def currency_setts():
with open('setts.json') as file: with open('setts.json') as file:
old_data = json.load(file) old_data = json.load(file)
try:
if old_data['settings']["currency"] == 'руб.': if old_data['settings']["currency"] == 'руб.':
currency = 'руб.' currency = 'руб.'
elif old_data['settings']["currency"] == '$': elif old_data['settings']["currency"] == '$':
currency = '$' currency = '$'
else: else:
currency = '' currency = ''
except KeyError:
if old_data['settings']["locale"] == "рус.":
currency = 'руб.'
else:
currency = '$'
return currency return currency
@ -45,7 +52,10 @@ def window_setts():
mk = old_data["settings"]["mk"] mk = old_data["settings"]["mk"]
a = old_data["settings"]["a"] a = old_data["settings"]["a"]
locale = old_data['settings']["locale"] locale = old_data['settings']["locale"]
try:
currency = old_data['settings']["currency"] currency = old_data['settings']["currency"]
except KeyError:
currency = "руб."
try: try:
spi = old_data["settings"]["spi"] spi = old_data["settings"]["spi"]
except KeyError: except KeyError:

View File

@ -73,4 +73,4 @@ new_sets = (_('Задайте стоимость принтера, \n'
new_marge = (_('Задайте процент желаемой наценки\n' new_marge = (_('Задайте процент желаемой наценки\n'
'в настройках (можно просто проставить ноль)')) 'в настройках (можно просто проставить ноль)'))
ver = '0.6.1' ver = '0.6.4'

View File

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