# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.
-import os
-import gtk
-import gobject
+import os, sys
-import avahi, dbus, gobject, sys
-from avahi.SimpleGladeApp import SimpleGladeApp
+try:
+ import avahi, gtk, gobject, dbus
+ from avahi.SimpleGladeApp import SimpleGladeApp
+except ImportError:
+ print "Sorry, to use this tool you need to install Avahi, pygtk and python-dbus."
+ sys.exit(1)
try:
import dbus.glib
service_type_browsers = {}
service_browsers = {}
-
glade_dir = "@interfacesdir@"
class Main_window(SimpleGladeApp):
def service_resolved(self, interface, protocol, name, type, domain, host, aprotocol, address, port, txt):
print "Service data for service '%s' of type '%s' in domain '%s' on %i.%i:" % (name, type, domain, interface, protocol)
- print "\tHost %s (%s), port %i, TXT data: %s" % (host, address, port, str(txt))
- self.update_label(interface, protocol, name, type, domain, host, aprotocol, address, port, str(txt))
+ print "\tHost %s (%s), port %i, TXT data: %s" % (host, address, port, str(avahi.txt_array_to_string_array(txt)))
+ self.update_label(interface, protocol, name, type, domain, host, aprotocol, address, port, str(avahi.txt_array_to_string_array(txt)))
def print_error(err):
print "Error:", str(err)