def getSelectedColoredLine(self): "Draw the selected line, add it to the items and return the colored line." self.window.cancelTimerResetButtons() coloredLines = self.window.getColoredLines() self.repository.line.value = max(0, self.repository.line.value) if len(coloredLines) < 1: return None self.repository.line.value = min( len(coloredLines) - 1, self.repository.line.value) coloredLine = coloredLines[self.repository.line.value] lineCoordinates = self.canvas.coords( self.window.getDrawnSelectedColoredLine(coloredLine)) end = complex(lineCoordinates[2], lineCoordinates[3]) radiusComplex = complex(16.0, 16.0) upperLeft = end - radiusComplex lowerRight = end + radiusComplex self.canvas.create_oval(int(upperLeft.real), int(upperLeft.imag), int(lowerRight.real), int(lowerRight.imag), tags='mouse_item') settings.setEntryText(self.window.lineEntry, self.repository.line.value) self.window.setLineButtonsState() return coloredLine
def getSelectedColoredLine( self ): "Draw the selected line, add it to the items and return the colored line." self.window.cancelTimerResetButtons() coloredLines = self.window.getColoredLines() self.repository.line.value = max( 0, self.repository.line.value ) if len( coloredLines ) < 1: return None self.repository.line.value = min( len( coloredLines ) - 1, self.repository.line.value ) coloredLine = coloredLines[ self.repository.line.value ] lineCoordinates = self.canvas.coords( self.window.getDrawnSelectedColoredLine( coloredLine ) ) end = complex( lineCoordinates[ 2 ], lineCoordinates[ 3 ] ) radiusComplex = complex( 16.0, 16.0 ) upperLeft = end - radiusComplex lowerRight = end + radiusComplex self.canvas.create_oval ( int( upperLeft.real ), int( upperLeft.imag ), int( lowerRight.real ), int( lowerRight.imag ), tags = 'mouse_item' ) settings.setEntryText( self.window.lineEntry, self.repository.line.value ) self.window.setLineButtonsState() return coloredLine
def setDisplayLayerIndex(self): "Set the display of the layer index entry field and buttons." coloredLines = self.getColoredLines() isAboveFloor = self.repository.layer.value > 0 isBelowCeiling = self.repository.layer.value < len(self.skeinPanes) - 1 setStateNormalDisabled(isAboveFloor, self.diveButton) setStateNormalDisabled(isBelowCeiling, self.soarButton) self.setLineButtonsState() settings.setEntryText(self.layerEntry, self.repository.layer.value) settings.setEntryText(self.lineEntry, self.repository.line.value) settings.setEntryText(self.scaleEntry, self.repository.scale.value) self.mouseTool.update() self.setInsetToDisplay()
def setDisplayLayerIndex( self ): "Set the display of the layer index entry field and buttons." coloredLines = self.getColoredLines() isAboveFloor = self.repository.layer.value > 0 isBelowCeiling = self.repository.layer.value < len( self.skeinPanes ) - 1 setStateNormalDisabled( isAboveFloor, self.diveButton ) setStateNormalDisabled( isBelowCeiling, self.soarButton ) self.setLineButtonsState() settings.setEntryText( self.layerEntry, self.repository.layer.value ) settings.setEntryText( self.lineEntry, self.repository.line.value ) settings.setEntryText( self.scaleEntry, self.repository.scale.value ) self.mouseTool.update() self.setInsetToDisplay()