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 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 _settings_open(self, obj, it): h = Hover(self) t = it.track_object h.pos = t.bottom_center del t del it.track_object l = List(h) l.mode = ELM_LIST_EXPAND h.part_content_set("bottom", l) l.show() chk = Check(self, text="Scroll By Page") chk.state = self.settings["scroll_by_page"] def _scroll_by_page_cb(obj): target_state = obj.state self.settings["scroll_by_page"] = target_state if self.tabs.currentContent: if target_state: self.tabs.currentContent.scroll_freeze() else: self.tabs.currentContent.scroll_thaw() h.dismiss() chk.callback_changed_add(_scroll_by_page_cb) l.item_append(None, chk) l.go() h.show()
def content_get(self, obj, part, data): checked = data[1] # "edit" EDC layout is like below. each part is swallow part. # the existing item is swllowed to elm.swallow.edit.content part. # -------------------------------------------------------------------- # | elm.edit.icon.1 | elm.swallow.decorate.content | elm.edit.icon,2 | # -------------------------------------------------------------------- if part == "elm.swallow.end": ic = Icon(obj, file=os.path.join(img_path, "bubble.png"), size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)) return ic elif part == "elm.edit.icon.1": ck = Check(obj, state=checked, propagate_events=False) ck.show() return ck elif part == "elm.edit.icon.2": icn = Icon(obj, file=os.path.join(img_path, "icon_06.png"), propagate_events=False, size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)) icn.callback_clicked_add(edit_icon_clicked_cb, data) return icn else: return
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 signal_clicked_cb(self, gl, item): pp = Popup(self._parent) pp.part_text_set('title,text', 'Signal content') en = Entry(self, text=prettify_if_needed(item.data['args'])) en.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND en.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL en.size_hint_min = 800, 800 # TODO: this should be respected :/ en.editable = False en.scrollable = True pp.content = en bt = Button(pp, text="Close") bt.callback_clicked_add(lambda b: pp.delete()) pp.part_content_set('button2', bt) def prettify_clicked_cb(chk): options.pretty_output = chk.state en.text = prettify_if_needed(item.data['args']) ck = Check(pp, text="Prettify") ck.state = options.pretty_output ck.callback_changed_add(prettify_clicked_cb) pp.part_content_set('button1', ck) pp.show()
def fileselector_entry_clicked(obj, item=None): win = StandardWindow("fileselector", "File selector test", autodel=True, size=(240, 150)) vbox = Box(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(vbox) vbox.show() fse = FileselectorEntry(win, text="Select a file", inwin_mode=False, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH) vbox.pack_end(fse) fse.show() sep = Separator(win, horizontal=True) vbox.pack_end(sep) sep.show() hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_BOTH) vbox.pack_end(hbox) hbox.show() ck = Check(win, text="inwin", state=fse.inwin_mode) ck.callback_changed_add(toggle_inwin, fse) hbox.pack_end(ck) ck.show() ck = Check(win, text="folder_only", state=fse.folder_only) ck.callback_changed_add(toggle_folder_only, fse) hbox.pack_end(ck) ck.show() ck = Check(win, text="is_save", state=fse.is_save) ck.callback_changed_add(toggle_is_save, fse) hbox.pack_end(ck) ck.show() ck = Check(win, text="expandable", state=fse.expandable) ck.callback_changed_add(toggle_expandable, fse) hbox.pack_end(ck) ck.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 content_get(self, obj, part, data): file_entry, progress, n, h = data if part == "elm.swallow.icon": check = Check(obj) check.tooltip_text_set("Enable/disable file download") check.state = h.file_priorities()[n] check.callback_changed_add(self.toggle_file_enabled, n, h) return check
def icon_clicked(obj, item=None): win = StandardWindow("icon test", "Icon Test", autodel=True, size=(400, 400)) win.show() box = Box(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(box) box.show() ic = Icon(box, file=os.path.join(img_path, "logo.png"), resizable=(True, True), size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) box.pack_end(ic) ic.show() hbox = Box(box, horizontal=True, size_hint_weight=EXPAND_HORIZ) box.pack_end(hbox) hbox.show() # Test Aspect Fixed tg = Check(hbox, text="Aspect Fixed", state=True) tg.callback_changed_add(aspect_fixed_cb, ic) hbox.pack_end(tg) tg.show() # Test Fill Outside tg = Check(hbox, text="Fill Outside") tg.callback_changed_add(fill_outside_cb, ic) hbox.pack_end(tg) tg.show() # Test Smooth tg = Check(hbox, text="Smooth", state=True) tg.callback_changed_add(smooth_cb, ic) hbox.pack_end(tg) tg.show() # Test Preload, Prescale bt = Button(hbox, text="Preload & Prescale") bt.callback_clicked_add(bt_clicked) hbox.pack_end(bt) bt.show()
def __init__(self, parent, session): self.session = session conf = session.conf PreferencesDialog.__init__(self, "General") limits = Limits(self, session) ports = ListenPorts(self, session) pe = EncryptionSettings(self, session) dlsel = DataStorageSelector(self, conf) pad = Rectangle(self.evas) pad.color = 0, 0, 0, 0 pad.size_hint_min = 0, 10 sep1 = Separator(self) sep1.horizontal = True chk1 = Check(self) chk1.size_hint_align = 0.0, 0.0 chk1.text = "Delete original .torrent file when added" chk1.state = conf.getboolean("Settings", "delete_original") chk1.callback_changed_add(lambda x: conf.set( "Settings", "delete_original", str(bool(chk1.state)))) chk2 = Check(self) chk2.size_hint_align = 0.0, 0.0 chk2.text = "Ask for confirmation on exit" chk2.state = conf.getboolean("Settings", "confirmations") chk2.callback_changed_add(lambda x: conf.set( "Settings", "confirmations", str(bool(chk2.state)))) sep2 = Separator(self) sep2.horizontal = True for w in ports, limits, dlsel, pe, pad, sep1, chk1, chk2, sep2: w.show() self.box.pack_end(w)
def __init__(self, parent, session): self.session = session Frame.__init__(self, parent) self.size_hint_align = -1.0, 0.0 self.text = "Encryption settings" pes = self.pes = session.get_pe_settings() b = Box(parent) enc_values = lt.enc_policy.disabled, lt.enc_policy.enabled, lt.enc_policy.forced enc_levels = lt.enc_level.plaintext, lt.enc_level.rc4, lt.enc_level.both inc = self.inc = ActSWithLabel(parent, "Incoming encryption", enc_values, pes.in_enc_policy) b.pack_end(inc) inc.show() out = self.out = ActSWithLabel(parent, "Outgoing encryption", enc_values, pes.out_enc_policy) b.pack_end(out) out.show() lvl = self.lvl = ActSWithLabel(parent, "Allowed encryption level", enc_levels, pes.allowed_enc_level) b.pack_end(lvl) lvl.show() prf = self.prf = Check(parent) prf.style = "toggle" prf.text = "Prefer RC4 ecryption" prf.state = pes.prefer_rc4 b.pack_end(prf) prf.show() a_btn = Button(parent) a_btn.text = "Apply" a_btn.callback_clicked_add(self.apply) b.pack_end(a_btn) a_btn.show() b.show() self.content = b
def __init__(self, parent, canvas): Toolbar.__init__(self, canvas) self._parent = parent self._canvas = canvas self.homogeneous = False self.size_hint_weight = (0.0, 0.0) self.size_hint_align = (EVAS_HINT_FILL, 0.0) self.select_mode = ELM_OBJECT_SELECT_MODE_NONE self.menu_parent = canvas self.item_append("document-new", "New", self.newPress) self.item_append("document-open", "Open", self.openPress) self.item_append("document-save", "Save", self.savePress) self.item_append("document-save-as", "Save As", self.saveAsPress) # -- Edit Dropdown Menu -- tb_it = self.item_append("edit", "Edit") tb_it.menu = True menu = tb_it.menu menu.item_add(None, "Copy", "edit-copy", self.copyPress) menu.item_add(None, "Paste", "edit-paste", self.pastePress) menu.item_add(None, "Cut", "edit-cut", self.cutPress) menu.item_separator_add() menu.item_add(None, "Select All", "edit-select-all", self.selectAllPress) # ----------------------- # # -- Options Dropdown Menu -- # # self.item_append("settings", "Options", self.optionsPress) tb_it = self.item_append("preferences-desktop", "Options") tb_it.menu = True menu = tb_it.menu self._parent.wordwrap = WORD_WRAP it = menu.item_add(None, "Wordwrap", None, self.optionsWWPress) chk = Check(canvas, disabled=True) it.content = chk # --------------------------- self.item_append("dialog-information", "About", self.aboutPress)
def __init__(self, parent): Frame.__init__(self, parent, text="Signals") self._parent = parent vbox = Box(self) vbox.show() self.content = vbox self.siglist = Genlist(self, homogeneous=True, mode=ELM_LIST_SCROLL) self.siglist.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND self.siglist.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL self.siglist.callback_clicked_double_add(self.signal_clicked_cb) self.siglist.show() vbox.pack_end(self.siglist) self.itc = SignalItemClass() hbox = Box(self, horizontal=True) hbox.size_hint_align = 0.0, 0.5 hbox.show() vbox.pack_end(hbox) bt = Button(self, text='Clear') bt.callback_clicked_add(lambda b: self.siglist.clear()) hbox.pack_end(bt) bt.show() def scroll_on_signal_clicked_cb(chk): options.scroll_on_signal = chk.state ck = Check(self, text='Scroll on signal') ck.state = options.scroll_on_signal ck.callback_changed_add(scroll_on_signal_clicked_cb) hbox.pack_end(ck) ck.show() for b in session_bus, system_bus: b.add_signal_receiver(self.signal_cb, sender_keyword='sender', destination_keyword='dest', interface_keyword='iface', member_keyword='signal', path_keyword='path')
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 addPackage(self, pak): row = [] ourCheck = Check(self) ourCheck.data['packageName'] = pak.name ourCheck.callback_changed_add(self.app.checkChange) ourCheck.show() row.append(ourCheck) ourName = Button(self, style="anchor", size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) ourName.text = pak.name ourName.data["packageDes"] = pak.candidate.description ourName.callback_pressed_add(self.packagePressed) ourName.show() row.append(ourName) ourVersion = Label(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=(0.1, 0.5)) ourVersion.text = pak.installed.version ourVersion.show() row.append(ourVersion) newVersion = Label(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=(0.1, 0.5)) newVersion.text = pak.candidate.version newVersion.show() row.append(newVersion) self.app.packagesToUpdate[pak.name] = { 'check': ourCheck, 'selected': False } self.packageList.row_pack(row, sort=False)
def __init__(self, parent, method): Popup.__init__(self, parent) self._method = method self._param_entry = None self._return_entry = None # title self.part_text_set('title,text', 'Method: %s()' % method.name) self.show() # content is vbox vbox = Box(parent) vbox.show() self.content = vbox # params label + entry if len(method.params) > 0: label = Label(parent) label.size_hint_align = 0.0, 0.5 label.text = 'Params: ' + method.params_str label.show() vbox.pack_end(label) en = Entry(parent) self._param_entry = en en.editable = True en.scrollable = True en.single_line = True en.entry = '' en.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND en.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL en.show() vbox.pack_end(en) sp = Separator(win) sp.horizontal = True sp.show() vbox.pack_end(sp) # returns label + entry label = Label(parent) label.size_hint_align = 0.0, 0.5 label.text = 'Returns: ' label.text += method.returns_str if method.returns_str else 'None' label.show() vbox.pack_end(label) en = Entry(parent) self._return_entry = en en.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND en.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL en.editable = False en.scrollable = True en.disabled = True en.single_line = True # TODO this is wrong, but the only way to show the entry :/ en.entry = '<br> <br> <br>' en.show() vbox.pack_end(en) # pretty print check button def pretty_output_clicked_cb(chk): options.pretty_output = chk.state ch = Check(parent) ch.size_hint_align = 0.0, 0.5 ch.text = "Prettify output (loosing type infos)" ch.state = options.pretty_output ch.callback_changed_add(pretty_output_clicked_cb) ch.show() vbox.pack_end(ch) # popup buttons btn = Button(parent) btn.text = 'Close' btn.callback_clicked_add(lambda b: self.delete()) self.part_content_set('button1', btn) btn = Button(parent) btn.text = 'Clear output' btn.callback_clicked_add(lambda b: self._return_entry.entry_set('')) self.part_content_set('button2', btn) btn = Button(parent) btn.text = 'Run method' btn.callback_clicked_add(self.run_clicked_cb) self.part_content_set('button3', btn)
def __init__(self, app): self.app = app self.prog_popup = None # the window StandardWindow.__init__(self, 'epack', 'Epack') self.autodel_set(True) self.callback_delete_request_add(lambda o: self.app.exit()) ### main table (inside a padding frame) frame = Frame(self, style='pad_small', size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.resize_object_add(frame) frame.content = table = Table(frame) frame.show() ### header horiz box self.header_box = Box(self, horizontal=True, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) table.pack(self.header_box, 0, 0, 3, 1) self.header_box.show() # genlist with archive content (inside a small padding frame) frame = Frame(self, style='pad_small', size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) table.pack(frame, 0, 1, 3, 1) self.file_itc = GenlistItemClass(item_style="no_icon", text_get_func=self._gl_file_text_get) self.fold_itc = GenlistItemClass( item_style="one_icon", text_get_func=self._gl_fold_text_get, content_get_func=self._gl_fold_icon_get) self.file_list = Genlist(frame, homogeneous=True) self.file_list.callback_expand_request_add(self._gl_expand_req_cb) self.file_list.callback_contract_request_add(self._gl_contract_req_cb) self.file_list.callback_expanded_add(self._gl_expanded_cb) self.file_list.callback_contracted_add(self._gl_contracted_cb) frame.content = self.file_list frame.show() # rect hack to force a min size on the genlist r = evas.Rectangle(table.evas, size_hint_min=(250, 250), size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) table.pack(r, 0, 1, 3, 1) # FileSelectorButton self.fsb = DestinationButton(app, self) table.pack(self.fsb, 0, 2, 3, 1) self.fsb.show() sep = Separator(table, horizontal=True, size_hint_weight=EXPAND_HORIZ) table.pack(sep, 0, 3, 3, 1) sep.show() # extract button self.extract_btn = Button(table, text=_('Extract')) self.extract_btn.callback_clicked_add(self.extract_btn_cb) table.pack(self.extract_btn, 0, 4, 1, 2) self.extract_btn.show() sep = Separator(table, horizontal=False) table.pack(sep, 1, 4, 1, 2) sep.show() # delete-archive checkbox self.del_chk = Check(table, text=_('Delete archive after extraction'), size_hint_weight=EXPAND_HORIZ, size_hint_align=(0.0, 1.0)) self.del_chk.callback_changed_add(self.del_check_cb) table.pack(self.del_chk, 2, 4, 1, 1) self.del_chk.show() # create-archive-folder checkbox self.create_folder_chk = Check(table, text=_('Create archive folder'), size_hint_weight=EXPAND_HORIZ, size_hint_align=(0.0, 1.0)) table.pack(self.create_folder_chk, 2, 5, 1, 1) self.create_folder_chk.callback_changed_add( lambda c: self.update_fsb_label()) self.create_folder_chk.show() # set the correct ui state self.update_ui() # show the window self.show()
def window_states_clicked(obj): win = Window("window-states", ELM_WIN_BASIC, title="Window States test", autodel=True, size=(280, 400)) win.callback_moved_add(cb_win_moved) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) print(win.available_profiles) bg = Background(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(bg) bg.show() vbox = Box(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(vbox) vbox.show() hbox = Box(win, horizontal=True, size_hint_align=FILL_HORIZ, size_hint_weight=EXPAND_HORIZ) vbox.pack_end(hbox) hbox.show() for state in [True, False]: bt = Button(win, text="Alpha " + ("On" if state else "Off"), size_hint_align=FILL_HORIZ, size_hint_weight=EXPAND_HORIZ) bt.callback_clicked_add(cb_alpha, win, bg, state) hbox.pack_end(bt) bt.show() for state in [True, False]: bt = Button(win, text="FS " + ("On" if state else "Off"), size_hint_align=FILL_HORIZ, size_hint_weight=EXPAND_HORIZ) bt.callback_clicked_add(cb_fullscreen, win, state) hbox.pack_end(bt) bt.show() sl = Slider(win, text="Visual test", indicator_format="%3.0f", min_max=(50, 150), value=50, inverted=True, size_hint_weight=EXPAND_BOTH, size_hint_align=(0.5, EVAS_HINT_FILL)) vbox.pack_end(sl) sl.show() ck = Check(win, text="Resize on rotate", size_hint_align=(0.0, 0.0)) vbox.pack_end(ck) ck.show() hbox = Box(win, horizontal=True, size_hint_align=FILL_HORIZ, size_hint_weight=EXPAND_HORIZ) vbox.pack_end(hbox) hbox.show() for rot in [0, 90, 180, 270]: bt = Button(win, text="Rot " + str(rot), size_hint_align=FILL_HORIZ, size_hint_weight=EXPAND_HORIZ) bt.callback_clicked_add(cb_rot, win, ck, rot) hbox.pack_end(bt) bt.show() win.show()
def gengrid_clicked(obj): global item_count item_count = 25 win = StandardWindow("gengrid", "Gengrid", autodel=True, size=(480, 800)) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) tb = Table(win, homogeneous=False, size_hint_weight=EXPAND_BOTH) win.resize_object_add(tb) tb.show() # gengrid itc = GengridItemClass(item_style="default", text_get_func=gg_text_get, content_get_func=gg_content_get, state_get_func=gg_state_get, del_func=gg_del) gg = ScrollableGengrid(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH, horizontal=False, bounce=(False, True), item_size=(80, 80), align=(0.5, 0.0)) tb.pack(gg, 0, 0, 6, 1) gg.callback_selected_add(gg_sel) gg.callback_unselected_add(gg_unsel) gg.callback_clicked_double_add(gg_clicked_double) gg.show() # add the first items for i in range(item_count): gg.item_append(itc, i, None) # multi select def multi_select_changed(bt, gg): gg.multi_select_set(bt.state) print((gg.multi_select)) bt = Check(win, text="MultiSelect", state=gg.multi_select) bt.callback_changed_add(multi_select_changed, gg) tb.pack(bt, 0, 1, 1, 1) bt.show() # horizontal def horizontal_changed(bt, gg): gg.horizontal_set(bt.state) bt = Check(win, text="Horizontal") bt.callback_changed_add(horizontal_changed, gg) tb.pack(bt, 1, 1, 1, 1) bt.show() # bounce h def bounce_h_changed(bt, gg): (h_bounce, v_bounce) = gg.bounce_get() gg.bounce_set(bt.state, v_bounce) print((gg.bounce_get())) bt = Check(win, text="BounceH") h_bounce = gg.bounce[0] bt.state = h_bounce bt.callback_changed_add(bounce_h_changed, gg) tb.pack(bt, 4, 1, 1, 1) bt.show() # bounce v def bounce_v_changed(bt, gg): (h_bounce, v_bounce) = gg.bounce_get() gg.bounce_set(h_bounce, bt.state) print((gg.bounce_get())) bt = Check(win, text="BounceV") v_bounce = gg.bounce[1] bt.state = v_bounce bt.callback_changed_add(bounce_v_changed, gg) tb.pack(bt, 5, 1, 1, 1) bt.show() # item size def item_size_w_changed(sl, gg): (w, h) = gg.item_size_get() gg.item_size_set(sl.value, h) print((gg.item_size_get())) def item_size_h_changed(sl, gg): (w, h) = gg.item_size_get() gg.item_size_set(w, sl.value) print((gg.item_size_get())) (w, h) = gg.item_size sl = Slider(win, text="ItemSizeW", min_max=(0, 500), indicator_format="%.0f", unit_format="%.0f", span_size=100, value=w) sl.callback_changed_add(item_size_w_changed, gg) tb.pack(sl, 0, 2, 2, 1) sl.show() sl = Slider(win, text="ItemSizeH", min_max=(0, 500), indicator_format="%.0f", unit_format="%.0f", span_size=100, value=h) sl.callback_changed_add(item_size_h_changed, gg) tb.pack(sl, 0, 3, 2, 1) sl.show() # align def alignx_changed(sl, gg): (ax, ay) = gg.align gg.align = sl.value, ay print(gg.align) def aligny_changed(sl, gg): (ax, ay) = gg.align gg.align = ax, sl.value print(gg.align) (ax, ay) = gg.align sl = Slider(win, text="AlignX", min_max=(0.0, 1.0), indicator_format="%.2f", unit_format="%.2f", span_size=100, value=ax) sl.callback_changed_add(alignx_changed, gg) tb.pack(sl, 0, 4, 2, 1) sl.show() sl = Slider(win, text="AlignY", min_max=(0.0, 1.0), indicator_format="%.2f", unit_format="%.2f", span_size=100, value=ay) sl.callback_changed_add(aligny_changed, gg) tb.pack(sl, 0, 5, 2, 1) sl.show() # select first def select_first_clicked(bt, gg): ggi = gg.first_item if ggi: ggi.selected = not ggi.selected bt = Button(win, size_hint_align=FILL_HORIZ, text="Select first") bt.callback_clicked_add(select_first_clicked, gg) tb.pack(bt, 2, 2, 1, 1) bt.show() # select last def select_last_clicked(bt, gg): ggi = gg.last_item if ggi: ggi.selected = not ggi.selected bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="Select last") bt.callback_clicked_add(select_last_clicked, gg) tb.pack(bt, 3, 2, 1, 1) bt.show() # selection del def seldel_clicked(bt, gg): for ggi in gg.selected_items_get(): ggi.delete() bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="Sel del") bt.callback_clicked_add(seldel_clicked, gg) tb.pack(bt, 4, 2, 1, 1) bt.show() # clear def clear_clicked(bt, gg): global item_count item_count = 0 gg.clear() bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="Clear") bt.callback_clicked_add(clear_clicked, gg) tb.pack(bt, 5, 2, 1, 1) bt.show() # show first/last def show_clicked(bt, gg, first): ggi = gg.first_item if first else gg.last_item if ggi: ggi.show() bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="Show first") bt.callback_clicked_add(show_clicked, gg, True) tb.pack(bt, 2, 3, 1, 1) bt.show() bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="Show last") bt.callback_clicked_add(show_clicked, gg, False) tb.pack(bt, 3, 3, 1, 1) bt.show() # bring-in first/last def bring_in_clicked(bt, gg, first): ggi = gg.first_item if first else gg.last_item if ggi: ggi.bring_in() bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="BringIn first") bt.callback_clicked_add(bring_in_clicked, gg, True) tb.pack(bt, 4, 3, 1, 1) bt.show() bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="BringIn last") bt.callback_clicked_add(bring_in_clicked, gg, False) tb.pack(bt, 5, 3, 1, 1) bt.show() # append def append_clicked(bt, gg, n): global item_count while n: item_count += 1 gg.item_append(itc, item_count, None) n -= 1 bt = Button(win, size_hint_align=FILL_HORIZ, text="Append 1") bt.callback_clicked_add(append_clicked, gg, 1) tb.pack(bt, 2, 4, 1, 1) bt.show() bt = Button(win, size_hint_align=FILL_HORIZ, text="Append 100") bt.callback_clicked_add(append_clicked, gg, 100) tb.pack(bt, 3, 4, 1, 1) bt.show() bt = Button(win, size_hint_align=FILL_HORIZ, text="Append 1000") bt.callback_clicked_add(append_clicked, gg, 1000) tb.pack(bt, 4, 4, 1, 1) bt.show() bt = Button(win, size_hint_align=FILL_HORIZ, text="Append 10000 :)") bt.callback_clicked_add(append_clicked, gg, 10000) tb.pack(bt, 5, 4, 1, 1) bt.show() # prepend def prepend_clicked(bt, gg): global item_count item_count += 1 gg.item_prepend(itc, item_count) bt = Button(win, size_hint_align=FILL_HORIZ, text="Prepend") bt.callback_clicked_add(prepend_clicked, gg) tb.pack(bt, 2, 5, 1, 1) bt.show() # insert_before def ins_before_clicked(bt, gg): global item_count item_count += 1 before = gg.selected_item_get() if before: gg.item_insert_before(itc, item_count, before) else: print("nothing selected") bt = Button(win, size_hint_align=FILL_HORIZ, text="Ins before") bt.callback_clicked_add(ins_before_clicked, gg) tb.pack(bt, 3, 5, 1, 1) bt.show() # insert_after def ins_after_clicked(bt, gg): global item_count item_count += 1 after = gg.selected_item_get() if after: gg.item_insert_after(itc, item_count, after) else: print("nothing selected") bt = Button(win, size_hint_align=FILL_HORIZ, text="Ins after") bt.callback_clicked_add(ins_after_clicked, gg) tb.pack(bt, 4, 5, 1, 1) bt.show() print(gg) win.show()
def __init__(self, parent, session): PreferencesDialog.__init__(self, "Session") # TODO: Construct and populate this with an Idler self.session = session widgets = {} elm_conf = Configuration() s = session.settings() t = Table(self, padding=(5, 5), homogeneous=True, size_hint_align=FILL_BOTH) self.box.pack_end(t) t.show() i = 0 INT_MIN = -2147483648 INT_MAX = 2147483647 scale = elm_conf.scale for k in dir(s): if k.startswith("__"): continue try: a = getattr(s, k) if isinstance(a, lt.disk_cache_algo_t): w = Spinner(t) w.size_hint_align = FILL_HORIZ # XXX: lt-rb python bindings don't have all values. w.min_max = 0, 2 #len(lt.disk_cache_algo_t.values.keys()) for name, val in lt.disk_cache_algo_t.names.items(): w.special_value_add(val, name) w.value = a elif isinstance(a, bool): w = Check(t) w.size_hint_align = 1.0, 0.0 w.style = "toggle" w.state = a elif isinstance(a, int): w = Spinner(t) w.size_hint_align = FILL_HORIZ w.min_max = INT_MIN, INT_MAX w.value = a elif isinstance(a, float): w = Slider(t) w.size_hint_align = FILL_HORIZ w.size_hint_weight = EXPAND_HORIZ w.unit_format = "%1.2f" if k.startswith("peer_turnover"): w.min_max = 0.0, 1.0 else: w.min_max = 0.0, 20.0 w.value = a elif k == "peer_tos": # XXX: This is an int pair in libtorrent, # which doesn't have a python equivalent. continue elif k == "user_agent": w = Entry(t) w.size_hint_align = 1.0, 0.0 w.size_hint_weight = EXPAND_HORIZ w.single_line = True w.editable = False w.entry = cgi.escape(a) else: w = Entry(t) w.part_text_set("guide", "Enter here") w.size_hint_align = FILL_HORIZ w.size_hint_weight = EXPAND_HORIZ w.single_line = True w.entry = cgi.escape(a) l = Label(t) l.text = k.replace("_", " ").capitalize() l.size_hint_align = 0.0, 0.0 l.size_hint_weight = EXPAND_HORIZ l.show() t.pack(l, 0, i, 1, 1) #w.size_hint_min = scale * 150, scale * 25 t.pack(w, 1, i, 1, 1) w.show() widgets[k] = w i += 1 except TypeError: pass #print("Error {}".format(k)) save_btn = Button(self) save_btn.text = "Apply session settings" save_btn.callback_clicked_add(self.apply_settings, widgets, session) save_btn.show() self.box.pack_end(save_btn)
def __init__(self, parent_widget, *args, **kwargs): Box.__init__(self, parent_widget, *args, **kwargs) self.cancelCallback = None self.actionCallback = None self.__first_run = True self.use_theme = False self.override_theme_font_size = True self.override_font_size = 14 self.theme_data = None self.default_font = 'Sans' self.default_font_style = 'Regular' self.default_font_size = 14 self.selected_font = self.default_font self.selected_font_style = self.default_font_style self.selected_font_size = self.default_font_size self.font_style_str = self.get_text_style(self.selected_font, self.selected_font_style, self.selected_font_size) self.preview_text = 'abcdefghijk ABCDEFGHIJK' # Font size min and max self.fs_min = 8 self.fs_max = 72 lb = Label(self, text="<br><hilight><i>Select Font</i></hilight>", size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) lb.show() self.pack_end(lb) sp = Separator(self, horizontal=True, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) sp.show() self.pack_end(sp) # A horizontal box to hold our font list and font styles fontBox = Box(self, horizontal=True, homogeneous=True, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) fontBox.show() self.pack_end(fontBox) # A vertical box to hold label and list of font families vBoxFL = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) vBoxFL.show() fontBox.pack_end(vBoxFL) # A vertical box to hold label and list of font styles vBoxFS = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) vBoxFS.show() fontBox.pack_end(vBoxFS) # Generate our needed font data #now =time.time() fonts = [] fonts_raw = self.evas.font_available_list() # populate with default font families # see elm_font_available_hash_add Function in EFL f_families = ['Sans', 'Serif', 'Monospace'] f_styles = ['Regular', 'Italic', 'Bold', 'Bold Italic'] fonts_raw += [i + ':style=' + s for i in f_families for s in f_styles] self.fonts_hash = {} for font in fonts_raw: a = font_properties_get(font) # if font name contains a '-' a.name will replace with '\\-' # This needs removed to properly display the name fn = a.name.replace('\\', '') fonts.append(fn) if fn in self.fonts_hash: self.fonts_hash.setdefault(fn, []).append(a.styles[0]) else: self.fonts_hash[fn] = [a.styles[0]] # Deal with some problematic special cases for a, s in self.fonts_hash.items(): #print(a,s) if s: if len(s) == 1: s[0] = s[0].rstrip() if s[0] == u'regular': s[0] = u'Regular' if s[0] == u'Medium Italic': self.fonts_hash.setdefault(a, []).append(u'Bold Italic') elif s[0] == u'Italic': if a != u'Romande ADF Script Std': self.fonts_hash.setdefault(a, []).append(u'Regular') self.fonts_hash.setdefault(a, []).append(u'Bold') self.fonts_hash.setdefault(a, []).append(u'Bold Italic') else: self.fonts_hash.setdefault(a, []).append(u'Italic') self.fonts_hash.setdefault(a, []).append(u'Bold') self.fonts_hash.setdefault(a, []).append(u'Bold Italic') elif len(s) == 2: if any(u'Oblique' in w for w in s): if a not in { u'Baskervald ADF Std Heavy', u'Latin Modern Roman Demi' }: self.fonts_hash.setdefault(a, []).append(u'Bold') self.fonts_hash.setdefault( a, []).append(u'Bold Oblique') elif any(u'Italic' in w for w in s): self.fonts_hash.setdefault(a, []).append(u'Bold') self.fonts_hash.setdefault(a, []).append(u'Bold Italic') else: self.fonts_hash.setdefault(a, []).append(u'Italic') self.fonts_hash.setdefault(a, []).append(u'Bold Italic') elif len(s) == 3 and set(s) == { u'Bold', u'Oblique', u'Medium' }: # case GWMonospace self.fonts_hash.setdefault(a, []).append(u'Bold Oblique') elif len(s) == 3 and set(s) == { u'Italic', u'Regular', u'Bold' }: # Case Eden Mills self.fonts_hash.setdefault(a, []).append(u'Bold Italic') elif len(s) < 4: print("may need fixed Font style for %s: %s" % (a, s)) #print(self.fonts_hash) # for some strange reason many fonts are displayed multiple times. The following lines remove # all duplicates and then sort them alphabetically. # FIXME: Is this still true fonts = list(set(fonts)) fonts.sort(cmp=locale.strcoll) # Elm List for holding font options self.font_list = List(self, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH, mode=ELM_LIST_LIMIT) #self.font_list.callback_selected_add(self.__font_demo_name_set) for font in fonts: self.font_list.item_append(font.replace('\\', '')) if font == self.selected_font: font_it = self.font_list.last_item_get() #print (time.time()- now) self.font_list.go() self.font_list.show() font_family_label = Label(self) font_family_label.text = "<br><b>Font:</b>" font_family_label.show() vBoxFL.pack_end(font_family_label) vBoxFL.pack_end(self.font_list) # Elm List for hold font styles self.font_style = List(self, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH, mode=ELM_LIST_LIMIT) #self.font_style.callback_selected_add(self.__font_demo_style_set) self.__reset_font_style_list(font_it.text_get()) self.font_style.go() self.font_style.show() font_style_label = Label(self) font_style_label.text = "<br><b>Style:</b>" font_style_label.show() vBoxFS.pack_end(font_style_label) vBoxFS.pack_end(self.font_style) # A table to hold font size Spinner and set theme default Check tb = Table(self, homogeneous=True, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) self.pack_end(tb) tb.show() # spinner to choose the font size self.font_sizer = Spinner(self) self.font_sizer.min_max_set(self.fs_min, self.fs_max) self.font_sizer.value_set(self.selected_font_size) #self.font_sizer.callback_changed_add(self.__font_demo_size_set) self.font_sizer.show() # Label for Spinner font_sizer_label = Label(self) font_sizer_label.text = "Font Size: " font_sizer_label.show() size_box = Box(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) size_box.horizontal_set(True) size_box.pack_end(font_sizer_label) size_box.pack_end(self.font_sizer) size_box.show() tb.pack(size_box, 33, 0, 34, 34) self.use_theme_ck = Check(self, text="Theme Default ", size_hint_weight=EXPAND_HORIZ, size_hint_align=(1, 0.5)) self.use_theme_ck.callback_changed_add(self.__use_theme_checked) self.use_theme_ck.show() tb.pack(self.use_theme_ck, 67, 0, 33, 34) # Entry to hold sample text self.font_demo = Entry(self, single_line=True, editable=False, context_menu_disabled=True, text=self.preview_text, scrollable=True, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) self.font_demo.show() demo_box = Frame(self, size_hint_align=FILL_BOTH, text="Preview:", content=self.font_demo) demo_box.show() # Fixme: move this shit font_it.selected_set(True) font_it.show() # Ensure focus is on Font List self.font_list.focus_set(True) self.pack_end(demo_box) # cancel and OK buttons ok_button = Button(self) ok_button.text = "OK" ok_button.callback_pressed_add(self.__ok_button_pressed) ok_button.show() cancel_button = Button(self) cancel_button.text = "Cancel" cancel_button.callback_pressed_add(self.__cancel_button_pressed) cancel_button.show() # box for buttons button_box = Box(self) button_box.horizontal_set(True) button_box.show() button_box.pack_end(cancel_button) button_box.pack_end(ok_button) self.pack_end(button_box)
def fileselector_clicked(obj, item=None): win = StandardWindow("fileselector", "File selector test", autodel=True, size=(500, 500)) box1 = Box(win, horizontal=True, size_hint_weight=EXPAND_BOTH) win.resize_object_add(box1) box1.show() fs = Fileselector(win, is_save=True, expandable=False, folder_only=False, path=os.getenv("HOME"), size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) fs.callback_done_add(fs_cb_done, win) fs.callback_selected_add(fs_cb_selected, win) fs.callback_directory_open_add(fs_cb_directory_open, win) box1.pack_end(fs) fs.show() fs.custom_filter_append(custom_filter_all, filter_name="All Files") fs.custom_filter_append(custom_filter_edje, filter_name="Edje Files") fs.mime_types_filter_append(["text/*"], "Text Files") fs.mime_types_filter_append(["image/*"], "Image Files") sep = Separator(win) box1.pack_end(sep) sep.show() vbox = Box(win) box1.pack_end(vbox) vbox.show() # Options frame fr = Frame(win, text="Options") vbox.pack_end(fr) fr.show() fbox1 = Box(win) fr.content = fbox1 fbox1.show() fbox2 = Box(win, horizontal=True) fbox1.pack_end(fbox2) fbox2.show() ck = Check(win, text="is_save", state=fs.is_save) ck.callback_changed_add(ck_cb_is_save, fs) fbox2.pack_end(ck) ck.show() ck = Check(win, text="folder_only", state=fs.folder_only) ck.callback_changed_add(ck_cb_folder_only, fs) fbox2.pack_end(ck) ck.show() ck = Check(win, text="expandable", state=fs.expandable) ck.callback_changed_add(ck_cb_expandable, fs) fbox2.pack_end(ck) ck.show() fbox2 = Box(win, horizontal=True) fbox1.pack_end(fbox2) fbox2.show() ck = Check(win, text="multiple selection", state=fs.multi_select) ck.callback_changed_add(ck_cb_multi_select, fs) fbox2.pack_end(ck) ck.show() ck = Check(win, text="buttons", state=fs.buttons_ok_cancel) ck.callback_changed_add(ck_cb_buttons, fs) fbox2.pack_end(ck) ck.show() ck = Check(win, text="hidden", state=fs.hidden_visible) ck.callback_changed_add(ck_cb_hidden, fs) fbox2.pack_end(ck) ck.show() # Getters frame fr = Frame(win, text="Getters", size_hint_align=FILL_BOTH) vbox.pack_end(fr) fr.show() fbox = Box(win, horizontal=True) fr.content = fbox fbox.show() bt = Button(win, text="selected_get") bt.callback_clicked_add(bt_cb_sel_get, fs) fbox.pack_end(bt) bt.show() bt = Button(win, text="path_get") bt.callback_clicked_add(bt_cb_path_get, fs) fbox.pack_end(bt) bt.show() bt = Button(win, text="selected_paths") bt.callback_clicked_add(bt_cb_paths_get, fs) fbox.pack_end(bt) bt.show() # Mode frame fr = Frame(win, text="Mode", size_hint_align=FILL_BOTH) vbox.pack_end(fr) fr.show() fbox = Box(win, horizontal=True) fr.content = fbox fbox.show() rdg = rd = Radio(win, text="List", state_value=ELM_FILESELECTOR_LIST) rd.callback_changed_add(rd_cb_mode, fs) fbox.pack_end(rd) rd.show() rd = Radio(win, text="Grid", state_value=ELM_FILESELECTOR_GRID) rd.callback_changed_add(rd_cb_mode, fs) rd.group_add(rdg) fbox.pack_end(rd) rd.show() # Thumbsize frame fr = Frame(win, text="Thumbnail size", size_hint_align=FILL_BOTH) vbox.pack_end(fr) fr.show() sl = Slider(win, min_max=(4, 130), unit_format="%.0f px", value=fs.thumbnail_size[0]) sl.callback_delay_changed_add(sl_cb_thumb_size, fs) fr.content = sl sl.show() # Sort method frame fr = Frame(win, text="Sort method", size_hint_align=FILL_BOTH) vbox.pack_end(fr) fr.show() hs = Hoversel(win, text="File name (asc)") sorts = ( ("File name (asc)", ELM_FILESELECTOR_SORT_BY_FILENAME_ASC), ("File name (desc)", ELM_FILESELECTOR_SORT_BY_FILENAME_DESC), ("Type (asc)", ELM_FILESELECTOR_SORT_BY_TYPE_ASC), ("Type (desc)", ELM_FILESELECTOR_SORT_BY_TYPE_DESC), ("Size (asc)", ELM_FILESELECTOR_SORT_BY_SIZE_ASC), ("Size (desc)", ELM_FILESELECTOR_SORT_BY_SIZE_DESC), ("Modified time (asc)", ELM_FILESELECTOR_SORT_BY_MODIFIED_ASC), ("Modified time (desc)", ELM_FILESELECTOR_SORT_BY_MODIFIED_DESC), ) for sort in sorts: hs.item_add(label=sort[0], callback=hs_cb_sort_method, fs=fs, method=sort[1]) fr.content = hs hs.show() win.show()
str4="test4") box0 = Box(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(box0) box0.show() lb = Label(win) lb.text = ("Please select a test from the list below by clicking<br>" "the test button to show the test window.") lb.show() fr = Frame(win, text="Information", content=lb) box0.pack_end(fr) fr.show() tg = Check(win, style="toggle", text="UI-Mirroring:") tg.callback_changed_add(cb_mirroring) box0.pack_end(tg) tg.show() bx1 = Box(win, size_hint_weight=(EVAS_HINT_EXPAND, 0.0), size_hint_align=(EVAS_HINT_FILL, 0.0), horizontal=True) box0.pack_end(bx1) bx1.show() lb = Label(win, text="Filter:") bx1.pack_end(lb) lb.show()
def __init__(self, windowGrid, name): offset = 0 if (name == 'Yau'): offset = 50 self.BaseBox = Box(windowGrid, size_hint_weight=(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), size_hint_align=(EVAS_HINT_FILL, EVAS_HINT_FILL)) windowGrid.pack(self.BaseBox, offset, 0, 50, 100) self.BaseBox.show() self.frame = Frame(self.BaseBox, size_hint_weight=(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), size_hint_align=(EVAS_HINT_FILL, EVAS_HINT_FILL), text=name) self.BaseBox.pack_end(self.frame) self.frame.show() self.FrameBox = Box(self.BaseBox, size_hint_weight=(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), size_hint_align=(EVAS_HINT_FILL, EVAS_HINT_FILL)) self.frame.content_set(self.FrameBox) self.FrameBox.show() self.FrameCheck = Check(self.BaseBox, size_hint_weight=(EVAS_HINT_EXPAND, 0.0), size_hint_align=(EVAS_HINT_FILL, 0.5), text="{0} Frame Check".format(name)) self.FrameBox.pack_end(self.FrameCheck) self.FrameCheck.show() self.FrameSeparator = Separator(self.BaseBox, horizontal=True, size_hint_weight=(EVAS_HINT_EXPAND, 0.0), size_hint_align=(EVAS_HINT_FILL, 0.5)) self.FrameBox.pack_end(self.FrameSeparator) self.FrameSeparator.show() self.FrameScroller = Scroller( self.BaseBox, content_min_limit=(True, False), size_hint_weight=(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), size_hint_align=(EVAS_HINT_FILL, EVAS_HINT_FILL), scrollbar_policy=(ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF)) self.FrameBox.pack_end(self.FrameScroller) self.FrameScroller.show() self.FrameTable = Table(self.BaseBox, size_hint_weight=(EVAS_HINT_EXPAND, 0.0), size_hint_align=(EVAS_HINT_FILL, 0.0)) self.FrameScroller.content_set(self.FrameTable) self.FrameTable.show() self.BaseLabel = Label(self.FrameTable, size_hint_weight=(0.0, 0.0), size_hint_align=(0.0, 0.5), text="Base:") self.FrameTable.pack(self.BaseLabel, 0, 0, 1, 1) self.BaseLabel.show() self.BaseEntry = Entry(self.FrameTable, size_hint_weight=(EVAS_HINT_EXPAND, 0.0), size_hint_align=(EVAS_HINT_FILL, 0.5), single_line=True, scrollable=True, text="") self.FrameTable.pack(self.BaseEntry, 1, 0, 1, 1) self.BaseEntry.show() self.SecretLabel = Label(self.FrameTable, size_hint_weight=(0.0, 0.0), size_hint_align=(0.0, 0.5), text="Secret:") self.FrameTable.pack(self.SecretLabel, 2, 0, 1, 1) self.SecretLabel.show() self.SecretEntry = Entry(self.FrameTable, size_hint_weight=(EVAS_HINT_EXPAND, 0.0), size_hint_align=(EVAS_HINT_FILL, 0.5), single_line=True, scrollable=True, text="") self.FrameTable.pack(self.SecretEntry, 3, 0, 1, 1) self.SecretEntry.show() self.SignalLabel = Label(self.FrameTable, size_hint_weight=(0.0, 0.0), size_hint_align=(0.0, 0.5), text="Signal:") self.FrameTable.pack(self.SignalLabel, 4, 0, 1, 1) self.SignalLabel.show() self.SignalEntry = Entry(self.FrameTable, size_hint_weight=(EVAS_HINT_EXPAND, 0.0), size_hint_align=(EVAS_HINT_FILL, 0.5), single_line=True, scrollable=True, text="") self.FrameTable.pack(self.SignalEntry, 5, 0, 1, 1) self.SignalEntry.show() self.ChannelLabel = Label(self.FrameTable, size_hint_weight=(0.0, 0.0), size_hint_align=(0.0, 0.5), text="Channel:") self.FrameTable.pack(self.ChannelLabel, 0, 1, 1, 1) self.ChannelLabel.show() self.ChannelEntry = Entry(self.FrameTable, size_hint_weight=(EVAS_HINT_EXPAND, 0.0), size_hint_align=(EVAS_HINT_FILL, 0.5), single_line=True, scrollable=True, text="") self.FrameTable.pack(self.ChannelEntry, 1, 1, 1, 1) self.ChannelEntry.show() self.PoleLabel = Label(self.FrameTable, size_hint_weight=(0.0, 0.0), size_hint_align=(0.0, 0.5), text="Pole:") self.FrameTable.pack(self.PoleLabel, 2, 1, 1, 1) self.PoleLabel.show() self.PoleEntry = Entry(self.FrameTable, size_hint_weight=(EVAS_HINT_EXPAND, 0.0), size_hint_align=(EVAS_HINT_FILL, 0.5), single_line=True, scrollable=True, text="") self.FrameTable.pack(self.PoleEntry, 3, 1, 1, 1) self.PoleEntry.show() self.IdentityLabel = Label(self.FrameTable, size_hint_weight=(0.0, 0.0), size_hint_align=(0.0, 0.5), text="Identity:") self.FrameTable.pack(self.IdentityLabel, 4, 1, 1, 1) self.IdentityLabel.show() self.IdentityEntry = Entry(self.FrameTable, size_hint_weight=(EVAS_HINT_EXPAND, 0.0), size_hint_align=(EVAS_HINT_FILL, 0.5), single_line=True, scrollable=True, text="") self.FrameTable.pack(self.IdentityEntry, 5, 1, 1, 1) self.IdentityEntry.show() self.FoundationLabel = Label(self.FrameTable, size_hint_weight=(0.0, 0.0), size_hint_align=(0.0, 0.5), text="Foundation:") self.FrameTable.pack(self.FoundationLabel, 0, 2, 1, 1) self.FoundationLabel.show() self.FoundationEntry = Entry(self.FrameTable, size_hint_weight=(EVAS_HINT_EXPAND, 0.0), size_hint_align=(EVAS_HINT_FILL, 0.5), single_line=True, scrollable=True, text="") self.FrameTable.pack(self.FoundationEntry, 1, 2, 1, 1) self.FoundationEntry.show() self.ElementLabel = Label(self.FrameTable, size_hint_weight=(0.0, 0.0), size_hint_align=(0.0, 0.5), text="Element:") self.FrameTable.pack(self.ElementLabel, 2, 2, 1, 1) self.ElementLabel.show() self.ElementEntry = Entry(self.FrameTable, size_hint_weight=(EVAS_HINT_EXPAND, 0.0), size_hint_align=(EVAS_HINT_FILL, 0.5), single_line=True, scrollable=True, text="") self.FrameTable.pack(self.ElementEntry, 3, 2, 1, 1) self.ElementEntry.show() self.DynamoLabel = Label(self.FrameTable, size_hint_weight=(0.0, 0.0), size_hint_align=(0.0, 0.5), text="Dynamo:") self.FrameTable.pack(self.DynamoLabel, 4, 2, 1, 1) self.DynamoLabel.show() self.DynamoEntry = Entry(self.FrameTable, size_hint_weight=(EVAS_HINT_EXPAND, 0.0), size_hint_align=(EVAS_HINT_FILL, 0.5), single_line=True, scrollable=True, text="") self.FrameTable.pack(self.DynamoEntry, 5, 2, 1, 1) self.DynamoEntry.show() self.ManifoldLabel = Label(self.FrameTable, size_hint_weight=(0.0, 0.0), size_hint_align=(0.0, 0.5), text="Manifold:") self.FrameTable.pack(self.ManifoldLabel, 0, 3, 1, 1) self.ManifoldLabel.show() self.ManifoldEntry = Entry(self.FrameTable, size_hint_weight=(EVAS_HINT_EXPAND, 0.0), size_hint_align=(EVAS_HINT_FILL, 0.5), single_line=True, scrollable=True, text="") self.FrameTable.pack(self.ManifoldEntry, 1, 3, 1, 1) self.ManifoldEntry.show() self.RingLabel = Label(self.FrameTable, size_hint_weight=(0.0, 0.0), size_hint_align=(0.0, 0.5), text="Ring:") self.FrameTable.pack(self.RingLabel, 2, 3, 1, 1) self.RingLabel.show() self.RingEntry = Entry(self.FrameTable, size_hint_weight=(EVAS_HINT_EXPAND, 0.0), size_hint_align=(EVAS_HINT_FILL, 0.5), single_line=True, scrollable=True, text="") self.FrameTable.pack(self.RingEntry, 3, 3, 1, 1) self.RingEntry.show() self.BarnLabel = Label(self.FrameTable, size_hint_weight=(0.0, 0.0), size_hint_align=(0.0, 0.5), text="Barn:") self.FrameTable.pack(self.BarnLabel, 4, 3, 1, 1) self.BarnLabel.show() self.BarnEntry = Entry(self.FrameTable, size_hint_weight=(EVAS_HINT_EXPAND, 0.0), size_hint_align=(EVAS_HINT_FILL, 0.5), single_line=True, scrollable=True, text="") self.FrameTable.pack(self.BarnEntry, 5, 3, 1, 1) self.BarnEntry.show() self.VoltpereLabel = Label(self.FrameTable, size_hint_weight=(0.0, 0.0), size_hint_align=(0.0, 0.5), text="Voltpere:") self.FrameTable.pack(self.VoltpereLabel, 0, 4, 1, 1) self.VoltpereLabel.show() self.VoltpereEntry = Entry(self.FrameTable, size_hint_weight=(EVAS_HINT_EXPAND, 0.0), size_hint_align=(EVAS_HINT_FILL, 0.5), single_line=True, scrollable=True, text="") self.FrameTable.pack(self.VoltpereEntry, 1, 4, 5, 1) self.VoltpereEntry.show() self.AmpereLabel = Label(self.FrameTable, size_hint_weight=(0.0, 0.0), size_hint_align=(0.0, 0.5), text="Ampere:") self.FrameTable.pack(self.AmpereLabel, 0, 5, 1, 1) self.AmpereLabel.show() self.AmpereEntry = Entry(self.FrameTable, size_hint_weight=(EVAS_HINT_EXPAND, 0.0), size_hint_align=(EVAS_HINT_FILL, 0.5), single_line=True, scrollable=True, text="") self.FrameTable.pack(self.AmpereEntry, 1, 5, 2, 1) self.AmpereEntry.show() self.HenryLabel = Label(self.FrameTable, size_hint_weight=(0.0, 0.0), size_hint_align=(0.0, 0.5), text="Henry:") self.FrameTable.pack(self.HenryLabel, 0, 6, 1, 1) self.HenryLabel.show() self.HenryEntry = Entry(self.FrameTable, size_hint_weight=(EVAS_HINT_EXPAND, 0.0), size_hint_align=(EVAS_HINT_FILL, 0.5), single_line=True, scrollable=True, text="") self.FrameTable.pack(self.HenryEntry, 1, 6, 2, 1) self.HenryEntry.show() self.MaxwellLabel = Label(self.FrameTable, size_hint_weight=(0.0, 0.0), size_hint_align=(0.0, 0.5), text="Maxwell:") self.FrameTable.pack(self.MaxwellLabel, 0, 7, 1, 1) self.MaxwellLabel.show() self.MaxwellEntry = Entry(self.FrameTable, size_hint_weight=(EVAS_HINT_EXPAND, 0.0), size_hint_align=(EVAS_HINT_FILL, 0.5), single_line=True, scrollable=True, text="") self.FrameTable.pack(self.MaxwellEntry, 1, 7, 2, 1) self.MaxwellEntry.show() self.FermatLabel = Label(self.FrameTable, size_hint_weight=(0.0, 0.0), size_hint_align=(0.0, 0.5), text="Fermat:") self.FrameTable.pack(self.FermatLabel, 0, 8, 1, 1) self.FermatLabel.show() self.FermatEntry = Entry(self.FrameTable, size_hint_weight=(EVAS_HINT_EXPAND, 0.0), size_hint_align=(EVAS_HINT_FILL, 0.5), single_line=True, scrollable=True, text="") self.FrameTable.pack(self.FermatEntry, 1, 8, 2, 1) self.FermatEntry.show() self.PropelButton = Button(self.FrameTable, size_hint_weight=(0.0, 0.0), size_hint_align=(0.0, 0.5), text="Propel") self.FrameTable.pack(self.PropelButton, 4, 8, 1, 1) self.PropelButton.show() self.PropelButton.callback_clicked_add(self.propelClicked)
def __init__(self, parent, method): StandardWindow.__init__(self, "espionage", "Method", autodel=True) self._method = method self._param_entry = None self._return_entry = None # content is vbox (with surrounding pad frame) pad = Frame(self, style='pad_medium') pad.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND pad.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL self.resize_object_add(pad) pad.show() vbox = Box(self) vbox.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND vbox.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL pad.content = vbox vbox.show() # title f = "font_size=16 align=0.5 font_weight=Bold" en = Entry(self, text='<font %s>%s()</>' % (f, method.name)) en.size_hint_weight = EVAS_HINT_EXPAND, 0.0 en.size_hint_align = EVAS_HINT_FILL, 0.0 en.editable = False vbox.pack_end(en) en.show() # params label + entry if len(method.params) > 0: label = Entry(self, editable=False) label.size_hint_weight = EVAS_HINT_EXPAND, 0.0 label.size_hint_align = EVAS_HINT_FILL, 0.0 pars = colored_params(method.params, omit_braces=True) label.text = 'Params: %s' % (pars if method.params else 'None') vbox.pack_end(label) label.show() en = Entry(self, editable=True, scrollable=True, single_line=True) en.size_hint_weight = EVAS_HINT_EXPAND, 0.0 en.size_hint_align = EVAS_HINT_FILL, 0.0 self._param_entry = en vbox.pack_end(en) en.show() # returns label + entry label = Entry(self, editable=False) label.size_hint_weight = EVAS_HINT_EXPAND, 0.0 label.size_hint_align = EVAS_HINT_FILL, 0.0 rets = colored_params(method.returns, omit_braces=True) label.text = 'Returns: %s' % (rets if method.returns else 'None') vbox.pack_end(label) label.show() en = Entry(self, editable=False, scrollable=True) en.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND en.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL self._return_entry = en vbox.pack_end(en) en.show() # pretty print check button def pretty_output_clicked_cb(chk): options.pretty_output = chk.state ch = Check(self) ch.size_hint_align = 0.0, 0.5 ch.text = "Prettify output (loosing type infos)" ch.state = options.pretty_output ch.callback_changed_add(pretty_output_clicked_cb) ch.show() vbox.pack_end(ch) sep = Separator(self, horizontal=True) vbox.pack_end(sep) sep.show() # buttons hbox = Box(self, horizontal=True) hbox.size_hint_weight = EVAS_HINT_EXPAND, 0.0 hbox.size_hint_align = EVAS_HINT_FILL, 0.5 vbox.pack_end(hbox) hbox.show() btn = Button(self) btn.text = 'Close' btn.callback_clicked_add(lambda b: self.delete()) hbox.pack_end(btn) btn.show() btn = Button(self) btn.text = 'Clear output' btn.callback_clicked_add(lambda b: self._return_entry.entry_set('')) hbox.pack_end(btn) btn.show() btn = Button(self) btn.text = 'Run method' btn.callback_clicked_add(self.run_clicked_cb) hbox.pack_end(btn) btn.show() # show the window self.resize(300, 300) self.show()
def map_clicked(obj): win = StandardWindow("map", "Map test", autodel=True, size=(600, 600)) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) vbox = Box(win) vbox.size_hint_weight = EXPAND_BOTH vbox.size_hint_align = FILL_BOTH win.resize_object_add(vbox) vbox.show() map_obj = Map(win, zoom=2) map_obj.size_hint_weight = EXPAND_BOTH map_obj.size_hint_align = FILL_BOTH map_obj.callback_tile_load_add(cb_map_load) map_obj.callback_tile_loaded_add(cb_map_load) map_obj.event_callback_add(EVAS_CALLBACK_MOUSE_DOWN, cb_map_mouse_down) vbox.pack_end(map_obj) map_obj.show() ### lb = Label(win, text="load_status: 0 / 0") vbox.pack_end(lb) lb.show() map_obj.data["lb_load_status"] = lb ### hbox = Box(win, horizontal=True) hbox.size_hint_weight = EXPAND_HORIZ hbox.size_hint_align = FILL_HORIZ vbox.pack_end(hbox) hbox.show() bt = Button(win, text="Goto") bt.callback_clicked_add(cb_btn_goto, map_obj) hbox.pack_end(bt) bt.show() bt = Button(win, text="Zoom +") bt.callback_clicked_add(cb_btn_zoom, map_obj, 1) hbox.pack_end(bt) bt.show() bt = Button(win, text="Zoom -") bt.callback_clicked_add(cb_btn_zoom, map_obj, -1) hbox.pack_end(bt) bt.show() sl = Slider(win, text="Rotation:", min_max=(0, 360), value=0, indicator_format="%3.0f") sl.callback_changed_add(cb_slider_rot, map_obj) hbox.pack_end(sl) sl.show() src_type = ELM_MAP_SOURCE_TYPE_TILE ho = Hoversel(win, hover_parent=win, text="Tiles: %s" % (map_obj.source_get(src_type))) for src in map_obj.sources_get(src_type): ho.item_add(src) ho.callback_selected_add(cb_hovsel_selected, map_obj, src_type, "Tiles") hbox.pack_end(ho) ho.show() ### hbox = Box(win, horizontal=True) hbox.size_hint_weight = EXPAND_HORIZ hbox.size_hint_align = FILL_HORIZ vbox.pack_end(hbox) hbox.show() ck = Check(win, text="wheel_disabled") ck.callback_changed_add(lambda bt: map_obj.wheel_disabled_set(bt.state)) hbox.pack_end(ck) ck.show() ck = Check(win, text="paused") ck.callback_changed_add(lambda bt: map_obj.paused_set(bt.state)) hbox.pack_end(ck) ck.show() ck = Check(win, text="hide overlays") ck.callback_changed_add(cb_chk_overlays_hidden, map_obj) hbox.pack_end(ck) ck.show() ck = Check(win, text="pause overlays") ck.callback_changed_add(cb_chk_overlays_paused, map_obj) hbox.pack_end(ck) ck.show() ### sp = Separator(win, horizontal=True) sp.show() vbox.pack_end(sp) hbox = Box(win, horizontal=True) hbox.size_hint_weight = EXPAND_HORIZ hbox.size_hint_align = FILL_HORIZ vbox.pack_end(hbox) hbox.show() src_type = ELM_MAP_SOURCE_TYPE_ROUTE ho = Hoversel(win, hover_parent=win, text="Routes: %s" % (map_obj.source_get(src_type))) for src in map_obj.sources_get(src_type): ho.item_add(src) ho.callback_selected_add(cb_hovsel_selected, map_obj, src_type, "Routes") hbox.pack_end(ho) ho.show() lb = Label(win, text="Set Start and End point to calculate route") hbox.pack_end(lb) lb.show() map_obj.data["lb_distance"] = lb bt = Button(win, text="Calc route") bt.callback_clicked_add(cb_btn_calc_route, map_obj) hbox.pack_end(bt) bt.show() ### sp = Separator(win, horizontal=True) sp.show() vbox.pack_end(sp) hbox = Box(win, horizontal=True) hbox.size_hint_weight = EXPAND_HORIZ hbox.size_hint_align = FILL_HORIZ vbox.pack_end(hbox) hbox.show() src_type = ELM_MAP_SOURCE_TYPE_NAME ho = Hoversel(win, hover_parent=win, text="Names: %s" % (map_obj.source_get(src_type))) for src in map_obj.sources_get(src_type): ho.item_add(src) ho.callback_selected_add(cb_hovsel_selected, map_obj, src_type, "Names") hbox.pack_end(ho) ho.show() en = Entry(win, scrollable=True, text="type an address here") en.size_hint_weight = EXPAND_BOTH en.size_hint_align = FILL_BOTH en.single_line = True hbox.pack_end(en) en.show() bt = Button(win, text="Search address") bt.callback_clicked_add(cb_btn_search_name, map_obj, en) hbox.pack_end(bt) bt.show() bt = Button(win, text="Search start point") bt.callback_clicked_add(cb_btn_search_region, map_obj, en) hbox.pack_end(bt) bt.show() print_map_info(map_obj) win.show()
def __init__(self): StandardWindow.__init__(self, "espionage", "EFL DBus Spy - Espionage") self.autodel_set(True) self.callback_delete_request_add(lambda o: elm.exit()) box = Box(self) self.resize_object_add(box) box.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND box.show() tb = Table(self) box.pack_end(tb) tb.show() lb = Label(self, text="Connect to:", scale=1.3) tb.pack(lb, 0, 0, 1, 2) lb.show() flip = FlipSelector(self, scale=1.3) flip.item_append("Session Bus", self.flip_selected_cb, session_bus) flip.item_append("System Bus", self.flip_selected_cb, system_bus) tb.pack(flip, 1, 0, 1, 2) flip.show() chk = Check(self, text="Show private services") chk.size_hint_align = 0.0, 1.0 chk.state = options.show_private_stuff chk.callback_changed_add(self.show_private_cb) tb.pack(chk, 2, 0, 1, 1) chk.show() chk = Check(self, text="Show DBus introspectables") chk.size_hint_align = 0.0, 0.0 chk.state = options.show_introspect_stuff chk.callback_changed_add(self.show_introspectables_cb) tb.pack(chk, 2, 1, 1, 1) chk.show() vpanes = Panes(self, horizontal=True) vpanes.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND vpanes.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL vpanes.content_left_size = 2.0 / 3 box.pack_end(vpanes) vpanes.show() hpanes = Panes(self) hpanes.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND hpanes.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL hpanes.content_left_size = 1.0 / 3 vpanes.part_content_set("left", hpanes) self.panes = hpanes hpanes.show() self.names_list = NamesList(self) hpanes.part_content_set("left", self.names_list) self.detail_list = DetailList(self) hpanes.part_content_set("right", self.detail_list) self.sigs_receiver = SignalReceiver(self) vpanes.part_content_set("right", self.sigs_receiver) self.resize(700, 500) self.show()
def __init__(self, parent, h): if not h.is_valid(): Information(parent.win, "Invalid torrent handle.") return if not h.has_metadata(): Information(parent.win, "Torrent contains no metadata.") return i = h.get_torrent_info() InnerWindow.__init__(self, parent.win) box = Box(self) box.size_hint_align = -1.0, -1.0 box.size_hint_weight = 1.0, 1.0 tname = Label(self) tname.size_hint_align = -1.0, 0.5 tname.line_wrap = ELM_WRAP_CHAR tname.ellipsis = True tname.text = "{}".format(cgi.escape(i.name())) tname.show() box.pack_end(tname) for func in i.comment, i.creation_date, i.creator: try: w = func() except Exception as e: log.debug(e) else: if w: f = Frame(self) f.size_hint_align = -1.0, 0.0 f.text = func.__name__.replace("_", " ").capitalize() l = Label(self) l.ellipsis = True l.text = cgi.escape(str(w)) l.show() f.content = l f.show() box.pack_end(f) tpriv = Check(self) tpriv.size_hint_align = 0.0, 0.0 tpriv.text = "Private" tpriv.tooltip_text_set("Whether this torrent is private.<br> \ i.e., it should not be distributed on the trackerless network<br> \ (the kademlia DHT).") tpriv.disabled = True tpriv.state = i.priv() magnet_uri = lt.make_magnet_uri(h) f = Frame(self) f.size_hint_align = -1.0, 0.0 f.text = "Magnet URI" me_box = Box(self) me_box.horizontal = True me = Entry(self) me.size_hint_align = -1.0, 0.0 me.size_hint_weight = 1.0, 0.0 #me.editable = False me.entry = magnet_uri me_box.pack_end(me) me.show() me_btn = Button(self) me_btn.text = "Copy" if hasattr(me, "cnp_selection_set"): me_btn.callback_clicked_add( lambda x: me.top_widget.cnp_selection_set( ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_TEXT, me.text)) else: import pyperclip me_btn.callback_clicked_add(lambda x: pyperclip.copy(magnet_uri)) me_btn.show() me_box.pack_end(me_btn) me_box.show() f.content = me_box f.show() box.pack_end(f) fl_btn = Button(self) fl_btn.text = "Files ->" fl_btn.callback_clicked_add(self.file_list_cb, h) xbtn = Button(self) xbtn.text_set("Close") xbtn.callback_clicked_add(lambda x: self.delete()) for w in tpriv, fl_btn, xbtn: w.show() box.pack_end(w) box.show() nf = self.nf = Naviframe(self) nf.item_simple_push(box) self.content_set(nf) self.activate()
def focus5_clicked(obj, item=None): theme_overlay_add(os.path.join(script_path, "test_focus_custom.edj")) win = StandardWindow("focus5", "Focus Custom", autodel=True, size=(320, 320)) win.focus_highlight_enabled = True win.focus_highlight_animate = True win.focus_highlight_style = "glow" fr = Frame(win, style="pad_large", size_hint_weight=EXPAND_BOTH) win.resize_object_add(fr) fr.show() bx = Box(fr) fr.content = bx bx.show() chk = Check(bx, text='Enable glow effect on "Glow" Button', state=True, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) bx.pack_end(chk) chk.show() spinner = Spinner(bx, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) bx.pack_end(spinner) spinner.show() bt = Button(bx, text="Glow Button", size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) bt.callback_focused_add(_glow_effect_on_cb, win, chk) bt.callback_unfocused_add(_glow_effect_off_cb, win, chk) bx.pack_end(bt) bt.show() sp = Separator(bx, horizontal=True, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) bx.pack_end(sp) sp.show() bx2 = Box(bx, horizontal=True, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) bx.pack_end(bx2) bx2.show() for i in range(1, 5): bt = Button(bx2, text="Button %d" % i, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) bx2.pack_end(bt) bt.show() win.show()