def __init__(self): Gtk.Box.__init__(self) self.set_spacing(StockEms.SMALL) self.selector = ReactiveStar() self.selector.set_n_stars(self.N_STARS) self.selector.set_rating(self.INIT_RATING) self.selector.set_size_as_pixel_value(big_em(3)) text = self.RATING_WORDS[self.INIT_RATING] self.caption = Gtk.Label.new(text) self.set_orientation(Gtk.Orientation.HORIZONTAL) self.pack_start(self.selector, False, False, 0) self.pack_start(self.caption, False, False, 0) return
def get_test_stars_window(): win = Gtk.Window() win.set_size_request(200, 200) vb = Gtk.VBox() vb.set_spacing(6) win.add(vb) vb.add(Gtk.Button()) vb.add(Gtk.Label(label="BLAHHHHHH")) star = Star() star.set_n_stars(5) star.set_rating(2.5) star.set_size(StarSize.SMALL) vb.pack_start(star, False, False, 0) star = Star() star.set_n_stars(5) star.set_rating(2.5) star.set_size(StarSize.NORMAL) vb.pack_start(star, False, False, 0) star = Star() star.set_n_stars(5) star.set_rating(2.575) star.set_size(StarSize.BIG) vb.pack_start(star, False, False, 0) star = Star() star.set_n_stars(5) star.set_rating(3.333) star.set_size_as_pixel_value(36) vb.pack_start(star, False, False, 0) star = ReactiveStar() star.set_n_stars(5) star.set_rating(3) star.set_size_as_pixel_value(big_em(3)) vb.pack_start(star, False, False, 0) selector = StarRatingSelector() vb.pack_start(selector, False, False, 0) win.connect("destroy", Gtk.main_quit) return win