本文整理汇总了Python中pyjamas.ui.VerticalPanel.setWidth方法的典型用法代码示例。如果您正苦于以下问题:Python VerticalPanel.setWidth方法的具体用法?Python VerticalPanel.setWidth怎么用?Python VerticalPanel.setWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.VerticalPanel
的用法示例。
在下文中一共展示了VerticalPanel.setWidth方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import setWidth [as 别名]
def __init__(self):
Sink.__init__(self)
self.curImage=0
self.image=Image()
self.loadingImage = Image(self.baseURL() + "images/blanksearching.gif")
self.nextButton = Image(self.baseURL() + "rembrandt/forward.gif")
self.prevButton = Image(self.baseURL() + "rembrandt/back.gif")
self.sImages=["rembrandt/JohannesElison.jpg", "rembrandt/LaMarcheNocturne.jpg", "rembrandt/SelfPortrait1628.jpg", "rembrandt/SelfPortrait1640.jpg", "rembrandt/TheArtistInHisStudio.jpg", "rembrandt/TheReturnOfTheProdigalSon.jpg"]
for i in range(len(self.sImages)):
self.sImages[i]=self.baseURL() + self.sImages[i]
self.image.addLoadListener(self)
self.prevButton.addClickListener(self)
self.nextButton.addClickListener(self)
topPanel = DockPanel()
topPanel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
topPanel.add(self.prevButton, DockPanel.WEST)
topPanel.add(self.nextButton, DockPanel.EAST)
topPanel.add(self.loadingImage, DockPanel.CENTER)
panel = VerticalPanel()
panel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER)
panel.add(HTML("<h2>A Bit of Rembrandt</h2>", True))
panel.add(topPanel)
panel.add(self.image)
panel.setWidth("100%")
self.initWidget(panel)
self.image.setStyleName("ks-images-Image")
self.nextButton.setStyleName("ks-images-Button")
self.prevButton.setStyleName("ks-images-Button")
self.loadImage(0)
示例2: onModuleLoad
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import setWidth [as 别名]
def onModuleLoad(self):
self.curInfo=''
self.curSink=None
self.description=HTML()
self.sink_list=SinkList()
self.panel=DockPanel()
self.loadSinks()
self.sinkContainer = DockPanel()
self.sinkContainer.setStyleName("ks-Sink")
vp=VerticalPanel()
vp.setWidth("100%")
vp.add(self.description)
vp.add(self.sinkContainer)
self.description.setStyleName("ks-Info")
self.panel.add(self.sink_list, DockPanel.WEST)
self.panel.add(vp, DockPanel.CENTER)
self.panel.setCellVerticalAlignment(self.sink_list, HasAlignment.ALIGN_TOP)
self.panel.setCellWidth(vp, "100%")
History().addHistoryListener(self)
RootPanel().add(self.panel)
#RootPanel().add(Logger())
#Show the initial screen.
initToken = History().getToken()
if len(initToken):
self.onHistoryChanged(initToken)
else:
self.showInfo()
示例3: __init__
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import setWidth [as 别名]
def __init__(self):
Composite.__init__(self)
panel = VerticalPanel()
headerPanel = VerticalPanel()
self.subject = HTML()
self.sender = HTML()
self.recipient = HTML()
self.body = HTML()
self.scroller = ScrollPanel(self.body)
self.body.setWordWrap(True)
headerPanel.add(self.subject)
headerPanel.add(self.sender)
headerPanel.add(self.recipient)
headerPanel.setWidth("100%")
innerPanel = DockPanel()
innerPanel.add(headerPanel, DockPanel.NORTH)
innerPanel.add(self.scroller, DockPanel.CENTER)
innerPanel.setCellHeight(self.scroller, "100%")
panel.add(innerPanel)
innerPanel.setSize("100%", "100%")
self.scroller.setSize("100%", "100%")
self.initWidget(panel)
self.setStyleName("mail-Detail")
headerPanel.setStyleName("mail-DetailHeader")
innerPanel.setStyleName("mail-DetailInner")
self.subject.setStyleName("mail-DetailSubject")
self.sender.setStyleName("mail-DetailSender")
self.recipient.setStyleName("mail-DetailRecipient")
self.body.setStyleName("mail-DetailBody")
示例4: LoginBox
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import setWidth [as 别名]
class LoginBox(Composite):
"""
Displays a rounded box ( firefox/safari ) with at facebook connect button.
And a link as backup in case the button is not rendered.
"""
@java.init
def __init__(self, *a, **kw):
self.outer = VerticalPanel()
self.inner = HorizontalPanel()
self.loginButton = FbLoginButton(u"facebookConnectLogin()")
self.loginLink = Anchor(u"don't see a button? Click here to login")
self.loginCallback = None
@java.typed(LoginCallback)
def addLoginCallback(self, loginCallback):
self.loginCallback = loginCallback
@__init__.register
@java.typed()
def __init__(self, ):
self.__init__._super()
self.outer.getElement().setId(u"OuterRouter")
class _anonymous(ClickHandler):
@java.typed(ClickEvent)
def onClick(self, event):
class _anonymous(AsyncCallback):
@java.typed(Throwable)
def onFailure(self, caught):
GWT.log(u"Require session failed: " + java.str(caught))
@java.typed(Boolean)
def onSuccess(self, isLoggedIn):
if self.loginCallback is not None and isLoggedIn:
self.loginCallback.onLogin()
FacebookConnect.requireSession(_anonymous())
self.loginLink.addClickHandler(_anonymous()) # Login with the javascript api. GWT client doesnt render the fb:login-button
self.outer.getElement().setId(u"LoginBox")
self.inner.addStyleName(u"inner")
self.outer.add(HTML(u"<h1>Login with your facebook id: </h1>"))
self.outer.add(HTML(u"This demo uses facebook data heavily to demonstrate API calls etc so you might as well login right away"))
self.inner.setSpacing(10)
self.inner.add(HTML(u"Click the button to allow this application to access your facebook account"))
self.inner.add(self.loginButton)
self.outer.add(self.inner)
self.outer.add(self.loginLink)
sourceCode = HTML(u"<br/><br/>This project on Gogle code : <a target=_blank href=\"http://code.google.com/p/gwt-facebook/\"> http://code.google.com/p/gwt-facebook/ </a>")
sourceCode.addStyleName(u"sourceCode")
self.outer.setWidth(u"400px")
self.outer.add(sourceCode)
Xfbml.parse(self.outer)
self.initWidget(self.outer)
示例5: XFBML_serverFbml
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import setWidth [as 别名]
class XFBML_serverFbml(Showcase):
"""
Demonstrates serverFbml tag. Used to do invites etc.
"""
@java.init
def __init__(self, *a, **kw):
self.outer = VerticalPanel()
# Display request form inside iframe(fb:serverFbml).
fbml = u"<script type=\"text/fbml\"> <fb:fbml> <fb:request-form action=\"/test\" method=\"POST\" invite=\"true\" type=\"XFBML\" content=\"This is a test invitation from XFBML test app <fb:req-choice url='see wiki page for fb:req-choice for details' label='Ignore the Connect test app!' /> \" > <fb:multi-friend-selector showborder=\"false\" actiontext=\"Invite your friends to use Connect.\"> </fb:request-form> </fb:fbml> </script>"
# Construct
@__init__.register
@java.typed()
def __init__(self, ):
self.__init__._super()
self.outer.setWidth(u"800px")
self.outer.getElement().setId(u"XFBML_serverFbml")
self.outer.add(FbServerFbml(self.__class__.fbml))
Xfbml.parse(self.outer)
self.initWidget(self.outer)
示例6: ShowcaseClient
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import setWidth [as 别名]
class ShowcaseClient(Composite):
"""
This class wraps showcases and adds a treemenu for navigation.
TODO: Needs a cleanup.
"""
@java.init
def __init__(self, *a, **kw):
self.wText = u"gwt-facebook is a library for writing facebook apps using GWT." + u"Click the menu on the left to browse showcases and see source code."
self.outer = VerticalPanel()
self.horizontalSplit = HorizontalPanel()
self.authMethods = u"XAuth:auth_createToken,auth_expireSession,auth_getSession,auth_promoteSession,auth_revokeAuthorization,auth_revokeExtendedPermission"
self.batchMethods = u"XBatch:batch_run"
self.commentMethods = u"Comments:comments_xfbml,comments_add,comments_get,Xcomments_remove"
self.connectMethods = u"Connect:connect_getUnconnect...,Xconnect_registerUsers,Xconnect_unregisterUsers"
self.dataMethods = u"Data:data_getCookies,data_setCookie"
self.eventMethods = u"Events:Xevents_cancel,events_create,Xevents_edit,events_get,events_getMembers,Xevents_rsvp"
self.fbmlMethods = u"XFBML:fbml_deleteCustomTags,fbml_getCustomTags,fbml_refreshImgSrc,fbml_refreshRefUrl,fbml_registerCustomTags,fbml_setRefHandle"
self.feedMethods = u"XFeed:feed_deactivateTemplateBundleByID,feed_getRegisteredTemplateBundleByID,feed_getRegisteredTemplateBundles,feed_publishTemplatizedAction,feed_publishUserAction,feed_registerTemplateBundle"
self.fqlMethods = u"XFql:fql_multiquery,fql_query"
self.friendMethods = u"Friends:friends_areFriends,friends_get,friends_getAppUsers,friends_getLists,friends_getMutualFriends"
self.groupMethods = u"Groups:groups_get,Xgroups_getMembers"
self.intlMethods = u"XIntl:intl_getTranslations,intl_uploadNativeStrings"
self.linkMethods = u"XLinks:links_get,links_post"
self.messageMethods = u"Message:XliveMessage_send,message_getThreadsInFolder"
self.noteMethods = u"Notes:notes_create,Xnotes_delete,Xnotes_edit,notes_get"
self.notificationMethods = u"Notification:notifications_get,notifications_getList,Xnotifications_markRead,notifications_sendEmail,Xnotifications_sendEmail"
self.pageMethods = u"XPages:pages_getInfo,pages_isAdmin,pages_isAppAdded,pages_isFan"
self.photoMethods = u"Photos:Xphotos_addTag,photos_createAlbum,photos_get,photos_getAlbums,Xphotos_getTags,Xphotos_upload"
self.profileMethods = u"XProfile:profile_getFBML,profile_getInfo,profile_getInfoOptions,profile_setFBML,profile_setInfo,profile_setInfoOptions"
self.smsMethods = u"XSMS:Xsms_canSend,sms_send"
self.statusMethods = u"XStatus:status_get,status_set"
self.streamMethods = u"Stream:Xstream_addComment,Xstream_addLike,stream_get,Xstream_getComments,Xstream_getFilters,stream_publish,stream_publishAttachment,Xstream_remove,Xstream_removeComment,Xstream_removeLike"
self.userMethods = u"Users:users_getInfo,users_getLoggedInUser,Xusers_getStandardInfo,Xusers_hasAppPermission,Xusers_isAppUser,Xusers_isVerified,Xusers_setStatus"
self.videoMethods = u"XVideo:video_getUploadLimits,video_upload"
self.xfbml = u"FBML:various,serverFbml"
self.menu = java.Array([self.authMethods, self.batchMethods, self.commentMethods, self.connectMethods, self.dataMethods, self.eventMethods, self.fbmlMethods, self.feedMethods, self.fqlMethods, self.friendMethods, self.groupMethods, self.intlMethods, self.linkMethods, self.messageMethods, self.noteMethods, self.notificationMethods, self.pageMethods, self.photoMethods, self.profileMethods, self.smsMethods, self.statusMethods, self.streamMethods, self.userMethods, self.videoMethods, self.xfbml])
self.showcaseWrapper = VerticalPanel()
self.loader = Image(u"/loader.gif")
self.treeMenu = self.createMenu()
self.apiClient = ApiFactory.getInstance()
DEFAULT_SHOW = u"#comments_xfbml"
@java.private
@java.innerclass
@java.implements(SelectionHandlerTreeItem)
class ShowcaseHandler(Object):
@java.init
def __init__(self, *a, **kw):
pass
@java.typed(SelectionEvent)
def onSelection(self, event):
clickedLink = event.getSelectedItem()
if clickedLink.getChildCount() == 0:
if not self.apiClient.isSessionValid():
Window.alert(u"Your session has expired")
self.showcaseWrapper.clear()
else:
History.newItem(clickedLink.getText())
@__init__.register
@java.typed()
def __init__(self, ):
self.__init__._super()
"""
Create showcase client.
"""
History.addValueChangeHandler(self)
self.outer.getElement().setId(u"ShowcaseClient")
self.showcaseWrapper.getElement().setId(u"ShowcaseWrapper")
self.horizontalSplit.setSpacing(10)
self.showcaseWrapper.setWidth(u"700px")
self.showcaseWrapper.addStyleName(u"showcaseWrapper")
self.treeMenu.addStyleName(u"treeMenu")
token = Window.Location.getHash()
if token == None or u"".equals(token):
self.doDisplayShowcase(self.__class__.DEFAULT_SHOW)
self.showcaseWrapper.insert(self.createDefaultFrontpage(), 0)
else:
self.doDisplayShowcase(token)
treeMenuWrapper = VerticalPanel()
treeMenuWrapper.addStyleName(u"treeMenuWrapper")
treeMenuWrapper.add(HTML(u"<h4>Methods: </h4>"))
treeMenuWrapper.add(self.treeMenu)
self.horizontalSplit.add(treeMenuWrapper) # Add left + right column
self.horizontalSplit.add(self.decorate(self.showcaseWrapper))
self.outer.add(self.horizontalSplit)
Xfbml.parse(self.outer)
self.initWidget(self.outer)
@java.private
def createDefaultFrontpage(self):
pp = FbProfilePic(self.apiClient.getLoggedInUser(), Size.square)
pp.setSize(u"30px", u"30px")
name = FbName(self.apiClient.getLoggedInUser())
name.setUseyou(False)
#.........这里部分代码省略.........
示例7: ErrorResponseUI
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import setWidth [as 别名]
class ErrorResponseUI(DecoratedPopupPanel):
"""
Wraps an errorresponse from facebook
Css Configuration
<ul>
<li>gwittit-ErrorResponse
<li>gwittit-ErrorResponse-header
<li>gwittit-ErrorResponse-userData
<li>gwittit-ErrorResponse-requestArgs
<li>gwittit-ErrorResponse .closeButton
</ul>
"""
@java.init
def __init__(self, *a, **kw):
self.outer = VerticalPanel()
self.userDataPanel = VerticalPanel()
self.requestArgsPanel = VerticalPanel()
self.closeButton = Button(u"Okay")
@__init__.register
@java.typed(Throwable)
def __init__(self, t):
self((t).getErrorMessage()) ##AltConstrInv
"""
Create new UI object
@param t original exception
"""
@__init__.register
@java.typed(ErrorResponse)
def __init__(self, errorResponse):
self.__init__._super()
"""
Create new UI error response
@param errorResponse original error response
"""
super(self.__class__,self).setAutoHideEnabled(True)
msg = errorResponse.getMessage()
# Check if the call resulted in an invalid session state.
if msg.matches(u".*Invalid session.*"):
msg = u"You must be logged in to do that..."
self.outer.setWidth(u"600px")
self.outer.addStyleName(u"gwittit-ErrorResponse") # Css
self.userDataPanel.addStyleName(u"gwittit-ErrorResponse-userData")
self.requestArgsPanel.addStyleName(u"gwittit-ErrorResponse-requestArgs")
self.closeButton.addStyleName(u"closeButton")
self.outer.add(HTML(java.str(u"<h3 class=gwittit-ErrorResponse-header> Error Response: " + java.str(msg)) + u"</h3>")) # Header
userData = errorResponse.getUserData() # User Data
if userData is not None:
userDataHtml = java.str(java.str(java.str(u"<h3>User Data </h3>" + u"<ul>") + u"<li>ErrorCode: " + userData.getErrorCode()) + u"<li>ErrorMessage: " + userData.getErrorMsg()) + u"</li>"
self.userDataPanel.add(HTML(userDataHtml))
self.outer.add(self.userDataPanel)
requestArgs = userData.getRequestArgs() # Request Args
if requestArgs.__len__() > 0:
self.requestArgsPanel.add(HTML(u"<h3> Request Args </h3>"))
self.requestArgsPanel.add(HTML(u"<ul>"))
for i in range(0,requestArgs.__len__()):
self.requestArgsPanel.add(HTML(java.str(u"<li> " + java.str(requestArgs.get(i).getKey())) + u": " + requestArgs.get(i).getValue()))
self.requestArgsPanel.add(HTML(u"</ul>"))
self.outer.add(self.requestArgsPanel)
class _anonymous(ClickHandler):
@java.typed(ClickEvent)
def onClick(self, event):
ErrorResponseUI.self###NOTIMPL QThis###.hide()
self.closeButton.addClickHandler(_anonymous()) # Close Button
self.outer.add(self.closeButton)
self.setWidget(self.outer)