本文整理汇总了Python中pyjamas.ui.DockPanel.DockPanel.setSpacing方法的典型用法代码示例。如果您正苦于以下问题:Python DockPanel.setSpacing方法的具体用法?Python DockPanel.setSpacing怎么用?Python DockPanel.setSpacing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.DockPanel.DockPanel
的用法示例。
在下文中一共展示了DockPanel.setSpacing方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setSpacing [as 别名]
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)
示例2: HelpAboutDlg
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setSpacing [as 别名]
class HelpAboutDlg(DialogBox):
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
def onClick(self, sender):
self.hide()
示例3: __init__
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setSpacing [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
示例4: __init__
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setSpacing [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
示例5: onModuleLoad
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setSpacing [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)
示例6: __init__
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setSpacing [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%"
示例7: __init__
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setSpacing [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: __init__
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setSpacing [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)
示例9: PopupFrame
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setSpacing [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 setSpacing [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: HelpContentsDlg
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setSpacing [as 别名]
class HelpContentsDlg(DialogBox):
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
def onClick(self, sender):
self.hide()
示例12: __init__
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setSpacing [as 别名]
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)
示例13: LoginWindow
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setSpacing [as 别名]
class LoginWindow (DialogBox, ZillaWindow):
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)
def login(self):
return True
def join_game (self):
return True
def quit (self):
return True
示例14: indent
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setSpacing [as 别名]
def indent(contents, all=None, left=None, right=None, top=None, bottom=None,
hIndent=None, vIndent=None):
""" Add a wrapper around the given contents to indent it.
The parameters are as follows:
'contents'
The contents to indent. This should be a widget or a panel.
'all'
The indent to use for all four sides. This is the first
argument, allowing you to call indent(c, 20) to indent the
contents on all sides by the same amount.
'left'
The left indent to use.
'right'
The right indent to use.
'top'
The top indent to use.
'bottom'
The bottom indent to use.
'hIndent'
The indent to use for the left and right sides.
'vIndent'
The indent to use for the top and bottom.
The contents will be wrapped in a panel which include whitespace on
each side of the panel as specified.
Upon completion, we return a Panel object contained the wrapped-up
contents.
"""
if all is not None:
left = all
right = all
top = all
bottom = all
if hIndent is not None:
left = hIndent
right = hIndent
if vIndent is not None:
top = vIndent
bottom = vIndent
wrapper = DockPanel()
wrapper.setSpacing(0)
wrapper.add(contents, DockPanel.CENTER)
if left > 0:
padding = Whitespace(width=left)
wrapper.add(padding, DockPanel.WEST)
if top > 0:
padding = Whitespace(height=top)
wrapper.add(padding, DockPanel.NORTH)
if right > 0:
padding = Whitespace(width=right)
wrapper.add(padding, DockPanel.EAST)
if bottom > 0:
padding = Whitespace(height=bottom)
wrapper.add(padding, DockPanel.SOUTH)
return wrapper
示例15: FileOpenDlg
# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setSpacing [as 别名]
class FileOpenDlg(DialogBox):
files = None
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
def onClickCancel(self, sender):
self.hide()
def onClickOpen(self, sender):
global has_getAsText
data = None
filename = None
if self.files:
if self.files.length == 0:
return
if self.files.length > 1:
alert("Cannot open more than one file")
return
file = self.files.item(0)
filename = file.fileName
try:
data = file.getAsText("")
except AttributeError, e:
has_getAsText = False
alert("Sorry. cannot retrieve file in this browser.\nTry again.")
else: