本文整理汇总了Python中efl.elementary.table.Table.show方法的典型用法代码示例。如果您正苦于以下问题:Python Table.show方法的具体用法?Python Table.show怎么用?Python Table.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类efl.elementary.table.Table
的用法示例。
在下文中一共展示了Table.show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: photo_clicked
# 需要导入模块: from efl.elementary.table import Table [as 别名]
# 或者: from efl.elementary.table.Table import show [as 别名]
def photo_clicked(obj):
win = StandardWindow("photo", "Photo test", autodel=True, size=(300, 300))
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
elementary.need_ethumb()
tb = Table(win, size_hint_weight=EXPAND_BOTH)
tb.show()
sc = Scroller(win, size_hint_weight=EXPAND_BOTH, content=tb)
win.resize_object_add(sc)
sc.show()
n = 0
for j in range(12):
for i in range(12):
ph = Photo(win, aspect_fixed=False, size=80, editable=True,
size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
name = os.path.join(img_path, images[n])
n += 1
if n >= 9: n = 0
if n == 8:
ph.thumb = name
else:
ph.file = name
if n in [2, 3]:
ph.fill_inside = True
ph.style = "shadow"
tb.pack(ph, i, j, 1, 1)
ph.show()
win.show()
示例2: video_clicked
# 需要导入模块: from efl.elementary.table import Table [as 别名]
# 或者: from efl.elementary.table.Table import show [as 别名]
def video_clicked(obj):
win = StandardWindow("video", "video", autodel=True, size=(800, 600))
win.alpha = True # Needed to turn video fast path on
video = Video(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(video)
video.show()
player = Player(win, content=video)
player.show()
notify = Notify(win, orient=ELM_NOTIFY_ORIENT_BOTTOM, timeout=3.0)
notify.content = player
tb = Table(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(tb)
bt = FileselectorButton(win, text="Select Video",
size_hint_weight=EXPAND_BOTH, size_hint_align=(0.5, 0.1))
bt.callback_file_chosen_add(my_bt_open, video)
tb.pack(bt, 0, 0, 1, 1)
bt.show()
tb.show()
video.event_callback_add(EVAS_CALLBACK_MOUSE_MOVE, notify_show, notify)
video.event_callback_add(EVAS_CALLBACK_MOUSE_IN, notify_block, notify)
video.event_callback_add(EVAS_CALLBACK_MOUSE_OUT, notify_unblock, notify)
win.show()
示例3: table4_clicked
# 需要导入模块: from efl.elementary.table import Table [as 别名]
# 或者: from efl.elementary.table.Table import show [as 别名]
def table4_clicked(obj, item=None):
win = StandardWindow("table4", "Table 4", autodel=True)
tb = Table(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(tb)
win.data["tb"] = tb
tb.show()
bt = Button(win, text="Button 1", size_hint_weight=(0.25, 0.25),
size_hint_align=FILL_BOTH)
tb.pack(bt, 0, 0, 1, 1)
win.data["b1"] = bt
bt.callback_clicked_add(my_tb_ch, win)
bt.show()
bt = Button(win, text="Button 2", size_hint_weight=(0.75, 0.25),
size_hint_align=FILL_BOTH)
tb.pack(bt, 1, 0, 1, 1)
win.data["b2"] = bt
bt.callback_clicked_add(my_tb_ch, win)
bt.show()
bt = Button(win, text="Button 3", size_hint_weight=(0.25, 0.75),
size_hint_align=FILL_BOTH)
tb.pack(bt, 0, 1, 1, 1)
win.data["b3"] = bt
bt.callback_clicked_add(my_tb_ch, win)
bt.show()
win.show()
示例4: table5_clicked
# 需要导入模块: from efl.elementary.table import Table [as 别名]
# 或者: from efl.elementary.table.Table import show [as 别名]
def table5_clicked(obj, item=None):
win = StandardWindow("table5", "Table 5", autodel=True)
tb = Table(win, homogeneous=True, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(tb)
tb.show()
bt = Button(win, text="A", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 33, 0, 34, 33)
bt.show()
bt = Button(win, text="B", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 67, 33, 33, 34)
bt.show()
bt = Button(win, text="C", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 33, 67, 34, 33)
bt.show()
bt = Button(win, text="D", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 0, 33, 33, 34)
bt.show()
bt = Button(win, text="X", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 33, 33, 34, 34)
bt.show()
win.show()
示例5: __init__
# 需要导入模块: from efl.elementary.table import Table [as 别名]
# 或者: from efl.elementary.table.Table import show [as 别名]
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()
示例6: fileExists
# 需要导入模块: from efl.elementary.table import Table [as 别名]
# 或者: from efl.elementary.table.Table import show [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()
示例7: __init__
# 需要导入模块: from efl.elementary.table import Table [as 别名]
# 或者: from efl.elementary.table.Table import show [as 别名]
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()
示例8: errorPopup
# 需要导入模块: from efl.elementary.table import Table [as 别名]
# 或者: from efl.elementary.table.Table import show [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()
示例9: thumb_clicked
# 需要导入模块: from efl.elementary.table import Table [as 别名]
# 或者: from efl.elementary.table.Table import show [as 别名]
def thumb_clicked(obj):
if not elementary.need_ethumb():
print("Ethumb not available!")
return
images = (
"panel_01.jpg",
"plant_01.jpg",
"rock_01.jpg",
"rock_02.jpg",
"sky_01.jpg",
"sky_02.jpg",
"sky_03.jpg",
"sky_04.jpg",
"wood_01.jpg",
"mystrale.jpg",
"mystrale_2.jpg"
)
win = StandardWindow("thumb", "Thumb", autodel=True, size=(600, 600))
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
tb = Table(win, size_hint_weight=EXPAND_BOTH)
n = 0
for j in range(12):
for i in range(12):
n = (n + 1) % 11
th = Thumb(win, file=os.path.join(img_path, images[n]),
size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
editable=True)
tb.pack(th, i, j, 1, 1)
th.show()
sc = Scroller(win, size_hint_weight=EXPAND_BOTH, content=tb)
win.resize_object_add(sc)
tb.show()
sc.show()
win.show()
示例10: table2_clicked
# 需要导入模块: from efl.elementary.table import Table [as 别名]
# 或者: from efl.elementary.table.Table import show [as 别名]
def table2_clicked(obj, item=None):
win = StandardWindow("table2", "Table Homogeneous", autodel=True)
tb = Table(win, homogeneous=True, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(tb)
tb.show()
bt = Button(win, text="A", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 1, 1, 2, 2)
bt.show()
bt = Button(win, text="Blah blah blah", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 3, 0, 2, 3)
bt.show()
bt = Button(win, text="Hallow", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 0, 3, 10, 1)
bt.show()
bt = Button(win, text="B", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 2, 5, 2, 1)
bt.show()
bt = Button(win, text="C", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 8, 8, 1, 1)
bt.show()
bt = Button(win, text="Wide", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 1, 7, 7, 2)
bt.show()
win.show()
示例11: table_clicked
# 需要导入模块: from efl.elementary.table import Table [as 别名]
# 或者: from efl.elementary.table.Table import show [as 别名]
def table_clicked(obj, item=None):
win = StandardWindow("table", "Table", autodel=True)
tb = Table(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(tb)
tb.show()
bt = Button(win, text="Button 1", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 0, 0, 1, 1)
bt.show()
bt = Button(win, text="Button 2", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 1, 0, 1, 1)
bt.show()
bt = Button(win, text="Button 3", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 2, 0, 1, 1)
bt.show()
bt = Button(win, text="Button 4", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 0, 1, 2, 1)
bt.show()
bt = Button(win, text="Button 5", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 2, 1, 1, 3)
bt.show()
bt = Button(win, text="Button 6", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 0, 2, 2, 2)
bt.show()
win.show()
示例12: __init__
# 需要导入模块: from efl.elementary.table import Table [as 别名]
# 或者: from efl.elementary.table.Table import show [as 别名]
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()
示例13: scroller_clicked
# 需要导入模块: from efl.elementary.table import Table [as 别名]
# 或者: from efl.elementary.table.Table import show [as 别名]
def scroller_clicked(obj):
win = StandardWindow("scroller", "Scroller", autodel=True, size=(320, 320))
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
tb = Table(win, size_hint_weight=EXPAND_BOTH)
img = ["panel_01.jpg",
"plant_01.jpg",
"rock_01.jpg",
"rock_02.jpg",
"sky_01.jpg",
"sky_02.jpg",
"sky_03.jpg",
"sky_04.jpg",
"wood_01.jpg"]
n = 0
for j in range(12):
for i in range(12):
bg2 = Background(win, file=os.path.join(img_path, img[n]),
size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
size_hint_min=(318, 318))
n = n + 1
if n >= 9:
n = 0
tb.pack(bg2, i, j, 1, 1)
bg2.show()
sc = Scroller(win, size_hint_weight=EXPAND_BOTH, content=tb,
page_relative=(1.0, 1.0))
sc.callback_edge_top_add(cb_edges, "top")
sc.callback_edge_bottom_add(cb_edges, "bottom")
sc.callback_edge_left_add(cb_edges, "left")
sc.callback_edge_right_add(cb_edges, "right")
sc.callback_scroll_drag_start_add(cb_drags, "start")
sc.callback_scroll_drag_stop_add(cb_drags, "stop")
sc.callback_scroll_anim_start_add(cb_anims, "start")
sc.callback_scroll_anim_stop_add(cb_anims, "stop")
win.resize_object_add(sc)
tb.show()
sc.show()
tb2 = Table(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(tb2)
bt = Button(win, text="to 300 300", size_hint_weight=EXPAND_BOTH,
size_hint_align=(0.1, 0.1))
bt.callback_clicked_add(my_scroller_go_300_300, sc)
tb2.pack(bt, 0, 0, 1, 1)
bt.show()
bt = Button(win, text="to 900 300", size_hint_weight=EXPAND_BOTH,
size_hint_align=(0.9, 0.1))
bt.callback_clicked_add(my_scroller_go_900_300, sc)
tb2.pack(bt, 1, 0, 1, 1)
bt.show()
bt = Button(win, text="to 300 900", size_hint_weight=EXPAND_BOTH,
size_hint_align=(0.1, 0.9))
bt.callback_clicked_add(my_scroller_go_300_900, sc)
tb2.pack(bt, 0, 1, 1, 1)
bt.show()
bt = Button(win, text="to 900 900", size_hint_weight=EXPAND_BOTH,
size_hint_align=(0.9, 0.9))
bt.callback_clicked_add(my_scroller_go_900_900, sc)
tb2.pack(bt, 1, 1, 1, 1)
bt.show()
tb2.show()
win.show()
示例14: __init__
# 需要导入模块: from efl.elementary.table import Table [as 别名]
# 或者: from efl.elementary.table.Table import show [as 别名]
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')
#.........这里部分代码省略.........
示例15: ComboBox
# 需要导入模块: from efl.elementary.table import Table [as 别名]
# 或者: from efl.elementary.table.Table import show [as 别名]
class ComboBox(Entry):
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 callback_selected_add(self, func):
self._selected_func = func
@property
def icon(self):
return self.part_content_get('icon')
@icon.setter
def icon(self, icon):
icon.size_hint_min = 16, 16 # TODO file a bug for elm on phab
self.part_content_set('icon', icon)
@property
def guide(self):
self.part_text_get('guide')
@guide.setter
def guide(self, text):
self.part_text_set('guide', text)
def item_append(self, label=None, icon=None, end=None):
item_data = (label, icon, end)
self._list.item_append(self._itc, item_data)
def clear(self):
self._list.clear()
def activate(self, source=None):
self.focus = False # :/
# TODO calculate this based on _list and parent size
# print(self._list.size)
# print(self._list.geometry)
self._bg.size_hint_min = 0, 200
loc = self._hover.best_content_location_get(ELM_HOVER_AXIS_VERTICAL)
self._hover.part_content_set(loc, self._table)
self._hover.show()
self._table.show()
self._bg.show()
self._list.show()
def dismiss(self):
self._hover.dismiss()
def _list_selected_cb(self, gl, item):
label, icon, end = item.data
self.text = label
if icon:
self.icon = SafeIcon(self, icon)
item.selected = False
self.dismiss()
if callable(self._selected_func):
self._selected_func(self)
def _gl_text_get(self, gl, part, item_data):
label, icon, end = item_data
return label
def _gl_content_get(self, gl, part, item_data):
label, icon, end = item_data
if icon and part == 'elm.swallow.icon':
return SafeIcon(gl, icon)
elif end and part == 'elm.swallow.end':
return SafeIcon(gl, end)