Sunday, April 28, 2024
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 658  / 2 Years ago, sun, may 29, 2022, 7:50:01

Im writing a PyGI app where I'd like to show a list of matching applications from the Ubuntu Software Centre in an auto-completion text entry or dropdwon. I haven't yet figured out the best way to present the information, I just want to make it easier for the user to type the name of an application.



But before that, I'd like to figure out how to get the data. Is there an API to get a list of all applications from the Software Centre, or indirectly through the Applications Dash in Unity?


More From » software-center

 Answers
3

You can use the xapian DB directly:



import xapian
db=xapian.Database("/var/cache/software-center/xapian")
for m in db.postlist(""):
appname = db.get_document(m.docid).get_data()


Or the internal software-center API:



import sys
sys.path.insert(0, "/usr/share/software-center/")
import softwarecenter.db.database
db = softwarecenter.db.database.StoreDatabase()
db._aptcache.open()
# 'use_axi' is use apt-xapian-index
# 'use_agent' is use the Software Center Agent database
db.open(use_axi=False, use_agent=False)
for doc in db:
app = db.get_application(doc)
print app.appname, app.pkgname
appdetails = app.get_details(db)
# Icon names are relative to /usr/share/app-install/icons/
print appdetails.icon

[#38298] Monday, May 30, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
istictroubli

Total Points: 306
Total Questions: 96
Total Answers: 114

Location: Sao Tome and Principe
Member since Wed, Jul 13, 2022
2 Years ago
istictroubli questions
;