本文整理汇总了Python中efl.elementary.icon.Icon类的典型用法代码示例。如果您正苦于以下问题:Python Icon类的具体用法?Python Icon怎么用?Python Icon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Icon类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
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 = Icon(self, standard='arrow-down')
ic.size_hint_min = 20, 20 # 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
示例2: content_get
def content_get(self, obj, part, data):
checked = data[1]
# "edit" EDC layout is like below. each part is swallow part.
# the existing item is swllowed to elm.swallow.edit.content part.
# --------------------------------------------------------------------
# | elm.edit.icon.1 | elm.swallow.decorate.content | elm.edit.icon,2 |
# --------------------------------------------------------------------
if part == "elm.swallow.end":
ic = Icon(obj, file=os.path.join(img_path, "bubble.png"),
size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
return ic
elif part == "elm.edit.icon.1":
ck = Check(obj, state=checked, propagate_events=False)
ck.show()
return ck
elif part == "elm.edit.icon.2":
icn = Icon(obj, file=os.path.join(img_path, "icon_06.png"),
propagate_events=False,
size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
icn.callback_clicked_add(edit_icon_clicked_cb, data)
return icn
else:
return
示例3: __init__
def __init__(self, parent):
DialogWindow.__init__(self, parent, 'epack-info', 'Epack', autodel=True)
fr = Frame(self, style='pad_large', size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
self.resize_object_add(fr)
fr.show()
hbox = Box(self, horizontal=True, padding=(12,12))
fr.content = hbox
hbox.show()
vbox = Box(self, align=(0.0,0.0), padding=(6,6),
size_hint_weight=EXPAND_VERT, size_hint_align=FILL_VERT)
hbox.pack_end(vbox)
vbox.show()
# icon + version
ic = Icon(self, standard='epack', size_hint_min=(64,64))
vbox.pack_end(ic)
ic.show()
lb = Label(self, text=_('Version: %s') % __version__)
vbox.pack_end(lb)
lb.show()
sep = Separator(self, horizontal=True)
vbox.pack_end(sep)
sep.show()
# buttons
bt = Button(self, text=_('Epack'), size_hint_align=FILL_HORIZ)
bt.callback_clicked_add(lambda b: self.entry.text_set(utils.INFO))
vbox.pack_end(bt)
bt.show()
bt = Button(self, text=_('Website'),size_hint_align=FILL_HORIZ)
bt.callback_clicked_add(lambda b: utils.xdg_open(utils.GITHUB))
vbox.pack_end(bt)
bt.show()
bt = Button(self, text=_('Authors'), size_hint_align=FILL_HORIZ)
bt.callback_clicked_add(lambda b: self.entry.text_set(utils.AUTHORS))
vbox.pack_end(bt)
bt.show()
bt = Button(self, text=_('License'), size_hint_align=FILL_HORIZ)
bt.callback_clicked_add(lambda b: self.entry.text_set(utils.LICENSE))
vbox.pack_end(bt)
bt.show()
# main text
self.entry = Entry(self, editable=False, scrollable=True, text=utils.INFO,
size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
self.entry.callback_anchor_clicked_add(lambda e,i: utils.xdg_open(i.name))
hbox.pack_end(self.entry)
self.entry.show()
self.resize(400, 200)
self.show()
示例4: __init__
def __init__(self, app):
# create the main window
StandardWindow.__init__(self, "eepdater", "eepDater - System Updater",
autodel=True, size=(320, 320))
self.callback_delete_request_add(lambda o: elementary.exit())
self.app = app
icon = Icon(self)
icon.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND)
icon.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL)
icon.standard_set('software-center')
icon.show()
self.icon_object_set(icon.object_get())
# build the two main boxes
self.mainBox = self.buildMainBox()
self.loadBox = self.buildLoadBox()
# build the information details inwin object
self.buildDetailsWin()
# the flip object has the load screen on one side and the GUI on the other
self.flip = Flip(self, size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
self.flip.part_content_set("front", self.mainBox)
self.flip.part_content_set("back", self.loadBox)
self.resize_object_add(self.flip)
self.flip.show()
# show the window
self.show()
示例5: grid_icons_get
def grid_icons_get(grid):
# Start icons animation before actually drag-starts
xposret, yposret = 0, 0
icons = []
xm, ym = grid.evas.pointer_canvas_xy
items = list(grid.selected_items)
print(items)
gli, xposret, yposret = grid.at_xy_item_get(xm, ym)
if gli is not None:
# Add the item mouse is over to the list if NOT seleced
if not gli in items:
items.append(gli)
print(items)
for gli in items:
# Now add icons to animation window
o = gli.part_content_get("elm.swallow.icon")
if o is not None:
ic = Icon(grid, file=o.file, pos=o.pos, size=o.size,
size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
ic.show()
icons.append(ic)
return icons
示例6: content_get
def content_get(self, obj, part, data, *args):
if part == "elm.swallow.icon":
icon = Icon(obj, file=os.path.join(img_path, data),
size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
icon.show()
return icon
return None
示例7: gl_createicon
def gl_createicon(win, xoff, yoff, data):
it = data
o = it.part_content_get("elm.swallow.icon")
if o is None:
return
w = h = 30
f, g = o.file
xm, ym = o.evas.pointer_canvas_xy
if xoff is not None:
xoff = xm - (w/2)
if yoff is not None:
yoff = ym - (h/2)
icon = Icon(win, file=(f, g), size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
if (xoff is not None) and (yoff is not None):
icon.move(xoff, yoff)
icon.resize(w, h)
return icon, xoff, yoff
示例8: gl_icons_get
def gl_icons_get(gl):
# Start icons animation before actually drag-starts
yposret = 0
icons = []
xm, ym = gl.evas.pointer_canvas_xy
items = list(gl.selected_items)
gli, yposret = gl.at_xy_item_get(xm, ym)
if gli is not None:
# Add the item mouse is over to the list if NOT seleced
if not gli in items:
items.append(gli)
for it in items:
# Now add icons to animation window
o = it.part_content_get("elm.swallow.icon")
if o is not None:
f, g = o.file
x, y, w, h = o.geometry
ic = Icon(gl, file=(f, g), size_hint_align=FILL_BOTH,
size_hint_weight=EXPAND_BOTH, pos=(x,y), size=(w,h))
ic.show()
icons.append(ic)
return icons
示例9: gl_anim_start
def gl_anim_start(anim_st):
# Start icons animation before actually drag-starts
yposret = 0
items = list(anim_st.gl.selected_items)
gli, yposret = anim_st.gl.at_xy_item_get(anim_st.mdx, anim_st.mdy)
if gli is not None:
# Add the item mouse is over to the list if NOT seleced
if not gli in items:
items.append(gli)
for gli in items:
# Now add icons to animation window
o = gli.part_content_get("elm.swallow.icon")
if o is not None:
st = AnimIconSt()
ic = Icon(anim_st.gl, file=o.file, size_hint_align=FILL_BOTH,
size_hint_weight=EXPAND_BOTH, pos=o.pos, size=o.size)
st.start_x, st.start_y = o.pos
ic.show()
st.o = ic
anim_st.icons.append(st)
anim_st.tm = None
anim_st.ea = AnimatorTimeline(drag_anim_play, DRAG_TIMEOUT,
anim_st)
return ECORE_CALLBACK_CANCEL
示例10: addTab
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)
示例11: content_get
def content_get(self, gg, part, data):
if not part == "elm.swallow.icon":
ic = Icon(gg, scale=0.5,
file=os.path.join(img_path, "icon_%02i.png" % (data % 4)),
resizable=(0, 0), size_hint_weight=EXPAND_BOTH,
size_hint_align=(0.5, 0.5))
ic.show()
return ic
示例12: __init__
def __init__(self, ourParent, ourText, ourIcon=None, ourCB=None, *args, **kwargs):
Button.__init__(self, ourParent, *args, **kwargs)
icon = Icon(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
icon.standard_set(ourIcon)
icon.show()
self.text = ourText
self.content_set(icon)
self.callback_clicked_add(ourCB)
示例13: fileExists
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()
示例14: __init__
def __init__(self, parent, icon_name, **kargs):
Icon.__init__(self, parent, **kargs)
if icon_name.startswith('git-'):
self.file = (theme_file_get(), 'elm/icon/%s/default' % icon_name)
else:
try:
self.standard = icon_name
except RuntimeWarning:
print("ERROR: Cannot find icon: '%s'" % icon_name)
示例15: buttons_clicked
def buttons_clicked(obj):
win = StandardWindow("buttons", "Buttons", focus_highlight_enabled=True,
autodel=True)
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
bx = Box(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(bx)
bx.show()
ic = Icon(win, file=ic_file,
size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
ic.show()
bt = Button(win, text="Icon sized to button", content=ic)
bx.pack_end(bt)
bt.show()
ic = Icon(win, file=ic_file, resizable=(False, False))
ic.show()
bt = Button(win, text="Icon no scale", content=ic)
bx.pack_end(bt)
bt.show()
bt = Button(win, text="No icon")
bx.pack_end(bt)
bt.show()
ic = Icon(win, file=ic_file, resizable=(False, False))
bt = Button(win, content=ic)
bx.pack_end(bt)
bt.show()
ic.show()
win.show()