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


Python TextArea.setText方法代码示例

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


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

示例1: WritePanel

# 需要导入模块: from pyjamas.ui.TextArea import TextArea [as 别名]
# 或者: from pyjamas.ui.TextArea.TextArea import setText [as 别名]
class WritePanel(AbsolutePanel):

    def __init__(self, parent):
        AbsolutePanel.__init__(self)
        self.post_header = Label("Write a Post", StyleName="header_label")
        self.post_write_title_label = Label("Title:")
        self.post_title = TextBox()
        self.post_content = TextArea()
        self.post_button = Button("Post")
        self.cancel_button = Button("Cancel")
        self.error_message_label = Label("", StyleName="error_message_label")
        contents = VerticalPanel(StyleName="Contents", Spacing=4)
        contents.add(self.post_header)
        contents.add(self.post_write_title_label)
        contents.add(self.post_title)
        contents.add(self.post_content)
        contents.add(self.post_button)
        contents.add(self.cancel_button)
        contents.add(self.error_message_label)
        self.dialog = DialogBox(glass=True)
        self.dialog.setHTML('<b>Blog Post Form</b>')
        self.dialog.setWidget(contents)
        left = (Window.getClientWidth() - 900) / 2 + Window.getScrollLeft()
        top = (Window.getClientHeight() - 600) / 2 + Window.getScrollTop()
        self.dialog.setPopupPosition(left, top)
        self.dialog.hide()

    def clear_write_panel(self):
        self.post_title.setText("")
        self.post_content.setText("")
        self.error_message_label.setText("")
开发者ID:Afey,项目名称:pyjs,代码行数:33,代码来源:components.py

示例2: EditPanel

# 需要导入模块: from pyjamas.ui.TextArea import TextArea [as 别名]
# 或者: from pyjamas.ui.TextArea.TextArea import setText [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

示例3: onModuleLoad

# 需要导入模块: from pyjamas.ui.TextArea import TextArea [as 别名]
# 或者: from pyjamas.ui.TextArea.TextArea import setText [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

示例4: onModuleLoad

# 需要导入模块: from pyjamas.ui.TextArea import TextArea [as 别名]
# 或者: from pyjamas.ui.TextArea.TextArea import setText [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

示例5: Wiki

# 需要导入模块: from pyjamas.ui.TextArea import TextArea [as 别名]
# 或者: from pyjamas.ui.TextArea.TextArea import setText [as 别名]
class Wiki(KeyboardHandler):
    def __init__(self):
        self.remote = DataService()

        self.title = Label()
        self.h = WikiBox()
        self.t = TextArea()
        self.t.addKeyboardListener(self)
        self.t.addChangeListener(self)
        RootPanel().add(self.title)
        RootPanel().add(self.h)
        RootPanel().add(self.t)
        History.addHistoryListener(self)
        self.name = None
        initToken = History.getToken()
        if not (initToken and len(initToken)):
            initToken = 'welcomepage'
        self.onHistoryChanged(initToken)

    def onHistoryChanged(self,token):
        self.name = token
        self.title.setText('Wiki page for: ' + token)
        self.remote.find_one(token,self)

    def onChange(self, sender):
        if sender == self.t:
            self.remote.insert(self.name,
                    self.t.getText(),
                    self)

    def onRemoteResponse(self, response, request_info): 
        if request_info.method == 'find_one':
            self.h.setHTML(response['content'])
            self.t.setText(response['content'])

    def onRemoteError(self, code, message, request_info):
        log.debug('remote error! ' + str(message))
        log.debug('remote error! ' + str(request_info))

    def onKeyUp(self, sender, keycode, modifiers): 
        if sender == self.t:
            self.h.setHTML(self.t.getText())
开发者ID:brodybits,项目名称:pyjs,代码行数:44,代码来源:Wiki.py

示例6: __init__

# 需要导入模块: from pyjamas.ui.TextArea import TextArea [as 别名]
# 或者: from pyjamas.ui.TextArea.TextArea import setText [as 别名]
 def __init__(self, handle, idx, image, variables = None, code = None, 
              perspective = '', checkOptions = [False, True]):
     VerticalPanel.__init__(self)
     self._handle = handle
     self.idx = idx
     # set style
     self.setStyleName('os-mech-drawing')  
     # create widgets
     self._img = Image(image)
     self._img.setStyleName('os-mech-thumb')
     self._img.addClickListener(self.onClickDrawing)
     self._perspective = '%d - %s'%(idx, perspective.capitalize())
     self._optionPanel = MechOptionPanel(handle, idx, checkOptions)
     textArea  = TextArea(code)
     textArea.setText(code)
     textArea.setStyleName('os-mech-code-locked')
     textArea.setReadonly(self, True)
     # populate drawing
     self.add(self._img)
     self.add(self._optionPanel)
     self.add(textArea)
开发者ID:OneSolver,项目名称:onesolver,代码行数:23,代码来源:Drawing.py

示例7: onRemoteResponse

# 需要导入模块: from pyjamas.ui.TextArea import TextArea [as 别名]
# 或者: from pyjamas.ui.TextArea.TextArea import setText [as 别名]
 def onRemoteResponse(self, response, request_info):
     self.table = FlexTable()
     self.table.setText(0,0, "Problem");
     self.table.setText(0,1, response['problem']);
     self.table.setText(1,0, "Code");
     self.table.setText(1,1, self.trcode(response['code'])+ " ("+response['code']+")");
     self.table.setText(2,0, "Message");
     x = TextArea()
     x.setText(response['message'])
     x.setWidth(600);
     x.setHeight(300);
     pyjamas.DOM.setAttribute(x.getElement(), 'readOnly', 'readonly')
     pyjamas.DOM.setAttribute(x.getElement(), 'readonly', 'readonly')
     self.table.setWidget(2,1,x );
     self.table.setText(3,0, "Source");
     x = TextArea()
     x.setText(response['source'])
     x.setWidth(600);
     x.setHeight(300);
     pyjamas.DOM.setAttribute(x.getElement(), 'readOnly',  'readonly')
     pyjamas.DOM.setAttribute(x.getElement(), 'readonly',  'readonly')
     self.table.setWidget(3,1, x);
     self.add("Submission "+response['id'])
开发者ID:antialize,项目名称:djudge,代码行数:25,代码来源:main.py

示例8: __init__

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

        area1 = TextArea()
        area1.setText("Zakładka 1")

        area2 = TextArea()
        area2.setText("Zakładka 2")

        area3 = TextArea()
        area3.setText("Zakładka 2")

        tabs = TabPanel()
        tabs.add(area2, tabText="Gra nr 1")
        tabs.add(area1, tabText="Pokój gier")
        tabs.add(area3, tabText="Pokój gier")

        self.add (tabs)

        lwindow = LoginWindow(centered=True)
        lwindow.setPopupPosition (100, 100)
        lwindow.show()
开发者ID:marcinn,项目名称:gamezilla,代码行数:25,代码来源:MainWindow.py

示例9: setText

# 需要导入模块: from pyjamas.ui.TextArea import TextArea [as 别名]
# 或者: from pyjamas.ui.TextArea.TextArea import setText [as 别名]
 def setText(self, text):
     TextArea.setText(self, text)
     self.autoHeight()
开发者ID:Afey,项目名称:pyjs,代码行数:5,代码来源:textArea.py

示例10: onModuleLoad

# 需要导入模块: from pyjamas.ui.TextArea import TextArea [as 别名]
# 或者: from pyjamas.ui.TextArea.TextArea import setText [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

示例11: Circuit

# 需要导入模块: from pyjamas.ui.TextArea import TextArea [as 别名]
# 或者: from pyjamas.ui.TextArea.TextArea import setText [as 别名]
class Circuit(object):
    def __init__(self, handle):
        self.log = logging.getConsoleLogger(type(self).__name__, lev)
        self.log.disabled = False
        self.log.debug("__init__: Instantiation")
        self._cacheBreaker = 0
        self._handle = handle
        self.remoteService = DiagramService(handle.spinner)
        labelDisplay = Label("Diagram")
        self.display = HTMLPanel("No circuit created.")
        self.latex = TextArea()

        buttonPanel = HorizontalPanel()

        labelFormatting = Label("Formatting")
        labelCheckbox = Label("Show: ")
        self.checkboxValue = CheckBox("value")
        self.checkboxValue.setID("CBXV1")
        self.checkboxValue.addClickListener(self.onCirctuiTikzClick)
        self.checkboxSymbol = CheckBox("symbol")
        self.checkboxSymbol.setID("CBXS1")
        self.checkboxSymbol.addClickListener(self.onCirctuiTikzClick)
        checkboxPanel = HorizontalPanel()
        checkboxPanel.add(labelCheckbox)
        checkboxPanel.add(self.checkboxSymbol)
        checkboxPanel.add(self.checkboxValue)

        # layout
        self.layout = VerticalPanel(HorizontalAlignment=HasAlignment.ALIGN_LEFT, Spacing=10)
        self.layout.add(labelDisplay)
        self.layout.add(self.display)
        self.layout.add(Label("Circuitikz Markup"))
        self.layout.add(self.latex)
        self.layout.add(buttonPanel)
        self.layout.add(labelFormatting)
        self.layout.add(checkboxPanel)
        RootPanel().add(self.layout)

        # Set Default view
        self.actCircuitTikzLock(lock=True)

    def actClear(self):
        self.latex.setText("")
        self.layout.remove(self.display)
        self.display = HTMLPanel("No circuit created.")
        self.layout.insert(self.display, 1)

    def onMenuResume(self):
        self.remoteService.session_resume(self._handle)

    def onCirctuiTikzClick(self, sender, event):
        sendId = sender.getID()
        if sendId == "CBXV1":
            self.log.debug("click value")
            self.remoteService.change_display(self._handle, "value", self.checkboxValue.getChecked())
        elif sendId == "CBXS1":
            self.log.debug("click symbol")
            self.remoteService.change_display(self._handle, "symbol", self.checkboxSymbol.getChecked())

    def onCircuitTikzSubmit(self):
        self.log.debug("onCircuitTikzSubmit - entry")
        self.remoteService.render_circuitikz(self._handle, self.latex.getText())

    def actCircuitTikzSubmit(self, **kwargs):
        id = kwargs.get("id")
        app = "Circuit"
        sessionId = getCookie("session_id")
        image = "api/image?app=Diagram&tab=Circuit&Id=%d&Cache=%d" % (id, self._cacheBreaker)
        self.layout.remove(self.display)
        self.display = Image(image)
        self.layout.insert(self.display, 1)
        self._cacheBreaker = self._cacheBreaker + 1

    def actCircuitTikzLock(self, **kwargs):
        lock = bool(kwargs.get("lock"))
        self.latex.setReadonly(lock)
        self.latex.setStyleName("os-diagram-code-lock")

    def actCircuitTikzSet(self, **kwargs):
        latex = kwargs["latex"]
        self.latex.setText(latex)

    def actCircuitTikzFail(self):
        pass

    def actCircuitTikzDisplayUpdate(self, **kwargs):
        symbol = kwargs.get("symbol", None)
        value = kwargs.get("value", None)
        if symbol != None:
            self.checkboxSymbol.setChecked(symbol)
        if value != None:
            self.checkboxValue.setChecked(value)
开发者ID:OneSolver,项目名称:onesolver,代码行数:94,代码来源:Circuit.py

示例12: __init__

# 需要导入模块: from pyjamas.ui.TextArea import TextArea [as 别名]
# 或者: from pyjamas.ui.TextArea.TextArea import setText [as 别名]
class SubmitTab:
    def __init__(self,app):
        self.app=app

        self.form = FormPanel()
        self.form.setEncoding("multipart/form-data")
        self.form.setMethod("post")
        
        self.msg = HTML("<b>Uploading</b>")
        self.table = FlexTable()
        self.table.setText(0,0, "Problem")
        self.table.setText(1,0, "Language")
        self.table.setText(2,0, "Program File")
        self.table.setText(3,0, "Program source")
        self.problem = ListBox()
        self.problem.insertItem("Detect",-1,-1)
        self.problem.setName("problem")
        self.table.setWidget(0,1,self.problem)
        
        self.lang = ListBox()
        self.lang.insertItem("Detect","",-1)
        self.lang.insertItem("C/C++","cc",-1)
        self.lang.insertItem("Java","Java",-1)
        self.lang.insertItem("Python","Python",-1)
        self.lang.setName("lang")
        self.table.setWidget(1,1,self.lang)
        self.cookie = Hidden()
        self.cookie.setName("cookie")
        self.table.setWidget(5,0,self.cookie)

        self.file = FileUpload()
        self.file.setName("file");
        self.table.setWidget(2,1,self.file)
        
        self.source = TextArea()
        self.source.setName("source")
        self.source.setWidth("600");
        self.source.setHeight("400");
        self.source.setText("""//$$problem: 1$$
//$$language: cc$$
#include <unistd.h>
#include <stdio.h>
int main() {
  int a,b;
  scanf("%d %d",&a,&b);
  printf("%d\\n",a+b);
  return 0;
}""")
        self.source.addChangeListener(self.onChange)
        self.table.setWidget(3,1,self.source)

        self.button = Button("Submit",self)
        self.table.setWidget(4,1, self.button)
        self.table.setWidget(5,1, self.msg)
        self.msg.setVisible(False)
        self.form.setWidget(self.table)
        self.form.setAction("../upload.py/submit")

        self.form.addFormHandler(self)

    def onChange(self, src):
        if self.source.getText():
            self.file = FileUpload()
            self.file.setName("file");
            self.table.setWidget(2,1,self.file)

    def onSubmitComplete(self,event):
        self.msg.setVisible(False)

    def onSubmit(self,evt):
        self.msg.setVisible(True)
        
    def onClick(self,evt):
        if self.app.cookie == None:
            self.app.login()
        else:
            self.cookie.setValue(self.app.cookie)
            self.form.submit()
        
    def getRoot(self):
        return self.form
开发者ID:antialize,项目名称:djudge,代码行数:83,代码来源:main.py

示例13: EditDialogWindow

# 需要导入模块: from pyjamas.ui.TextArea import TextArea [as 别名]
# 或者: from pyjamas.ui.TextArea.TextArea import setText [as 别名]
class EditDialogWindow(DialogWindow):

    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

    def add_tinymce(self):

        # for storing the results when available
        iframe = DOM.createElement("iframe")
        DOM.setElemAttribute(iframe, "id", "__edit_%s" % self.editor_id)
        DOM.setElemAttribute(iframe, "style", "display:none")
        doc().body.appendChild(iframe)

        # activate tinymce
        new_script = DOM.createElement("script")
        new_script.innerHTML = """
tinyMCE.init({
        // General options
        mode : "textareas",
        theme : "simple",

        // Theme options
        theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,|,table,removeformat",
        theme_advanced_buttons2 : "",
        theme_advanced_buttons3 : "",
        theme_advanced_buttons4 : "",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_resizing : true,
});
"""

        ih = """
var ed = new tinymce.Editor('%s',{
        mode : "none",
        theme : "advanced",
        plugins : "inlinepopups",
        theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,table,image,removeformat",
        theme_advanced_buttons2 : "",
        theme_advanced_buttons3 : "",
        theme_advanced_buttons4 : "",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_resizing : true
});
ed.render();
ed.load();
tinymce.add(ed);
""" % self.editor_id

        print new_script.innerHTML

        DOM.setElemAttribute(new_script, "type", "text/javascript")
        doc().body.appendChild(new_script)

    def load(self, token, fname, data):

        left = 50 # self.fDialogButton.getAbsoluteLeft() + 10
        top = 50 # self.fDialogButton.getAbsoluteTop() + 10
        self.setPopupPosition(left, top)
        self.show()

        self.token = token
        self.fname = fname
        self.msg.setHTML("<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 image '%s':</center>" % fname)
#.........这里部分代码省略.........
开发者ID:brodybits,项目名称:pyjs,代码行数:103,代码来源:TinyMCEditor.py

示例14: __init__

# 需要导入模块: from pyjamas.ui.TextArea import TextArea [as 别名]
# 或者: from pyjamas.ui.TextArea.TextArea import setText [as 别名]

#.........这里部分代码省略.........
                                          StyleName = 'text'))
        self.period_search = ListBox()
        self.period_search.setVisibleItemCount(1)
        self.period_search.addItem("last week")
        self.period_search.addItem("last month")
        self.period_search.addItem("last year")
        self.period_search.addItem("all time")
        self.period_search_panel.add(self.period_search)
        #add the listeners to the appropriate widgets
        self.options.addChangeListener(self)
        self.period_search.addChangeListener(self)
        self.ret_area_scroll = ScrollPanel()
        self.search_panel = HorizontalPanel()
        self.options_panel = VerticalPanel()

    # A change listener for the boxes
    def onChange(self, sender):
        #switch the list box options
        if sender == self.options:
            self.search_panel.remove(self.period_search_panel)
            self.search_panel.remove(self.date_search_panel)
            self.search_panel.remove(self.artist_search_panel)

            index = self.options.getSelectedIndex()

            if index == 0:
                self.search_panel.add(self.artist_search_panel)
                self.search_option = 1
            elif index == 1:
                self.search_panel.add(self.date_search_panel)
                self.search_option = 2
            elif index == 2:
                self.search_panel.add(self.period_search_panel)
                self.search_option = 3

        elif sender == self.period_search:
            index = self.period_search.getSelectedIndex()
            if index == 0:
                self.period_search = "last week"
            elif index == 1:
                self.period_search = "last month"
            elif index == 2:
                self.period_search = "last year"
            elif index == 3:
                self.period_search = "all time"

    #A listener for the text boxes            
    def onInput(self, sender):
        if sender == self.artist_search:
            self.artist = sender.getText()
        elif sender == self.date_search_end:
            self.end_date = sender.getText()
        elif sender == self.date_search_start:
            self.start_date = sender.getText()

    #A listener for the buttons that, when the button is clicked, looks up the results and outputs them
    def get_result(self):
        return_str = " "
        if self.search_option == 1:
            return_str = self.artist
        elif self.search_option == 2:
            return_str = self.start_date
        elif self.search_option ==3:
            return_str = self.period_search
        else:
            return_str = "Find the most played artist, album, or song for a time period, or the number of songs played by a certain artist"
        self.ret_area.setText(return_str)

   
    def onModuleLoad(self):
        #Put together the list of options
        self.options.addItem("Artist")
        self.options.addItem("Date")
        self.options.addItem("Time Span")
        self.options.setVisibleItemCount(3)

        #put the text area together
        self.ret_area_scroll.add(self.ret_area)
        self.ret_area.setText("Find the most played artist, album, or song for a time period, or the number of songs played by a certain artist")
        #put the search items together
        self.search_panel.add(self.artist_search_panel)
        #Put together the options panel
        self.options_panel.add(HTML("Search By:", True, StyleName = 'text'))
        self.options_panel.add(self.options)
        #Add everything to the main panel
        self.panel.add(HTML("WQHS Song Search",True, StyleName = 'header'),
                       DockPanel.NORTH)

        self.panel.add(self.options_panel, DockPanel.WEST)
        
        self.panel.add(self.ret_area_scroll, DockPanel.SOUTH)
        self.panel.setCellHeight(self.ret_area_scroll, "100px")
        self.panel.setCellWidth(self.ret_area_scroll, "300px")

        self.panel.add(self.search_button, DockPanel.EAST)
        
        self.panel.add(self.search_panel, DockPanel.CENTER)
    
        #Associate panel with the HTML host page
        RootPanel().add(self.panel)
开发者ID:jiangl,项目名称:WQHS-Web-Crawler,代码行数:104,代码来源:Widget.py

示例15: Button

# 需要导入模块: from pyjamas.ui.TextArea import TextArea [as 别名]
# 或者: from pyjamas.ui.TextArea.TextArea import setText [as 别名]
    resdict = resgen_core.processconf(inputArea.getText())
    hData = resgen_core.processhorz(resdict, hTemplate, footdict)
    outputArea.setText(hData)

if __name__ == '__main__':
    b = Button("Convert", convert)

    p = HorizontalPanel()
    p.add(inputArea)
    p.add(outputArea)
   
    q = VerticalPanel()
    q.setStyleName("panel")
    q.add(b)
    q.add(p)

   
    q.setHeight("100%")
    q.setWidth("100%")
    p.setHeight("80%")
    p.setWidth("100%")
    inputArea.setHeight("100%")
    inputArea.setWidth("100%")
    outputArea.setHeight("100%")
    outputArea.setWidth("100%")

    inputArea.setText(confDefault)

    RootPanel().add(q)

开发者ID:johnpeck,项目名称:resgen,代码行数:31,代码来源:resgen_web.py


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