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)
def doItemAction(self, item, fireCommand): if (self.shownChildMenu is not None) and (item.getSubMenu() == self.shownChildMenu): return if (self.shownChildMenu is not None): self.shownChildMenu.onHide() self.popup.hide() if item.getSubMenu() is None: if fireCommand: self.closeAllParents() cmd = item.getCommand() if cmd is not None: DeferredCommand.add(cmd) return self.selectItem(item) self.popup = MenuBarPopupPanel(item) self.popup.addPopupListener(self) if self.vertical: self.popup.setPopupPosition(self.getAbsoluteLeft() + self.getOffsetWidth() - 1, item.getAbsoluteTop()) else: self.popup.setPopupPosition(item.getAbsoluteLeft(), self.getAbsoluteTop() + self.getOffsetHeight() - 1) self.shownChildMenu = item.getSubMenu() sub_menu = item.getSubMenu() sub_menu.parentMenu = self self.popup.show()
def onLoad(self): self.impl.onAttach() # Set the position realizing it might not work until # after layout runs. This first call is simply to try # to avoid a jitter effect if possible. self.setSplitPosition(self.lastSplitPosition) DeferredCommand.add(self)
def main(init): root = RootPanel() container = FocusPanel() DeferredCommand.add(Focus(container)) root.add(container) container.setSize(21*15,21*15) init(container)
def setDayIncluded(self, day, included): if (self.daysFilter[day] == included): return self.daysFilter[day] = included if not self.pendingRefresh: self.pendingRefresh = True DeferredCommand.add(self)
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)
def __init__(self): SimplePanel.__init__(self, StyleName='main-panel') self.setWidth('100%') self.tabs = tabs.Tabs() self.tabs.addTabListener(self) self.add(self.tabs) Window.addWindowResizeListener(self) DeferredCommand.add(self) args = Window.getLocation().getSearchDict() userlist.setSortKey(args.get('sort')) userlist.setIconSize(args.get('icons'))
def setSplitPosition(self, pos=None): if pos is not None: # remember last pos set self._pos = pos else: pos = self._pos if pos < 1: pos = 1 self._pos = pos # change adjustable dimension if self._vertical: self._container1.setHeight(pos) else: self._container1.setWidth(pos) # if pix are given, we can try to finalize the positions finalized = False if isinstance(pos, int): finalized = self._finalizePositions(pos) # if needed, queue callback to finalize if not finalized: DeferredCommand.add(self._finalizePositions)
def __init__(self): GChart.__init__(self) self.phase = 0 self.btn = Button("Update", self) self.setChartFootnotes(self.btn) self.setChartSize(1000, 100) self.setChartTitle("<big><i>Sine vs Time</i></big>") self.setPadding("2px") self.getXAxis().setAxisLabel("<small><i>Time (seconds)</i></small>") self.getXAxis().setHasGridlines(True) self.getXAxis().setTickCount(6) self.getXAxis().setTickLabelFormat("#.##") self.getXAxis().setAxisMin(0) self.getXAxis().setAxisMax(PERIOD * N_PERIODS) self.getYAxis().setHasGridlines(True) self.getYAxis().setTickCount(5) self.getYAxis().setAxisMin(-1) self.getYAxis().setAxisMax(1) self.getYAxis().setTickLabelThickness(10) self.addCurve() self.getCurve().getSymbol().setSymbolType( SymbolType.VBAR_BASELINE_CENTER) self.getCurve().getSymbol().setBorderWidth(0) self.getCurve().getSymbol().setBackgroundColor("blue") self.getCurve().getSymbol().setFillSpacing(Double.NaN) self.getCurve().getSymbol().setFillThickness(0) self.getCurve().getSymbol().setHeight(1) self.getCurve().getSymbol().setWidth(1) for i in range(N_PERIODS): DeferredCommand.add(IncrementalUpdate(self, i, 0, 1))
def __init__(self): GChart.__init__(self) self.phase = 0 self.btn = Button("Update", self) self.setChartFootnotes(self.btn) self.setChartSize(1000,100) self.setChartTitle("<big><i>Sine vs Time</i></big>") self.setPadding("2px") self.getXAxis().setAxisLabel("<small><i>Time (seconds)</i></small>") self.getXAxis().setHasGridlines(True) self.getXAxis().setTickCount(6) self.getXAxis().setTickLabelFormat("#.##") self.getXAxis().setAxisMin(0) self.getXAxis().setAxisMax(PERIOD*N_PERIODS) self.getYAxis().setHasGridlines(True) self.getYAxis().setTickCount(5) self.getYAxis().setAxisMin(-1) self.getYAxis().setAxisMax(1) self.getYAxis().setTickLabelThickness(10) self.addCurve() self.getCurve().getSymbol().setSymbolType(SymbolType.VBAR_BASELINE_CENTER) self.getCurve().getSymbol().setBorderWidth(0) self.getCurve().getSymbol().setBackgroundColor("blue") self.getCurve().getSymbol().setFillSpacing(Double.NaN) self.getCurve().getSymbol().setFillThickness(0) self.getCurve().getSymbol().setHeight(1) self.getCurve().getSymbol().setWidth(1) for i in range(N_PERIODS): DeferredCommand.add(IncrementalUpdate(self, i, 0, 1))
def onClick(self, event): self.phase += DELTA_PHASE for i in range(N_PERIODS): DeferredCommand.add(IncrementalUpdate(self, i, self.phase, 1))
def onModuleLoad(self): dlp = DockPanel(Width="100%", Height="100%") self.m_rte = RichTextArea(Width="500px", Height="400px") self.m_tb = RichTextToolbar(self.m_rte, self) buts = FlowPanel() self.m_getCurr = Button("Refresh v", self) self.m_setHtml = Button("Set html ^", self) self.m_setHtml.setTitle("Set html from the lower left text area") self.m_toSCursor = Button("< To Cursor", self) self.m_toSCursor.setTitle( "Set the selection to be a cursor at the beginning of the current selection" ) self.m_toECursor = Button("To Cursor >", self) self.m_toECursor.setTitle( "Set the selection to be a cursor at the end of the current selection" ) self.m_surround1 = Button("Surround1", self) self.m_surround2 = Button("Surround2", self) self.m_font1 = Button("Times New Roman", self) self.m_font2 = Button("Arial", self) grid = Grid(2, 2) self.m_startNode = self.createTextBox(1) self.m_startOffset = self.createTextBox(3) self.m_endNode = self.createTextBox(4) self.m_endOffset = self.createTextBox(5) self.m_select = Button("`>Select", self) self.m_select.setTitle("Select the texts/offsets in the boxes above") self.m_cursor = Button("`>Cursor", self) self.m_cursor.setTitle( "Set cursor to text/offset of top 2 boxes above") grid.setWidget(0, 0, self.m_startNode) grid.setWidget(0, 1, self.m_startOffset) grid.setWidget(1, 0, self.m_endNode) grid.setWidget(1, 1, self.m_endOffset) self.m_deleteSel = Button("Delete", self) self.m_reset = Button("Reset", self) buts.add(self.m_getCurr) buts.add(self.m_setHtml) buts.add(self.m_toSCursor) buts.add(self.m_toECursor) buts.add(self.m_font1) buts.add(self.m_font2) buts.add(self.m_surround1) buts.add(self.m_surround2) buts.add(grid) buts.add(self.m_select) buts.add(self.m_cursor) buts.add(self.m_deleteSel) buts.add(self.m_reset) dlp.add(buts, DockPanel.WEST) textPanels = DockPanel() self.m_html = TextArea() self.m_html.setSize("100%", "100%") self.m_sel = TextArea() self.m_sel.setSize("100%", "100%") textPanels.add(self.m_sel, DockPanel.EAST) textPanels.add(self.m_html, DockPanel.WEST) dlp.add(textPanels, DockPanel.SOUTH) dlp.add(self.m_tb, DockPanel.NORTH) dlp.add(self.m_rte, DockPanel.CENTER) rp = RootPanel.get() rp.add(dlp) DeferredCommand.add(getattr(self, "set_html_focus")) self.reset()
def addChartNoUpdate(gchart): DeferredCommand.add(AddOneChart(gchart, False))
def addChart(gchart): DeferredCommand.add(AddOneChart(gchart, True))
def onModuleLoad(self): dlp = DockPanel(Width="100%", Height="100%") self.m_rte = RichTextArea(Width="500px", Height="400px") self.m_tb = RichTextToolbar(self.m_rte, self) buts = FlowPanel() self.m_getCurr = Button("Refresh v", self) self.m_setHtml = Button("Set html ^", self) self.m_setHtml.setTitle("Set html from the lower left text area") self.m_toSCursor = Button("< To Cursor", self) self.m_toSCursor.setTitle("Set the selection to be a cursor at the beginning of the current selection") self.m_toECursor = Button("To Cursor >", self) self.m_toECursor.setTitle("Set the selection to be a cursor at the end of the current selection") self.m_surround1 = Button("Surround1", self) self.m_surround2 = Button("Surround2", self) self.m_font1 = Button("Times New Roman", self) self.m_font2 = Button("Arial", self) grid = Grid(2, 2) self.m_startNode = self.createTextBox(1) self.m_startOffset = self.createTextBox(3) self.m_endNode = self.createTextBox(4) self.m_endOffset = self.createTextBox(5) self.m_select = Button("`>Select", self) self.m_select.setTitle("Select the texts/offsets in the boxes above") self.m_cursor = Button("`>Cursor", self) self.m_cursor.setTitle("Set cursor to text/offset of top 2 boxes above") grid.setWidget(0, 0, self.m_startNode) grid.setWidget(0, 1, self.m_startOffset) grid.setWidget(1, 0, self.m_endNode) grid.setWidget(1, 1, self.m_endOffset) self.m_deleteSel = Button("Delete", self) self.m_reset = Button("Reset", self) buts.add(self.m_getCurr) buts.add(self.m_setHtml) buts.add(self.m_toSCursor) buts.add(self.m_toECursor) buts.add(self.m_font1) buts.add(self.m_font2) buts.add(self.m_surround1) buts.add(self.m_surround2) buts.add(grid) buts.add(self.m_select) buts.add(self.m_cursor) buts.add(self.m_deleteSel) buts.add(self.m_reset) dlp.add(buts, DockPanel.WEST) textPanels = DockPanel() self.m_html = TextArea() self.m_html.setSize("100%", "100%") self.m_sel = TextArea() self.m_sel.setSize("100%", "100%") textPanels.add(self.m_sel, DockPanel.EAST) textPanels.add(self.m_html, DockPanel.WEST) dlp.add(textPanels, DockPanel.SOUTH) dlp.add(self.m_tb, DockPanel.NORTH) dlp.add(self.m_rte, DockPanel.CENTER) rp = RootPanel.get() rp.add(dlp) DeferredCommand.add(getattr(self, "set_html_focus")) self.reset()