本文整理汇总了Python中pyjamas.ui.DockPanel.DockPanel.add方法的典型用法代码示例。如果您正苦于以下问题:Python DockPanel.add方法的具体用法?Python DockPanel.add怎么用?Python DockPanel.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.DockPanel.DockPanel
的用法示例。
在下文中一共展示了DockPanel.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import add [as 别名]
def __init__(self):
Sink.__init__(self)
self.curImage=0
self.image=Image()
self.loadingImage = Image(self.baseURL() + "images/blanksearching.gif")
self.nextButton = Image(self.baseURL() + "rembrandt/forward.gif")
self.prevButton = Image(self.baseURL() + "rembrandt/back.gif")
self.sImages=["rembrandt/JohannesElison.jpg", "rembrandt/LaMarcheNocturne.jpg", "rembrandt/SelfPortrait1628.jpg", "rembrandt/SelfPortrait1640.jpg", "rembrandt/TheArtistInHisStudio.jpg", "rembrandt/TheReturnOfTheProdigalSon.jpg"]
for i in range(len(self.sImages)):
self.sImages[i]=self.baseURL() + self.sImages[i]
self.image.addLoadListener(self)
self.prevButton.addClickListener(self)
self.nextButton.addClickListener(self)
topPanel = DockPanel()
topPanel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
topPanel.add(self.prevButton, DockPanel.WEST)
topPanel.add(self.nextButton, DockPanel.EAST)
topPanel.add(self.loadingImage, DockPanel.CENTER)
panel = VerticalPanel()
panel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER)
panel.add(HTML("<h2>A Bit of Rembrandt</h2>", True))
panel.add(topPanel)
panel.add(self.image)
panel.setWidth("100%")
self.initWidget(panel)
self.image.setStyleName("ks-images-Image")
self.nextButton.setStyleName("ks-images-Button")
self.prevButton.setStyleName("ks-images-Button")
self.loadImage(0)
示例2: DisplayPanel
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import add [as 别名]
class DisplayPanel(Composite):
def __init__(self, owner):
Composite.__init__(self)
self.owner = owner
self.bar = DockPanel()
self.timer_msg = HTML(" timer: ")
self.timer = TimeDisplay()
self.timer_panel = HorizontalPanel()
self.timer_panel.add(self.timer_msg)
self.timer_panel.add(self.timer)
self.counter_msg = HTML(" total moves: ")
self.counter = HTML("0")
self.counter_panel = HorizontalPanel()
self.counter_panel.add(self.counter_msg)
self.counter_panel.add(self.counter)
self.initWidget(self.bar)
self.bar.add(self.timer_panel, DockPanel.WEST)
self.bar.add(self.counter_panel, DockPanel.EAST)
self.setStyleName("Puzzle-DisplayPanel")
def incrCount(self):
count = self.counter.getText()
count = int(count) + 1
self.counter.setText(count)
def reset(self):
self.timer.setDisplay(0, 0, 0)
self.counter.setText("0")
示例3: HelpAboutDlg
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import add [as 别名]
class HelpAboutDlg(DialogBox):
def __init__(self, left = 50, top = 50):
try:
DialogBox.__init__(self, modal = False)
self.setPopupPosition(left, top)
self.dockPanel = DockPanel()
self.dockPanel.setSpacing(4)
self.setText("About")
msg = HTML("""\
This is an example application, which uses PureMVC<br/>
<br/>
""", True)
self.dockPanel.add(msg, DockPanel.CENTER)
self.closeBtn = Button("Close", self)
self.dockPanel.add(self.closeBtn, DockPanel.SOUTH)
self.setWidget(self.dockPanel)
except:
raise
def onClick(self, sender):
self.hide()
示例4: onModuleLoad
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import add [as 别名]
def onModuleLoad(self):
dock = DockPanel(Width="100%")
self.header = HTML(Width="100%", Height="220px")
self.footer = HTML(Width="100%")
self.sidebar = HTML(Width="200px", Height="100%", StyleName="sidebar")
self.fTabs = DecoratedTabPanel(Size=("100%", "100%"), StyleName="tabs")
#dp = DecoratorTitledPanel("Tabs", "bluetitle", "bluetitleicon",
# ["bluetop", "bluetop2", "bluemiddle", "bluebottom"])
#dp.add(self.fTabs)
dock.add(self.header, DockPanel.NORTH)
dock.add(self.footer, DockPanel.SOUTH)
dock.add(self.sidebar, DockPanel.EAST)
dock.add(self.fTabs, DockPanel.CENTER)
dock.setCellVerticalAlignment(self.fTabs, HasAlignment.ALIGN_TOP)
#dock.setCellHorizontalAlignment(self.fTabs, HasAlignment.ALIGN_CENTER)
dock.setCellWidth(self.header, "100%")
dock.setCellHeight(self.header, "220px")
dock.setCellWidth(self.footer, "100%")
dock.setCellWidth(self.sidebar, "200px")
RootPanel().add(dock)
self.dock = dock
self.loadPageList()
Window.addWindowResizeListener(self)
DeferredCommand.add(self)
示例5: DockPanelTest
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import add [as 别名]
class DockPanelTest(UnitTest1):
def testDockAdd(self):
self.d = DockPanel()
RootPanel('tests').add(self.d)
self.write_test_output('adddockpanel')
if not RootPanel('tests').remove(self.d):
self.fail("DockPanel added but apparently not owned by RootPanel()")
self.write_test_output('removedockpanel')
def testDockAddCentre(self):
self.d = DockPanel()
RootPanel('tests').add(self.d)
l = Label("Hello World (label)", StyleName='teststyle')
self.d.add(l, DockPanel.CENTER)
self.write_test_output('addcentrelabel')
self.d.remove(l)
self.write_test_output('removecentrelabel')
l2 = Label("Hello World 2 (label)", StyleName='teststyle')
self.d.add(l2, DockPanel.CENTER)
self.write_test_output('addcentrelabel2')
if not RootPanel('tests').remove(self.d):
self.fail("DockPanel added but apparently not owned by RootPanel()")
self.write_test_output('removedock')
示例6: onModuleLoad
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import add [as 别名]
class WebApp:
def onModuleLoad(self):
self.remote = DataService()
#Show the initial screen.
initToken = History.getToken()
if initToken and len(initToken):
if initToken == 'admin':
RootPanel().add(WebPageEdit(self))
return
else:
initToken = 'index'
self.dock = DockPanel()
self.dock.setWidth("100%")
self.pages = {}
self.current_page = None
RootPanel().add(self.dock)
History.addHistoryListener(self)
self.onHistoryChanged(initToken)
def createPage(self, ref, html, title):
htp = HTMLLinkPanel(html)
htp.replaceLinks()
htp.setWidth("100%")
self.pages[ref] = htp
def onHistoryChanged(self, token):
#log.debug("onHistoryChanged %s" % token)
if self.pages.has_key(token):
self.setPage(token)
return
self.remote.getPageByName(token, self)
def setPage(self, ref):
htp = self.pages[ref]
if htp == self.current_page:
return
Window.setTitle(htp.title)
if self.current_page:
self.dock.remove(self.current_page)
self.dock.add(htp, DockPanel.CENTER)
self.current_page = htp
def onRemoteResponse(self, response, request_info):
if (request_info.method == 'getPageByName' or
request_info.method == 'getPage'):
item = response[0]
html = item['fields']['text']
token = item['fields']['name']
self.createPage(token, html, token)
self.setPage(token)
def onRemoteError(self, code, message, request_info):
RootPanel().add(HTML("Server Error or Invalid Response: ERROR " + str(code) + " - " + str(message)))
示例7: __init__
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import add [as 别名]
def __init__(self, operations,after,type='rel'):
DialogWindow.__init__(self, modal=True, close=True)
self.formula = Formula([])
self.after=after
left = 100
top = 100
self.ops_with_buttons = [{"op": op, "button": Button(op.name, self)} for op in operations if op.available]
dock = DockPanel()
dock.setSpacing(3)
for owb in self.ops_with_buttons:
dock.add(owb['button'], DockPanel.NORTH)
dock.setWidth("300")
self.image = Image(latex_to_url(self.formula.fill_with_placeholders().to_latex()))
dock.add(self.image, DockPanel.EAST)
dock.setCellHorizontalAlignment(self.image, HasAlignment.ALIGN_TOP)
self.doneButton=Button("Done",self)
self.doneButton.setEnabled(False)
dock.add(self.doneButton,DockPanel.SOUTH)
dock.add(HTML(""),DockPanel.CENTER)
self.setText("opkop")
self.setPopupPosition(left, top)
self.setStyleAttribute("background-color", "#ffffff")
self.setStyleAttribute("color", "blue")
self.setStyleAttribute("border-width", "5px")
self.setStyleAttribute("border-style", "solid")
self.setWidget(dock)
示例8: __init__
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import add [as 别名]
def __init__(self, sink):
SimplePanel.__init__(self)
self.sink = sink
self.caption = HTML()
self.child = None
self.showing = False
self.dragging = False
self.dragStartX = 0
self.dragStartY = 0
self.panel = FlexTable()
self.collapse = Image("./images/cancel.png")
self.collapse.addClickListener(self)
dock = DockPanel()
dock.setSpacing(0)
dock.add(self.collapse, DockPanel.EAST)
dock.add(self.caption, DockPanel.WEST)
dock.setCellHorizontalAlignment(self.collapse, HasAlignment.ALIGN_RIGHT)
dock.setCellVerticalAlignment(self.collapse, HasAlignment.ALIGN_TOP)
dock.setCellHorizontalAlignment(self.caption, HasAlignment.ALIGN_LEFT)
dock.setCellWidth(self.caption, "100%")
dock.setWidth("100%")
dock.setHeight("100%")
self.panel.setWidget(0, 0, dock)
self.panel.setHeight("100%")
self.panel.setWidth("100%")
self.panel.setBorderWidth(0)
self.panel.setCellPadding(0)
self.panel.setCellSpacing(0)
self.panel.getCellFormatter().setHeight(1, 0, "100%")
self.panel.getCellFormatter().setWidth(1, 0, "100%")
self.panel.getCellFormatter().setAlignment(1, 0, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_TOP)
SimplePanel.setWidget(self, self.panel)
self.setStyleName("gwt-DialogBox")
self.caption.setStyleName("Caption")
self.collapse.setStyleName("Close")
dock.setStyleName("Header")
#self.caption.addMouseListener(self)
self.collapsed = False
self.collapsed_width = "15px"
self.uncollapsed_width = "100%"
示例9: DynaTableWidget
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import add [as 别名]
class DynaTableWidget(Composite):
def __init__(self, provider, columns, columnStyles, rowCount):
Composite.__init__(self)
self.acceptor = RowDataAcceptorImpl(self)
self.outer = DockPanel()
self.startRow = 0
self.grid = Grid()
self.navbar = NavBar(self)
self.provider = provider
self.initWidget(self.outer)
self.grid.setStyleName("table")
self.outer.add(self.navbar, DockPanel.NORTH)
self.outer.add(self.grid, DockPanel.CENTER)
self.initTable(columns, columnStyles, rowCount)
self.setStyleName("DynaTable-DynaTableWidget")
def initTable(self, columns, columnStyles, rowCount):
self.grid.resize(rowCount + 1, len(columns))
for i in range(len(columns)):
self.grid.setText(0, i, columns[i])
if columnStyles:
self.grid.cellFormatter.setStyleName(0, i, columnStyles[i] + "header")
def setStatusText(self, text):
self.navbar.status.setText(text)
def clearStatusText(self, text):
self.navbar.status.setHTML(" ")
def refresh(self):
self.navbar.gotoFirst.setEnabled(False)
self.navbar.gotoPrev.setEnabled(False)
self.navbar.gotoNext.setEnabled(False)
self.setStatusText("Please wait...")
self.provider.updateRowData(self.startRow, self.grid.getRowCount() - 1, self.acceptor)
def setRowCount(self, rows):
self.grid.resizeRows(rows)
def getDataRowCount(self):
return self.grid.getRowCount() - 1
示例10: __init__
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import add [as 别名]
def __init__(self, parent = None):
Sink.__init__(self, parent)
self.reduceFiles = []
if True:
HTTPRequest().asyncGet("datadir.xml",
DirDictLoader(self),
)
dock = DockPanel(HorizontalAlignment=HasAlignment.ALIGN_LEFT,
Spacing=10,
Size=("100%","100%"))
self.dock = dock
self.fProto = []
self.fTree = Tree()
self.treePanel = ScrollPanel()
self.treePanel.setSize("100%",
str(
int(
Window.getClientHeight()*.75
)
)+"px")
Window.addWindowResizeListener(self)
self.treePanel.add(self.fTree)
dock.add(self.treePanel, DockPanel.WEST)
#self.treePanel.setBorderWidth(1)
#self.treePanel.setWidth("100%")
prPanel = self.createRightPanel()
dock.add(prPanel,DockPanel.EAST)
dock.setCellWidth(self.treePanel, "50%")
dock.setCellWidth(prPanel, "50%")
for i in range(len(self.fProto)):
self.createItem(self.fProto[i])
self.fTree.addItem(self.fProto[i].item)
self.fTree.addTreeListener(self)
self.initWidget(self.dock)
if False: #self.parent.filexml != None:
DirDictLoader(self).onCompletion(self.parent.filexml)
示例11: __init__
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import add [as 别名]
def __init__(self, identifier, autoHide=None, modal=False, rootpanel=None):
PopupPanel.__init__(self, autoHide, modal, rootpanel)
self.identifier = identifier
self.caption = HTML()
self.child = None
self.showing = False
self.dragging = False
self.dragStartX = 0
self.dragStartY = 0
self.panel = FlexTable()
self.closeButton = Image('cancel.png')
self.closeButton.addClickListener(self)
dock = DockPanel()
dock.setSpacing(0)
dock.add(self.closeButton, DockPanel.EAST)
dock.add(self.caption, DockPanel.WEST)
dock.setCellHorizontalAlignment(self.closeButton,
HasAlignment.ALIGN_RIGHT)
dock.setCellHorizontalAlignment(self.caption, HasAlignment.ALIGN_LEFT)
dock.setCellWidth(self.caption, '100%')
dock.setWidth('100%')
self.panel.setWidget(0, 0, dock)
self.panel.setHeight('100%')
self.panel.setBorderWidth(0)
self.panel.setCellPadding(0)
self.panel.setCellSpacing(0)
self.panel.getCellFormatter().setHeight(1, 0, '100%')
self.panel.getCellFormatter().setWidth(1, 0, '100%')
#self.panel.getCellFormatter().setAlignment(1, 0,
# HasHorizontalAlignment.ALIGN_CENTER,
# HasVerticalAlignment.ALIGN_MIDDLE)
PopupPanel.setWidget(self, self.panel)
self.setStyleName('gwt-DialogBox')
self.caption.setStyleName('Caption')
self.closeButton.setStyleName('Close')
dock.setStyleName('Header')
self.caption.addMouseListener(self)
示例12: __init__
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import add [as 别名]
def __init__(self):
Composite.__init__(self)
panel = DockPanel(HorizontalAlignment=HasAlignment.ALIGN_CENTER,
VerticalAlignment=HasAlignment.ALIGN_MIDDLE)
panel.setWidth("100%")
vp = VerticalPanel()
grid = FlexTable(CellPadding=4, CellSpacing=4)
hp = HorizontalPanel()
handle_n = NextHandle(self)
handle_f = FinishHandle(self)
handle_c = ClearHandle(self)
self.next = Button("Next", handle_n, StyleName='button')
self.finish = Button("Finish!", handle_f, StyleName='button')
self.clear = Button("Clear", handle_c, StyleName='button')
hp.add(self.clear)
hp.add(self.finish)
hp.add(self.next)
hp.setWidth("70%")
vp.add(Label("Content-Based Image Retrieval Using OPF", StyleName='label'))
vp.add(grid)
vp.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT)
vp.add(hp)
cols = 4
for i in range(100):
im = Image('images/cbir/%d.jpg' % random.randint(0, 1000), Size=("200px", "150px"), StyleName='image-cool')
grid.setWidget(int(i/cols), i%cols, im)
panel.add(vp, DockPanel.CENTER)
self.initWidget(panel)
self.status = Label()
vp.add(self.status)
示例13: __init__
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import add [as 别名]
def __init__(self, name, html):
DialogBox.__init__(self)
self.setText(name)
closeButton = Button("Close", self)
htp = HTMLPanel(html)
self.sp = ScrollPanel(htp)
dock = DockPanel()
dock.setSpacing(4)
dock.add(closeButton, DockPanel.SOUTH)
dock.add(self.sp, DockPanel.CENTER)
dock.setCellHorizontalAlignment(closeButton, HasAlignment.ALIGN_RIGHT)
dock.setCellWidth(self.sp, "100%")
dock.setWidth("100%")
self.setWidget(dock)
示例14: PopupFrame
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import add [as 别名]
class PopupFrame(DialogBoxModal):
def __init__(self, identifier, title, iframe):
if modal_popups.has_key(identifier):
return
modal_popups[identifier] = self
DialogBoxModal.__init__(self, identifier)
self.setText(title)
self.iframe = iframe
#closeButton = Button("Close", self)
#msg = HTML("<center>IFRAME:</center>", True)
self.iframe.setStyleName("gwt-DialogFrame")
self.dock = DockPanel()
self.dock.setSpacing(4)
#dock.add(closeButton, DockPanel.SOUTH)
#dock.add(msg, DockPanel.NORTH)
self.dock.add(self.iframe, DockPanel.CENTER)
#dock.setCellHorizontalAlignment(closeButton, HasAlignment.ALIGN_RIGHT)
self.dock.setCellWidth(self.iframe, "100%")
self.dock.setWidth("100%")
#self.iframe.setWidth("320px")
#self.iframe.setHeight("200px")
self.setWidget(self.dock)
def setUrl(self, url):
self.iframe.setUrl(url)
def onClick(self, sender):
self.hide()
def set_width(self, width):
self.iframe.setWidth("%dpx" % width)
def set_height(self, height):
self.iframe.setHeight("%dpx" % height)
示例15: NavBar
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import add [as 别名]
class NavBar(Composite):
def __init__(self, owner):
Composite.__init__(self)
self.owner = owner
self.bar = DockPanel()
self.gotoFirst = Button("<<", self)
self.gotoNext = Button(">", self)
self.gotoPrev = Button("<", self)
self.status = HTML()
self.initWidget(self.bar)
self.bar.setStyleName("navbar")
self.status.setStyleName("status")
buttons = HorizontalPanel()
buttons.add(self.gotoFirst)
buttons.add(self.gotoPrev)
buttons.add(self.gotoNext)
self.bar.add(buttons, DockPanel.EAST)
self.bar.setCellHorizontalAlignment(buttons, HasAlignment.ALIGN_RIGHT)
self.bar.add(self.status, DockPanel.CENTER)
self.bar.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
self.bar.setCellHorizontalAlignment(self.status, HasAlignment.ALIGN_RIGHT)
self.bar.setCellVerticalAlignment(self.status, HasAlignment.ALIGN_MIDDLE)
self.bar.setCellWidth(self.status, "100%")
self.gotoPrev.setEnabled(False)
self.gotoFirst.setEnabled(False)
def onClick(self, sender):
if sender == self.gotoNext:
self.owner.startRow += self.owner.getDataRowCount()
self.owner.refresh()
elif sender == self.gotoPrev:
self.owner.startRow -= self.owner.getDataRowCount()
if self.owner.startRow < 0:
self.owner.startRow = 0
self.owner.refresh()
elif sender == self.gotoFirst:
self.owner.startRow = 0
self.owner.refresh()