Lines Matching refs:cell
38 self.cells = {} # {(x, y): cell, ...}
40 cell = self.cellvalue,
46 cell = self.getcell(x, y)
47 if hasattr(cell, 'recalc'):
48 return cell.recalc(self.ns)
50 return cell
66 def setcell(self, x, y, cell):
68 assert isinstance(cell, BaseCell)
69 self.cells[x, y] = cell
105 cell = self.cells[x, y]
106 if hasattr(cell, 'renumber'):
107 cell = cell.renumber(x1, y1, x2, y2, dx, dy)
111 new[x, y] = cell
142 for cell in self.cells.values():
143 if hasattr(cell, 'reset'):
144 cell.reset()
148 for cell in self.cells.values():
149 if hasattr(cell, 'recalc'):
150 cell.recalc(self.ns)
166 for (x, y), cell in self.cells.items():
169 if hasattr(cell, 'recalc'):
170 cell.recalc(self.ns)
171 if hasattr(cell, 'format'):
172 text, alignment = cell.format()
176 text = str(cell)
177 if isinstance(cell, str):
204 for (x, y), cell in self.cells.items():
205 if hasattr(cell, 'xml'):
206 cellxml = cell.xml()
208 cellxml = '<value>%s</value>' % escape(cell)
209 out.append('<cell row="%s" col="%s">\n %s\n</cell>' %
286 self.cell = self.value
288 self.cell = StringCell(self.value,
292 self.cell = NumericCell(self.value,
297 self.cell = FormulaCell(text,
302 self.sheet.setcell(self.x, self.y, self.cell)
310 cell.reset() -- prepare for recalculation
311 cell.recalc(ns) -> value -- recalculate formula
312 cell.format() -> (value, alignment) -- return formatted value
313 cell.xml() -> string -- return XML
428 """Translate a formula containing fancy cell names to valid Python code.
431 B4 -> cell(2, 4)
443 s = "cell(%s, %s)" % (x1, y1)
451 "Translate a cell coordinate to a fancy cell name (e.g. (1, 1)->'A1')."
527 # Now create the cell grid
529 # Select the top-left cell
550 cell = self.sheet.getcell(x, y)
551 if cell is None:
553 elif isinstance(cell, FormulaCell):
554 text = '=' + cell.formula
556 text, alignment = cell.format()
569 # Create the top left corner cell (which selects all)
570 cell = Tk.Label(self.cellgrid, relief='raised')
571 cell.grid_configure(column=0, row=0, sticky='NSWE')
572 cell.bind("<ButtonPress-1>", self.selectall)
576 cell = Tk.Label(self.cellgrid, text=colnum2name(x), relief='raised')
577 cell.grid_configure(column=x, row=0, sticky='WE')
578 self.gridcells[x, 0] = cell
579 cell.__x = x
580 cell.__y = 0
581 cell.bind("<ButtonPress-1>", self.selectcolumn)
582 cell.bind("<B1-Motion>", self.extendcolumn)
583 cell.bind("<ButtonRelease-1>", self.extendcolumn)
584 cell.bind("<Shift-Button-1>", self.extendcolumn)
587 cell = Tk.Label(self.cellgrid, text=str(y), relief='raised')
588 cell.grid_configure(column=0, row=y, sticky='WE')
589 self.gridcells[0, y] = cell
590 cell.__x = 0
591 cell.__y = y
592 cell.bind("<ButtonPress-1>", self.selectrow)
593 cell.bind("<B1-Motion>", self.extendrow)
594 cell.bind("<ButtonRelease-1>", self.extendrow)
595 cell.bind("<Shift-Button-1>", self.extendrow)
599 cell = Tk.Label(self.cellgrid, relief='sunken',
601 cell.grid_configure(column=x, row=y, sticky='NSWE')
602 self.gridcells[x, y] = cell
603 cell.__x = x
604 cell.__y = y
606 cell.bind("<ButtonPress-1>", self.press)
607 cell.bind("<B1-Motion>", self.motion)
608 cell.bind("<ButtonRelease-1>", self.release)
609 cell.bind("<Shift-Button-1>", self.release)
662 "Make (x, y) the current cell."
687 for (x, y), cell in self.gridcells.items():
689 cell['bg'] = 'lightBlue'
723 for (x, y), cell in self.gridcells.items():
725 cell['bg'] = 'white'
756 "Set the current cell from the entry widget."
759 cell = None
761 cell = FormulaCell(text[1:])
769 cell = NumericCell(value)
771 if cell is None and text:
772 cell = StringCell(text)
773 if cell is None:
776 self.sheet.setcell(x, y, cell)
785 cell = self.sheet.getcell(x, y)
786 if cell is None:
789 if hasattr(cell, 'format'):
790 text, alignment = cell.format()
792 text, alignment = str(cell), LEFT
803 cell = NumericCell(y)
805 cell = NumericCell(x)
810 cell = FormulaCell(formula)
811 a.setcell(x, y, cell)