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
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
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
def __init__(self, baseURL): DialogWindow.__init__( self, modal=False, minimize=True, maximize=True, close=True, ) closeButton = Button("Close", self) imgname = self.images.pop(0) self.images.append(imgname) self.setText("Sample DialogWindow with embedded image") img = Image("%srembrandt/%s" % (baseURL, imgname)) 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 image '%s':</center>" % imgname, True) dock = DockPanel() dock.setSpacing(4) dock.add(closeButton, DockPanel.SOUTH) dock.add(msg, DockPanel.NORTH) dock.add(img, DockPanel.CENTER) dock.setCellHorizontalAlignment(closeButton, HasAlignment.ALIGN_RIGHT) dock.setCellWidth(img, "100%") dock.setWidth("100%") self.setWidget(dock)
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)
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%"
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%"
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)
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()
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)
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("images/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)
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)
def __init__(self, baseURL): DialogWindow.__init__( self, modal=False, minimize=True, maximize=True, close=True, ) closeButton = Button("Close", self) imgname = self.images.pop(0) self.images.append(imgname) self.setText("Sample DialogWindow with embedded image") img = Image("%srembrandt/%s" % (baseURL, imgname)) 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 image '%s':</center>" % imgname, True) dock = DockPanel() dock.setSpacing(4) dock.add(closeButton, DockPanel.SOUTH) dock.add(msg, DockPanel.NORTH) dock.add(img, DockPanel.CENTER) dock.setCellHorizontalAlignment(closeButton, HasAlignment.ALIGN_RIGHT) dock.setCellWidth(img, "100%") dock.setWidth("100%") self.setWidget(dock)
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)
def __init__(self, chart): """ DialogBox CSS Style self.settings used with this example for reference: Note: These simplified CSS styles make the dialog's title bar behave a little quirkily in IE6 when dragging. For more sophisticated CSS that fixes this problem (and also provides a more professional look) see the CSS tab of the DialogBox example in the GWT <a href="xxx"> Showcase of Features</a> (I just didn't want to copy 5 pages of obscure DialogBox CSS into what is after all a Client-side GChart example). .gwt-DialogBox .Caption { font-size: 18 color: #eef background: #00f repeat-x 0px -2003px padding: 4px 4px 4px 8px cursor: default border-bottom: 2px solid #008 border-top: 3px solid #448 .gwt-DialogBox .dialogContent { border: 1px solid #008 background: #ddd padding: 3px """ DialogBox.__init__(self, autoHide=True, modal=True) self.chart = chart self.isFirstTime = True mainPanel = VerticalPanel() propertyForm = FlexTable() commandBar = DockPanel() sliceSwitcher = HorizontalPanel() self.prevSlice = Button("<Prev Slice", self) self.nextSlice = Button("Next Slice>", self) self.closeButton = Button("Close", self) self.chart.colorSelector.addChangeListener(self) self.chart.sliceSizeSelector.addChangeListener(self) self.chart.shadingSelector.addChangeListener(self) #self.prevSlice.addClickListener(self) #self.nextSlice.addClickListener(self) #self.closeButton.addClickListener(self) # slice properties table (slice color, shading and size) propertyForm.setSize(3, 2) propertyForm.setText(0, 0, "Color:") propertyForm.setWidget(0, 1, self.chart.colorSelector) propertyForm.setText(1, 0, "Shading Pattern:") propertyForm.setWidget(1, 1, self.chart.shadingSelector) propertyForm.setText(2, 0, "Slice Size:") propertyForm.setWidget(2, 1, self.chart.sliceSizeSelector) # add additional properties here, if desired # buttons for changing the selected slice from the form sliceSwitcher.add(self.prevSlice) sliceSwitcher.add(self.nextSlice) commandBar.add(sliceSwitcher, DockPanel.WEST) commandBar.add(self.closeButton, DockPanel.EAST) commandBar.setCellHorizontalAlignment( self.closeButton, HasHorizontalAlignment.ALIGN_RIGHT) commandBar.setWidth("100%") # pushes close button to right edge # create main form and place it in DialogBox mainPanel.add(propertyForm) mainPanel.add(commandBar) self.setWidget(mainPanel)
def __init__(self, chart): """ DialogBox CSS Style self.settings used with this example for reference: Note: These simplified CSS styles make the dialog's title bar behave a little quirkily in IE6 when dragging. For more sophisticated CSS that fixes this problem (and also provides a more professional look) see the CSS tab of the DialogBox example in the GWT <a href="xxx"> Showcase of Features</a> (I just didn't want to copy 5 pages of obscure DialogBox CSS into what is after all a Client-side GChart example). .gwt-DialogBox .Caption { font-size: 18 color: #eef background: #00f repeat-x 0px -2003px padding: 4px 4px 4px 8px cursor: default border-bottom: 2px solid #008 border-top: 3px solid #448 .gwt-DialogBox .dialogContent { border: 1px solid #008 background: #ddd padding: 3px """ DialogBox.__init__(self, autoHide=True, modal=True) self.chart = chart self.isFirstTime = True mainPanel = VerticalPanel() propertyForm = FlexTable() commandBar = DockPanel() sliceSwitcher = HorizontalPanel() self.prevSlice = Button("<Prev Slice", self) self.nextSlice = Button("Next Slice>", self) self.closeButton = Button("Close", self) self.chart.colorSelector.addChangeListener(self) self.chart.sliceSizeSelector.addChangeListener(self) self.chart.shadingSelector.addChangeListener(self) #self.prevSlice.addClickListener(self) #self.nextSlice.addClickListener(self) #self.closeButton.addClickListener(self) # slice properties table (slice color, shading and size) propertyForm.setSize(3, 2) propertyForm.setText( 0, 0, "Color:") propertyForm.setWidget(0, 1, self.chart.colorSelector) propertyForm.setText( 1, 0, "Shading Pattern:") propertyForm.setWidget(1, 1, self.chart.shadingSelector) propertyForm.setText( 2, 0, "Slice Size:") propertyForm.setWidget(2, 1, self.chart.sliceSizeSelector) # add additional properties here, if desired # buttons for changing the selected slice from the form sliceSwitcher.add(self.prevSlice) sliceSwitcher.add(self.nextSlice) commandBar.add(sliceSwitcher, DockPanel.WEST) commandBar.add(self.closeButton, DockPanel.EAST) commandBar.setCellHorizontalAlignment(self.closeButton, HasHorizontalAlignment.ALIGN_RIGHT) commandBar.setWidth("100%"); # pushes close button to right edge # create main form and place it in DialogBox mainPanel.add(propertyForm) mainPanel.add(commandBar) self.setWidget(mainPanel); # add the DialogBox' single, defining, widget
class FormulaBuilder(DialogWindow): def __init__(self, operations, after, **kwargs): DialogWindow.__init__(self, modal=True, close=True) self.formula = Formula([]) self.after = after if "type" in kwargs: self.type = kwargs["type"] else: self.type = 'rel' self.set_styles() def op_button_click(op): def aio(): self.add_op(op) return aio self.ops_with_buttons = [{ "op": op, "button": Button(op.name, op_button_click(op)) } for op in operations] for owb in self.ops_with_buttons: self.add_button(owb["button"]) self.var = list() self.is_clicked = list() self.textbox = list() self.set_variables((0 if self.type == 'exp' else 5)) def set_variables(self, no_of_vars, x=True): def name(n): return "var" + str(n) def print_scheme(n): return ["\\alpha", "\\beta", "\\gamma", "\\delta", "\\epsilon"][n] def button_click(n): def sopa(): if not self.is_clicked[n]: v = Operation(name(n), 0, self.textbox[n].getText(), name(n), Operation.VARIABLE) self.var[n] = v self.textbox[n].setEnabled(False) self.is_clicked[n] = True self.add_op(self.var[n]) return sopa for i in range(no_of_vars): h = HorizontalPanel() b = Button("variable", button_click(i)) h.add(b) self.is_clicked.append(False) self.var.append(None) t = TextBox() self.textbox.append(t) t.setText(print_scheme(i)) h.add(t) self.add_button(h) def set_styles(self): self.dock = DockPanel() self.dock.setSpacing(3) self.dock.setWidth("300") self.image = Image( latex_to_url(self.formula.fill_with_placeholders().to_latex())) self.dock.add(self.image, DockPanel.EAST) self.dock.setCellHorizontalAlignment(self.image, HasAlignment.ALIGN_TOP) self.backspaceButton_add() self.doneButton_add() self.dock.add(HTML(""), DockPanel.CENTER) left = 100 top = 100 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(self.dock) def doneButton_add(self): def doneButton_click(): self.hide() self.after(self.formula) self.doneButton = Button("Done", doneButton_click) self.doneButton.setEnabled(False) self.dock.add(self.doneButton, DockPanel.SOUTH) def backspaceButton_add(self): def backspaceButton_click(): self.formula = Formula(self.formula.body[:-1]) self.refresh() self.backspaceButton = Button("Backspace", backspaceButton_click) self.backspaceButton.setEnabled(False) self.dock.add(self.backspaceButton, DockPanel.SOUTH) def refresh(self): self.image.setUrl( latex_to_url(self.formula.fill_with_placeholders().to_latex())) self.doneButton.setEnabled(self.formula.is_closed()) self.backspaceButton.setEnabled(len(self.formula.body) >= 0) def add_button(self, b): self.dock.add(b, DockPanel.NORTH) def add_op(self, op): if not self.formula.is_closed(): self.formula.add_one_op(op, self.type) self.refresh()