示例#1
0
    def __init__(self):
        BasePage.__init__(self)
        self.frame = Gtk.Frame()
        self.frame.set_shadow_type(Gtk.ShadowType.NONE)
        self.tmap = TimezoneMap.TimezoneMap()
        self.pack_start(self.frame, True, True, 0)
        self.frame.set_margin_end(0)
        self.frame.set_margin_start(0)
        self.frame.add(self.tmap)

        self.locations = Gtk.Entry()
        self.locations.set_property("margin-right", 30)
        self.locations.set_property("margin-start", 30)
        self.locations.set_property("margin-top", 10)
        self.pack_end(self.locations, False, False, 0)

        self.locations.set_placeholder_text("Search for your timezone" + u"…")

        completion = TimezoneMap.TimezoneCompletion()
        completion.set_text_column(0)
        completion.set_inline_completion(True)
        completion.set_inline_selection(True)
        completion.connect("match-selected", self.change_timezone)
        self.locations.set_completion(completion)
        self.tmap.connect("location-changed", self.changed)
示例#2
0
    def __init__(self, installer):
        BasePage.__init__(self)
        self.map = TimezoneMap.TimezoneMap()
        self.pack_start(self.map, True, True, 0)
        self.installer = installer

        # Set up timezone database
        self.db = Database()

        self.locations = Gtk.Entry()
        self.locations.set_placeholder_text(_("Search for your timezone..."))

        tz_model = Gtk.ListStore(str,str,str,str,float,float,str)

        for item in self.db.locations:
            tz_model.append([item.human_zone, item.human_country,  None, item.country, item.longitude, item.latitude,item.zone])

        completion = TimezoneMap.TimezoneCompletion()
        completion.set_model(tz_model)
        completion.set_text_column(0)
        completion.set_inline_completion(True)
        completion.set_inline_selection(True)
        completion.connect("match-selected", self.change_timezone)
        self.locations.set_completion(completion)
        self.map.connect("location-changed", self.changed)

        self.pack_end(self.locations, False, False, 3)

        self.timezone = None
        self.timezone_human = None
        self.installer.can_go_forward(False)