Skip to content

Commit

Permalink
Clean up, add some more benchmarking to costly operations.
Browse files Browse the repository at this point in the history
  • Loading branch information
mtwebster committed May 2, 2024
1 parent 0da700d commit 5897b70
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions usr/lib/linuxmint/mintinstall/mintinstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import platform
import functools
import requests
import time
import json
import re
import math
Expand Down Expand Up @@ -194,8 +195,6 @@ def __init__(self, icon_string=None, width=DETAILS_ICON_SIZE, height=DETAILS_ICO
self.width = 1
self.height = 1

self.request_stream = None

self.connect("destroy", self.on_destroyed)

if icon_string:
Expand Down Expand Up @@ -937,6 +936,7 @@ def __init__(self):
flags=Gio.ApplicationFlags.HANDLES_OPEN | Gio.ApplicationFlags.HANDLES_COMMAND_LINE)

self.gui_ready = False
self.start_time = time.time()

self.low_res = self.get_low_res_screen()

Expand Down Expand Up @@ -1427,11 +1427,17 @@ def on_installer_ready(self):
housekeeping.run()

self.refresh_cache_menuitem.set_sensitive(True)
self.print_startup_time()
except Exception as e:
print("Loading error: %s" % e)
traceback.print_tb(e.__traceback__)
GLib.idle_add(self.refresh_cache)

def print_startup_time(self):
end_time = time.time()
print('Mintinstall startup took %0.3f ms' % ((end_time - self.start_time) * 1000.0,))

@print_timing
def load_banner(self):
box = self.builder.get_object("box_banner")

Expand Down Expand Up @@ -1495,6 +1501,7 @@ def load_banner(self):
def on_banner_clicked(self, button, pkginfo):
self.show_package(pkginfo, self.PAGE_LANDING)

@print_timing
def load_top_rated(self):
box = self.builder.get_object("box_top_rated")

Expand Down Expand Up @@ -1539,6 +1546,7 @@ def load_top_rated(self):
self.picks_tiles.append(tile)
box.show_all()

@print_timing
def load_featured(self):
box = self.builder.get_object("box_featured")

Expand Down Expand Up @@ -3240,7 +3248,6 @@ def on_installer_info_ready(self, task):
if launchable.get_kind() == AppStream.LaunchableKind.DESKTOP_ID:
[desktop_id] = launchable.get_entries()
desktop_file = os.path.join(self.installer.get_flatpak_root_path(), "exports/share/applications", desktop_id)
print(desktop_file)
try:
info = Gio.DesktopAppInfo.new_from_filename(desktop_file)
except TypeError:
Expand Down

0 comments on commit 5897b70

Please sign in to comment.