def setLineButtonsState(self): 'Set the state of the line buttons.' coloredLines = self.getColoredLines() if len(coloredLines) < 1: print( 'Warning, there are no coloredLines in setLineButtonsState in tableau for the layer:' ) print(self.repository.layer.value) return isAboveFloor = self.repository.layer.value > 0 isBelowCeiling = self.repository.layer.value < len(self.skeinPanes) - 1 setStateNormalDisabled(isAboveFloor or self.repository.line.value > 0, self.lineDiveButton) setStateNormalDisabled( isBelowCeiling or self.repository.line.value < len(coloredLines) - 1, self.lineSoarButton) self.repository.line.value = max(self.repository.line.value, 0) self.repository.line.value = min(self.repository.line.value, len(coloredLines) - 1) gcodeString = '' if self.repository.showGcode.value: gcodeString = 'Gcode: ' + coloredLines[ self.repository.line.value].displayString self.gcodeStringVar.set(gcodeString) self.canvas.delete('selection_line') self.getDrawnSelectedColoredLine( coloredLines[self.repository.line.value]) settings.setEntryText(self.lineEntry, self.repository.line.value)
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 setLineButtonsState(self): 'Set the state of the line buttons.' coloredLines = self.getColoredLines() if len(coloredLines) < 1: print('Warning, there are no coloredLines in setLineButtonsState in tableau for the layer:') print(self.repository.layer.value) return isAboveFloor = self.repository.layer.value > 0 isBelowCeiling = self.repository.layer.value < len( self.skeinPanes ) - 1 setStateNormalDisabled( isAboveFloor or self.repository.line.value > 0, self.lineDiveButton ) setStateNormalDisabled( isBelowCeiling or self.repository.line.value < len( coloredLines ) - 1, self.lineSoarButton ) self.repository.line.value = max(self.repository.line.value, 0) self.repository.line.value = min(self.repository.line.value, len(coloredLines) - 1) gcodeString = '' if self.repository.showGcode.value: gcodeString = 'Gcode: ' + coloredLines[self.repository.line.value].displayString self.gcodeStringVar.set(gcodeString) self.canvas.delete('selection_line') self.getDrawnSelectedColoredLine(coloredLines[self.repository.line.value]) settings.setEntryText(self.lineEntry, self.repository.line.value)
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()