本文整理汇总了Python中pyjamas.Window.getClientWidth方法的典型用法代码示例。如果您正苦于以下问题:Python Window.getClientWidth方法的具体用法?Python Window.getClientWidth怎么用?Python Window.getClientWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.Window
的用法示例。
在下文中一共展示了Window.getClientWidth方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onClick
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getClientWidth [as 别名]
def onClick(self, sender):
if sender == self.newpage:
self.todoId = None
self.todoTextName.setText("")
self.todoTextArea.setHTML("")
return
elif sender == self.view:
name = self.todoTextName.getText()
html = self.todoTextArea.getHTML()
if not html:
return
p = HTMLDialog(name, html)
p.setPopupPosition(10, 10)
p.setWidth(Window.getClientWidth() - 40)
p.setHeight(Window.getClientHeight() - 40)
p.show()
return
elif sender == self.fDialogButton:
Window.open(fileedit_url, "fileupload", "width=800,height=600")
return
dlg = FileDialog(fileedit_url)
left = self.fDialogButton.getAbsoluteLeft() + 10
top = self.fDialogButton.getAbsoluteTop() + 10
dlg.setPopupPosition(left, top)
dlg.show()
id = self.remote.getPage(sender.getValue(sender.getSelectedIndex()), self)
if id < 0:
self.status.setHTML("Server Error or Invalid Response")
示例2: show_custom
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getClientWidth [as 别名]
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()
ADD(contents, rows, columns, bombs, buttons)
self.row = TextBox()
ADD(rows, Label('Rows:'), self.row)
self.column = TextBox()
ADD(columns, Label('Columns:'), self.column)
self.bomb = TextBox()
ADD(bombs, Label('Bombs:'), self.bomb)
ADD(buttons, Button("OK", getattr(self, 'new_game')), \
Button("Cancel", getattr(self, 'close_dialog')))
left = (Window.getClientWidth() - 201) / 2
top = (Window.getClientHeight() - 190) / 2
self.dialog.setPopupPosition(left, top)
self.dialog.show()
示例3: __init__
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getClientWidth [as 别名]
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()
示例4: __init__
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getClientWidth [as 别名]
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)
示例5: onClick
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getClientWidth [as 别名]
def onClick(self, sender):
if sender == self.db:
width = (Window.getClientWidth() - POPUP_WIDTH) / 2.0
self.popup.setPopupPosition(width, 100)
self.popup.show()
else:
self.process()
示例6: setPopupPosition
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getClientWidth [as 别名]
def setPopupPosition(self, left, top):
if isinstance(left, basestring):
if left.endswith('%'):
left = int(left[:-1])
left = int(left * Window.getClientWidth() / 100)
elif left.lower().endswith('px'):
left = int(left[:-2])
if isinstance(top, basestring):
if top.lower().endswith('%'):
top = int(top[:-1])
top = int(top * Window.getClientHeight() / 100)
elif top.endswith('px'):
top = int(top[:-2])
left = max(left, 0)
top = max(top, 0)
# Account for the difference between absolute position and the
# body's positioning context.
left -= DOM.getBodyOffsetLeft()
top -= DOM.getBodyOffsetTop()
element = self.getElement()
DOM.setStyleAttribute(element, "left", "%dpx" % left)
DOM.setStyleAttribute(element, "top", "%dpx" % top)
示例7: start_spinner
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getClientWidth [as 别名]
def start_spinner(container, run_str='Processing<br>Please wait...'):
global __spinner # pylint: disable=W0603
__spinner = Spinner(run_str)
RootPanel().add(__spinner)
center = (Window.getClientWidth() - __spinner.size) / 2
middle = Window.getClientHeight() / 3
__spinner.setPopupPosition(center, middle)
__spinner.show()
__spinner.draw()
container.setStyleAttribute('opacity', '0.3')
示例8: __init__
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getClientWidth [as 别名]
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()
示例9: testResize
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getClientWidth [as 别名]
def testResize(self):
# TODO: window resizing does not work accuratly in browser
# because getClientWidth etc does not really match GWT. We
# need to copy the GWT implementation
if IN_BROWSER:
return
self.resize_test = True
Window.addWindowResizeListener(self)
self.h = Window.getClientHeight()
self.w = Window.getClientWidth()
Window.resize(800, 600)
示例10: setGlassPosition
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getClientWidth [as 别名]
def setGlassPosition(self):
top = Window.getScrollTop()
left = Window.getScrollLeft()
height = Window.getClientHeight()
width = Window.getClientWidth()
DOM.setStyleAttribute(self.glass, "position", "absolute")
DOM.setStyleAttribute(self.glass, "left", "%s" % \
left if left == 0 else "%spx" % left)
DOM.setStyleAttribute(self.glass, "top", "%s" % \
top if top == 0 else "%spx" % top)
DOM.setStyleAttribute(self.glass, "height", "%spx" % (top + height))
DOM.setStyleAttribute(self.glass, "width", "%spx" % (left + width))
示例11: centerBox
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getClientWidth [as 别名]
def centerBox(self):
self_width = self.getOffsetWidth()
self_height = self.getOffsetHeight()
height = Window.getClientHeight()
width = Window.getClientWidth()
center_x = int(width) / 2
center_y = int(height) / 2
self_top = center_y - (int(self_height) / 2)
self_left = center_x - (int(self_width) / 2)
self.setPopupPosition(self_left, self_top)
示例12: __init__
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getClientWidth [as 别名]
def __init__(self):
Composite.__init__(self)
self.vp_list=VerticalPanel()
self.sinks=[]
self.selectedSink=-1
self.sp = ScrollPanel(self.vp_list)
self.sp.setWidth("14em")
self.initWidget(self.sp)
self.setStyleName("ks-List")
self.resize(Window.getClientWidth(), Window.getClientHeight())
示例13: onModuleLoad
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getClientWidth [as 别名]
def onModuleLoad(self):
self.remote = InfoServicePython()
self.tree_width = 200
self.tp = HorizontalPanel()
self.tp.setWidth("%dpx" % (self.tree_width))
self.treeview = Trees()
self.treeview.fTree.addTreeListener(self)
self.sp = ScrollPanel()
self.tp.add(self.treeview)
self.sp.add(self.tp)
self.sp.setHeight("100%")
self.horzpanel1 = HorizontalPanel()
self.horzpanel1.setSize("100%", "100%")
self.horzpanel1.setBorderWidth(1)
self.horzpanel1.setSpacing("10px")
self.rp = RightPanel()
self.rps = ScrollPanel()
self.rps.add(self.rp)
self.rps.setWidth("100%")
self.rp.setWidth("100%")
self.cp1 = CollapserPanel(self)
self.cp1.setWidget(self.sp)
self.cp1.setHTML(" ")
self.midpanel = MidPanel(self)
self.cp2 = CollapserPanel(self)
self.cp2.setWidget(self.midpanel)
self.cp2.setHTML(" ")
self.horzpanel1.add(self.cp1)
self.horzpanel1.add(self.cp2)
self.horzpanel1.add(self.rps)
self.cp1.setInitialWidth("%dpx" % self.tree_width)
self.cp2.setInitialWidth("200px")
RootPanel().add(self.horzpanel1)
width = Window.getClientWidth()
height = Window.getClientHeight()
self.onWindowResized(width, height)
Window.addWindowResizeListener(self)
示例14: showDialog
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getClientWidth [as 别名]
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()
示例15: onShowImpl
# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getClientWidth [as 别名]
def onShowImpl(self, popup):
width = self.getOffsetWidth()
heigth = self.getOffsetHeight()
w_width = Window.getClientWidth()
w_heigth = Window.getClientHeight()
if w_width > width and w_heigth > heigth:
offset_x = self.getAbsoluteLeft()
offset_y = self.getAbsoluteTop()
element = self.getElement()
if (offset_x + width) > w_width:
offset_x = w_width - width
DOM.setStyleAttribute(element, "left", "%dpx" % offset_x)
if (offset_y + heigth) > w_heigth:
offset_y = w_heigth - heigth
DOM.setStyleAttribute(element, "top", "%dpx" % offset_y)