1 """Provide a standard window for displaying application information."""
9 class InfoWin(g
.Dialog
):
10 """Window to show app info"""
11 def __init__(self
, program
, purpose
, version
, author
, website
):
12 g
.Dialog
.__init
__(self
)
15 def close(iw
, event
=None, data
=None):
18 self
.connect("delete_event", close
)
21 self
.vbox
.pack_start(hbox
)
25 path
=os
.path
.join(rox
.app_dir
, '.DirIcon')
26 pixbuf
=g
.gdk
.pixbuf_new_from_file(path
)
28 icon
.set_from_pixbuf(pixbuf
)
32 #rox.report_exception()
36 hbox
.pack_start(table
)
38 label
=g
.Label("Program")
39 table
.attach(label
, 0, 1, 0, 1)
42 frame
.set_shadow_type(g
.SHADOW_IN
)
43 table
.attach(frame
, 1, 2, 0, 1)
45 label
=g
.Label(program
or '')
48 label
=g
.Label("Purpose")
49 table
.attach(label
, 0, 1, 1, 2)
52 frame
.set_shadow_type(g
.SHADOW_IN
)
53 table
.attach(frame
, 1, 2, 1, 2)
55 label
=g
.Label(purpose
or '')
58 label
=g
.Label("Version")
59 table
.attach(label
, 0, 1, 2, 3)
62 frame
.set_shadow_type(g
.SHADOW_IN
)
63 table
.attach(frame
, 1, 2, 2, 3)
65 label
=g
.Label(version
or '')
68 label
=g
.Label("Authors")
69 table
.attach(label
, 0, 1, 3, 4)
72 frame
.set_shadow_type(g
.SHADOW_IN
)
73 table
.attach(frame
, 1, 2, 3, 4)
75 label
=g
.Label(author
or '')
78 label
=g
.Label("Web site")
79 table
.attach(label
, 0, 1, 5, 6)
82 button
=g
.Button(website
)
83 table
.attach(button
, 1, 2, 5, 6)
85 def goto_website(widget
, iw
):
86 webbrowser
.open(iw
.website
)
88 button
.connect("clicked", goto_website
, self
)
92 frame
.set_shadow_type(g
.SHADOW_IN
)
93 table
.attach(frame
, 1, 2, 5, 6)
97 button
=g
.Button(stock
=g
.STOCK_CLOSE
)
98 hbox
.pack_start(button
)
100 def dismiss(widget
, iw
):
103 button
.connect("clicked", dismiss
, self
)
108 from rox
import AppInfo
110 def infowin(pname
, info
=None):
111 """Open info window for this program. info is a source of the
112 AppInfo.xml file, if None then $APP_DIR/AppInfo.xml is loaded instead"""
115 info
=os
.path
.join(rox
.app_dir
, 'AppInfo.xml')
118 app_info
=AppInfo
.AppInfo(info
)
120 rox
.report_exception()
124 iw
=InfoWin(pname
, app_info
.getAbout('Purpose')[1],
125 app_info
.getAbout('Version')[1],
126 app_info
.getAuthors(),
127 app_info
.getAbout('Homepage')[1])
131 rox
.report_exception()