def select_torrent(self): sel = Fileselector(self.win) sel.expandable = False sel.path_set(os.path.expanduser("~")) sel.size_hint_weight_set(1.0, 1.0) sel.size_hint_align_set(-1.0, -1.0) sel.show() sf = Frame(self.win) sf.size_hint_weight_set(1.0, 1.0) sf.size_hint_align_set(-1.0, -1.0) sf.text = "Select torrent file" sf.content = sel sf.show() magnet = Entry(self.win) magnet.single_line = True magnet.scrollable = True if hasattr(magnet, "cnp_selection_get"): magnet.cnp_selection_get(ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_TEXT) else: import pyperclip t = pyperclip.paste() if t is not None and t.startswith("magnet:"): magnet.entry = t magnet.show() mf = Frame(self.win) mf.size_hint_weight_set(1.0, 0.0) mf.size_hint_align_set(-1.0, 0.0) mf.text = "Or enter magnet URI here" mf.content = magnet mf.show() mbtn = Button(self.win) mbtn.text = "Done" mbtn.show() mbox = Box(self.win) mbox.size_hint_weight_set(1.0, 0.0) mbox.size_hint_align_set(-1.0, 0.0) mbox.horizontal = True mbox.pack_end(mf) mbox.pack_end(mbtn) mbox.show() box = Box(self.win) box.size_hint_weight = (1.0, 1.0) box.size_hint_align = (-1.0, -1.0) box.pack_end(sf) box.pack_end(mbox) box.show() inwin = InnerWindow(self.win) inwin.content = box sel.callback_done_add(self.add_torrent_cb) sel.callback_done_add(lambda x, y: inwin.delete()) mbtn.callback_clicked_add(self.add_magnet_uri_cb, magnet) mbtn.callback_clicked_add(lambda x: inwin.delete()) inwin.activate()
def __init__(self, rent): Box.__init__(self, rent) self.parent = rent #This appears on the button in the main swmai window self.name = "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 __init__(self, cmd, exec_cb): DialogWindow.__init__(self, _app_instance.win, 'egitu-review', 'Git Command Review', autodel=True, size=(300,50)) # main table (inside a padding frame) fr = Frame(self, style='default', text='Command to execute', size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) self.resize_object_add(fr) fr.show() tb = Table(self, padding=(6,6), size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) fr.content = tb tb.show() # cmd entry en = Entry(self, single_line=True, scrollable=True, text=utf8_to_markup(cmd), size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) tb.pack(en, 0, 0, 2, 1) en.show() # buttons bt = Button(self, text='Close', size_hint_expand=EXPAND_HORIZ, size_hint_fill=FILL_HORIZ) bt.callback_clicked_add(lambda b: self.delete()) tb.pack(bt, 0, 1, 1, 1) bt.show() bt = Button(self, text='Execute', size_hint_expand=EXPAND_HORIZ, size_hint_fill=FILL_HORIZ) bt.callback_clicked_add(self._exec_clicked_cb, en, exec_cb) tb.pack(bt, 1, 1, 1, 1) bt.show() # self.show()
def __init__(self, parent): DialogWindow.__init__(self, parent, 'epack-info', 'Epack', autodel=True) fr = Frame(self, style='pad_large', size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.resize_object_add(fr) fr.show() hbox = Box(self, horizontal=True, padding=(12,12)) fr.content = hbox hbox.show() vbox = Box(self, align=(0.0,0.0), padding=(6,6), size_hint_weight=EXPAND_VERT, size_hint_align=FILL_VERT) hbox.pack_end(vbox) vbox.show() # icon + version ic = Icon(self, standard='epack', size_hint_min=(64,64)) vbox.pack_end(ic) ic.show() lb = Label(self, text=_('Version: %s') % __version__) vbox.pack_end(lb) lb.show() sep = Separator(self, horizontal=True) vbox.pack_end(sep) sep.show() # buttons bt = Button(self, text=_('Epack'), size_hint_align=FILL_HORIZ) bt.callback_clicked_add(lambda b: self.entry.text_set(utils.INFO)) vbox.pack_end(bt) bt.show() bt = Button(self, text=_('Website'),size_hint_align=FILL_HORIZ) bt.callback_clicked_add(lambda b: utils.xdg_open(utils.GITHUB)) vbox.pack_end(bt) bt.show() bt = Button(self, text=_('Authors'), size_hint_align=FILL_HORIZ) bt.callback_clicked_add(lambda b: self.entry.text_set(utils.AUTHORS)) vbox.pack_end(bt) bt.show() bt = Button(self, text=_('License'), size_hint_align=FILL_HORIZ) bt.callback_clicked_add(lambda b: self.entry.text_set(utils.LICENSE)) vbox.pack_end(bt) bt.show() # main text self.entry = Entry(self, editable=False, scrollable=True, text=utils.INFO, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.entry.callback_anchor_clicked_add(lambda e,i: utils.xdg_open(i.name)) hbox.pack_end(self.entry) self.entry.show() self.resize(400, 200) self.show()
def __init__(self, parent_widget, *args, **kwargs): Box.__init__(self, parent_widget, *args, **kwargs) self.ourList = ourList = List(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.keys = [] ourList.go() ourList.show() self.ourItems = [] sframe = Frame(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) sframe.text = "Search" self.search = search = Entry(self) search.single_line = True search.callback_changed_add(self.searchChange) sframe.content = search search.show() sframe.show() self.pack_end(ourList) self.pack_end(sframe)
def __init__(self, parent, text=None, icon=None): Entry.__init__(self, parent, scrollable=True, single_line=True, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) self.show() if text: self.text = text if icon: self.icon = icon ic = SafeIcon(self, 'go-down') ic.size_hint_min = 16, 16 # TODO file a bug for elm on phab ic.callback_clicked_add(self.activate) self.part_content_set('end', ic) self._itc = GenlistItemClass(item_style='default', text_get_func=self._gl_text_get, content_get_func=self._gl_content_get) self._list = Genlist(self) self._list.callback_selected_add(self._list_selected_cb) self._hover = Hover(self.parent, target=self) self._bg = Background(self, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) fr = Frame(self, style='pad_medium', size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) fr.content = self._list fr.show() self._table = Table(self, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) self._table.pack(self._bg, 0, 0, 1, 1) self._table.pack(fr, 0, 0, 1, 1) self._selected_func = None
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()
def __init__(self, parent_widget, titles=None, *args, **kwargs): Box.__init__(self, parent_widget, *args, **kwargs) self.outPut = Entry(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.outPut.editable_set(False) self.outPut.scrollable_set(True) self.outPut.callback_changed_add(self.changedCb) self.outPut.show() frame = Frame(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) frame.text = "Input:" frame.autocollapse_set(True) frame.collapse_go(True) frame.show() bx = Box(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) bx.horizontal = True bx.show() frame.content = bx self.inPut = Entry(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.inPut.single_line_set(True) self.inPut.callback_activated_add(self.enterPressed) self.inPut.show() enterButton = Button(self) enterButton.text = "Execute" enterButton.callback_pressed_add(self.enterPressed) enterButton.show() bx.pack_end(self.inPut) bx.pack_end(enterButton) self.pack_end(self.outPut) self.pack_end(frame) self.cmd_exe = None self.done_cb = None
def __init__(self, parent_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, parent, app): self.app = app DialogWindow.__init__(self, parent, 'Egitu-tags', 'Tags', size=(350,350), autodel=True) # main vertical box (inside a padding frame) vbox = Box(self, padding=(0, 6), size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) fr = Frame(self, style='pad_medium', size_hint_weight=EXPAND_BOTH) self.resize_object_add(fr) fr.content = vbox fr.show() vbox.show() # title en = Entry(self, editable=False, single_line=True, text='<title>%s</title>' % 'Tags', size_hint_expand=EXPAND_HORIZ) vbox.pack_end(en) en.show() # tag list self.itc = GenlistItemClass(item_style='one_icon', text_get_func=self._gl_text_get, content_get_func=self._gl_content_get) li = Genlist(self, homogeneous=True, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) li.callback_selected_add(self._list_selected_cb) vbox.pack_end(li) li.show() self.tags_list = li # buttons hbox = Box(self, horizontal=True, size_hint_expand=EXPAND_HORIZ, size_hint_fill=FILL_BOTH) vbox.pack_end(hbox) hbox.show() bt = Button(self, text='Create', content=Icon(self, standard='git-tag')) bt.callback_clicked_add(lambda b: CreateTagPopup(self, self.app)) hbox.pack_end(bt) bt.show() bt = Button(self, text='Delete', content=Icon(self, standard='user-trash')) bt.callback_clicked_add(self._delete_clicked_cb) hbox.pack_end(bt) bt.show() self.delete_btn = bt bt = Button(self, text='Checkout') bt.callback_clicked_add(self._checkout_clicked_cb) hbox.pack_end(bt) bt.show() self.checkout_btn = bt sep = Separator(self, size_hint_expand=EXPAND_HORIZ) hbox.pack_end(sep) bt = Button(self, text='Close') bt.callback_clicked_add(lambda b: self.delete()) hbox.pack_end(bt) bt.show() # self.populate() self.show()
def __init__(self, parent, title='About', standardicon='dialog-information', version='N/A', authors='No One', licen='GPL', webaddress='', info='Something, something, turtles'): if AboutWindow.__initialized: raise InstanceError( "You can't create more than 1 instance of AboutWindow") AboutWindow.__initialized = True self.parent = parent Window.__init__(self, title, ELM_WIN_DIALOG_BASIC, autodel=True) self.callback_delete_request_add(self.cb_close) background = Background(self, size_hint_weight=EXPAND_BOTH) self.resize_object_add(background) background.show() frame = Frame(self, style='pad_large', size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.resize_object_add(frame) frame.show() hbox = Box(self, horizontal=True, padding=(12, 12)) frame.content = hbox hbox.show() vbox = Box(self, align=(0.0, 0.0), padding=(6, 6), size_hint_weight=EXPAND_VERT, size_hint_align=FILL_VERT) hbox.pack_end(vbox) vbox.show() # icon + version icon = Icon(self, size_hint_min=(64, 64)) icon.standard_set(standardicon) vbox.pack_end(icon) icon.show() ver_lb = Label(self, text=f'Version: {version}') vbox.pack_end(ver_lb) ver_lb.show() sep = Separator(self, horizontal=True) vbox.pack_end(sep) sep.show() # buttons btn = Button(self, text=(title), size_hint_align=FILL_HORIZ) btn.callback_clicked_add(lambda b: self.entry.text_set(info)) vbox.pack_end(btn) btn.show() btn = Button(self, text=('Website'), size_hint_align=FILL_HORIZ) btn.callback_clicked_add(lambda b: xdg_open(webaddress)) vbox.pack_end(btn) btn.show() btn = Button(self, text=('Authors'), size_hint_align=FILL_HORIZ) btn.callback_clicked_add(lambda b: self.entry.text_set(authors)) vbox.pack_end(btn) btn.show() btn = Button(self, text=('License'), size_hint_align=FILL_HORIZ) btn.callback_clicked_add(lambda b: self.entry.text_set(licen)) vbox.pack_end(btn) btn.show() # main text self.entry = Entry(self, editable=False, scrollable=True, text=info, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.entry.callback_anchor_clicked_add(lambda e, i: xdg_open(i.name)) hbox.pack_end(self.entry) self.entry.show() self.resize(400, 200) self.show()
def __init__(self, app): self.app = app self.selected_branch = None DialogWindow.__init__(self, app.win, 'Egitu-branches', 'Branches', size=(500,500), autodel=True) # main vertical box (inside a padding frame) vbox = Box(self, padding=(0, 6), size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) fr = Frame(self, style='pad_medium', size_hint_weight=EXPAND_BOTH) self.resize_object_add(fr) fr.content = vbox fr.show() vbox.show() # title en = Entry(self, editable=False, single_line=True, text='<title>%s</title>' % 'Local branches', size_hint_expand=EXPAND_HORIZ) vbox.pack_end(en) en.show() # list li = List(self, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) li.callback_selected_add(self._list_selected_cb) vbox.pack_end(li) li.show() self.branches_list = li # buttons hbox = Box(self, horizontal=True, size_hint_expand=EXPAND_HORIZ, size_hint_fill=FILL_BOTH) vbox.pack_end(hbox) hbox.show() ic = SafeIcon(self, 'git-branch') bt = Button(self, text='Create', content=ic) bt.callback_clicked_add(lambda b: CreateBranchPopup(self, app)) hbox.pack_end(bt) bt.show() ic = SafeIcon(self, 'user-trash') bt = Button(self, text='Delete', content=ic) bt.callback_clicked_add(lambda b: DeleteBranchPopup(self, self.app, self.selected_branch)) hbox.pack_end(bt) bt.show() self.delete_btn = bt ic = SafeIcon(self, 'git-merge') bt = Button(self, text='Merge', content=ic) bt.callback_clicked_add(lambda b: MergeBranchPopup(self, app, self.selected_branch.name)) hbox.pack_end(bt) bt.show() self.merge_btn = bt ic = SafeIcon(self, 'git-compare') bt = Button(self, text='Compare & Merge', content=ic) bt.callback_clicked_add(lambda b: \ self.app.action_compare(target=self.selected_branch.name)) hbox.pack_end(bt) bt.show() self.merge_btn2 = bt sep = Separator(self, size_hint_expand=EXPAND_HORIZ) hbox.pack_end(sep) bt = Button(self, text='Close') bt.callback_clicked_add(lambda b: self.delete()) hbox.pack_end(bt) bt.show() # populate the list and show the dialog self.populate() self.show()
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()
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 vertical box vbox = Box(self, size_hint_weight=EXPAND_BOTH) self.resize_object_add(vbox) vbox.show() ### header horiz box (inside a padding frame) frame = Frame(self, style='pad_medium', size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) vbox.pack_end(frame) frame.show() self.header_box = Box(self, horizontal=True, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) frame.content = self.header_box self.header_box.show() # genlist with archive content self.file_itc = GenlistItemClass(item_style="no_icon", text_get_func=gl_file_text_get) self.fold_itc = GenlistItemClass(item_style="one_icon", text_get_func=gl_fold_text_get, content_get_func=gl_fold_icon_get) self.file_list = Genlist(self, homogeneous=True, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) 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) vbox.pack_end(self.file_list) self.file_list.show() ### footer table (inside a padding frame) frame = Frame(self, style='pad_medium', size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) vbox.pack_end(frame) frame.show() table = Table(frame) frame.content = table table.show() # FileSelectorButton self.fsb = DestinationButton(app, self) table.pack(self.fsb, 0, 0, 3, 1) self.fsb.show() sep = Separator(table, horizontal=True, size_hint_weight=EXPAND_HORIZ) table.pack(sep, 0, 1, 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, 2, 1, 2) self.extract_btn.show() sep = Separator(table, horizontal=False) table.pack(sep, 1, 2, 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, 2, 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, 3, 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.resize(300, 380) self.show()
def __init__(self, command=None, win=None, start_callback=None, end_callback=None, *args, **kwargs): if not win: nowindow = True win = self.win = Window("esudo", ELM_WIN_DIALOG_BASIC) win.title = "eSudo" win.borderless = True 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.layer_set(11) #~ win.fullscreen = True win.show() win.activate() bg = Background(win) bg.size_hint_weight = 1.0, 1.0 win.resize_object_add(bg) bg.show() self.embedded = False else: nowindow = False self.embedded = True self.cmd = command self.start_cb = start_callback if callable(start_callback) else None self.end_cb = end_callback if callable(end_callback) else None self.args = args self.kwargs = kwargs #--------eSudo Window bz = Box(win) if nowindow: bz.size_hint_weight = evas.EVAS_HINT_EXPAND, 0.0 else: bz.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND bz.size_hint_align = evas.EVAS_HINT_FILL, 0.0 bz.show() if nowindow: lbl = Label(win) lbl.style = "marker" lbl.color = 170, 170, 170, 255 lbl.size_hint_align = 0.5, 0.0 lbl.scale = 2.0 lbl.text = "<b>eSudo</b>" bz.pack_end(lbl) lbl.show() sep = Separator(win) sep.horizontal = True bz.pack_end(sep) sep.show() fr = Frame(win) fr.text = "Command:" fr.size_hint_align = evas.EVAS_HINT_FILL, 0.0 bz.pack_end(fr) fr.show() if nowindow: sep = Separator(win) sep.horizontal = True bz.pack_end(sep) sep.show() self.cmdline = cmdline = Entry(win) cmdline.elm_event_callback_add(self.entry_event) cmdline.single_line = True if self.cmd: cmdline.text = self.cmd cmdline.editable = False fr.content = cmdline cmdline.scrollable_set(True) cmdline.show() if nowindow: fr = Frame(win) fr.text = "Password:"******"<b>Password:</b>" lb.size_hint_align = 0.0, 0.5 bz1.pack_end(lb) lb.show() en = self.en = Entry(win) en.name = "password" en.elm_event_callback_add(self.entry_event) en.single_line = True en.password = True en.show() if nowindow: fr.content = en else: bz1.pack_end(en) sep = Separator(win) sep.horizontal = True bz.pack_end(sep) sep.show() btnb = Box(win) btnb.horizontal = True btnb.size_hint_weight = evas.EVAS_HINT_EXPAND, 0.0 btnb.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL bz.pack_end(btnb) btnb.show() bt = Button(win) bt.text = "Cancel" bt.callback_clicked_add(self.esudo_cancel, en) bt.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL bt.size_hint_weight = evas.EVAS_HINT_EXPAND, 0.0 btnb.pack_end(bt) bt.show() bt = Button(win) bt.text = "OK" bt.callback_clicked_add(self.password_check, en) bt.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL bt.size_hint_weight = evas.EVAS_HINT_EXPAND, 0.0 btnb.pack_end(bt) bt.show() self.iw = iw = InnerWindow(win) iw.content = bz iw.show() iw.activate() if self.cmd: en.focus = True
def slider_clicked(obj): win = StandardWindow("slider", "Slider", autodel=True) if obj is None: win.callback_delete_request_add(lambda x: elementary.exit()) win.show() fr = Frame(win, size_hint_weight=EXPAND_BOTH, style="pad_large") win.resize_object_add(fr) fr.show() bx = Box(win) fr.content = bx bx.show() # disabled horizontal slider ic = Icon(bx, file=os.path.join(img_path, "logo_small.png"), size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)) ic.show() sl = Slider(bx, text="Disabled", unit_format="%1.1f units", span_size=120, min_max=(50, 150), value=80, disabled=True, size_hint_align=FILL_HORIZ, size_hint_weight=EXPAND_HORIZ) sl.part_content_set("icon", ic) bx.pack_end(sl) sl.show() step = step_size_calculate(0, 9) sl = Slider(bx, unit_format="%1.0f units", indicator_format="%1.0f", span_size=120, min_max=(0, 9), text="Manual step", step=step, size_hint_align=FILL_HORIZ, size_hint_weight=EXPAND_HORIZ) bx.pack_end(sl) sl.show() # normal horizontal slider ic = Icon(bx, file=os.path.join(img_path, "logo_small.png"), size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)) sl1 = sl = Slider(bx, text="Horizontal", unit_format="%1.1f units", indicator_format="%1.1f", span_size=120, size_hint_align=FILL_HORIZ, size_hint_weight=EXPAND_HORIZ) sl.part_content_set("icon", ic) bx.pack_end(sl) ic.show() sl.show() # horizontally inverted slider ic = Icon(bx, file=os.path.join(img_path, "logo_small.png"), size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)) ic.show() sl = Slider(bx, text="Horizontal inverted", unit_format="%3.0f units", span_size=80, indicator_format="%3.0f", min_max=(50, 150), value=80, inverted=True, size_hint_align=ALIGN_CENTER, size_hint_weight=(0.0, 0.0)) sl.part_content_set("end", ic) sl.callback_delay_changed_add(delay_change_cb) bx.pack_end(sl) sl.show() # disabled horizontally inverted slider ic = Icon(bx, file=os.path.join(img_path, "logo_small.png"), size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)) ic.show() sl = Slider(bx, text="Disabled inverted", span_size=80, indicator_format="%3.0f", min_max=(50, 150), value=80, inverted=True, disabled=True, size_hint_align=ALIGN_CENTER, size_hint_weight=(0.0, 0.0)) sl.part_content_set("end", ic) bx.pack_end(sl) sl.show() # scale doubled slider sl = Slider(bx, indicator_show=False, text="Scale doubled", unit_format="%3.0f units", span_size=40, size_hint_align=FILL_HORIZ, size_hint_weight=EXPAND_HORIZ, indicator_format="%3.0f", min_max=(50, 150), value=80, inverted=True, scale=2.0) bx.pack_end(sl) sl.show() # horizontal box bx2 = Box(bx, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_VERT, horizontal=True) bx.pack_end(bx2) bx2.show() # vertical inverted slider ic = Icon(bx2, file=os.path.join(img_path, "logo_small.png"), size_hint_aspect=(EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1)) ic.show() sl = Slider(bx2, text="Vertical inverted", inverted=True, unit_format="%1.1f units", span_size=60, size_hint_align=FILL_VERT, size_hint_weight=EXPAND_VERT, indicator_format="%1.1f", value=0.2, scale=1.0, horizontal=False) sl.part_content_set("icon", ic) bx2.pack_end(sl) sl.show() sl1.callback_changed_add(change_cb, sl) # disabled vertical slider ic = Icon(bx2, file=os.path.join(img_path, "logo_small.png"), size_hint_aspect=(EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1)) sl = Slider(bx2, text="Disabled vertical", inverted=True, unit_format="%1.1f units", span_size=100, size_hint_align=FILL_VERT, size_hint_weight=EXPAND_VERT, indicator_format="%1.1f", value=0.2, scale=1.0, horizontal=False) # # XXX: If vertical mode is set after disabled, it's no longer disabled. # Elm bug? # sl.disabled = True sl.part_content_set("icon", ic) bx2.pack_end(sl) sl.show() # normal vertical slider sl = Slider(bx2, text="Vertical", unit_format="%1.1f units", span_size=60, size_hint_align=FILL_VERT, size_hint_weight=EXPAND_VERT, indicator_show=False, value=0.2, scale=1.0, horizontal=False) sl.callback_changed_add(change_print_cb, sl) bx2.pack_end(sl) sl.show() # box for bottom buttons bx2 = Box(win, size_hint_weight=EXPAND_HORIZ, horizontal=True) bx.pack_end(bx2) bx2.show() bt = Button(win, text="0") bt.callback_clicked_add(bt_0, sl) bt.show() bx2.pack_end(bt) bt = Button(win, text="1") bt.callback_clicked_add(bt_1, sl) bt.show() bx2.pack_end(bt) bt = Button(win, text="+0.1") bt.callback_clicked_add(bt_p1, sl) bt.show() bx2.pack_end(bt) bt = Button(win, text="-0.1") bt.callback_clicked_add(bt_m1, sl) bt.show() bx2.pack_end(bt)
def __init__(self, parent): DialogWindow.__init__(self, parent, 'epack-info', 'Epack', autodel=True) fr = Frame(self, style='pad_large', size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.resize_object_add(fr) fr.show() hbox = Box(self, horizontal=True, padding=(12, 12)) fr.content = hbox hbox.show() vbox = Box(self, align=(0.0, 0.0), padding=(6, 6), size_hint_weight=EXPAND_VERT, size_hint_align=FILL_VERT) hbox.pack_end(vbox) vbox.show() # icon + version ic = SafeIcon(self, 'epack', size_hint_min=(64, 64)) vbox.pack_end(ic) ic.show() lb = Label(self, text=_('Version: %s') % __version__) vbox.pack_end(lb) lb.show() sep = Separator(self, horizontal=True) vbox.pack_end(sep) sep.show() # buttons bt = Button(self, text=_('Epack'), size_hint_align=FILL_HORIZ) bt.callback_clicked_add(lambda b: self.entry.text_set(utils.INFO)) vbox.pack_end(bt) bt.show() bt = Button(self, text=_('Website'), size_hint_align=FILL_HORIZ) bt.callback_clicked_add(lambda b: utils.xdg_open(utils.GITHUB)) vbox.pack_end(bt) bt.show() bt = Button(self, text=_('Authors'), size_hint_align=FILL_HORIZ) bt.callback_clicked_add(lambda b: self.entry.text_set(utils.AUTHORS)) vbox.pack_end(bt) bt.show() bt = Button(self, text=_('License'), size_hint_align=FILL_HORIZ) bt.callback_clicked_add(lambda b: self.entry.text_set(utils.LICENSE)) vbox.pack_end(bt) bt.show() # main text self.entry = Entry(self, editable=False, scrollable=True, text=utils.INFO, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.entry.callback_anchor_clicked_add( lambda e, i: utils.xdg_open(i.name)) hbox.pack_end(self.entry) self.entry.show() self.resize(400, 200) self.show()
def __init__(self, parent, app, stash=None): self.app = app self.stash = stash or app.repo.stash[0] self.idx = parseint(stash.ref) if stash else 0 DialogWindow.__init__(self, app.win, 'egitu-stash', 'stash', size=(500,500), autodel=True) # main vertical box (inside a padding frame) vbox = Box(self, padding=(0, 6), size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) fr = Frame(self, style='pad_medium', size_hint_weight=EXPAND_BOTH) self.resize_object_add(fr) fr.content = vbox fr.show() vbox.show() # header horizontal box hbox = Box(self, horizontal=True, size_hint_expand=EXPAND_HORIZ, size_hint_fill=FILL_HORIZ) vbox.pack_end(hbox) hbox.show() # title en = Entry(self, editable=False, scrollable=False, size_hint_expand=EXPAND_HORIZ, size_hint_align=(-1,0.0)) hbox.pack_end(en) en.show() self.title_entry = en # header separator sep = Separator(self) hbox.pack_end(sep) sep.show() # navigation table tb = Table(self, size_hint_align=(0.5,0.0)) hbox.pack_end(tb) tb.show() lb = Label(self) tb.pack(lb, 0, 0, 2, 1) lb.show() self.nav_label = lb ic = SafeIcon(self, 'go-previous') bt = Button(self, text='Prev', content=ic) bt.callback_clicked_add(self._prev_clicked_cb) tb.pack(bt, 0, 1, 1, 1) bt.show() self.prev_btn = bt ic = SafeIcon(self, 'go-next') bt = Button(self, text='Next', content=ic) bt.callback_clicked_add(self._next_clicked_cb) tb.pack(bt, 1, 1, 1, 1) bt.show() self.next_btn = bt # diff entry self.diff_entry = DiffedEntry(self) vbox.pack_end(self.diff_entry) self.diff_entry.show() # buttons sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_HORIZ) vbox.pack_end(sep) sep.show() hbox = Box(self, horizontal=True, size_hint_expand=EXPAND_HORIZ, size_hint_fill=FILL_BOTH) vbox.pack_end(hbox) hbox.show() bt = Button(self, text='Apply') bt.callback_clicked_add(self._apply_clicked_cb) hbox.pack_end(bt) bt.show() bt = Button(self, text='Pop (apply & delete)') bt.callback_clicked_add(self._pop_clicked_cb) hbox.pack_end(bt) bt.show() bt = Button(self, text='Branch & Delete', content=SafeIcon(self, 'git-branch')) bt.callback_clicked_add(self._branch_clicked_cb) hbox.pack_end(bt) bt.show() bt = Button(self, text='Delete', content=SafeIcon(self, 'user-trash')) bt.callback_clicked_add(self._drop_clicked_cb) hbox.pack_end(bt) bt.show() sep = Separator(self, size_hint_expand=EXPAND_HORIZ) hbox.pack_end(sep) bt = Button(self, text='Close') bt.callback_clicked_add(lambda b: self.delete()) hbox.pack_end(bt) bt.show() # request the diff and show the dialog self.update(self.idx) self.show()
def __init__(self, rent): Box.__init__(self, rent) self.parent = rent self.name = "Date and Time" self.section = "System Settings" self.searchData = ["clock", "timezone", "date", "system"] self.launchArg = "--time" self.button = None self.timezones = getTimeZones() 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('clock') self.icon.show() cframe = Frame(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) cframe.text = "Current Time" cframe.show() self.clock = clock = Clock(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) clock.show_seconds_set(True) clock.show_am_pm_set(True) clock.show() cframe.content = clock dframe = Frame(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) dframe.text = "Current Day" dframe.show() self.cal = cal = Calendar(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) cal.select_mode = ELM_CALENDAR_SELECT_MODE_NONE cal.show() dframe.content = cal tzframe = Frame(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) tzframe.text = "Current Timezone" tzframe.show() self.tz = tz = Label(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) tz.text = "<b>%s</b>"%time.tzname[0] tz.show() tzframe.content = tz self.mainBox = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.mainBox.pack_end(cframe) self.mainBox.pack_end(dframe) self.mainBox.pack_end(tzframe) self.mainBox.show() self.zoneList = zoneList = SearchableList(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) zoneList.callback_item_focused_add(self.enableTZSelect) self.zones = [] for tz in self.timezones: for each in self.timezones[tz]: if each not in self.zones: self.zones.append(each) self.zones.sort(reverse=True) for zone in self.zones: zoneList.item_append(zone) zoneList.show() self.buttonTZSelect = buttonTZSelect = StandardButton(self, "Select", "ok", self.tzselectPressed) buttonTZSelect.disabled = True buttonTZSelect.show() buttonTZCancel = StandardButton(self, "Cancel", "close", self.tzcancelPressed) buttonTZCancel.show() tzBBox = Box(self, size_hint_weight = EXPAND_HORIZ, size_hint_align = FILL_BOTH) tzBBox.horizontal = True tzBBox.pack_end(buttonTZSelect) tzBBox.pack_end(buttonTZCancel) tzBBox.show() tzChangeBox = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) tzChangeBox.pack_end(zoneList) tzChangeBox.pack_end(tzBBox) tzChangeBox.show() self.flip = Flip(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.flip.part_content_set("front", self.mainBox) self.flip.part_content_set("back", tzChangeBox) self.flip.show() buttonBox = Box(self, size_hint_weight = EXPAND_HORIZ, size_hint_align = FILL_BOTH) buttonBox.horizontal = True self.buttonApply = buttonApply = StandardButton(self, "Apply Changes", "ok", self.applyPressed) buttonApply.disabled = True buttonApply.show() self.buttonSync = buttonSync = StandardButton(self, "Sync from Internet", "refresh", self.syncPressed) buttonSync.show() self.buttonDT = buttonDT = StandardButton(self, "Edit Date and Time", "x-office-calendar", self.editDTPressed) buttonDT.show() self.buttonTZ = buttonTZ = StandardButton(self, "Change Timezone", "clock", self.editTZPressed) buttonTZ.show() buttonReturn = StandardButton(self, "Back", "go-previous", self.returnPressed) buttonReturn.show() buttonBox.pack_end(buttonApply) buttonBox.pack_end(buttonSync) buttonBox.pack_end(buttonDT) buttonBox.pack_end(buttonTZ) buttonBox.pack_end(buttonReturn) buttonBox.show() self.pack_end(self.flip) self.pack_end(buttonBox)
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 __init__(self): self.repo = None self.branch_selector = None self.caption_label = None self.status_label = None self.graph = None self.diff_view = None StandardWindow.__init__(self, "egitu", "Efl GIT gUi - Egitu") self.autodel_set(True) self.callback_delete_request_add(lambda o: elm.exit()) # main vertical box box = Box(self, size_hint_weight = EXPAND_BOTH) self.resize_object_add(box) box.show() # header fr = Frame(self, style="outdent_bottom", size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) box.pack_end(fr) fr.show() tb = Table(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) fr.content = tb tb.show() # main menu button bt = Button(self, text='Menu') bt.content = Icon(self, standard='home') bt.callback_clicked_add(lambda b: EgituMenu(self, b)) tb.pack(bt, 0, 0, 1, 1) bt.show() # editable description entry self.caption_label = EditableDescription(self) tb.pack(self.caption_label, 1, 0, 1, 1) self.caption_label.show() # branch selector lb = Label(self, text='On branch') tb.pack(lb, 2, 0, 1, 1) lb.show() self.branch_selector = Hoversel(self, text='none') self.branch_selector.callback_selected_add(self.branch_selected_cb) tb.pack(self.branch_selector, 3, 0, 1, 1) self.branch_selector.show() # status label + button self.status_label = lb = Entry(self, single_line=True, editable=False) tb.pack(lb, 4, 0, 1, 1) lb.show() ### Main content (left + right panes) panes = Panes(self, content_left_size = 0.5, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) box.pack_end(panes) panes.show() # the dag graph inside a scroller on the left self.graph = DagGraph(self, self.repo) fr = Frame(self, style="pad_medium", content=self.graph) scr = Scroller(self, content=fr, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) scr.bounce_set(0, 1) panes.part_content_set("left", scr) # the diff viewer on the right self.diff_view = DiffViewer(self, self.repo) self.diff_view.size_hint_weight = EXPAND_BOTH self.diff_view.size_hint_align = 0.0, 0.0 panes.part_content_set("right", self.diff_view) self.resize(800, 600) self.show()
def focus_clicked(obj, item=None): win = StandardWindow("focus", "Focus", autodel=True, size=(800,600)) win.focus_highlight_enabled = True tbx = Box(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(tbx) tbx.show() ### Toolbar tbar = Toolbar(win, shrink_mode=ELM_TOOLBAR_SHRINK_MENU, size_hint_align=(EVAS_HINT_FILL,0.0)) tb_it = tbar.item_append("document-print", "Hello", _tb_sel) tb_it.disabled = True tb_it = tbar.item_append("folder-new", "World", _tb_sel) tb_it = tbar.item_append("object-rotate-right", "H", _tb_sel) tb_it = tbar.item_append("mail-send", "Comes", _tb_sel) tb_it = tbar.item_append("clock", "Elementary", _tb_sel) tb_it = tbar.item_append("refresh", "Menu", _tb_sel) tb_it.menu = True tbar.menu_parent = win menu = tb_it.menu menu.item_add(None, "Shrink", "edit-cut", _tb_sel) menu_it = menu.item_add(None, "Mode", "edit-copy", _tb_sel) menu.item_add(menu_it, "is set to", "edit-paste", _tb_sel) menu.item_add(menu_it, "or to", "edit-paste", _tb_sel) menu.item_add(None, "Menu", "edit-delete", _tb_sel) tbx.pack_end(tbar) tbar.show() mainbx = Box(win, horizontal=True, size_hint_weight=EXPAND_BOTH) tbx.pack_end(mainbx) mainbx.show() ## First Col bx = Box(win, size_hint_weight=EXPAND_BOTH) mainbx.pack_end(bx) bx.show() lb = Label(win, text="<b>Use Tab or Shift+Tab<br/>or Arrow keys</b>", size_hint_align=FILL_BOTH) bx.pack_end(lb) lb.show() tg = Check(win, style="toggle") tg.part_text_set("on", "Yes") tg.part_text_set("off", "No") bx.pack_end(tg) tg.show() en = Entry(win, scrollable=True, single_line=True, text="This is a single line", size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) bx.pack_end(en) en.show() # bx2 = Box(win, horizontal=True, size_hint_align=FILL_BOTH) bx.pack_end(bx2) bx2.show() for i in range(2): bt = Button(win, text="Box", size_hint_align=FILL_BOTH, disabled=(i % 2)) bx2.pack_end(bt) bt.show() sc = Scroller(win, bounce=(True,True), content_min_limit=(1,1), size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) bx2.pack_end(sc) sc.show() bt = Button(win, text="Scroller", size_hint_align=FILL_BOTH) sc.content = bt bt.show() # bt = Button(win, text="Box", size_hint_align=FILL_BOTH) bx.pack_end(bt) bt.show() # bx2 = Box(win, horizontal=True, size_hint_align=FILL_BOTH) bx.pack_end(bx2) bx2.show() for i in range(2): bx3 = Box(win, size_hint_align=FILL_BOTH) bx2.pack_end(bx3) bx3.show() for j in range(3): bt = Button(win, text="Box", size_hint_align=FILL_BOTH) bx3.pack_end(bt) bt.show() sc = Scroller(win, bounce=(False, True), content_min_limit=(1,0), size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH) sc.content_min_limit=(1,1) bx2.pack_end(sc) sc.show() bx3 = Box(win, size_hint_align=FILL_BOTH) sc.content = bx3 bx3.show() for i in range(5): bt = Button(win, text="BX Scroller", size_hint_align=FILL_BOTH) bx3.pack_end(bt) bt.show() ## Second Col ly = Layout(win, size_hint_weight=EXPAND_BOTH) ly.file = edj_file, "twolines" mainbx.pack_end(ly) ly.show() bx2 = Box(win, horizontal=True, size_hint_align=FILL_BOTH) ly.part_content_set("element1", bx2) bx2.show() for i in range(3): bt = Button(win, text="Layout", size_hint_align=FILL_BOTH) bx2.pack_end(bt) bt.show() bx2.focus_custom_chain_prepend(bt) bx2 = Box(win, size_hint_align=FILL_BOTH) ly.part_content_set("element2", bx2) bx2.show() bt = Button(win, text="Disable", size_hint_align=FILL_BOTH) bt.callback_clicked_add(lambda b: b.disabled_set(True)) bx2.pack_end(bt) bt.show() bx2.focus_custom_chain_prepend(bt) bt2 = Button(win, text="Enable", size_hint_align=FILL_BOTH) bt2.callback_clicked_add(lambda b, b1: b1.disabled_set(False), bt) bx2.pack_end(bt2) bt2.show() bx2.focus_custom_chain_append(bt2) ## Third Col bx = Box(win, size_hint_weight=EXPAND_BOTH) mainbx.pack_end(bx) bx.show() fr = Frame(win, text="Frame", ) bx.pack_end(fr) fr.show() tb = Table(win, size_hint_weight=EXPAND_BOTH) fr.content = tb tb.show() for j in range(1): for i in range(2): bt = Button(win, text="Table", size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH) tb.pack(bt, i, j, 1, 1) bt.show() # fr = Bubble(win, text="Bubble", size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH) bx.pack_end(fr) fr.show() tb = Table(win, size_hint_weight=EXPAND_BOTH) fr.content = tb tb.show() for j in range(2): for i in range(1): bt = Button(win, text="Table", size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH) tb.pack(bt, i, j, 1, 1) bt.show() win.show()
def populate(self): # main vertical box box = Box(self, size_hint_weight = EXPAND_BOTH) self.resize_object_add(box) box.show() ### header fr = Frame(self, style='outdent_bottom', size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) box.pack_end(fr) fr.show() tb = Table(self, padding=(3,3), size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) fr.content = tb tb.show() # main menu button bt = MainMenuButton(self.app) tb.pack(bt, 0, 0, 1, 1) bt.show() # editable description entry self.caption_label = EditableDescription(self.app) tb.pack(self.caption_label, 1, 0, 1, 1) self.caption_label.show() # status label + button lb = Entry(self, editable=False, line_wrap=ELM_WRAP_NONE) lb.text_style_user_push("DEFAULT='align=center'") tb.pack(lb, 2, 0, 1, 1) lb.show() self.status_label = lb # branch selector self.branch_selector = Hoversel(self, text='HEAD', disabled=True, content=SafeIcon(self, 'git-branch')) self.branch_selector.callback_selected_add(self.branch_selected_cb) tb.pack(self.branch_selector, 3, 0, 1, 1) self.branch_selector.show() # pull button bt = Button(self, text='Pull', disabled=True, content=SafeIcon(self, 'git-pull')) bt.callback_clicked_add(self.app.action_pull) tb.pack(bt, 4, 0, 1, 1) bt.show() self.pull_btn = bt # push button bt = Button(self, text='Push', disabled=True, content=SafeIcon(self, 'git-push')) bt.callback_clicked_add(self.app.action_push) tb.pack(bt, 5, 0, 1, 1) bt.show() self.push_btn = bt ### Tree panes panes1 = Panes(self, content_left_min_size=200, content_left_size=0.0, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) box.pack_end(panes1) panes1.show() # the sidebar on the left self.sidebar = Sidebar(self, self.app) panes1.part_content_set('left', self.sidebar) ### Main content (left + right panes) panes2 = Panes(self, content_left_size=0.5, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) panes1.part_content_set('right', panes2) panes2.show() # the dag graph in the center self.graph = DagGraph(self, self.app) panes2.part_content_set('left', self.graph) # the diff viewer on the right self.diff_view = DiffViewer(self, self.app) self.diff_view.size_hint_weight = EXPAND_BOTH self.diff_view.size_hint_align = 0.0, 0.0 panes2.part_content_set('right', self.diff_view) # 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 focus4_clicked(obj, item=None): win = StandardWindow("focus4", "Focus 4", autodel=True, size=(320, 320)) win.focus_highlight_enabled = True win.focus_highlight_animate = True fr = Frame(win, style="pad_large", size_hint_weight=EXPAND_BOTH); win.resize_object_add(fr) fr.show() # First Example - Using Focus Highlight bx = Box(fr) fr.content = bx bx.show() tg = Check(bx, text="Focus Highlight Enabled (Config)", state=True, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) tg.callback_changed_add(_highlight_enabled_cb, win) bx.pack_end(tg) tg.show() tg = Check(bx, text="Focus Highlight Animate (Config)", state=True, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) tg.callback_changed_add(_highlight_animate_cb, win) bx.pack_end(tg) tg.show() tg = Check(bx, text="Focus Highlight Enabled (Win)", state=True, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) tg.callback_changed_add(_win_highlight_enabled_cb, win) bx.pack_end(tg) tg.show() tg = Check(bx, text="Focus Highlight Animate (Win)", state=True, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) tg.callback_changed_add(_win_highlight_animate_cb, win) bx.pack_end(tg) tg.show() sp = Separator(win, horizontal=True, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) bx.pack_end(sp) sp.show() # Second Example - Using Custom Chain lb = Label(bx, text="Custom Chain: Please use tab key to check", size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) bx.pack_end(lb) lb.show() bx2 = Box(bx, horizontal=True, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) bx.pack_end(bx2) bx2.show() bt1 = Button(bx2, text="Button 1", size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) bx2.pack_end(bt1) bt1.show() bt2 = Button(bx2, text="Button 2", size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) bx2.pack_end(bt2) bt2.show() bt3 = Button(bx2, text="Button 3", size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) bx2.pack_end(bt3) bt3.show() bt4 = Button(bx2, text="Button 4", size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) bx2.pack_end(bt4) bt4.show() bx2.focus_custom_chain = [bt2, bt1, bt4, bt3] tg = Check(bx, text="Custom Chain", state=False, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) tg.callback_changed_add(_custom_chain_cb, bx) bx.pack_end(tg) tg.show() win.show()
def focus4_clicked(obj, item=None): win = StandardWindow("focus4", "Focus 4", autodel=True, size=(320, 320)) win.focus_highlight_enabled = True win.focus_highlight_animate = True fr = Frame(win, style="pad_large", size_hint_weight=EXPAND_BOTH) win.resize_object_add(fr) fr.show() # First Example - Using Focus Highlight bx = Box(fr) fr.content = bx bx.show() tg = Check(bx, text="Focus Highlight Enabled (Config)", state=True, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) tg.callback_changed_add(_highlight_enabled_cb, win) bx.pack_end(tg) tg.show() tg = Check(bx, text="Focus Highlight Animate (Config)", state=True, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) tg.callback_changed_add(_highlight_animate_cb, win) bx.pack_end(tg) tg.show() tg = Check(bx, text="Focus Highlight Enabled (Win)", state=True, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) tg.callback_changed_add(_win_highlight_enabled_cb, win) bx.pack_end(tg) tg.show() tg = Check(bx, text="Focus Highlight Animate (Win)", state=True, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) tg.callback_changed_add(_win_highlight_animate_cb, win) bx.pack_end(tg) tg.show() sp = Separator(win, horizontal=True, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) bx.pack_end(sp) sp.show() # Second Example - Using Custom Chain lb = Label(bx, text="Custom Chain: Please use tab key to check", size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) bx.pack_end(lb) lb.show() bx2 = Box(bx, horizontal=True, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) bx.pack_end(bx2) bx2.show() bt1 = Button(bx2, text="Button 1", size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) bx2.pack_end(bt1) bt1.show() bt2 = Button(bx2, text="Button 2", size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) bx2.pack_end(bt2) bt2.show() bt3 = Button(bx2, text="Button 3", size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) bx2.pack_end(bt3) bt3.show() bt4 = Button(bx2, text="Button 4", size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) bx2.pack_end(bt4) bt4.show() bx2.focus_custom_chain = [bt2, bt1, bt4, bt3] tg = Check(bx, text="Custom Chain", state=False, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH) tg.callback_changed_add(_custom_chain_cb, bx) bx.pack_end(tg) tg.show() win.show()
def __init__(self, parent, title="About", standardicon="dialog-information", \ version="N/A", authors="No One", \ licen="GPL", webaddress="", info="Something, something, turtles"): Window.__init__(self, title, ELM_WIN_DIALOG_BASIC, autodel=True) background = Background(self, size_hint_weight=EXPAND_BOTH) self.resize_object_add(background) background.show() fr = Frame(self, style='pad_large', size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.resize_object_add(fr) fr.show() hbox = Box(self, horizontal=True, padding=(12, 12)) fr.content = hbox hbox.show() vbox = Box(self, align=(0.0, 0.0), padding=(6, 6), size_hint_weight=EXPAND_VERT, size_hint_align=FILL_VERT) hbox.pack_end(vbox) vbox.show() # icon + version ic = Icon(self, size_hint_min=(64, 64)) ic.standard_set(standardicon) vbox.pack_end(ic) ic.show() lb = Label(self, text=('Version: %s') % version) vbox.pack_end(lb) lb.show() sep = Separator(self, horizontal=True) vbox.pack_end(sep) sep.show() # buttons bt = Button(self, text=(title), size_hint_align=FILL_HORIZ) bt.callback_clicked_add(lambda b: self.entry.text_set(info)) vbox.pack_end(bt) bt.show() bt = Button(self, text=('Website'), size_hint_align=FILL_HORIZ) bt.callback_clicked_add(lambda b: xdg_open(webaddress)) vbox.pack_end(bt) bt.show() bt = Button(self, text=('Authors'), size_hint_align=FILL_HORIZ) bt.callback_clicked_add(lambda b: self.entry.text_set(authors)) vbox.pack_end(bt) bt.show() bt = Button(self, text=('License'), size_hint_align=FILL_HORIZ) bt.callback_clicked_add(lambda b: self.entry.text_set(licen)) vbox.pack_end(bt) bt.show() # main text self.entry = Entry(self, editable=False, scrollable=True, text=info, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.entry.callback_anchor_clicked_add(lambda e, i: xdg_open(i.name)) hbox.pack_end(self.entry) self.entry.show() self.resize(400, 200) self.show()
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 __init__(self, parent, title="About", standardicon="dialog-information", \ version="N/A", authors="No One", \ licen="GPL", webaddress="", info="Something, something, turtles"): if AboutWindow.__initialized: raise InstanceError("You can't create more than 1 instance of AboutWindow") AboutWindow.__initialized = True Window.__init__(self, title, ELM_WIN_DIALOG_BASIC, autodel=True) self.callback_delete_request_add(self.close_inst) background = Background(self, size_hint_weight=EXPAND_BOTH) self.resize_object_add(background) background.show() fr = Frame(self, style='pad_large', size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.resize_object_add(fr) fr.show() hbox = Box(self, horizontal=True, padding=(12,12)) fr.content = hbox hbox.show() vbox = Box(self, align=(0.0,0.0), padding=(6,6), size_hint_weight=EXPAND_VERT, size_hint_align=FILL_VERT) hbox.pack_end(vbox) vbox.show() # icon + version ic = Icon(self, size_hint_min=(64,64)) ic.standard_set(standardicon) vbox.pack_end(ic) ic.show() lb = Label(self, text=('Version: %s') % version) vbox.pack_end(lb) lb.show() sep = Separator(self, horizontal=True) vbox.pack_end(sep) sep.show() # buttons bt = Button(self, text=(title), size_hint_align=FILL_HORIZ) bt.callback_clicked_add(lambda b: self.entry.text_set(info)) vbox.pack_end(bt) bt.show() bt = Button(self, text=('Website'),size_hint_align=FILL_HORIZ) bt.callback_clicked_add(lambda b: xdg_open(webaddress)) vbox.pack_end(bt) bt.show() bt = Button(self, text=('Authors'), size_hint_align=FILL_HORIZ) bt.callback_clicked_add(lambda b: self.entry.text_set(authors)) vbox.pack_end(bt) bt.show() bt = Button(self, text=('License'), size_hint_align=FILL_HORIZ) bt.callback_clicked_add(lambda b: self.entry.text_set(licen)) vbox.pack_end(bt) bt.show() # main text self.entry = Entry(self, editable=False, scrollable=True, text=info, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.entry.callback_anchor_clicked_add(lambda e,i: xdg_open(i.name)) hbox.pack_end(self.entry) self.entry.show() self.resize(400, 200) self.show()
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()
def __init__(self, parent, app, target=None): self.app = app self._selected_item = None DialogWindow.__init__(self, parent, 'Egitu-compare', 'Compare tool', size=(500,500), autodel=True) # main vertical box (inside a padding frame) vbox = Box(self, padding=(0, 6), size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) fr = Frame(self, style='pad_medium', size_hint_expand=EXPAND_BOTH) self.resize_object_add(fr) fr.content = vbox fr.show() vbox.show() # two combos hbox = Box(self, horizontal=True, padding=(6,0), size_hint_expand=EXPAND_HORIZ, size_hint_fill=FILL_HORIZ) vbox.pack_end(hbox) hbox.show() cb1 = ComboBox(self, text=app.repo.status.current_branch.name) cb1.icon = SafeIcon(cb1, 'git-branch') cb1.callback_selected_add(lambda c: self.compare()) hbox.pack_end(cb1) cb1.show() self.base_combo = cb1 lb = Label(self, text='<b>...</b>', size_hint_align=(0.5,1.0)) hbox.pack_end(lb) lb.show() cb2 = ComboBox(self, text=target or app.repo.status.current_branch.name) cb2.icon = SafeIcon(cb1, 'git-branch') cb2.callback_selected_add(lambda c: self.compare()) hbox.pack_end(cb2) cb2.show() self.compare_combo = cb2 for branch in app.repo.branches: cb1.item_append(branch.name, 'git-branch') cb2.item_append(branch.name, 'git-branch') for branch in app.repo.remote_branches: cb1.item_append(branch, 'git-branch') cb2.item_append(branch, 'git-branch') for tag in app.repo.tags: cb1.item_append(tag.name, 'git-tag') cb2.item_append(tag.name, 'git-tag') # vertical panes panes = Panes(self, horizontal=True, content_left_size=0.25, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) vbox.pack_end(panes) panes.show() # commit list (inside a frame) li = CommitsList(panes, select_mode=ELM_OBJECT_SELECT_MODE_ALWAYS) li.callback_selected_add(self._list_selected_cb) li.show() self.commits_list = li fr = Frame(panes, content=li) panes.part_content_set('left', fr) fr.show() self.commits_frame = fr # diff de = DiffedEntry(panes) panes.part_content_set('right', de) de.show() self.diff_entry = de # buttons hbox = Box(self, horizontal=True, size_hint_expand=EXPAND_HORIZ, size_hint_fill=FILL_BOTH) vbox.pack_end(hbox) hbox.show() bt = Button(self, text='Merge', content=SafeIcon(self, 'git-merge')) bt.callback_clicked_add(lambda b: MergeBranchPopup(self, self.app, self.compare_combo.text)) hbox.pack_end(bt) bt.show() self.merge_btn = bt lb = Entry(self, single_line=True, editable=False) hbox.pack_end(lb) lb.show() self.merge_label = lb sep = Separator(self, size_hint_expand=EXPAND_HORIZ) hbox.pack_end(sep) bt = Button(self, text='Close') bt.callback_clicked_add(lambda b: self.delete()) hbox.pack_end(bt) bt.show() # self.compare() self.show()
def __init__(self, parent, app, branch=None): self.app = app Popup.__init__(self, parent) self.part_text_set('title,text', 'Create a new local branch') self.part_content_set('title,icon', SafeIcon(self, 'git-branch')) # main table tb = Table(self, padding=(4,4), size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) self.content = tb tb.show() # sep sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_BOTH) tb.pack(sep, 0, 0, 2, 1) sep.show() # branch name lb = Label(self, text='Branch name', size_hint_align=(0.0, 0.5)) tb.pack(lb, 0, 1, 1, 1) lb.show() en = Entry(self, single_line=True, scrollable=True, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) tb.pack(en, 1, 1, 1, 1) en.show() self.name_entry = en # branch type lb = Label(self, text='Branch type', size_hint_align=(0.0, 0.5)) tb.pack(lb, 0, 2, 1, 1) lb.show() hbox = Box(self, horizontal=True, padding=(6,0), size_hint_expand=EXPAND_BOTH, size_hint_align=(0.0, 0.5)) tb.pack(hbox, 1, 2, 1, 1) hbox.show() rdg = Radio(self, state_value=0, text='Local branch') rdg.callback_changed_add(self._type_radio_changed_cb) hbox.pack_end(rdg) rdg.show() rd = Radio(self, state_value=1, text='Tracking branch') rd.callback_changed_add(self._type_radio_changed_cb) rd.group_add(rdg) hbox.pack_end(rd) rd.show() self.type_radio = rdg # starting revision fr = Frame(self, text='Starting revision', size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) tb.pack(fr, 0, 3, 2, 1) fr.show() r = Rectangle(self.evas, size_hint_min=(300,200), size_hint_expand=EXPAND_BOTH) tb.pack(r, 0, 3, 2, 1) # TODO: use genlist to speedup population self.itc = GenlistItemClass(item_style='one_icon', text_get_func=self._gl_text_get, content_get_func=self._gl_content_get) li = Genlist(self, homogeneous=True, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) li.callback_selected_add(self._revision_selected_cb) fr.content = li li.show() self.rev_list = li # sep sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_BOTH) tb.pack(sep, 0, 4, 2, 1) sep.show() # buttons hbox = Box(self, horizontal=True, size_hint_expand=EXPAND_HORIZ, size_hint_fill=FILL_BOTH) tb.pack(hbox, 0, 5, 2, 1) hbox.show() bt = Button(self, text='Close') bt.callback_clicked_add(lambda b: self.delete()) hbox.pack_end(bt) bt.show() sep = Separator(self, size_hint_expand=EXPAND_HORIZ) hbox.pack_end(sep) bt = Button(self, text='Create') bt.callback_clicked_add(self._create_clicked_cb) hbox.pack_end(bt) bt.show() # populate the revision list and show the popup self.populate() self.show() self.name_entry.focus = True
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()
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 = {"sections": []} with open(LightDMConf) as f: currentSection = None for line in f: #Sections start with [ - such as [SeatDefaults] if line[0] == "[": self.config["sections"].append(line) currentSection = line.rstrip() s = Frame(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) s.text = currentSection[1:-1] s.show() sectionBox = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) sectionBox.show() s.content = sectionBox self.mainBox.pack_end(s) elif line[0] not in ["[", "\n"]: 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() sectionBox.pack_end(f) self.config[setting] = [f, currentSection] 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 __init__(self, app): self.app = app DialogWindow.__init__(self, app.win, 'egitu-remotes', 'Remotes', autodel=True, size=(600,400)) # main vertical box (inside a padding frame) fr = Frame(self, style='pad_medium', size_hint_weight=EXPAND_BOTH) self.resize_object_add(fr) fr.show() box = Box(fr, padding=(6,6)) fr.content = box box.show() # panes panes = Panes(box, content_left_size=0.25, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) box.pack_end(panes) panes.show() ### remotes List (on the left) li = List(panes) li.callback_selected_add(self._list_selected_cb) panes.part_content_set('left', li) li.show() self.remotes_list = li ### remote info (on the right) tb = Table(self, padding=(4, 4)) panes.part_content_set('right', tb) tb.show() # url lb = Label(self, text='URL', size_hint_align=(0.0,0.5)) tb.pack(lb, 0, 0, 1, 1) lb.show() en = Entry(self, single_line=True, scrollable=True, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) en.callback_changed_user_add(lambda e: \ setattr(self.save_url_btn, 'disabled', False)) tb.pack(en, 1, 0, 1, 1) en.show() self.url_entry = en # fetch lb = Label(self, text='Fetch', size_hint_align=(0.0,0.5)) tb.pack(lb, 0, 1, 1, 1) lb.show() en = Entry(self, single_line=True, scrollable=True, editable=False, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) tb.pack(en, 1, 1, 1, 1) en.show() self.fetch_entry = en # save button bt = Button(self, text='Save', disabled=True, size_hint_expand=EXPAND_VERT, size_hint_fill=FILL_VERT) bt.callback_clicked_add(self._save_url_clicked_cb) tb.pack(bt, 2, 0, 1, 1) bt.show() self.save_url_btn = bt # big info entry en = Entry(panes, scrollable=True, editable=False, line_wrap=ELM_WRAP_NONE, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH) en.callback_clicked_add(self._info_clicked_cb) tb.pack(en, 0, 2, 3, 1) en.show() self.info_entry = en ### buttons bar hbox = Box(box, horizontal=True, size_hint_expand=EXPAND_HORIZ, size_hint_fill=FILL_BOTH) box.pack_end(hbox) hbox.show() bt = Button(hbox, text='Add') bt.callback_clicked_add(lambda b: RemoteAddPopup(self, self.app.repo)) hbox.pack_end(bt) bt.show() bt = Button(hbox, text='Remove') bt.callback_clicked_add(self._remove_btn_cb) hbox.pack_end(bt) bt.show() bt = Button(hbox, text='Refresh') bt.callback_clicked_add(lambda b: self.restart_dialog()) hbox.pack_end(bt) bt.show() sep = Separator(hbox, size_hint_expand=EXPAND_HORIZ) hbox.pack_end(sep) bt = Button(hbox, text='Close') bt.callback_clicked_add(lambda b: self.delete()) hbox.pack_end(bt) bt.show() # populate and show the dialog window self.restart_dialog() self.show()
def slider_clicked(obj): win = StandardWindow("slider", "Slider", autodel=True) if obj is None: win.callback_delete_request_add(lambda x: elementary.exit()) win.show() fr = Frame(win, size_hint_weight=EXPAND_BOTH, style="pad_large") win.resize_object_add(fr) fr.show() bx = Box(win) fr.content = bx bx.show() # disabled horizontal slider ic = Icon(bx, file=os.path.join(img_path, "logo_small.png"), size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)) ic.show() sl = Slider(bx, text="Disabled", unit_format="%1.1f units", span_size=120, min_max=(50, 150), value=80, disabled=True, size_hint_align=FILL_HORIZ, size_hint_weight=EXPAND_HORIZ) sl.part_content_set("icon", ic) bx.pack_end(sl) sl.show() step = step_size_calculate(0, 9) sl = Slider(bx, unit_format="%1.0f units", indicator_format="%1.0f", span_size=120, min_max=(0, 9), text="Manual step", step=step, size_hint_align=FILL_HORIZ, size_hint_weight=EXPAND_HORIZ) bx.pack_end(sl) sl.show() # normal horizontal slider ic = Icon(bx, file=os.path.join(img_path, "logo_small.png"), size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)) sl1 = sl = Slider(bx, text="Horizontal", unit_format="%1.1f units", indicator_format="%1.1f", span_size=120, size_hint_align=FILL_HORIZ, size_hint_weight=EXPAND_HORIZ) sl.part_content_set("icon", ic) bx.pack_end(sl) ic.show() sl.show() # horizontally inverted slider ic = Icon(bx, file=os.path.join(img_path, "logo_small.png"), size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)) ic.show() sl = Slider(bx, text="Horizontal inverted", unit_format="%3.0f units", span_size=80, indicator_format="%3.0f", min_max=(50, 150), value=80, inverted=True, size_hint_align=ALIGN_CENTER, size_hint_weight=(0.0, 0.0)) sl.part_content_set("end", ic) sl.callback_delay_changed_add(delay_change_cb) bx.pack_end(sl) sl.show() # disabled horizontally inverted slider ic = Icon(bx, file=os.path.join(img_path, "logo_small.png"), size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)) ic.show() sl = Slider(bx, text="Disabled inverted", span_size=80, indicator_format="%3.0f", min_max=(50, 150), value=80, inverted=True, disabled=True, size_hint_align=ALIGN_CENTER, size_hint_weight=(0.0, 0.0)) sl.part_content_set("end", ic) bx.pack_end(sl) sl.show() # scale doubled slider sl = Slider(bx, indicator_show=False, text="Scale doubled", unit_format="%3.0f units", span_size=40, size_hint_align=FILL_HORIZ, size_hint_weight=EXPAND_HORIZ, indicator_format="%3.0f", min_max=(50, 150), value=80, inverted=True, scale=2.0) bx.pack_end(sl) sl.show() # horizontal box bx2 = Box(bx, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_VERT, horizontal=True) bx.pack_end(bx2) bx2.show() # vertical inverted slider ic = Icon(bx2, file=os.path.join(img_path, "logo_small.png"), size_hint_aspect=(EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1)) ic.show() sl = Slider(bx2, text="Vertical inverted", inverted=True, unit_format="%1.1f units", span_size=60, size_hint_align=FILL_VERT, size_hint_weight=EXPAND_VERT, indicator_format="%1.1f", value=0.2, scale=1.0, horizontal=False) sl.part_content_set("icon", ic) bx2.pack_end(sl) sl.show() sl1.callback_changed_add(change_cb, sl) # disabled vertical slider ic = Icon(bx2, file=os.path.join(img_path, "logo_small.png"), size_hint_aspect=(EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1)) sl = Slider(bx2, text="Disabled vertical", inverted=True, unit_format="%1.1f units", span_size=100, size_hint_align=FILL_VERT, size_hint_weight=EXPAND_VERT, indicator_format="%1.1f", value=0.2, scale=1.0, horizontal=False) # # XXX: If vertical mode is set after disabled, it's no longer disabled. # Elm bug? # sl.disabled = True sl.part_content_set("icon", ic) bx2.pack_end(sl) sl.show() # normal vertical slider sl = Slider(bx2, text="Vertical", unit_format="%1.1f units", span_size=60, size_hint_align=FILL_VERT, size_hint_weight=EXPAND_VERT, indicator_show=False, value=0.2, scale=1.0, horizontal=False) sl.callback_changed_add(change_print_cb, sl) bx2.pack_end(sl) sl.show() # box for bottom buttons bx2 = Box(win,size_hint_weight=EXPAND_HORIZ, horizontal=True) bx.pack_end(bx2) bx2.show() bt = Button(win, text="0") bt.callback_clicked_add(bt_0, sl) bt.show() bx2.pack_end(bt) bt = Button(win, text="1") bt.callback_clicked_add(bt_1, sl) bt.show() bx2.pack_end(bt) bt = Button(win, text="+0.1") bt.callback_clicked_add(bt_p1, sl) bt.show() bx2.pack_end(bt) bt = Button(win, text="-0.1") bt.callback_clicked_add(bt_m1, sl) bt.show() bx2.pack_end(bt)
def focus_clicked(obj, item=None): win = StandardWindow("focus", "Focus", autodel=True, size=(800, 600)) win.focus_highlight_enabled = True tbx = Box(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(tbx) tbx.show() ### Toolbar tbar = Toolbar(win, shrink_mode=ELM_TOOLBAR_SHRINK_MENU, size_hint_align=(EVAS_HINT_FILL, 0.0)) tb_it = tbar.item_append("document-print", "Hello", _tb_sel) tb_it.disabled = True tb_it = tbar.item_append("folder-new", "World", _tb_sel) tb_it = tbar.item_append("object-rotate-right", "H", _tb_sel) tb_it = tbar.item_append("mail-send", "Comes", _tb_sel) tb_it = tbar.item_append("clock", "Elementary", _tb_sel) tb_it = tbar.item_append("refresh", "Menu", _tb_sel) tb_it.menu = True tbar.menu_parent = win menu = tb_it.menu menu.item_add(None, "Shrink", "edit-cut", _tb_sel) menu_it = menu.item_add(None, "Mode", "edit-copy", _tb_sel) menu.item_add(menu_it, "is set to", "edit-paste", _tb_sel) menu.item_add(menu_it, "or to", "edit-paste", _tb_sel) menu.item_add(None, "Menu", "edit-delete", _tb_sel) tbx.pack_end(tbar) tbar.show() mainbx = Box(win, horizontal=True, size_hint_weight=EXPAND_BOTH) tbx.pack_end(mainbx) mainbx.show() ## First Col bx = Box(win, size_hint_weight=EXPAND_BOTH) mainbx.pack_end(bx) bx.show() lb = Label(win, text="<b>Use Tab or Shift+Tab<br/>or Arrow keys</b>", size_hint_align=FILL_BOTH) bx.pack_end(lb) lb.show() tg = Check(win, style="toggle") tg.part_text_set("on", "Yes") tg.part_text_set("off", "No") bx.pack_end(tg) tg.show() en = Entry(win, scrollable=True, single_line=True, text="This is a single line", size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) bx.pack_end(en) en.show() # bx2 = Box(win, horizontal=True, size_hint_align=FILL_BOTH) bx.pack_end(bx2) bx2.show() for i in range(2): bt = Button(win, text="Box", size_hint_align=FILL_BOTH, disabled=(i % 2)) bx2.pack_end(bt) bt.show() sc = Scroller(win, bounce=(True, True), content_min_limit=(1, 1), size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) bx2.pack_end(sc) sc.show() bt = Button(win, text="Scroller", size_hint_align=FILL_BOTH) sc.content = bt bt.show() # bt = Button(win, text="Box", size_hint_align=FILL_BOTH) bx.pack_end(bt) bt.show() # bx2 = Box(win, horizontal=True, size_hint_align=FILL_BOTH) bx.pack_end(bx2) bx2.show() for i in range(2): bx3 = Box(win, size_hint_align=FILL_BOTH) bx2.pack_end(bx3) bx3.show() for j in range(3): bt = Button(win, text="Box", size_hint_align=FILL_BOTH) bx3.pack_end(bt) bt.show() sc = Scroller(win, bounce=(False, True), content_min_limit=(1, 0), size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH) sc.content_min_limit = (1, 1) bx2.pack_end(sc) sc.show() bx3 = Box(win, size_hint_align=FILL_BOTH) sc.content = bx3 bx3.show() for i in range(5): bt = Button(win, text="BX Scroller", size_hint_align=FILL_BOTH) bx3.pack_end(bt) bt.show() ## Second Col ly = Layout(win, size_hint_weight=EXPAND_BOTH) ly.file = edj_file, "twolines" mainbx.pack_end(ly) ly.show() bx2 = Box(win, horizontal=True, size_hint_align=FILL_BOTH) ly.part_content_set("element1", bx2) bx2.show() for i in range(3): bt = Button(win, text="Layout", size_hint_align=FILL_BOTH) bx2.pack_end(bt) bt.show() bx2.focus_custom_chain_prepend(bt) bx2 = Box(win, size_hint_align=FILL_BOTH) ly.part_content_set("element2", bx2) bx2.show() bt = Button(win, text="Disable", size_hint_align=FILL_BOTH) bt.callback_clicked_add(lambda b: b.disabled_set(True)) bx2.pack_end(bt) bt.show() bx2.focus_custom_chain_prepend(bt) bt2 = Button(win, text="Enable", size_hint_align=FILL_BOTH) bt2.callback_clicked_add(lambda b, b1: b1.disabled_set(False), bt) bx2.pack_end(bt2) bt2.show() bx2.focus_custom_chain_append(bt2) ## Third Col bx = Box(win, size_hint_weight=EXPAND_BOTH) mainbx.pack_end(bx) bx.show() fr = Frame( win, text="Frame", ) bx.pack_end(fr) fr.show() tb = Table(win, size_hint_weight=EXPAND_BOTH) fr.content = tb tb.show() for j in range(1): for i in range(2): bt = Button(win, text="Table", size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH) tb.pack(bt, i, j, 1, 1) bt.show() # fr = Bubble(win, text="Bubble", size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH) bx.pack_end(fr) fr.show() tb = Table(win, size_hint_weight=EXPAND_BOTH) fr.content = tb tb.show() for j in range(2): for i in range(1): bt = Button(win, text="Table", size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH) tb.pack(bt, i, j, 1, 1) bt.show() win.show()