def grid_clicked(obj): win = StandardWindow("grid", "Grid test", autodel=True, size=(480, 480)) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) gd = Grid(win, size=(100, 100), size_hint_weight=EXPAND_BOTH) win.resize_object_add(gd) gd.show() en = Entry(win, scrollable=True, text="Entry text 2", single_line=True) gd.pack(en, 60, 20, 30, 10) en.show() bt = Button(win, text="Next API function", disabled=True) gd.pack(bt, 30, 0, 40, 10) bt.disabled = True bt.show() bt = Button(win, text="Button") gd.pack(bt, 0, 0, 20, 20) bt.show() bt = Button(win, text="Button") gd.pack(bt, 10, 10, 40, 20) bt.show() bt = Button(win, text="Button") gd.pack(bt, 10, 30, 20, 50) bt.show() bt = Button(win, text="Button") gd.pack(bt, 80, 80, 20, 20) bt.show() bt = Button(win, text="Change") bt.callback_clicked_add(cb_change) gd.pack(bt, 40, 40, 20, 20) bt.show() re = Rectangle(win.evas, color=(128, 0, 0, 128)) gd.pack(re, 40, 70, 20, 10) re.show() re = Rectangle(win.evas, color=(0, 128, 0, 128)) gd.pack(re, 60, 70, 10, 10) re.show() re = Rectangle(win.evas, color=(0, 0, 128, 128)) gd.pack(re, 40, 80, 10, 10) re.show() re = Rectangle(win.evas, color=(128, 0, 128, 128)) gd.pack(re, 50, 80, 10, 10) re.show() re = Rectangle(win.evas, color=(128, 64, 0, 128)) gd.pack(re, 60, 80, 10, 10) re.show() win.show()
def confirmSave( self, ourCallback=None ): self.confirmPopup = Popup(self.mainWindow, size_hint_weight=EXPAND_BOTH) self.confirmPopup.part_text_set("title,text","File Unsaved") if self.mainEn.file_get()[0]: self.confirmPopup.text = "Save changes to '%s'?" % self.mainEn.file_get()[0].split("/")[len(self.mainEn.file_get()[0].split("/"))-1] else: self.confirmPopup.text = "Save changes to 'Untitlted'?" # Close without saving button no_btt = Button(self.mainWindow) no_btt.text = "No" no_btt.callback_clicked_add(self.closePopup, self.confirmPopup) if ourCallback is not None: no_btt.callback_clicked_add(ourCallback, True) no_btt.show() # cancel close request cancel_btt = Button(self.mainWindow) cancel_btt.text = "Cancel" cancel_btt.callback_clicked_add(self.closePopup, self.confirmPopup) cancel_btt.show() # Save the file and then close button sav_btt = Button(self.mainWindow) sav_btt.text = "Yes" sav_btt.callback_clicked_add(self.saveFile) sav_btt.callback_clicked_add(self.closePopup, self.confirmPopup) sav_btt.show() # add buttons to popup self.confirmPopup.part_content_set("button1", no_btt) self.confirmPopup.part_content_set("button2", cancel_btt) self.confirmPopup.part_content_set("button3", sav_btt) self.confirmPopup.show()
def addTab(self, widget, tabName, canClose=True, disabled=False): self.tabs.append(widget) btn = Button(self.buttonBox, style="anchor", size_hint_align=ALIGN_LEFT) btn.text = tabName btn.data["widget"] = widget btn.disabled = disabled btn.callback_clicked_add(self.showTab, widget) btn.show() icn = Icon(self.buttonBox) icn.standard_set("gtk-close") icn.show() cls = Button(self.buttonBox, content=icn, style="anchor", size_hint_align=ALIGN_LEFT) cls.data["widget"] = widget cls.callback_clicked_add(self.closeTab) cls.disabled = disabled if canClose: cls.show() sep = Separator(self.buttonBox, size_hint_align=ALIGN_LEFT) sep.show() self.buttonBox.pack_end(btn) self.buttonBox.pack_end(cls) self.buttonBox.pack_end(sep) #Arguments go: btn, cls, sep widget.data["close"] = cls widget.data["button"] = btn widget.data["sep"] = sep self.showTab(widget=widget)
def build_prog_popup(self): pp = Popup(self) pp.part_text_set('title,text', _('Extracting files, please wait...')) pp.show() vbox = Box(self) pp.part_content_set('default', vbox) vbox.show() lb = Label(self, ellipsis=True, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) vbox.pack_end(lb) lb.show() pb = Progressbar(pp, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) vbox.pack_end(pb) pb.show() bt = Button(pp, text=_('Cancel')) bt.callback_clicked_add(lambda b: self.app.abort_operation()) pp.part_content_set('button1', bt) self.prog_pbar = pb self.prog_label = lb self.prog_popup = pp
def 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 __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 calendar_clicked(obj, item=None): win = StandardWindow("calendar", "Calendar", autodel=True) bx = Box(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(bx) bx.show() bt = Button(bx, text="Next API function") bt.callback_clicked_add(api_bt_clicked, api) bx.pack_end(bt) if api["state"] == API_STATE_LAST: bt.disabled = True bt.show() the_time = datetime(2010, 12, 31) cal = Calendar(bx, first_day_of_week=ELM_DAY_MONDAY, size_hint_weight=EXPAND_BOTH, selected_time=the_time, min_max_year=(2010, 2012)) api["cal"] = cal bx.pack_end(cal) cal.show() win.show()
def build_prog_popup(self): pp = Popup(self) pp.part_text_set('title,text', _('Extracting files, please wait...')) pp.show() vbox = Box(self) pp.part_content_set('default', vbox) vbox.show() lb = Label(self, ellipsis=True, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) vbox.pack_end(lb) lb.show() pb = Progressbar(pp, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) vbox.pack_end(pb) pb.show() bt = Button(pp, text=_('Cancel')) bt.callback_clicked_add(lambda b: self.app.abort_operation()) pp.part_content_set('button1', bt) self.prog_pbar = pb self.prog_label = lb self.prog_popup = pp
def __init__(self, parent, session): Frame.__init__(self, parent) self.session = session self.size_hint_align = FILL_HORIZ self.text = "Listen port (range)" port = session.listen_port() b = Box(parent) b.size_hint_weight = EXPAND_HORIZ lp = self.lp = RangeSpinners( parent, low = session.conf.getint("Settings", "listen_low"), high = session.conf.getint("Settings", "listen_high"), minim = 0, maxim = 65535) lp.show() b.pack_end(lp) save = Button(parent) save.text = "Apply" save.callback_clicked_add(self.save_cb) save.show() b.pack_end(save) b.show() self.content = b
def __init__(self, parent, session): Frame.__init__(self, parent) self.session = session self.size_hint_align = FILL_HORIZ self.text = "Listen port (range)" port = session.listen_port() b = Box(parent) b.size_hint_weight = EXPAND_HORIZ lp = self.lp = RangeSpinners( parent, low=session.conf.getint("Settings", "listen_low"), high=session.conf.getint("Settings", "listen_high"), minim=0, maxim=65535) lp.show() b.pack_end(lp) save = Button(parent) save.text = "Apply" save.callback_clicked_add(self.save_cb) save.show() b.pack_end(save) b.show() self.content = b
def 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 header_row_pack(self, titles): """Takes a list (or a tuple) of tuples (string, bool) and packs them to the first row of the table.""" assert isinstance(titles, (list, tuple)) for t in titles: assert isinstance(t, tuple) assert len(t) == 2 title, sortable = t assert isinstance(title, basestring) assert isinstance(sortable, bool) def sort_btn_cb(button, col): if self.sort_column == col: self.reverse() else: self.sort_by_column(col) for count, t in enumerate(titles): title, sortable = t btn = Button(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ, text=title) btn.callback_clicked_add(sort_btn_cb, count) if not sortable: btn.disabled = True btn.show() self.pack(btn, count, 0, 1, 1) self.header_row.append(btn)
def _populate_done_cb(self, success): # draw the last date piece if self._last_date: self.date_add(self._last_date, self._last_date_row, self._current_row) # draw still-open connections lines (and clear the old ones) while self._open_connection_lines: l = self._open_connection_lines.pop() l.delete() for key in self._open_connections: for child_col, child_row, new_col in self._open_connections[key]: l = self.connection_add(child_col, child_row, child_col, self._current_row) self._open_connection_lines.append(l) # add the "show more" button if necessary if self._open_connections: bt = Button(self, text="Show more commits", size_hint_align=(0,0)) bt.callback_clicked_add(self._show_more_clicked_cb) self.pack(bt, 0, self._current_row + 1, 10, 2) bt.show() # show the first commit in the diff view if self._first_commit is not None: self.win.show_commit(self._first_commit) self._first_commit = None
def naviframe_clicked(obj): win = StandardWindow("naviframe", "Naviframe test", autodel=True, size=(400, 400)) win.focus_highlight_enabled = True if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) nf = Naviframe(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) win.resize_object_add(nf) nf.show() bt = Button(win, text="Next") bt.callback_clicked_add(page2, nf) content = Photo(nf, file=os.path.join(img_path, "logo.png"), fill_inside=True, style="shadow") item = nf.item_push("Page 1", None, bt, content, "basic") nf.data["page1"] = item win.show()
def menu_create(search, win): tbx.clear() for category in items: frame = Frame(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH, text=category[0]) frame.show() tbx.pack_end(frame) tbx2 = Box(win, layout=ELM_BOX_LAYOUT_FLOW_HORIZONTAL, size_hint_weight=(EVAS_HINT_EXPAND, 0.0), size_hint_align=(EVAS_HINT_FILL, 0.0)) frame.content_set(tbx2) tbx2.show() cnt = 0 for test in category[1]: if (search == None) or (test[0].lower().find(search.lower()) > -1): bt = Button(win, text=test[0]) bt.callback_clicked_add(selected_cb, test[1], test[2]) bt.show() tbx2.pack_end(bt) cnt += 1 if cnt < 1: frame.delete()
def __init__(self, parent): InnerWindow.__init__(self, parent) vbox = Box(self) vbox.show() self.content = vbox title = Label(self, scale=2.0, text='Edone %s' % VERSION) title.show() vbox.pack_end(title) en = Entry(self, text=INFO, editable=False, scrollable=True, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) en.show() vbox.pack_end(en) sep = Separator(self, horizontal=True) sep.show() vbox.pack_end(sep) close = Button(self, text='Close') close.callback_clicked_add(lambda b: self.delete()) close.show() vbox.pack_end(close) self.activate()
def box_transition_clicked(obj, item=None): win = StandardWindow("box-layout-transition", "Box Layout Transition", autodel=True) vbox = Box(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH) win.resize_object_add(vbox) vbox.show() bx = Box(win, layout=ELM_BOX_LAYOUT_HORIZONTAL, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH) vbox.pack_end(bx) bx.show() sep = Separator(win, horizontal=True) vbox.pack_end(sep) sep.show() bt = Button(win, text="layout: %s" % layout_list[current_layout]) bt.callback_clicked_add(box_transition_button_cb, bx) vbox.pack_end(bt) bt.show() for i in range(4): ic = Icon(win, file=ic_file, resizable=(0, 0), size_hint_align=(0.5, 0.5)) bx.pack_end(ic) ic.show() win.show()
def menu_create(search, win): tbx.clear() for category in items: frame = Frame(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH, text=category[0]) frame.show() tbx.pack_end(frame) tbx2 = Box(win, layout=ELM_BOX_LAYOUT_FLOW_HORIZONTAL, size_hint_weight=(EVAS_HINT_EXPAND, 0.0), size_hint_align=(EVAS_HINT_FILL, 0.0)) frame.content_set(tbx2) tbx2.show() cnt = 0 for test in category[1]: if (search == None) or (test[0].lower().find(search.lower()) > -1): bt = Button(win, text=test[0]) bt.callback_clicked_add(selected_cb, test[1], test[2]) bt.show() tbx2.pack_end(bt) cnt += 1 if cnt < 1: frame.delete()
def confirmSave(self, ourCallback=None): self.confirmPopup = Popup(self.mainWindow, size_hint_weight=EXPAND_BOTH) self.confirmPopup.part_text_set("title,text", "File Unsaved") current_file = self.mainEn.file[0] current_file = \ os.path.basename(current_file) if current_file else "Untitled" self.confirmPopup.text = "Save changes to '%s'?" % (current_file) # Close without saving button no_btt = Button(self.mainWindow) no_btt.text = "No" no_btt.callback_clicked_add(self.closePopup, self.confirmPopup) if ourCallback is not None: no_btt.callback_clicked_add(ourCallback, True) no_btt.show() # cancel close request cancel_btt = Button(self.mainWindow) cancel_btt.text = "Cancel" cancel_btt.callback_clicked_add(self.closePopup, self.confirmPopup) cancel_btt.show() # Save the file and then close button sav_btt = Button(self.mainWindow) sav_btt.text = "Yes" sav_btt.callback_clicked_add(self.saveFile) sav_btt.callback_clicked_add(self.closePopup, self.confirmPopup) sav_btt.show() # add buttons to popup self.confirmPopup.part_content_set("button1", no_btt) self.confirmPopup.part_content_set("button2", cancel_btt) self.confirmPopup.part_content_set("button3", sav_btt) self.confirmPopup.show()
def __init__(self): StandardWindow.__init__(self, "ex2", "Hello Elementary", size=(300, 200)) self.callback_delete_request_add(lambda o: elm.exit()) ourLabel = Label(self) ourLabel.size_hint_weight = EXPAND_BOTH ourLabel.text = "Hello Elementary!" ourLabel.show() ourButton = Button(self) ourButton.size_hint_weight = EXPAND_BOTH ourButton.text = "Goodbye Elementary" ourButton.callback_clicked_add(self.buttonPressed) ourButton.show() ourBox = Box(self) ourBox.size_hint_weight = EXPAND_BOTH ourBox.pack_end(ourLabel) ourBox.pack_end(ourButton) ourBox.show() self.resize_object_add(ourBox)
def __init__(self, repo, win): self.repo = repo self.win = win self.confirmed = False StandardWindow.__init__(self, 'Egitu', 'Egitu', autodel=True) vbox = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.resize_object_add(vbox) vbox.show() # title en = Entry(self, editable=False, text='<title><align=center>Commit changes</align></title>', size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) vbox.pack_end(en) en.show() panes = Panes(self, content_left_size = 0.2, horizontal=True, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) vbox.pack_end(panes) panes.show() # message entry en = Entry(self, editable=True, scrollable=True, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) en.part_text_set('guide', 'Enter commit message here') panes.part_content_set("left", en) en.show() self.msg_entry = en # diff entry self.diff_entry = DiffedEntry(self) panes.part_content_set("right", self.diff_entry) self.diff_entry.show() # buttons hbox = Box(self, horizontal=True, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) vbox.pack_end(hbox) hbox.show() bt = Button(self, text="Cancel") bt.callback_clicked_add(lambda b: self.delete()) hbox.pack_end(bt) bt.show() bt = Button(self, text="Commit") bt.callback_clicked_add(self.commit_button_cb) hbox.pack_end(bt) bt.show() # show the window and give focus to the editable entry self.size = 500, 500 self.show() en.focus = True # load the diff repo.request_diff(self.diff_done_cb, only_staged=True)
def confirmSave(self, ourCallback=None): self.confirmPopup = Popup(self.mainWindow, size_hint_weight=EXPAND_BOTH) self.confirmPopup.part_text_set("title,text", "File Unsaved") if self.mainEn.file_get()[0]: self.confirmPopup.text = "Save changes to '%s'?" % self.mainEn.file_get( )[0].split("/")[len(self.mainEn.file_get()[0].split("/")) - 1] else: self.confirmPopup.text = "Save changes to 'Untitlted'?" # Close without saving button no_btt = Button(self.mainWindow) no_btt.text = "No" no_btt.callback_clicked_add(self.closePopup, self.confirmPopup) if ourCallback is not None: no_btt.callback_clicked_add(ourCallback, True) no_btt.show() # cancel close request cancel_btt = Button(self.mainWindow) cancel_btt.text = "Cancel" cancel_btt.callback_clicked_add(self.closePopup, self.confirmPopup) cancel_btt.show() # Save the file and then close button sav_btt = Button(self.mainWindow) sav_btt.text = "Yes" sav_btt.callback_clicked_add(self.saveFile) sav_btt.callback_clicked_add(self.closePopup, self.confirmPopup) sav_btt.show() # add buttons to popup self.confirmPopup.part_content_set("button1", no_btt) self.confirmPopup.part_content_set("button2", cancel_btt) self.confirmPopup.part_content_set("button3", sav_btt) self.confirmPopup.show()
def confirmSave(self, ourCallback=None): self.confirmPopup = Popup(self.mainWindow, size_hint_weight=EXPAND_BOTH) self.confirmPopup.part_text_set("title,text", "File Unsaved") current_file = self.mainEn.file[0] current_file = \ os.path.basename(current_file) if current_file else "Untitled" self.confirmPopup.text = "Save changes to '%s'?" % (current_file) # Close without saving button no_btt = Button(self.mainWindow) no_btt.text = "No" no_btt.callback_clicked_add(self.closePopup, self.confirmPopup) if ourCallback is not None: no_btt.callback_clicked_add(ourCallback, True) no_btt.show() # cancel close request cancel_btt = Button(self.mainWindow) cancel_btt.text = "Cancel" cancel_btt.callback_clicked_add(self.closePopup, self.confirmPopup) cancel_btt.show() # Save the file and then close button sav_btt = Button(self.mainWindow) sav_btt.text = "Yes" sav_btt.callback_clicked_add(self.saveFile) sav_btt.callback_clicked_add(self.closePopup, self.confirmPopup) sav_btt.show() # add buttons to popup self.confirmPopup.part_content_set("button1", no_btt) self.confirmPopup.part_content_set("button2", cancel_btt) self.confirmPopup.part_content_set("button3", sav_btt) self.confirmPopup.show()
def select_torrent(self): sel = Fileselector(self.win) sel.expandable = False sel.path_set(os.path.expanduser("~")) sel.size_hint_weight_set(1.0, 1.0) sel.size_hint_align_set(-1.0, -1.0) sel.show() sf = Frame(self.win) sf.size_hint_weight_set(1.0, 1.0) sf.size_hint_align_set(-1.0, -1.0) sf.text = "Select torrent file" sf.content = sel sf.show() magnet = Entry(self.win) magnet.single_line = True magnet.scrollable = True if hasattr(magnet, "cnp_selection_get"): magnet.cnp_selection_get(ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_TEXT) else: import pyperclip t = pyperclip.paste() if t is not None and t.startswith("magnet:"): magnet.entry = t magnet.show() mf = Frame(self.win) mf.size_hint_weight_set(1.0, 0.0) mf.size_hint_align_set(-1.0, 0.0) mf.text = "Or enter magnet URI here" mf.content = magnet mf.show() mbtn = Button(self.win) mbtn.text = "Done" mbtn.show() mbox = Box(self.win) mbox.size_hint_weight_set(1.0, 0.0) mbox.size_hint_align_set(-1.0, 0.0) mbox.horizontal = True mbox.pack_end(mf) mbox.pack_end(mbtn) mbox.show() box = Box(self.win) box.size_hint_weight = (1.0, 1.0) box.size_hint_align = (-1.0, -1.0) box.pack_end(sf) box.pack_end(mbox) box.show() inwin = InnerWindow(self.win) inwin.content = box sel.callback_done_add(self.add_torrent_cb) sel.callback_done_add(lambda x, y: inwin.delete()) mbtn.callback_clicked_add(self.add_magnet_uri_cb, magnet) mbtn.callback_clicked_add(lambda x: inwin.delete()) inwin.activate()
def 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 cb_popup_center_title_text_1button(li, item, win): popup = Popup(win, size_hint_weight=EXPAND_BOTH) popup.text = "This Popup has content area and " \ "action area set, action area has one button Close" bt = Button(win, text="Close") bt.callback_clicked_add(cb_bnt_close, popup) popup.part_content_set("button1", bt) popup.show()
def transit2_clicked(obj, item=None): win = StandardWindow("transit2", "Transit 2", autodel=True, size=(400, 400)) bt = Button(win, text="Resizing Effect", pos=(50, 100), size=(100, 50)) bt.show() bt.callback_clicked_add(transit_resizing) win.show()
def cb_popup_center_title_text_1button(li, item, win): popup = Popup(win, size_hint_weight=EXPAND_BOTH) popup.text = "This Popup has content area and " \ "action area set, action area has one button Close" bt = Button(win, text="Close") bt.callback_clicked_add(cb_bnt_close, popup) popup.part_content_set("button1", bt) popup.show()
def __init__(self, win, url=None): Popup.__init__(self, win) self.win = win # title self.part_text_set('title,text', 'Recent Repositories') ic = Icon(self, file=theme_resource_get('egitu.png')) self.part_content_set('title,icon', ic) # content: recent list li = List(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) li.callback_activated_add(self.recent_selected_cb) recents = recent_history_get() if recents: for recent_url in recents: path, name = os.path.split(recent_url) item = li.item_append(name) item.data['url'] = recent_url else: item = li.item_append('no recent repository') item.disabled = True li.show() # table+rect to respect min size :/ tb = Table(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) r = Rectangle(self.evas, color=(0,0,0,0), size_hint_min=(200,200), size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) tb.pack(r, 0, 0, 1, 1) tb.pack(li, 0, 0, 1, 1) self.content = tb # popup auto-list - not expand well :( # self.size_hint_weight = EXPAND_BOTH # self.size_hint_align = FILL_BOTH # self.size_hint_min = 400, 400 # self.item_append('no recent repos', None) # self.item_append('asd2', None) # self.item_append('asd2', None) # buttons bt = Button(self, text='Open') bt.callback_clicked_add(self.load_btn_cb) self.part_content_set('button1', bt) bt = Button(self, text='Clone (TODO)') bt.disabled = True self.part_content_set('button2', bt) bt = Button(self, text='Create (TODO)') bt.disabled = True self.part_content_set('button3', bt) if url is not None: self.try_to_load(url) else: self.callback_block_clicked_add(lambda p: p.delete()) self.show()
def __init__(self, parent, app, branch): self.app = app self.branch = branch Popup.__init__(self, parent) self.part_text_set("title,text", "Delete branch") self.part_content_set("title,icon", Icon(self, standard="user-trash")) # main vertical box box = Box(self) self.content = box box.show() # sep sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_BOTH) box.pack_end(sep) sep.show() # label en = Entry( self, editable=False, text="%s<br><br><hilight>%s</hilight><br>" % ("Are you sure you want to delete this branch?", branch.name), size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH, ) box.pack_end(en) en.show() # force checkbox ck = Check( self, text="Force delete (even if not fully merged)", size_hint_expand=EXPAND_BOTH, size_hint_align=(0.0, 0.5), ) box.pack_end(ck) ck.show() self.force_chk = ck # buttons sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_BOTH) box.pack_end(sep) sep.show() bt = Button(self, text="Cancel") bt.callback_clicked_add(lambda b: self.delete()) self.part_content_set("button1", bt) bt.show() bt = Button(self, text="Delete branch") bt.callback_clicked_add(self._delete_btn_cb) self.part_content_set("button2", bt) bt.show() # self.show()
def __init__(self): win = StandardWindow("Testing", "Elementary Sorted Table") # pylint: disable=no-member win.callback_delete_request_add(lambda o: elm.exit()) # Build the titles for the table. The titles is a list of tuples # with the following format: # ( <str - Header Text>, <Bool - Sortable> )''' titles = [] for i in range(COLUMNS): titles.append(("Column " + str(i), True if i != 2 else False)) # Create our sorted list object slist = SortedList(win, titles=titles, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) # Populate the rows in our table for _i in range(ROWS): # Each row is a list with the number of elements # that must equal the number of headers row = [] for j in range(COLUMNS): # Row elements can be ANY elementary object if j == 0: # For the first column in each row, we will create a button # that will delete the row when pressed btn = Button(slist, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) btn.text = "Delete row" btn.callback_clicked_add( lambda x, y=row: slist.row_unpack(y, delete=True)) btn.show() # Add the btn created to our row row.append(btn) else: # For each other row create a label with a random number data = random.randint(0, ROWS * COLUMNS) label = Label(slist, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) label.text = str(data) # For integer data we also need to assign value to "sort_data" # because otherwise things get sorted as text label.data["sort_data"] = data label.show() # Append our label to the row row.append(label) # Add the row into the SortedList slist.row_pack(row, sort=False) # Show the list slist.show() win.resize_object_add(slist) win.resize(600, 400) win.show()
def transit4_clicked(obj, item=None): win = StandardWindow("transit4", "Transit 4", autodel=True, size=(300, 300)) bt = Button(win, text="Zoom Effect", size=(100, 50), pos=(100, 125)) bt.show() bt.callback_clicked_add(transit_zoom) win.show()
def __init__(self, canvas, title, text): n = Popup(canvas) n.part_text_set("title,text", title) n.text = text b = Button(canvas) b.text = "OK" b.callback_clicked_add(lambda x: n.delete()) n.part_content_set("button1", b) n.show()
def update_ui(self, listing_in_progress=False): box = self.header_box box.clear() ui_disabled = True # file listing in progress if listing_in_progress: spin = Progressbar(box, style='wheel', pulse_mode=True) spin.pulse(True) spin.show() box.pack_end(spin) lb = Label(box, text=_('Reading archive, please wait...'), size_hint_weight=EXPAND_HORIZ, size_hint_align=(0.0, 0.5)) lb.show() box.pack_end(lb) # or header button else: if self.app.file_name is None: txt = _('No archive loaded, click to choose a file') else: ui_disabled = False txt = _('<b>Archive:</b> %s') % \ (os.path.basename(self.app.file_name)) txt = '<align=left>%s</align>' % txt lb = Label(box, ellipsis=True, text=txt) bt = Button(box, content=lb, size_hint_weight=EXPAND_HORIZ, size_hint_fill=FILL_HORIZ) bt.callback_clicked_add(lambda b: \ FileSelectorInwin(self, _('Choose an archive'), self._archive_selected_cb, path=os.getcwd())) box.pack_end(bt) bt.show() # always show the about button sep = Separator(box) box.pack_end(sep) sep.show() ic = SafeIcon(box, 'help-about', size_hint_min=(24, 24)) ic.callback_clicked_add(lambda i: InfoWin(self)) box.pack_end(ic) ic.show() for widget in (self.extract_btn, self.fsb, self.create_folder_chk, self.del_chk): widget.disabled = ui_disabled self.update_fsb_label()
def __init__(self, parent, repo): self.repo = repo Popup.__init__(self, parent) self.part_text_set("title,text", "Add remote") tb = Table(self, padding=(3, 3), size_hint_expand=EXPAND_BOTH) self.content = tb tb.show() # name lb = Label(tb, text="Name") tb.pack(lb, 0, 0, 1, 1) lb.show() en = Entry( tb, editable=True, single_line=True, scrollable=True, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH ) en.part_text_set("guide", "Name for the new remote") en.callback_changed_user_add(lambda e: self.err_unset()) tb.pack(en, 1, 0, 1, 1) en.show() self.name_entry = en # url lb = Label(tb, text="URL") tb.pack(lb, 0, 1, 1, 1) lb.show() en = Entry( tb, editable=True, single_line=True, scrollable=True, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH ) en.part_text_set("guide", "git://git.example.com/repo.git") en.callback_changed_user_add(lambda e: self.err_unset()) tb.pack(en, 1, 1, 1, 1) en.show() self.url_entry = en # error label lb = Label(tb, text="", size_hint_expand=EXPAND_HORIZ) tb.pack(lb, 0, 2, 2, 1) lb.show() self.error_label = lb # buttons bt = Button(self, text="Cancel") bt.callback_clicked_add(lambda b: self.delete()) self.part_content_set("button1", bt) bt.show() bt = Button(self, text="Add remote") bt.callback_clicked_add(self._add_btn_cb) self.part_content_set("button2", bt) bt.show() self.show()
def showDialog(self, title, msg): dia = Popup(self) dia.part_text_set("title,text", title) dia.part_text_set("default", msg) bt = Button(dia, text="Ok") bt.callback_clicked_add(lambda b: dia.delete()) dia.part_content_set("button1", bt) dia.show()
def aboutPress( self, obj, it ): #About popup self.popupAbout = Popup(self.mainWindow, size_hint_weight=EXPAND_BOTH) self.popupAbout.text = "ePad - A simple text editor written in python and elementary<br><br> " \ "By: Jeff Hoogland" bt = Button(self.mainWindow, text="Done") bt.callback_clicked_add(self.aboutClose) self.popupAbout.part_content_set("button1", bt) self.popupAbout.show() it.selected_set(False)
def aboutPress(self, obj, it): #About popup self.popupAbout = Popup(self.mainWindow, size_hint_weight=EXPAND_BOTH) self.popupAbout.text = "ePad - A simple text editor written in python and elementary<br><br> " \ "By: Jeff Hoogland" bt = Button(self.mainWindow, text="Done") bt.callback_clicked_add(self.aboutClose) self.popupAbout.part_content_set("button1", bt) self.popupAbout.show() it.selected_set(False)
def showDialog(self, title, msg): dia = Popup(self) dia.part_text_set("title,text", title) dia.part_text_set("default", msg) bt = Button(dia, text="Ok") bt.callback_clicked_add(lambda b: dia.delete()) dia.part_content_set("button1", bt) dia.show()
def __init__( self ): win = StandardWindow("Testing", "Elementary Sorted Table") win.callback_delete_request_add(lambda o: elm.exit()) """Build the titles for the table. The titles is a list of tuples with the following format: ( <String - Header Text>, <Bool - Sortable> )""" titles = [] for i in range(COLUMNS): titles.append( ("Column " + str(i), True if i != 2 else False) ) #Create our sorted list object slist = SortedList(win, titles=titles, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) #Populate the rows in our table for i in range(ROWS): #Each row is a list with the number of elements that must equal the number of headers row = [] for j in range(COLUMNS): #Row elements can be ANY elementary object if j == 0: #For the first column in each row, we will create a button that will delete the row when pressed btn = Button(slist, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) btn.text = "Delete row" btn.callback_clicked_add( lambda x, y=row: slist.row_unpack(y, delete=True) ) btn.show() #Add the btn created to our row row.append(btn) else: #For each other row create a label with a random number data = random.randint(0, ROWS*COLUMNS) lb = Label(slist, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) lb.text=str(data) """For integer data we also need to assign value to "sort_data" because otherwise things get sorted as text""" lb.data["sort_data"] = data lb.show() #Append our label to the row row.append(lb) #Add the row into the SortedList slist.row_pack(row, sort=False) #Show the list slist.show() win.resize_object_add(slist) win.resize(600, 400) win.show()
def core_evas_canvas_callbacks_clicked(obj, item=None): win = StandardWindow("evascanvascbs", "Evas canvas callbacks", autodel=True, size=(320, 320)) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) text = Text(win.evas, text="Events printed on console", size=(300, 30), color=(0, 0, 0, 255)) text.font_set("Sans", 12) text.pos = (10, 10) text.show() canvas = win.evas_get() canvas.event_callback_add(EVAS_CALLBACK_CANVAS_FOCUS_IN, events_cb1, "EVAS_CALLBACK_CANVAS_FOCUS_IN") canvas.event_callback_add(EVAS_CALLBACK_CANVAS_FOCUS_OUT, events_cb1, "EVAS_CALLBACK_CANVAS_FOCUS_OUT") canvas.event_callback_add(EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN, events_cb2, "EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN") canvas.event_callback_add(EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT, events_cb2, "EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT") canvas.event_callback_add(EVAS_CALLBACK_RENDER_FLUSH_PRE, events_cb1, "EVAS_CALLBACK_RENDER_FLUSH_PRE") canvas.event_callback_add(EVAS_CALLBACK_RENDER_FLUSH_POST, events_cb1, "EVAS_CALLBACK_RENDER_FLUSH_POST") canvas.event_callback_add(EVAS_CALLBACK_RENDER_PRE, events_cb1, "EVAS_CALLBACK_RENDER_PRE") canvas.event_callback_add(EVAS_CALLBACK_RENDER_POST, events_cb1, "EVAS_CALLBACK_RENDER_POST") r2 = Rectangle(win.evas, size=(120, 70), color=(0, 100, 0, 100), pos=(70, 70)) r2.show() hbox = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH, horizontal=True) win.resize_object_add(hbox) hbox.show() b = Button(win, text="del cbs", size_hint_align=(0.5, 1.0)) hbox.pack_end(b) b.callback_clicked_add(btn_del_cbs_cb) b.show() win.show()
def __init__(self, parent, title, msg): Popup.__init__(self, parent) self.part_text_set('title,text', title) self.part_text_set('default', msg) b = Button(self, text='Close') b.callback_clicked_add(lambda b: self.delete()) b.show() self.part_content_set('button1', b) self.show()
def page2(bt, nf): ic = Icon(nf, file=os.path.join(img_path, "icon_right_arrow.png")) bt = Button(nf, content=ic) bt.callback_clicked_add(page3, nf) content = Photo(nf, file=os.path.join(img_path, "plant_01.jpg"), fill_inside=True, style="shadow") item = nf.item_push("Page 2", None, bt, content, "basic") item.part_text_set("subtitle", "Here is sub-title part!")
def page5(bt, nf): bt = Button(nf, text="Page 4") bt.callback_clicked_add(navi_pop, nf) bt2 = Button(nf, text="Page 6") bt2.callback_clicked_add(page6, nf) content = Photo(nf, file=os.path.join(img_path, "sky_01.jpg"), fill_inside=True, style="shadow") item = nf.item_insert_after(nf.top_item_get(), "Page 5", bt, bt2, content, "basic") item.part_text_set("subtitle", "This page is inserted without transition")
def page7(bt, nf): bt = Button(nf, text="Page 6") bt.callback_clicked_add(navi_pop, nf) bt2 = Button(nf, text="Page 1") bt2.callback_clicked_add(lambda x: nf.data["page1"].promote()) content = Photo(nf, file=os.path.join(img_path, "sky_02.jpg"), fill_inside=True, style="shadow") item = nf.item_push("Page 7", bt, bt2, content, "overlap") item.part_text_set("subtitle", "Overlap style!")
def page6(bt, nf): bt = Button(nf, text="Page 5") bt.callback_clicked_add(navi_pop, nf) bt2 = Button(nf, text="Page 7") bt2.callback_clicked_add(page7, nf) content = Photo(nf, file=os.path.join(img_path, "sky_03.jpg"), fill_inside=True, style="shadow") item = nf.item_push("Page 6", bt, bt2, content, "overlap") item.part_text_set("subtitle", "Overlap style!")
def image_clicked(obj): win = StandardWindow("image", "Image test", autodel=True, size=(320, 480)) if obj is None: win.callback_delete_request_add(lambda o: elementary.exit()) vbox = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) win.resize_object_add(vbox) vbox.show() im = Image(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH, file=os.path.join(img_path, "logo.png")) vbox.pack_end(im) im.show() sep = Separator(win, horizontal=True) vbox.pack_end(sep) sep.show() hbox = Box(win, layout=ELM_BOX_LAYOUT_FLOW_HORIZONTAL, size_hint_align=FILL_BOTH) vbox.pack_end(hbox) hbox.show() for rot in orients: b = Button(win, text=rot[0]) hbox.pack_end(b) b.callback_clicked_add(lambda b, y=rot[1]: im.orient_set(y)) b.show() sep = Separator(win, horizontal=True) vbox.pack_end(sep) sep.show() hbox = Box(win, horizontal=True, size_hint_align=FILL_BOTH) vbox.pack_end(hbox) hbox.show() b = Button(win, text="Set remote URL") hbox.pack_end(b) b.callback_clicked_add(lambda b: im.file_set(remote_url)) b.show() pb = Progressbar(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) hbox.pack_end(pb) pb.show() im.callback_download_start_add(_cb_im_download_start, pb) im.callback_download_done_add(_cb_im_download_done) im.callback_download_progress_add(_cb_im_download_progress, pb) im.callback_download_error_add(_cb_im_download_error, pb) win.show()
def aboutPress(self, obj, it): # About popup self.popupAbout = Popup(self._canvas, size_hint_weight=EXPAND_BOTH) self.popupAbout.part_text_set("title,text", "ePad version {0}".format(__version__)) self.popupAbout.text = ("A simple text editor written in " "python and elementary<br><br> " "By: Jeff Hoogland") bt = Button(self._canvas, text="Done") bt.callback_clicked_add(self.aboutClose) self.popupAbout.part_content_set("button1", bt) self.popupAbout.show()
def update_ui(self, listing_in_progress=False): box = self.header_box box.clear() ui_disabled = True # file listing in progress if listing_in_progress: spin = Progressbar(box, style='wheel', pulse_mode=True) spin.pulse(True) spin.show() box.pack_end(spin) lb = Label(box, text=_('Reading archive, please wait...'), size_hint_weight=EXPAND_HORIZ, size_hint_align=(0.0, 0.5)) lb.show() box.pack_end(lb) # or header button else: if self.app.file_name is None: txt = _('No archive loaded, click to choose a file') else: ui_disabled = False txt = _('<b>Archive:</b> %s') % \ (os.path.basename(self.app.file_name)) txt = '<align=left>%s</align>' % txt lb = Label(box, ellipsis=True, text=txt) bt = Button(box, content=lb, size_hint_weight=EXPAND_HORIZ, size_hint_fill=FILL_HORIZ) bt.callback_clicked_add(lambda b: \ FileSelectorInwin(self, _('Choose an archive'), self._archive_selected_cb, path=os.getcwd())) box.pack_end(bt) bt.show() # always show the about button sep = Separator(box) box.pack_end(sep) sep.show() ic = SafeIcon(box, 'help-about', size_hint_min=(24,24)) ic.callback_clicked_add(lambda i: InfoWin(self)) box.pack_end(ic) ic.show() for widget in (self.extract_btn, self.fsb, self.create_folder_chk, self.del_chk): widget.disabled = ui_disabled self.update_fsb_label()
def header_row_pack(self, titles): """Takes a list (or a tuple) of tuples (string, bool) and packs them to the first row of the table.""" assert isinstance(titles, (list, tuple)) for _t in titles: assert isinstance(_t, tuple) assert len(_t) == 2 title, sortable = _t try: assert isinstance(title, str) except TypeError: assert isinstance(title, str) assert isinstance(sortable, bool) def sort_btn_cb(button, col): """ Sort or reverse if sort button pressed. """ if self.sort_column == col: self.reverse() else: self.sort_by_column(col) for count, _t in enumerate(titles): title, sortable = _t btn = Button(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ, text=title) btn.callback_clicked_add(sort_btn_cb, count) if not sortable: btn.disabled = True btn.show() self.header_box.pack_end(btn) self.header_row.append(btn) elm_list = ScrollableList(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) elm_list.policy_set(ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF) elm_list.mode_set(ELM_LIST_EXPAND) elm_list.go() elm_list.show() self.list_box.pack_end(elm_list) self.lists.append(elm_list) sep = Separator(self) sep.show() self.header_box.pack_end(sep) self.header_box.pack_end(sep)
def show_error_msg(self, msg): pop = Popup(self, text=msg) pop.part_text_set('title,text', _('Error')) btn = Button(self, text=_('Continue')) btn.callback_clicked_add(lambda b: pop.delete()) pop.part_content_set('button1', btn) btn = Button(self, text=_('Exit')) btn.callback_clicked_add(lambda b: self.app.exit()) pop.part_content_set('button2', btn) pop.show()
def __init__(self, parent, title=None, msg=None): Popup.__init__(self, parent) self.part_text_set('title,text', title or 'Error') if not msg: msg = 'Unknown error' self.part_text_set('default', '<align=left>'+msg+'</align>') b = Button(self, text='Close') b.callback_clicked_add(lambda b: self.delete()) b.show() self.part_content_set('button1', b) self.show()
def page2(bt, nf): ic = Icon(nf, file=os.path.join(img_path, "icon_right_arrow.png")) bt = Button(nf, content=ic) bt.callback_clicked_add(page3, nf) content = Photo(nf, file=os.path.join(img_path, "plant_01.jpg"), fill_inside=True, style="shadow") item = nf.item_push("Page 2", None, bt, content, "basic") item.part_text_set("subtitle", "Here is sub-title part!")
def __init__(self, canvas, exit_func): n = Popup(canvas) n.part_text_set("title,text", "Confirm exit") n.text = "Are you sure you wish to exit Epour?" b = Button(canvas) b.text = "Yes" b.callback_clicked_add(lambda x: exit_func()) n.part_content_set("button1", b) b = Button(canvas) b.text = "No" b.callback_clicked_add(lambda x: n.delete()) n.part_content_set("button2", b) n.show()
def page6(bt, nf): bt = Button(nf, text="Page 5") bt.callback_clicked_add(navi_pop, nf) bt2 = Button(nf, text="Page 7") bt2.callback_clicked_add(page7, nf) content = Photo(nf, file=os.path.join(img_path, "sky_03.jpg"), fill_inside=True, style="shadow") item = nf.item_push("Page 6", bt, bt2, content, "overlap") item.part_text_set("subtitle", "Overlap style!")
def transit7_clicked(obj, item=None): win = StandardWindow("transit7", "Transit 7", autodel=True, size=(400, 400)) bt = Button(win, text="Front Button - Resizable Flip Effect", pos=(50, 100), size=(250, 30)) bt.show() bt2 = Button(win, text="Back Button - Resizable Flip Effect", pos=(50, 100), size=(300, 200)) win.show() bt.callback_clicked_add(transit_resizable_flip, bt2) bt2.callback_clicked_add(transit_resizable_flip, bt)