本文整理汇总了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
示例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
示例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()
示例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