Skip to content

Commit

Permalink
Optimize software source update detection at startup
Browse files Browse the repository at this point in the history
  • Loading branch information
wenbo607 committed Sep 25, 2019
1 parent 60b9afa commit b4e1431
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
22 changes: 15 additions & 7 deletions backend/service/appmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def __init__(self):

self.worker_thread1 = ThreadWorker(self)
self.worker_thread1.setDaemon(True)
self.worker_thread1.start()
#self.worker_thread1.start()

self.backend = InstallBackend()
self.backend.kydroid_dbus_ifaces()
Expand Down Expand Up @@ -387,6 +387,7 @@ def open_cache(self):

def init_models(self):
#print "self.appmgr.init_models()"
self.worker_thread1.start()
item = WorkerItem("init_models",None)
self.mutex.acquire()
self.worklist.append(item)
Expand Down Expand Up @@ -415,7 +416,7 @@ def update_models(self,action, pkgname=""):

def get_category_list_from_db(self):
# list = self.db.query_categories()
cat_list = {}
cat_list = self.cat_list
for item in self.list:
#c = UnicodeToAscii(item[2])
c = item[2]
Expand All @@ -424,9 +425,16 @@ def get_category_list_from_db(self):
visible = (item[0]==1)

icon = UBUNTUKYLIN_RES_PATH + str(c) + ".png"
cat = Category(c, zhcnc, index, visible, icon, self.get_category_apps_from_db(c))
cat_list[c] = cat
self.cat_list = cat_list
if(c == 'recommend'):
cat = Category(c, zhcnc, index, visible, icon, self.get_category_apps_from_db(c))
while(not cat.apps):
time.sleep(0.2)
cat = Category(c, zhcnc, index, visible, icon, self.get_category_apps_from_db(c))
cat_list = self.cat_list
cat_list[c] = cat

#cat = Category(c, zhcnc, index, visible, icon, self.get_category_apps_from_db(c))
#cat_list[c] = cat
Globals.ALL_APPS = {}# zx10.05 To free the all_apps dict after all apps init ready for using less memeory
return cat_list

Expand All @@ -435,8 +443,8 @@ def get_category_list(self, reload=False, catdir=""):
if reload is False:
return self.cat_list

# cat_list = self.get_category_list_from_db()
return self.cat_list
cat_list = self.get_category_list_from_db()
return cat_list

def get_category_apps_from_db(self,cat,catdir=""):
lists = self.db.query_category_apps(cat)
Expand Down
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
ubuntu-kylin-software-center (3.0.4) eoan; urgency=medium

* Add software source update detection at startup.

-- wenbo <[email protected]> Wed, 25 Sep 2019 20:27:35 +0800

ubuntu-kylin-software-center (3.0.3) eoan; urgency=medium

[Wen Bo]
Expand Down

0 comments on commit b4e1431

Please sign in to comment.