本文整理汇总了Python中efl.elementary.popup.Popup类的典型用法代码示例。如果您正苦于以下问题:Python Popup类的具体用法?Python Popup怎么用?Python Popup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Popup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
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()
示例2: __init__
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()
示例3: __init__
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()
示例4: showDialog
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()
示例5: build_prog_popup
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
示例6: __init__
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()
示例7: __init__
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()
示例8: _confirm_delete
def _confirm_delete(self, m, item):
pp = Popup(self.top_widget, text=self._task.text)
pp.part_text_set('title,text', 'Confirm task deletion?')
btn = Button(pp, text='Cancel')
btn.callback_clicked_add(lambda b: pp.delete())
pp.part_content_set('button1', btn)
btn = Button(pp, text='Delete Task')
btn.callback_clicked_add(self._delete_confirmed, pp)
pp.part_content_set('button2', btn)
pp.show()
示例9: show_error_msg
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()
示例10: __init__
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()
示例11: __init__
def __init__(self, parent, app):
self.app = app
Popup.__init__(self, parent)
self.part_text_set('title,text', 'Save current status')
self.part_content_set('title,icon', SafeIcon(self, 'git-stash'))
# main vertical box
box = Box(self, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
self.content = box
box.show()
# separator
sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_HORIZ)
box.pack_end(sep)
sep.show()
# description
en = Entry(self, single_line=True, scrollable=True,
size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
en.part_text_set('guide', 'Stash description (or empty for the default)')
en.text = 'WIP on ' + app.repo.status.head_describe
box.pack_end(en)
en.show()
# include untracked
ck = Check(self, text='Include untracked files', state=True,
size_hint_expand=EXPAND_HORIZ, size_hint_align=(0.0,0.5))
box.pack_end(ck)
ck.show()
# separator
sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_HORIZ)
box.pack_end(sep)
sep.show()
# buttons
bt = Button(self, text='Close')
bt.callback_clicked_add(lambda b: self.delete())
self.part_content_set('button1', bt)
bt.show()
bt = Button(self, text='Stash', content=SafeIcon(self, 'git-stash'))
bt.callback_clicked_add(self._stash_clicked_cb, en, ck)
self.part_content_set('button2', bt)
bt.show()
# focus to the entry and show
en.select_all()
en.focus = True
self.show()
示例12: cb_popup_center_title_text_block_clicked_event
def cb_popup_center_title_text_block_clicked_event(li, item, win):
popup = Popup(win, size_hint_weight=EXPAND_BOTH)
popup.text = "This Popup has title area and content area. " \
"When clicked on blocked event region, popup gets deleted"
popup.part_text_set("title,text", "Title")
popup.callback_block_clicked_add(cb_bnt_close, popup)
popup.show()
示例13: cb_popup_center_title_text_2button_restack
def cb_popup_center_title_text_2button_restack(li, item, win):
popup = Popup(win, size_hint_weight=EXPAND_BOTH)
popup.text = "When you click the 'Restack' button, " \
"an image will be located under this popup"
popup.part_text_set("title,text", "Title")
bt = Button(win, text="Restack")
bt.callback_clicked_add(cb_btn_restack, popup)
popup.part_content_set("button1", bt)
bt = Button(win, text="Close")
bt.callback_clicked_add(cb_bnt_close, popup)
popup.part_content_set("button3", bt)
popup.show()
示例14: confirmSave
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()
示例15: confirmSave
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()