本文整理汇总了Python中pyjamas.ui.HorizontalPanel.HorizontalPanel.remove方法的典型用法代码示例。如果您正苦于以下问题:Python HorizontalPanel.remove方法的具体用法?Python HorizontalPanel.remove怎么用?Python HorizontalPanel.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.HorizontalPanel.HorizontalPanel
的用法示例。
在下文中一共展示了HorizontalPanel.remove方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_canvas
# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import remove [as 别名]
class GWTCanvasDemo:
# can be overriden to use another canvas class
def _get_canvas(self):
return GWTCanvas(400,400)
def onModuleLoad(self):
self.layout = HorizontalPanel()
# Each demo will set their own dimensions, so it doesn't matter
# what we initialize the canvas to. Use the overrideable.
canvas = self._get_canvas()
canvas.addStyleName("gwt-canvas")
self.demos = []
# Create demos
self.demos.append(StaticDemo(canvas))
self.demos.append(LogoDemo(canvas))
self.demos.append(ParticleDemo(canvas))
self.demos.append(GradientDemo(canvas))
self.demos.append(SuiteDemo(canvas))
# Add them to the selection list box
lb = ListBox()
lb.setStyleName("listBox")
for i in range(len(self.demos)):
lb.addItem(self.demos[i].getName())
lb.addChangeListener(self)
# start off with the first demo
self.currentDemo = self.demos[0]
# Add widgets to self.layout and RootPanel
vp = VerticalPanel()
vp.add(lb)
vp.add(canvas)
self.layout.add(vp)
if self.currentDemo.getControls() is not None:
self.layout.add(self.currentDemo.getControls())
RootPanel().add(self.layout)
self.currentDemo.drawDemo()
def onChange(self, listBox):
choice = listBox.getSelectedIndex()
self.swapDemo(self.demos[choice])
"""
* Changes the current demo for the input demo
"""
def swapDemo(self, newDemo):
self.currentDemo.stopDemo()
self.layout.remove(self.currentDemo.getControls())
self.currentDemo = newDemo
self.layout.add(self.currentDemo.getControls())
self.currentDemo.drawDemo()
示例2: TabBar
# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import remove [as 别名]
#.........这里部分代码省略.........
clickable).
"""
if beforeIndex is None:
beforeIndex = asHTML
asHTML = False
if (beforeIndex < 0) or (beforeIndex > self.getTabCount()):
#throw new IndexOutOfBoundsException();
pass
if text is None:
text = HTML(" ", True)
text.setWidth("100%")
text.setStyleName("gwt-TabBarRest")
self.panel.insert(text, beforeIndex + 1)
self.panel.setCellWidth(text, "100%")
return
istext = isinstance(text, basestring)
if istext:
if asHTML:
item = HTML(text)
else:
item = Label(text)
item.setWordWrap(False)
else:
# passing in a widget, it's expected to have its own style
item = text
self.insertTabWidget(item, beforeIndex)
def insertTabWidget(self, widget, beforeIndex):
delWidget = ClickDelegatePanel(self, widget, self, self)
delWidget.setStyleName(self.STYLENAME_DEFAULT)
focusablePanel = delWidget.getFocusablePanel()
self.panel.insert(delWidget, beforeIndex + 1)
self.setStyleName(DOM.getParent(delWidget.getElement()),
self.STYLENAME_DEFAULT + "-wrapper", True)
#print "insertTabWidget", DOM.getParent(delWidget.getElement()), DOM.getAttribute(DOM.getParent(delWidget.getElement()), "className")
def onClick(self, sender=None):
for i in range(1, self.panel.getWidgetCount() - 1):
if DOM.isOrHasChild(self.panel.getWidget(i).getElement(),
sender.getElement()):
return self.selectTab(i - 1)
return False
def removeTab(self, index):
self.checkTabIndex(index)
toRemove = self.panel.getWidget(index + 1)
if toRemove == self.selectedTab:
self.selectedTab = None
self.panel.remove(toRemove)
def removeTabListener(self, listener):
self.tabListeners.remove(listener)
def selectTab(self, index):
self.checkTabIndex(index)
for listener in self.tabListeners:
if not listener.onBeforeTabSelected(self, index):
return False
self.setSelectionStyle(self.selectedTab, False)
if index == -1:
self.selectedTab = None
return True
self.selectedTab = self.panel.getWidget(index + 1)
self.setSelectionStyle(self.selectedTab, True)
for listener in self.tabListeners:
listener.onTabSelected(self, index)
return True
def checkTabIndex(self, index):
if (index < -1) or (index >= self.getTabCount()):
#throw new IndexOutOfBoundsException();
pass
def setSelectionStyle(self, item, selected):
if item is not None:
if selected:
item.addStyleName("gwt-TabBarItem-selected")
self.setStyleName(DOM.getParent(item.getElement()),
"gwt-TabBarItem-wrapper-selected", True)
else:
item.removeStyleName("gwt-TabBarItem-selected")
self.setStyleName(DOM.getParent(item.getElement()),
"gwt-TabBarItem-wrapper-selected", False)
示例3: onModuleLoad
# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import remove [as 别名]
class InfoDirectory:
def onModuleLoad(self):
self.remote = InfoServicePython()
self.tree_width = 200
self.tp = HorizontalPanel()
self.tp.setWidth("%dpx" % (self.tree_width))
self.treeview = Trees()
self.treeview.fTree.addTreeListener(self)
self.sp = ScrollPanel()
self.tp.add(self.treeview)
self.sp.add(self.tp)
self.sp.setHeight("100%")
self.horzpanel1 = HorizontalPanel()
self.horzpanel1.setSize("100%", "100%")
self.horzpanel1.setBorderWidth(1)
self.horzpanel1.setSpacing("10px")
self.rp = RightPanel()
self.rps = ScrollPanel()
self.rps.add(self.rp)
self.rps.setWidth("100%")
self.rp.setWidth("100%")
self.cp1 = CollapserPanel(self)
self.cp1.setWidget(self.sp)
self.cp1.setHTML(" ")
self.midpanel = MidPanel(self)
self.cp2 = CollapserPanel(self)
self.cp2.setWidget(self.midpanel)
self.cp2.setHTML(" ")
self.horzpanel1.add(self.cp1)
self.horzpanel1.add(self.cp2)
self.horzpanel1.add(self.rps)
self.cp1.setInitialWidth("%dpx" % self.tree_width)
self.cp2.setInitialWidth("200px")
RootPanel().add(self.horzpanel1)
width = Window.getClientWidth()
height = Window.getClientHeight()
self.onWindowResized(width, height)
Window.addWindowResizeListener(self)
def setCollapserWidth(self, widget, width):
self.horzpanel1.setCellWidth(widget, width)
def onWindowResized(self, width, height):
#self.hp.setWidth("%dpx" % (width - self.tree_width))
#self.hp.setHeight("%dpx" % (height - 20))
self.cp1.setHeight("%dpx" % (height - 30))
self.cp2.setHeight("%dpx" % (height - 30))
self.rps.setHeight("%dpx" % (height - 30))
self.horzpanel1.setHeight("%dpx" % (height - 20))
def onTreeItemStateChanged(self, item):
if item.isSelected():
self.onTreeItemSelected(item)
def onTreeItemSelected(self, item):
obj = item.getUserObject()
if len(obj.children) != 0:
self.clear_mid_panel()
return
self.remote.get_midpanel_data(obj.root + "/" + obj.text, self)
self.cp2.setHTML(obj.text)
self.clear_right_panel()
def clear_right_panel(self):
self.horzpanel1.remove(2)
self.horzpanel1.insert(HTML(""), 2)
self.rp.setTitle(" ")
def clear_mid_panel(self):
self.clear_right_panel()
#self.horzpanel2.setLeftWidget(HTML(""))
def set_mid_panel(self, response):
self.midpanel.set_items(response)
self.cp2.setWidget(self.midpanel)
def select_right_grid(self, location, name):
self.horzpanel1.remove(2)
self.horzpanel1.insert(self.rps, 2)
self.rp.setTitle(name)
self.remote.get_rightpanel_datanames(location, self)
#.........这里部分代码省略.........
示例4: __init__
# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import remove [as 别名]
class SongFrequency:
def __init__(self):
self.artist =''
self.start_date = ''
self.end_date = ''
self.period_search =''
self.search_option = 1
#declare the general interface widgets
self.panel = DockPanel(StyleName = 'background')
self.ret_area = TextArea()
self.ret_area.setWidth("350px")
self.ret_area.setHeight("90px")
self.options = ListBox()
self.search_button = Button("Search", getattr(self, "get_result"), StyleName = 'button')
#set up the date search panel; it has different text boxes for
#to and from search dates
self.date_search_panel = VerticalPanel()
self.date_search_start = TextBox()
self.date_search_start.addInputListener(self)
self.date_search_end = TextBox()
self.date_search_end.addInputListener(self)
self.date_search_panel.add(HTML("Enter as month/day/year", True, StyleName = 'text'))
self.date_search_panel.add(HTML("From:", True, StyleName = 'text'))
self.date_search_panel.add(self.date_search_start)
self.date_search_panel.add(HTML("To:", True, StyleName = 'text'))
self.date_search_panel.add(self.date_search_end)
#set up the artist search panel
self.artist_search = TextBox()
self.artist_search.addInputListener(self)
self.artist_search_panel = VerticalPanel()
self.artist_search_panel.add(HTML("Enter artist's name:",True,
StyleName = 'text'))
self.artist_search_panel.add(self.artist_search)
#Put together the list timespan search options
self.period_search_panel = VerticalPanel()
self.period_search_panel.add(HTML("Select a seach period:",True,
StyleName = 'text'))
self.period_search = ListBox()
self.period_search.setVisibleItemCount(1)
self.period_search.addItem("last week")
self.period_search.addItem("last month")
self.period_search.addItem("last year")
self.period_search.addItem("all time")
self.period_search_panel.add(self.period_search)
#add the listeners to the appropriate widgets
self.options.addChangeListener(self)
self.period_search.addChangeListener(self)
self.ret_area_scroll = ScrollPanel()
self.search_panel = HorizontalPanel()
self.options_panel = VerticalPanel()
# A change listener for the boxes
def onChange(self, sender):
#switch the list box options
if sender == self.options:
self.search_panel.remove(self.period_search_panel)
self.search_panel.remove(self.date_search_panel)
self.search_panel.remove(self.artist_search_panel)
index = self.options.getSelectedIndex()
if index == 0:
self.search_panel.add(self.artist_search_panel)
self.search_option = 1
elif index == 1:
self.search_panel.add(self.date_search_panel)
self.search_option = 2
elif index == 2:
self.search_panel.add(self.period_search_panel)
self.search_option = 3
elif sender == self.period_search:
index = self.period_search.getSelectedIndex()
if index == 0:
self.period_search = "last week"
elif index == 1:
self.period_search = "last month"
elif index == 2:
self.period_search = "last year"
elif index == 3:
self.period_search = "all time"
#A listener for the text boxes
def onInput(self, sender):
if sender == self.artist_search:
self.artist = sender.getText()
elif sender == self.date_search_end:
self.end_date = sender.getText()
elif sender == self.date_search_start:
self.start_date = sender.getText()
#A listener for the buttons that, when the button is clicked, looks up the results and outputs them
def get_result(self):
return_str = " "
if self.search_option == 1:
#.........这里部分代码省略.........