def onTest(self, widget): test = widget.get_label() print test, if test == "Color Selector": dialog = hildon.ColorSelector(self.window) print "run: %s" % dialog.run(), print "color: %s, %s, %s" % ( dialog.get_color().red, dialog.get_color().green, dialog.get_color().blue ), dialog.destroy() elif test == "Calendar Popup": dialog = hildon.CalendarPopup(self.window, 2004, 9, 1) print "run: %s" % dialog.run(), print "date: %s-%s-%s" % dialog.get_date(), dialog.destroy() elif test == "Add Home": dialog = hildon.AddHomeDialog(self.window, "foo", "bar") print "run: %s" % dialog.run(), print "name: %s" % dialog.get_name(), dialog.destroy() elif test == "File Selector": dialog = hildon.FileChooserDialog(self.window, "open") print "run: %s" % dialog.run(), dialog.destroy() elif test == "Sort": dialog = hildon.SortDialog(self.window) dialog.add_sort_key("foo") dialog.add_sort_key("bar") dialog.add_sort_key("baz") print "run: %s" % dialog.run(), print "sort: %s %s" % (dialog.get_sort_order(), dialog.get_sort_key()), dialog.destroy() elif test == "File Details": try: os.mkdir("%s/MyDocs" % os.environ['HOME']) except Exception, e: pass try: f = open("%s/MyDocs/foobar.txt" % os.environ['HOME'], "w") f.write("Test file\n") f.close() except Exception, e: print "Xerror: %s" % e,
def setUp(self): self.window = hildon.Window() self.obj = hildon.CalendarPopup(self.window, 2009, 4, 13)