mirror of
https://github.com/morgan9e/warehouse
synced 2026-04-14 00:04:08 +09:00
Speedup opening properties window
Getting the size of the user data is now threaded, meaning the window opens instantly
This commit is contained in:
@@ -80,10 +80,19 @@ def show_properties_window(widget, index, window):
|
||||
properties_list.add_css_class("boxed-list")
|
||||
|
||||
path = str(window.user_data_path) + window.host_flatpaks[index][2]
|
||||
|
||||
|
||||
def size_thread(path):
|
||||
size = f"{path}\n~{my_utils.getSizeWithFormat(path)}"
|
||||
user_data_row.set_subtitle(size)
|
||||
|
||||
def calc_size(path):
|
||||
task = Gio.Task.new(None, None, None)
|
||||
task.run_in_thread(lambda _task, _obj, _data, _cancellable: size_thread(path))
|
||||
|
||||
if os.path.exists(path):
|
||||
user_data_row.set_title("User Data")
|
||||
user_data_row.set_subtitle(f"{path}\n~{my_utils.getSizeWithFormat(path)}")
|
||||
# user_data_row.set_subtitle(f"{path}\n~{my_utils.getSizeWithFormat(path)}")
|
||||
calc_size(path)
|
||||
|
||||
open_button = Gtk.Button(icon_name="document-open-symbolic", valign=Gtk.Align.CENTER, tooltip_text=_("Open Data Folder"))
|
||||
open_button.add_css_class("flat")
|
||||
|
||||
Reference in New Issue
Block a user