Example #1
0
    def abort(self, reason=None):
        """
    Description:
    ------------
    The abort() method of the WritableStream interface aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.

    Related Pages:

      https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/abort
    """
        if reason is None:
            return JsObjects.JsPromise("%s.abort()" % self.varId)

        reason = JsUtils.jsConvertData(reason, None)
        return JsObjects.JsPromise("%s.abort(%s)" % (self.varId, reason))
Example #2
0
    def previousPage(self):
        """
    Description:
    -----------

    Related Pages:

      http://tabulator.info/docs/4.1/page
    """
        return JsObjects.JsPromise("%s.previousPage()" % self.varId)
Example #3
0
    def nextPage(self):
        """
    Description:
    -----------

    http://tabulator.info/docs/4.1/page

    :return:
    """
        return JsObjects.JsPromise("%s.nextPage()" % self.varId)
Example #4
0
    def setPage(self, i):
        """
    Description:
    -----------

    http://tabulator.info/docs/4.1/page

    :param i:
    :return:
    """
        return JsObjects.JsPromise("%s.setPage(%s)" % (self.varId, i))
Example #5
0
    def writer(self):
        """
    Description:
    ------------
    The closed read-only property of the WritableStreamDefaultWriter interface returns a promise that fulfills if the stream becomes closed or the writer's lock is released, or rejects if the stream errors.

    Related Pages:

      https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/closed
    """
        return JsObjects.JsPromise("%s.writer" % self.varId)
Example #6
0
  def close(self):
    """
    Description:
    ------------
    The close() method of the WritableStreamDefaultWriter interface closes the associated writable stream.

    Related Pages:

      https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/close
    """
    return JsObjects.JsPromise("%s.close()" % self.varId)
Example #7
0
    def ready(self):
        """
    Description:
    ------------
    The ready read-only property of the WritableStreamDefaultWriter interface returns a Promise that resolves when the desired size of the stream's internal queue transitions from non-positive to positive, signaling that it is no longer applying backpressure.

    Related Pages:

      https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/ready
    """
        return JsObjects.JsPromise("%s.ready" % self.varId)
Example #8
0
    def deleteRow(self, n):
        """
    You can delete any row in the table using the deleteRow function.
    The first argument is the row you want to delete, it will take any of the standard row component look up options.

    documentation
    http://www.tabulator.info/docs/4.0/update

    :param n:

    :return:
    """
        return JsObjects.JsPromise("%s.deleteRow(%s)" % (self.varId, n))
Example #9
0
    def hideColumn(self, column):
        """
    You can hide a visible column at any point using the hideColumn function. Pass the field name of the column you wish to hide as the first parameter of the function.

    Example
    table.hideColumn("name")

    Documentation
    http://tabulator.info/docs/4.5/columns#addColumn

    :param column:
    """
        column = JsUtils.jsConvertData(column, None)
        return JsObjects.JsPromise("%s.hideColumn(%s)" % (self.varId, column))
Example #10
0
    def write(self, chunk):
        """
    Description:
    ------------
    The write() property of the WritableStreamDefaultWriter interface writes a passed chunk of data to a WritableStream and its underlying sink, then returns a Promise that resolves to indicate the success or failure of the write operation.

    Related Pages:

      https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter/write

    Attributes:
    ----------
    :param chunk: A block of binary data to pass to the WritableStream.
    """
        chunk = JsUtils.jsConvertData(chunk, None)
        return JsObjects.JsPromise("%s.write(%s)" % (self.varId, chunk))
Example #11
0
    def deleteColumn(self, jsData):
        """
    Description:
    -----------
    To permanently remove a column from the table deleteColumn function. This function takes any of the standard column component look up options as its first parameter.

    Documentation
    http://tabulator.info/docs/4.5/columns#delete

    Attributes:
    ----------
    :param jsData:
    """
        return JsObjects.JsPromise(
            "%s.deleteColumn(%s)" %
            (self.varId, JsUtils.jsConvertData(jsData, None)))
Example #12
0
    def showColumn(self, column):
        """
    Description:
    ------------
    You can show a hidden column at any point using the showColumn function. Pass the field name of the column you wish to show as the first parameter of the function.

    Related Pages:

			http://tabulator.info/docs/4.0/columns

    Attributes:
    ----------
    :param column: String. The column name to be displayed
    """
        return JsObjects.JsPromise(
            "%s.showColumn(%s)" %
            (self.varId, JsUtils.jsConvertData(column, None)))
Example #13
0
    def addColumns(self, jsData, before=False, position="", options=None):
        """
    Description:
    -----------

    Attributes:
    ----------
    :param jsData:
    :param before:
    :param position:
    """
        jsData = JsUtils.jsConvertData(jsData, None)
        before = JsUtils.jsConvertData(before, None)
        position = JsUtils.jsConvertData(position, None)
        options = options or {}
        return JsObjects.JsPromise(
            "%s.forEach(function(row){if(typeof row === 'string'){row = Object.assign(%s, {field: row, title: row})}; %s.addColumn(row, %s, %s)})"
            % (jsData, options, self.varId, position, before))
Example #14
0
    def toImage(self, format, htmlCode=None):
        """
    Description:
    ------------
    toImage will generate a promise to an image of the plot in data URL format.

    Related Pages:

      https://plot.ly/javascript/plotlyjs-function-reference/#plotlynewplot

    Attributes:
    ----------
    :param format:
    :param htmlCode: DOM node or string id of a DOM node
    """
        format = JsUtils.jsConvertData(format, None)
        return JsObjects.JsPromise("Plotly.toImage(%s, %s)" %
                                   (htmlCode or self.src.dom.varName, format))
Example #15
0
    def showColumns(self, columna):
        """
    Description:
    ------------
    You can show a hidden columns at any point using the showColumn function. Pass the field name of the column you wish to show as the first parameter of the function.

    Example
    table.showColumna("name")

    Related Pages:

			http://tabulator.info/docs/4.0/columns

    Attributes:
    ----------
    :param columna: List. The column names to be displayed
    """
        return JsObjects.JsPromise(
            "%s.forEach(function(c){%s.showColumn(c)})" %
            (JsUtils.jsConvertData(columna, None), self.varId))
Example #16
0
  def fnc_closure_in_promise(self, data, checkUndefined=False):
    """
    Description:
    ------------
    Base function to allow the creation of a promise.

    A Js promise is an event attached toa function which will be only executed after the function.
    In case of success the then will be triggered otherwise the exception will be caught.

    Attributes:
    ----------
    :param data: String. The Javascript fragment to be added
    :param checkUndefined: Boolean. Add a check on the variable definition

    :return: The promise
    """
    self._js[-1].append(JsObjects.JsPromise(data))
    if checkUndefined:
      self._u[len(self._js) - 1] = checkUndefined
    self._js.append([])
    return data
Example #17
0
    def addColumn(self, jsData, before=False, position=""):
        """
    Description:
    -----------
    If you wish to add a single column to the table, you can do this using the addColumn function

    Example
    table.addColumn({"title": "Age", "field": "age"}, True, "name");

    Documentation
    http://tabulator.info/docs/4.5/columns#addColumn

    Attributes:
    ----------
    :param jsData: The column definition object for the column you want to add
    :param before: Determines how to position the new column.
                   A value of true will insert the column to the left of existing columns, a value of false will insert it to the right
    :param position: The field to insert the new column next to, this can be any of the standard column component look up options.
    """
        jsData = JsUtils.jsConvertData(jsData, None)
        before = JsUtils.jsConvertData(before, None)
        position = JsUtils.jsConvertData(position, None)
        return JsObjects.JsPromise("%s.addColumn(%s, %s, %s)" %
                                   (self.varId, jsData, position, before))
Example #18
0
 def locked(self):
   return JsObjects.JsPromise("%s.locked" % self.varId)