当前位置: 首页>>代码示例>>Python>>正文


Python Frame.content_set方法代码示例

本文整理汇总了Python中efl.elementary.frame.Frame.content_set方法的典型用法代码示例。如果您正苦于以下问题:Python Frame.content_set方法的具体用法?Python Frame.content_set怎么用?Python Frame.content_set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在efl.elementary.frame.Frame的用法示例。


在下文中一共展示了Frame.content_set方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: menu_create

# 需要导入模块: from efl.elementary.frame import Frame [as 别名]
# 或者: from efl.elementary.frame.Frame import content_set [as 别名]
def menu_create(search, win):
    tbx.clear()
    for category in items:
        frame = Frame(win, size_hint_weight=EXPAND_BOTH,
            size_hint_align=FILL_BOTH, text=category[0])
        frame.show()
        tbx.pack_end(frame)

        tbx2 = Box(win, layout=ELM_BOX_LAYOUT_FLOW_HORIZONTAL,
            size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
            size_hint_align=(EVAS_HINT_FILL, 0.0))
        frame.content_set(tbx2)
        tbx2.show()

        cnt = 0
        for test in category[1]:
            if (search == None) or (test[0].lower().find(search.lower()) > -1):
                bt = Button(win, text=test[0])
                bt.callback_clicked_add(selected_cb, test[1], test[2])
                bt.show()
                tbx2.pack_end(bt)
                cnt += 1

        if cnt < 1:
            frame.delete()
开发者ID:maikodaraine,项目名称:EnlightenmentUbuntu,代码行数:27,代码来源:test.py

示例2: __init__

# 需要导入模块: from efl.elementary.frame import Frame [as 别名]
# 或者: from efl.elementary.frame.Frame import content_set [as 别名]

#.........这里部分代码省略.........
                except:
                    iconObj = Icon(self, standard="preferences-system", size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
                    icon = None
                
                if fileName in startupApplications:
                    startupToAdd.append([name, iconObj, fileName, icon])
                else:
                    applicationsToAdd.append([name, iconObj, fileName, icon])
        
        startupToAdd.sort()
        applicationsToAdd.sort()
        
        for s in startupToAdd:
            ourItem = startupList.item_append(s[0], s[1])
            ourItem.data["file"] = s[2]
            ourItem.data["icon"] = s[3]
            #ourItem.append_to(startupList)
            #startupList.item_append(ourItem)
        
        for a in applicationsToAdd:
            ourItem = applicationsList.item_append(a[0], a[1])
            ourItem.data["file"] = a[2]
            ourItem.data["icon"] = a[3]
            #ourItem.append_to(applicationsList.ourList)
            #applicationsList.item_append(a[0], a[1])
        
        startupList.callback_clicked_double_add(self.startupAppRemove)
        applicationsList.callback_clicked_double_add(self.startupAppAdd)
        
        startupList.go()
        startupList.show()
        applicationsList.show()
        
        startupFrame = Frame(self, size_hint_weight = EXPAND_BOTH, size_hint_align=FILL_BOTH)
        startupFrame.text = "Startup Applications"
        startupFrame.content_set(startupList)
        startupFrame.show()
        
        otherFrame = Frame(self, size_hint_weight = EXPAND_BOTH, size_hint_align=FILL_BOTH)
        otherFrame.text = "Other Applications"
        otherFrame.content_set(applicationsList)
        otherFrame.show()
        
        self.mainBox.pack_end(startupFrame)
        self.mainBox.pack_end(otherFrame)
        
        self.backBox = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        self.backBox.show()
        
        self.commandsList = commandsList = List(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        
        with open(StartupCommandsFile) as scf:
            for line in scf:
                if line.rstrip()[-3:] == "| \\":
                    commandsList.item_append(line.rstrip()[:-3])
                else:
                    commandsList.item_append(line.rstrip())
                
        commandsList.callback_clicked_right_add(self.commandRightClicked)
        
        commandsList.go()
        commandsList.show()
        
        commandBox = Box(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=(1, 0.5))
        commandBox.horizontal = True
        commandBox.show()
        
        self.newCommandEntry = newCommandEntry = Entry(self, size_hint_weight = EXPAND_HORIZ, size_hint_align = FILL_BOTH)
        newCommandEntry.single_line = True
        newCommandEntry.text = "<i>Type command here</i>"
        newCommandEntry.data["default text"] = True
        newCommandEntry.callback_clicked_add(self.entryClicked)
        newCommandEntry.show()
        
        newCommandButton = StandardButton(self, "Add Command", "add", self.newCmdPressed)
        newCommandButton.show()
        
        delCommandButton = StandardButton(self, "Delete Command", "exit", self.delCmdPressed)
        delCommandButton.show()
        
        commandBox.pack_end(newCommandButton)
        commandBox.pack_end(delCommandButton)
        
        newCommandFrame = Frame(self, size_hint_weight = EXPAND_HORIZ, size_hint_align = FILL_BOTH)
        newCommandFrame.text = "Add Startup Command:"
        newCommandFrame.content_set(newCommandEntry)
        newCommandFrame.show()
        
        self.backBox.pack_end(commandsList)
        self.backBox.pack_end(newCommandFrame)
        self.backBox.pack_end(commandBox)
        
        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.backBox)
        self.flip.show()
        
        self.pack_end(self.flip)
        self.pack_end(buttonBox)
开发者ID:JeffHoogland,项目名称:bodhi4packages,代码行数:104,代码来源:swami_startupapps.py

示例3: Application

# 需要导入模块: from efl.elementary.frame import Frame [as 别名]
# 或者: from efl.elementary.frame.Frame import content_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)
开发者ID:wfx,项目名称:eyekill,代码行数:92,代码来源:eyekill.py


注:本文中的efl.elementary.frame.Frame.content_set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。