Skip to content

Commit

Permalink
v3.2
Browse files Browse the repository at this point in the history
Updated program to version 3.2.
  • Loading branch information
Skrepysh committed May 1, 2024
1 parent ae4e335 commit 06ff2f6
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 9 deletions.
3 changes: 2 additions & 1 deletion config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ theme = dark
window_width = 450
window_height = 750
ui_color = cyanaccent200
compact_ui = True
compact_ui = True
check_current_modpack = False
51 changes: 44 additions & 7 deletions minesquid.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import requests
from subprocess import Popen

program_version = '3.1'
build_date = '12.04.2024'
program_version = '3.2'
build_date = '01.05.2024'


class MineSquid:
Expand Down Expand Up @@ -159,6 +159,7 @@ def apply_settings(e):

edit_config('options', 'backup_restore_dlg', str(open_dlg_backup_restored_checkbox.value))
edit_config('options', 'mp_load_dlg', str(open_dlg_mp_loaded_checkbox.value))
edit_config('options', 'check_current_modpack', str(check_current_modpack_checkbox.value))

page.window_width = width_field.value
page.window_height = height_field.value
Expand All @@ -172,7 +173,7 @@ def apply_settings(e):
log_add('Настройки применены успешно')
page.dialog = dlg_settings_applied
open_dlg()
read_config()
refresh(0)
else:
log_add('Обнаружены некорректные настройки, не удалось применить')
page.dialog = dlg_incorrect_settings
Expand All @@ -194,11 +195,15 @@ def open_reset_settings_dlg(e):
open_dlg()

def refresh(e):
start_time = time.time()
log_add('*' * 16)
log_add('Обновление данных')
prepare_main_tab()
read_config()
check_settings()
page.radio.value = None
end_time = time.time()
log_add(f'Затрачено времени: {end_time - start_time}с')
log_add('Данные обновлены')
log_add('*' * 16)

Expand Down Expand Up @@ -230,6 +235,14 @@ def enter_path():
def build_list():
os.chdir(f"{self.userappdata}\\modpacks")
self.mp_list = [e for e in os.listdir() if os.path.isdir(e)]
if check_current_modpack_checkbox.value and os.path.exists(mdir := f'{self.game_directory}\\mods'):
current = os.listdir(mdir)
for x in self.mp_list:
if os.listdir(x) == current:
index = self.mp_list.index(x)
x1 = f'{x}👈'
self.mp_list[index] = x1
log_add(f'Текущий модпак: {x}')
log_add('Список модпаков обновлен')
if not self.game_directory_exists:
log_add('Папка с игрой не назначена')
Expand All @@ -248,7 +261,8 @@ def repair_config(**kwargs):
'window_height': '750',
'window_width': '450',
'ui_color': 'cyanaccent200',
'compact_ui': 'True'
'compact_ui': 'True',
'check_current_modpack': 'False'
}
if 'restore_section' in kwargs:
with open(f'{self.userappdata}\\config.ini', 'w') as cfg:
Expand All @@ -269,7 +283,8 @@ def read_config():
'theme', 'window_width',
'window_height',
'ui_color',
'compact_ui'
'compact_ui',
'check_current_modpack'
]

if not self.config.has_section('options'):
Expand All @@ -290,6 +305,7 @@ def read_config():
config_height = self.config['options']['window_height']
config_ui_color = self.config['options']['ui_color']
config_compact_ui = self.config['options']['compact_ui']
config_check_current_modpack = self.config['options']['check_current_modpack']

if os.path.exists(config_game_directory): # Обработка пути к папке с игрой
self.game_directory = config_game_directory
Expand All @@ -314,6 +330,11 @@ def read_config():
open_dlg_backup_restored_checkbox.value = False # Конец обработки настроек диалогов об успешном
# действии

if config_check_current_modpack == 'True':
check_current_modpack_checkbox.value = True
else:
check_current_modpack_checkbox.value = False

if config_theme == 'dark':
page.theme_mode = themes[0] # Темная тема
elif config_theme == 'light':
Expand Down Expand Up @@ -569,6 +590,7 @@ def loadmp(e):
log_add('Не назначена папка с игрой, отмена операции')
page.dialog = dlg_papka
open_dlg()
refresh(0)
page.floating_action_button.disabled = False
restore_btn.disabled = False
page.update()
Expand Down Expand Up @@ -598,6 +620,7 @@ def restore(e):
page.dialog = dlg_papka
open_dlg()
log_add('Папка с игрой не назначена, отмена операции')
refresh(0)
page.floating_action_button.disabled = False
restore_btn.disabled = False
log_add('*' * 16)
Expand Down Expand Up @@ -851,15 +874,28 @@ def check_folders():
),
compact_ui_checkbox := ft.Checkbox(
label='Компактный вид интерфейса',
value=True
value=True,
tooltip='Уменьшает расстояние между элементами интерфейса'
),
open_dlg_mp_loaded_checkbox := ft.Checkbox(
label='Оповещать об успешной загрузке модпака',
value=False,
tooltip='Если включено, то после загрузки модпака будет показываться диалоговое окно'
),
open_dlg_backup_restored_checkbox := ft.Checkbox(
label='Оповещать об успешном восстановлении бэкапа',
value=True,
tooltip='Если включено, '
'то после восстановления бэкапа будет показываться диалоговое окно'
),
check_current_modpack_checkbox := ft.Checkbox(
label='Выделять активный модпак',
value=False,
tooltip='Если включено, то программа будет '
'проверять, какой из имеющихся модпаков '
'сейчас находится в папке mods, и выделять его символом 👈.\n'
'ВНИМАНИЕ! НЕ включайте, эту функцию, если у вас слабый ПК или медленный '
'жесткий диск!'
),
ft.Container(padding=5),
ft.Row(
Expand Down Expand Up @@ -897,7 +933,8 @@ def check_folders():
)
]
),
ft.Container(padding=15) # чтобы при слишком маленькой высоте окна кнопка сброса настроек не перекрывалась кнопкой GO
ft.Container(padding=15) # чтобы при слишком маленькой высоте окна кнопка
# сброса настроек не перекрывалась кнопкой GO
]
),
),
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1
3.2

0 comments on commit 06ff2f6

Please sign in to comment.