def cell_changed(self, event: wx.grid.GridEvent): try: self.matrix.set(self.matrix.items[event.GetRow()], self.matrix.items[event.GetCol()], self.GetCellValue(event.GetRow(), event.GetCol())) self.update() self.focus_gain(None) self.GetGrandParent().GetParent().GetParent().proj_saved = False except Exception as e: self.SetCellValue(event.GetRow(), event.GetCol(), event.GetString())
def select_label(self, e: wx.grid.GridEvent): """ Move GridCursor to first cell of selected label rows or columns. :param e: :return: """ if e.GetCol() >= 0: self.SetGridCursor(0, e.GetCol()) elif e.GetRow() >= 0: self.SetGridCursor(e.GetRow(), 0) print(self.GetSelectionBlockTopLeft()) self.Layout() e.Skip() # do default event.
def _onCellSelected(self, event: wx.grid.GridEvent): row = event.GetRow() col = event.GetCol() self.SelectBlock(row, col, row, col) if self._isSetupRow(row): self._owner.onSetupSelected(row) else: self._owner.onNoSetupSelected()
def _onCellDoubleLeftClick(self, event: wx.grid.GridEvent): row = event.GetRow() col = event.GetCol() if self._grid.IsReadOnly(row, col): self._grid.SelectRow(row) fitId = self._getShip(row).fitId self._onOpenFit(fitId, event.AltDown()) else: event.Skip()
def _onCellLeftClick(self, event: wx.grid.GridEvent): if self._setup is None: return row = event.GetRow() col = event.GetCol() if col == _ACTIVE_COL and self._isShipRow(row): self._getShip(row).toggleActive() self._updateShipRow(row) event.Skip()
def _onCellChanging(self, event: wx.grid.GridEvent): row = event.GetRow() col = event.GetCol() if col == _SHIP_COL: if row == self._addShipRowIndex: # <Add Ship> self._onAddShip(event) elif self._isShipRow(row): self._onShipChanging(event) elif col == _FIT_COL: self._onChoosingFit(event) elif col == _ACTIVE_COL: self._getShip(row).toggleActive() self._updateShipRow(row)