def select_torrent(self): sel = Fileselector(self.win) sel.expandable = False sel.path_set(os.path.expanduser("~")) sel.size_hint_weight_set(1.0, 1.0) sel.size_hint_align_set(-1.0, -1.0) sel.show() sf = Frame(self.win) sf.size_hint_weight_set(1.0, 1.0) sf.size_hint_align_set(-1.0, -1.0) sf.text = "Select torrent file" sf.content = sel sf.show() magnet = Entry(self.win) magnet.single_line = True magnet.scrollable = True if hasattr(magnet, "cnp_selection_get"): magnet.cnp_selection_get(ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_TEXT) else: import pyperclip t = pyperclip.paste() if t is not None and t.startswith("magnet:"): magnet.entry = t magnet.show() mf = Frame(self.win) mf.size_hint_weight_set(1.0, 0.0) mf.size_hint_align_set(-1.0, 0.0) mf.text = "Or enter magnet URI here" mf.content = magnet mf.show() mbtn = Button(self.win) mbtn.text = "Done" mbtn.show() mbox = Box(self.win) mbox.size_hint_weight_set(1.0, 0.0) mbox.size_hint_align_set(-1.0, 0.0) mbox.horizontal = True mbox.pack_end(mf) mbox.pack_end(mbtn) mbox.show() box = Box(self.win) box.size_hint_weight = (1.0, 1.0) box.size_hint_align = (-1.0, -1.0) box.pack_end(sf) box.pack_end(mbox) box.show() inwin = InnerWindow(self.win) inwin.content = box sel.callback_done_add(self.add_torrent_cb) sel.callback_done_add(lambda x, y: inwin.delete()) mbtn.callback_clicked_add(self.add_magnet_uri_cb, magnet) mbtn.callback_clicked_add(lambda x: inwin.delete()) inwin.activate()
def __init__(self, rent): Box.__init__(self, rent) self.parent = rent #This appears on the button in the main swmai window self.name = "Skel" #The section in the main window the button is added to self.section = "The Body" #Search terms that this module should appear for self.searchData = [] #Command line argument to open this module directly self.launchArg = "--skel" #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('icon-name') 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 genlist_clicked(obj, item=None): win = StandardWindow("Genlist", "Genlist test", autodel=True) bx = Box(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(bx) bx.show() gl = Genlist(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) gl.callback_selected_add(_gl_selected, "arg1", "arg2", kwarg1="kwarg1", kwarg2="kwarg2") gl.callback_clicked_double_add(_gl_clicked_double, "arg1", "arg2", kwarg1="kwarg1", kwarg2="kwarg2") gl.callback_longpressed_add(_gl_longpressed, "arg1", "arg2", kwarg1="kwarg1", kwarg2="kwarg2") bx.pack_end(gl) gl.show() over = Rectangle(win.evas_get()) over.color_set(0, 0, 0, 0) over.event_callback_add(evas.EVAS_CALLBACK_MOUSE_DOWN, _gl_over_click, gl) over.repeat_events_set(True) over.show() over.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) win.resize_object_add(over) vbx = Box(win, horizontal=True) bx.pack_end(vbx) vbx.show() itc1 = GenlistItemClass(item_style="default", text_get_func=gl_text_get, content_get_func=gl_content_get, state_get_func=gl_state_get) bt_50 = Button(win, text="Go to 50") vbx.pack_end(bt_50) bt_50.show() bt_1500 = Button(win, text="Go to 1500") vbx.pack_end(bt_1500) bt_1500.show() for i in range(0, 2000): gli = gl.item_append(itc1, i, func=gl_item_sel) if i == 50: bt_50._callback_add("clicked", lambda bt, it: it.bring_in(), gli) elif i == 1500: bt_1500._callback_add("clicked", lambda bt, it: it.bring_in(), gli) win.resize(480, 800) win.show()
def box_transition_clicked(obj, item=None): win = StandardWindow("box-layout-transition", "Box Layout Transition", autodel=True) vbox = Box(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH) win.resize_object_add(vbox) vbox.show() bx = Box(win, layout=ELM_BOX_LAYOUT_HORIZONTAL, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH) vbox.pack_end(bx) bx.show() sep = Separator(win, horizontal=True) vbox.pack_end(sep) sep.show() bt = Button(win, text="layout: %s" % layout_list[current_layout]) bt.callback_clicked_add(box_transition_button_cb, bx) vbox.pack_end(bt) bt.show() for i in range(4): ic = Icon(win, file=ic_file, resizable=(0, 0), size_hint_align=(0.5, 0.5)) bx.pack_end(ic) ic.show() win.show()
def clock_clicked(obj): win = StandardWindow("clock", "Clock", autodel=True) 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() L = [] ck = Clock(win) bx.pack_end(ck) ck.show() L.append(ck) ck = Clock(win, show_am_pm=True) bx.pack_end(ck) ck.show() L.append(ck) print((ck.time_get())) ck = Clock(win, show_seconds=True) bx.pack_end(ck) ck.show() L.append(ck) ck = Clock(win, show_seconds=True, show_am_pm=True) bx.pack_end(ck) ck.show() L.append(ck) ck = Clock(win, edit=True, show_seconds=True, show_am_pm=True, time=(10, 11, 12)) bx.pack_end(ck) ck.show() L.append(ck) ck = Clock( win, edit=True, show_seconds=True, edit_mode = ( ELM_CLOCK_EDIT_HOUR_DECIMAL | ELM_CLOCK_EDIT_MIN_DECIMAL | ELM_CLOCK_EDIT_SEC_DECIMAL ) ) bx.pack_end(ck) ck.show() L.append(ck) hbox = Box(win, horizontal=True) bx.pack_end(hbox) hbox.show() ck = Check(win, text="pause") ck.callback_changed_add(pause_changed_cb, L) ck.show() hbox.pack_end(ck) win.show()
def genlist15_clicked(obj, item=None): win = StandardWindow("genlist-decorate-all-mode", "Genlist Decorate All Mode", autodel=True, size=(520, 520)) bx = Box(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(bx) bx.show() gl = Genlist(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH) gl.show() itc15 = ItemClass15(item_style="default", decorate_all_item_style="edit") itc15.state_get = gl_state_get for i in range(100): ck = Check(gl) data = [i, False] it = GenlistItem( item_class=itc15, item_data=data, parent_item=None, flags=ELM_GENLIST_ITEM_NONE, func=gl15_sel, func_data=data, ).append_to(gl) data.append(it) bx.pack_end(gl) bx.show() bx2 = Box(win, horizontal=True, homogeneous=True, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) bt = Button(win, text="Decorate All mode", size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_HORIZ) bt.callback_clicked_add(gl15_deco_all_mode, gl) bx2.pack_end(bt) bt.show() bt = Button(win, text="Normal mode", size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_HORIZ) bt.callback_clicked_add(gl15_normal_mode, gl) bx2.pack_end(bt) bt.show() bx.pack_end(bx2) bx2.show() win.show()
def index_clicked(obj): win = StandardWindow("index", "Index test", autodel=True, size=(320, 480)) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) vbox = Box(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(vbox) vbox.show() # index idx = Index(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH) idx.callback_delay_changed_add(cb_idx_delay_changed) idx.callback_changed_add(cb_idx_changed) idx.callback_selected_add(cb_idx_selected) win.resize_object_add(idx) idx.show() # genlist itc = GenlistItemClass(item_style="default", text_get_func=gl_text_get) # content_get_func=gl_content_get, # state_get_func=gl_state_get) gl = Genlist(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH) vbox.pack_end(gl) gl.show() for i in 'ABCDEFGHILMNOPQRSTUVZ': for j in 'acegikmo': gl_item = gl.item_append(itc, i + j) if j == 'a': idx_item = idx.item_append(i, cb_idx_item, gl_item) idx_item.data["gl_item"] = gl_item idx.level_go(0) sep = Separator(win, horizontal=True) vbox.pack_end(sep) sep.show() hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_HORIZ) vbox.pack_end(hbox) hbox.show() ck = Check(win, text="autohide_disabled") ck.callback_changed_add(lambda ck: idx.autohide_disabled_set(ck.state)) hbox.pack_end(ck) ck.show() ck = Check(win, text="indicator_disabled") ck.callback_changed_add(lambda ck: idx.indicator_disabled_set(ck.state)) hbox.pack_end(ck) ck.show() ck = Check(win, text="horizontal") ck.callback_changed_add(lambda ck: idx.horizontal_set(ck.state)) hbox.pack_end(ck) ck.show() win.show()
def genlist10_clicked(obj, item=None): win = StandardWindow("genlist-decorate-item-mode", "Genlist Decorate Item Mode", autodel=True, size=(520, 520)) bx = Box(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(bx) bx.show() bx2 = Box(win) bx2.show() fr = Frame(win, text="Decorate Item Mode Type", content=bx2) bx.pack_end(fr) fr.show() rd = Radio(win, size_hint_weight=EXPAND_BOTH, state_value=0, text="Slide : Sweep genlist items to the right.") rd.show() bx2.pack_end(rd) rdg = rd rd = Radio(win, size_hint_weight=EXPAND_BOTH, state_value=1, text="Rotate : Click each item.") rd.group_add(rdg) rd.show() bx2.pack_end(rd) gl = Genlist(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH) gl.callback_drag_start_right_add(my_gl_mode_right, rdg) gl.callback_drag_start_left_add(my_gl_mode_left, rdg) gl.callback_drag_start_up_add(my_gl_mode_cancel, rdg) gl.callback_drag_start_down_add(my_gl_mode_cancel, rdg) gl.show() itc10 = ItemClass10(item_style="default", decorate_item_style="mode") itc10.state_get = gl_state_get for i in range(1000, 1050): GenlistItem(item_class=itc10, item_data=i, parent_item=None, flags=ELM_GENLIST_ITEM_NONE, func=gl_sel10, func_data=(i, rdg)).append_to(gl) bx.pack_end(gl) win.size = 520, 520 win.show()
def image_clicked(obj): win = StandardWindow("image", "Image test", autodel=True, size=(320, 480)) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) vbox = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) win.resize_object_add(vbox) vbox.show() im = Image(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH, file=os.path.join(img_path, "logo.png")) vbox.pack_end(im) im.show() sep = Separator(win, horizontal=True) vbox.pack_end(sep) sep.show() hbox = Box(win, layout=ELM_BOX_LAYOUT_FLOW_HORIZONTAL, size_hint_align=FILL_BOTH) vbox.pack_end(hbox) hbox.show() for rot in orients: b = Button(win, text=rot[0]) hbox.pack_end(b) b.callback_clicked_add(lambda b, y=rot[1]: im.orient_set(y)) b.show() sep = Separator(win, horizontal=True) vbox.pack_end(sep) sep.show() hbox = Box(win, horizontal=True, size_hint_align=FILL_BOTH) vbox.pack_end(hbox) hbox.show() b = Button(win, text="Set remote URL") hbox.pack_end(b) b.callback_clicked_add(lambda b: im.file_set(remote_url)) b.show() pb = Progressbar(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) hbox.pack_end(pb) pb.show() im.callback_download_start_add(_cb_im_download_start, pb) im.callback_download_done_add(_cb_im_download_done) im.callback_download_progress_add(_cb_im_download_progress, pb) im.callback_download_error_add(_cb_im_download_error, pb) win.show()
def theme_clicked(obj, data=None): win = StandardWindow("config", "Theme", autodel=True, size=(400, 200)) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) box = Box(win) box.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND box.show() win.resize_object_add(box) bt = Button(win, text="A button with a custom style") bt.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND bt.style = "my_custom_style" bt.show() box.pack_end(bt) bt = Button(win, text="A button with default style") bt.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND bt.show() box.pack_end(bt) sep = Separator(win, horizontal=True) sep.show() box.pack_end(sep) hbox = Box(win, horizontal=True) hbox.show() box.pack_end(hbox) bt = Button(win, text="Add Extension") bt.callback_clicked_add(add_ext_clicked_cb) bt.show() hbox.pack_end(bt) bt = Button(win, text="Remove Extension") bt.callback_clicked_add(del_ext_clicked_cb) bt.show() hbox.pack_end(bt) bt = Button(win, text="Add Overlay") bt.callback_clicked_add(add_ovr_clicked_cb) bt.show() hbox.pack_end(bt) bt = Button(win, text="Remove Overlay") bt.callback_clicked_add(del_ovr_clicked_cb) bt.show() hbox.pack_end(bt) win.show()
def hover_clicked(obj, item=None): win = StandardWindow("hover", "Hover", autodel=True, size=(320, 320)) bx = Box(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(bx) bx.show() hv = Hover(win) bt = Button(win, text="Button") bt.callback_clicked_add(hover_bt1_clicked, hv) bx.pack_end(bt) bt.show() hv.target = bt bt = Button(win, text="Popup") hv.part_content_set("middle", bt) bt.show() bx = Box(win) ic = Icon(win, file=os.path.join(img_path, "logo_small.png"), resizable=(False, False)) bx.pack_end(ic) ic.show() for t in "Top 1", "Top 2", "Top 3": bt = Button(win, text=t) bx.pack_end(bt) bt.show() bx.show() hv.part_content_set("top", bx) bt = Button(win, text="Bottom") hv.part_content_set("bottom", bt) bt.show() bt = Button(win, text="Left") hv.part_content_set("left", bt) bt.show() bt = Button(win, text="Right") hv.part_content_set("right", bt) bt.show() win.show()
def __init__(self): StandardWindow.__init__(self, "ex7", "Naviframe", size=(300, 200)) self.callback_delete_request_add(lambda o: elm.exit()) staticImage = staticImage = Image(self) staticImage.size_hint_weight = EXPAND_BOTH staticImage.file_set("images/logo.png") staticImage.tooltip_text_set("A picture!") staticImage.show() ourLabel = ourLabel = Label(self) ourLabel.size_hint_weight = EXPAND_BOTH ourLabel.text = "Hey look some text!" ourLabel.show() self.nf = Naviframe(self) self.nf.size_hint_weight = EXPAND_BOTH self.nf.size_hint_align = FILL_BOTH self.nf.show() buttonOne = Button(self) buttonOne.size_hint_weight = EXPAND_BOTH buttonOne.text = "Show image" buttonOne.callback_clicked_add(self.buttonPressed, staticImage) buttonOne.show() buttonTwo = Button(self) buttonTwo.size_hint_weight = EXPAND_BOTH buttonTwo.text = "Show label" buttonTwo.callback_clicked_add(self.buttonPressed, ourLabel) buttonTwo.show() buttonBox = Box(self) buttonBox.size_hint_weight = EXPAND_HORIZ buttonBox.horizontal_set(True) buttonBox.pack_end(buttonOne) buttonBox.pack_end(buttonTwo) buttonBox.show() mainBox = Box(self) mainBox.size_hint_weight = EXPAND_BOTH mainBox.pack_end(self.nf) mainBox.pack_end(buttonBox) mainBox.show() self.nf.item_simple_push(staticImage) self.resize_object_add(mainBox)
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 transit_clicked(obj, item=None): win = StandardWindow("transit", "Transit") win.autodel = True bx = Box(win) bx.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND win.resize_object_add(bx) bx.size_hint_min = 318, 318 bx.show() ic = Image(win, file=os.path.join(img_path, "icon_11.png"), size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)) bt = Button(win, text="ImageAnimation Effect") bt.part_content_set("icon", ic) bx.pack_end(bt) bt.show() ic.show() bt.callback_clicked_add(transit_image_animation, ic) bt = Button(win, text="Color, Rotation and Translation") bx.pack_end(bt) bt.show() bt.callback_clicked_add(transit_rotation_translation_color) bt = Button(win, text="Wipe Effect") bx.pack_end(bt) bt.show() bt.callback_clicked_add(transit_wipe) win.show()
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 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 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): StandardWindow.__init__(self, "ex2", "Deep Icon Test") self.callback_delete_request_add(lambda o: elm.exit()) bx = Box(self) ic1 = DeepIcon(self, 'terminal', 72) ic1.show() bx.pack_end(ic1) ic2 = DeepIcon(self, 'folder', 96) ic2.show() bx.pack_end(ic2) ic3 = DeepIcon(self, 'audio-mp3', 112) ic3.show() bx.pack_end(ic3) ic4 = DeepIcon(self, 'audio-mp3', 112) ic4.show() bx.pack_end(ic4) ic5 = DeepIcon(self, 'close', 146) ic5.show() bx.pack_end(ic5) self.content_set(bx)
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 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 __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 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 buildSubs(self): self.subWin = Window("lifetracker", ELM_WIN_DIALOG_BASIC, self, size=(300, 300)) self.subWin.title = "Life Tracker Assignment" bg = Background(self.subWin, size_hint_weight=EXPAND_BOTH) bg.show() self.subWin.resize_object_add(bg) self.subWin.callback_delete_request_add(lambda o: elm.exit()) self.ourWin = Window("lifetracker", ELM_WIN_DIALOG_BASIC, self, size=(300, 300)) self.ourWin.title = "Life Tracker Key Strokes" bg = Background(self.ourWin, size_hint_weight=EXPAND_BOTH) bg.show() self.ourWin.resize_object_add(bg) self.ourWin.callback_delete_request_add(lambda o: elm.exit()) self.ourWin.elm_event_callback_add(self.eventsCb) self.ourLife = ourLabel = Entry(self.ourWin, editable=False) ourLabel.size_hint_weight = EXPAND_BOTH ourLabel.size_hint_align = FILL_BOTH ourLabel.text_style_user_push("DEFAULT='font_size=20'") ourLabel.text = "Up and Down for Their Life, Left and Right for Mine" ourLabel.show() self.ourEntry = ourEntry = Entry(self.subWin) ourEntry.size_hint_weight = EXPAND_HORIZ ourEntry.size_hint_align = (-1, 0) ourEntry.single_line_set(True) ourEntry.text_style_user_push("DEFAULT='font_size=50'") ourEntry.callback_activated_add(self.ourLifeUpdate) ourEntry.text = "20" ourEntry.show() self.theirEntry = theirEntry = Entry(self.subWin) theirEntry.size_hint_weight = EXPAND_HORIZ theirEntry.size_hint_align = (-1, 0) theirEntry.single_line_set(True) theirEntry.text_style_user_push("DEFAULT='font_size=50'") theirEntry.callback_activated_add(self.theirLifeUpdate) theirEntry.text = "20" theirEntry.show() resetBtn = Button(self.subWin) resetBtn.text = "Reset life totals" resetBtn.callback_pressed_add(self.resetLifeTotals) resetBtn.show() entryBox = Box(self.subWin) entryBox.size_hint_weight = EXPAND_HORIZ entryBox.pack_end(ourEntry) entryBox.pack_end(theirEntry) entryBox.pack_end(resetBtn) entryBox.show() self.ourWin.resize_object_add(ourLabel) self.subWin.resize_object_add(entryBox) self.ourWin.show() self.subWin.show() self.ourWin.center(True, True) self.subWin.center(True, True)
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 __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 core_evas_smart_clicked(obj, item=None): win = StandardWindow("evassmart", "Evas Smart Object Test", autodel=True) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) box = Box(win, horizontal=True, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) box.show() win.resize_object_add(box) b = Button(win, text="Add one", size_hint_align=(0.0,0.0)) b.callback_clicked_add(btn_add_cb) box.pack_end(b) b.show() b = Button(win, text="Del last", size_hint_align=(0.0,0.0)) b.callback_clicked_add(btn_del_cb) box.pack_end(b) b.show() b = Button(win, text="Hide all", size_hint_align=(0.0,0.0)) b.callback_clicked_add(btn_hide_cb) box.pack_end(b) b.show() b = Button(win, text="Show all", size_hint_align=(0.0,0.0)) b.callback_clicked_add(btn_show_cb) box.pack_end(b) b.show() win.resize(320, 320) win.show()
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 __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 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, 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