How can I show my own personalized banner exhibits on Ubuntu Software Center?
I've seen some URL definitions on /usr/share/software-center/softwarecenter/enums.py
and /usr/share/software-center/softwarecenter/distro/Ubuntu.py
so far.
I also tried to track the code from the views to the core. But I got lost. _append_banner_adds
calls SoftwareCenterAgent
. It calls SpawnHelper
. Then I get lost. There are also some calls at SimpleFileDownloader
but I'm not able to track them.
Also, I've noticed this entry on the debug log.
2013-02-08 15:07:43,731 - softwarecenter.simplefiledownloader - DEBUG - download_file: http://software-center.ubuntu.com/site_media/exhibits/2012/12/SC_banner_Mixxx_2.png None True
Is there documentation on how this is implemented? Some simple recipe to change the default banners and put my own banners on a clean way would be very helpful.
I suppose I can simply rewrite the _append_banner_adds
function, but I'm not very prolific on python and I'd like to understand and use the same methods Ubuntu is using, if possible.
Best Answer
Open up
/usr/share/software-center/softwarecenter/backend/scagent.py
and edit the beginning of this function, so that it says:You can leave the rest as it is, it will never be reached.
If you want scripting support in your
<iframe>
, edit/usr/share/software-center/softwarecenter/ui/gtk3/widgets/exhibits.py
and find
settings.set_property("enable-scripts", False)
. ChangeFalse
toTrue
.Now make
/var/www/cgi-bin/bannerlist.py
and make it executable:This demonstrates a generated banner list.
Now make
/var/www/cgi-bin/banner.py
and make it executable:This demonstrates a generated banner.
You might need to clear the software-center cache. You can do that using
rm -rf ~/.cache/software-center
.Obviously you need to put something in
/tmp/test.html
for the first banner to work.You also need a webserver running at 8800 with a
cgi-bin
for this to work. If you don't have this, run this in Bash:You need to style the
iframe
to make it fill the space, but you figured that out.