2 from rox
import g
, loading
5 class Chooser(rox
.Dialog
, loading
.XDSLoader
):
7 rox
.Dialog
.__init
__(self
)
8 loading
.XDSLoader
.__init
__(self
, ['text/x-moz-url'])
10 vbox
= g
.VBox(False, 2)
11 self
.vbox
.pack_start(vbox
, True, True, 0)
12 vbox
.set_border_width(10)
14 message
= g
.Label('Enter the URI of a program available through the Zero Install\n'
15 'Injector system, or drag a link from a web browser into this\n'
17 self
.set_has_separator(False)
18 vbox
.pack_start(message
)
21 self
.uri
.set_text('http://rox.sourceforge.net/2005/interfaces/ROX-Filer')
22 vbox
.pack_start(self
.uri
)
23 self
.uri
.set_activates_default(True)
27 fetching
= g
.Label('Checking interface URI...')
28 vbox
.pack_start(fetching
)
30 self
.add_button(g
.STOCK_CANCEL
, g
.RESPONSE_CANCEL
)
31 self
.add_button(g
.STOCK_ADD
, g
.RESPONSE_OK
)
32 self
.set_default_response(g
.RESPONSE_OK
)
34 def xds_load_uris(self
, uris
):
37 rox
.error("Can't handle multiple URIs at once! (got %s)" % repr(uris
))
39 self
.uri
.set_text(uris
[0])
41 def xds_load_from_selection(self
, selection
, leafname
= None):
42 if selection
.data
is None:
43 g
.gdk
.beep() # Load aborted
45 data
= codecs
.utf_16_decode(selection
.data
)[0]
46 uri
= data
.split('\n')[0]
47 self
.xds_load_uris([uri
])