def ctxpopup_clicked(obj): win = elementary.Window("ctxpopup", elementary.ELM_WIN_BASIC) win.title = "Context popup 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() li = elementary.List(win) win.resize_object_add(li) li.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) li.mode = elementary.ELM_LIST_COMPRESS li.show() li.item_append("Ctxpopup with icons and labels", callback=cb_item1) li.item_append("Ctxpopup with icons only", callback=cb_item2) li.item_append("Ctxpopup with labels only", callback=cb_item3) li.item_append("Ctxpopup at horizontal mode", callback=cb_item4) li.item_append("Ctxpopup with user content", callback=cb_item5) li.item_append("Ctxpopup with restacking", callback=cb_item6) li.go() win.resize(400, 400) win.show()
def _group_selected_cb(self, li, it): group = it.label_get() self._group = group self._options_edje.part_text_set("group_name", group) self.options = True parts_list = elementary.List(self._pager) parts_list.bounce_set(False, False) parts_list.callback_selected_add(self._widget_selected_cb) types = self._loaded_types[group] types.sort(key=lambda x: (str.lower(x[0]))) for widget in types: ico = None if widget[1] == edje.EDJE_PART_TYPE_EXTERNAL: ico = widget[2].icon_add(self.evas) parts_list.item_append(widget[0], ico, None, None, widget) parts_list.go() parts_list.show() it.selected = False self._pager.item_simple_push(parts_list)
def _content_load(self): self._list = elementary.List(self._parent) self._list.style_set("editje.collapsable") self._list.bounce_set(False, False) self._list.callback_selected_add(self._selected_cb) self._list.callback_unselected_add(self._unselected_cb) self.content_set("content", self._list) self._list.show()
def _types_init(self): self._types = elementary.List(self) self._types.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) self._types.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) self.pack_end(self._types) self._types.show()
def _floater_content_init(self): self._floater_list = elementary.List(self._floater) self._floater_list.scroller_policy_set( elementary.ELM_SCROLLER_POLICY_OFF, elementary.ELM_SCROLLER_POLICY_ON) self._floater_list.callback_selected_add(self._floater_list_select_cb) self._floater.content_set(self._floater_list) self._floater_list.show()
def cursor_clicked(obj, item=None): win = elementary.Window("cursors", elementary.ELM_WIN_BASIC) win.title_set("Cursors") win.autodel_set(True) 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() ck = elementary.Clock(win) ck.cursor_set(cursors.ELM_CURSOR_CLOCK) bx.pack_end(ck) ck.show() bt = elementary.Button(win) bt.text_set("Coffee Mug") bt.cursor_set(cursors.ELM_CURSOR_COFFEE_MUG) bx.pack_end(bt) bt.show() bt = elementary.Button(win) bt.text_set("Cursor unset") bt.cursor_set(cursors.ELM_CURSOR_BOGOSITY) bt.cursor_unset() bx.pack_end(bt) bt.show() lst = elementary.List(win) lst.item_append("watch over list") lst.item_append("watch over list") lst.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) lst.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) lst.cursor_set(cursors.ELM_CURSOR_WATCH) bx.pack_end(lst) lst.go() lst.show() en = elementary.Entry(win) en.scrollable_set(True) en.single_line_set(True) en.entry_set("Xterm cursor") en.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) en.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5) en.cursor_set(cursors.ELM_CURSOR_XTERM) bx.pack_end(en) en.show() win.resize(320, 480) win.show()
def __init__(self, parent, new_anim_cb=None, anims_list_cb=None, parts_list_cb=None): if not new_anim_cb or not anims_list_cb: raise TypeError("You must set callbacks for animations retrieval" " and creation on NewAnimationWizard objects.") Wizard.__init__(self, parent) self.page_add("default", "New Animation", "Name the new animation to be created.", separator=True) self._anim_name_entry = NameEntry(self, changed_cb=self._name_changed_cb, weight_hints=(evas.EVAS_HINT_EXPAND, 0.0), align_hints=(evas.EVAS_HINT_FILL, 0.5)) self.content_add("default", self._anim_name_entry) self._anim_name_entry.show() lbl = elementary.Label(self) lbl.text_set("Select the parts to use in the animation." " An empty selection will use all parts.") self.content_add("default", lbl) lbl.show() self._parts_list = elementary.List(self) self._parts_list.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) self._parts_list.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) if parts_list_cb: for p in parts_list_cb(): self._parts_list.item_append(p) self._parts_list.multi_select = True self._parts_list.go() self.content_add("default", self._parts_list) self._parts_list.show() self.alternate_background_set(True) self.action_add("default", "Cancel", self._cancel, key="Escape") self.action_add("default", "Add", self._add, key="Return") self.action_disabled_set("default", "Add", True) self._new_anim_cb = new_anim_cb self._anims_list_cb = anims_list_cb
def _navigator_init(self): bx = elementary.Box(self) bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bx.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) self.pack(bx, 0, 0, 1, 4) bx.show() self._nav_home = elementary.Button(self) self._nav_home.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) self._nav_home.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0) self._nav_home.text_set("Home") ic = elementary.Icon(self) ic.standard_set("home") ic.resizable_set(0, 0) self._nav_home.content_set(ic) self._nav_home.callback_clicked_add(self._home_load) bx.pack_end(self._nav_home) self._nav_home.show() sp = elementary.Separator(self) sp.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0) sp.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) sp.horizontal_set(True) bx.pack_end(sp) sp.show() self._nav_up = elementary.Button(self) self._nav_up.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) self._nav_up.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0) self._nav_up.text_set("Up") ic = elementary.Icon(self) ic.standard_set("arrow_up") ic.resizable_set(0, 0) self._nav_up.content_set(ic) self._nav_up.callback_clicked_add(self._parent_load) bx.pack_end(self._nav_up) self._nav_up.show() self._directories = elementary.List(self) self._directories.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) self._directories.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) self._directories.callback_selected_add(self._folder_change) bx.pack_end(self._directories) self._directories.show()
def cursor2_clicked(obj, item=None): win = elementary.Window("cursors", elementary.ELM_WIN_BASIC) win.title_set("Cursors 2") win.autodel_set(True) 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() tb = elementary.Toolbar(win) ti = tb.item_append("folder-new", "Bogosity", None, None) ti.cursor_set(cursors.ELM_CURSOR_BOGOSITY) ti = tb.item_append("clock", "Unset", None, None) ti.cursor_set(cursors.ELM_CURSOR_BOGOSITY) ti.cursor_unset() ti = tb.item_append("document-print", "Xterm", None, None) ti.cursor_set(cursors.ELM_CURSOR_XTERM) tb.size_hint_weight_set(0.0, 0.0) tb.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0) bx.pack_end(tb) tb.show() lst = elementary.List(win) li = lst.item_append("cursor bogosity") li.cursor_set(cursors.ELM_CURSOR_BOGOSITY) li = lst.item_append("cursor unset") li.cursor_set(cursors.ELM_CURSOR_BOGOSITY) li.cursor_unset() li = lst.item_append("cursor xterm") li.cursor_set(cursors.ELM_CURSOR_XTERM) lst.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) lst.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) bx.pack_end(lst) lst.go() lst.show() win.resize(320, 480) win.show()
def _content_load(self): self._pager = elementary.Naviframe(self) self._pager.style_set("editje.rightwards") self._pager.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) self._pager.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) self.content_set("content", self._pager) self._groups_list = elementary.List(self._pager) self._groups_list.style_set("editje.collapsable") self._groups_list.bounce_set(False, False) self._groups_list.callback_selected_add(self._group_selected_cb) for group in self._loaded_types.keys(): self._groups_list.item_append(group) self._groups_list.go() self._groups_list.show() self._pager.item_simple_push(self._groups_list)
def _files_init(self): self._right_bx = elementary.Box(self) self._right_bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) self._right_bx.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) self.pack(self._right_bx, 1, 0, 3, 4) self._right_bx.show() self._nav_path = elementary.Entry(self) self._nav_path.scrollable_set(True) self._nav_path.single_line_set(True) self._nav_path.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) self._nav_path.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) self._nav_path.editable_set(False) self._nav_path.entry_set("PATH") self._nav_path.callback_anchor_clicked_add(self._path_go) self._nav_path.callback_changed_add(self._path_change) self._right_bx.pack_end(self._nav_path) self._nav_path.show() self._files = elementary.List(self) self._files.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) self._files.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) self._files.callback_selected_add(self._file_selected) self._files.callback_unselected_add(self._file_unselected) self._files.callback_activated_add(self._file_clicked) self._right_bx.pack_end(self._files) self._files.show() self._file_entry = elementary.Entry(self) self._file_entry.scrollable_set(True) self._file_entry.single_line_set(True) self._file_entry.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) self._file_entry.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5) self._file_entry.editable_set(True) self._file_entry.entry_set("") self._file_entry.callback_changed_add(self._file_entry_change) self._right_bx.pack_end(self._file_entry)
def popup_clicked(obj): win = elementary.Window("popup", elementary.ELM_WIN_BASIC) win.title_set("Popup test") 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 = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() li = elementary.List(win) li.mode = elementary.ELM_LIST_LIMIT li.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) li.callback_selected_add(lambda li, it: it.selected_set(False)) win.resize_object_add(li) li.show() li.item_append("popup-center-text", None, None, cb_popup_center_text, win) li.item_append("popup-center-text + 1 button", None, None, cb_popup_center_title_text_1button, win) li.item_append("popup-center-title + text + 1 button", None, None, cb_popup_center_title_text_1button, win) li.item_append("popup-center-title + text (block,clicked handling)", None, None, cb_popup_center_title_text_block_clicked_event, win) li.item_append("popup-bottom-title + text + 3 buttons", None, None, cb_popup_bottom_title_text_3button, win) li.item_append("popup-center-title + content + 3 buttons", None, None, cb_popup_center_title_content_3button, win) li.item_append("popup-center-title + items + 3 buttons", None, None, cb_popup_center_title_item_3button, win) li.item_append("popup-center-title + text + 2 buttons (check restacking)", None, None, cb_popup_center_title_text_2button_restack, win) li.item_append("popup-center-text + 1 button (check hide, show)", None, None, cb_popup_center_text_1button_hide_show, win) li.go() win.resize(480, 800) win.show()
def selectPet(self): dia = elementary.InnerWindow(self.win) new = elementary.Button(dia) new.label_set('New pet') new._callback_add('clicked', partial(self.newPet, dia)) new.show() list = elementary.List(dia) list.size_hint_align_set(-1.0, -1.0) list.size_hint_weight_set(1.0, 1.0) petlist = self.parent.getPets() for pet in petlist: list.item_append(str(pet), None, None, partial(self.loadPet, pet, dia)) list.go() list.show() box = elementary.Box(dia) box.pack_start(list) box.pack_end(new) box.show() dia.content_set(box) self.win.resize_object_add(dia) dia.show() dia.activate()
elementary.init() win = elementary.Window("test", elementary.ELM_WIN_BASIC) win.title_set("List") win.callback_destroy_add(destroy) bg = elementary.Background(win) win.resize_object_add(bg) bg.show() box0 = elementary.Box(win) win.resize_object_add(box0) box0.show() items = [("test1", bt_clicked_ok), ("test2", bt_clicked_ko)] li = elementary.List(win) li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) li.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) box0.pack_end(li) li.show() for item in items: li.item_append(item[0], callback=item[1]) li.go() win.resize(250, 200) win.show() elementary.run() elementary.shutdown()
def tooltip_clicked(obj): win = elementary.Window("tooltips", elementary.ELM_WIN_BASIC) win.title_set("Tooltips") 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() tb = elementary.Toolbar(win) tb.homogeneous_set(False) tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) tb.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0) bx.pack_end(tb) tb.show() ti = tb.item_append("folder-new", "Open", None, None) ti.tooltip_text_set("Opens a file") ti = tb.item_append("clock", "Icon", None, None) ti.tooltip_content_cb_set(_tt_item_icon, None) ti.tooltip_style_set("transparent") bt = elementary.Button(win) bt.text_set("Simple text tooltip") bt.tooltip_text_set("Simple text tooltip") bx.pack_end(bt) bt.show() def _tt_text_replace(obj, data): value = data.get("value") if not value: value = 1 obj.tooltip_text_set("count=%d" % value) value += 1 data["value"] = value bt = elementary.Button(win) bt.text_set("Simple text tooltip, click to change") bt.tooltip_text_set("Initial") data = dict() bt.callback_clicked_add(_tt_text_replace, data) bx.pack_end(bt) bt.show() def _tt_text_replace_timer_cb(obj, data): _tt_text_replace(obj, data) return True def _tt_text_replace_timed(obj, data, *args, **kargs): timer = data.get("timer") if timer: timer.delete() del data["timer"] obj.text_set("Simple text tooltip, click to start changed timed") return data["timer"] = ecore.timer_add(1.5, _tt_text_replace_timer_cb, obj, data) obj.text_set("Simple text tooltip, click to stop changed timed") bt = elementary.Button(win) bt.text_set("Simple text tooltip, click to start changed timed") bt.tooltip_text_set("Initial") data = dict() bt.callback_clicked_add(_tt_text_replace_timed, data) bx.pack_end(bt) bt.show() bt.on_del_add(_tt_timer_del, data) bt = elementary.Button(win) bt.text_set("Icon tooltip") bt.tooltip_content_cb_set(_tt_icon, None) bx.pack_end(bt) bt.show() def _tt_icon_replace_timer_cb(obj, data): value = data.get("value") data["value"] = not value if value: obj.tooltip_content_cb_set(_tt_icon) else: obj.tooltip_content_cb_set(_tt_icon2) return True def _tt_icon_replace_timed(obj, data, *args, **kargs): timer = data.get("timer") if timer: timer.delete() del data["timer"] obj.text_set("Icon tooltip, click to start changed timed") return data["timer"] = ecore.timer_add(1.5, _tt_icon_replace_timer_cb, obj, data) obj.text_set("Icon tooltip, click to stop changed timed") bt = elementary.Button(win) bt.text_set("Icon tooltip, click to start changed timed") bt.tooltip_content_cb_set(_tt_icon) data = dict() bt.callback_clicked_add(_tt_icon_replace_timed, data) bx.pack_end(bt) bt.show() bt.on_del_add(_tt_timer_del, data) bt = elementary.Button(win) bt.text_set("Transparent Icon tooltip") bt.tooltip_content_cb_set(_tt_icon, None) bt.tooltip_style_set("transparent") bx.pack_end(bt) bt.show() def _tt_style_replace_timer_cb(obj, data): value = data.get("value") data["value"] = not value if value: obj.tooltip_style_set() else: obj.tooltip_style_set("transparent") return True def _tt_style_replace_timed(obj, data, *args, **kargs): timer = data.get("timer") if timer: timer.delete() del data["timer"] obj.text_set("Icon tooltip style, click to start changed timed") return data["timer"] = ecore.timer_add(1.5, _tt_style_replace_timer_cb, obj, data) obj.text_set("Icon tooltip, click to stop changed timed") bt = elementary.Button(win) bt.text_set("Icon tooltip style, click to start changed timed") bt.tooltip_content_cb_set(_tt_icon, None) data = dict() bt.callback_clicked_add(_tt_style_replace_timed, data) bx.pack_end(bt) bt.show() bt.on_del_add(_tt_timer_del, data) def _tt_visible_lock_toggle(obj, data, *args, **kargs): value = data.get("value") data["value"] = not value if value: obj.text_set("Unlocked tooltip visibility") obj.tooltip_hide() else: obj.text_set("Locked tooltip visibility") obj.tooltip_show() bt = elementary.Button(win) bt.text_set("Unlocked tooltip visibility") bt.tooltip_text_set( "This tooltip is unlocked visible,<br> clock the button to lock!") data = dict() bt.callback_clicked_add(_tt_visible_lock_toggle, data) bx.pack_end(bt) bt.show() en = elementary.Entry(win) en.scrollable_set(True) en.single_line_set(True) en.entry_set("Hello, some scrolled entry here!") en.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) en.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5) en.tooltip_text_set("Type something here!") bx.pack_end(en) en.show() lst = elementary.List(win) li = lst.item_append("Hello") li.tooltip_text_set("Something useful here?") li = lst.item_append("Icon Tooltip") li.tooltip_content_cb_set(_tt_item_icon, None) lst.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) lst.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) lst.size_hint_min_set(100, 100) bx.pack_end(lst) lst.go() lst.show() win.show() win.resize(400, 500)
def list3_clicked(obj, item=None): win = elementary.Window("list-3", elementary.ELM_WIN_BASIC) win.title_set("List 3") win.autodel_set(True) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() li = elementary.List(win) win.resize_object_add(li) li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) li.mode_set(elementary.ELM_LIST_COMPRESS) ic = elementary.Icon(win) ic.file_set('images/logo_small.png') li.item_append("Hello", ic) ic = elementary.Icon(win) ic.file_set('images/logo_small.png') ic.resizable_set(0, 0) li.item_append("world", ic) ic = elementary.Icon(win) ic.standard_set("edit") ic.resizable_set(0, 0) li.item_append(".", ic) ic = elementary.Icon(win) ic.standard_set("delete") ic.resizable_set(0, 0) ic2 = elementary.Icon(win) ic2.standard_set("clock") ic2.resizable_set(0, 0) it2 = li.item_append("How", ic, ic2) bx = elementary.Box(win) bx.horizontal_set(True) ic = elementary.Icon(win) ic.file_set('images/logo_small.png') ic.resizable_set(0, 0) ic.size_hint_align_set(0.5, 0.5) bx.pack_end(ic) ic.show() ic = elementary.Icon(win) ic.file_set('images/logo_small.png') ic.resizable_set(0, 0) ic.size_hint_align_set(0.5, 0.0) bx.pack_end(ic) ic.show() ic = elementary.Icon(win) ic.file_set('images/logo_small.png') ic.resizable_set(0, 0) ic.size_hint_align_set(0.0, evas.EVAS_HINT_EXPAND) bx.pack_end(ic) ic.show() li.item_append("are", bx) li.item_append("you") li.item_append("doing") li.item_append("out") li.item_append("there") li.item_append("today") li.item_append("?") li.item_append("Here") li.item_append("are") li.item_append("some") li.item_append("more") li.item_append("items") li.item_append("Is this label long enough?") it5 = li.item_append( "Maybe this one is even longer so we can test long long items.") li.go() li.show() win.resize(320, 300) win.show()
def list2_clicked(obj, item=None): win = elementary.Window("list-2", elementary.ELM_WIN_BASIC) win.title_set("List 2") win.autodel_set(True) bg = elementary.Background(win) bg.file_set('images/plant_01.jpg') win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() bx = elementary.Box(win) bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(bx) bx.show() li = elementary.List(win) li.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) li.mode_set(elementary.ELM_LIST_LIMIT) ic = elementary.Icon(win) ic.file_set('images/logo_small.png') it = li.item_append("Hello", ic, callback=my_list2_sel) it.selected_set(True) ic = elementary.Icon(win) ic.resizable_set(0, 0) ic.file_set('images/logo_small.png') li.item_append("world", ic) ic = elementary.Icon(win) ic.standard_set("edit") ic.resizable_set(0, 0) li.item_append(".", ic) ic = elementary.Icon(win) ic.standard_set("delete") ic.resizable_set(0, 0) ic2 = elementary.Icon(win) ic2.standard_set("clock") ic2.resizable_set(0, 0) it2 = li.item_append("How", ic, ic2) bx2 = elementary.Box(win) bx2.horizontal_set(True) ic = elementary.Icon(win) ic.file_set('images/logo_small.png') ic.resizable_set(0, 0) ic.size_hint_align_set(0.5, 0.5) bx2.pack_end(ic) ic.show() ic = elementary.Icon(win) ic.file_set('images/logo_small.png') ic.resizable_set(0, 0) ic.size_hint_align_set(0.5, 0.0) bx2.pack_end(ic) ic.show() li.item_append("are", bx2) li.item_append("you") li.item_append("doing") li.item_append("out") li.item_append("there") li.item_append("today") li.item_append("?") li.item_append("Here") li.item_append("are") li.item_append("some") li.item_append("more") li.item_append("items") li.item_append("Longer label.") li.go() bx.pack_end(li) li.show() bx2 = elementary.Box(win) bx2.horizontal_set(True) bx2.homogeneous_set(True) bx2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) bx2.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) bt = elementary.Button(win) bt.text_set("Clear") bt.callback_clicked_add(my_list2_clear, li) bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) bx2.pack_end(bt) bt.show() bx.pack_end(bx2) bx2.show() win.resize(320, 320) win.show()
def list_clicked(obj, item=None): win = elementary.Window("list", elementary.ELM_WIN_BASIC) win.title_set("List") win.autodel_set(True) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() li = elementary.List(win) win.resize_object_add(li) li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) ic = elementary.Icon(win) ic.file_set('images/logo_small.png') ic.resizable_set(1, 1) it1 = li.item_append("Hello", ic) ic = elementary.Icon(win) ic.file_set('images/logo_small.png') ic.resizable_set(0, 0) li.item_append("Hello", ic) ic = elementary.Icon(win) ic.standard_set("edit") ic.resizable_set(0, 0) ic2 = elementary.Icon(win) ic2.standard_set("clock") ic2.resizable_set(0, 0) li.item_append(".", ic, ic2) ic = elementary.Icon(win) ic.standard_set("delete") ic.resizable_set(0, 0) ic2 = elementary.Icon(win) ic2.standard_set("clock") ic2.resizable_set(0, 0) it2 = li.item_append("How", ic, ic2) bx = elementary.Box(win) bx.horizontal_set(True) ic = elementary.Icon(win) ic.file_set('images/logo_small.png') ic.resizable_set(0, 0) ic.size_hint_align_set(0.5, 0.5) bx.pack_end(ic) ic.show() ic = elementary.Icon(win) ic.file_set('images/logo_small.png') ic.resizable_set(0, 0) ic.size_hint_align_set(0.5, 0.0) bx.pack_end(ic) ic.show() ic = elementary.Icon(win) ic.file_set('images/logo_small.png') ic.resizable_set(0, 0) ic.size_hint_align_set(0.0, evas.EVAS_HINT_EXPAND) bx.pack_end(ic) ic.show() li.item_append("are") li.item_append("you") it3 = li.item_append("doing") li.item_append("out") li.item_append("there") li.item_append("today") li.item_append("?") it4 = li.item_append("Here") li.item_append("are") li.item_append("some") li.item_append("more") li.item_append("items") li.item_append("Is this label long enough?") it5 = li.item_append( "Maybe this one is even longer so we can test long long items.") li.go() li.show() tb2 = elementary.Table(win) tb2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(tb2) bt = elementary.Button(win) bt.text_set("Hello") bt.callback_clicked_add(my_list_show_it, it1) bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(0.9, 0.5) tb2.pack(bt, 0, 0, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("How") bt.callback_clicked_add(my_list_show_it, it2) bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(0.9, 0.5) tb2.pack(bt, 0, 1, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("doing") bt.callback_clicked_add(my_list_show_it, it3) bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(0.9, 0.5) tb2.pack(bt, 0, 2, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("Here") bt.callback_clicked_add(my_list_show_it, it4) bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(0.9, 0.5) tb2.pack(bt, 0, 3, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("Maybe this...") bt.callback_clicked_add(my_list_show_it, it5) bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(0.9, 0.5) tb2.pack(bt, 0, 4, 1, 1) bt.show() tb2.show() win.resize(320, 320) win.show()
def font_pressed(font_button, window1, textbox1): # inner window to hold GUI for font font_win = elementary.InnerWindow(window1) font_win.show() # Entry to hold sample text font_demo = elementary.Entry(font_win) font_demo.editable_set(False) font_demo.entry_set( 'Example: the quick brown fox jumped over the lazy dog. 0123456789') font_demo.line_wrap_set(False) font_demo.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) font_demo.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) font_demo.show() # spinner to choose the font size font_sizer = elementary.Spinner(font_win) font_sizer.min_max_set(10, 100) font_sizer.show() # list of System fonts fonts_raw = window1.evas.font_available_list() fonts = [] for n in range(len(fonts_raw)): tmp = fonts_raw[n].split(":") fonts.append(tmp[0]) # for some strange reason many fonts are displayed multiple times. The following lines remove # all duplicates and then sort them alphabetically. fonts = list(set(fonts)) fonts.sort() # GenList for holding font options font_list = elementary.List(font_win) font_list.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) font_list.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) for i in range(len(fonts)): font_list.item_append(fonts[i], None, None, font_demo_set, fonts[i], font_demo, font_sizer) font_list.go() font_list.show() # Label for Spinner font_sizer_label = elementary.Label(font_win) font_sizer_label.text = "Font Size: " font_sizer_label.show() size_box = elementary.Box(font_win) size_box.horizontal_set(True) size_box.pack_end(font_sizer_label) size_box.pack_end(font_sizer) size_box.show() # cancel and OK buttons ok_button = elementary.Button(font_win) ok_button.text = "OK" ok_button.callback_pressed_add(font_set, font_list, font_sizer, textbox1, font_win) ok_button.show() cancel_button = elementary.Button(font_win) cancel_button.text = "Cancel" cancel_button.callback_pressed_add(close_popup, font_win) cancel_button.show() # box for buttons button_box = elementary.Box(font_win) button_box.horizontal_set(True) button_box.pack_end(cancel_button) button_box.pack_end(ok_button) button_box.show() # box for Entry (for spacing) entry_box = elementary.Box(font_win) entry_box.pack_end(font_demo) entry_box.size_hint_weight_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) entry_box.size_hint_weight_set(0.1, 0.1) entry_box.show() # box for everything full_box = elementary.Box(font_win) full_box.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) full_box.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) full_box.pack_end(font_list) full_box.pack_end(size_box) full_box.pack_end(entry_box) full_box.pack_end(button_box) full_box.show() font_win.content_set(full_box)
def cursor3_clicked(obj, item=None): win = elementary.Window("cursors", elementary.ELM_WIN_BASIC) win.title_set("Cursors 3") win.autodel_set(True) elementary.theme_extension_add("./cursors.edj") 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.Button(win) bt.text_set("hand1") bt.cursor_set(cursors.ELM_CURSOR_HAND1) bt.cursor_theme_search_enabled_set(False) bx.pack_end(bt) bt.show() bt = elementary.Button(win) bt.text_set("hand2 x") bt.cursor_set(cursors.ELM_CURSOR_HAND2) bx.pack_end(bt) bt.show() bt = elementary.Button(win) bt.text_set("hand2") bt.cursor_set(cursors.ELM_CURSOR_HAND2) bt.cursor_theme_search_enabled_set(False) bx.pack_end(bt) bt.show() bt = elementary.Button(win) bt.text_set("hand3") bt.cursor_set("hand3") bt.cursor_theme_search_enabled_set(False) bx.pack_end(bt) bt.show() bt = elementary.Button(win) bt.text_set("hand3") bt.cursor_set("hand3") bt.cursor_theme_search_enabled_set(False) bt.cursor_style_set("transparent") bx.pack_end(bt) bt.show() bt = elementary.Button(win) bt.text_set("not existent") bt.cursor_set("hand4") bt.cursor_theme_search_enabled_set(False) bx.pack_end(bt) bt.show() elementary.cursor_engine_only_set(False) bt = elementary.Button(win) bt.text_set("hand 2 engine only config false") bt.cursor_set("hand2") bx.pack_end(bt) bt.show() elementary.cursor_engine_only_set(True) bt = elementary.Button(win) bt.text_set("hand 2 engine only config true") bt.cursor_set("hand2") bx.pack_end(bt) bt.show() lst = elementary.List(win) li = lst.item_append("cursor hand2 x") li.cursor_set(cursors.ELM_CURSOR_HAND2) li = lst.item_append("cursor hand2") li.cursor_set(cursors.ELM_CURSOR_HAND2) li.cursor_engine_only_set(False) li = lst.item_append("cursor hand3") li.cursor_set("hand3") li.cursor_engine_only_set(False) li = lst.item_append("cursor hand3 transparent") li.cursor_set("hand3") bt.cursor_style_set("transparent") li.cursor_engine_only_set(False) lst.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) lst.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) bx.pack_end(lst) lst.go() lst.show() win.resize(320, 480) win.show()