diff options
author | Mark Sims <mark@nanorex.com> | 2008-07-16 15:48:06 +0000 |
---|---|---|
committer | Mark Sims <mark@nanorex.com> | 2008-07-16 15:48:06 +0000 |
commit | 598b797b8874798992bf6d6709931302efa4671a (patch) | |
tree | e16aaa23ef6d4f48959a06751cb06def2df5fdac | |
parent | bb0b3bade32556a1c2a878a73e5cf51fd8714bf8 (diff) | |
download | nanoengineer-theirix-598b797b8874798992bf6d6709931302efa4671a.tar.gz nanoengineer-theirix-598b797b8874798992bf6d6709931302efa4671a.zip |
Replaced the old color chooser widget (a button) with a PM_ColorCombobox widget for Liner and Rotary motors.
5 files changed, 77 insertions, 83 deletions
diff --git a/cad/src/command_support/MotorPropertyManager.py b/cad/src/command_support/MotorPropertyManager.py index a6fdfda51..744632866 100644 --- a/cad/src/command_support/MotorPropertyManager.py +++ b/cad/src/command_support/MotorPropertyManager.py @@ -113,23 +113,18 @@ class MotorPropertyManager(EditCommand_PM): except Exception: print_compact_traceback("Ignored exception while disabling "\ " an action.") - + return + def change_jig_color(self): """ - Slot method to change the jig's color. + Slot method for the ColorComboBox. + @note: This overrides change_jig_color in class MotorPropertyManager. """ - color = QColorDialog.getColor(self.jig_QColor, self) - - if color.isValid(): - self.jig_QColor = color - - ## I intend to implement this once PropMgrColorChooser is complete. - #- Mark 2007-05-28 - #self.jig_color_pixmap = \ - #get_widget_with_color_palette(self.jig_color_pixmap, - #self.jig_QColor) - self.editCommand.struct.color = self.editCommand.struct.normcolor = QColor_to_RGBf(color) - self.glpane.gl_update() + color = self.motorColorComboBox.getColor() + self.editCommand.struct.color = color + self.editCommand.struct.normcolor = color + self.glpane.gl_update() + return def change_motor_size(self, gl_update = True): """ diff --git a/cad/src/commands/LinearMotorProperties/LinearMotorPropertyManager.py b/cad/src/commands/LinearMotorProperties/LinearMotorPropertyManager.py index 9b84eacc3..abf7eba33 100644 --- a/cad/src/commands/LinearMotorProperties/LinearMotorPropertyManager.py +++ b/cad/src/commands/LinearMotorProperties/LinearMotorPropertyManager.py @@ -16,8 +16,7 @@ from PM.PM_GroupBox import PM_GroupBox from PM.PM_DoubleSpinBox import PM_DoubleSpinBox from PM.PM_CheckBox import PM_CheckBox from PM.PM_PushButton import PM_PushButton - -from widgets.widget_helpers import RGBf_to_QColor +from PM.PM_ColorComboBox import PM_ColorComboBox from command_support.MotorPropertyManager import MotorPropertyManager @@ -44,6 +43,7 @@ class LinearMotorPropertyManager(MotorPropertyManager): MotorPropertyManager.__init__( self, win, motorEditCommand) + return def connect_or_disconnect_signals(self, isConnect): """ @@ -72,9 +72,10 @@ class LinearMotorPropertyManager(MotorPropertyManager): change_connect(self.spokeRadiusDblSpinBox, SIGNAL("valueChanged(double)"), self.change_motor_size) - change_connect(self.colorPushButton, - SIGNAL("clicked()"), - self.change_jig_color) + change_connect(self.motorColorComboBox, + SIGNAL("editingFinished()"), + self.change_jig_color) + return def _update_widgets_in_PM_before_show(self): """ @@ -113,9 +114,8 @@ class LinearMotorPropertyManager(MotorPropertyManager): self.motorLengthDblSpinBox.setValue(length) self.motorWidthDblSpinBox.setValue(width) self.spokeRadiusDblSpinBox.setValue(spoke_radius) - self.jig_QColor = RGBf_to_QColor(normcolor) - - + return + def change_motor_size(self, gl_update=True): """ Slot method to change the jig's length, width and/or spoke radius. @@ -126,6 +126,7 @@ class LinearMotorPropertyManager(MotorPropertyManager): self.editCommand.struct.sradius = self.spokeRadiusDblSpinBox.value() if gl_update: self.glpane.gl_update() + return def _loadGroupBox1(self, pmGroupBox): """ @@ -163,7 +164,7 @@ class LinearMotorPropertyManager(MotorPropertyManager): self.enableMinimizeCheckBox = \ PM_CheckBox(pmGroupBox, - text ="Enable in Minimize", + text ="Enable in minimize", widgetColumn = 1 ) self.enableMinimizeCheckBox.setChecked(enable_minimize) @@ -173,8 +174,8 @@ class LinearMotorPropertyManager(MotorPropertyManager): label = "Direction :", text = "Reverse", spanWidth = False) - - + return + def _loadGroupBox2(self, pmGroupBox): """ Load widgets in groubox 2. @@ -194,7 +195,7 @@ class LinearMotorPropertyManager(MotorPropertyManager): self.motorLengthDblSpinBox = \ PM_DoubleSpinBox(pmGroupBox, - label = "Motor Length :", + label = "Motor length :", value = length, setAsDefault = True, minimum = 0.5, @@ -206,7 +207,7 @@ class LinearMotorPropertyManager(MotorPropertyManager): self.motorWidthDblSpinBox = \ PM_DoubleSpinBox(pmGroupBox, - label="Motor Width :", + label="Motor width :", value = width, setAsDefault = True, minimum = 0.1, @@ -218,7 +219,7 @@ class LinearMotorPropertyManager(MotorPropertyManager): self.spokeRadiusDblSpinBox = \ PM_DoubleSpinBox(pmGroupBox, - label = "Spoke Radius :", + label = "Spoke radius :", value = spoke_radius, setAsDefault = True, minimum = 0.1, @@ -227,13 +228,10 @@ class LinearMotorPropertyManager(MotorPropertyManager): decimals = 1, suffix = ' Angstroms') - # Used as default color by Color Chooser - self.jig_QColor = RGBf_to_QColor(normcolor) - - self.colorPushButton = \ - PM_PushButton(pmGroupBox, - label = "Color :", - text = "Choose...") + self.motorColorComboBox = \ + PM_ColorComboBox(pmGroupBox, + color = normcolor) + return def _addWhatsThisText(self): """ @@ -241,11 +239,12 @@ class LinearMotorPropertyManager(MotorPropertyManager): """ from ne1_ui.WhatsThisText_for_PropertyManagers import whatsThis_LinearMotorPropertyManager whatsThis_LinearMotorPropertyManager(self) - - + return + def _addToolTipText(self): """ What's Tool Tip text for widgets in this Property Manager. """ from ne1_ui.ToolTipText_for_PropertyManagers import ToolTip_LinearMotorPropertyManager ToolTip_LinearMotorPropertyManager(self) + return diff --git a/cad/src/commands/RotaryMotorProperties/RotaryMotorPropertyManager.py b/cad/src/commands/RotaryMotorProperties/RotaryMotorPropertyManager.py index 8d3838af2..914c2fb89 100755 --- a/cad/src/commands/RotaryMotorProperties/RotaryMotorPropertyManager.py +++ b/cad/src/commands/RotaryMotorProperties/RotaryMotorPropertyManager.py @@ -21,8 +21,8 @@ from PyQt4.Qt import SIGNAL from PM.PM_DoubleSpinBox import PM_DoubleSpinBox from PM.PM_CheckBox import PM_CheckBox from PM.PM_PushButton import PM_PushButton +from PM.PM_ColorComboBox import PM_ColorComboBox -from widgets.widget_helpers import RGBf_to_QColor from utilities.constants import gray from command_support.MotorPropertyManager import MotorPropertyManager @@ -49,6 +49,7 @@ class RotaryMotorPropertyManager(MotorPropertyManager): MotorPropertyManager.__init__( self, win, motorEditCommand) + return def connect_or_disconnect_signals(self, isConnect): """ @@ -77,9 +78,10 @@ class RotaryMotorPropertyManager(MotorPropertyManager): change_connect(self.spokeRadiusDblSpinBox, SIGNAL("valueChanged(double)"), self.change_motor_size) - change_connect(self.colorPushButton, - SIGNAL("clicked()"), - self.change_jig_color) + change_connect(self.motorColorComboBox, + SIGNAL("editingFinished()"), + self.change_jig_color) + return def _update_widgets_in_PM_before_show(self): """ @@ -124,8 +126,8 @@ class RotaryMotorPropertyManager(MotorPropertyManager): self.motorLengthDblSpinBox.setValue(length) self.motorRadiusDblSpinBox.setValue(radius) self.spokeRadiusDblSpinBox.setValue(spoke_radius) - self.jig_QColor = RGBf_to_QColor(normcolor) - + return + def change_motor_size(self, gl_update = True): """ Slot method to change the jig's length, radius and/or spoke radius. @@ -140,6 +142,7 @@ class RotaryMotorPropertyManager(MotorPropertyManager): if gl_update: self.glpane.gl_update() + return def _loadGroupBox1(self, pmGroupBox): """ @@ -171,7 +174,7 @@ class RotaryMotorPropertyManager(MotorPropertyManager): self.initialSpeedDblSpinBox = \ PM_DoubleSpinBox(pmGroupBox, - label = "Initial Speed :", + label = "Initial speed :", value = initial_speed, setAsDefault = True, minimum = 0.0, @@ -182,7 +185,7 @@ class RotaryMotorPropertyManager(MotorPropertyManager): self.finalSpeedDblSpinBox = \ PM_DoubleSpinBox(pmGroupBox, - label = "Final Speed :", + label = "Final speed :", value = final_speed, setAsDefault = True, minimum = 0.0, @@ -202,7 +205,7 @@ class RotaryMotorPropertyManager(MotorPropertyManager): self.enableMinimizeCheckBox = \ PM_CheckBox(pmGroupBox, - text = "Enable in Minimize", + text = "Enable in minimize", widgetColumn = 0 ) self.enableMinimizeCheckBox.setChecked(enable_minimize) @@ -212,8 +215,7 @@ class RotaryMotorPropertyManager(MotorPropertyManager): label = "Direction :", text = "Reverse", spanWidth = False) - - + return def _loadGroupBox2(self, pmGroupBox): """ @@ -232,7 +234,7 @@ class RotaryMotorPropertyManager(MotorPropertyManager): self.motorLengthDblSpinBox = \ PM_DoubleSpinBox(pmGroupBox, - label = "Motor Length :", + label = "Motor length :", value = length, setAsDefault = True, minimum = 0.5, @@ -243,7 +245,7 @@ class RotaryMotorPropertyManager(MotorPropertyManager): self.motorRadiusDblSpinBox = \ PM_DoubleSpinBox(pmGroupBox, - label="Motor Radius :", + label="Motor radius :", value = radius, setAsDefault = True, minimum = 0.1, @@ -254,7 +256,7 @@ class RotaryMotorPropertyManager(MotorPropertyManager): self.spokeRadiusDblSpinBox = \ PM_DoubleSpinBox(pmGroupBox, - label = "Spoke Radius :", + label = "Spoke radius :", value = spoke_radius, setAsDefault = True, minimum = 0.1, @@ -263,14 +265,10 @@ class RotaryMotorPropertyManager(MotorPropertyManager): decimals = 1, suffix = ' Angstroms') - - # Used as default color by Color Chooser - self.jig_QColor = RGBf_to_QColor(normcolor) - - self.colorPushButton = \ - PM_PushButton(pmGroupBox, - label = "Color :", - text = "Choose...") + self.motorColorComboBox = \ + PM_ColorComboBox(pmGroupBox, + color = normcolor) + return def _addWhatsThisText(self): """ @@ -278,6 +276,7 @@ class RotaryMotorPropertyManager(MotorPropertyManager): """ from ne1_ui.WhatsThisText_for_PropertyManagers import whatsThis_RotaryMotorPropertyManager whatsThis_RotaryMotorPropertyManager(self) + return def _addToolTipText(self): """ @@ -285,5 +284,6 @@ class RotaryMotorPropertyManager(MotorPropertyManager): """ from ne1_ui.ToolTipText_for_PropertyManagers import ToolTip_RotaryMotorPropertyManager ToolTip_RotaryMotorPropertyManager(self) + return diff --git a/cad/src/ne1_ui/ToolTipText_for_PropertyManagers.py b/cad/src/ne1_ui/ToolTipText_for_PropertyManagers.py index 73ac39bce..0351a5a88 100644 --- a/cad/src/ne1_ui/ToolTipText_for_PropertyManagers.py +++ b/cad/src/ne1_ui/ToolTipText_for_PropertyManagers.py @@ -45,26 +45,26 @@ def ToolTip_RotaryMotorPropertyManager(propMgr): "Tool Tip" text for widgets in the Rotary Motor Property Manager. """ - propMgr.torqueDblSpinBox.setToolTip("Motor Torque") + propMgr.torqueDblSpinBox.setToolTip("Motor torque") - propMgr.initialSpeedDblSpinBox.setToolTip("Initial Speed") + propMgr.initialSpeedDblSpinBox.setToolTip("Initial speed") - propMgr.finalSpeedDblSpinBox.setToolTip("Final Speed") + propMgr.finalSpeedDblSpinBox.setToolTip("Final speed") - propMgr.dampersCheckBox.setToolTip("Turn Motor Dampers ON/OFF") + propMgr.dampersCheckBox.setToolTip("Turn motor dampers on/off") - propMgr.enableMinimizeCheckBox.setToolTip("Motor is Enabled During" \ - " Minimizations") + propMgr.enableMinimizeCheckBox.setToolTip("Enable motor during" \ + " minimizations") - propMgr.motorLengthDblSpinBox.setToolTip("Set Motor Length") + propMgr.motorLengthDblSpinBox.setToolTip("Set motor length") - propMgr.motorRadiusDblSpinBox.setToolTip("Set Motor Radius") + propMgr.motorRadiusDblSpinBox.setToolTip("Set motor radius") - propMgr.spokeRadiusDblSpinBox.setToolTip("Set Spoke Radius") + propMgr.spokeRadiusDblSpinBox.setToolTip("Set spoke radius") - propMgr.colorPushButton.setToolTip("Change Color") + propMgr.motorColorComboBox.setToolTip("Change motor color") - propMgr.directionPushButton.setToolTip("Rotation Direction") + propMgr.directionPushButton.setToolTip("Set rotation direction") def ToolTip_LinearMotorPropertyManager(propMgr): @@ -73,22 +73,22 @@ def ToolTip_LinearMotorPropertyManager(propMgr): Tool Tip text for widgets in the Linear Motor Property Manager. """ - propMgr.forceDblSpinBox.setToolTip("Motor Force") + propMgr.forceDblSpinBox.setToolTip("Specify motor force") - propMgr.enableMinimizeCheckBox.setToolTip("Motor is Enabled During" \ - " Minimizations") + propMgr.enableMinimizeCheckBox.setToolTip("Enabled motor during" \ + " minimizations") - propMgr.stiffnessDblSpinBox.setToolTip("Stiffness") + propMgr.stiffnessDblSpinBox.setToolTip("Specify stiffness") - propMgr.motorLengthDblSpinBox.setToolTip("Motor Length") + propMgr.motorLengthDblSpinBox.setToolTip("Set motor length") - propMgr.motorWidthDblSpinBox.setToolTip("Motor Width") + propMgr.motorWidthDblSpinBox.setToolTip("Set motor width") - propMgr.spokeRadiusDblSpinBox.setToolTip("Motor Radius") + propMgr.spokeRadiusDblSpinBox.setToolTip("Set motor radius") - propMgr.colorPushButton.setToolTip("Change Color") + propMgr.motorColorComboBox.setToolTip("Change motor color") - propMgr.directionPushButton.setToolTip("Motor Direction") + propMgr.directionPushButton.setToolTip("Set motor direction") def ToolTip_GrapheneGeneratorPropertyManager(propMgr): diff --git a/cad/src/ne1_ui/WhatsThisText_for_PropertyManagers.py b/cad/src/ne1_ui/WhatsThisText_for_PropertyManagers.py index 5eda363d7..cc7949181 100644 --- a/cad/src/ne1_ui/WhatsThisText_for_PropertyManagers.py +++ b/cad/src/ne1_ui/WhatsThisText_for_PropertyManagers.py @@ -1050,10 +1050,10 @@ def whatsThis_RotaryMotorPropertyManager(propMgr): radius of the spokes, measured in angstroms. </p>""") - propMgr.colorPushButton.setWhatsThis( + propMgr.motorColorComboBox.setWhatsThis( """<b>Color</b> <p> - Allows you to change the color of the motor body and spokes + Changes the color of the motor. </p>""") propMgr.directionPushButton.setWhatsThis( @@ -1116,10 +1116,10 @@ def whatsThis_LinearMotorPropertyManager(propMgr): radius of the spokes, measured in angstroms. </p>""") - propMgr.colorPushButton.setWhatsThis( + propMgr.motorColorComboBox.setWhatsThis( """<b>Color</b> <p> - Allows you to change the color of the motor body and spokes + Changes the color of the motor. </p>""") propMgr.directionPushButton.setWhatsThis( |