Skip to content

Commit

Permalink
linux: fix logic and bump
Browse files Browse the repository at this point in the history
  • Loading branch information
gorouflex authored Jul 19, 2024
1 parent aa0eb60 commit 42ce220
Showing 1 changed file with 6 additions and 22 deletions.
28 changes: 6 additions & 22 deletions Linux/UXTU4Unix.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import urllib.request, json, select
from configparser import ConfigParser

LOCAL_VERSION = "0.3.02"
LOCAL_VERSION = "0.3.03"
LATEST_VERSION_URL = "https://github.com/HorizonUnix/UXTU4Unix/releases/latest"
GITHUB_API_URL = "https://api.github.com/repos/HorizonUnix/UXTU4Unix/releases/latest"
current_dir = os.path.dirname(os.path.realpath(__file__))
Expand Down Expand Up @@ -519,8 +519,6 @@ def preset_cfg():
cfg.set('User', 'CustomArgs', custom_args)
if cfg.get('Settings', 'DynamicMode', fallback='0') == '1':
cfg.set('Settings', 'DynamicMode', '0')
if cfg.get('Settings', 'ReApply', fallback='0') == '1':
cfg.set('Settings', 'ReApply', '0')
logging.info("Set preset successfully!")
input("Press Enter to continue...")
with open(CONFIG_PATH, 'w') as config_file:
Expand All @@ -544,8 +542,6 @@ def preset_cfg():
cfg.set('User', 'Mode', preset_name)
if cfg.get('Settings', 'DynamicMode', fallback='0') == '1':
cfg.set('Settings', 'DynamicMode', '0')
if cfg.get('Settings', 'ReApply', fallback='0') == '1':
cfg.set('Settings', 'ReApply', '0')
logging.info("Set preset successfully!")
input("Press Enter to continue...")
with open(CONFIG_PATH, 'w') as config_file:
Expand Down Expand Up @@ -651,7 +647,7 @@ def about():
while True:
clear()
logging.info("About UXTU4Unix")
logging.info("The Future Stepping Update (3LinuxL2TDreamNV1)")
logging.info("The New Future Vision Update (3Linux290724)")
logging.info("----------------------------")
logging.info("Maintainer: GorouFlex\nCLI: GorouFlex")
logging.info("GUI: NotchApple1703\nCore: NotchApple1703")
Expand Down Expand Up @@ -704,13 +700,10 @@ def preset_menu():
selected_preset = list(PRESETS.keys())[preset_number - 1]
clear()
last_mode = cfg.get('Settings', 'DynamicMode', fallback='0')
last_apply = cfg.get('Settings', 'ReApply', fallback='0')
cfg.set('Settings', 'ReApply', '0')
cfg.set('Settings', 'DynamicMode', '0')
user_mode = selected_preset
apply_smu(PRESETS[user_mode], user_mode)
cfg.set('Settings', 'DynamicMode', last_mode)
cfg.set('Settings', 'ReApply', last_apply)
else:
logging.info("Invalid option.")
input("Press Enter to continue...")
Expand Down Expand Up @@ -738,12 +731,12 @@ def apply_smu(args, user_mode):
sleep_time = cfg.get('Settings', 'Time', fallback='30')
password = cfg.get('User', 'Password', fallback='')
dynamic = cfg.get('Settings', 'dynamicmode', fallback='0')
last_apply = cfg.get('Settings', 'ReApply', fallback='0')
prev_mode = None
PRESETS = get_presets()
dm_enabled = cfg.get('Settings', 'DynamicMode', fallback='0') == '1'
if dm_enabled:
if cfg.get('Settings', 'ReApply', fallback='0') == '0':
cfg.set('Settings', 'ReApply', '1')
if dm_enabled:
cfg.set('Settings', 'ReApply', '1')
reapply = cfg.get('Settings', 'ReApply', fallback='0')
if reapply == '1':
while True:
Expand All @@ -755,16 +748,6 @@ def apply_smu(args, user_mode):
user_mode = 'Eco'
else:
user_mode = 'Extreme'
if prev_mode == user_mode and dynamic == '1':
for _ in range(int(float(sleep_time))):
for _ in range(1):
time.sleep(1)
if sys.stdin in select.select([sys.stdin], [], [], 0)[0]:
line = sys.stdin.readline()
if line.lower().strip() == 'b':
return
continue
prev_mode = user_mode
clear()
if args == 'Custom':
custom_args = cfg.get('User', 'CustomArgs', fallback='')
Expand Down Expand Up @@ -792,6 +775,7 @@ def apply_smu(args, user_mode):
if sys.stdin in select.select([sys.stdin], [], [], 0)[0]:
line = sys.stdin.readline()
if line.lower().strip() == 'b':
cfg.set('Settings', 'ReApply', last_apply)
return
else:
clear()
Expand Down

0 comments on commit 42ce220

Please sign in to comment.