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


Python TextArea.setVisibleLines方法代码示例

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


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

示例1: EditPanel

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

示例2: __init__

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

        field = TextArea()
        field.setCharacterWidth(20)
        field.setVisibleLines(4)
        self.add(field)
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:9,代码来源:textArea.py

示例3: Email

# 需要导入模块: from pyjamas.ui.TextArea import TextArea [as 别名]
# 或者: from pyjamas.ui.TextArea.TextArea import setVisibleLines [as 别名]
class Email(Composite):
    def __init__(self, **kwargs):

        element = None
        if kwargs.has_key('Element'):
            element = kwargs.pop('Element')

        panel = VerticalPanel(Element=element)
        Composite.__init__(self, panel, **kwargs)

        self.TEXT_WAITING = "Please wait..."
        self.TEXT_ERROR = "Server Error"

        self.remote_py = EchoServicePython()

        self.status=Label()
        self.subject = TextBox()
        self.subject.setVisibleLength(60)
        self.sender = TextBox()
        self.sender.setVisibleLength(40)
        self.message = TextArea()
        self.message.setCharacterWidth(60)
        self.message.setVisibleLines(15)
        
        self.button_py = Button("Send", self)

        buttons = HorizontalPanel()
        buttons.add(self.button_py)
        buttons.setSpacing(8)
        
        panel.add(HTML("Subject:"))
        panel.add(self.subject)
        panel.add(HTML("From:"))
        panel.add(self.sender)
        panel.add(HTML("Your Message - please keep it to under 1,000 characters"))
        panel.add(self.message)
        panel.add(buttons)
        panel.add(self.status)
        
    def onClick(self, sender):
        self.status.setText(self.TEXT_WAITING)
        text = self.message.getText()
        msg_sender = self.sender.getText()
        msg_subject = self.subject.getText()

        # demonstrate proxy & callMethod()
        if sender == self.button_py:
            id = self.remote_py.send(msg_sender, msg_subject, text, self)
        if id<0:
            self.status.setText(self.TEXT_ERROR)

    def onRemoteResponse(self, response, request_info):
        self.status.setText(response)

    def onRemoteError(self, code, message, request_info):
        self.status.setText("Server Error or Invalid Response: ERROR " + \
                str(code) + " - " + str(message))
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:59,代码来源:Email.py

示例4: __init__

# 需要导入模块: from pyjamas.ui.TextArea import TextArea [as 别名]
# 或者: from pyjamas.ui.TextArea.TextArea import setVisibleLines [as 别名]
    def __init__(self):
        VerticalPanel.__init__(self)
        self.setSpacing("10px")

        field = TextArea()
        field.setCharacterWidth(20)
        field.setVisibleLines(4)
        self.add(field)

        self.add(AutoTextArea(self))
开发者ID:Afey,项目名称:pyjs,代码行数:12,代码来源:textArea.py

示例5: __init__

# 需要导入模块: from pyjamas.ui.TextArea import TextArea [as 别名]
# 或者: from pyjamas.ui.TextArea.TextArea import setVisibleLines [as 别名]
class Editor:
    def __init__(self, db_url, parent_panel):
        self.db_url = db_url
        self.doc_id = None
        self.parent_panel = parent_panel

    def loadDocument(self, doc_id):
        # Load document into editor
        HTTPRequest().asyncGet(None, None, url=self.db_url+doc_id,
                                handler=DocLoader(self))
    def reloadDocument(self):
        if self.doc_id is None:
            Window.Alert('Trying to reload blank doc')
        else:
            self.loadDocument(self.doc_id)

    def updateDoc(self, json):
        doc_obj = JSONParser().decode(json)
        self.doc_id = doc_obj['_id']
        self.id_label.setText('ID : %s'%doc_obj['_id'])
        self.rev_label.setText('REV: %s'%doc_obj['_rev'])
        self.save_button.setEnabled(True)
        self.doc_area.setText(json)
        self.doc_area.setEnabled(True)
        self.doc_area.setFocus(True)

    def saveDocument(self):
        self.doc_area.setEnabled(False)
        self.save_button.setEnabled(False)
        HTTPRequest().asyncPut(None, None, url=self.db_url+self.doc_id,
                                postData=self.doc_area.getText(),
                                handler=DocSaver(self))

    def onModuleLoad(self):
        # Editor
        self.editor_panel = VerticalPanel()
        self.id_label = Label('ID: ')
        self.editor_panel.add(self.id_label)
        self.rev_label = Label('REV: ')
        self.editor_panel.add(self.rev_label)
        self.doc_area = TextArea()
        self.doc_area.setCharacterWidth(80)
        self.doc_area.setVisibleLines(24)
        self.doc_area.setEnabled(False)
        self.editor_panel.add(self.doc_area)
        self.parent_panel.add(self.editor_panel)

        # Buttons
        self.button_panel = HorizontalPanel()
        self.save_button = Button("Save", self.saveDocument)
        self.save_button.setEnabled(False)
        self.button_panel.add(self.save_button)
        self.parent_panel.add(self.button_panel)
开发者ID:CodeSturgeon,项目名称:slipcover,代码行数:55,代码来源:editor.py

示例6: onModuleLoad

# 需要导入模块: from pyjamas.ui.TextArea import TextArea [as 别名]
# 或者: from pyjamas.ui.TextArea.TextArea import setVisibleLines [as 别名]
class CookieExample:
    COOKIE_NAME = "myCookie"

    def onModuleLoad(self):
        try:
            setCookie(COOKIE_NAME, "setme", 100000)
        except:
            pass

        self.status = Label()
        self.text_area = TextArea()
        self.text_area.setText(r"Me eat cookie!")
        self.text_area.setCharacterWidth(80)
        self.text_area.setVisibleLines(8)
        self.button_py_set = Button("Set Cookie", self)
        self.button_py_read = Button("Read Cookie ", self)

        buttons = HorizontalPanel()
        buttons.add(self.button_py_set)
        buttons.add(self.button_py_read)
        buttons.setSpacing(8)
        info = r"This demonstrates setting and reading information using cookies."
        panel = VerticalPanel()
        panel.add(HTML(info))
        panel.add(self.text_area)
        panel.add(buttons)
        panel.add(self.status)

        RootPanel().add(panel)

    def onClick(self, sender):
        """
        Run when any button is clicked
        """
        if sender.getText() == "Set Cookie":
            # clicked the set cookie button
            text = self.text_area.getText()
            # print goes to console.log
            print "setting cookie to:", text
            # Note: this sets the cookie on the top level
            setCookie(COOKIE_NAME, text, 10000, path="/")
        else:
            cookie_text = getCookie(COOKIE_NAME)
            if cookie_text is None:
                print "No Cookie"
            else:
                print "myCookie", cookie_text
                self.status.setText(cookie_text)
开发者ID:janjaapbos,项目名称:pyjs,代码行数:50,代码来源:cookiemonster.py

示例7: onModuleLoad

# 需要导入模块: from pyjamas.ui.TextArea import TextArea [as 别名]
# 或者: from pyjamas.ui.TextArea.TextArea import setVisibleLines [as 别名]
class AMSSnoopStack:
    def onModuleLoad(self):
        global statusbar
        statusbar = Label()
        self.button = Button("Display Current Stack Frames", self)
        self.buttonupdate = Button("Update data from AMS publisher", self)

        buttons = HorizontalPanel()
        buttons.add(self.button)
        buttons.add(self.buttonupdate)
        buttons.setSpacing(8)

        info = """<p>This example demonstrates the calling of the Memory Snooper in PETSc with Pyjamas and <a href="http://json-rpc.org/">JSON-RPC</a>.</p>"""

        self.panel = VerticalPanel()
        self.panel.add(HTML(info))
        self.panel.add(buttons)
        self.panel.add(statusbar)
        RootPanel().add(self.panel)
        self.commobj = AMS.AMS_Comm()
        self.textarea = None

    def onClick(self, sender):
        global statusbar,boxes
        statusbar.setText('Button pressed')
        pass
        if sender == self.buttonupdate:
            self.commobj = AMS.AMS_Comm()
            statusbar.setText('Updating data: Press Display list button to refesh')
        if sender == self.button:
            if AMS.sent > AMS.recv:
               statusbar.setText('Press button again: sent '+str(AMS.sent)+' recv '+str(AMS.recv))
            if self.commobj.commname == 'No AMS publisher running' or not self.commobj.commname or  self.commobj.comm == -1:
               if self.textarea: self.panel.remove(self.textarea)
               pass
            else:
               statusbar.setText('Memories for AMS Comm: '+self.commobj.commname)
               result = self.commobj.get_memory_list()
               if self.textarea: self.panel.remove(self.textarea)
               self.textarea = TextArea()
               memory = self.commobj.memory_attach("Stack")
               size = memory.get_field_info("current size")
               functions = memory.get_field_info("functions")
               funcs = '\n'.join(functions[4])
               self.textarea.setText(str(funcs))
               self.textarea.setVisibleLines(size[4])
               self.panel.add(self.textarea)
开发者ID:00liujj,项目名称:petsc,代码行数:49,代码来源:AMSSnoopStack.py

示例8: onModuleLoad

# 需要导入模块: from pyjamas.ui.TextArea import TextArea [as 别名]
# 或者: from pyjamas.ui.TextArea.TextArea import setVisibleLines [as 别名]
class JSONRPCExample:
    def onModuleLoad(self):
        self.TEXT_WAITING = "Waiting for response..."
        self.TEXT_ERROR = "Server Error"
        self.METHOD_ECHO = "Echo"
        self.METHOD_REVERSE = "Reverse"
        self.METHOD_UPPERCASE = "UPPERCASE"
        self.METHOD_LOWERCASE = "lowercase"
        self.METHOD_NONEXISTANT = "Non existant"
        self.methods = [self.METHOD_ECHO, self.METHOD_REVERSE,
                        self.METHOD_UPPERCASE, self.METHOD_LOWERCASE,
                        self.METHOD_NONEXISTANT]

        self.remote_php = EchoServicePHP()
        self.remote_py = EchoServicePython()

        self.status=Label()
        self.text_area = TextArea()
        self.text_area.setText("""{'Test'} [\"String\"]
\tTest Tab
Test Newline\n
after newline
""" + r"""Literal String:
{'Test'} [\"String\"]
""")
        self.text_area.setCharacterWidth(80)
        self.text_area.setVisibleLines(8)

        self.method_list = ListBox()
        self.method_list.setName("hello")
        self.method_list.setVisibleItemCount(1)
        for method in self.methods:
            self.method_list.addItem(method)
        self.method_list.setSelectedIndex(0)

        method_panel = HorizontalPanel()
        method_panel.add(HTML("Remote string method to call: "))
        method_panel.add(self.method_list)
        method_panel.setSpacing(8)

        self.button_php = Button("Send to PHP Service", self)
        self.button_py = Button("Send to Python Service", self)

        buttons = HorizontalPanel()
        buttons.add(self.button_php)
        buttons.add(self.button_py)
        buttons.setSpacing(8)

        info = """<h2>JSON-RPC Example</h2>
        <p>This example demonstrates the calling of server services with
           <a href="http://json-rpc.org/">JSON-RPC</a>.
        </p>
        <p>Enter some text below, and press a button to send the text
           to an Echo service on your server. An echo service simply sends the exact same text back that it receives.
           </p>"""

        panel = VerticalPanel()
        panel.add(HTML(info))
        panel.add(self.text_area)
        panel.add(method_panel)
        panel.add(buttons)
        panel.add(self.status)

        RootPanel().add(panel)

    def onClick(self, sender):
        self.status.setText(self.TEXT_WAITING)
        method = self.methods[self.method_list.getSelectedIndex()]
        text = self.text_area.getText()

        # demonstrate proxy & callMethod()
        if sender == self.button_php:
            if method == self.METHOD_ECHO:
                id = self.remote_php.echo(text, self)
            elif method == self.METHOD_REVERSE:
                id = self.remote_php.callMethod("reverse", [text], self)
            elif method == self.METHOD_UPPERCASE:
                id = self.remote_php.uppercase(text, self)
            elif method == self.METHOD_LOWERCASE:
                id = self.remote_php.lowercase(self, msg=text)
            elif method == self.METHOD_NONEXISTANT:
                id = self.remote_php.nonexistant(text, self)
        else:
            if method == self.METHOD_ECHO:
                id = self.remote_py.echo(text, self)
            elif method == self.METHOD_REVERSE:
                id = self.remote_py.reverse(text, self)
            elif method == self.METHOD_UPPERCASE:
                id = self.remote_py.uppercase(text, self)
            elif method == self.METHOD_LOWERCASE:
                id = self.remote_py.lowercase(text, self)
            elif method == self.METHOD_NONEXISTANT:
                id = self.remote_py.nonexistant(text, self)

    def onRemoteResponse(self, response, request_info):
        self.status.setText(response)

    def onRemoteError(self, code, errobj, request_info):
        # onRemoteError gets the HTTP error code or 0 and
        # errobj is an jsonrpc 2.0 error dict:
#.........这里部分代码省略.........
开发者ID:chopin,项目名称:pyjs,代码行数:103,代码来源:JSONRPCExample.py

示例9: onRemoteResponse

# 需要导入模块: from pyjamas.ui.TextArea import TextArea [as 别名]
# 或者: from pyjamas.ui.TextArea.TextArea import setVisibleLines [as 别名]
    def onRemoteResponse(self, response, request_info):
        mname = request_info.method
        if mname == "customize_message":
            showCustomizationResult(self, response, request_info)
            return

        if mname == "get_messagesdata_for_cust":
            locations_data = response["locations"]
            selectionbox = VerticalPanel(Padding=3)
            locations = ListBox()
            for (loc_name, loc_id) in locations_data:
                locations.addItem(loc_id, loc_name)
            messages = ListBox()
            messages.setName("locations")
            messages.addItem(location_select_label)
            for (name, d) in response["messages"].items():
                messages.addItem(d['label'], name)

            locations.addChangeListener(self)
            messages.addChangeListener(self)
            self.locations = locations
            self.messages = messages

            locationbox = HorizontalPanel()
            locationbox.add(Label("Location: ", StyleName="text", Width=80))
            locationbox.add(locations)

            msgnamebox = HorizontalPanel()
            msgnamebox.add(Label("Message: ", StyleName="text", Width=80))
            msgnamebox.add(messages)

            selectionbox.add(locationbox)
            selectionbox.add(msgnamebox)

            mainpanel = VerticalPanel(StyleName="dataBoxContent")
            mainpanel.add(selectionbox)
            self.mainpanel = mainpanel
            root = RootPanel()
            root.add(mainpanel)

        if mname == "get_messagecustdata":
            self.messages_data = response
            buttonspanel = FlowPanel(Spacing=1, Padding=1, Width=600)
            #buttonspanel.add(Label("Macros:", StyleName="text"))
            for macro_d in self.messages_data['macros']:
                macrobutton = Button(macro_d['label'], self, StyleName="buttonlikelink")#"nicebutton small")
                macrobutton.name = macro_d['name']
                buttonspanel.add(macrobutton)

            msgpanel = VerticalPanel(Padding=1, Spacing=1)
            messagebox = TextArea()
            messagebox.setCharacterWidth(70)
            height = len(self.messages_data["text"].split('\n')) + 1
            messagebox.setVisibleLines(height)
            messagebox.setText(self.messages_data["text"])
            messagebox.setName("textBoxFormElement")
            self.messagebox = messagebox
            msgpanel.add(messagebox)
            self.statusbar = Label(StyleName="errorMessage")
            msgpanel.add(self.statusbar)
            actionbuttons = HorizontalPanel(Spacing=2)
            updatebutton = Button("Update", self, StyleName="nicebutton small yellow")
            updatebutton.name = "update"
            actionbuttons.add(updatebutton)
            #actionbuttons.add(Button("Send me a preview mail"))
            msgpanel.add(actionbuttons)

            editorbox = VerticalPanel(Padding=1)
            editorbox.add(buttonspanel)
            editorbox.add(msgpanel)
            editorpanel = CaptionPanel("Message editor", editorbox, Padding=1, StyleName="text")
            editorpanel.name = "editorpanel"
            self.editorpanel = editorpanel

            self.mainpanel.add(editorpanel)
开发者ID:mightymau,项目名称:hubspace,代码行数:77,代码来源:messagecust.py

示例10: __init__

# 需要导入模块: from pyjamas.ui.TextArea import TextArea [as 别名]
# 或者: from pyjamas.ui.TextArea.TextArea import setVisibleLines [as 别名]
 def __init__(self, name, help):
     widget = TextArea()
     widget.setCharacterWidth(72)
     widget.setStyleName('form-control')
     widget.setVisibleLines(5)
     Form_Row.__init__(self, name, widget, help=help)
开发者ID:mcsquaredjr,项目名称:Reports,代码行数:8,代码来源:form.py


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