本文整理汇总了Python中efl.elementary.frame.Frame.text_set方法的典型用法代码示例。如果您正苦于以下问题:Python Frame.text_set方法的具体用法?Python Frame.text_set怎么用?Python Frame.text_set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类efl.elementary.frame.Frame
的用法示例。
在下文中一共展示了Frame.text_set方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Application
# 需要导入模块: from efl.elementary.frame import Frame [as 别名]
# 或者: from efl.elementary.frame.Frame import text_set [as 别名]
class Application(object):
def __init__(self):
self.cfg = ConfigOption()
self.userid = os.getuid()
self.win = None
self.bg = None
self.main_box = None
self.info_frame = None
self.lb = None
self.ps_list = None
self.win = StandardWindow("my app", "eyekill", size=(320, 384))
self.win.title_set("eye kill")
self.win.callback_delete_request_add(self.destroy)
self.main_box = Box(self.win)
self.main_box.size_hint_weight = EXPAND_BOTH
self.win.resize_object_add(self.main_box)
self.main_box.show()
self.info_frame = Frame(self.win)
self.info_frame.text_set("Information")
self.main_box.pack_end(self.info_frame)
self.info_frame.show()
self.lb = Label(self.win)
self.lb.text_set('<b>Kill process with a double click</b>')
self.info_frame.content_set(self.lb)
self.lb.show()
self.ps_list = List(self.win)
self.ps_list.size_hint_weight = EXPAND_BOTH
self.ps_list.size_hint_align = FILL_BOTH
self.ps_list.callback_clicked_double_add(self.kill_bill)
self.update_list()
self.main_box.pack_end(self.ps_list)
self.ps_list.go()
self.ps_list.show()
self.win.resize(320, 384)
self.win.show()
def destroy(self, obj):
# FIXME: but here self.cfg.save()???
elementary.exit()
def update_list(self):
if bool(self.cfg.get_desktop()):
for de in self.cfg.get_desktop():
ps = psutil.Process(get_pid_by_name(de))
pl = ps.children()
for p in pl:
if p.uids().real == self.userid:
if p.name not in self.cfg.get_process():
short_info = '%s / %s / %s' % (p.pid, p.name(), p.status())
self.ps_list.item_append(label = short_info, callback = self.update_info, p = p)
else:
pl = psutil.get_pid_list()
for p in pl:
p = psutil.Process(p)
if p.uids().real == self.userid:
if p.name() not in self.cfg.get_process():
short_info = '%s / %s / %s' % (p.pid, p.name(), p.status())
self.ps_list.item_append(label = short_info, callback = self.update_info, p = p)
def update_info(self,li , it, p):
info = ("PID %i STAT %s TIME %s<br/>MEM %s CPU %s COMMAND %s" % \
(p.pid,\
p.status(),\
p.get_cpu_times().user,\
hbytes(p.get_memory_info().rss),\
p.get_cpu_percent(interval=0),\
p.name()))
self.lb.text_set(info)
def kill_bill(self, obj, cb_data):
bill = cb_data.data_get()[1]['p'].pid
print ("%s ... Gotcha" % bill)
os.kill(bill, signal.SIGTERM)
if (os.kill(bill, 0)):
os.kill(bill, signal.SIGKILL)
item = obj.selected_item_get()
item.disabled_set(True)