当前位置: 首页>>代码示例>>Python>>正文


Python DockPanel.setWidth方法代码示例

本文整理汇总了Python中pyjamas.ui.DockPanel.DockPanel.setWidth方法的典型用法代码示例。如果您正苦于以下问题:Python DockPanel.setWidth方法的具体用法?Python DockPanel.setWidth怎么用?Python DockPanel.setWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyjamas.ui.DockPanel.DockPanel的用法示例。


在下文中一共展示了DockPanel.setWidth方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setWidth [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)
开发者ID:vizafogo123,项目名称:pokpok,代码行数:37,代码来源:Trees.py

示例2: __init__

# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setWidth [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
开发者ID:brodybits,项目名称:pyjs,代码行数:37,代码来源:TinyMCEditor.py

示例3: __init__

# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setWidth [as 别名]
    def __init__(self):
        Algorithm.__init__(self)
	self.MLAlgorithmService = MLAlgorithmService(self)
        self.image=Image(self.baseURL() + "services/kMeansPictures/lenna.png",Width="320px", Height="360px")
        self.resultImage=Image("",Width="320px", Height="360px")
        self.loadingImage = Image(self.baseURL() + "images/blanksearching.gif")
        self.calculateButton = Button("RUN", self.onButtonClick)
        self.log = Button("SHOW LOG", self.openLogFile)
        self.log.setEnabled(False)

        self.image.addLoadListener(self)
        
        topPanel = DockPanel()
        topPanel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
        topPanel.add(self.calculateButton, DockPanel.WEST)
        topPanel.add(self.loadingImage, DockPanel.CENTER)
        topPanel.add(self.log, DockPanel.EAST)
        
        panel = DockPanel()
        panel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER)
        panel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
        #panel.add(HTML("<h2>Image compression</h2>", True))
        panel.add(topPanel, DockPanel.NORTH)
        panel.add(self.image, DockPanel.WEST)
        panel.add(self.resultImage, DockPanel.EAST)
        
        panel.setWidth("100%")
        self.initWidget(panel)
        self.image.setStyleName("ks-images-Image")
        self.calculateButton.setStyleName("ks-images-Button")
        
        self.loadImage("picturem.png")
开发者ID:aprovodi,项目名称:mlServerCalculations,代码行数:34,代码来源:kMeans.py

示例4: __init__

# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setWidth [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
开发者ID:brodybits,项目名称:pyjs,代码行数:27,代码来源:Popups.py

示例5: onModuleLoad

# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setWidth [as 别名]
class WebApp:
    def onModuleLoad(self):

        self.remote = DataService()

        #Show the initial screen.
        initToken = History.getToken()
        if initToken and len(initToken):
            if initToken == 'admin':
                RootPanel().add(WebPageEdit(self))
                return
        else:
            initToken = 'index'

        self.dock = DockPanel()
        self.dock.setWidth("100%")
        self.pages = {}
        self.current_page = None
        RootPanel().add(self.dock)

        History.addHistoryListener(self)
        self.onHistoryChanged(initToken)

    def createPage(self, ref, html, title):
        htp = HTMLLinkPanel(html)
        htp.replaceLinks()
        htp.setWidth("100%")
        self.pages[ref] = htp

    def onHistoryChanged(self, token):
        #log.debug("onHistoryChanged %s" % token)
        if self.pages.has_key(token):
            self.setPage(token)
            return
        self.remote.getPageByName(token, self)

    def setPage(self, ref):

        htp = self.pages[ref]
        if htp == self.current_page:
            return
        Window.setTitle(htp.title)
        if self.current_page:
            self.dock.remove(self.current_page)
        self.dock.add(htp, DockPanel.CENTER)
        self.current_page = htp

    def onRemoteResponse(self, response, request_info):
        if (request_info.method == 'getPageByName' or
           request_info.method == 'getPage'):
            item = response[0]
            html = item['fields']['text']
            token = item['fields']['name']
            self.createPage(token, html, token)
            self.setPage(token)

    def onRemoteError(self, code, message, request_info):
        RootPanel().add(HTML("Server Error or Invalid Response: ERROR " + str(code) + " - " + str(message)))
开发者ID:Afey,项目名称:pyjs,代码行数:60,代码来源:WebPage.py

示例6: onModuleLoad

# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setWidth [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)
开发者ID:Afey,项目名称:pyjs,代码行数:54,代码来源:Mail.py

示例7: __init__

# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setWidth [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%"
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:48,代码来源:InfoDirectory.py

示例8: __init__

# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setWidth [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)
开发者ID:fluidinfo,项目名称:Tickery,代码行数:45,代码来源:Popups.py

示例9: __init__

# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setWidth [as 别名]
  def __init__(self):
    Composite.__init__(self)

    panel = DockPanel(HorizontalAlignment=HasAlignment.ALIGN_CENTER,
                      VerticalAlignment=HasAlignment.ALIGN_MIDDLE)
    panel.setWidth("100%")

    vp = VerticalPanel()

    grid = FlexTable(CellPadding=4, CellSpacing=4)

    hp = HorizontalPanel()

    handle_n = NextHandle(self)
    handle_f = FinishHandle(self)
    handle_c = ClearHandle(self)

    self.next   = Button("Next",    handle_n, StyleName='button')
    self.finish = Button("Finish!", handle_f, StyleName='button')
    self.clear  = Button("Clear",   handle_c, StyleName='button')

    hp.add(self.clear)
    hp.add(self.finish)
    hp.add(self.next)
    hp.setWidth("70%")

    vp.add(Label("Content-Based Image Retrieval Using OPF", StyleName='label'))
    vp.add(grid)

    vp.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT)
    vp.add(hp)

    cols = 4
    for i in range(100):
      im = Image('images/cbir/%d.jpg' % random.randint(0, 1000),  Size=("200px", "150px"), StyleName='image-cool')
      grid.setWidget(int(i/cols), i%cols, im)

    panel.add(vp, DockPanel.CENTER)

    self.initWidget(panel)

    self.status = Label()
    vp.add(self.status)
开发者ID:victormatheus,项目名称:cbir_pyjamas,代码行数:45,代码来源:cbir.py

示例10: __init__

# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setWidth [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)
开发者ID:Afey,项目名称:pyjs,代码行数:21,代码来源:HTMLDialog.py

示例11: PopupFrame

# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setWidth [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)
开发者ID:Afey,项目名称:pyjs,代码行数:44,代码来源:Popups.py

示例12: __init__

# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setWidth [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)
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:23,代码来源:Popups.py

示例13: onHistoryChanged

# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setWidth [as 别名]
class Bookreader:

    def onHistoryChanged(self, token):
        info = self.sink_list.find(token)
        if info:
            self.show(info, False)
        else:
            self.showInfo()

    def onModuleLoad(self):
        section = Window.getLocation().getSearchVar("section")
        if not section:
            self.loadChapters()
        else:
            loadSection(section)

    def loadChapters(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")

        #self.nf = NamedFrame("section")
        #self.nf.setWidth("100%")
        #self.nf.setHeight("10000")

        self.sp = ScrollPanel(self.sinkContainer)
        #self.sp = VerticalSplitPanel()
        self.sp.setWidth("100%")
        self.sp.setHeight("100%")

        #self.sp.setTopWidget(self.sinkContainer)
        #self.sp.setBottomWidget(self.nf)
        #self.sp.setSplitPosition(10000) # deliberately high - max out.

        vp = VerticalPanel()
        vp.setWidth("99%")
        vp.setHeight("100%")
        vp.add(self.description)
        vp.add(self.sp)

        authors = [
            ("2008, 2009", "Kenneth Casson Leighton", "[email protected]")
        ]
        for years, name, email in authors:
            authors_html = \
            '&copy; %s <a href="mailto:%s">%s</a><br />' %\
            (years, email, name)
        authors_panel = HTML()
        authors_panel.setStyleName("ks-Authors")
        authors_panel.setHTML(authors_html[:-6])

        left_panel = DockPanel(Height="100%")
        left_panel.add(self.sink_list, DockPanel.NORTH)
        left_panel.add(authors_panel, DockPanel.SOUTH)

        self.description.setStyleName("ks-Intro")

        self.panel.add(left_panel, DockPanel.WEST)
        self.panel.add(vp, DockPanel.CENTER)

        self.panel.setCellVerticalAlignment(self.sink_list,
                                            HasAlignment.ALIGN_TOP)
        self.panel.setCellWidth(vp, "100%")
        self.panel.setCellHeight(vp, "100%")

        Window.addWindowResizeListener(self)

        History.addHistoryListener(self)
        RootPanel().add(self.panel)

        self.onWindowResized(Window.getClientWidth(), Window.getClientHeight())

    def onWindowResized(self, width, height):
        self.panel.setWidth(width-20)
        self.sink_list.resize(width-20, height-130)
        self.sp.setHeight("%dpx" % (height-130))

    def show(self, info, affectHistory):
        if info == self.curInfo:
            return
        self.curInfo = info

        #Logger.write("showing " + info.getName())
        if self.curSink is not None:
            self.curSink.onHide()
            #Logger.write("removing " + self.curSink)
            self.sinkContainer.remove(self.curSink)

        self.curSink = info.getInstance()
        self.sink_list.setSinkSelection(info.getName())
        self.sink_list.sp.setScrollPosition(0)
        self.sink_list.sp.setHorizontalScrollPosition(0)
        self.description.setHTML(info.getDescription())
#.........这里部分代码省略.........
开发者ID:Afey,项目名称:pyjs,代码行数:103,代码来源:Bookreader.py

示例14: onFormLoad

# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setWidth [as 别名]
class WebApp:
    def onFormLoad(self):
        self.fetch = Button("Retrieve", self)
        self.search = TextBox()
        self.submit = Button("Submit", self)
        self.formsvc = FormService()
        self.wanted = WantedService()
        d = {'price': 20, 'name': 'a good car'}
        self.form = Form(getattr(self.formsvc, "itemform"), data=d,
                         listener=self)
        #self.describe(['name', 'description'])
        RootPanel().add(self.form)
        RootPanel().add(self.search)
        RootPanel().add(self.fetch)

    def onRetrieveDone(self, form):
        log.debug("onRetrieveDone: %s" % repr(form))

    def onDescribeDone(self, form):
        form.add_widget("Submit", self.submit)

    def onClick(self, sender):
        if sender == self.fetch:
            key = self.search.getText()
            if not key:
                log.debug("Please enter id")
                return
            key = int(key)
            log.debug("id %d" % key)
            #self.wanted.getItem(key, self)
            self.form.get(id=key)

        if sender == self.submit:
            v = self.form.getValue()
            log.debug("onClick %s" % repr(v))
            if v.get('id', None):
                self.form.update(v)
            else:
                self.form.save(v)
 
    def onErrors(self, form, response):
        log.debug("onErrors %s" % repr(response))
        
    def onSaveDone(self, form, response):
        log.debug("onSave %s" % repr(response))
        
    def onModuleLoad(self):

        self.pages = DataService()

        #Show the initial screen.
        initToken = History().getToken()
        if initToken and len(initToken):
            if initToken == 'admin':
                RootPanel().add(WebPageEdit(self))
                return
        else:
            initToken = 'index'

        self.dock = DockPanel()
        self.dock.setWidth("100%")
        self.pages = {}
        self.current_page = None
        RootPanel().add(self.dock)

        History.addHistoryListener(self)
        self.onHistoryChanged(initToken)

    def createPage(self, ref, html, title):
        htp = HTMLLinkPanel(self, html, title)
        htp.replaceLinks()
        htp.setWidth("100%")
        self.pages[ref] = htp

    def onHistoryChanged(self, token):
        #log.debug("onHistoryChanged %s" % token)
        if self.pages.has_key(token):
            self.setPage(token)
            return
        self.pages.getPageByName(token, self)

    def setPage(self, ref):
        
        htp = self.pages[ref]
        if htp == self.current_page:
            return
        Window.setTitle(htp.title)
        if self.current_page:
            self.dock.remove(self.current_page)
        self.dock.add(htp, DockPanel.CENTER)
        self.current_page = htp

    def onRemoteResponse(self, response, request_info):
        #if (request_info.method == 'getItem'):
        #    data = {'id': response['pk']}
        #    log.debug(repr(response))
        #    self.form.update_values(response)

        if (request_info.method == 'getPageByName' or
           request_info.method == 'getPage'):
#.........这里部分代码省略.........
开发者ID:brodybits,项目名称:pyjs,代码行数:103,代码来源:WebPage.py

示例15: __init__

# 需要导入模块: from pyjamas.ui.DockPanel import DockPanel [as 别名]
# 或者: from pyjamas.ui.DockPanel.DockPanel import setWidth [as 别名]
    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
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:72,代码来源:GChartExample20.py


注:本文中的pyjamas.ui.DockPanel.DockPanel.setWidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。