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


Python VerticalPanel.getWidget方法代码示例

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


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

示例1: SinkList

# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import getWidget [as 别名]
class SinkList(Composite):
    def __init__(self):
        Composite.__init__(self)
        self.vp_list=VerticalPanel()
        self.sinks=[]
        self.selectedSink=-1
        
        self.initWidget(self.vp_list)
        self.setStyleName("ks-List")

    def addSink(self, info):
        name = info.getName()
        link = Hyperlink(name, False, TargetHistoryToken=name)
        link.setStyleName("ks-SinkItem")
        self.vp_list.add(link)
        self.sinks.append(info)

    def find(self, sinkName):
        for info in self.sinks:
            if info.getName()==sinkName:
                return info
        return None

    def setSinkSelection(self, name):
        if self.selectedSink <> -1:
            self.vp_list.getWidget(self.selectedSink).removeStyleName("ks-SinkItem-selected")

        for i in range(len(self.sinks)):
            info = self.sinks[i]
            if (info.getName()==name):
                self.selectedSink = i
                widget=self.vp_list.getWidget(self.selectedSink)
                widget.addStyleName("ks-SinkItem-selected")
                return
开发者ID:anandology,项目名称:pyjamas,代码行数:36,代码来源:SinkList.py

示例2: AlgorithmList

# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import getWidget [as 别名]
class AlgorithmList(Composite):
    def __init__(self):
        Composite.__init__(self)

        self.vp_list=VerticalPanel()
        self.Algorithms=[]
        self.selectedAlgorithm=-1
        
        self.initWidget(self.vp_list)
        self.setStyleName("ks-List")

    def addAlgorithm(self, info):
        name = info.getName()
        link = Hyperlink(name, False, TargetHistoryToken=name)
        link.setStyleName("ks-AlgorithmItem")
        self.vp_list.add(link)
        self.Algorithms.append(info)

    def find(self, AlgorithmName):
        for info in self.Algorithms:
            if info.getName()==AlgorithmName:
                return info
        return None

    def setAlgorithmSelection(self, name):
        if self.selectedAlgorithm <> -1:
            self.vp_list.getWidget(self.selectedAlgorithm).removeStyleName("ks-AlgorithmItem-selected")

        for i in range(len(self.Algorithms)):
            info = self.Algorithms[i]
            if (info.getName()==name):
                self.selectedAlgorithm = i
                widget=self.vp_list.getWidget(self.selectedAlgorithm)
                widget.addStyleName("ks-AlgorithmItem-selected")
                return
开发者ID:aprovodi,项目名称:mlServerCalculations,代码行数:37,代码来源:AlgorithmList.py

示例3: LoggerPanel

# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import getWidget [as 别名]
class LoggerPanel(DisclosurePanel):
    def __init__(self, maxhistory=100, maxloglinelength=200, headerStyleName=None, panelStyleName=None,
                 buttonStyleName=None, labelStyleName=None):
        super(LoggerPanel, self).__init__(self, header='BLAH', isOpen=False)
        self.labelStyleName = labelStyleName
        self.maxhistory = maxhistory
        self.maxloglinelength = maxloglinelength

        self.getHeader().setStyleName(headerStyleName)
        self.logpanel = VerticalPanel(StyleName=panelStyleName)
        self.setContent(self.logpanel)

        self.clearbutton = Button('Clear', listener=self.clear, StyleName=buttonStyleName)
        self.logpanel.add(self.clearbutton)
        self.updateHeaderText()
    def log(self, string):
        self.logpanel.add(Label(string[:self.maxloglinelength], StyleName=self.labelStyleName))
        widgcnt = self.logpanel.getWidgetCount()
        if widgcnt > self.maxhistory:
            for i in range(0, widgcnt - self.maxhistory):
                self.logpanel.remove(self.logpanel.getWidget(i))
        self.updateHeaderText()
    def __call__(self, string):
        self.log(string)
        return
    def updateHeaderText(self):
        self.getHeader().setText('Logging: %s items' % (self.logpanel.getWidgetCount() - 1))
    def clear(self):
        self.logpanel.clear()
        self.logpanel.add(self.clearbutton)
        self.updateHeaderText()
开发者ID:satyam07,项目名称:taoggregator,代码行数:33,代码来源:commoncontrols.py

示例4: SinkList

# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import getWidget [as 别名]
class SinkList(Composite):
    def __init__(self):
        Composite.__init__(self)

        self.vp_list=VerticalPanel()
        self.sinks=[]
        self.selectedSink=-1
        
        self.sp = ScrollPanel(self.vp_list)
        self.sp.setWidth("14em")

        self.initWidget(self.sp)
        self.setStyleName("ks-List")

        self.resize(Window.getClientWidth(), Window.getClientHeight())

    def resize(self, width, height):
        self.sp.setHeight("%dpx" % (height - 70))

    def addSink(self, info):
        name = info.getName()
        link = Hyperlink(name, False, name)
        link.setStyleName("ks-SinkItem")
        self.vp_list.add(link)
        self.sinks.append(info)

    def find(self, sinkName):
        for info in self.sinks:
            if info.getName()==sinkName:
                return info
        return None

    def setSinkSelection(self, name):
        if self.selectedSink <> -1:
            self.vp_list.getWidget(self.selectedSink).removeStyleName("ks-SinkItem-selected")

        for i in range(len(self.sinks)):
            info = self.sinks[i]
            if (info.getName()==name):
                self.selectedSink = i
                widget=self.vp_list.getWidget(self.selectedSink)
                widget.addStyleName("ks-SinkItem-selected")
                return
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:45,代码来源:SinkList.py


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