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


Python FlexTable.setHTML方法代码示例

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


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

示例1: ProblemTab

# 需要导入模块: from pyjamas.ui.FlexTable import FlexTable [as 别名]
# 或者: from pyjamas.ui.FlexTable.FlexTable import setHTML [as 别名]
class ProblemTab(EntityTab):
    def __init__(self,app, pid):
        global gw
        EntityTab.__init__(self, app)
        self.table = FlexTable()
        self.table.setHTML(0, 0, "<b>Implement me</b>")
        self.add("Foo problem "+pid)
开发者ID:antialize,项目名称:djudge,代码行数:9,代码来源:main.py

示例2: LoginDialgoBox

# 需要导入模块: from pyjamas.ui.FlexTable import FlexTable [as 别名]
# 或者: from pyjamas.ui.FlexTable.FlexTable import setHTML [as 别名]
class LoginDialgoBox(DialogBox,RPCBase):
    def __init__(self, app):
        DialogBox.__init__(self)
        self.app = app
        self.table=FlexTable()
        self.table.setText(0, 0, "Please enter username and password")
        self.table.getFlexCellFormatter().setColSpan(0, 0, 2)
        self.table.setText(1, 0, "Username")
        self.handle = TextBox()
        h = getCookie('handle')
        self.handle.setText(h)
        self.table.setWidget(1, 1, self.handle)
        self.table.setText(2, 0, "Password")
        self.pwd = PasswordTextBox()
        self.table.setWidget(2, 1, self.pwd)

        self.table.setHTML(3,0,"")
        self.table.getFlexCellFormatter().setColSpan(3, 0, 2)        
        h = HorizontalPanel()
        self.table.setWidget(4,0, h)
        self.table.getFlexCellFormatter().setColSpan(4, 0, 2)
        h.add(Button("Ok", getattr(self, "onOk")))
        h.add(Button("Cancel", getattr(self, "onClose")))
        h.setSpacing(4)
        self.setHTML("<b>Login</b>")
        self.setWidget(self.table)
        left = (Window.getClientWidth() - 200) / 2
        top = (Window.getClientHeight() - 100) / 2
        self.setPopupPosition(left,top)
    
    def onRemoteResponse(self, response, request_info):
        if response == "invalid_cookie":
            self.show()
        elif response == None or len(response) < 3:
            self.table.setHTML(3,0,"<b>Invalid username or password</b>")
        else:
            self.app.cookie = response[0]
            setCookie('cookie',response[0],1000*60*60*24)
            self.hide()
            self.app.logininit(response[1],response[2])
            
    def onClose(self,env):
        Window.getLocation().setHref("http://www.google.com")

    def onOk(self, env):
        global gw
        setCookie('handle',self.handle.getText(),24*60*60*1000)
        x = self.pwd.getText()
        x = pwhash(x)
        gw.login(self.handle.getText(), x, self)

    def login(self):
        global gw
        if not self.app.cookie:
            self.show()
        else:
            gw.validateCookie(self.app.cookie, self)
开发者ID:antialize,项目名称:djudge,代码行数:59,代码来源:main.py

示例3: FlexTableDemo

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

        self._table = FlexTable(BorderWidth=1, Width="100%")

        cellFormatter = self._table.getFlexCellFormatter()
        rowFormatter = self._table.getRowFormatter()

        self._table.setHTML(0, 0, "<b>Mammals</b>")
        self._table.setText(1, 0, "Cow")
        self._table.setText(1, 1, "Rat")
        self._table.setText(1, 2, "Dog")

        cellFormatter.setColSpan(0, 0, 3)
        cellFormatter.setHorizontalAlignment(0, 0, HasAlignment.ALIGN_CENTER)

        self._table.setWidget(2, 0, Button("Hide", getattr(self, "hideRows")))
        self._table.setText(2, 1, "1,1")
        self._table.setText(2, 2, "2,1")
        self._table.setText(3, 0, "1,2")
        self._table.setText(3, 1, "2,2")

        cellFormatter.setRowSpan(2, 0, 2)
        cellFormatter.setVerticalAlignment(2, 0, HasAlignment.ALIGN_MIDDLE)

        self._table.setWidget(4, 0, Button("Show", getattr(self, "showRows")))

        cellFormatter.setColSpan(4, 0, 3)

        rowFormatter.setVisible(4, False)

        self.add(self._table)


    def hideRows(self, sender):
        rowFormatter = self._table.getRowFormatter()
        rowFormatter.setVisible(2, False)
        rowFormatter.setVisible(3, False)
        rowFormatter.setVisible(4, True)


    def showRows(self, sender):
        rowFormatter = self._table.getRowFormatter()
        rowFormatter.setVisible(2, True)
        rowFormatter.setVisible(3, True)
        rowFormatter.setVisible(4, False)
开发者ID:Afey,项目名称:pyjs,代码行数:49,代码来源:flexTable.py

示例4: __init__

# 需要导入模块: from pyjamas.ui.FlexTable import FlexTable [as 别名]
# 或者: from pyjamas.ui.FlexTable.FlexTable import setHTML [as 别名]
    def __init__(self):
        Sink.__init__(self)
        inner = Grid(10, 5, Width="100%", BorderWidth="1")
        outer = FlexTable(Width="100%", BorderWidth="1")

        outer.setWidget(0, 0, Image(self.baseURL() + "rembrandt/LaMarcheNocturne.jpg"))
        outer.getFlexCellFormatter().setColSpan(0, 0, 2)
        outer.getFlexCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER)

        outer.setHTML(1, 0, "Look to the right...<br>That's a nested table component ->")
        outer.setWidget(1, 1, inner)
        outer.getCellFormatter().setColSpan(1, 1, 2)
        
        for i in range(10):
            for j in range(5):
                inner.setText(i, j, "%d" % i + ",%d" % j)

        self.initWidget(outer)
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:20,代码来源:Tables.py

示例5: UsersTab

# 需要导入模块: from pyjamas.ui.FlexTable import FlexTable [as 别名]
# 或者: from pyjamas.ui.FlexTable.FlexTable import setHTML [as 别名]
class UsersTab(RPCBase):
    def __init__(self,app):
        global gw
        self.app=app
        self.vpanel = VerticalPanel()
        self.vpanel.setWidth("100%")
        self.table = FlexTable()
        self.table.setHTML(0, 0, "<b>ID</b>")
        self.table.setHTML(0, 1, "<b>Handle</b>")
        self.table.setHTML(0, 2, "<b>Name</b>")
        self.vpanel.add(self.table)
        if self.app.admin:
            self.btn = Button("Create User",self.createUser)
            self.vpanel.add(self.btn)
        self.cnt = 1
        gw.listUsers(self)

    def reload(self):
        global gw
        gw.listUsers(self)

    def createUser(self,_):
        UserTab(self.app, -1)

    def userLambda(self,uid):
        return lambda: UserTab(self.app, uid)

    def getRoot(self):
        return self.vpanel

    def onRemoteResponse(self, response, request_info):
        while self.cnt > 1:
            self.cnt -= 1
            self.table.removeRow(self.cnt)

        for line in response:
            l=Hyperlink(line[0])
            l.addClickListener(self.userLambda(line[0]));
            self.table.setWidget(self.cnt, 0, l)
            l=Hyperlink(line[1])
            l.addClickListener(self.userLambda(line[0]));
            self.table.setWidget(self.cnt, 1, l)
            l=Hyperlink(line[2])
            l.addClickListener(self.userLambda(line[0]));
            self.table.setWidget(self.cnt, 2, l)
            self.cnt += 1       
开发者ID:antialize,项目名称:djudge,代码行数:48,代码来源:main.py

示例6: ProblemsTab

# 需要导入模块: from pyjamas.ui.FlexTable import FlexTable [as 别名]
# 或者: from pyjamas.ui.FlexTable.FlexTable import setHTML [as 别名]
class ProblemsTab(RPCBase):
    def __init__(self,app):
        global gw
        self.app=app
        self.vpanel = VerticalPanel()
        self.vpanel.setWidth("100%")
        self.table = FlexTable()
        self.table.setHTML(0, 0, "<b>ID</b>")
        self.table.setHTML(0, 1, "<b>Name</b>")
        self.table.setHTML(0, 2, "<b>Submitted By</b>")
        self.vpanel.add(self.table)
        if self.app.admin:
            self.btn = Button("Upload new problem",self.uploadProblem)
            self.vpanel.add(self.btn)
        self.cnt = 1
        gw.listProblems(self)

    def problemLambda(self, pid):
        return lambda: ProblemTab(self.app, pid)

    def userLambda(self,uid):
        return lambda: UserTab(self.app, uid)

    def uploadProblem(self,_=None):
        UploadProblemTab(self.app)
        
    def getRoot(self):
        return self.vpanel

    def onRemoteResponse(self, response, request_info):
        for line in response:
            l=Hyperlink(line[1])
            l.addClickListener(self.problemLambda(line[1]));
            self.table.setWidget(self.cnt, 0, l)
            l=Hyperlink(line[0])
            l.addClickListener(self.problemLambda(line[1]));
            self.table.setWidget(self.cnt, 1, l)
            l=Hyperlink(line[3])
            l.addClickListener(self.userLambda(line[2]));
            self.table.setWidget(self.cnt, 2, l)
            self.app.submitTab.problem.insertItem(line[0]+" ("+line[1]+")",line[1],-1)
            self.cnt += 1       
开发者ID:antialize,项目名称:djudge,代码行数:44,代码来源:main.py

示例7: MailList

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

#.........这里部分代码省略.........
            if (self.startIndex >= MailItems().getMailItemCount()):
                self.startIndex = self.startIndex - MailList.VISIBLE_EMAIL_COUNT
            else:
                self.styleRow(self.selectedRow, False)
                self.selectedRow = -1
                self.update()

        elif (sender == self.newerButton):
            # Move back a page.
            self.startIndex = self.startIndex - MailList.VISIBLE_EMAIL_COUNT
            if (self.startIndex < 0):
                self.startIndex = 0
            else:
                self.styleRow(self.selectedRow, False)
                self.selectedRow = -1
                self.update()

    def initTable(self):
        # Create the header row.
        self.table.setText(0, 0, "sender")
        self.table.setText(0, 1, "email")
        self.table.setText(0, 2, "subject")
        self.table.setWidget(0, 3, self.navBar)
        self.table.getRowFormatter().setStyleName(0, "mail-ListHeader")

        # Initialize the rest of the rows.
        i = 0
        while i < MailList.VISIBLE_EMAIL_COUNT:
            self.table.setText(i + 1, 0, "")
            self.table.setText(i + 1, 1, "")
            self.table.setText(i + 1, 2, "")
            self.table.getCellFormatter().setWordWrap(i + 1, 0, False)
            self.table.getCellFormatter().setWordWrap(i + 1, 1, False)
            self.table.getCellFormatter().setWordWrap(i + 1, 2, False)
            self.table.getFlexCellFormatter().setColSpan(i + 1, 2, 2)
            i = i + 1


    def selectRow(self, row):
        # When a row (other than the first one, which is used as a header) is
        # selected, display its associated MailItem.
        item = MailItems().getMailItem(self.startIndex + row)
        if item is None:
            return

        self.styleRow(self.selectedRow, False)
        self.styleRow(row, True)

        item.read = True
        self.selectedRow = row
        self.mailObject.get().displayItem(item)


    def styleRow(self, row, selected):
        if (row != -1):
            if (selected):
                self.table.getRowFormatter().addStyleName(row + 1, "mail-SelectedRow")
            else:
                self.table.getRowFormatter().removeStyleName(row + 1, "mail-SelectedRow")

    def update(self):
        # Update the older/newer buttons & label.
        count = MailItems().getMailItemCount()
        max = self.startIndex + MailList.VISIBLE_EMAIL_COUNT
        if (max > count):
            max = count

        self.newerButton.setVisible(self.startIndex != 0)
        self.olderButton.setVisible(self.startIndex + MailList.VISIBLE_EMAIL_COUNT < count)
        startIndexPlusOne = self.startIndex + 1
        self.countLabel.setText("%d - %d of %d" % (startIndexPlusOne, max, count))

        # Show the selected emails.
        i = 0
        while (i < MailList.VISIBLE_EMAIL_COUNT):
            # Don't read past the end.
            if (self.startIndex + i >= MailItems().getMailItemCount()):
                break

            item = MailItems().getMailItem(self.startIndex + i)

            # Add a row to the table, then set each of its columns to the
            # email's sender and subject values.

            self.table.setText(i + 1, 0, item.sender)
            self.table.setText(i + 1, 1, item.email)
            self.table.setText(i + 1, 2, item.subject)

            i = i + 1

        # Clear any remaining slots.
        while (i < MailList.VISIBLE_EMAIL_COUNT):
            self.table.setHTML(i + 1, 0, "&nbsp;")
            self.table.setHTML(i + 1, 1, "&nbsp;")
            self.table.setHTML(i + 1, 2, "&nbsp;")
            i = i + 1

        # Select the first row if none is selected.
        if (self.selectedRow == -1):
            self.selectRow(0)
开发者ID:Ludovic-Condette,项目名称:pyjs,代码行数:104,代码来源:MailList.py

示例8: __init__

# 需要导入模块: from pyjamas.ui.FlexTable import FlexTable [as 别名]
# 或者: from pyjamas.ui.FlexTable.FlexTable import setHTML [as 别名]
    def __init__(self, autoHide=None, modal=True, **kwargs):

        PopupPanel.__init__(self, autoHide, modal, **kwargs)

        datasource = None
        id = None

        if kwargs.has_key("datasrc"):
            datasource = kwargs["datasrc"]
        if kwargs.has_key("id"):
            id = kwargs["id"]

        self.setSize(Window.getClientWidth() - 50, Window.getClientHeight() - 50)
        self.setPopupPosition(20, 0)
        DOM.setAttribute(self, "align", "center")

        # self.dbProxInstrucao = DialogBox()
        # self.dbProxInstrucao.setHTML("Alow")
        # botton = Button("Ok")
        # botton.addClickListener(self.onCloseDialog)
        # self.dbProxInstrucao.setWidget(botton)

        self.caption = HTML()
        self.child = None
        self.setHTML("<b>Soma de Matrizes.</b>")

        self.dragging = False
        self.dragStartX = 0
        self.dragStartY = 0

        self.imageFechar = Image("images/fechar.gif", Size=("32px", "32px"), StyleName="gwt-ImageButton")
        self.imgbtnDesfazer = Image("images/previous-arrow.png", Size=("32px", "20px"), StyleName="gwt-ImageButton")
        self.imgbtnFazer = Image("images/next-arrow.png", Size=("32px", "20px"), StyleName="gwt-ImageButton")
        #        self.imgbtnDesfazer.addClickListener(desfazerProxOperacao)
        #        self.imgbtnFazer.addClickListener(fazerProxOperacao)

        self.btnAutomatic = Button("Automático", self.onIniciarAnimacaoAutomatica)
        self.btnInterativo = Button("Interativo")
        if id == "escalar":
            self.btnStepByStep = Button("Passo a passo", IniciarAnimacaoPassoAPasso)
        else:
            self.btnStepByStep = Button("Passo a passo", self.onIniciarAnimacaoPassoAPasso)
        self.btnFazer = Button("fazer >>", fazerProxOperacao)
        # self.btnFazer.setEnabled(False);
        self.btnDesfazer = Button("<< desfazer", desfazerProxOperacao)
        # self.btnDesfazer.setEnabled(False);
        self.btnFechar = PushButton(imageFechar, imageFechar)
        self.btnTestarResposta = Button("Testar Solução")
        self.lbVelocidade = ListBox()
        self.lbVelocidade.setID("lbseg")

        self.lbVelocidade.addItem("0.5 segundo", value=2)
        self.lbVelocidade.addItem("1 segundo", value=1)
        self.lbVelocidade.addItem("2 segundos", value=0.5)
        self.lbVelocidade.addItem("3 segundos", value=1 / 3)
        self.lbVelocidade.addItem("4 segundos", value=0.25)
        self.lbVelocidade.addItem("5 segundos", value=0.20)
        self.lbVelocidade.addItem("6 segundos", value=0.167)
        self.lbVelocidade.addItem("7 segundos", value=0.143)
        self.lbVelocidade.addItem("8 segundos", value=0.125)
        self.lbVelocidade.addItem("10 segundos", value=0.1)

        lblinha1 = ListBox()
        lblinha1.setID("lm1")
        lblinha1.addItem("1", value=1)
        lblinha1.addItem("2", value=2)
        lblinha1.addItem("3", value=3)
        lblinha1.addItem("4", value=4)
        lblinha1.addItem("5", value=5)

        lblinha2 = ListBox()
        lblinha2.setID("lm2")
        lblinha2.addItem("1", value=1)
        lblinha2.addItem("2", value=2)
        lblinha2.addItem("3", value=3)
        lblinha2.addItem("4", value=4)
        lblinha2.addItem("5", value=5)

        lbcoluna1 = ListBox()
        lbcoluna1.setID("cm1")
        lbcoluna1.addItem("1", value=1)
        lbcoluna1.addItem("2", value=2)
        lbcoluna1.addItem("3", value=3)
        lbcoluna1.addItem("4", value=4)
        lbcoluna1.addItem("5", value=5)
        lbcoluna1.addItem("6", value=6)
        lbcoluna1.addItem("7", value=7)

        lbcoluna2 = ListBox()
        lbcoluna2.setID("cm2")
        lbcoluna2.addItem("1", value=1)
        lbcoluna2.addItem("2", value=2)
        lbcoluna2.addItem("3", value=3)
        lbcoluna2.addItem("4", value=4)
        lbcoluna2.addItem("5", value=5)
        lbcoluna2.addItem("6", value=6)
        lbcoluna2.addItem("7", value=7)

        self.lblStatus = Label("Label para Status")

#.........这里部分代码省略.........
开发者ID:nielsonsantana,项目名称:emath,代码行数:103,代码来源:PopupPagina.py

示例9: onModuleLoad

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

        _example_descr=HTML("""This example shows how to validate text using
 a TextBox.  A new class called RegexTextBox, which inherits from TextBox
 validates text, when focus is removed (ie, onblur event).<br>
In the table below, TextBoxes in the 'Valid Text' column contain text 
strings that match that rows regular expression.  TextBoxes in the 'Invalid Text'
column contain strings that violates the same regular expressions.  Feel free
to modify the text to test different values to see if they are valid or not.
<p>""")

        self._table=FlexTable(BorderWidth=0)
        self._table.setStyleName("gwt-table")
        self._setHeaders()

        self._row=1
        for _descr, _regex, _correct, _wrong in self._get_data():
            self._rowHelper(_descr, _regex, _correct, _wrong)
            self._row+=1

        _panel=VerticalPanel()
        _panel.add(_example_descr)
        _panel.add(self._table)
        RootPanel().add(_panel)

    def _setHeaders(self):
        self._table.setHTML(0,0, "<b>Description</b>")
        self._table.setHTML(0,1, "<b>Regex</b>")
        self._table.setHTML(0,2, "<b>Valid Text</b>")
        self._table.setHTML(0,3, "<b>Invalid Text</b>")

    def _rowHelper(self, text, regex, value1, value2):
        self._table.setHTML(self._row, 0, text)
        self._table.setHTML(self._row, 1, regex)

        _rtb=RegexTextBox()
        _rtb.setRegex(regex)
        _rtb.setText(value1)
        _rtb.appendValidListener(display_ok)
        _rtb.appendInvalidListener(display_error)
        _rtb.validate(None)
        self._table.setWidget(self._row, 2, _rtb)

        _rtb1=RegexTextBox()
        _rtb1.setRegex(regex)
        _rtb1.setText(value2)
        _rtb1.appendValidListener(display_ok)
        _rtb1.appendInvalidListener(display_error)
        _rtb1.validate(None)
        self._table.setWidget(self._row, 3, _rtb1)

    def _get_data(self):
        return [['Positive Unsigned Integer', r'^\d+$', '123', '1a2'],
                ['Signed Integer', r'^[+-]?\d+$', '+321', '321-'],
                ['No whitespace', r'^\S+$', 'pyjamas', '1 3'],
                ['Date in (MM/DD/YYYY) format', r'^\d\d/\d\d/\d{4}$', 
                   '12/21/2012', '12-21-2012'],
                ['Non digits', r'^\D+$', 'pyjamas', '1 3'],
               ]  
开发者ID:chopin,项目名称:pyjs,代码行数:62,代码来源:RegexTextBoxDemo.py

示例10: RightGrid

# 需要导入模块: from pyjamas.ui.FlexTable import FlexTable [as 别名]
# 或者: from pyjamas.ui.FlexTable.FlexTable import setHTML [as 别名]
class RightGrid(DockPanel):

    def __init__(self, title):
        DockPanel.__init__(self)
        self.grid = FlexTable()
        title = HTML(title)
        self.add(title, DockPanel.NORTH)
        self.setCellHorizontalAlignment(title,
                                        HasHorizontalAlignment.ALIGN_LEFT)
        self.add(self.grid, DockPanel.CENTER)
        self.grid.setBorderWidth("0px")
        self.grid.setCellSpacing("0px")
        self.grid.setCellPadding("4px")

        self.formatCell(0, 0)
        self.grid.setHTML(0, 0, "&nbsp;")

    def clear_items(self):
        self.index = 0
        self.items = {}

    def set_items(self, items):
        self.items = items
        self.index = 0
        self.max_rows = 0
        self.max_cols = 0
        Timer(1, self)

    def onTimer(self, t):
        count = 0
        while count < 10 and self.index < len(self.items):
            self._add_items(self.index)
            self.index += 1
            count += 1
        if self.index < len(self.items):
            Timer(1, self)

    def _add_items(self, i):

        item = self.items[i]
        command = item[0]
        col = item[1]
        row = item[2]
        data = item[3]

        format_row = -1
        format_col = -1
        if col+1 > self.max_cols:
            format_col = self.max_cols
            #self.grid.resizeColumns(col+1)
            self.max_cols = col+1

        if row+1 >= self.max_rows:
            format_row = self.max_rows
            #self.grid.resizeRows(row+1)
            self.max_rows = row+1

        if format_row >= 0:
            for k in range(format_row, self.max_rows):
                self.formatCell(k, 0)

        self.formatCell(row, col)

        cf = self.grid.getCellFormatter()

        if command == 'data':
            self.grid.setHTML(row, col, data)
        elif command == 'cellstyle':
            data = space_split(data)
            attr = data[0]
            val = data[1]
            cf.setStyleAttr(row, col, attr, val)
        elif command == 'align':
            data = space_split(data)
            vert = data[0]
            horiz = data[1]
            if vert != '-':
                cf.setVerticalAlignment(row, col, vert)
            if horiz != '-':
                cf.setHorizontalAlignment(row, col, horiz)
        elif command == 'cellspan':
            data = space_split(data)
            rowspan = data[0]
            colspan = data[1]
            if colspan != '-':
                cf.setColSpan(row, col, colspan)
            if rowspan != '-':
                cf.setRowSpan(row, col, rowspan)

    def formatCell(self, row, col):
        self.grid.prepareCell(row, col)
        if col == 0 and row != 0:
            self.grid.setHTML(row, col, "%d" % row)
        if row != 0 and col != 0:
            #self.grid.setHTML(row, col, "&nbsp;")
            fmt = "rightpanel-cellformat"
        if col == 0 and row == 0:
            fmt = "rightpanel-cellcornerformat"
        elif row == 0:
            fmt = "rightpanel-celltitleformat"
#.........这里部分代码省略.........
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:103,代码来源:InfoDirectory.py

示例11: StatusTab

# 需要导入模块: from pyjamas.ui.FlexTable import FlexTable [as 别名]
# 或者: from pyjamas.ui.FlexTable.FlexTable import setHTML [as 别名]
class StatusTab(RPCBase):
    def __init__(self,app):
        self.app=app
        self.vpanel = VerticalPanel()
        self.vpanel.setWidth("100%")
        self.table = FlexTable()
        self.vpanel.add(self.table)
        btn = Button('Update',self.update)
        self.vpanel.add(btn)
        self.id2row = {}
        self.table.setHTML(0, 0, "<b>Time</b>")
        self.table.setHTML(0, 1, "<b>Problem</b>")
        self.table.setHTML(0, 2, "<b>User</b>")
        self.table.setHTML(0, 3, "<b>Status</b>")
        self.cnt=1
        self.time=None
        #self.update()
        Timer(4000,self)
        
    def onTimer(self, x):
        #self.update()
        Timer(4000,self)

    def update(self,_=None):
        global gw
        gw.listSubmissions(self.time, self)
    
    def problemLambda(self, pid):
        return lambda: ProblemTab(self.app, pid)

    def userLambda(self,uid):
        return lambda: UserTab(self.app, uid)

    def submissionLambda(self,sid):
        return lambda: SubmissionTab(self.app, sid)

    def onRemoteResponse(self, response, request_info):
#0  (x.id,               
#1 x.problem.name, 
#2 x.problem_id, 
#3 x.submitter.handle, 
#4 x.submitter_id,  
#5 status(x.code),
#6 x.judgeTime,
#7 x.submitTime )
        if response:
            for line in response:
                if line[0] in self.id2row:
                    idx =self.cnt- self.id2row[line[0]]
                    #alert(self.id2row[line[0]] + " " + idx + " " + self.cnt);
                    #return
                else:
                    idx = 1
                    self.table.insertRow(1)
                    self.id2row[line[0]] = self.cnt
                    self.cnt += 1          
                #Hyperlink
                self.table.setText(idx, 0, line[7])
                pl=Hyperlink(line[1])
                pl.addClickListener(self.problemLambda(line[2]));
                self.table.setWidget(idx, 1, pl)
                ul=Hyperlink(line[3])
                ul.addClickListener(self.userLambda(line[4]) );
                self.table.setWidget(idx, 2, ul)
                sl=Hyperlink(line[5])
                sl.addClickListener(self.submissionLambda(line[0]))
                self.table.setWidget(idx, 3, sl)
                if line[6] != 'None': self.time = max(self.time, line[6], line[7])
                else: self.time = max(self.time, line[7])

    def getRoot(self):
        return self.vpanel
开发者ID:antialize,项目名称:djudge,代码行数:74,代码来源:main.py


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