1
0
Fork 0
mirror of https://github.com/aclist/dztui.git synced 2025-04-04 19:43:00 +02:00

chore: unify time delta methods

This commit is contained in:
aclist 2024-11-19 21:51:43 +09:00
parent 8b9f751ff1
commit 651b50ade2
2 changed files with 6 additions and 12 deletions

View file

@ -569,7 +569,7 @@ fetch_helpers_by_sum(){
[[ -f "$config_file" ]] && source "$config_file"
declare -A sums
sums=(
["ui.py"]="4663cdda7bf91a0c594103d6f4382f15"
["ui.py"]="353e6fcb8d2c674a3720c0ab8a2b3fd6"
["query_v2.py"]="55d339ba02512ac69de288eb3be41067"
["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397"
["funcs"]="5eae515ea2cac2ab38212a529415e86b"

View file

@ -12,7 +12,6 @@ import subprocess
import sys
import textwrap
import threading
import time
locale.setlocale(locale.LC_ALL, '')
gi.require_version("Gtk", "3.0")
@ -22,7 +21,6 @@ from enum import Enum
# 5.6.0
app_name = "DZGUI"
start_time = 0
cache = {}
config_vals = []
@ -874,15 +872,11 @@ class TreeView(Gtk.TreeView):
def refresh_player_count(self):
parent = self.get_outer_window()
global start_time
then = start_time
now = time.monotonic()
diff = now - then
cooldown = 30 - math.floor(diff)
if ((start_time > 0) and (now - then) < 30):
spawn_dialog(parent, "Global refresh cooldown not met. Wait %s second(s)." %(str(cooldown)), Popup.NOTIFY)
return
start_time = now
cooldown = call_out(self, "test_cooldown", "", "")
if cooldown.returncode == 1:
spawn_dialog(self.get_outer_window(), cooldown.stdout, Popup.NOTIFY)
return 1
call_out(self, "start_cooldown", "", "")
thread = threading.Thread(target=self._background_player_count, args=())
thread.start()