Skip to content

Commit 7495705

Browse files
committed
Performance and Animation
Smoothing animations (I did not realize they were glitching till now) Performance bug fixed with service
1 parent a222f76 commit 7495705

File tree

3 files changed

+45
-12
lines changed

3 files changed

+45
-12
lines changed

animator.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ def update(self, func, clock):
3131
if self.pos[axis] != self.new_pos[axis]:
3232
if func == "ease":
3333
if self.pos[axis] < self.new_pos[axis] - (((self.new_pos[axis] - self.pos[axis]) / (2 * scale))):
34-
vel[axis] = (self.new_pos[axis] - self.pos[axis]) / (2 * scale)
34+
vel[axis] = (self.new_pos[axis] - self.pos[axis]) / (2.0 * scale)
3535

3636
elif self.pos[axis] > self.new_pos[axis] + (((self.pos[axis] - self.new_pos[axis]) / (2 * scale))):
3737
vel[axis] = -1 * (self.pos[axis] - self.new_pos[axis]) / (2 * scale)
38+
3839
elif func == "old":
3940
if self.pos[axis] < self.new_pos[axis]:
4041
vel[axis] = 1 * scale
@@ -52,9 +53,11 @@ def update(self, func, clock):
5253
diff = self.new_pos[axis] - self.pos[axis]
5354
if diff < 0:
5455
diff *= -1
55-
if diff < 1:
56+
if diff < 1 and self.id != "start": #ugly fix for popping animation
5657
self.pos[axis] = self.new_pos[axis]
5758
# self.vel[axis] = 0
59+
elif diff < 0.1 and self.id == "start":
60+
self.pos[axis] = self.new_pos[axis]
5861

5962
# bounce
6063
"""

main.py

+29-7
Original file line numberDiff line numberDiff line change
@@ -455,8 +455,8 @@ def start_audio():
455455
#proc = subprocess.Popen([f"PULSE/bin/pulseaudio.exe", "--cleanup-shm"], shell=True)
456456
proc = subprocess.Popen(["PULSE/bin/pulseaudio.exe", "-D"], stdout = subprocess.PIPE,
457457
creationflags = subprocess.CREATE_NO_WINDOW)
458-
459-
#audio_server_PID = proc.pid
458+
#print("as", proc.pid)
459+
audio_server_PID = proc.pid
460460
else:
461461
print("Audio Disabled")
462462

@@ -497,15 +497,25 @@ def get_running():
497497
#Psutil method
498498
if server_PID == "reloading":
499499
return True
500+
501+
try:
502+
running = psutil.pid_exists(server_PID)
503+
#print("X", running)
504+
return running
505+
except:
506+
return False
507+
500508

509+
"""
501510
for p in psutil.process_iter(attrs=["pid"]):
502511
try:
503512
name = int(p.info['pid'])
504513
if int(server_PID) == name:
505514
return True
506515
except:
507516
continue
508-
return False
517+
""" #SLOW BC WE ALREADY GOT THE PID
518+
#return False
509519

510520

511521
def get_audio_running():
@@ -516,14 +526,24 @@ def get_audio_running():
516526
return True
517527
return False
518528
"""
529+
530+
try:
531+
running = psutil.pid_exists(audio_server_PID)
532+
#print("audio", running)
533+
return running
534+
except:
535+
return False
536+
"""
519537
#Psutil method
520-
for p in psutil.process_iter(attrs=["name"]):
538+
for p in psutil.process_iter(attrs=["name", "pid"]):
521539
try:
522540
name = p.info['name'].lower()
523541
if "pulseaudio.exe" in name:
542+
print(p.info["pid"])
524543
return True
525544
except:
526545
continue
546+
"""
527547
return False
528548

529549

@@ -557,11 +577,12 @@ def main():
557577
systray.start()
558578

559579
# start service listener
560-
timer = time.perf_counter()
580+
timer = time.time()
561581
while True:
562582
try:
563-
if time.perf_counter() - timer > 4:
564-
timer = timer = time.perf_counter()
583+
#print(time.time() - timer)
584+
if time.time() - timer > 4:
585+
timer = time.time()
565586
if not get_running():
566587
# In case someone closes a single-window server... restart as multi window.
567588
if display_mode == "s":
@@ -600,6 +621,7 @@ def main():
600621
sys.exit()
601622

602623
time.sleep(2)
624+
603625

604626
kill_server()
605627
systray.shutdown()

manager.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -1664,7 +1664,7 @@ def indirect_conf():
16641664
libgl_indirect = True
16651665

16661666

1667-
restart = pymsgbox.confirm(text='Restart ' + machine + " To Apply Changes?", title='Restart Machine?',
1667+
restart = pymsgbox.confirm(text='Restart ' + str(machine) + " To Apply Changes?", title='Restart Machine?',
16681668
buttons=["Yes", "No"])
16691669
if restart == "Yes":
16701670
reboot(machine)
@@ -3739,11 +3739,16 @@ def draw(canvas, mouse=False):
37393739
hover = mouse
37403740
if mouse == False:
37413741
hover = pygame.mouse.get_pos()
3742-
3742+
#fade = False
37433743
#pad = 10
3744+
#print(int(HEIGHT * launch))
37443745
if animator.get("start")[0] < 100 and animator.get("start")[0] > 0:
3746+
#print("1")
3747+
#print(screensize[1] - taskbar - (HEIGHT * launch) - pad)
37453748
if acrylic == False:
37463749
canvas.blit(back, [-1 * (screensize[0] - WIDTH), -1 * (screensize[1] - taskbar - int(HEIGHT * launch))])
3750+
3751+
37473752
if pos_config == "bottom":
37483753
win32gui.MoveWindow(HWND, winpos - padx, screensize[1] - taskbar - int(HEIGHT * launch) - pad, WIDTH, HEIGHT, 1)
37493754
elif pos_config == "top":
@@ -3769,6 +3774,8 @@ def draw(canvas, mouse=False):
37693774
if show_ad == True:
37703775
show_ad = False
37713776
announce()
3777+
3778+
#print(screensize[1] - taskbar - int(HEIGHT) - pad)
37723779
if acrylic == False:
37733780
canvas.blit(back, [-1 * (screensize[0] - WIDTH), -1 * (screensize[1] - taskbar - int(HEIGHT))])
37743781
if pos_config == "bottom":
@@ -3791,7 +3798,7 @@ def draw(canvas, mouse=False):
37913798

37923799
#win32.
37933800

3794-
3801+
if animator.get("start")[0] >= 98:
37953802
animator.animate("start2", [100, 0])
37963803
if service_loaded == True:
37973804
animator.animate("loading", [100, 0])
@@ -4386,6 +4393,7 @@ def on_validate(self, new_value):
43864393

43874394
draw(canvas)
43884395
pygame.display.update()
4396+
43894397
except Exception as e:
43904398
logger.exception("Exception occurred - Error in Mainloop")
43914399

0 commit comments

Comments
 (0)