示例#1
0
 def __init__(self, parent):
     Widget.__init__(self)
     self.obj = elementary.Hoversel(parent)
     self.obj.hover_parent_set(parent)
     self.obj.style_set("editje")
     self.obj.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
     self.obj.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0)
     self.obj.show()
     self.items = []
示例#2
0
    def __init__(self, amsn_core, parent):
        self._core = amsn_core
        self._parent = parent
        self._personal_info_view = None
        elementary.Layout.__init__(self, self._parent)
        self.file_set(THEME_FILE, "personal_info")

        self._dp = elementary.Button(self._parent)
        self._dp.label_set("pouet")
        self._dp.size_hint_weight_set(1.0, 1.0)
        self.content_set("dp", self._dp);
        self._dp.show()

        self._presence = elementary.Hoversel(self._parent)
        self._presence.hover_parent_set(self._parent)
        for key in self._core.p2s:
            name = self._core.p2s[key]
            _, path = self._core._theme_manager.get_statusicon("buddy_%s" % name)
            if name == 'offline': continue
            def cb(hoversel, it, key):
                hoversel.label_set(it.label_get())
                (icon_file, icon_group, icon_type) = it.icon_get()
                ic = elementary.Icon(hoversel)
                ic.scale_set(0, 1)
                if icon_type == elementary.ELM_ICON_FILE:
                    ic.file_set(icon_file, icon_group)
                else:
                    ic.standart_set(icon_file)
                hoversel.icon_set(ic)
                ic.show()
                #TODO
            self._presence.item_add(name, path, elementary.ELM_ICON_FILE, cb,
                                   key)
        self.content_set("presence", self._presence);
        self._presence.show()

        sc = elementary.Scroller(self._parent)
        sc.content_min_limit(0, 1)
        sc.policy_set(elementary.ELM_SCROLLER_POLICY_OFF,
                      elementary.ELM_SCROLLER_POLICY_OFF);
        sc.size_hint_weight_set(1.0, 0.0)
        sc.size_hint_align_set(-1.0, 0.0)
        self.content_set("nick", sc)
        self._nick = elementary.Entry(self._parent)
        self._nick.single_line_set(True)
        self._nick.size_hint_weight_set(1.0, 0.0)
        self._nick.size_hint_align_set(-1.0, 0.0)
        sc.content_set(self._nick)
        self._nick.show()
        sc.show()

        sc = elementary.Scroller(self._parent)
        sc.content_min_limit(0, 1)
        sc.policy_set(elementary.ELM_SCROLLER_POLICY_OFF,
                      elementary.ELM_SCROLLER_POLICY_OFF);
        sc.size_hint_weight_set(1.0, 0.0)
        sc.size_hint_align_set(-1.0, -1.0)
        self.content_set("psm", sc);
        self._psm = elementary.Entry(self._parent)
        self._psm.single_line_set(True)
        self._psm.size_hint_weight_set(1.0, 0.0)
        self._psm.size_hint_align_set(-1.0, -1.0)
        sc.content_set(self._psm)
        self._psm.show()
        sc.show()

        sc = elementary.Scroller(self._parent)
        sc.content_min_limit(0, 1)
        sc.policy_set(elementary.ELM_SCROLLER_POLICY_OFF,
                      elementary.ELM_SCROLLER_POLICY_OFF)
        sc.size_hint_weight_set(1.0, 0.0)
        sc.size_hint_align_set(-1.0, -1.0)
        self.content_set("current_media", sc)
        self._cm = elementary.Entry(self._parent)
        self._cm.single_line_set(True)
        self._cm.size_hint_weight_set(1.0, 0.0)
        self._cm.size_hint_align_set(-1.0, -1.0)
        sc.content_set(self._cm)
        self._cm.show()
        sc.show()
示例#3
0
文件: login.py 项目: Pythone/amsn2
class aMSNLoginWindow(base.aMSNLoginWindow):
    def __init__(self, amsn_core, parent):
        self._core = amsn_core
        self._evas = parent._evas
        self._parent = parent
        self._account_views = []

        edje.frametime_set(1.0 / 30)

        try:
            self._edje = edje.Edje(self._evas,
                                   file=THEME_FILE,
                                   group="login_screen")
        except edje.EdjeLoadError, e:
            raise SystemExit("error loading %s: %s" % (THEME_FILE, e))

        self._parent.resize_object_add(self._edje)
        self._edje.size_hint_weight_set(1.0, 1.0)
        self.show()

        sc = elementary.Scroller(self._edje)
        sc.content_min_limit(0, 1)
        sc.policy_set(elementary.ELM_SCROLLER_POLICY_OFF,
                      elementary.ELM_SCROLLER_POLICY_OFF)
        sc.size_hint_weight_set(1.0, 0.0)
        sc.size_hint_align_set(-1.0, -1.0)
        self._edje.part_swallow("login_screen.username", sc)
        self.username = elementary.Entry(self._edje)
        self.username.single_line_set(1)
        self.username.size_hint_weight_set(1.0, 0.0)
        self.username.size_hint_align_set(-1.0, -1.0)
        sc.content_set(self.username)
        self.username.show()
        sc.show()

        sc = elementary.Scroller(self._edje)
        sc.content_min_limit(0, 1)
        sc.policy_set(elementary.ELM_SCROLLER_POLICY_OFF,
                      elementary.ELM_SCROLLER_POLICY_OFF)
        sc.size_hint_weight_set(1.0, 0.0)
        sc.size_hint_align_set(-1.0, -1.0)
        self._edje.part_swallow("login_screen.password", sc)
        self.password = elementary.Entry(self._edje)
        self.password.single_line_set(1)
        self.password.password_set(1)
        self.password.size_hint_weight_set(1.0, 1.0)
        self.password.size_hint_align_set(-1.0, -1.0)
        sc.content_set(self.password)
        self.password.show()
        sc.show()

        self.presence = elementary.Hoversel(self._edje)
        self.presence.hover_parent_set(self._parent)
        for key in self._core.p2s:
            name = self._core.p2s[key]
            _, path = self._core._theme_manager.get_statusicon("buddy_%s" %
                                                               name)
            if name == 'offline': continue

            def cb(hoversel, it, key):
                hoversel.label_set(it.label_get())
                (icon_file, icon_group, icon_type) = it.icon_get()
                ic = elementary.Icon(hoversel)
                ic.scale_set(0, 1)
                if icon_type == elementary.ELM_ICON_FILE:
                    ic.file_set(icon_file, icon_group)
                else:
                    ic.standart_set(icon_file)
                hoversel.icon_set(ic)
                ic.show()
                self.presence_key = data

            self.presence.item_add(name, path, elementary.ELM_ICON_FILE, cb,
                                   key)

        self.presence_key = self._core.Presence.ONLINE
        self.presence.label_set(self._core.p2s[self.presence_key])
        ic = elementary.Icon(self.presence)
        ic.scale_set(0, 1)
        _, path = self._core._theme_manager.get_statusicon(
            "buddy_%s" % self._core.p2s[self.presence_key])
        ic.file_set(path)
        self.presence.icon_set(ic)
        ic.show()
        self.presence.size_hint_weight_set(0.0, 0.0)
        self.presence.size_hint_align_set(0.5, 0.5)
        self._edje.part_swallow("login_screen.presence", self.presence)
        self.presence.show()

        self.save = elementary.Check(self._edje)
        self.save.label_set("Remember Me")

        def cb(obj):
            if obj.state_get():
                self.save_password.disabled_set(False)
            else:
                self.save_password.disabled_set(True)
                self.save_password.state_set(False)
                self.autologin.disabled_set(True)
                self.autologin.state_set(False)

        self.save.callback_changed_add(cb)
        self._edje.part_swallow("login_screen.remember_me", self.save)
        self.save.show()

        self.save_password = elementary.Check(self._edje)
        self.save_password.label_set("Remember Password")
        self.save_password.disabled_set(True)

        def cb(obj):
            if obj.state_get():
                self.autologin.disabled_set(False)
            else:
                self.autologin.disabled_set(True)
                self.autologin.state_set(False)

        self.save_password.callback_changed_add(cb)
        self._edje.part_swallow("login_screen.remember_password",
                                self.save_password)
        self.save_password.show()

        self.autologin = elementary.Check(self._edje)
        self.autologin.label_set("Auto Login")
        self.autologin.disabled_set(True)
        self._edje.part_swallow("login_screen.auto_login", self.autologin)
        self.autologin.show()

        if self._edje.part_exists("login_screen.signin"):
            self.signin_b = elementary.Button(self._edje)
            self.signin_b.label_set("Sign in")
            self.signin_b.callback_clicked_add(self.__signin_button_cb)
            self.signin_b.show()
            self._edje.part_swallow("login_screen.signin", self.signin_b)
        else:
            self._edje.signal_callback_add("signin", "*", self.__signin_cb)
示例#4
0
文件: test_map.py 项目: yihan5523/e17
def map_clicked(obj):
    win = elementary.Window("map", elementary.ELM_WIN_BASIC)
    win.title = "Map test"
    win.autodel = True
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    bg = elementary.Background(win)
    win.resize_object_add(bg)
    bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    bg.show()

    vbox = elementary.Box(win)
    vbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    vbox.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    win.resize_object_add(vbox)
    vbox.show()

    Map = elementary.Map(win)
    Map.zoom = 2
    Map.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    Map.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    # Map.callback_clicked_add(cb_map_clicked)
    vbox.pack_end(Map)
    Map.show()

    # view
    hbox = elementary.Box(win)
    hbox.horizontal = True
    hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
    hbox.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
    vbox.pack_end(hbox)
    hbox.show()

    bt = elementary.Button(win)
    bt.text = "Zoom +"
    bt.callback_clicked_add(cb_btn_zoom, Map, 1)
    hbox.pack_end(bt)
    bt.show()

    bt = elementary.Button(win)
    bt.text = "Zoom -"
    bt.callback_clicked_add(cb_btn_zoom, Map, -1)
    hbox.pack_end(bt)
    bt.show()

    sl = elementary.Slider(win)
    sl.text = "Rotation:"
    sl.min_max = (0, 360)
    sl.value = 0
    sl.indicator_format = "%3.0f"
    sl.callback_changed_add(cb_slider_rot, Map)
    hbox.pack_end(sl)
    sl.show()

    ho = elementary.Hoversel(win)
    ho.hover_parent_set(win)
    type = elementary.ELM_MAP_SOURCE_TYPE_TILE
    ho.text_set("Tiles: %s" % (Map.source_get(type)))
    for src in Map.sources_get(type):
        ho.item_add(src)
    ho.callback_selected_add(cb_hovsel_selected, Map, type)
    hbox.pack_end(ho)
    ho.show()

    # show / bring in
    hbox = elementary.Box(win)
    hbox.horizontal = True
    hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
    hbox.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
    vbox.pack_end(hbox)
    hbox.show()

    bt = elementary.Button(win)
    bt.text = "Show Sydney"
    bt.callback_clicked_add(cb_btn_show, Map, 151.175274, -33.859126)
    hbox.pack_end(bt)
    bt.show()

    bt = elementary.Button(win)
    bt.text = "Show Paris"
    bt.callback_clicked_add(cb_btn_show, Map, 2.342913, 48.853701)
    hbox.pack_end(bt)
    bt.show()

    bt = elementary.Button(win)
    bt.text = "BringIn Sydney"
    bt.callback_clicked_add(cb_btn_bringin, Map, 151.175274, -33.859126)
    hbox.pack_end(bt)
    bt.show()

    bt = elementary.Button(win)
    bt.text = "BringIn Paris"
    bt.callback_clicked_add(cb_btn_bringin, Map, 2.342913, 48.853701)
    hbox.pack_end(bt)
    bt.show()

    hbox = elementary.Box(win)
    hbox.horizontal = True
    hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
    hbox.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
    vbox.pack_end(hbox)
    hbox.show()

    # options
    ck = elementary.Check(win)
    ck.text = "wheel_disabled"
    ck.callback_changed_add(lambda bt: Map.wheel_disabled_set(bt.state))
    hbox.pack_end(ck)
    ck.show()

    ck = elementary.Check(win)
    ck.text = "paused"
    ck.callback_changed_add(lambda bt: Map.paused_set(bt.state))
    hbox.pack_end(ck)
    ck.show()

    print_map_info(Map)

    win.resize(600, 600)
    win.show()
示例#5
0
    def __init__(self, amsn_core, win):
        self._core = amsn_core
        self._evas = win._evas
        self._win = win
        self._account_views = []
        self._ui_manager = self._core._ui_manager

        edje.frametime_set(1.0 / 30)

        elementary.Layout.__init__(self, win)
        self.file_set(THEME_FILE, "amsn2/login_screen")

        self._edje = self.edje_get()

        self.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
        self.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)

        sc = elementary.Scroller(self)
        sc.content_min_limit(0, 1)
        sc.policy_set(elementary.ELM_SCROLLER_POLICY_OFF,
                      elementary.ELM_SCROLLER_POLICY_OFF)
        sc.size_hint_weight_set(1.0, 0.0)
        sc.size_hint_align_set(-1.0, -1.0)
        self.content_set("username", sc)
        self.username = elementary.Entry(self)
        self.username.single_line_set(1)
        self.username.size_hint_weight_set(1.0, 0.0)
        self.username.size_hint_align_set(-1.0, -1.0)
        sc.content_set(self.username)
        self.username.show()
        sc.show()

        sc = elementary.Scroller(self)
        sc.content_min_limit(0, 1)
        sc.policy_set(elementary.ELM_SCROLLER_POLICY_OFF,
                      elementary.ELM_SCROLLER_POLICY_OFF)
        sc.size_hint_weight_set(1.0, 0.0)
        sc.size_hint_align_set(-1.0, -1.0)
        self.content_set("password", sc)
        self.password = elementary.Entry(self)
        self.password.single_line_set(1)
        self.password.password_set(1)
        self.password.size_hint_weight_set(1.0, 1.0)
        self.password.size_hint_align_set(-1.0, -1.0)
        sc.content_set(self.password)
        self.password.show()
        sc.show()

        self.presence = elementary.Hoversel(self)
        self.presence.hover_parent_set(self._win)
        for key in self._core.p2s:
            name = self._core.p2s[key]
            _, path = self._core._theme_manager.get_statusicon("buddy_%s" %
                                                               name)
            if name == 'offline': continue

            def cb(hoversel, it, key):
                hoversel.label_set(it.label_get())
                (icon_file, icon_group, icon_type) = it.icon_get()
                ic = elementary.Icon(hoversel)
                ic.scale_set(0, 1)
                if icon_type == elementary.ELM_ICON_FILE:
                    ic.file_set(icon_file, icon_group)
                else:
                    ic.standart_set(icon_file)
                hoversel.icon_set(ic)
                ic.show()
                self.presence_key = data

            self.presence.item_add(name, path, elementary.ELM_ICON_FILE, cb,
                                   key)

        self.presence_key = self._core.Presence.ONLINE
        self.presence.label_set(self._core.p2s[self.presence_key])
        ic = elementary.Icon(self.presence)
        ic.scale_set(0, 1)
        _, path = self._core._theme_manager.get_statusicon(
            "buddy_%s" % self._core.p2s[self.presence_key])
        ic.file_set(path)
        self.presence.icon_set(ic)
        ic.show()
        self.presence.size_hint_weight_set(0.0, 0.0)
        self.presence.size_hint_align_set(0.5, 0.5)
        self.content_set("presence", self.presence)
        self.presence.show()

        self.save = elementary.Check(self)
        self.save.label_set("Remember Me")

        def cb(obj):
            if obj.state_get():
                self.save_password.disabled_set(False)
            else:
                self.save_password.disabled_set(True)
                self.save_password.state_set(False)
                self.autologin.disabled_set(True)
                self.autologin.state_set(False)

        self.save.callback_changed_add(cb)
        self.content_set("remember_me", self.save)
        self.save.show()

        self.save_password = elementary.Check(self)
        self.save_password.label_set("Remember Password")
        self.save_password.disabled_set(True)

        def cb(obj):
            if obj.state_get():
                self.autologin.disabled_set(False)
            else:
                self.autologin.disabled_set(True)
                self.autologin.state_set(False)

        self.save_password.callback_changed_add(cb)
        self.content_set("remember_password", self.save_password)
        self.save_password.show()

        self.autologin = elementary.Check(self)
        self.autologin.label_set("Auto Login")
        self.autologin.disabled_set(True)
        self.content_set("auto_login", self.autologin)
        self.autologin.show()

        if self._edje.part_exists("signin"):
            self.signin_b = elementary.Button(self)
            self.signin_b.label_set("Sign in")
            self.signin_b.callback_clicked_add(self.__signin_button_cb)
            self.signin_b.show()
            self.content_set("signin", self.signin_b)
        else:
            self._edje.signal_callback_add("signin", "*", self.__signin_cb)

        self._win.child = self
        self.show()
示例#6
0
def hoversel_clicked(obj):
    win = elementary.Window("hoversel", elementary.ELM_WIN_BASIC)
    win.title_set("Hoversel")
    win.autodel_set(True)
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    bg = elementary.Background(win)
    win.resize_object_add(bg)
    bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    bg.show()

    bx = elementary.Box(win)
    win.resize_object_add(bx)
    bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    bx.show()

    bt = elementary.Hoversel(win)
    bt.hover_parent_set(win)
    bt.text_set("Labels")
    bt.item_add("Item 1")
    bt.item_add("Item 2")
    bt.item_add("Item 3")
    bt.item_add("Item 4 - Long Label Here")
    bt.size_hint_weight_set(0.0, 0.0)
    bt.size_hint_align_set(0.5, 0.5)
    bx.pack_end(bt)
    bt.show()

    bt = elementary.Hoversel(win)
    bt.hover_parent_set(win)
    bt.text_set("Some Icons")
    bt.item_add("Item 1")
    bt.item_add("Item 2")
    bt.item_add("Item 3", "home", elementary.ELM_ICON_STANDARD)
    bt.item_add("Item 4", "close", elementary.ELM_ICON_STANDARD)
    bt.size_hint_weight_set(0.0, 0.0)
    bt.size_hint_align_set(0.5, 0.5)
    bx.pack_end(bt)
    bt.show()

    bt = elementary.Hoversel(win)
    bt.hover_parent_set(win)
    bt.text_set("All Icons")
    bt.item_add("Item 1", "apps", elementary.ELM_ICON_STANDARD)
    bt.item_add("Item 2", "arrow_down", elementary.ELM_ICON_STANDARD)
    bt.item_add("Item 3", "home", elementary.ELM_ICON_STANDARD)
    bt.item_add("Item 4", "close", elementary.ELM_ICON_STANDARD)
    bt.size_hint_weight_set(0.0, 0.0)
    bt.size_hint_align_set(0.5, 0.5)
    bx.pack_end(bt)
    bt.show()

    bt = elementary.Hoversel(win)
    bt.hover_parent_set(win)
    bt.text_set("All Icons")
    bt.item_add("Item 1", "apps", elementary.ELM_ICON_STANDARD)
    bt.item_add("Item 2", "images/logo_small.png", elementary.ELM_ICON_FILE)
    bt.item_add("Item 3", "home", elementary.ELM_ICON_STANDARD)
    bt.item_add("Item 4", "close", elementary.ELM_ICON_STANDARD)
    bt.size_hint_weight_set(0.0, 0.0)
    bt.size_hint_align_set(0.5, 0.5)
    bx.pack_end(bt)
    bt.show()

    bt = elementary.Hoversel(win)
    bt.hover_parent_set(win)
    bt.text_set("Disabled Hoversel")
    bt.item_add("Item 1", "apps", elementary.ELM_ICON_STANDARD)
    bt.item_add("Item 2", "close", elementary.ELM_ICON_STANDARD)
    bt.disabled_set(True)
    bt.size_hint_weight_set(0.0, 0.0)
    bt.size_hint_align_set(0.5, 0.5)
    bx.pack_end(bt)
    bt.show()

    bt = elementary.Hoversel(win)
    bt.hover_parent_set(win)
    bt.text_set("Icon + Label")

    ic = elementary.Icon(win)
    ic.file_set("images/sky_03.jpg")
    bt.content_set(ic)
    ic.show()

    bt.item_add("Item 1", "apps", elementary.ELM_ICON_STANDARD)
    bt.item_add("Item 2", "arrow_down", elementary.ELM_ICON_STANDARD)
    bt.item_add("Item 3", "home", elementary.ELM_ICON_STANDARD)
    bt.item_add("Item 4", "close", elementary.ELM_ICON_STANDARD)
    bt.size_hint_weight_set(0.0, 0.0)
    bt.size_hint_align_set(0.5, 0.5)
    bx.pack_end(bt)
    bt.show()

    win.resize(320, 320)
    win.show()
示例#7
0
def map_route_clicked(obj):
    win = elementary.Window("maproute", elementary.ELM_WIN_BASIC)
    win.title = "Map Route test"
    win.autodel = True
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    bg = elementary.Background(win)
    win.resize_object_add(bg)
    bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    bg.show()

    vbox = elementary.Box(win)
    vbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    vbox.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    win.resize_object_add(vbox)
    vbox.show()

    Map = elementary.Map(win)
    Map.zoom = 2
    Map.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    Map.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    Map.callback_clicked_add(cb_map_clicked)
    Map.callback_tile_load_add(cb_map_load)
    Map.callback_tile_loaded_add(cb_map_load)
    vbox.pack_end(Map)
    Map.show()

    lb = elementary.Label(win)
    lb.text = "load_status: 0 / 0"
    vbox.pack_end(lb)
    lb.show()
    Map.data["lb_load_status"] = lb

    lb = elementary.Label(win)
    lb.text = "First set Start and End point and then click 'Calc Route !'"
    vbox.pack_end(lb)
    lb.show()
    Map.data["lb_distance"] = lb

    # info
    hbox = elementary.Box(win)
    hbox.horizontal = True
    hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
    hbox.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
    vbox.pack_end(hbox)
    hbox.show()

    # route
    ho = elementary.Hoversel(win)
    ho.hover_parent_set(win)
    type = elementary.ELM_MAP_SOURCE_TYPE_ROUTE
    ho.text_set("Routes: %s" % (Map.source_get(type)))
    for src in Map.sources_get(type):
        ho.item_add(src)
    ho.callback_selected_add(cb_hovsel_selected, Map, type, "Routes")
    hbox.pack_end(ho)
    ho.show()

    sep = elementary.Separator(win)
    sep.show()
    hbox.pack_end(sep)

    bt = elementary.Button(win)
    bt.text = "GOTO"
    bt.callback_clicked_add(cb_btn_goto, Map)
    hbox.pack_end(bt)
    bt.show()

    bt = elementary.Button(win)
    bt.text = "Calc Route !"
    bt.callback_clicked_add(cb_btn_calc_route, Map)
    hbox.pack_end(bt)
    bt.show()

    bt = elementary.Button(win)
    bt.text = "clear route overlays"
    bt.callback_clicked_add(cb_btn_clear_overlays, Map)
    hbox.pack_end(bt)
    bt.show()

    # names
    hbox = elementary.Box(win)
    hbox.horizontal = True
    hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
    hbox.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
    vbox.pack_end(hbox)
    hbox.show()

    ho = elementary.Hoversel(win)
    ho.hover_parent_set(win)
    type = elementary.ELM_MAP_SOURCE_TYPE_NAME
    ho.text_set("Names: %s" % (Map.source_get(type)))
    for src in Map.sources_get(type):
        ho.item_add(src)
    ho.callback_selected_add(cb_hovsel_selected, Map, type, "Names")
    hbox.pack_end(ho)
    ho.show()

    en = elementary.Entry(win)
    en.scrollable = True
    en.single_line = True
    en.text = "type an address here"
    en.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    en.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    hbox.pack_end(en)
    en.show()

    bt = elementary.Button(win)
    bt.text = "Search Address !"
    bt.callback_clicked_add(cb_btn_search_name, Map, en)
    hbox.pack_end(bt)
    bt.show()

    hbox = elementary.Box(win)
    hbox.horizontal = True
    hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
    hbox.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
    vbox.pack_end(hbox)
    hbox.show()

    en = elementary.Entry(win)
    en.scrollable = True
    en.single_line = True
    en.disabled = True
    en.text = "place the start point and press the button"
    en.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    en.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    hbox.pack_end(en)
    en.show()

    bt = elementary.Button(win)
    bt.text = "Search start point Region"
    bt.callback_clicked_add(cb_btn_search_region, Map, en)
    hbox.pack_start(bt)
    bt.show()

    win.resize(600, 600)
    win.show()
示例#8
0
def slideshow_clicked(obj):
    win = elementary.StandardWindow("slideshow", "Slideshow")
    win.autodel = True

    ss = elementary.Slideshow(win)
    ss.loop = True
    win.resize_object_add(ss)
    ss.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    ss.show()

    ssc = ssClass()
    ss.item_add(ssc, img1)
    ss.item_add(ssc, img2)
    ss.item_add(ssc, img3)
    ss.item_add(ssc, img4)
    ss.item_add(ssc, img9)
    ss.item_add(ssc, img5)
    ss.item_add(ssc, img6)
    ss.item_add(ssc, img7)
    slide_last_it = ss.item_add(ssc, img8)
    ss.callback_transition_end_add(slide_transition, slide_last_it)

    no = elementary.Notify(win)
    no.orient = elementary.ELM_NOTIFY_ORIENT_BOTTOM
    no.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    win.resize_object_add(no)
    no.timeout = 3.0

    bx = elementary.Box(win)
    bx.horizontal = True
    no.content = bx
    bx.show()

    bx.event_callback_add(evas.EVAS_CALLBACK_MOUSE_IN, mouse_in, no)
    bx.event_callback_add(evas.EVAS_CALLBACK_MOUSE_OUT, mouse_out, no)

    bt = elementary.Button(win)
    bt.text = "Previous"
    bt.callback_clicked_add(previous, ss)
    bx.pack_end(bt)
    bt.show()

    bt = elementary.Button(win)
    bt.text = "Next"
    bt.callback_clicked_add(next, ss)
    bx.pack_end(bt)
    bt.show()

    hv = elementary.Hoversel(win)
    bx.pack_end(hv)
    hv.hover_parent = win
    for transition in ss.transitions:
        hv.item_add(transition, None, 0, hv_select, ss, transition)
    hv.item_add("None", None, 0, hv_select, ss, None)
    hv.text_set(ss.transitions[0])
    hv.show()

    hv = elementary.Hoversel(win)
    bx.pack_end(hv)
    hv.hover_parent = win
    for layout in ss.layouts:
        hv.item_add(layout, None, 0, layout_select, ss, layout)
    hv.text = ss.layout
    hv.show()

    sp = elementary.Spinner(win)
    sp.label_format = "%2.0f secs."
    sp.callback_changed_add(spin, ss)
    sp.step = 1
    sp.min_max = (1, 30)
    sp.value = 3
    bx.pack_end(sp)
    sp.show()

    bt_start = elementary.Button(win)
    bt_stop = elementary.Button(win)

    bt = bt_start
    bt.text = "Start"
    bt.callback_clicked_add(start, ss, sp, bt_start, bt_stop)
    bx.pack_end(bt)
    bt.show()

    bt = bt_stop
    bt.text = "Stop"
    bt.callback_clicked_add(stop, ss, sp, bt_start, bt_stop)
    bx.pack_end(bt)
    bt.disabled = True
    bt.show()

    ss.event_callback_add(evas.EVAS_CALLBACK_MOUSE_UP, notify_show, no)
    ss.event_callback_add(evas.EVAS_CALLBACK_MOUSE_MOVE, notify_show, no)

    win.resize(500, 400)
    win.show()