def unsaved_popup(window1, textbox1, function1): # Create popup unsaved_popup = elementary.Popup(window1) unsaved_popup.part_text_set("title,text", "File Unsaved!") unsaved_popup.text = "The current file has not been saved.<ps>what would you like to do?" # Close without saving button clc_no_save_btt = elementary.Button(window1) clc_no_save_btt.text = "Close Without Saving" clc_no_save_btt.callback_clicked_add(function1, window1, textbox1) clc_no_save_btt.show() # Save the file and then close button clc_save_btt = elementary.FileselectorButton(window1) clc_save_btt.expandable_set(False) clc_save_btt.inwin_mode_set(True) clc_save_btt.is_save_set(True) if textbox1.file_get()[0] != None: clc_save_btt.path_set(textbox1.file_get()[0]) clc_save_btt.callback_file_chosen_add(saveas_file, None, window1, textbox1) clc_save_btt.text = "Save File" clc_save_btt.show() # cancel close request cancel_btt = elementary.Button(window1) cancel_btt.text = "Cancel" cancel_btt.callback_clicked_add(close_popup, unsaved_popup) cancel_btt.show() # add buttons to popup unsaved_popup.part_content_set("button1", clc_no_save_btt) unsaved_popup.part_content_set("button2", clc_save_btt) unsaved_popup.part_content_set("button3", cancel_btt) unsaved_popup.show()
def cb_popup_center_title_item_3button(li, item, win): popup = elementary.Popup(win) popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) popup.part_text_set("title,text", "Title") for i in range(1, 11): if i in [3, 5, 6]: ic = elementary.Icon(win) ic.file = "images/logo_small.png" popup.item_append("item" + str(i), ic) else: popup.item_append("item" + str(i)) bt = elementary.Button(win) bt.text = "OK" popup.part_content_set("button1", bt) bt = elementary.Button(win) bt.text = "Cancel" popup.part_content_set("button2", bt) bt = elementary.Button(win) bt.text = "Close" bt.callback_clicked_add(cb_bnt_close, popup) popup.part_content_set("button3", bt) popup.show()
def cb_popup_center_title_content_3button(li, item, win): popup = elementary.Popup(win) popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) popup.part_text_set("title,text", "Title") ic = elementary.Icon(win) ic.file = "images/logo_small.png" bt = elementary.Button(win) bt.text = "Content" bt.content = ic popup.content = bt bt = elementary.Button(win) bt.text = "OK" popup.part_content_set("button1", bt) bt = elementary.Button(win) bt.text = "Cancel" popup.part_content_set("button2", bt) bt = elementary.Button(win) bt.text = "Close" bt.callback_clicked_add(cb_bnt_close, popup) popup.part_content_set("button3", bt) popup.show()
def cb_popup_bottom_title_text_3button(li, item, win): popup = elementary.Popup(win) popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) popup.text = "This Popup has title area, content area and " \ "action area set with content being character wrapped. " \ "action area has three buttons OK, Cancel and Close" popup.content_text_wrap_type = elementary.ELM_WRAP_CHAR popup.part_text_set("title,text", "Title") ic = elementary.Icon(win) ic.file = "images/logo_small.png" popup.part_content_set("title,icon", ic) bt = elementary.Button(win) bt.text = "OK" popup.part_content_set("button1", bt) bt = elementary.Button(win) bt.text = "Cancel" popup.part_content_set("button2", bt) bt = elementary.Button(win) bt.text = "Close" bt.callback_clicked_add(cb_bnt_close, popup) popup.part_content_set("button3", bt) popup.show()
def notify_clicked(obj, it): win = elementary.Window("notify", elementary.ELM_WIN_BASIC) win.callback_destroy_add(destroy) win.title_set("Notify test") win.autodel_set(True) win.size_hint_min_set(160, 160) win.size_hint_max_set(320, 320) win.resize(320, 320) bg = elementary.Background(win) win.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() tb = elementary.Table(win) tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(tb) tb.show() bt = elementary.Button(win) bt.label_set("Show notify without sleep") bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_CENTER) tb.pack(bt, 0, 0, 1, 1) bt.show() bt = elementary.Button(win) bt.label_set("Show notify with sleep (5 seconds)") bt.callback_clicked_add(notify_show_sleep, win, elementary.ELM_NOTIFY_ORIENT_CENTER) tb.pack(bt, 0, 1, 1, 1) bt.show() win.show()
def run(self, parent, title, msg, option1=None, option2=None): """Create an show the message""" self.window = ElementaryWindow(str(title)) self.window.elm_obj.show() self.window.elm_obj.color_set(0, 0, 0, 255) self.box = ElementaryBox(self.window.elm_obj) self.window.elm_obj.resize_object_add(self.box.elm_obj) self.label = elementary.Label(self.window.elm_obj) self.label.label_set(str(title)) self.box.elm_obj.pack_end(self.label) self.label.size_hint_min_set(440, 50) self.label.show() self.scroller = ElementaryScroller(self.window) self.entry = elementary.Entry(self.window.elm_obj) self.entry.entry_set(str(msg)) self.entry.size_hint_weight_set(1.0, 0.6) self.entry.editable_set(False) self.entry.show() self.scroller.elm_obj.content_set(self.entry) self.box.elm_obj.pack_end(self.scroller.elm_obj) if option2 == None: self.button = elementary.Button(self.window.elm_obj) label_text = option1 or "OK" self.button.label_set(label_text) self.button.on_mouse_up_add(self._on_ok_clicked) self.box.elm_obj.pack_end(self.button) self.button.show() else: self.box2 = ElementaryBox(self.window.elm_obj) self.box2.elm_obj.horizontal_set(True) self.box.elm_obj.pack_end(self.box2.elm_obj) self.button1 = elementary.Button(self.window.elm_obj) self.button1.label_set(option1) self.button1.name_set(option1) self.button2 = elementary.Button(self.window.elm_obj) self.button2.label_set(option2) self.button2.name_set(option2) self.box2.elm_obj.pack_end(self.button1) self.box2.elm_obj.pack_end(self.button2) self.button1.show() self.button1.on_mouse_up_add(self._on_clicked) self.button2.on_mouse_up_add(self._on_clicked) self.button2.show() self.window.elm_obj.layer_set(99) self.val = None yield Wait(self, 'done') logger.info("self.val = %s", self.val) self.window.elm_obj.delete() yield self.val
def box_vert2_clicked(obj, item=None): win = elementary.Window("box-vert2", elementary.ELM_WIN_BASIC) win.title_set("Box Vert 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(0.0, 0.0) bx.show() bt = elementary.Button(win) bt.text_set("Button 1") bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) bt.size_hint_weight_set(0.0, 0.0) bt.callback_clicked_add(boxvert2_del_cb, bx) bx.pack_end(bt) bt.show() bt = elementary.Button(win) bt.text_set("Button 2") bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) bt.size_hint_weight_set(0.0, 0.0) bt.callback_clicked_add(boxvert2_del_cb, bx) bx.pack_end(bt) bt.show() bt = elementary.Button(win) bt.text_set("Button 3") bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) bt.size_hint_weight_set(0.0, 0.0) bt.callback_clicked_add(boxvert2_del_cb, bx) bx.pack_end(bt) bt.show() bt = elementary.Button(win) bt.text_set("Button 4") bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) bt.size_hint_weight_set(0.0, 0.0) bt.callback_clicked_add(boxvert2_del_cb, bx) bx.pack_end(bt) bt.show() bt = elementary.Button(win) bt.text_set("Button 5") bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) bt.size_hint_weight_set(0.0, 0.0) bt.callback_clicked_add(boxvert2_del_cb, bx) bx.pack_end(bt) bt.show() win.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 page6(bt, nf): bt = elementary.Button(nf) bt.callback_clicked_add(navi_pop, nf) bt.text_set("Page 5") bt2 = elementary.Button(nf) bt2.callback_clicked_add(page7, nf) bt2.text_set("Page 7") content = content_new(nf, "images/sky_03.jpg") item = nf.item_push("Page 6", bt, bt2, content, "overlap") item.part_text_set("subtitle", "Overlap style!")
def buttons_clicked(obj): win = elementary.Window("buttons", elementary.ELM_WIN_BASIC) win.title_set("Buttons") win.focus_highlight_enabled_set(True) 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() ic = elementary.Icon(win) ic.file_set("images/logo_small.png") ic.size_hint_aspect_set(evas.EVAS_ASPECT_CONTROL_VERTICAL, 1, 1) bt = elementary.Button(win) bt.text_set("Icon sized to button") bt.content_set(ic) bx.pack_end(bt) bt.show() ic.show() ic = elementary.Icon(win) ic.file_set("images/logo_small.png") ic.resizable_set(0, 0) bt = elementary.Button(win) bt.text_set("Icon no scale") bt.content_set(ic) bx.pack_end(bt) bt.show() ic.show() bt = elementary.Button(win) bt.text_set("Button only") bx.pack_end(bt) bt.show() ic = elementary.Icon(win) ic.file_set("images/logo_small.png") ic.resizable_set(0, 0) bt = elementary.Button(win) bt.content_set(ic) bx.pack_end(bt) bt.show() ic.show() win.show()
def page3(bt, nf): bt = elementary.Button(nf) bt.callback_clicked_add(navi_pop, nf) bt.text_set("Prev") bt2 = elementary.Button(nf) bt2.callback_clicked_add(page4, nf) bt2.text_set("Next") content = content_new(nf, "images/rock_01.jpg") item = nf.item_push("Page 3", bt, bt2, content, "basic") ic = elementary.Icon(nf) ic.file_set("images/logo_small.png") item.part_content_set("icon", ic)
def page5(bt, nf): bt = elementary.Button(nf) bt.callback_clicked_add(navi_pop, nf) bt.text_set("Page 4") bt2 = elementary.Button(nf) bt2.callback_clicked_add(page6, nf) bt2.text_set("Page 6") content = content_new(nf, "images/sky_01.jpg") item = nf.item_insert_after(nf.top_item_get(), "Page 5", bt, bt2, content, "basic") item.part_text_set("subtitle", "This page is inserted without transition (TODO)")
def naviframe_clicked(obj): win = elementary.Window("naviframe", elementary.ELM_WIN_BASIC) win.title_set("Naviframe 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.show() nf = elementary.Naviframe(win) win.resize_object_add(nf) nf.show() bt = elementary.Button(win) bt.callback_clicked_add(page2, nf) bt.text_set("Next") content = content_new(nf, "images/logo.png") item = nf.item_push("Page 1", None, bt, content, "basic") nf.data["page1"] = item win.resize(400, 600) win.show()
def panel_clicked(obj): win = elementary.Window("panel", elementary.ELM_WIN_BASIC) win.title_set("Panel 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_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() panel = elementary.Panel(win) panel.orient = elementary.ELM_PANEL_ORIENT_LEFT panel.size_hint_weight_set(0.0, evas.EVAS_HINT_EXPAND) panel.size_hint_align_set(0.0, evas.EVAS_HINT_FILL) bt = elementary.Button(win) bt.text_set("HIDE ME :)") bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) bt.show() panel.content_set(bt) bx.pack_end(panel) panel.show() win.resize(300, 300) win.show()
def cb_item6(li, item): box = elementary.Box(li) box.size_hint_min = (200, 150) sc = elementary.Scroller(li) sc.bounce = (False, True) sc.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) sc.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) sc.show() bt = elementary.Button(li) bt.text = "Ctxpop will be on the top of layer" bt.callback_clicked_add(cb_btn) bt.size_hint_min = (190, 140) sc.content = bt box.pack_end(sc) cp = elementary.Ctxpopup(li) cp.callback_dismissed_add(cb_dismissed) cp.content = box (x, y) = li.evas.pointer_canvas_xy_get() cp.move(x, y) cp.show() bt.data["ctxpopup"] = cp
def menu_create(search, win): tbx.clear() for category in items: frame = elementary.Frame(win) frame.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) frame.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) frame.text = category[0] frame.show() tbx.pack_end(frame) tbx2 = elementary.Box(win) tbx2.layout_set(elementary.ELM_BOX_LAYOUT_FLOW_HORIZONTAL) tbx2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) tbx2.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0) frame.content_set(tbx2) tbx2.show() cnt = 0 for test in category[1]: if (search == None) or (test[0].lower().find(search.lower()) > -1): bt = elementary.Button(win) bt.text = test[0] bt.callback_clicked_add(test[1]) bt.show() tbx2.pack_end(bt) cnt += 1 if cnt < 1: frame.delete()
def __init__(self, parent, bt_icon=None): WidgetEntry.__init__(self, parent) self.selection_list = [] self.button = elementary.Button(parent) self.button.size_hint_align_set(-1.0, -1.0) self.button.callback_clicked_add(self._open) self.button.style_set("editje.details") self.button.show() self.theme_file = sysconfig.theme_file_get("default") ico = elementary.Icon(self.button) if bt_icon: ico.file_set(self.theme_file, bt_icon) else: ico.file_set(self.theme_file, "editje/icon/entry_button") ico.size_hint_min_set(18, 18) ico.show() self.button.content_set(ico) self.button.size_hint_min_set(20, 20) self.box = elementary.Box(parent) self.box.horizontal_set(True) self.box.size_hint_weight_set(1.0, 0.0) self.box.size_hint_align_set(-1.0, -1.0) self.box.pack_end(self.entry) self.box.pack_end(self.button) self.box.show() self.obj = self.box
def __init__(self, amsn_conversation, parent, contacts_uid): self._parent = parent elementary.Box.__init__(self, parent) 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) self.homogenous_set(False) self._parent.resize_object_add(self) self.show() self._amsn_conversation = amsn_conversation self.outsc = elementary.Scroller(parent) self.outsc.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) self.outsc.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) self.outsc.policy_set(elementary.ELM_SCROLLER_POLICY_AUTO, elementary.ELM_SCROLLER_POLICY_ON) self.outsc.bounce_set(False, True) self.pack_end(self.outsc) self.outbx = elementary.Box(parent) self.outbx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) self.outbx.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) self.outsc.content_set(self.outbx) self.outbx.show() self.outsc.show() self.inbx = elementary.Box(parent) self.inbx.horizontal_set(True) self.inbx.homogenous_set(False) self.inbx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0) self.inbx.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5) self.pack_end(self.inbx) self.insc = elementary.Scroller(parent) self.insc.policy_set(elementary.ELM_SCROLLER_POLICY_AUTO, elementary.ELM_SCROLLER_POLICY_AUTO) self.insc.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) self.insc.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) self.inbx.pack_end(self.insc) self.ine = elementary.Entry(parent) self.ine.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) self.ine.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) self.ine.event_callback_add(evas.EVAS_CALLBACK_KEY_DOWN, self.__ine_key_down) self.insc.content_set(self.ine) self.ine.show() self.insc.show() self.inb = elementary.Button(parent) self.inb.label_set("Send") self.inb.callback_clicked_add(self.__sendButton_cb, self.ine) self.inbx.pack_end(self.inb) self.inb.show() self.inbx.show() self.show()
def panes_clicked(obj): win = elementary.Window("panes", elementary.ELM_WIN_BASIC) win.title_set("Panes 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_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() panes = elementary.Panes(win) win.resize_object_add(panes) panes.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) panes.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) panes.callback_clicked_add(cb_panes, "clicked") panes.callback_clicked_double_add(cb_panes, "clicked,double") panes.callback_press_add(cb_panes, "press") panes.callback_unpress_add(cb_panes, "unpress") panes.show() bt = elementary.Button(win) bt.text = "Left" panes.part_content_set("left", bt) bt.show() panes_h = elementary.Panes(win) panes_h.horizontal = True panes_h.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) panes_h.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) panes.part_content_set("right", panes_h) panes_h.show() bt = elementary.Button(win) bt.text = "Up" panes_h.part_content_set("left", bt) bt.show() bt = elementary.Button(win) bt.text = "Down" panes_h.part_content_set("right", bt) bt.show() win.resize(320, 480) win.show()
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 cb_popup_center_title_text_2button_restack(li, item, win): popup = elementary.Popup(win) popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) popup.text = "When you click the 'Restack' button, " \ "an image will be located under this popup" popup.part_text_set("title,text", "Title") bt = elementary.Button(win) bt.text = "Restack" bt.callback_clicked_add(cb_btn_restack, popup) popup.part_content_set("button1", bt) bt = elementary.Button(win) bt.text = "Close" bt.callback_clicked_add(cb_bnt_close, popup) popup.part_content_set("button3", bt) popup.show()
def box_layout_clicked(obj, item=None): win = elementary.Window("box-layout", elementary.ELM_WIN_BASIC) win.title_set("Box Layout") 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() vbox = elementary.Box(win) win.resize_object_add(vbox) vbox.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) vbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) vbox.show() bx = elementary.Box(win) bx.layout_set(elementary.ELM_BOX_LAYOUT_HORIZONTAL) bx.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) vbox.pack_end(bx) bx.show() sep = elementary.Separator(win) sep.horizontal_set(True) vbox.pack_end(sep) sep.show() bt = elementary.Button(win) bt.text_set("layout: %s" % layout_list[current_layout]) bt.callback_clicked_add(box_layout_button_cb, bx) vbox.pack_end(bt) bt.show() for i in range(5): 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(1.0, 1.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, 0.0) bx.pack_end(ic) ic.show() win.show()
def cb_popup_center_title_text_1button(li, item, win): popup = elementary.Popup(win) popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) popup.text = "This Popup has content area and " \ "action area set, action area has one button Close" bt = elementary.Button(win) bt.text = "Close" bt.callback_clicked_add(cb_bnt_close, popup) popup.part_content_set("button1", bt) popup.show()
def page2(bt, nf): ic = elementary.Icon(nf) ic.file_set("images/icon_right_arrow.png") bt = elementary.Button(nf) bt.callback_clicked_add(page3, nf) bt.content_set(ic) content = content_new(nf, "images/plant_01.jpg") item = nf.item_push("Page 2", None, bt, content, "basic") item.part_text_set("subtitle", "Here is sub-title part!")
def __init__(self, parent): Widget.__init__(self) self.parent = parent self.obj = elementary.Button(parent) self.obj.size_hint_weight_set(1.0, 0.0) self.obj.size_hint_align_set(-1.0, 0.0) self.obj.style_set("editje.details") self.obj.callback_clicked_add(self._clicked) self.obj.show() self._value = ""
def table_clicked(obj): win = elementary.Window("table", elementary.ELM_WIN_BASIC) win.title_set("Table") 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() tb = elementary.Table(win) win.resize_object_add(tb) tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) tb.show() bt = elementary.Button(win) bt.text_set("Button 1") bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) tb.pack(bt, 0, 0, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("Button 2") bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) tb.pack(bt, 1, 0, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("Button 3") bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) tb.pack(bt, 2, 0, 1, 1) bt.show() bt = elementary.Button(win) bt.text_set("Button 4") bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) tb.pack(bt, 0, 1, 2, 1) bt.show() bt = elementary.Button(win) bt.text_set("Button 5") bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) tb.pack(bt, 2, 1, 1, 3) bt.show() bt = elementary.Button(win) bt.text_set("Button 6") bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) tb.pack(bt, 0, 2, 2, 2) bt.show() win.show()
def about_pressed(about_button, window1): about_popup = elementary.Popup(window1) about_popup.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) about_popup.part_text_set("title,text", "Etext v" + str(version)) about_popup.text = "<b>The Enlightened Text Editor</b><ps>By: Tyler Bradbeer<ps><ps>Etext is licensed under the GNU GPL v2" close_button = elementary.Button(window1) close_button.text = "OK" close_button.callback_clicked_add(close_popup, about_popup) about_popup.part_content_set("button1", close_button) about_popup.show()
def layout_clicked(obj): win = elementary.Window("layout", elementary.ELM_WIN_BASIC) win.title_set("Layout") win.elm_event_callback_add(_event) 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() ly = elementary.Layout(win) ly.file_set("test.edj", "layout") ly.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(ly) ly.show() bt = elementary.Button(win) bt.text_set("Button 1") ly.part_content_set("element1", bt) bt.elm_event_callback_add(_event) bt.elm_event_callback_del(_event) bt.show() bt = elementary.Button(win) bt.text_set("Button 2") ly.part_content_set("element2", bt) bt.show() bt = elementary.Button(win) bt.text_set("Button 3") ly.part_content_set("element3", bt) bt.show() win.show()
def page4(bt, nf): ic = elementary.Icon(nf) ic.file_set("images/icon_right_arrow.png") bt = elementary.Button(nf) bt.callback_clicked_add(page5, nf) bt.content_set(ic) content = content_new(nf, "images/rock_02.jpg") item = nf.item_push("Page 4", None, bt, content, "basic") ic = elementary.Icon(nf) ic.file_set("images/logo_small.png") item.part_content_set("icon", ic) item.part_text_set("subtitle", "Title area visibility test") item.title_visible_set(False) content.callback_clicked_add(title_visible, item)
def action_add(self, label, func_cb, data=None, icon=None): btn = elementary.Button(self._parent) btn.label_set(label) btn.callback_clicked_add(self.__action_btn_clicked) btn.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) btn.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) btn.data["clicked"] = (func_cb, data) if icon: btn.icon_set(icon) icon.show() self.__actions_list[label] = btn btn.show() self.__edje.part_box_append("actions", btn)