示例#1
0
    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
示例#2
0
    def __init__(self, **kwargs):
        ZillaWindow.__init__(self, kwargs)
        DialogBox.__init__(self, kwargs)
        self.dockPanel = DockPanel()
        self.dockPanel.setSpacing(4)

        self.setText("Logowanie")

        hpanel1 = HorizontalPanel()

        login = TextBox()
        login.setText("Login")
        #hpanel1.add(login)

        passwd = TextBox()
        passwd.setText("Hasło")

        self.dockPanel.add(login, DockPanel.NORTH)
        self.dockPanel.add(passwd, DockPanel.NORTH)

        #hpanel1.add(passwd)

        #self.add(hpanel1)

        self.add(login)
        self.add(passwd)
示例#3
0
    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("Help Contents")
            self.setWidth('80%')

            msg = HTML(
                """\
<h2>Introduction</h2>

This application can be used to maintain a timesheet.

<p/>
On startup, it tries to open the last opened timesheet.

<p/>
There are two modes: Edit and Summary (see menu). In edit mode the user can enter/modify his timescheet. There's some inteligence built in. The 'From' is filled in automatically when the previous line has a 'To'. The 'To' can be filled in as time span, or as end-time. The 'Project' is mandatory (as the 'From' and 'To' are). The user can walk around with the cursor keys.


<h2>Opening and saving sheets</h2>
The sheet can be loaded and saved from a local file. There might be some issues with Firefox, which might refuse access to the document in an iframe.

<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
示例#4
0
    def __init__(self, left=50, top=50):
        DialogBox.__init__(self, modal=False)

        self.setPopupPosition(left, top)
        self.setText("Preferences")
        ftable = FlexTable()
        ftableFormatter = ftable.getFlexCellFormatter()
        row = 0

        try:
            self.fileLocation = getCookie("fileLocation")
        except:
            self.fileLocation = None

        row += 1
        ftable.setWidget(row, 0,
                         Label("Sheet loaded on startup", wordWrap=False))
        self.fileLocationInput = TextBox()
        self.fileLocationInput.addChangeListener(self.checkValid)
        self.fileLocationInput.addKeyboardListener(self)
        self.fileLocationInput.setVisibleLength(30)
        self.fileLocationInput.setText(self.fileLocation)
        ftable.setWidget(row, 1, self.fileLocationInput)

        row += 1
        hpanel = HorizontalPanel()
        self.saveBtn = Button("Save", self.onSave)
        self.saveBtn.setEnabled(False)
        hpanel.add(self.saveBtn)
        self.cancelBtn = Button("Cancel", self.onCancel)
        hpanel.add(self.cancelBtn)
        ftable.setWidget(row, 0, hpanel)
        ftableFormatter.setColSpan(row, 0, 2)

        self.setWidget(ftable)
示例#5
0
    def __init__(self, left = 50, top = 50):
        DialogBox.__init__(self, modal = False)

        self.setPopupPosition(left, top)
        self.setText("Preferences")
        ftable = FlexTable()
        ftableFormatter = ftable.getFlexCellFormatter()
        row = 0

        try:
            self.fileLocation = getCookie("fileLocation")
        except:
            self.fileLocation = None

        row += 1
        ftable.setWidget(row, 0, Label("Sheet loaded on startup", wordWrap=False))
        self.fileLocationInput = TextBox()
        self.fileLocationInput.addChangeListener(self.checkValid)
        self.fileLocationInput.addKeyboardListener(self)
        self.fileLocationInput.setVisibleLength(30)
        self.fileLocationInput.setText(self.fileLocation)
        ftable.setWidget(row, 1, self.fileLocationInput)

        row += 1
        hpanel = HorizontalPanel()
        self.saveBtn = Button("Save", self.onSave)
        self.saveBtn.setEnabled(False)
        hpanel.add(self.saveBtn)
        self.cancelBtn = Button("Cancel", self.onCancel)
        hpanel.add(self.cancelBtn)
        ftable.setWidget(row, 0, hpanel)
        ftableFormatter.setColSpan(row, 0, 2)

        self.setWidget(ftable)
示例#6
0
class DialogBoxDemo(SimplePanel):
    def __init__(self):
        SimplePanel.__init__(self)

        self.add(Button("Show Dialog", getattr(self, "showDialog")))


    def showDialog(self, event):
        contents = VerticalPanel()
        contents.setSpacing(4)
        contents.add(HTML('You can place any contents you like in a dialog box.'))
        contents.add(Button("Close", getattr(self, "onClose")))
        contents.setStyleName("Contents")

        self._dialog = DialogBox()
        self._dialog.setHTML('<b>Welcome to the dialog box</b>')
        self._dialog.setWidget(contents)

        left = (Window.getClientWidth() - 200) / 2
        top = (Window.getClientHeight() - 100) / 2
        self._dialog.setPopupPosition(left, top)
        self._dialog.show()


    def onClose(self, event):
        self._dialog.hide()
class ErrorMessage:
    """
	Simple class to show a message that blocks the screen until the user
	clicks the "Close" button.
	
	Note that this gets its style from the CSS styles ".gwt-DialogBox .Caption",
	".gwt-DialogBox .Contents" and ".gwt-PopupPanelGlass"
	
	@author Mark Grimes ([email protected])
	@date 17/Jan/2014
	"""

    def __init__(self, message, messageTitle="Error"):
        self.dialog = DialogBox(glass=True)
        self.dialog.setHTML("<b>" + messageTitle + "</b>")
        dialogContents = VerticalPanel(StyleName="Contents", Spacing=4)
        dialogContents.add(HTML(message))
        dialogContents.add(Button("Close", getattr(self, "onClose")))
        self.dialog.setWidget(dialogContents)
        left = (Window.getClientWidth() - 200) / 2 + Window.getScrollLeft()
        top = (Window.getClientHeight() - 100) / 2 + Window.getScrollTop()
        self.dialog.setPopupPosition(left, top)
        self.dialog.show()

    def onClose(self, event):
        self.dialog.hide()
示例#8
0
 def show(self):
     if self.hasBackground:
         self.background = Widget(Element=DOM.createDiv(), StyleName='diaglog_coverup')
         self.background.setHeight(RootPanel().getOffsetHeight())
         RootPanel().add(self.background)
     DialogBox.show(self)
     
示例#9
0
    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("Help Contents")
            self.setWidth('80%')

            msg = HTML("""\
<h2>Introduction</h2>

This application can be used to maintain a timesheet.

<p/>
On startup, it tries to open the last opened timesheet.

<p/>
There are two modes: Edit and Summary (see menu). In edit mode the user can enter/modify his timescheet. There's some inteligence built in. The 'From' is filled in automatically when the previous line has a 'To'. The 'To' can be filled in as time span, or as end-time. The 'Project' is mandatory (as the 'From' and 'To' are). The user can walk around with the cursor keys.


<h2>Opening and saving sheets</h2>
The sheet can be loaded and saved from a local file. There might be some issues with Firefox, which might refuse access to the document in an iframe.

<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
示例#10
0
class DialogBoxDemo(SimplePanel):
    def __init__(self):
        SimplePanel.__init__(self)

        self.add(Button("Show Dialog", getattr(self, "showDialog")))


    def showDialog(self, event):
        contents = VerticalPanel(StyleName="Contents",
                                 Spacing=4)
        contents.add(HTML('You can place any contents you like in a dialog box.'))
        contents.add(Button("Close", getattr(self, "onClose")))

        self._dialog = DialogBox(glass=True)
        self._dialog.setHTML('<b>Welcome to the dialog box</b>')
        self._dialog.setWidget(contents)

        left = (Window.getClientWidth() - 200) / 2 + Window.getScrollLeft()
        top = (Window.getClientHeight() - 100) / 2 + Window.getScrollTop()
        self._dialog.setPopupPosition(left, top)
        self._dialog.show()


    def onClose(self, event):
        self._dialog.hide()
示例#11
0
文件: Popups.py 项目: brodybits/pyjs
 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
示例#12
0
 def __init__(self, key, title, content):
     AbsolutePanel.__init__(self)
     self.edit_header = Label("Edit a Post", StyleName="header_label")
     self.edit_title_label = Label("Title:")
     self.edit_title = TextBox()
     self.edit_title.setMaxLength(255)
     self.edit_content = TextArea()
     self.edit_content.setVisibleLines(2)
     self.edit_button = Button("Save")
     self.edit_cancel_button = Button("Cancel")
     self.edit_hidden_key = Hidden()
     self.error_message_label = Label("", StyleName="error_message_label")
     edit_contents = VerticalPanel(StyleName="Contents", Spacing=4)
     edit_contents.add(self.edit_header)
     edit_contents.add(self.edit_title_label)
     edit_contents.add(self.edit_title)
     edit_contents.add(self.edit_content)
     edit_contents.add(self.edit_button)
     edit_contents.add(self.edit_cancel_button)
     edit_contents.add(self.error_message_label)
     edit_contents.add(self.edit_hidden_key)
     self.edit_dialog = DialogBox(glass=True)
     self.edit_dialog.setHTML('<b>Blog Post Form</b>')
     self.edit_dialog.setWidget(edit_contents)
     left = (Window.getClientWidth() - 900) / 2 + Window.getScrollLeft()
     top = (Window.getClientHeight() - 600) / 2 + Window.getScrollTop()
     self.edit_dialog.setPopupPosition(left, top)
     self.edit_dialog.hide()
示例#13
0
    def __init__ (self, **kwargs):
        ZillaWindow.__init__(self, kwargs)
        DialogBox.__init__(self, kwargs)
        self.dockPanel = DockPanel()
        self.dockPanel.setSpacing(4)

        self.setText ("Logowanie")

        hpanel1 = HorizontalPanel()
        
        login = TextBox()
        login.setText("Login")
        #hpanel1.add(login)

        passwd = TextBox()
        passwd.setText("Hasło")

        self.dockPanel.add(login, DockPanel.NORTH)
        self.dockPanel.add(passwd, DockPanel.NORTH)

        #hpanel1.add(passwd)

        #self.add(hpanel1)

        self.add(login)
        self.add(passwd)
示例#14
0
文件: main.py 项目: antialize/djudge
    def __init__(self, app):
        DialogBox.__init__(self)
        self.app = app
        self.table=FlexTable()
        self.table.setText(0, 0, "Please enter username and password")
        self.table.getFlexCellFormatter().setColSpan(0, 0, 2)
        self.table.setText(1, 0, "Username")
        self.handle = TextBox()
        h = getCookie('handle')
        self.handle.setText(h)
        self.table.setWidget(1, 1, self.handle)
        self.table.setText(2, 0, "Password")
        self.pwd = PasswordTextBox()
        self.table.setWidget(2, 1, self.pwd)

        self.table.setHTML(3,0,"")
        self.table.getFlexCellFormatter().setColSpan(3, 0, 2)        
        h = HorizontalPanel()
        self.table.setWidget(4,0, h)
        self.table.getFlexCellFormatter().setColSpan(4, 0, 2)
        h.add(Button("Ok", getattr(self, "onOk")))
        h.add(Button("Cancel", getattr(self, "onClose")))
        h.setSpacing(4)
        self.setHTML("<b>Login</b>")
        self.setWidget(self.table)
        left = (Window.getClientWidth() - 200) / 2
        top = (Window.getClientHeight() - 100) / 2
        self.setPopupPosition(left,top)
示例#15
0
 def __init__(self, title, okClick=None, cancelClick=None, options=-1, hasBackground=True):
     DialogBox.__init__(self, autoHide=False, modal=hasBackground, centered=True, StyleName='dialog')
     KeyboardHandler.__init__(self)
     self.addKeyboardListener(self)#n�o funciona fora do input
     self.title = title
     self.okClick = okClick
     self.cancelClick = cancelClick
     self.options = options
     self.hasBackground = hasBackground
     self.center = VerticalPanel(StyleName='dialog_center')
     self.draw()
示例#16
0
文件: components.py 项目: Afey/pyjs
class EditPanel(AbsolutePanel):

    def __init__(self, key, title, content):
        AbsolutePanel.__init__(self)
        self.edit_header = Label("Edit a Post", StyleName="header_label")
        self.edit_title_label = Label("Title:")
        self.edit_title = TextBox()
        self.edit_title.setMaxLength(255)
        self.edit_content = TextArea()
        self.edit_content.setVisibleLines(2)
        self.edit_button = Button("Save")
        self.edit_cancel_button = Button("Cancel")
        self.edit_hidden_key = Hidden()
        self.error_message_label = Label("", StyleName="error_message_label")
        edit_contents = VerticalPanel(StyleName="Contents", Spacing=4)
        edit_contents.add(self.edit_header)
        edit_contents.add(self.edit_title_label)
        edit_contents.add(self.edit_title)
        edit_contents.add(self.edit_content)
        edit_contents.add(self.edit_button)
        edit_contents.add(self.edit_cancel_button)
        edit_contents.add(self.error_message_label)
        edit_contents.add(self.edit_hidden_key)
        self.edit_dialog = DialogBox(glass=True)
        self.edit_dialog.setHTML('<b>Blog Post Form</b>')
        self.edit_dialog.setWidget(edit_contents)
        left = (Window.getClientWidth() - 900) / 2 + Window.getScrollLeft()
        top = (Window.getClientHeight() - 600) / 2 + Window.getScrollTop()
        self.edit_dialog.setPopupPosition(left, top)
        self.edit_dialog.hide()

    def clear_edit_panel(self):
        self.edit_title.setText("")
        self.edit_content.setText("")
        self.error_message_label.setText("")
示例#17
0
class WritePanel(AbsolutePanel):

    def __init__(self, parent):
        AbsolutePanel.__init__(self)
        self.post_header = Label("Write a Post", StyleName="header_label")
        self.post_write_title_label = Label("Title:")
        self.post_title = TextBox()
        self.post_content = TextArea()
        self.post_button = Button("Post")
        self.cancel_button = Button("Cancel")
        self.error_message_label = Label("", StyleName="error_message_label")
        contents = VerticalPanel(StyleName="Contents", Spacing=4)
        contents.add(self.post_header)
        contents.add(self.post_write_title_label)
        contents.add(self.post_title)
        contents.add(self.post_content)
        contents.add(self.post_button)
        contents.add(self.cancel_button)
        contents.add(self.error_message_label)
        self.dialog = DialogBox(glass=True)
        self.dialog.setHTML('<b>Blog Post Form</b>')
        self.dialog.setWidget(contents)
        left = (Window.getClientWidth() - 900) / 2 + Window.getScrollLeft()
        top = (Window.getClientHeight() - 600) / 2 + Window.getScrollTop()
        self.dialog.setPopupPosition(left, top)
        self.dialog.hide()

    def clear_write_panel(self):
        self.post_title.setText("")
        self.post_content.setText("")
        self.error_message_label.setText("")
示例#18
0
    def showDialog(self, event):
        contents = VerticalPanel()
        contents.setSpacing(4)
        contents.add(
            HTML('You can place any contents you like in a dialog box.'))
        contents.add(Button("Close", getattr(self, "onClose")))
        contents.setStyleName("Contents")

        self._dialog = DialogBox()
        self._dialog.setHTML('<b>Welcome to the dialog box</b>')
        self._dialog.setWidget(contents)

        left = (Window.getClientWidth() - 200) / 2
        top = (Window.getClientHeight() - 100) / 2
        self._dialog.setPopupPosition(left, top)
        self._dialog.show()
示例#19
0
文件: HTMLDialog.py 项目: Afey/pyjs
    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)
示例#20
0
    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)
 def __init__(self, message, messageTitle="Error"):
     self.dialog = DialogBox(glass=True)
     self.dialog.setHTML("<b>" + messageTitle + "</b>")
     dialogContents = VerticalPanel(StyleName="Contents", Spacing=4)
     dialogContents.add(HTML(message))
     dialogContents.add(Button("Close", getattr(self, "onClose")))
     self.dialog.setWidget(dialogContents)
     left = (Window.getClientWidth() - 200) / 2 + Window.getScrollLeft()
     top = (Window.getClientHeight() - 100) / 2 + Window.getScrollTop()
     self.dialog.setPopupPosition(left, top)
     self.dialog.show()
示例#22
0
    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
示例#23
0
    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
示例#24
0
    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)
示例#25
0
文件: bingo.py 项目: rgeos/bingo
    def create_popup(self):

        # create the popup in the middle box
        popup = DialogBox(False, False)
        
        popup.setHTML(num.pop())

        x = self.box.getAbsoluteLeft() + random()*100
        y = self.box.getAbsoluteTop() + random()*100
        popup.setPopupPosition(x, y)
        popup.show()
示例#26
0
    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)
示例#27
0
文件: dialogBox.py 项目: Afey/pyjs
    def showDialog(self, event):
        contents = VerticalPanel(StyleName="Contents",
                                 Spacing=4)
        contents.add(HTML('You can place any contents you like in a dialog box.'))
        contents.add(Button("Close", getattr(self, "onClose")))

        self._dialog = DialogBox(glass=True)
        self._dialog.setHTML('<b>Welcome to the dialog box</b>')
        self._dialog.setWidget(contents)

        left = (Window.getClientWidth() - 200) / 2 + Window.getScrollLeft()
        top = (Window.getClientHeight() - 100) / 2 + Window.getScrollTop()
        self._dialog.setPopupPosition(left, top)
        self._dialog.show()
示例#28
0
文件: AboutDialog.py 项目: Afey/pyjs
  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)
示例#29
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)
示例#30
0
 def _create_korobov_dialog(self):
     contents = VerticalPanel(StyleName="Contents", Spacing=4)
     contents.add(HTML("Enter the Korobov parameter."))
     kparam = TextBox(Text='2')
     contents.add(kparam)
     contents.add(Button("OK", getattr(self, '_close_korobov_dialog')))
     dialog = DialogBox(glass=True)
     dialog.setHTML('<b>Compute a Korobov generating vector</b>')
     dialog.setWidget(contents)
     return dialog, kparam
示例#31
0
 def _create_expr_dialog(self):
     contents = VerticalPanel(StyleName="Contents", Spacing=4)
     msg = (
         "Enter an expression for the weights, using <em>{0}</em> as the "
         "{1}, for example: <ul><li>{0}^-2</li><li>1/(1+{0}^2)</li><li>0.1^{0}</li></ul>."
     ).format(self._expr_var, self._expr_var_desc)
     contents.add(HTML(msg))
     expr = TextBox(Text='0.1')
     contents.add(expr)
     contents.add(Button("OK", getattr(self, '_close_expr_dialog')))
     dialog = DialogBox(glass=True)
     dialog.setHTML('<b>Set the weights from an expression</b>')
     dialog.setWidget(contents)
     return dialog, expr
示例#32
0
 def _create_add_dialog(self):
     contents = VerticalPanel(StyleName="Contents", Spacing=4)
     wtype = ListBox(Width="14em")
     wtype.addChangeListener(self)
     for wclass in self.WEIGHT_TYPES:
         wtype.addItem(wclass.NAME, value=wclass)
     panel = HorizontalPanel(Spacing=8)
     panel.add(HTML("Weight type: ", **captionstyle))
     panel.add(wtype)
     contents.add(panel)
     contents.add(Button("OK", getattr(self, '_close_add_dialog')))
     dialog = DialogBox(glass=True)
     dialog.setHTML('<b>Add a new type of weights</b>')
     dialog.setWidget(contents)
     return dialog, wtype
示例#33
0
    def show_custom(self):
        self.dialog = DialogBox(StyleName='custom-dialog')
        self.dialog.setHTML('Custom Settings')

        contents = VerticalPanel(StyleName='contents')
        self.dialog.setWidget(contents)

        # contents of contents
        rows = HorizontalPanel()
        columns = HorizontalPanel()
        bombs = HorizontalPanel()
        buttons = HorizontalPanel()

        for each in (rows, columns, bombs, buttons):
            contents.add(each)

        rows.add(Label('Rows:'))
        self.row = TextBox()
        rows.add(self.row)

        columns.add(Label('Columns:'))
        self.column = TextBox()
        columns.add(self.column)

        bombs.add(Label('Bombs:'))
        self.bomb = TextBox()
        bombs.add(self.bomb)

        buttons.add(Button("OK", getattr(self, 'new_game')))
        buttons.add(Button("Cancel", getattr(self, 'close_dialog')))

        left = (Window.getClientWidth() - 201) / 2
        top = (Window.getClientHeight() - 190) / 2
        self.dialog.setPopupPosition(left, top)

        self.dialog.show()
示例#34
0
文件: HTMLDialog.py 项目: Afey/pyjs
 def setWidth(self, width):
     DialogBox.setWidth(self, "%dpx" % width)
     self.sp.setWidth("%dpx" % (width-20))
示例#35
0
    def create_popup(self):

        # create the popup in the middle box
        popup = DialogBox(False, False)
        popup.onClick = lambda w: popup.hide()
        popup.setHTML('<b>Hello!</b>')
        popup.setWidget(Button('Close', popup))
        x = self.box.getAbsoluteLeft() + random()*100
        y = self.box.getAbsoluteTop() + random()*100
        popup.setPopupPosition(x, y)
        popup.show()
示例#36
0
文件: HTMLDialog.py 项目: Afey/pyjs
 def setHeight(self, height):
     DialogBox.setHeight(self, "%dpx" % height)
     self.sp.setHeight("%dpx" % (height-65))
示例#37
0
 def setPopupPosition(self, left, top):
     if top + self.getOffsetHeight() > Window.getClientHeight():
         top = Window.getClientHeight() - self.getOffsetHeight()
     if left + self.getOffsetWidth() > Window.getClientWidth():
         left = Window.getClientWidth() - self.getOffsetWidth()    
     DialogBox.setPopupPosition(self, left, top)    
示例#38
0
 def hide(self, autoClosed=False):
     if self.hasBackground: RootPanel().remove(self.background)
     return DialogBox.hide(self, autoClosed=autoClosed)
示例#39
0
    def create_popup(self):

        # create the popup in the middle box
        popup = DialogBox(False, False)
        popup.onClick = lambda w: popup.hide()
        popup.setHTML('<b>Hello!</b>')
        popup.setWidget(Button('Close', popup))
        x = self.box.getAbsoluteLeft() + random() * 100
        y = self.box.getAbsoluteTop() + random() * 100
        popup.setPopupPosition(x, y)
        popup.show()
示例#40
0
    def __init__(self, left=50, top=50, fileLocation=None):
        global has_getAsText
        try:
            DialogBox.__init__(self, modal=False)
            self.filename = None
            self.data = None

            self.setPopupPosition(left, top)
            self.dockPanel = DockPanel()
            self.dockPanel.setSpacing(4)
            self.setText("File Open")

            if not fileLocation is None:
                msg = HTML("Loading file...", True)
                self.dockPanel.add(msg, DockPanel.NORTH)
                location = fileLocation
                if fileLocation.find("://") < 0:
                    base = Window.getLocation().getHref()
                    if base.find('/') >= 0:
                        sep = '/'
                    else:
                        sep = '\\'
                    base = sep.join(base.split(sep)[:-1]) + sep
                    location = base + fileLocation
                self.iframe = Frame(location)
                self.dockPanel.add(self.iframe, DockPanel.CENTER)
            else:
                msg = HTML("Choose a file", True)

                self.browseFile = FileUpload()
                elem = self.browseFile.getElement()
                if False and has_getAsText and hasattr(elem, 'files'):
                    self.iframe = None
                    self.files = elem.files
                    self.dockPanel.add(self.browseFile, DockPanel.CENTER)
                else:
                    self.browseFile = None
                    self.files = None
                    base = '' + doc().location
                    if base.find('/') >= 0:
                        sep = '/'
                    else:
                        sep = '\\'
                    if not base.lower()[:5] == "file:":
                        base = "file:///C:/"
                        msg = HTML(
                            "You'll have to place the application on a local file system, otherwise the browser forbids access.",
                            True)
                    else:
                        base = sep.join(base.split(sep)[:-1]) + sep
                    self.iframe = Frame(base)
                    self.dockPanel.add(self.iframe, DockPanel.CENTER)
                self.dockPanel.add(msg, DockPanel.NORTH)

            if self.iframe:
                self.iframe.setWidth("36em")
            hpanel = HorizontalPanel()
            self.openBtn = Button("Open", self.onClickOpen)
            hpanel.add(self.openBtn)
            self.cancelBtn = Button("Cancel", self.onClickCancel)
            hpanel.add(self.cancelBtn)
            self.dockPanel.add(hpanel, DockPanel.SOUTH)

            self.setWidget(self.dockPanel)
        except:
            raise
示例#41
0
 def create_popup(self, txt):
     popup = DialogBox(False, False)
     popup.onClick = lambda w: popup.hide()
     popup.setHTML('<b>%s</b>' % (txt))
     popup.setWidget(Button('Close', popup))
     popup.show()
示例#42
0
 def setHeight(self, height):
     DialogBox.setHeight(self, "%dpx" % height)
     self.sp.setHeight("%dpx" % (height - 65))
示例#43
0
    def __init__(self, left = 50, top = 50, fileLocation = None):
        global has_getAsText
        try:
            DialogBox.__init__(self, modal = False)
            self.filename = None
            self.data = None

            self.setPopupPosition(left, top)
            self.dockPanel = DockPanel()
            self.dockPanel.setSpacing(4)
            self.setText("File Open")

            if not fileLocation is None:
                msg = HTML("Loading file...", True)
                self.dockPanel.add(msg, DockPanel.NORTH)
                location =  fileLocation
                if fileLocation.find("://") < 0:
                    base = Window.getLocation().getHref()
                    if base.find('/') >= 0:
                        sep = '/'
                    else:
                        sep = '\\'
                    base = sep.join(base.split(sep)[:-1]) + sep
                    location = base + fileLocation
                self.iframe = Frame(location)
                self.dockPanel.add(self.iframe, DockPanel.CENTER)
            else:
                msg = HTML("Choose a file", True)

                self.browseFile = FileUpload()
                elem = self.browseFile.getElement()
                if False and has_getAsText and hasattr(elem, 'files'):
                    self.iframe = None
                    self.files = elem.files
                    self.dockPanel.add(self.browseFile, DockPanel.CENTER)
                else:
                    self.browseFile = None
                    self.files = None
                    base = '' + doc().location
                    if base.find('/') >= 0:
                        sep = '/'
                    else:
                        sep = '\\'
                    if not base.lower()[:5] == "file:":
                        base = "file:///C:/"
                        msg = HTML("You'll have to place the application on a local file system, otherwise the browser forbids access.", True)
                    else:
                        base = sep.join(base.split(sep)[:-1]) + sep
                    self.iframe = Frame(base)
                    self.dockPanel.add(self.iframe, DockPanel.CENTER)
                self.dockPanel.add(msg, DockPanel.NORTH)

            if self.iframe:
                self.iframe.setWidth("36em")
            hpanel = HorizontalPanel()
            self.openBtn = Button("Open", self.onClickOpen)
            hpanel.add(self.openBtn)
            self.cancelBtn = Button("Cancel", self.onClickCancel)
            hpanel.add(self.cancelBtn)
            self.dockPanel.add(hpanel, DockPanel.SOUTH)

            self.setWidget(self.dockPanel)
        except:
            raise
示例#44
0
    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("&lt;Prev Slice", self)
        self.nextSlice = Button("Next Slice&gt;", 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
示例#45
0
 def setWidth(self, width):
     DialogBox.setWidth(self, "%dpx" % width)
     self.sp.setWidth("%dpx" % (width - 20))
示例#46
0
    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("&lt;Prev Slice", self)
        self.nextSlice = Button("Next Slice&gt;", 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)