Пример #1
0
  def __init__(self):
      DialogBox.__init__(self)
      # Use this opportunity to set the dialog's caption.
      self.setText("About the Mail Sample")

      # Create a DockPanel to contain the 'about' label and the 'OK' button.
      outer = DockPanel()
      outer.setSpacing(4)
      
      outer.add(Image(AboutDialog.LOGO_IMAGE), DockPanel.WEST)

      # Create the 'OK' button, along with a listener that hides the dialog
      # when the button is clicked. Adding it to the 'south' position within
      # the dock causes it to be placed at the bottom.
      buttonPanel = HorizontalPanel()
      buttonPanel.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT)
      buttonPanel.add(Button("Close", self))
      outer.add(buttonPanel, DockPanel.SOUTH)

      # Create the 'about' label. Placing it in the 'rest' position within the
      # dock causes it to take up any remaining space after the 'OK' button
      # has been laid out.

      textplain =  "This sample application demonstrates the construction "
      textplain += "of a complex user interface using pyjamas' built-in widgets.  Have a look "
      textplain += "at the code to see how easy it is to build your own apps!"
      text = HTML(textplain)
      text.setStyleName("mail-AboutText")
      outer.add(text, DockPanel.CENTER)

      # Add a bit of spacing and margin to the dock to keep the components from
      # being placed too closely together.
      outer.setSpacing(8)

      self.setWidget(outer)
    def __init__(self):
        DialogBox.__init__(self)
        # Use this opportunity to set the dialog's caption.
        self.setText("About the Mail Sample")

        # Create a DockPanel to contain the 'about' label and the 'OK' button.
        outer = DockPanel()
        outer.setSpacing(4)

        outer.add(Image(AboutDialog.LOGO_IMAGE), DockPanel.WEST)

        # Create the 'OK' button, along with a listener that hides the dialog
        # when the button is clicked. Adding it to the 'south' position within
        # the dock causes it to be placed at the bottom.
        buttonPanel = HorizontalPanel()
        buttonPanel.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT)
        buttonPanel.add(Button("Close", self))
        outer.add(buttonPanel, DockPanel.SOUTH)

        # Create the 'about' label. Placing it in the 'rest' position within the
        # dock causes it to take up any remaining space after the 'OK' button
        # has been laid out.

        textplain = "This sample application demonstrates the construction "
        textplain += "of a complex user interface using pyjamas' built-in widgets.  Have a look "
        textplain += "at the code to see how easy it is to build your own apps!"
        text = HTML(textplain)
        text.setStyleName("mail-AboutText")
        outer.add(text, DockPanel.CENTER)

        # Add a bit of spacing and margin to the dock to keep the components from
        # being placed too closely together.
        outer.setSpacing(8)

        self.add(outer)
    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.

        # FIXME - need implementation#
        #     DeferredCommand.add(onWindowResized(Window.getClientWidth(), Window.getClientHeight()))

        self.onWindowResized(Window.getClientWidth(), Window.getClientHeight())
Пример #4
0
 def __init__(self):
     DialogBox.__init__(self)
     self.setText("Sample DialogBox with embedded Frame")
     
     iframe = Frame(Popups.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)
Пример #5
0
 def __init__(self):
     DialogBox.__init__(self)
     self.setText("Sample DialogBox with embedded Frame")
     
     iframe = Frame(Popups.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.add(dock)