[6f07ed]: chooser.py  Maximize  Restore  History

Download this file

48 lines (38 with data), 1.4 kB

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

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks