本文整理汇总了Python中efl.elementary.button.Button.text方法的典型用法代码示例。如果您正苦于以下问题:Python Button.text方法的具体用法?Python Button.text怎么用?Python Button.text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类efl.elementary.button.Button
的用法示例。
在下文中一共展示了Button.text方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: confirmSave
# 需要导入模块: from efl.elementary.button import Button [as 别名]
# 或者: from efl.elementary.button.Button import text [as 别名]
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()
示例2: __init__
# 需要导入模块: from efl.elementary.button import Button [as 别名]
# 或者: from efl.elementary.button.Button import text [as 别名]
def __init__(self):
StandardWindow.__init__(self, "ex4", "Align Example", size=(300, 200))
self.callback_delete_request_add(lambda o: elm.exit())
ourButton = Button(self)
ourButton.size_hint_weight = EXPAND_BOTH
ourButton.size_hint_align = (0, 0)
ourButton.text = "Button 1"
ourButton.show()
ourButton2 = Button(self)
ourButton2.size_hint_weight = EXPAND_BOTH
ourButton2.size_hint_align = FILL_BOTH
ourButton2.text = "Button 2"
ourButton2.show()
ourButton3 = Button(self)
ourButton3.size_hint_weight = EXPAND_BOTH
ourButton3.size_hint_align = (1, 1)
ourButton3.text = "Button 3"
ourButton3.show()
ourBox = Box(self)
ourBox.size_hint_weight = EXPAND_BOTH
ourBox.pack_end(ourButton)
ourBox.pack_end(ourButton2)
ourBox.pack_end(ourButton3)
ourBox.show()
self.resize_object_add(ourBox)
示例3: confirmSave
# 需要导入模块: from efl.elementary.button import Button [as 别名]
# 或者: from efl.elementary.button.Button import text [as 别名]
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()
示例4: fileExists
# 需要导入模块: from efl.elementary.button import Button [as 别名]
# 或者: from efl.elementary.button.Button import text [as 别名]
def fileExists(self, filePath):
self.confirmPopup = Popup(self.mainWindow,
size_hint_weight=EXPAND_BOTH)
# Add a table to hold dialog image and text to Popup
tb = Table(self.confirmPopup, size_hint_weight=EXPAND_BOTH)
self.confirmPopup.part_content_set("default", tb)
tb.show()
# Add dialog-error Image to table
need_ethumb()
icon = Icon(self.confirmPopup, thumb='True')
icon.standard_set('dialog-question')
# Using gksudo or sudo fails to load Image here
# unless options specify using preserving their existing environment.
# may also fail to load other icons but does not raise an exception
# in that situation.
# Works fine using eSudo as a gksudo alternative,
# other alternatives not tested
try:
dialogImage = Image(self.confirmPopup,
size_hint_weight=EXPAND_HORIZ,
size_hint_align=FILL_BOTH,
file=icon.file_get())
tb.pack(dialogImage, 0, 0, 1, 1)
dialogImage.show()
except RuntimeError:
# An error message is displayed for this same error
# when aboutWin is initialized so no need to redisplay.
pass
# Add dialog text to table
dialogLabel = Label(self.confirmPopup, line_wrap=ELM_WRAP_WORD,
size_hint_weight=EXPAND_HORIZ,
size_hint_align=FILL_BOTH)
current_file = os.path.basename(filePath)
dialogLabel.text = "'%s' already exists. Overwrite?<br><br>" \
% (current_file)
tb.pack(dialogLabel, 1, 0, 1, 1)
dialogLabel.show()
# Close without saving button
no_btt = Button(self.mainWindow)
no_btt.text = "No"
no_btt.callback_clicked_add(self.closePopup, self.confirmPopup)
no_btt.show()
# Save the file and then close button
sav_btt = Button(self.mainWindow)
sav_btt.text = "Yes"
sav_btt.callback_clicked_add(self.doSelected)
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("button3", sav_btt)
self.confirmPopup.show()
示例5: __init__
# 需要导入模块: from efl.elementary.button import Button [as 别名]
# 或者: from efl.elementary.button.Button import text [as 别名]
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()
示例6: __init__
# 需要导入模块: from efl.elementary.button import Button [as 别名]
# 或者: from efl.elementary.button.Button import text [as 别名]
def __init__(self):
StandardWindow.__init__(self, "ex7", "Naviframe", size=(300, 200))
self.callback_delete_request_add(lambda o: elm.exit())
staticImage = staticImage = Image(self)
staticImage.size_hint_weight = EXPAND_BOTH
staticImage.file_set("images/logo.png")
staticImage.tooltip_text_set("A picture!")
staticImage.show()
ourLabel = ourLabel = Label(self)
ourLabel.size_hint_weight = EXPAND_BOTH
ourLabel.text = "Hey look some text!"
ourLabel.show()
self.nf = Naviframe(self)
self.nf.size_hint_weight = EXPAND_BOTH
self.nf.size_hint_align = FILL_BOTH
self.nf.show()
buttonOne = Button(self)
buttonOne.size_hint_weight = EXPAND_BOTH
buttonOne.text = "Show image"
buttonOne.callback_clicked_add(self.buttonPressed, staticImage)
buttonOne.show()
buttonTwo = Button(self)
buttonTwo.size_hint_weight = EXPAND_BOTH
buttonTwo.text = "Show label"
buttonTwo.callback_clicked_add(self.buttonPressed, ourLabel)
buttonTwo.show()
buttonBox = Box(self)
buttonBox.size_hint_weight = EXPAND_HORIZ
buttonBox.horizontal_set(True)
buttonBox.pack_end(buttonOne)
buttonBox.pack_end(buttonTwo)
buttonBox.show()
mainBox = Box(self)
mainBox.size_hint_weight = EXPAND_BOTH
mainBox.pack_end(self.nf)
mainBox.pack_end(buttonBox)
mainBox.show()
self.nf.item_simple_push(staticImage)
self.resize_object_add(mainBox)
示例7: addTab
# 需要导入模块: from efl.elementary.button import Button [as 别名]
# 或者: from efl.elementary.button.Button import text [as 别名]
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)
示例8: __init__
# 需要导入模块: from efl.elementary.button import Button [as 别名]
# 或者: from efl.elementary.button.Button import text [as 别名]
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
示例9: addPackage
# 需要导入模块: from efl.elementary.button import Button [as 别名]
# 或者: from efl.elementary.button.Button import text [as 别名]
def addPackage(self, pak):
row = []
ourCheck = Check(self)
ourCheck.data['packageName'] = pak.name
ourCheck.callback_changed_add(self.app.checkChange)
ourCheck.show()
row.append(ourCheck)
ourName = Button(self, style="anchor", size_hint_weight=EXPAND_HORIZ,
size_hint_align=FILL_HORIZ)
ourName.text = pak.name
ourName.data["packageDes"] = pak.candidate.description
ourName.callback_pressed_add(self.packagePressed)
ourName.show()
row.append(ourName)
ourVersion = Label(self, size_hint_weight=EXPAND_HORIZ,
size_hint_align=(0.1, 0.5))
ourVersion.text = pak.installed.version
ourVersion.show()
row.append(ourVersion)
newVersion = Label(self, size_hint_weight=EXPAND_HORIZ,
size_hint_align=(0.1, 0.5))
newVersion.text = pak.candidate.version
newVersion.show()
row.append(newVersion)
self.app.packagesToUpdate[pak.name] = {'check':ourCheck, 'selected':False}
self.packageList.row_pack(row, sort=False)
示例10: select_torrent
# 需要导入模块: from efl.elementary.button import Button [as 别名]
# 或者: from efl.elementary.button.Button import text [as 别名]
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()
示例11: __init__
# 需要导入模块: from efl.elementary.button import Button [as 别名]
# 或者: from efl.elementary.button.Button import text [as 别名]
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()
示例12: errorPopup
# 需要导入模块: from efl.elementary.button import Button [as 别名]
# 或者: from efl.elementary.button.Button import text [as 别名]
def errorPopup(window, errorMsg):
errorPopup = Popup(window, size_hint_weight=EXPAND_BOTH)
errorPopup.callback_block_clicked_add(lambda obj: errorPopup.delete())
# Add a table to hold dialog image and text to Popup
tb = Table(errorPopup, size_hint_weight=EXPAND_BOTH)
errorPopup.part_content_set("default", tb)
tb.show()
# Add dialog-error Image to table
need_ethumb()
icon = Icon(errorPopup, thumb='True')
icon.standard_set('dialog-warning')
# Using gksudo or sudo fails to load Image here
# unless options specify using preserving their existing environment.
# may also fail to load other icons but does not raise an exception
# in that situation.
# Works fine using eSudo as a gksudo alternative,
# other alternatives not tested
try:
dialogImage = Image(errorPopup,
size_hint_weight=EXPAND_HORIZ,
size_hint_align=FILL_BOTH,
file=icon.file_get())
tb.pack(dialogImage, 0, 0, 1, 1)
dialogImage.show()
except RuntimeError:
# An error message is displayed for this same error
# when aboutWin is initialized so no need to redisplay.
pass
# Add dialog text to table
dialogLabel = Label(errorPopup, line_wrap=ELM_WRAP_WORD,
size_hint_weight=EXPAND_HORIZ,
size_hint_align=FILL_BOTH)
dialogLabel.text = errorMsg
tb.pack(dialogLabel, 1, 0, 1, 1)
dialogLabel.show()
# Ok Button
ok_btt = Button(errorPopup)
ok_btt.text = "Ok"
ok_btt.callback_clicked_add(lambda obj: errorPopup.delete())
ok_btt.show()
# add button to popup
errorPopup.part_content_set("button3", ok_btt)
errorPopup.show()
示例13: __init__
# 需要导入模块: from efl.elementary.button import Button [as 别名]
# 或者: from efl.elementary.button.Button import text [as 别名]
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)
示例14: __init__
# 需要导入模块: from efl.elementary.button import Button [as 别名]
# 或者: from efl.elementary.button.Button import text [as 别名]
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
示例15: __init__
# 需要导入模块: from efl.elementary.button import Button [as 别名]
# 或者: from efl.elementary.button.Button import text [as 别名]
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:"
fr.size_hint_align = evas.EVAS_HINT_FILL, 0.0
bz.pack_end(fr)
fr.show()
else:
bz1 = Box(win)
bz.pack_end(bz1)
bz1.show()
lb = Label(win)
lb.text = "<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)
#.........这里部分代码省略.........