Tuesday, May 7, 2024
 Popular · Latest · Hot · Upcoming
0
rated 0 times [  0] [ 0]  / answers: 1 / hits: 351  / 2 Years ago, sun, june 12, 2022, 4:14:12

I want to deploy a "Did you know..." or "Tip of the day" application at the office. It should:




  • Show a dialog at login time with a random tip.

  • Obviously, provide some way to store my own tips.

  • Be easy to disable and reenable by the user itself.



I'm using puppet, so I'm covered with the deployment. The tips don't even need to be gathered from a server, since I can deploy the newest tips file/database with no costs.



Sure, I could hack a quick solution by using zenity and bash, but I'd like to know if there's any application out there specifically targeted at this.



I don't like the zenity approach very much because it's very limited on the contents that can be displayed. No text alongside screenshots, for example. Zenity is aimed towards displaying simple dialogs.


More From » 12.04

 Answers
2

I ended up hacking a quick solution with Python using Python-webkit. This solution displays HTML files



#!/usr/bin/env python

import gtk,webkit,os
from random import choice

win = gtk.Window()
win.connect("destroy", lambda w: gtk.main_quit())

scroller = gtk.ScrolledWindow()
win.add(scroller)

web = webkit.WebView()
scroller.add(web)

banners = ["banner1","banner2","banner3"]
banner = choice(banners)

web.load_uri("file:///usr/local/lib/tips/"+banner+".html")

win.resize(640,400)
win.show_all()
gtk.main()


Place the corresponding banners on /usr/local/lib/tips/, for example, the banner1.html is a simple image:



<html><head><style>*,html,body{margin:0;padding:0;}</style></head><body></body><img src='banner1.png' /></html>


If you reference resources (images, css, js...), place them also in /usr/local/lib/tips/.



Then, run this python script at session start, by creating a desktop file on /etc/xdg/autostart.


[#33798] Monday, June 13, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
laiuct

Total Points: 44
Total Questions: 105
Total Answers: 107

Location: Seychelles
Member since Mon, Feb 15, 2021
3 Years ago
;