def __init__(self): hildon.Program.__init__(self) self.window = hildon.Window() self.window.connect("delete-event", gtk.main_quit) self.add_window(self.window) # Osso stuff self.osso_c = osso.Context("osso_test_mime_icons", "0.0.1", False) self.mime = osso.Mime(self.osso_c) # Remaining widgets vbox = gtk.VBox() self.entry = gtk.Entry() vbox.pack_start(self.entry, expand=False, fill=True) self.button = gtk.Button("Ok") self.button.connect("clicked", self.button_cb) vbox.pack_start(self.button, expand=False, fill=True) scroll = gtk.ScrolledWindow() vbox.pack_start(scroll) self.model = gtk.ListStore(gtk.gdk.Pixbuf, str) self.iconview = gtk.IconView(self.model) self.iconview.set_pixbuf_column(0) self.iconview.set_text_column(1) self.iconview.set_margin(12) self.iconview.set_item_width(125) scroll.add(self.iconview) self.window.add(vbox) self.window.show_all()
def test_set_mime_callback(self): mime = osso.Mime(self.ctx) mime.set_mime_callback(self.mime_cb, self) mime.unset_mime_callback() mime.set_mime_callback(self.mime_cb, self) mime.unset_mime_callback_full(self.mime_cb, self)
def main(): if len(sys.argv) < 2: print "Usage: %s <mimetype>" % sys.argv[0] osso_c = osso.Context("osso_test_mime_category", "0.0.1", False) mime = osso.Mime(osso_c) cat = mime.get_category_for_mime_type(sys.argv[1]) print "category is: %s " % cat
def main(): if len(sys.argv) < 2: print "Usage: %s <uri> [<mimetype>]" % sys.argv[0] osso_c = osso.Context("osso_test_mime_category", "0.0.1", False) mime = osso.Mime(osso_c) print "Testing osso.Mime.open_file with uri:'%s'" % sys.argv[1] ret = mime.open_file(sys.argv[1]) print "Testing osso.Mime.open_file_list with uri:'%s'" % sys.argv[1] ret = mime.open_file_list([sys.argv[1]])
def test_constructor(self): mime = osso.Mime(self.ctx) self.assertTrue(isinstance(mime, osso.Mime)) self.assertRaises(TypeError, osso.Mime, None)