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 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 __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): 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): 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 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 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 __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 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 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, 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
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 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 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 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, 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, repo, win): self.repo = repo self.win = win self.confirmed = False StandardWindow.__init__(self, 'Egitu', 'Egitu', autodel=True) vbox = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.resize_object_add(vbox) vbox.show() # title en = Entry(self, editable=False, text='<title><align=center>Commit changes</align></title>', size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) vbox.pack_end(en) en.show() panes = Panes(self, content_left_size = 0.2, horizontal=True, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) vbox.pack_end(panes) panes.show() # message entry en = Entry(self, editable=True, scrollable=True, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) en.part_text_set('guide', 'Enter commit message here') panes.part_content_set("left", en) en.show() self.msg_entry = en # diff entry self.diff_entry = DiffedEntry(self) panes.part_content_set("right", self.diff_entry) self.diff_entry.show() # buttons hbox = Box(self, horizontal=True, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) vbox.pack_end(hbox) hbox.show() bt = Button(self, text="Cancel") bt.callback_clicked_add(lambda b: self.delete()) hbox.pack_end(bt) bt.show() bt = Button(self, text="Commit") bt.callback_clicked_add(self.commit_button_cb) hbox.pack_end(bt) bt.show() # show the window and give focus to the editable entry self.size = 500, 500 self.show() en.focus = True # load the diff repo.request_diff(self.diff_done_cb, only_staged=True)
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 __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 = "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 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 __init__(self, rent): Box.__init__(self, rent) self.parent = rent #This appears on the button in the main swmai window self.name = "Light DM" #The section in the main window the button is added to self.section = "System Settings" #Search terms that this module should appear for self.searchData = ["lightdm", "autologin", "login", "display"] #Command line argument to open this module directly self.launchArg = "--lightdm" #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('video-display') self.icon.show() self.mainBox = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.mainBox.show() self.config = {} with open(LightDMConf) as f: for line in f: #Sections start with [ - such as [SeatDefaults] if line[0] != "[": setting, value = line.replace("\n", "").split("=") e = Entry(self) e.single_line_set(True) e.text = value e.show() f = Frame(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) f.text = setting f.content = e f.show() self.mainBox.pack_end(f) self.config[setting] = f buttonBox = Box(self, size_hint_weight = EXPAND_HORIZ, size_hint_align = FILL_BOTH) buttonBox.horizontal = True buttonSave = StandardButton(self, "Save Changes", "ok", self.savePressed) buttonSave.show() buttonReturn = StandardButton(self, "Back", "go-previous", self.returnPressed) buttonReturn.show() buttonBox.pack_end(buttonSave) buttonBox.pack_end(buttonReturn) buttonBox.show() self.pack_end(self.mainBox) self.pack_end(buttonBox)
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 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 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 box_horiz_clicked(obj, item=None): win = StandardWindow("box-horiz", "Box Horiz", autodel=True) bx = Box(win, horizontal=True, size_hint_weight=EXPAND_BOTH) win.resize_object_add(bx) bx.show() for align in ((0.5, 0.5), (0.5, 0.0), (0.0, EVAS_HINT_EXPAND)): ic = Icon(win, file=ic_file, resizable=(0, 0), size_hint_align=align) bx.pack_end(ic) ic.show() win.show()
def conformant_clicked(obj, item=None): win = StandardWindow("conformant", "Conformant", autodel=True, conformant=True, size=(240,240)) conform = Conformant(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(conform) conform.show() bx = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) en = ScrollableEntry(win, single_line=True, bounce=(True, False), text="This is the top entry here", size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) en.show() bx.pack_end(en) btn = Button(win, text="Test Conformant", size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) bx.pack_end(btn) btn.show() en = ScrollableEntry(win, single_line=True, bounce=(True, False), text="This is the middle entry here", size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) en.show() bx.pack_end(en) btn = Button(win, text="Test Conformant", size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) bx.pack_end(btn) btn.show() en = ScrollableEntry(win, bounce=(False, True), size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) en.text = \ "This is a multi-line entry at the bottom<br/>" \ "This can contain more than 1 line of text and be " \ "scrolled around to allow for entering of lots of " \ "content. It is also to test to see that autoscroll " \ "moves to the right part of a larger multi-line " \ "text entry that is inside of a scroller than can be " \ "scrolled around, thus changing the expected position " \ "as well as cursor changes updating auto-scroll when " \ "it is enabled." en.show() bx.pack_end(en) conform.content = bx bx.show() 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 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 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 bubble_clicked(obj, item=None): win = StandardWindow("bubble", "Bubble", autodel=True, size=(320,320)) bx = Box(win) win.resize_object_add(bx) bx.size_hint_weight = EXPAND_BOTH bx.show() # bb 1 ic = Icon(win, file=ic_file, size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)) lb = Label(win, text="Blah, Blah, Blah") bb = Bubble(win, text = "Message 1", content = lb, pos = ELM_BUBBLE_POS_TOP_LEFT, size_hint_weight = EXPAND_BOTH, size_hint_align = FILL_BOTH) bb.part_text_set("info", "Corner: top_left") bb.part_content_set("icon", ic) bx.pack_end(bb) bb.show() # bb 2 ic = Icon(win, file=ic_file, size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)) lb = Label(win, text="Blah, Blah, Blah") bb = Bubble(win, text = "Message 2", content = lb, pos = ELM_BUBBLE_POS_TOP_RIGHT, size_hint_weight = EXPAND_BOTH, size_hint_align = FILL_BOTH) bb.part_text_set("info", "Corner: top_right") bb.part_content_set("icon", ic) bx.pack_end(bb) bb.show() # bb 3 ic = Icon(win, file=ic_file, size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)) lb = Label(win, text="Blah, Blah, Blah") bb = Bubble(win, text = "Message 3", content = ic, pos = ELM_BUBBLE_POS_BOTTOM_LEFT, size_hint_weight = EXPAND_BOTH, size_hint_align = FILL_BOTH) bb.part_text_set("info", "Corner: bottom_left") bx.pack_end(bb) bb.show() # bb 4 ic = Icon(win, file=ic_file, size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)) lb = Label(win, text="Blah, Blah, Blah") bb = Bubble(win, text = "Message 4", content = lb, pos = ELM_BUBBLE_POS_BOTTOM_RIGHT, size_hint_weight = EXPAND_BOTH, size_hint_align = FILL_BOTH) bb.part_text_set("info", "Corner: bottom_right") bb.part_content_set("icon", ic) bx.pack_end(bb) bb.show() win.show()
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 buildLoadBox(self): # build the load label loadLable = Label(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_HORIZ) loadLable.text = "<b>Processing</b>" loadLable.show() # build the spinning wheel wheel = Progressbar(self, pulse_mode=True, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_HORIZ) wheel.pulse(True) wheel.show() detailsbtn = Button(self, style="anchor") detailsbtn.text_set("Details") detailsbtn.callback_pressed_add(self.innerWinShow) detailsbtn.show() # build the status label self.statusLabel = Label(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_HORIZ) self.statusLabel.show() # put all the built objects in a vertical box box = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) box.pack_end(loadLable) box.pack_end(wheel) box.pack_end(self.statusLabel) box.pack_end(detailsbtn) box.show() return box
def focus3_clicked(obj, item=None): win = StandardWindow("focus3", "Focus 3", autodel=True, size=(320, 480)) win.focus_highlight_enabled = True bx = Box(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(bx) bx.show() en = Entry(win, scrollable=True, single_line=True, text="An entry", size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) en.callback_focused_add(_focused_cb) en.callback_unfocused_add(_unfocused_cb) bx.pack_end(en) en.show() bt = Button(win, text="Add", focus_allow=False, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) bt.callback_clicked_add(_add_cb, win, bx) bx.pack_end(bt) bt.show() bt = Button(win, text="Del", focus_allow=False, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) bt.callback_clicked_add(_del_cb, bx) bx.pack_end(bt) bt.show() bt = Button(win, text="hide", focus_allow=False, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) bt.callback_clicked_add(_hide_cb) bx.pack_end(bt) bt.show() win.show()
def buttons_clicked(obj): win = StandardWindow("buttons", "Buttons", focus_highlight_enabled=True, 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() ic = Icon(win, file=ic_file, size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)) ic.show() bt = Button(win, text="Icon sized to button", content=ic) bx.pack_end(bt) bt.show() ic = Icon(win, file=ic_file, resizable=(False, False)) ic.show() bt = Button(win, text="Icon no scale", content=ic) bx.pack_end(bt) bt.show() bt = Button(win, text="No icon") bx.pack_end(bt) bt.show() ic = Icon(win, file=ic_file, resizable=(False, False)) bt = Button(win, content=ic) bx.pack_end(bt) bt.show() ic.show() win.show()
def __init__(self, parent): InnerWindow.__init__(self, parent) vbox = Box(self) vbox.show() self.content = vbox title = Label(self, scale=2.0, text='Edone %s' % VERSION) title.show() vbox.pack_end(title) en = Entry(self, text=INFO, editable=False, scrollable=True, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) en.show() vbox.pack_end(en) sep = Separator(self, horizontal=True) sep.show() vbox.pack_end(sep) close = Button(self, text='Close') close.callback_clicked_add(lambda b: self.delete()) close.show() vbox.pack_end(close) self.activate()
def check_clicked(obj): win = StandardWindow("check", "Check test", 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() ic = Icon(win, file=ic_file, size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)) ck = Check(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_HORIZ, text="Icon sized to check", content=ic, state=True ) ck.callback_changed_add(ck_1) bx.pack_end(ck) ck.show() ic.show() ic = Icon(win, file=ic_file, resizable=(0, 0)) ck = Check(win, text="Icon no scale", content=ic) ck.callback_changed_add(ck_2) bx.pack_end(ck) ck.show() ic.show() ck = Check(win, text="Label Only") ck.callback_changed_add(ck_3) bx.pack_end(ck) ck.show() ic = Icon(win, file=ic_file, size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)) ck = Check(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_HORIZ, text="Disabled check", content=ic, state=True ) ck.callback_changed_add(ck_never) bx.pack_end(ck) ck.disabled_set(True) ck.show() ic.show() ic = Icon(win, file=ic_file, size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1), resizable=(0, 0)) ck = Check(win, content=ic) ck.callback_changed_add(ck_4) bx.pack_end(ck) ck.show() ic.show() 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 __init__(self): """Creates the window and its contents. :attribute memory: The first operand. :attribute operand: The operand to join the both values. :attribute field: The input/display field. :attribute table: Formatting table holding the buttons. """ # Create mathematical attributes. self.memory = '' self.operand = None self.display_is_result = False # Create the main window. self.window = StandardWindow("eCalculate", "eCalculate", autodel=True, size=(300, 300)) # Create box that holds all GUI elements. box = Box(self.window, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.window.resize_object_add(box) box.show() # Create Input field. self.field = Entry(self.window, single_line=True, size_hint_weight=EXPAND_HORIZONTAL, size_hint_align=FILL_HORIZONTAL) self.field.markup_filter_append(self.filter_markup) box.pack_end(self.field) self.field.show() # Create table holding the buttons. self.table = Table(self.window, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) box.pack_end(self.table) self.table.show() # Create buttons. self.add_button(x=0, y=2, text='1', char='1') self.add_button(x=1, y=2, text='2', char='2') self.add_button(x=2, y=2, text='3', char='3') self.add_button(x=0, y=1, text='4', char='4') self.add_button(x=1, y=1, text='5', char='5') self.add_button(x=2, y=1, text='6', char='6') self.add_button(x=0, y=0, text='7', char='7') self.add_button(x=1, y=0, text='8', char='8') self.add_button(x=2, y=0, text='9', char='9') self.add_button(x=0, y=3, text='0', char='0') self.add_button(x=4, y=0, text='÷', char='/') self.add_button(x=4, y=1, text='×', char='*') self.add_button(x=4, y=2, text='−', char='-') self.add_button(x=4, y=3, text='+', char='+') self.add_button(x=2, y=3, text='=', char='=') self.add_button(x=1, y=3, text='.', char='.') # Finally show the window. self.window.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 __init__(self, parent, app, branch): self.app = app self.branch = branch Popup.__init__(self, parent) self.part_text_set("title,text", "Delete branch") self.part_content_set("title,icon", Icon(self, standard="user-trash")) # main vertical box box = Box(self) self.content = box box.show() # sep sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_BOTH) box.pack_end(sep) sep.show() # label en = Entry( self, editable=False, text="%s<br><br><hilight>%s</hilight><br>" % ("Are you sure you want to delete this branch?", branch.name), size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH, ) box.pack_end(en) en.show() # force checkbox ck = Check( self, text="Force delete (even if not fully merged)", size_hint_expand=EXPAND_BOTH, size_hint_align=(0.0, 0.5), ) box.pack_end(ck) ck.show() self.force_chk = ck # buttons sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_BOTH) box.pack_end(sep) sep.show() bt = Button(self, text="Cancel") bt.callback_clicked_add(lambda b: self.delete()) self.part_content_set("button1", bt) bt.show() bt = Button(self, text="Delete branch") bt.callback_clicked_add(self._delete_btn_cb) self.part_content_set("button2", bt) bt.show() # self.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 __init__(self, parent_widget, *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.cb_changed) 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() hbx = Box(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) hbx.horizontal = True hbx.show() frame.content = hbx 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.cb_enter) self.input.show() enter_btn = Button(self) enter_btn.text = 'Execute' enter_btn.callback_pressed_add(self.cb_enter) enter_btn.show() hbx.pack_end(self.input) hbx.pack_end(enter_btn) self.pack_end(self.output) self.pack_end(frame) self.cmd_exe = None self.done_cb = None
def __init__(self, rent): Box.__init__(self, rent) self.parent = rent self.name = "Keyboard Layout" self.section = "System Settings" self.searchData = ["keyboard", "layout", "system", "input"] self.launchArg = "--keyboard" 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('input-keyboard') self.icon.show() #print(list(KeyboardLayouts)) self.keyboardList = keyboardList = SearchableList(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) keyboardList.callback_item_focused_add(self.enableKBSelect) self.keys = list(KeyboardLayouts) self.keys.sort() for kbl in self.keys: keyboardList.item_append(kbl) keyboardList.show() self.mainBox = Box(self, size_hint_weight = EXPAND_BOTH, size_hint_align = FILL_BOTH) self.mainBox.pack_end(keyboardList) self.mainBox.show() buttonBox = Box(self, size_hint_weight = EXPAND_HORIZ, size_hint_align = FILL_BOTH) buttonBox.horizontal = True self.buttonKBSelect = buttonKBSelect = StandardButton(self, "Apply Selected", "ok", self.applyPressed) buttonKBSelect.disabled = True buttonKBSelect.show() buttonReturn = StandardButton(self, "Back", "go-previous", self.returnPressed) buttonReturn.show() buttonBox.pack_end(buttonKBSelect) buttonBox.pack_end(buttonReturn) buttonBox.show() self.pack_end(self.mainBox) self.pack_end(buttonBox)
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()