def __init__(self): StandardWindow.__init__(self, "ex8", "ElmEx - Button and Popup", size=(300, 200)) self.callback_delete_request_add(lambda o: elm.exit()) ourButton = StandardButton(self, "Show Popup", "start-here", self.buttonPressed) ourButton.size_hint_weight = EXPAND_HORIZ ourButton.size_hint_align = FILL_BOTH ourButton.show() ourButton2 = StandardButton(self, "Show About", "dialog-information", self.button2Pressed) ourButton2.size_hint_weight = EXPAND_HORIZ ourButton2.size_hint_align = FILL_BOTH ourButton2.show() mainBox = Box(self) mainBox.size_hint_weight = EXPAND_BOTH mainBox.size_hint_align = FILL_BOTH mainBox.pack_end(ourButton) mainBox.pack_end(ourButton2) mainBox.show() self.resize_object_add(mainBox)
def __init__(self, parent_widget, *args, titles=None, initial_sort=0, ascending=True, **kwargs): Scroller.__init__(self, parent_widget, *args, **kwargs) self.policy_set(ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF) self.main_box = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.main_box.show() self.header = titles self.sort_column = initial_sort self.sort_column_ascending = ascending self.rows = [] self.header_row = [] header = Panes(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) header.callback_unpress_add(self.cb_resize_pane) header.show() list_pane = Panes(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) list_pane.callback_unpress_add(self.cb_resize_pane) list_pane.style_set("flush") list_pane.show() header.data["related"] = list_pane list_pane.data["related"] = header self.scroller = Scroller(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.scroller.policy_set(ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO) self.scroller.content = list_pane self.scroller.show() self.headers = [] self.headers.append(header) self.list_panes = [] self.list_panes.append(list_pane) self.lists = [] if titles is not None: self.header_row_pack(titles) self.main_box.pack_end(header) self.main_box.pack_end(self.scroller) self.content = self.main_box self.show()
def dnd_genlist_user_anim_clicked(obj, item=None): win = StandardWindow("dnd-genlist-user-anim", "DnD-Genlist-User-Anim", autodel=True, size=(680,800)) bxx = Box(win, horizontal=True, size_hint_weight=EXPAND_BOTH) win.resize_object_add(bxx) bxx.show() for j in range(2): gl = Genlist(win, multi_select=True, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) # START Drag and Drop handling win.callback_delete_request_add(win_del, gl) gl.drop_item_container_add(ELM_SEL_FORMAT_TARGETS, gl_item_getcb, dropcb=gl_dropcb) gl.drag_item_container_add(ANIM_TIME, DRAG_TIMEOUT, gl_item_getcb, gl_data_getcb) # We add mouse-down, up callbacks to start/stop drag animation gl.event_callback_add(EVAS_CALLBACK_MOUSE_DOWN, gl_obj_mouse_down, gl) # END Drag and Drop handling # FIXME: This causes genlist to resize the horiz axis very slowly :( # Reenable this and resize the window horizontally, then try to resize it back #elm_genlist_mode_set(gl, ELM_LIST_LIMIT) bxx.pack_end(gl) gl.show() for i in range(20): gl.item_append(itc1, img[i % 9], flags=ELM_GENLIST_ITEM_NONE) win.show()
def access_clicked(obj, item=None): win = StandardWindow("access", "Access") win.autodel = True win.on_free_add(cleanup_cb) config.access = True bx = Box(win, size_hint_weight=EXPAND_BOTH, homogeneous=True, horizontal=True) win.resize_object_add(bx) bx.show() gl = Genlist(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) bx.pack_end(gl) gl.show() gl.callback_realized_add(_realized) itc1 = GLItC1(item_style="default") itc2 = GLItC2(item_style="full") for i in range(1,9): if i % 4: gl.item_append(itc1, i, None, ELM_GENLIST_ITEM_NONE) else: gl.item_append(itc2, i, None, ELM_GENLIST_ITEM_NONE) itc1.free() itc2.free() win.resize(500, 400) win.show()
def __init__(self, parent_widget, *args, **kwargs): Box.__init__(self, parent_widget, *args, **kwargs) self.ourList = ourList = List(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.keys = [] ourList.go() ourList.show() self.ourItems = [] sframe = Frame(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) sframe.text = "Search" self.search = search = Entry(self) search.single_line = True search.callback_changed_add(self.searchChange) sframe.content = search search.show() sframe.show() self.pack_end(ourList) self.pack_end(sframe)
def __init__(self, parent, label_text, values, initial_value): Box.__init__(self, parent) self.vd = { ELM_ACTIONSLIDER_LEFT: values[0], ELM_ACTIONSLIDER_CENTER: values[1], ELM_ACTIONSLIDER_RIGHT: values[2], } self.horizontal = True self.size_hint_align = -1.0, 0.0 self.size_hint_weight = 1.0, 0.0 l = Label(parent) l.text = label_text l.show() w = self.w = Actionslider(parent) w.magnet_pos = ELM_ACTIONSLIDER_ALL w.size_hint_align = -1.0, 0.0 w.size_hint_weight = 1.0, 0.0 w.show() parts = "left", "center", "right" for i, v in enumerate(values): w.part_text_set(parts[i], str(v)) w.indicator_pos = values.index(initial_value) + 1 self.pack_end(l) self.pack_end(w)
def __init__(self, parent_widget, *args, **kwargs): Box.__init__(self, parent_widget, *args, **kwargs) self.tabs = [] self.current = None self.tab_changed_cb = None self.close_cb = None self.empty_cb = None self.scr = Scroller(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) self.scr.content_min_limit(False, True) self.button_bx = Box(self.scr, size_hint_weight=EXPAND_HORIZ, align=ALIGN_LEFT) self.button_bx.horizontal = True self.button_bx.show() self.scr.content = self.button_bx self.scr.show() self.nav_fr = Naviframe(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.nav_fr.show() self.pack_end(self.scr) self.pack_end(self.nav_fr)
def __init__(self, parent_widget, *args, **kwargs): Box.__init__(self, parent_widget, *args, **kwargs) self.tabs = [] self.currentTab = None self.tabChangedCallback = None self.closeCallback = None self.emptyCallback = None self.scr = Scroller(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) self.scr.content_min_limit(False, True) self.buttonBox = Box(self.scr, size_hint_weight=EXPAND_HORIZ, align=ALIGN_LEFT) self.buttonBox.horizontal = True self.buttonBox.show() self.scr.content = self.buttonBox self.scr.show() self.nf = Naviframe(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.nf.show() self.pack_end(self.scr) self.pack_end(self.nf)
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 menu_create(search, win): tbx.clear() for category in items: frame = Frame(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH, text=category[0]) frame.show() tbx.pack_end(frame) tbx2 = Box(win, layout=ELM_BOX_LAYOUT_FLOW_HORIZONTAL, size_hint_weight=(EVAS_HINT_EXPAND, 0.0), size_hint_align=(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 = Button(win, text=test[0]) bt.callback_clicked_add(selected_cb, test[1], test[2]) bt.show() tbx2.pack_end(bt) cnt += 1 if cnt < 1: frame.delete()
def __init__(self, parent, conf): Frame.__init__(self, parent) self.size_hint_align = -1.0, 0.0 self.size_hint_weight = 1.0, 0.0 self.text = "Data storage" self.conf = conf b = Box(parent) lbl = self.path_lbl = Label(parent) lbl.text = conf.get("Settings", "storage_path") self.dlsel = dlsel = FileselectorButton(self) dlsel.size_hint_align = -1.0, 0.0 dlsel.inwin_mode = False dlsel.folder_only = True dlsel.expandable = False dlsel.text = "Change path" dlsel.path = conf.get("Settings", "storage_path") dlsel.callback_file_chosen_add(self.save_dlpath) for w in lbl, dlsel: w.show() b.pack_end(w) b.show() self.content = b
def FRAME(win, bx, t): bx2 = Box(win, size_hint_weight=EXPAND_HORIZ, size_hint_align=(EVAS_HINT_FILL, 0.0), align=(0.0, 0.5)) bx2.show() fr = Frame(bx, text=t, content=bx2, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) bx.pack_end(fr) fr.show() return fr, bx2
def __init__(self): StandardWindow.__init__(self, "ex2", "Hello Elementary", size=(300, 200)) self.callback_delete_request_add(lambda o: elm.exit()) ourLabel = Label(self) ourLabel.size_hint_weight = EXPAND_BOTH ourLabel.text = "Hello Elementary!" ourLabel.show() ourButton = Button(self) ourButton.size_hint_weight = EXPAND_BOTH ourButton.text = "Goodbye Elementary" ourButton.callback_clicked_add(self.buttonPressed) ourButton.show() ourBox = Box(self) ourBox.size_hint_weight = EXPAND_BOTH ourBox.pack_end(ourLabel) ourBox.pack_end(ourButton) ourBox.show() self.resize_object_add(ourBox)
def __init__(self, parent, session): Frame.__init__(self, parent) self.session = session self.size_hint_align = FILL_HORIZ self.text = "Listen port (range)" port = session.listen_port() b = Box(parent) b.size_hint_weight = EXPAND_HORIZ lp = self.lp = RangeSpinners( parent, low=session.conf.getint("Settings", "listen_low"), high=session.conf.getint("Settings", "listen_high"), minim=0, maxim=65535) lp.show() b.pack_end(lp) save = Button(parent) save.text = "Apply" save.callback_clicked_add(self.save_cb) save.show() b.pack_end(save) b.show() self.content = b
def __init__(self, rent): Box.__init__(self, rent) self.parent = rent #This appears on the button in the main swmai window self.name = "Startup Applications" #The section in the main window the button is added to self.section = "Applications" #Search terms that this module should appear for self.searchData = ["startup", "command", "applications", "apps"] #Command line argument to open this module directly self.launchArg = "--startupapps" #Should be none by default. This value is used internally by swami self.button = None self.icon = Icon(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) #Use FDO icons -> http://standards.freedesktop.org/icon-naming-spec/latest/ar01s04.html self.icon.standard_set('system-run') self.icon.show() self.mainBox = Box(self, size_hint_weight = EXPAND_BOTH) self.mainBox.show() buttonBox = Box(self, size_hint_weight = EXPAND_HORIZ, size_hint_align = FILL_BOTH) buttonBox.horizontal = True buttonReturn = StandardButton(self, "Back", "go-previous", self.returnPressed) buttonReturn.show() buttonBox.pack_end(buttonReturn) buttonBox.show() self.pack_end(self.mainBox) self.pack_end(buttonBox)
def __init__(self): StandardWindow.__init__(self, "ex4", "Align Example", size=(300, 200)) self.callback_delete_request_add(lambda o: elm.exit()) ourButton = Button(self) ourButton.size_hint_weight = EXPAND_BOTH ourButton.size_hint_align = (0, 0) ourButton.text = "Button 1" ourButton.show() ourButton2 = Button(self) ourButton2.size_hint_weight = EXPAND_BOTH ourButton2.size_hint_align = FILL_BOTH ourButton2.text = "Button 2" ourButton2.show() ourButton3 = Button(self) ourButton3.size_hint_weight = EXPAND_BOTH ourButton3.size_hint_align = (1, 1) ourButton3.text = "Button 3" ourButton3.show() ourBox = Box(self) ourBox.size_hint_weight = EXPAND_BOTH ourBox.pack_end(ourButton) ourBox.pack_end(ourButton2) ourBox.pack_end(ourButton3) ourBox.show() self.resize_object_add(ourBox)
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 radio_add(win, bx): ad = win.data["ad"] i = 0 bx2 = Box(win, size_hint_weight=EXPAND_HORIZ, size_hint_align=(EVAS_HINT_FILL, 0.0), align=(0.0, 0.5), horizontal=True) bx.pack_end(bx2) bx2.show() rdg = rd = Radio(win, state_value=i, text="Nothing", size_hint_weight=EXPAND_BOTH) rd.group_add(rdg) bx2.pack_end(rd) rd.show() i += 1 for profile in ad.profiles: rd = Radio(win, state_value=i, text=profile, size_hint_weight=EXPAND_BOTH) rd.group_add(rdg) bx2.pack_end(rd) rd.show() i += 1 return rdg
def list3_clicked(obj, item=None): win = StandardWindow("list-3", "List 3", autodel=True, size=(320, 300)) li = List(win, size_hint_weight=EXPAND_BOTH, mode=ELM_LIST_COMPRESS) win.resize_object_add(li) ic = Icon(win, file=os.path.join(img_path, "logo_small.png")) li.item_append("Hello", ic) ic = Icon(win, file=os.path.join(img_path, "logo_small.png"), resizable=(False, False)) li.item_append("world", ic) ic = Icon(win, standard="edit", resizable=(False, False)) li.item_append(".", ic) ic = Icon(win, standard="delete", resizable=(False, False)) ic2 = Icon(win, standard="clock", resizable=(False, False)) it2 = li.item_append("How", ic, ic2) bx = Box(win, horizontal=True) bx.horizontal_set(True) ic = Icon(win, standard="delete", resizable=(False, False), size_hint_align=ALIGN_CENTER) bx.pack_end(ic) ic.show() ic = Icon(win, file=os.path.join(img_path, "logo_small.png"), resizable=(False, False), size_hint_align=(0.5, 0.0)) bx.pack_end(ic) ic.show() ic = Icon(win, file=os.path.join(img_path, "logo_small.png"), resizable=(False, False), size_hint_align=(0.0, EVAS_HINT_FILL)) 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.show()
def inlined_add(parent): win = Window("inlined", ELM_WIN_INLINED_IMAGE, parent, pos=(10, 100), size=(150, 70)) bg = Background(win, color=(110, 210, 120), size_hint_weight=EXPAND_BOTH) win.resize_object_add(bg) bg.show() bx = Box(win, size_hint_weight=EXPAND_HORIZ, size_hint_align=(EVAS_HINT_FILL, 0.0)) bx.show() lb = LOG(win, "ELM_WIN_INLINED_IMAGE") bx.pack_end(lb) lb = LOG(win, "Profile: <b>N/A</b>") bx.pack_end(lb) win.data["lb"] = lb win.inlined_image_object.pos = 10, 100 win.inlined_image_object.size = 150, 70 win.callback_profile_changed_add(win_profile_changed_cb) win.show() return win
def __init__(self, parent, title, done_cb, **kargs): self._user_cb = done_cb self._inwin = InnerWindow(parent) vbox = Box(self._inwin) self._inwin.content = vbox vbox.show() lb = Label(vbox, text='<b>%s</b>' % title) vbox.pack_end(lb) lb.show() Fileselector.__init__(self, vbox, expandable=False, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH, **kargs) self.callback_done_add(self._fileselector_done_cb) self.callback_activated_add(self._fileselector_done_cb) # TODO this filter seems not to work well...need fixing # fs.mime_types_filter_append(list(EXTRACT_MAP.keys()), 'Archive files') # fs.mime_types_filter_append(['*'], 'All files') vbox.pack_end(self) self.show() self._inwin.activate()
def __init__(self, cmd): self.cmd = cmd self.cmd_exe = None win = self.win = Window("ecore-ex", ELM_WIN_DIALOG_BASIC) win.title = "Ecore Example" win.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND win.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL win.resize(300, 200) win.callback_delete_request_add(lambda o: elementary.exit()) win.show() win.activate() self.sendEntry = Entry(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.sendEntry.show() self.sendButton = Button(win, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) self.sendButton.text = "Send!" self.sendButton.callback_pressed_add(self.sendPressed) self.sendButton.show() box = Box(win, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) box.pack_end(self.sendEntry) box.pack_end(self.sendButton) box.show() win.resize_object_add(box) self.run_command(cmd)
def build_prog_popup(self): pp = Popup(self) pp.part_text_set('title,text', _('Extracting files, please wait...')) pp.show() vbox = Box(self) pp.part_content_set('default', vbox) vbox.show() lb = Label(self, ellipsis=True, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) vbox.pack_end(lb) lb.show() pb = Progressbar(pp, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) vbox.pack_end(pb) pb.show() bt = Button(pp, text=_('Cancel')) bt.callback_clicked_add(lambda b: self.app.abort_operation()) pp.part_content_set('button1', bt) self.prog_pbar = pb self.prog_label = lb self.prog_popup = pp
def calendar_clicked(obj, item=None): win = StandardWindow("calendar", "Calendar", autodel=True) bx = Box(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(bx) bx.show() bt = Button(bx, text="Next API function") bt.callback_clicked_add(api_bt_clicked, api) bx.pack_end(bt) if api["state"] == API_STATE_LAST: bt.disabled = True bt.show() the_time = datetime(2010, 12, 31) cal = Calendar(bx, first_day_of_week=ELM_DAY_MONDAY, size_hint_weight=EXPAND_BOTH, selected_time=the_time, min_max_year=(2010, 2012)) api["cal"] = cal bx.pack_end(cal) cal.show() win.show()
def __init__(self, parent, session): Frame.__init__(self, parent) self.session = session self.size_hint_align = FILL_HORIZ self.text = "Listen port (range)" port = session.listen_port() b = Box(parent) b.size_hint_weight = EXPAND_HORIZ lp = self.lp = RangeSpinners( parent, low = session.conf.getint("Settings", "listen_low"), high = session.conf.getint("Settings", "listen_high"), minim = 0, maxim = 65535) lp.show() b.pack_end(lp) save = Button(parent) save.text = "Apply" save.callback_clicked_add(self.save_cb) save.show() b.pack_end(save) b.show() self.content = b
def cursor2_clicked(obj, item=None): win = StandardWindow("cursors", "Cursors 2", autodel=True, size=(320, 480)) bx = Box(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(bx) bx.show() tb = Toolbar(win, size_hint_weight=(0.0, 0.0), size_hint_align=(EVAS_HINT_FILL, 0.0)) ti = tb.item_append("folder-new", "Bogosity", None, None) ti.cursor_set("bogosity") ti = tb.item_append("clock", "Unset", None, None) ti.cursor_unset() ti = tb.item_append("document-print", "Xterm", None, None) ti.cursor_set("xterm") bx.pack_end(tb) tb.show() lst = List(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) li = lst.item_append("cursor bogosity") li.cursor_set("bogosity") li = lst.item_append("cursor unset") li.cursor_unset() li = lst.item_append("cursor xterm") li.cursor_set("xterm") bx.pack_end(lst) lst.go() lst.show() win.show()
def __init__(self, title): elm_conf = Configuration() scale = elm_conf.scale Window.__init__(self, title, ELM_WIN_BASIC, title=title, autodel=True) self.size = scale * 480, scale * 320 bg = Background(self, size_hint_weight=EXPAND_BOTH) self.resize_object_add(bg) bg.show() # bt = Button(self, text="Close") # bt.callback_clicked_add(lambda b: self.delete()) self.scroller = Scroller(self, policy=SCROLL_BOTH, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.resize_object_add(self.scroller) self.scroller.show() self.box = Box(self) self.box.size_hint_weight = EXPAND_BOTH self.scroller.content = self.box self.show()
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 dnd_genlist_gengrid_clicked(obj, item=None): win = StandardWindow("dnd-genlist-gengrid", "DnD-Genlist-Gengrid", autodel=True, size=(680, 800)) bxx = Box(win, horizontal=True, size_hint_weight=EXPAND_BOTH) win.resize_object_add(bxx) bxx.show() gl = Genlist(win, multi_select=True, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) win.callback_delete_request_add(win_del, gl) # START Drag and Drop handling gl.drop_item_container_add(ELM_SEL_FORMAT_TARGETS, gl_item_getcb, dropcb=gl_dropcb) gl.drag_item_container_add(ANIM_TIME, DRAG_TIMEOUT, gl_item_getcb, gl_dnd_default_anim_data_getcb) # END Drag and Drop handling # FIXME: This causes genlist to resize the horiz axis very slowly :( # Reenable this and resize the window horizontally, then try to resize it back #elm_genlist_mode_set(gl, ELM_LIST_LIMIT) bxx.pack_end(gl) gl.show() for i in range(20): gl.item_append(itc1, img[i % 9], flags=ELM_GENLIST_ITEM_NONE) grid = Gengrid(win, item_size=(conf.scale * 150, conf.scale * 150), horizontal=False, reorder_mode=False, multi_select=True, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) win.callback_delete_request_add(win_del, grid) grid.drop_item_container_add(ELM_SEL_FORMAT_TARGETS, grid_item_getcb, dropcb=grid_dropcb) grid.drag_item_container_add(ANIM_TIME, DRAG_TIMEOUT, grid_item_getcb, grid_data_getcb) for i in range(20): grid.item_append(gic, img[i % 9]) bxx.pack_end(grid) grid.show() win.show()
def core_evas_canvas_callbacks_clicked(obj, item=None): win = StandardWindow("evascanvascbs", "Evas canvas callbacks", autodel=True, size=(320,320)) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) text = Text(win.evas, text="Events printed on console", size=(300, 30), color=(0,0,0,255)) text.font_set("Sans", 12) text.pos = (10, 10) text.show() canvas = win.evas_get() canvas.event_callback_add(EVAS_CALLBACK_CANVAS_FOCUS_IN, events_cb1, "EVAS_CALLBACK_CANVAS_FOCUS_IN") canvas.event_callback_add(EVAS_CALLBACK_CANVAS_FOCUS_OUT, events_cb1, "EVAS_CALLBACK_CANVAS_FOCUS_OUT") canvas.event_callback_add(EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN, events_cb2, "EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN") canvas.event_callback_add(EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT, events_cb2, "EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT") canvas.event_callback_add(EVAS_CALLBACK_RENDER_FLUSH_PRE, events_cb1, "EVAS_CALLBACK_RENDER_FLUSH_PRE") canvas.event_callback_add(EVAS_CALLBACK_RENDER_FLUSH_POST, events_cb1, "EVAS_CALLBACK_RENDER_FLUSH_POST") canvas.event_callback_add(EVAS_CALLBACK_RENDER_PRE, events_cb1, "EVAS_CALLBACK_RENDER_PRE") canvas.event_callback_add(EVAS_CALLBACK_RENDER_POST, events_cb1, "EVAS_CALLBACK_RENDER_POST") r2 = Rectangle(win.evas, size=(120,70), color=(0,100,0,100), pos=(70,70)) r2.show() hbox = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH, horizontal=True) win.resize_object_add(hbox) hbox.show() b = Button(win, text="del cbs", size_hint_align=(0.5, 1.0)) hbox.pack_end(b) b.callback_clicked_add(btn_del_cbs_cb) b.show() win.show()
def store_clicked(obj): win = StandardWindow("store", "Store") win.autodel = True if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bx = Box(win) bx.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND win.resize_object_add(bx) bx.show() gl = Genlist(win) gl.mode = ELM_LIST_COMPRESS gl.callback_selected_add(st_selected) gl.callback_clicked_double_add(st_double_clicked) gl.callback_longpressed_add(st_longpress) gl.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND gl.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL bx.pack_end(gl) gl.show() itc1 = GenlistItemClass() itc1.item_style = "message" st = Store() st.fs_list_func_set(st_store_list) st.fetch_func_set(st_store_fetch) #st.fetch_thread = False #st.unfetch_func_set(st_store_unfetch) st.items_sorted = False st.target_genlist = gl st.filesystem_directory = "." win.size = 480, 800 win.show()
def radio_add(win, bx): ad = win.data["ad"] i = 0 bx2 = Box(win, size_hint_weight=EXPAND_HORIZ, size_hint_align=(EVAS_HINT_FILL, 0.0), align=(0.0, 0.5), horizontal = True) bx.pack_end(bx2) bx2.show() rdg = rd = Radio(win, state_value=i, text="Nothing", size_hint_weight=EXPAND_BOTH) rd.group_add(rdg) bx2.pack_end(rd) rd.show() i += 1 for profile in ad.profiles: rd = Radio(win, state_value=i, text=profile, size_hint_weight=EXPAND_BOTH) rd.group_add(rdg) bx2.pack_end(rd) rd.show() i += 1 return rdg
def socket_add(name): win = Window("socket image", ELM_WIN_SOCKET_IMAGE) try: win.socket_listen(name, 0, False) except RuntimeError: print("No socket") win.delete() return None else: win.autodel = True bg = Background(win, color=(80, 110, 205), size_hint_weight=EXPAND_BOTH) win.resize_object_add(bg) bg.show() bx = Box(win, size_hint_weight=EXPAND_HORIZ, size_hint_align=(EVAS_HINT_FILL, 0.0)) bx.show() lb = LOG(win, "ELM_WIN_SOCKET_IMAGE") bx.pack_end(lb) lb = LOG(win, "Profile: <b>N/A</b>") bx.pack_end(lb) win.data["lb"] = lb inlined_add(win) win.move(0, 0) win.resize(150, 200) win.callback_profile_changed_add(win_profile_changed_cb) win.show() return win
def calendar3_clicked(obj, item=None): win = StandardWindow("calendar", "Calendar", autodel=True) bxx = Box(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(bxx) bxx.show() selected_time = datetime.now() + timedelta(34) cal = Calendar(win, size_hint_weight=EXPAND_BOTH, first_day_of_week=ELM_DAY_THURSDAY, select_mode=ELM_CALENDAR_SELECT_MODE_ONDEMAND, selected_time=selected_time) bxx.pack_end(cal) cal.show() win.show()
def __init__(self, doc_specs={}): SCALE = elm_conf.scale self.docs = [] self.doc_specs = doc_specs self.settings = {"scroll_by_page": False} super(AppWindow, self).__init__("main", "Lekha", size=(400 * SCALE, 400 * SCALE), autodel=True) main_box = self.main_box = Box(self, size_hint_weight=EXPAND_BOTH) self.resize_object_add(main_box) tb = self.tb = Toolbar( self, # For some reason item menus break when parent is main_box size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ, select_mode=ELM_OBJECT_SELECT_MODE_NONE, icon_size=24) tb.item_append("document-open", "Open", lambda x, y: Fs(self.document_open)) tb.item_append("view-fullscreen", "Fullscreen", lambda x, y: self.fullscreen_set(True)) it = tb.item_append("preferences-system", "Settings", self._settings_open) tabs = self.tabs = Tabs(main_box, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) # tabs.callback_add( # "tab,added", lambda x, y: self.title_set(y.doc_title)) tabs.callback_add("tab,selected", lambda x, y: self.title_set(y.doc_title)) def selected_cb(tabs, content): for c in content.page_box: c.changed() tabs.callback_add("tab,selected", selected_cb) tabs.callback_add("tab,deleted", lambda x, y: y.delete()) main_box.pack_end(tb) main_box.pack_end(tabs) tb.show() tabs.show() self.callback_fullscreen_add(self._fullscreen_cb) self.callback_unfullscreen_add(self._unfullscreen_cb) self.elm_event_callback_add(self._event_handler) main_box.show()
def __init__(self, parent): self._freezed = False # used in populate to not trigger callbacks Box.__init__(self, parent, size_hint_weight=EXPAND_VERT, size_hint_align=FILL_VERT) # status (view: all, todo or done) seg = SegmentControl(self, focus_allow=False) for name, val in ('All','all'),('Todo','todo'),('Done','done'): it = seg.item_add(None, name) it.data['view'] = val it.selected = True if options.view == val else False seg.callback_changed_add(self._status_changed_cb) self.pack_end(seg) seg.show() # @Projects list label = Label(self, text="<b>Projects +</b>", scale=1.4) self.pack_end(label) label.show() self.projs_list = List(self, multi_select=True, focus_allow=False, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.projs_list.callback_selected_add(self._list_selection_changed_cb) self.projs_list.callback_unselected_add(self._list_selection_changed_cb) self.pack_end(self.projs_list) self.projs_list.show() # @Contexts list label = Label(self, text="<b>Contexts @</b>", scale=1.4) self.pack_end(label) label.show() self.cxts_list = List(self, multi_select=True, focus_allow=False, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.cxts_list.callback_selected_add(self._list_selection_changed_cb) self.cxts_list.callback_unselected_add(self._list_selection_changed_cb) self.pack_end(self.cxts_list) self.cxts_list.show() self.show()
def __init__(self): self.cfg = ConfigOption() self.userid = os.getuid() self.win = None self.bg = None self.main_box = None self.info_frame = None self.lb = None self.ps_list = None self.win = StandardWindow("my app", "eyekill", size=(320, 384)) self.win.title_set("eye kill") self.win.callback_delete_request_add(self.destroy) self.main_box = Box(self.win) self.main_box.size_hint_weight = EXPAND_BOTH self.win.resize_object_add(self.main_box) self.main_box.show() self.info_frame = Frame(self.win) self.info_frame.text_set("Information") self.main_box.pack_end(self.info_frame) self.info_frame.show() self.lb = Label(self.win) self.lb.text_set('<b>Kill process with a double click</b>') self.info_frame.content_set(self.lb) self.lb.show() self.ps_list = List(self.win) self.ps_list.size_hint_weight = EXPAND_BOTH self.ps_list.size_hint_align = FILL_BOTH self.ps_list.callback_clicked_double_add(self.kill_bill) self.update_list() self.main_box.pack_end(self.ps_list) self.ps_list.go() self.ps_list.show() self.win.resize(320, 384) self.win.show()
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 panel_clicked(obj): win = StandardWindow("panel", "Panel test", autodel=True, size=(300, 300)) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) bx = Box(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(bx) bx.show() bt = Button(win, text="HIDE ME :)", size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) bt.show() panel = Panel(win, orient=ELM_PANEL_ORIENT_LEFT, content=bt, size_hint_weight=EXPAND_VERT, size_hint_align=FILL_VERT_ALIGN_LEFT) bx.pack_end(panel) panel.show() win.show()
def check_add(win, bx): ad = win.data["ad"] bx2 = Box(win, size_hint_weight=EXPAND_HORIZ, size_hint_align=(EVAS_HINT_FILL, 0.0), align=(0.0, 0.5), horizontal=True) bx.pack_end(bx2) bx2.show() ll = [] for profile in ad.profiles: ck = Check(win, text=profile, size_hint_weight=EXPAND_BOTH) ck.data["profile"] = profile bx2.pack_end(ck) ck.show() ll.append(ck) return ll
def entry_anchor_clicked(obj, item=None): win = StandardWindow("entry", "Entry Anchor", autodel=True, size=(400,400)) box = Box(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(box) entry = Entry(win, anchor_hover_style="popout", anchor_hover_parent=win) entry.text = "<a href=url:http://www.enlightenment.org/>Enlightenment</a>" entry.callback_anchor_clicked_add(anchor_clicked) entry.callback_anchor_hover_opened_add(anchor_hover_opened) entry.show() frame = Frame(win, size_hint_align=FILL_BOTH, text="Entry test", content=entry) frame.show() box.pack_end(frame) box.show() win.show()
def __init__(self, parent_widget, add_tab=False, *args, **kwargs): Box.__init__(self, parent_widget, *args, **kwargs) self._dict = OrderedDict() # Tabs scr = self._scr = Scroller( self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH, policy=(ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF), movement_block=ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL) scr.content_min_limit(False, True) tb = self._tabBox = Box(self._scr, size_hint_weight=EXPAND_HORIZ, align=ALIGN_LEFT, horizontal=True) tb.show() self._addTab = None if add_tab: at = self._addTab = Button(self._tabBox, style="anchor") at.content = Icon(self._addTab, standard="list-add") at.callback_clicked_add( lambda x: self.callback_call("tabs,add,clicked")) self._tabBox.pack_end(self._addTab) at.show() scr.content = self._tabBox scr.show() # Contents nf = self._nf = Naviframe(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) nf.callback_transition_finished_add(self._nfit_shown) nf.show() self.pack_end(scr) self.pack_end(nf)
def elm_input_events_clicked(obj, item=None): win = StandardWindow("inputevents", "Input Events Test", autodel=True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) box = Box(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(box) box.show() entry = Entry(win, scrollable=True, size_hint_align=FILL_BOTH, size_hint_weight=(1.0, 0.2)) entry.text = ( "This example will show how Elementary input events are handled. " "Typing in this entry will log in the entry box below all events " "caught by event handlers set to this Entry widget and its parent, " "the Window widget. Key up events are checked for in the callback " "and won't propagate to a parent widget." ) entry.show() log_entry = Entry(win, editable=False, scrollable=True, focus_allow=False, size_hint_align=FILL_BOTH, size_hint_weight=(1.0, 0.8)) log_entry.callback_changed_add(changed_cb) log_entry.show() btn = Button(win, text="Clear log", focus_allow=False) btn.callback_clicked_add(lambda x: setattr(log_entry, "entry", "")) btn.show() box.pack_end(entry) box.pack_end(log_entry) box.pack_end(btn) entry.elm_event_callback_add(events_cb, log_entry) entry.markup_filter_append(filter_cb) win.elm_event_callback_add(events_cb, log_entry) win.resize(640, 480) win.show() entry.focus = True
def __init__(self): StandardWindow.__init__(self, "efl-dbus-spy", "EFL DBus Spy - Espionage") self.autodel_set(True) self.callback_delete_request_add(lambda o: elm.exit()) bg = Background(self) self.resize_object_add(bg) bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() box = Box(self) self.resize_object_add(box) box.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) box.show() flip = FlipSelector(self) flip.item_append("Session Bus", self.flip_selected_cb, session_bus) flip.item_append("System Bus", self.flip_selected_cb, system_bus) box.pack_end(flip) flip.show() panes = Panes(self) 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.content_left_size = 0.333 # panes.fixed = True box.pack_end(panes) panes.show() self.names_list = NamesList(self) panes.part_content_set("left", self.names_list) self.names_list.show() self.detail_list = DetailList(self) panes.part_content_set("right", self.detail_list) self.detail_list.show() self.resize(700, 500) self.show()
def access_clicked(obj, item=None): win = StandardWindow("access", "Access") win.autodel = True win.on_free_add(cleanup_cb) config.access = True bx = Box(win, size_hint_weight=EXPAND_BOTH, homogeneous=True, horizontal=True) win.resize_object_add(bx) bx.show() gl = Genlist(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) bx.pack_end(gl) gl.show() gl.callback_realized_add(_realized) itc1 = GLItC1(item_style="default") itc2 = GLItC2(item_style="full") for i in range(1, 9): if i % 4: gl.item_append(itc1, i, None, ELM_GENLIST_ITEM_NONE) else: gl.item_append(itc2, i, None, ELM_GENLIST_ITEM_NONE) itc1.free() itc2.free() win.resize(500, 400) win.show()
def __init__(self, parent_widget, titles=None, initial_sort=0, ascending=True, *args, **kwargs): Scroller.__init__(self, parent_widget, *args, **kwargs) self.policy_set(ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF) self.mainBox = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.mainBox.show() self.header = titles self.sort_column = initial_sort self.sort_column_ascending = ascending self.rows = [] self.header_row = [] headerPane = Panes(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) headerPane.callback_unpress_add(self.paneResized) headerPane.show() listPane = Panes(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) listPane.callback_unpress_add(self.paneResized) listPane.style_set("flush") listPane.show() headerPane.data["related"] = listPane listPane.data["related"] = headerPane self.mainScr = Scroller(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.mainScr.policy_set(ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO) self.mainScr.content = listPane self.mainScr.show() self.headerPanes = [] self.headerPanes.append(headerPane) self.listPanes = [] self.listPanes.append(listPane) self.lists = [] #self.pack_end(self.header_box) if titles is not None: self.header_row_pack(titles) self.mainBox.pack_end(headerPane) self.mainBox.pack_end(self.mainScr) self.content = self.mainBox self.show()
def __init__(self, parent_widget, titles=None, *args, **kwargs): Box.__init__(self, parent_widget, *args, **kwargs) self.outPut = Entry(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.outPut.editable_set(False) self.outPut.scrollable_set(True) self.outPut.callback_changed_add(self.changedCb) self.outPut.show() frame = Frame(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) frame.text = "Input:" frame.autocollapse_set(True) frame.collapse_go(True) frame.show() bx = Box(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) bx.horizontal = True bx.show() frame.content = bx self.inPut = Entry(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.inPut.single_line_set(True) self.inPut.callback_activated_add(self.enterPressed) self.inPut.show() enterButton = Button(self) enterButton.text = "Execute" enterButton.callback_pressed_add(self.enterPressed) enterButton.show() bx.pack_end(self.inPut) bx.pack_end(enterButton) self.pack_end(self.outPut) self.pack_end(frame) self.cmd_exe = None self.done_cb = None
def __init__(self, parent, low, high, minim, maxim): Box.__init__(self, parent) self.size_hint_weight = EXPAND_BOTH self.size_hint_align = FILL_BOTH self.horizontal = True l = self.listenlow = Spinner(parent) l.size_hint_weight = EXPAND_BOTH l.size_hint_align = FILL_BOTH l.min_max = minim, maxim l.value = low self.pack_end(l) l.show() h = self.listenhigh = Spinner(parent) h.size_hint_weight = EXPAND_BOTH h.size_hint_align = FILL_BOTH h.min_max = minim, maxim h.value = high self.pack_end(h) h.show()