def __init__(self, parent_widget, titles=None, initial_sort=None, ascending=True, *args, **kwargs): Box.__init__(self, parent_widget, *args, **kwargs) self.header = titles self.sort_column = initial_sort self.sort_column_ascending = ascending self.rows = [] self.header_row = [] self.header_box = Box(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) self.header_box.horizontal = True self.header_box.show() scr = Scroller(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.list_box = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.list_box.horizontal = True self.list_box.show() scr.policy_set(ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_ON) scr.content = self.list_box scr.show() self.lists = [] self.pack_end(self.header_box) self.pack_end(scr) self.show() if titles is not None: self.header_row_pack(titles)
def buildMainBox(self): # build our toolbar self.mainTb = Toolbar(self, homogeneous=False, size_hint_weight=(0.0, 0.0), size_hint_align=(EVAS_HINT_FILL, 0.0)) self.mainTb.item_append("remove", "Clear", self.clearPressed) self.mainTb.item_append("system-run", "Select All", self.selectAllPressed) self.mainTb.item_append("view-refresh", "Refresh", self.refreshPressed) self.mainTb.item_append("info", "Log", self.detailsPressed) self.mainTb.item_append("ok", "Apply", self.installUpdatesPressed) self.mainTb.show() # build our sortable list that displays packages that need updates titles = [("Upgrade", True), ("Package", True), ("Installed", True), ("Available", True)] scr = Scroller(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.packageList = sl.SortedList(scr, titles=titles, homogeneous=False, size_hint_weight=EXPAND_HORIZ) scr.content = self.packageList scr.show() # build the label that shows the package's description self.currentDescription = Label(self, size_hint_weight=FILL_BOTH) self.currentDescription.text = "Select a package for information" self.currentDescription.line_wrap_set(True) self.currentDescription.show() self.desFrame = Frame(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) self.desFrame.text = "Description" self.desFrame.content = self.currentDescription self.desFrame.show() # add all of our objects to the box box = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) box.pack_end(self.mainTb) box.pack_end(scr) box.pack_end(self.desFrame) box.show() return box
def cb_item5(li, item): box = Box(li, size_hint_min=(150, 150)) sc = Scroller(li, bounce=(False, True), size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH) sc.show() bt = Button(li, text="Enlightenment", size_hint_min=(140, 140)) sc.content = bt box.pack_end(sc) cp = Ctxpopup(li, content = box) (x, y) = li.evas.pointer_canvas_xy_get() cp.move(x, y) cp.show()
def __init__(self, parent_widget, *args, titles=None, initial_sort=0, ascending=True, **kwargs): Box.__init__(self, parent_widget, *args, **kwargs) self.header = titles self.sort_column = initial_sort self.sort_column_ascending = ascending self.rows = [] self.header_row = [] self.header_box = Box(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) self.header_box.horizontal = True self.header_box.show() scr = Scroller(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.list_box = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.list_box.horizontal = True self.list_box.show() scr.policy_set(ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_ON) scr.content = self.list_box scr.show() self.lists = [] self.pack_end(self.header_box) self.pack_end(scr) self.show() if titles is not None: self.header_row_pack(titles)
def cb_item6(li, item): box = Box(li, size_hint_min=(200, 150)) sc = Scroller(li, bounce=(False, True), size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH) sc.show() bt = Button(li, text="Ctxpop will be on the top of layer", size_hint_min=(190, 140)) bt.callback_clicked_add(cb_btn) sc.content = bt box.pack_end(sc) cp = Ctxpopup(li, content=box) cp.callback_dismissed_add(cb_dismissed) (x, y) = li.evas.pointer_canvas_xy_get() cp.move(x, y) cp.show() bt.data["ctxpopup"] = cp
def mapbuf_clicked(obj, item=None): global mb_list win = Window("mapbuf", ELM_WIN_BASIC, title="Mapbuf test", autodel=True, size=(480, 600)) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bg = Background(win, file=os.path.join(img_path, "sky_04.jpg"), size_hint_weight=EXPAND_BOTH) win.resize_object_add(bg) bg.show() vbox = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) win.resize_object_add(vbox) vbox.show() # launcher sc = Scroller(win, bounce=(True, False), policy=SCROLL_POLICY_OFF, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH) vbox.pack_end(sc) bx = Box(win, horizontal=True, homogeneous=True) bx.show() for k in range(8): tb = Table(win, size_hint_align=ALIGN_CENTER, size_hint_weight=(0.0, 0.0)) tb.show() pad = Rectangle(win.evas, color=(255, 255, 0, 255)) pad.size_hint_min = (464, 4) pad.size_hint_weight = (0.0, 0.0) pad.size_hint_align = (EVAS_HINT_FILL, EVAS_HINT_FILL) pad.show() tb.pack(pad, 1, 0, 5, 1) pad = Rectangle(win.evas, color=(255, 255, 0, 255)) pad.size_hint_min = (464, 4) pad.size_hint_weight = (0.0, 0.0) pad.size_hint_align = (EVAS_HINT_FILL, EVAS_HINT_FILL) pad.show() tb.pack(pad, 1, 11, 5, 1) pad = Rectangle(win.evas, color=(255, 255, 0, 255)) pad.size_hint_min = (4, 4) pad.size_hint_weight = (0.0, 0.0) pad.size_hint_align = (EVAS_HINT_FILL, EVAS_HINT_FILL) pad.show() tb.pack(pad, 0, 1, 1, 10) pad = Rectangle(win.evas, color=(255, 255, 0, 255)) pad.size_hint_min = (4, 4) pad.size_hint_weight = (0.0, 0.0) pad.size_hint_align = (EVAS_HINT_FILL, EVAS_HINT_FILL) pad.show() tb.pack(pad, 6, 1, 1, 10) mb = Mapbuf(win, content=tb) mb.point_color_set(k % 4, 255, 0, 0, 255) mb_list.append(mb) bx.pack_end(mb) mb.show() n = m = 0 for j in range(5): for i in range(5): ic = Icon(win, scale=0.5, file=os.path.join(img_path, "icon_%02d.png" % (n)), resizable=(False, False), size_hint_weight=EXPAND_BOTH, size_hint_align=ALIGN_CENTER) tb.pack(ic, 1 + i, 1 + (j * 2), 1, 1) ic.show() lb = Label(win, style="marker", text=names[m]) tb.pack(lb, 1 + i, 1 + (j * 2) + 1, 1, 1) lb.show() n = n + 1 if n < 23 else 0 m = m + 1 if m < 15 else 0 sc.content = bx sc.page_relative_set(1.0, 1.0) sc.show() # controls hbox = Box(win, horizontal=True, homogeneous=True, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) vbox.pack_start(hbox) hbox.show() ck = Check(win, text="Map", state=False) ck.callback_changed_add(cb_ck_map) hbox.pack_end(ck) ck.show() ck = Check(win, text="Alpha", state=True) ck.callback_changed_add(cb_ck_alpha) hbox.pack_end(ck) ck.show() ck = Check(win, text="Smooth", state=True) ck.callback_changed_add(cb_ck_smooth) hbox.pack_end(ck) ck.show() ck = Check(win, text="FS", state=False) ck.callback_changed_add(cb_ck_fs, win) hbox.pack_end(ck) ck.show() bt = Button(win, text="Close", size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_HORIZ) bt.callback_clicked_add(cb_btn_close, win) hbox.pack_end(bt) bt.show() win.show()
def focus_clicked(obj, item=None): win = StandardWindow("focus", "Focus", autodel=True, size=(800,600)) win.focus_highlight_enabled = True tbx = Box(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(tbx) tbx.show() ### Toolbar tbar = Toolbar(win, shrink_mode=ELM_TOOLBAR_SHRINK_MENU, size_hint_align=(EVAS_HINT_FILL,0.0)) tb_it = tbar.item_append("document-print", "Hello", _tb_sel) tb_it.disabled = True tb_it = tbar.item_append("folder-new", "World", _tb_sel) tb_it = tbar.item_append("object-rotate-right", "H", _tb_sel) tb_it = tbar.item_append("mail-send", "Comes", _tb_sel) tb_it = tbar.item_append("clock", "Elementary", _tb_sel) tb_it = tbar.item_append("refresh", "Menu", _tb_sel) tb_it.menu = True tbar.menu_parent = win menu = tb_it.menu menu.item_add(None, "Shrink", "edit-cut", _tb_sel) menu_it = menu.item_add(None, "Mode", "edit-copy", _tb_sel) menu.item_add(menu_it, "is set to", "edit-paste", _tb_sel) menu.item_add(menu_it, "or to", "edit-paste", _tb_sel) menu.item_add(None, "Menu", "edit-delete", _tb_sel) tbx.pack_end(tbar) tbar.show() mainbx = Box(win, horizontal=True, size_hint_weight=EXPAND_BOTH) tbx.pack_end(mainbx) mainbx.show() ## First Col bx = Box(win, size_hint_weight=EXPAND_BOTH) mainbx.pack_end(bx) bx.show() lb = Label(win, text="<b>Use Tab or Shift+Tab<br/>or Arrow keys</b>", size_hint_align=FILL_BOTH) bx.pack_end(lb) lb.show() tg = Check(win, style="toggle") tg.part_text_set("on", "Yes") tg.part_text_set("off", "No") bx.pack_end(tg) tg.show() en = Entry(win, scrollable=True, single_line=True, text="This is a single line", size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) bx.pack_end(en) en.show() # bx2 = Box(win, horizontal=True, size_hint_align=FILL_BOTH) bx.pack_end(bx2) bx2.show() for i in range(2): bt = Button(win, text="Box", size_hint_align=FILL_BOTH, disabled=(i % 2)) bx2.pack_end(bt) bt.show() sc = Scroller(win, bounce=(True,True), content_min_limit=(1,1), size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) bx2.pack_end(sc) sc.show() bt = Button(win, text="Scroller", size_hint_align=FILL_BOTH) sc.content = bt bt.show() # bt = Button(win, text="Box", size_hint_align=FILL_BOTH) bx.pack_end(bt) bt.show() # bx2 = Box(win, horizontal=True, size_hint_align=FILL_BOTH) bx.pack_end(bx2) bx2.show() for i in range(2): bx3 = Box(win, size_hint_align=FILL_BOTH) bx2.pack_end(bx3) bx3.show() for j in range(3): bt = Button(win, text="Box", size_hint_align=FILL_BOTH) bx3.pack_end(bt) bt.show() sc = Scroller(win, bounce=(False, True), content_min_limit=(1,0), size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH) sc.content_min_limit=(1,1) bx2.pack_end(sc) sc.show() bx3 = Box(win, size_hint_align=FILL_BOTH) sc.content = bx3 bx3.show() for i in range(5): bt = Button(win, text="BX Scroller", size_hint_align=FILL_BOTH) bx3.pack_end(bt) bt.show() ## Second Col ly = Layout(win, size_hint_weight=EXPAND_BOTH) ly.file = edj_file, "twolines" mainbx.pack_end(ly) ly.show() bx2 = Box(win, horizontal=True, size_hint_align=FILL_BOTH) ly.part_content_set("element1", bx2) bx2.show() for i in range(3): bt = Button(win, text="Layout", size_hint_align=FILL_BOTH) bx2.pack_end(bt) bt.show() bx2.focus_custom_chain_prepend(bt) bx2 = Box(win, size_hint_align=FILL_BOTH) ly.part_content_set("element2", bx2) bx2.show() bt = Button(win, text="Disable", size_hint_align=FILL_BOTH) bt.callback_clicked_add(lambda b: b.disabled_set(True)) bx2.pack_end(bt) bt.show() bx2.focus_custom_chain_prepend(bt) bt2 = Button(win, text="Enable", size_hint_align=FILL_BOTH) bt2.callback_clicked_add(lambda b, b1: b1.disabled_set(False), bt) bx2.pack_end(bt2) bt2.show() bx2.focus_custom_chain_append(bt2) ## Third Col bx = Box(win, size_hint_weight=EXPAND_BOTH) mainbx.pack_end(bx) bx.show() fr = Frame(win, text="Frame", ) bx.pack_end(fr) fr.show() tb = Table(win, size_hint_weight=EXPAND_BOTH) fr.content = tb tb.show() for j in range(1): for i in range(2): bt = Button(win, text="Table", size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH) tb.pack(bt, i, j, 1, 1) bt.show() # fr = Bubble(win, text="Bubble", size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH) bx.pack_end(fr) fr.show() tb = Table(win, size_hint_weight=EXPAND_BOTH) fr.content = tb tb.show() for j in range(2): for i in range(1): bt = Button(win, text="Table", size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH) tb.pack(bt, i, j, 1, 1) bt.show() win.show()
def focus_clicked(obj, item=None): win = StandardWindow("focus", "Focus", autodel=True, size=(800, 600)) win.focus_highlight_enabled = True tbx = Box(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(tbx) tbx.show() ### Toolbar tbar = Toolbar(win, shrink_mode=ELM_TOOLBAR_SHRINK_MENU, size_hint_align=(EVAS_HINT_FILL, 0.0)) tb_it = tbar.item_append("document-print", "Hello", _tb_sel) tb_it.disabled = True tb_it = tbar.item_append("folder-new", "World", _tb_sel) tb_it = tbar.item_append("object-rotate-right", "H", _tb_sel) tb_it = tbar.item_append("mail-send", "Comes", _tb_sel) tb_it = tbar.item_append("clock", "Elementary", _tb_sel) tb_it = tbar.item_append("refresh", "Menu", _tb_sel) tb_it.menu = True tbar.menu_parent = win menu = tb_it.menu menu.item_add(None, "Shrink", "edit-cut", _tb_sel) menu_it = menu.item_add(None, "Mode", "edit-copy", _tb_sel) menu.item_add(menu_it, "is set to", "edit-paste", _tb_sel) menu.item_add(menu_it, "or to", "edit-paste", _tb_sel) menu.item_add(None, "Menu", "edit-delete", _tb_sel) tbx.pack_end(tbar) tbar.show() mainbx = Box(win, horizontal=True, size_hint_weight=EXPAND_BOTH) tbx.pack_end(mainbx) mainbx.show() ## First Col bx = Box(win, size_hint_weight=EXPAND_BOTH) mainbx.pack_end(bx) bx.show() lb = Label(win, text="<b>Use Tab or Shift+Tab<br/>or Arrow keys</b>", size_hint_align=FILL_BOTH) bx.pack_end(lb) lb.show() tg = Check(win, style="toggle") tg.part_text_set("on", "Yes") tg.part_text_set("off", "No") bx.pack_end(tg) tg.show() en = Entry(win, scrollable=True, single_line=True, text="This is a single line", size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) bx.pack_end(en) en.show() # bx2 = Box(win, horizontal=True, size_hint_align=FILL_BOTH) bx.pack_end(bx2) bx2.show() for i in range(2): bt = Button(win, text="Box", size_hint_align=FILL_BOTH, disabled=(i % 2)) bx2.pack_end(bt) bt.show() sc = Scroller(win, bounce=(True, True), content_min_limit=(1, 1), size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) bx2.pack_end(sc) sc.show() bt = Button(win, text="Scroller", size_hint_align=FILL_BOTH) sc.content = bt bt.show() # bt = Button(win, text="Box", size_hint_align=FILL_BOTH) bx.pack_end(bt) bt.show() # bx2 = Box(win, horizontal=True, size_hint_align=FILL_BOTH) bx.pack_end(bx2) bx2.show() for i in range(2): bx3 = Box(win, size_hint_align=FILL_BOTH) bx2.pack_end(bx3) bx3.show() for j in range(3): bt = Button(win, text="Box", size_hint_align=FILL_BOTH) bx3.pack_end(bt) bt.show() sc = Scroller(win, bounce=(False, True), content_min_limit=(1, 0), size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH) sc.content_min_limit = (1, 1) bx2.pack_end(sc) sc.show() bx3 = Box(win, size_hint_align=FILL_BOTH) sc.content = bx3 bx3.show() for i in range(5): bt = Button(win, text="BX Scroller", size_hint_align=FILL_BOTH) bx3.pack_end(bt) bt.show() ## Second Col ly = Layout(win, size_hint_weight=EXPAND_BOTH) ly.file = edj_file, "twolines" mainbx.pack_end(ly) ly.show() bx2 = Box(win, horizontal=True, size_hint_align=FILL_BOTH) ly.part_content_set("element1", bx2) bx2.show() for i in range(3): bt = Button(win, text="Layout", size_hint_align=FILL_BOTH) bx2.pack_end(bt) bt.show() bx2.focus_custom_chain_prepend(bt) bx2 = Box(win, size_hint_align=FILL_BOTH) ly.part_content_set("element2", bx2) bx2.show() bt = Button(win, text="Disable", size_hint_align=FILL_BOTH) bt.callback_clicked_add(lambda b: b.disabled_set(True)) bx2.pack_end(bt) bt.show() bx2.focus_custom_chain_prepend(bt) bt2 = Button(win, text="Enable", size_hint_align=FILL_BOTH) bt2.callback_clicked_add(lambda b, b1: b1.disabled_set(False), bt) bx2.pack_end(bt2) bt2.show() bx2.focus_custom_chain_append(bt2) ## Third Col bx = Box(win, size_hint_weight=EXPAND_BOTH) mainbx.pack_end(bx) bx.show() fr = Frame( win, text="Frame", ) bx.pack_end(fr) fr.show() tb = Table(win, size_hint_weight=EXPAND_BOTH) fr.content = tb tb.show() for j in range(1): for i in range(2): bt = Button(win, text="Table", size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH) tb.pack(bt, i, j, 1, 1) bt.show() # fr = Bubble(win, text="Bubble", size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH) bx.pack_end(fr) fr.show() tb = Table(win, size_hint_weight=EXPAND_BOTH) fr.content = tb tb.show() for j in range(2): for i in range(1): bt = Button(win, text="Table", size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH) tb.pack(bt, i, j, 1, 1) bt.show() win.show()