Пример #1
0
 def get(self):
     user = users.get_current_user()
     if user:
         user_name = user.nickname()
         user_url = users.create_logout_url("/")
     else:
         self.redirect(users.create_login_url("/"))
         return
     r = Row(name = 'NewRow', owner = user)
     r.put()
     self.redirect('/show')
Пример #2
0
    def to_records(cls):
        columns = Column.count()
        rows = Row.count()

        return [[str(Cell.array[(row, column)]._data)
                 if (row, column) in Cell.array else ""
                 for column in range(columns)] for row in range(rows)]
Пример #3
0
 def execute(self):
     # color = self.color.color.name(QtGui.QColor.HexRgb)
     query = Query(self.input.toPlainText())
     query.execute()
     if query.error == Query.NoError:
         selection = Selection()
         selection.query = query
         DataView.Model.headerDataChanged.emit(Qt.Vertical, 0, Row.count())
Пример #4
0
 def revert(self):
     self.random_sample_widget.setDisabled(True)
     self.case_range_widget.setDisabled(True)
     self.if_condition_btn.setDisabled(True)
     self.filter_variable_line.setDisabled(True)
     self.random_sample_widget.revert()
     # begin = data_view.cell_model.createIndex(0, 0)
     # end = data_view.cell_model.createIndex(100, 10)
     DataView.Model.headerDataChanged.emit(Qt.Vertical, 0, Row.count())
Пример #5
0
    def execute(self):
        r = Row.count()
        approx, exact = RandomSample.Approximately, RandomSample.Exactly
        try:
            if r > 0:
                if self.type == approx:
                    args = range(0, r), int(r * self.percent / 100)

                elif self.type == exact:
                    args = range(0, self._from), self.no
                # print(*args)
                # print("r={}".format(r))
                self.selection = sample(*args)
        except ValueError as e:
            logger.error(e)
Пример #6
0
    def __init__(self, row, column, data=None):
        self.id = len(Cell.array)
        self.row_id = row
        self.column_id = column
        self._data = data

        column_obj = Column.get(column)
        row_obj = Row.get(row)

        if not self.column:
            self.column = Column(column)
        else:
            self.column = column_obj

        if not self.row:
            self.row = Row(row)
        else:
            self.row = row_obj

        Cell.array[(row, column)] = self
Пример #7
0
    def get(self):
        user = users.get_current_user()
        if user:
            user_name = user.nickname()
            user_url = users.create_logout_url("/")
        else:
            self.redirect(users.create_login_url("/"))
            return
        now = datetime.datetime.now()
        now = now.replace(hour = 0, minute = 0,
            second = 0, microsecond = 0)
        rows = []
        rows = Row.all().filter("owner =",user)
        text = 'Now: %s\n' % now
        text += 'User: %s, URL: %s\n' % (user_name, user_url)

        segments = make_segments(now, 15)

        template_rows = make_template_rows(segments, rows)

        self.response.out.write(template.render('templates/lines.html',
                {'text': text, 'segments': segments,
                'template_rows': template_rows, 'user_name': user_name,
                'user_url': user_url}))
Пример #8
0
 def rowCount(self, QModelIndex_parent=None, *args, **kwargs):
     rows_count = Row.count()
     # logger.debug("rows_count={}".format(rows_count))
     return CellModel.Rows
Пример #9
0
 def from_changed(self, value):
     self.selection.random_sample.from_ = value
     DataView.Model.headerDataChanged.emit(Qt.Vertical, 0, Row.count())
     logger.debug(value)
Пример #10
0
 def to_changed(self, value):
     self.selection.range.to = value
     DataView.Model.headerDataChanged.emit(Qt.Vertical, 0, Row.count())
     logger.debug(value)
Пример #11
0
 def row(self):
     return Row.get(self.row_id)