diff options
author | Ninad Sathaye <ninad@nanorex.com> | 2008-07-10 19:59:15 +0000 |
---|---|---|
committer | Ninad Sathaye <ninad@nanorex.com> | 2008-07-10 19:59:15 +0000 |
commit | cbcc84a127c212a13fb35066629c8a43d6a3aa9e (patch) | |
tree | 2c47b2db869618ef2162a080ee192f0653cbfbef | |
parent | aaea3f0cc36f08621dc2e592b38f6aee8172f0c4 (diff) | |
download | nanoengineer-theirix-cbcc84a127c212a13fb35066629c8a43d6a3aa9e.tar.gz nanoengineer-theirix-cbcc84a127c212a13fb35066629c8a43d6a3aa9e.zip |
fixed more cases of color contrast between the background color and line color
9 files changed, 42 insertions, 14 deletions
diff --git a/cad/src/cnt/commands/NanotubeSegment/NanotubeSegment_GraphicsMode.py b/cad/src/cnt/commands/NanotubeSegment/NanotubeSegment_GraphicsMode.py index ec530ecd4..7de8d1cd6 100644 --- a/cad/src/cnt/commands/NanotubeSegment/NanotubeSegment_GraphicsMode.py +++ b/cad/src/cnt/commands/NanotubeSegment/NanotubeSegment_GraphicsMode.py @@ -518,7 +518,7 @@ class NanotubeSegment_GraphicsMode(BuildNanotube_GraphicsMode): beamThickness = 4.0, beam1Color = gray, beam2Color = gray, - stepColor = black ) + ) self._drawCursorText() else: diff --git a/cad/src/cnt/temporary_commands/NanotubeLineMode.py b/cad/src/cnt/temporary_commands/NanotubeLineMode.py index 21f352e68..64010fa9b 100644 --- a/cad/src/cnt/temporary_commands/NanotubeLineMode.py +++ b/cad/src/cnt/temporary_commands/NanotubeLineMode.py @@ -9,7 +9,6 @@ TODO: - User Preferences for different rubberband line display styles """ -import foundation.env as env from temporary_commands.LineMode import LineMode @@ -17,7 +16,6 @@ from graphics.drawing.drawNanotubeLadder import drawNanotubeLadder from utilities.constants import gray, black, darkred, blue, white -from utilities.prefs_constants import DarkBackgroundContrastColor_prefs_key # == GraphicsMode part @@ -92,9 +90,7 @@ class NanotubeLine_GM( LineMode.GraphicsMode_class ): self.glpane.lineOfSight, ladderWidth = self.command.nanotube.getDiameter(), beamThickness = 4.0, - beam1Color = env.prefs[DarkBackgroundContrastColor_prefs_key], - beam2Color = env.prefs[DarkBackgroundContrastColor_prefs_key], - stepColor = env.prefs[DarkBackgroundContrastColor_prefs_key] ) + ) # == Command part class NanotubeLineMode(LineMode): diff --git a/cad/src/dna/commands/DnaSegment/DnaSegment_GraphicsMode.py b/cad/src/dna/commands/DnaSegment/DnaSegment_GraphicsMode.py index c1b730cb9..62d498423 100644 --- a/cad/src/dna/commands/DnaSegment/DnaSegment_GraphicsMode.py +++ b/cad/src/dna/commands/DnaSegment/DnaSegment_GraphicsMode.py @@ -216,7 +216,7 @@ class DnaSegment_GraphicsMode(BuildDna_GraphicsMode): ribbon2_direction = ribbon2_direction, ribbon1Color = ribbon1Color, ribbon2Color = ribbon2Color, - stepColor = black ) + ) #Draw the text next to the cursor that gives info about #number of base pairs etc diff --git a/cad/src/dna/commands/DnaStrand/DnaStrand_GraphicsMode.py b/cad/src/dna/commands/DnaStrand/DnaStrand_GraphicsMode.py index 287212423..4f0777165 100644 --- a/cad/src/dna/commands/DnaStrand/DnaStrand_GraphicsMode.py +++ b/cad/src/dna/commands/DnaStrand/DnaStrand_GraphicsMode.py @@ -64,7 +64,7 @@ class DnaStrand_GraphicsMode(BuildDna_GraphicsMode): ribbon1_direction = ribbon1_direction, ribbonThickness = 4.0, ribbon1Color = ribbon1Color, - stepColor = black ) + ) #Draw the text next to the cursor that gives info about #number of base pairs etc diff --git a/cad/src/dna/temporary_commands/DnaLineMode.py b/cad/src/dna/temporary_commands/DnaLineMode.py index 464e10c33..57e8d7c96 100644 --- a/cad/src/dna/temporary_commands/DnaLineMode.py +++ b/cad/src/dna/temporary_commands/DnaLineMode.py @@ -21,7 +21,6 @@ import foundation.env as env from utilities.prefs_constants import dnaDefaultStrand1Color_prefs_key from utilities.prefs_constants import dnaDefaultStrand2Color_prefs_key -from utilities.prefs_constants import DarkBackgroundContrastColor_prefs_key # == GraphicsMode part @@ -151,7 +150,7 @@ class DnaLine_GM( LineMode_GM ): beamThickness = 4.0, beam1Color = env.prefs[dnaDefaultStrand1Color_prefs_key], beam2Color = env.prefs[dnaDefaultStrand2Color_prefs_key], - stepColor = env.prefs[DarkBackgroundContrastColor_prefs_key] ) + ) elif self.command.callback_rubberbandLineDisplay() == 'Ribbons': #Default dna rubberband line display style drawDnaRibbons(self.glpane, @@ -165,7 +164,7 @@ class DnaLine_GM( LineMode_GM ): ribbonThickness = 4.0, ribbon1Color = env.prefs[dnaDefaultStrand1Color_prefs_key], ribbon2Color = env.prefs[dnaDefaultStrand2Color_prefs_key], - stepColor = env.prefs[DarkBackgroundContrastColor_prefs_key] ) + ) else: pass diff --git a/cad/src/graphics/drawing/drawDnaLadder.py b/cad/src/graphics/drawing/drawDnaLadder.py index 7d799f53d..601986c06 100755 --- a/cad/src/graphics/drawing/drawDnaLadder.py +++ b/cad/src/graphics/drawing/drawDnaLadder.py @@ -8,7 +8,7 @@ beam and each step represents duplex rise. @version: $Id$ @license: GPL """ - +import foundation.env as env from Numeric import pi ONE_RADIAN = 180.0 / pi HALF_PI = pi/2.0 @@ -26,6 +26,7 @@ from graphics.drawing.CS_draw_primitives import drawline from graphics.drawing.drawers import drawPoint from geometry.VQT import norm, vlen, V, cross +from utilities.prefs_constants import DarkBackgroundContrastColor_prefs_key def drawDnaLadder(endCenter1, endCenter2, @@ -73,6 +74,15 @@ def drawDnaLadder(endCenter1, if ladderLength < duplexRise: return + if beam1Color is None: + beam1Color = env.prefs[DarkBackgroundContrastColor_prefs_key] + + if beam2Color is None: + beam2Color = env.prefs[DarkBackgroundContrastColor_prefs_key] + + if stepColor is None: + stepColor = env.prefs[DarkBackgroundContrastColor_prefs_key] + unitVector = norm(endCenter2 - endCenter1) glDisable(GL_LIGHTING) diff --git a/cad/src/graphics/drawing/drawDnaRibbons.py b/cad/src/graphics/drawing/drawDnaRibbons.py index 246fbdab0..618514951 100755 --- a/cad/src/graphics/drawing/drawDnaRibbons.py +++ b/cad/src/graphics/drawing/drawDnaRibbons.py @@ -12,6 +12,7 @@ TODO: It should support various display styles that match with the display of the actual model. """ +import foundation.env as env from math import asin, acos from Numeric import sin, cos, pi @@ -38,6 +39,10 @@ from utilities.constants import white, blue from utilities.constants import diTrueCPK, diTUBES, diLINES from Numeric import dot + + +from utilities.prefs_constants import DarkBackgroundContrastColor_prefs_key + #Constants for drawing the ribbon points as spheres. SPHERE_RADIUS = 1.0 SPHERE_DRAWLEVEL = 2 @@ -149,6 +154,9 @@ def drawDnaSingleRibbon(glpane, #will be rendered in ball and stick display style SPHERE_RADIUS = 1.0 ribbonThickness = 3.0 + + if stepColor is None: + stepColor = env.prefs[DarkBackgroundContrastColor_prefs_key] ribbonLength = vlen(endCenter1 - endCenter2) @@ -415,6 +423,8 @@ def drawDnaRibbons(glpane, #will be rendered in ball and stick display style SPHERE_RADIUS = 1.0 ribbonThickness = 3.0 + + diff --git a/cad/src/graphics/drawing/drawNanotubeLadder.py b/cad/src/graphics/drawing/drawNanotubeLadder.py index ea625f2cf..f42462ad3 100644 --- a/cad/src/graphics/drawing/drawNanotubeLadder.py +++ b/cad/src/graphics/drawing/drawNanotubeLadder.py @@ -7,7 +7,7 @@ Draws the CNT in a ladder display. @version: $Id$ @license: GPL """ - +import foundation.env as env from OpenGL.GL import glDisable from OpenGL.GL import glEnable from OpenGL.GL import GL_LIGHTING @@ -20,6 +20,7 @@ from graphics.drawing.drawers import drawPoint from graphics.drawing.drawers import drawCircle from geometry.VQT import norm, vlen, V, cross +from utilities.prefs_constants import DarkBackgroundContrastColor_prefs_key def drawNanotubeLadder(endCenter1, endCenter2, @@ -76,6 +77,16 @@ def drawNanotubeLadder(endCenter1, unitVector = norm(endCenter2 - endCenter1) + if beam1Color is None: + beam1Color = env.prefs[DarkBackgroundContrastColor_prefs_key] + + if beam2Color is None: + beam2Color = env.prefs[DarkBackgroundContrastColor_prefs_key] + + if stepColor is None: + stepColor = env.prefs[DarkBackgroundContrastColor_prefs_key] + + glDisable(GL_LIGHTING) glPushMatrix() glTranslatef(endCenter1[0], endCenter1[1], endCenter1[2]) diff --git a/cad/src/temporary_commands/LineMode.py b/cad/src/temporary_commands/LineMode.py index f3ddcafd1..627f885dd 100644 --- a/cad/src/temporary_commands/LineMode.py +++ b/cad/src/temporary_commands/LineMode.py @@ -27,6 +27,8 @@ from utilities.constants import black, darkred, blue from geometry.VQT import vlen, norm, angleBetween, V, ptonline +import foundation.env as env +from utilities.prefs_constants import DarkBackgroundContrastColor_prefs_key STARTPOINT_SPHERE_RADIUS = 1.0 STARTPOINT_SPHERE_DRAWLEVEL = 2 @@ -70,7 +72,7 @@ class LineMode_GM( Select_GraphicsMode ): #Rubberband line color - rubberband_line_color = black + rubberband_line_color = env.prefs[DarkBackgroundContrastColor_prefs_key] rubberband_line_width = 1 #thickness or 'width' for drawer.drawline endPoint1_sphereColor = darkred |