def __init__(self, action, myorca): self.action = action self.myorca = myorca self.config = self.myorca.config def cleanUp(*args): if hasattr(__main__,"_KCellsOrca"): getattr(__main__,"_KCellsOrca").finalized() self.action.connect("started(Kross::Action*)", cleanUp) self.action.connect("finalized(Kross::Action*)", cleanUp) self._view = KCells.view() self._setSheet( KCells.currentSheet() ) def selectionChanged(): print "Selection changed" s = KCells.currentSheet() if s: if s.sheetName() != self.sheetName: self._setSheet(s) if self.config.sheetNameOnSheetChanged: self.speakSheetName() else: if self.config.cellNameOnSelectionChanged: self.speakCellName() if self.config.cellValueOnSelectionChanged: self.speakCellValue() self._view.connect("selectionChanged()", selectionChanged)
def speakCellValue(self): sheet = KCells.currentSheet() (x1,y1,x2,y2) = KCells.view().selection() t = sheet.text(x1,y1) self.myorca.speak(t)
def speakSheetName(self): n = KCells.view().sheet() self.myorca.speak(n)
def speakCellName(self): sheet = KCells.currentSheet() (x1,y1,x2,y2) = KCells.view().selection() p1 = sheet.cellName(x1,y1) self.myorca.speak(p1)