本文整理汇总了Python中pyjamas.ui.DockPanel.DockPanel.setCellWidth方法的典型用法代码示例。如果您正苦于以下问题:Python DockPanel.setCellWidth方法的具体用法?Python DockPanel.setCellWidth怎么用?Python DockPanel.setCellWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.DockPanel.DockPanel
的用法示例。
在下文中一共展示了DockPanel.setCellWidth方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setCellWidth [as 别名]
def __init__(self, app):
self.app = app
DialogWindow.__init__(
self, modal=False,
minimize=True, maximize=True, close=True,
)
self.closeButton = Button("Close", self)
self.saveButton = Button("Save", self)
self.setText("Sample DialogWindow with embedded image")
self.msg = HTML("", True)
global _editor_id
_editor_id += 1
editor_id = "editor%d" % _editor_id
#self.ht = HTML("", ID=editor_id)
self.txt = TextArea(Text="", VisibleLines=30, CharacterWidth=80,
ID=editor_id)
dock = DockPanel()
dock.setSpacing(4)
hp = HorizontalPanel(Spacing="5")
hp.add(self.saveButton)
hp.add(self.closeButton)
dock.add(hp, DockPanel.SOUTH)
dock.add(self.msg, DockPanel.NORTH)
dock.add(self.txt, DockPanel.CENTER)
dock.setCellHorizontalAlignment(hp, HasAlignment.ALIGN_RIGHT)
dock.setCellWidth(self.txt, "100%")
dock.setWidth("100%")
self.setWidget(dock)
self.editor_id = editor_id
self.editor_created = False
示例2: __init__
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setCellWidth [as 别名]
def __init__(self, baseURL):
DialogBox.__init__(self, glass=True)
self.setText("Sample DialogBox with embedded Frame")
iframe = Frame(baseURL + "rembrandt/LaMarcheNocturne.html")
closeButton = Button("Close", self)
msg = HTML("<center>This is an example of a standard dialog box component.<br> You can put pretty much anything you like into it,<br>such as the following IFRAME:</center>", True)
dock = DockPanel()
dock.setSpacing(4)
dock.add(closeButton, DockPanel.SOUTH)
dock.add(msg, DockPanel.NORTH)
dock.add(iframe, DockPanel.CENTER)
dock.setCellHorizontalAlignment(closeButton, HasAlignment.ALIGN_RIGHT)
dock.setCellWidth(iframe, "100%")
dock.setWidth("100%")
iframe.setWidth("36em")
iframe.setHeight("20em")
self.setWidget(dock)
# Work around for IE/MSHTML Issue 511
self.initURL = iframe.getUrl()
self.iframe = iframe
示例3: onModuleLoad
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setCellWidth [as 别名]
def onModuleLoad(self):
self.singleton = self
topPanel = TopPanel()
rightPanel = VerticalPanel()
self.mailDetail = MailDetail()
self.shortcuts = Shortcuts()
topPanel.setWidth("100%")
# MailList uses Mail.get() in its constructor, so initialize it after
# 'singleton'.
mailList = MailList(self.singleton)
mailList.setWidth("100%")
# Create the right panel, containing the email list & details.
rightPanel.add(mailList)
rightPanel.add(self.mailDetail)
mailList.setWidth("100%")
self.mailDetail.setWidth("100%")
# Create a dock panel that will contain the menu bar at the top,
# the shortcuts to the left, and the mail list & details taking the rest.
outer = DockPanel()
outer.add(topPanel, DockPanel.NORTH)
outer.add(self.shortcuts, DockPanel.WEST)
outer.add(rightPanel, DockPanel.CENTER)
outer.setWidth("100%")
outer.setSpacing(4)
outer.setCellWidth(rightPanel, "100%")
# Hook the window resize event, so that we can adjust the UI.
#FIXME need implementation # Window.addWindowResizeListener(this)
Window.addWindowResizeListener(self)
# Get rid of scrollbars, and clear out the window's built-in margin,
# because we want to take advantage of the entire client area.
Window.enableScrolling(False)
Window.setMargin("0px")
# Finally, add the outer panel to the RootPanel, so that it will be
# displayed.
#RootPanel.get().add(outer) # FIXME get#
RootPanel().add(outer)
RootPanel().add(Logger())
# Call the window resized handler to get the initial sizes setup. Doing
# this in a deferred command causes it to occur after all widgets' sizes
# have been computed by the browser.
DeferredCommand.add(self)
示例4: __init__
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setCellWidth [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%"
示例5: __init__
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setCellWidth [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)
示例6: __init__
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setCellWidth [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)
示例7: __init__
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setCellWidth [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)
示例8: NavBar
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setCellWidth [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()
示例9: PopupFrame
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setCellWidth [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)
示例10: __init__
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setCellWidth [as 别名]
def __init__(self, url):
DialogBox.__init__(self)
self.setText("Upload Files")
iframe = Frame(url)
closeButton = Button("Close", self)
msg = HTML("<center>Upload files, here. Please avoid spaces in file names.<br />(rename the file before uploading)</center>", True)
dock = DockPanel()
dock.setSpacing(4)
dock.add(closeButton, DockPanel.SOUTH)
dock.add(msg, DockPanel.NORTH)
dock.add(iframe, DockPanel.CENTER)
dock.setCellHorizontalAlignment(closeButton, HasAlignment.ALIGN_RIGHT)
dock.setCellWidth(iframe, "100%")
dock.setWidth("100%")
iframe.setWidth("800px")
iframe.setHeight("600px")
self.setWidget(dock)
示例11: onModuleLoad
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setCellWidth [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)
示例12: __init__
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setCellWidth [as 别名]
def __init__(self):
SimplePanel.__init__(self)
panel = DockPanel(BorderWidth=1, Padding=8,
HorizontalAlignment=HasAlignment.ALIGN_CENTER,
VerticalAlignment=HasAlignment.ALIGN_MIDDLE)
north = Label("North")
west = Label("West")
center = Label("Center")
east = Label("East")
south = Label("South")
panel.add(north, DockPanel.NORTH)
panel.add(west, DockPanel.WEST)
panel.add(center, DockPanel.CENTER)
panel.add(east, DockPanel.EAST)
panel.add(south, DockPanel.SOUTH)
panel.setCellHeight(center, "200px")
panel.setCellWidth(center, "400px")
self.add(panel)
示例13: onHistoryChanged
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setCellWidth [as 别名]
class Bookreader:
def onHistoryChanged(self, token):
info = self.sink_list.find(token)
if info:
self.show(info, False)
else:
self.showInfo()
def onModuleLoad(self):
section = Window.getLocation().getSearchVar("section")
if not section:
self.loadChapters()
else:
loadSection(section)
def loadChapters(self):
self.curInfo = ''
self.curSink = None
self.description = HTML()
self.sink_list = SinkList()
self.panel = DockPanel()
self.loadSinks()
self.sinkContainer = DockPanel()
self.sinkContainer.setStyleName("ks-Sink")
#self.nf = NamedFrame("section")
#self.nf.setWidth("100%")
#self.nf.setHeight("10000")
self.sp = ScrollPanel(self.sinkContainer)
#self.sp = VerticalSplitPanel()
self.sp.setWidth("100%")
self.sp.setHeight("100%")
#self.sp.setTopWidget(self.sinkContainer)
#self.sp.setBottomWidget(self.nf)
#self.sp.setSplitPosition(10000) # deliberately high - max out.
vp = VerticalPanel()
vp.setWidth("99%")
vp.setHeight("100%")
vp.add(self.description)
vp.add(self.sp)
authors = [
("2008, 2009", "Kenneth Casson Leighton", "[email protected]")
]
for years, name, email in authors:
authors_html = \
'© %s <a href="mailto:%s">%s</a><br />' %\
(years, email, name)
authors_panel = HTML()
authors_panel.setStyleName("ks-Authors")
authors_panel.setHTML(authors_html[:-6])
left_panel = DockPanel(Height="100%")
left_panel.add(self.sink_list, DockPanel.NORTH)
left_panel.add(authors_panel, DockPanel.SOUTH)
self.description.setStyleName("ks-Intro")
self.panel.add(left_panel, DockPanel.WEST)
self.panel.add(vp, DockPanel.CENTER)
self.panel.setCellVerticalAlignment(self.sink_list,
HasAlignment.ALIGN_TOP)
self.panel.setCellWidth(vp, "100%")
self.panel.setCellHeight(vp, "100%")
Window.addWindowResizeListener(self)
History.addHistoryListener(self)
RootPanel().add(self.panel)
self.onWindowResized(Window.getClientWidth(), Window.getClientHeight())
def onWindowResized(self, width, height):
self.panel.setWidth(width-20)
self.sink_list.resize(width-20, height-130)
self.sp.setHeight("%dpx" % (height-130))
def show(self, info, affectHistory):
if info == self.curInfo:
return
self.curInfo = info
#Logger.write("showing " + info.getName())
if self.curSink is not None:
self.curSink.onHide()
#Logger.write("removing " + self.curSink)
self.sinkContainer.remove(self.curSink)
self.curSink = info.getInstance()
self.sink_list.setSinkSelection(info.getName())
self.sink_list.sp.setScrollPosition(0)
self.sink_list.sp.setHorizontalScrollPosition(0)
self.description.setHTML(info.getDescription())
#.........这里部分代码省略.........
示例14: onHistoryChanged
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setCellWidth [as 别名]
class KitchenSink:
filexml = None
def onHistoryChanged(self, token):
log.writebr("onHistoryChanged: %s" % token)
info = self.sink_list.find(token)
if info:
self.show(info, False)
else:
self.showInfo()
def onModuleLoad(self):
self.curInfo=''
self.curSink=None
self.description=HTML()
self.sink_list=SinkList()
self.panel=DockPanel()
self.loadSinks()
self.sinkContainer = DockPanel()
self.sinkContainer.setStyleName("ks-Sink")
vp=VerticalPanel()
vp.setWidth("100%")
vp.add(self.description)
vp.add(self.sinkContainer)
self.description.setStyleName("ks-Info")
self.panel.add(self.sink_list, DockPanel.WEST)
self.panel.add(vp, DockPanel.CENTER)
self.panel.setCellVerticalAlignment(self.sink_list, HasAlignment.ALIGN_TOP)
self.panel.setCellWidth(vp, "100%")
History.addHistoryListener(self)
RootPanel().add(self.panel)
RootPanel().add(Logger())
#Show the initial screen.
initToken = History.getToken()
if len(initToken):
self.onHistoryChanged(initToken)
else:
self.showInfo()
def getHeight(self):
return rccutil.getHeight()
def show(self, info, affectHistory):
if info == self.curInfo: return
self.curInfo = info
#Logger.write("showing " + info.getName())
if self.curSink <> None:
self.curSink.onHide()
#Logger.write("removing " + self.curSink)
self.sinkContainer.remove(self.curSink)
self.curSink = info.getInstance()
self.sink_list.setSinkSelection(info.getName())
self.description.setHTML(info.getDescription())
if (affectHistory):
History.newItem(info.getName())
self.sinkContainer.add(self.curSink, DockPanel.CENTER)
self.sinkContainer.setCellWidth(self.curSink, "100%")
self.sinkContainer.setCellHeight(self.curSink, "100%")
self.sinkContainer.setCellVerticalAlignment(self.curSink, HasAlignment.ALIGN_TOP)
self.curSink.onShow()
def loadSinks(self):
#self.sink_list.addSink(DataTree.init())
#self.sink_list.addSink(RecipeSystemIFACE.init())
self.sink_list.addSink(ADViewerIFACE.init())
self.sink_list.addSink(RecipeViewer.init())
self.sink_list.addSink(FITSStoreFACE.init())
self.sink_list.addSink(DisplayIFACE.init())
self.sink_list.addSink(Info.init())
if False:
self.sink_list.addSink(Buttons.init())
self.sink_list.addSink(Menus.init())
self.sink_list.addSink(Images.init())
self.sink_list.addSink(Layouts.init())
self.sink_list.addSink(Lists.init())
self.sink_list.addSink(Popups.init())
self.sink_list.addSink(Tables.init())
self.sink_list.addSink(Text.init())
if False: #preserving originaly order
self.sink_list.addSink(Frames.init())
self.sink_list.addSink(Tabs.init())
def showInfo(self):
self.show(self.sink_list.find("AstroData Viewer"), False)
示例15: onHistoryChanged
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setCellWidth [as 别名]
class MLAlgorithms:
def onHistoryChanged(self, token):
log.writebr("onHistoryChanged: %s" % token)
info = self.Algorithm_list.find(token)
if info is not None:
self.show(info, False)
else:
self.showInfo()
def onModuleLoad(self):
self.curInfo=''
self.curAlgorithm=None
self.description=HTML()
self.Algorithm_list=AlgorithmList()
self.panel=DockPanel()
self.loadAlgorithms()
self.AlgorithmContainer = DockPanel()
self.AlgorithmContainer.setStyleName("ks-Algorithm")
vp=VerticalPanel()
vp.setWidth("100%")
vp.add(self.description)
vp.add(self.AlgorithmContainer)
self.description.setStyleName("ks-Info")
self.panel.add(self.Algorithm_list, DockPanel.WEST)
self.panel.add(vp, DockPanel.CENTER)
self.panel.setCellVerticalAlignment(self.Algorithm_list, HasAlignment.ALIGN_TOP)
self.panel.setCellWidth(vp, "100%")
History.addHistoryListener(self)
RootPanel().add(self.panel)
RootPanel().add(Logger())
#Show the initial screen.
initToken = History.getToken()
if len(initToken):
self.onHistoryChanged(initToken)
else:
self.showInfo()
def show(self, info, affectHistory):
if info == self.curInfo: return
self.curInfo = info
log.writebr("showing " + info.getName())
if self.curAlgorithm is not None:
log.writebr("removing " + str(self.curAlgorithm))
self.curAlgorithm.onHide()
self.AlgorithmContainer.remove(self.curAlgorithm)
self.curAlgorithm = info.getInstance()
self.Algorithm_list.setAlgorithmSelection(info.getName())
self.description.setHTML(info.getDescription())
if (affectHistory):
History.newItem(info.getName())
self.AlgorithmContainer.add(self.curAlgorithm, DockPanel.CENTER)
self.AlgorithmContainer.setCellWidth(self.curAlgorithm, "100%")
self.AlgorithmContainer.setCellHeight(self.curAlgorithm, "100%")
self.AlgorithmContainer.setCellVerticalAlignment(self.curAlgorithm, HasAlignment.ALIGN_TOP)
self.curAlgorithm.onShow()
def loadAlgorithms(self):
self.Algorithm_list.addAlgorithm(Info.init())
self.Algorithm_list.addAlgorithm(kMeans.init())
def showInfo(self):
self.show(self.Algorithm_list.find("Info"), False)