diff options
author | Derrick Hendricks <derrick@nanorex.com> | 2008-09-29 21:03:48 +0000 |
---|---|---|
committer | Derrick Hendricks <derrick@nanorex.com> | 2008-09-29 21:03:48 +0000 |
commit | 647e6261b84cac77d68407778b9721acdde9c868 (patch) | |
tree | 96a515162e85002af4bf2ccfcd541dabcdb15794 | |
parent | 825c1977f6a9cc740b4b507ecc40edb3a38171c9 (diff) | |
download | nanoengineer-647e6261b84cac77d68407778b9721acdde9c868.tar.gz nanoengineer-647e6261b84cac77d68407778b9721acdde9c868.zip |
mods to preferences
-rw-r--r-- | cad/src/experimental/prefs/Preferences.py | 459 | ||||
-rw-r--r-- | cad/src/experimental/prefs/PreferencesDialog.py | 96 |
2 files changed, 488 insertions, 67 deletions
diff --git a/cad/src/experimental/prefs/Preferences.py b/cad/src/experimental/prefs/Preferences.py index cb3d06674..e6c63a9ce 100644 --- a/cad/src/experimental/prefs/Preferences.py +++ b/cad/src/experimental/prefs/Preferences.py @@ -39,7 +39,7 @@ from widgets.widget_helpers import RGBf_to_QColor, QColor_to_RGBf from widgets.widget_helpers import double_fixup from widgets.prefs_widgets import connect_colorpref_to_colorframe, \ connect_checkbox_with_boolean_pref, connect_comboBox_with_pref, \ - connect_doubleSpinBox_with_pref + connect_doubleSpinBox_with_pref, connect_spinBox_with_pref from utilities import debug_flags from utilities.constants import str_or_unicode from platform_dependent.PlatformDependent import screen_pos_size @@ -254,6 +254,8 @@ GDS_INDEXES = [diLINES, diTUBES, diBALL, diTrueCPK, diDNACYLINDER] GDS_NAMES = ["Lines", "Tubes", "Ball and Stick", "CPK", "DNA Cylinder"] GDS_ICONS = ["Lines", "Tubes", "Ball_and_Stick", "CPK", "DNACylinder" ] +from PreferencesDialog import HIGH_ORDER_BOND_STYLES + # Widget constants for the "Colors" page. # HHS = hover highlighting styles @@ -489,11 +491,11 @@ class Preferences(PreferencesDialog): self._setupPage_General() #self._setupPage_Color() self._setupPage_Graphics_Area() - #self._setupPage_ZoomPanRotate() - #self._setupPage_Rulers() - #self._setupPage_Atoms() - #self._setupPage_Bonds() - #self._setupPage_Dna() + self._setupPage_Zoom_Pan_and_Rotate() + self._setupPage_Rulers() + self._setupPage_Atoms() + self._setupPage_Bonds() + self._setupPage_DNA() #self._setupPage_DnaMinorGrooveErrorIndicator() #self._setupPage_DnaBaseOrientationIndicators() #self._setupPage_Adjust() @@ -552,6 +554,34 @@ class Preferences(PreferencesDialog): self.change_pasteOffsetScaleFactorForDnaObjects) return + def setPrefsLogoDownloadPermissions(self, permission): + """ + Set the sponsor logos download permissions in the persistent user + preferences database. + + @param permission: The permission, where: + 0 = Always ask before downloading + 1 = Never ask before downloading + 2 = Never download + @type permission: int + """ + _permanentValue = False + _downloadValue = True + if permission == 1: + _permanentValue = True + _downloadValue = True + + elif permission == 2: + _permanentValue = True + _downloadValue = False + + else: + _permanentValue = False + + env.prefs[sponsor_permanent_permission_prefs_key] = _permanentValue + env.prefs[sponsor_download_permission_prefs_key] = _downloadValue + return + def setGlobalDisplayStyleAtStartUp(self, junk): """ Slot method for the "Global Display Style at Start-up" combo box in @@ -612,23 +642,24 @@ class Preferences(PreferencesDialog): #else: #self.cursor_text_CheckBox.setCheckState(UNCHECKED) #self.cursor_text_enable_fields(CURSOR_TEXT_KEY) - connect_doubleSpinBox_with_pref(self.cursor_text_font_size_SpinBox,cursorTextFontSize_prefs_key) - self.connect(self.cursor_text_reset_Button, SIGNAL("clicked()"), self.cursor_text_font_size_reset) + connect_doubleSpinBox_with_pref(self.cursor_text_font_size_SpinBox, cursorTextFontSize_prefs_key) + self.connect(self.cursor_text_reset_Button, SIGNAL("clicked()"), self.reset_cursor_text_font_size) self.cursor_text_color_ComboBox.setColor(env.prefs[cursorTextColor_prefs_key], default = True) - self.connect(self.cursor_text_color_ComboBox, SIGNAL("editingFinished()"), self.store_cursor_text_color) + self.connect(self.cursor_text_color_ComboBox, SIGNAL("editingFinished()"), self.set_cursor_text_color) # GROUPBOX: Other graphics options groupbox connect_checkbox_with_boolean_pref(self.display_confirmation_corner_CheckBox, displayConfirmationCorner_prefs_key) connect_checkbox_with_boolean_pref(self.anti_aliasing_CheckBox, enableAntiAliasing_prefs_key) return - def cursor_text_font_size_reset(self): + def reset_cursor_text_font_size(self): if not env.prefs.has_default_value(cursorTextFontSize_prefs_key): _tmp = env.prefs.get_default_value(cursorTextFontSize_prefs_key) self.cursor_text_font_size_SpinBox.setValue(_tmp) env.prefs[cursorTextFontSize_prefs_key] = _tmp return - def store_cursor_text_color(self): + + def set_cursor_text_color(self): _newColor = self.cursor_text_color_ComboBox.getColor() env.prefs[cursorTextColor_prefs_key] = _newColor return @@ -654,7 +685,384 @@ class Preferences(PreferencesDialog): env.prefs[displayCompass_prefs_key] = val return - # PAGE: PLUGINS + #PAGE: ZOOM, PAN, AND ROTATE + def _setupPage_Zoom_Pan_and_Rotate(self): + """ + Setup the Zoom, Pan and Rotate page. + """ + # GROUPBOX: View rotation settings + connect_checkbox_with_boolean_pref(self.animate_views_CheckBox, animateStandardViews_prefs_key) + self.view_animation_speed_Slider.setValue(int (env.prefs[animateMaximumTime_prefs_key] * -100)) + self.mouse_rotation_speed_Slider.setValue(int (env.prefs[mouseSpeedDuringRotation_prefs_key] * 100)) + if env.prefs.has_default_value(animateMaximumTime_prefs_key): + self.view_animation_speed_reset_ToolButton.setEnabled(False) + if env.prefs.has_default_value(mouseSpeedDuringRotation_prefs_key): + self.mouse_rotation_speed_reset_ToolButton.setEnabled(False) + self.connect(self.view_animation_speed_Slider, SIGNAL("sliderReleased()"), self.set_view_animation_speed) + self.connect(self.view_animation_speed_reset_ToolButton, SIGNAL("clicked()"), self.reset_view_animation_speed) + self.connect(self.mouse_rotation_speed_Slider, SIGNAL("sliderReleased()"), self.set_mouse_rotation_speed) + self.connect(self.mouse_rotation_speed_reset_ToolButton, SIGNAL("clicked()"), self.reset_mouse_rotation_speed) + + # GROUPBOX: Mouse wheel zoom settings + connect_comboBox_with_pref(self.zoom_directon_ComboBox, mouseWheelDirection_prefs_key) + connect_comboBox_with_pref(self.zoom_in_center_ComboBox, zoomInAboutScreenCenter_prefs_key) + connect_comboBox_with_pref(self.zoom_out_center_ComboBox, zoomOutAboutScreenCenter_prefs_key) + connect_doubleSpinBox_with_pref(self.hover_highlighting_timeout_SpinBox, mouseWheelTimeoutInterval_prefs_key) + return + + def set_view_animation_speed(self): + env.prefs[animateMaximumTime_prefs_key] = \ + self.view_animation_speed_Slider.value() / -100.0 + self.view_animation_speed_reset_ToolButton.setEnabled(True) + return + + def reset_view_animation_speed(self): + env.prefs.restore_defaults([animateMaximumTime_prefs_key]) + self.view_animation_speed_Slider.setValue(int (env.prefs[animateMaximumTime_prefs_key] * -100)) + self.view_animation_speed_reset_ToolButton.setEnabled(False) + + def set_mouse_rotation_speed(self): + env.prefs[mouseSpeedDuringRotation_prefs_key] = \ + self.mouse_rotation_speed_Slider.value() / 100.0 + self.mouse_rotation_speed_reset_ToolButton.setEnabled(True) + return + + def reset_mouse_rotation_speed(self): + env.prefs.restore_defaults([mouseSpeedDuringRotation_prefs_key]) + self.mouse_rotation_speed_Slider.setValue(int (env.prefs[mouseSpeedDuringRotation_prefs_key] * 100)) + self.mouse_rotation_speed_reset_ToolButton.setEnabled(False) + + # PAGE: RULERS + + def _setupPage_Rulers(self): + """ + Setup the "Rulers" page. + """ + # GROUPBOX: Rulers + if env.prefs[displayVertRuler_prefs_key] and env.prefs[displayHorzRuler_prefs_key]: + self.display_rulers_ComboBox.setCurrentIndex(0) + elif not env.prefs[displayHorzRuler_prefs_key]: + self.display_rulers_ComboBox.setCurrentIndex(1) + elif not env.prefs[displayVertRuler_prefs_key]: + self.display_rulers_ComboBox.setCurrentIndex(2) + + self.connect(self.display_rulers_ComboBox, SIGNAL("currentIndexChanged(int)"), self.set_ruler_display) + connect_comboBox_with_pref(self.origin_rulers_ComboBox, rulerPosition_prefs_key) + self.ruler_color_ColorComboBox.setColor(env.prefs[rulerColor_prefs_key], default = True) + self.connect(self.ruler_color_ColorComboBox, SIGNAL("editingFinished()"), self.set_ruler_color) + connect_spinBox_with_pref(self.ruler_opacity_SpinBox, rulerOpacity_prefs_key) + connect_checkbox_with_boolean_pref(self.show_rulers_in_perspective_view_CheckBox,\ + showRulersInPerspectiveView_prefs_key) + return + + def set_ruler_display(self, indx): + if indx == 0: + env.prefs[displayVertRuler_prefs_key] = True + env.prefs[displayHorzRuler_prefs_key] = True + elif indx == 1: + env.prefs[displayVertRuler_prefs_key] = True + env.prefs[displayHorzRuler_prefs_key] = False + else: + env.prefs[displayVertRuler_prefs_key] = False + env.prefs[displayHorzRuler_prefs_key] = True + return + + def set_ruler_color(self): + _newColor = self.ruler_color_ComboBox.getColor() + env.prefs[rulerColor_prefs_key] = _newColor + return + + + # PAGE: ATOMS ============================================================ + def _setupPage_Atoms(self): + """ + Setup the "Atoms" page. + """ + + # "Change Element Colors" button. + self.connect(self.change_element_colors_PushButton, SIGNAL("clicked()"), self.change_element_colors) + + # GROUPBOX: Colors sub + self.atom_highlighting_ColorComboBox.setColor(env.prefs[atomHighlightColor_prefs_key], default = True) + self.connect(self.atom_highlighting_ColorComboBox, SIGNAL("editingFinished()"), self.set_atom_highlighting_color) + self.bondpoint_highlighting_ColorComboBox.setColor(env.prefs[bondpointHighlightColor_prefs_key], default = True) + self.connect(self.bondpoint_highlighting_ColorComboBox, SIGNAL("editingFinished()"), self.set_bondpoint_highlighting_color) + self.bondpoint_hotspots_ColorComboBox.setColor(env.prefs[bondpointHotspotColor_prefs_key], default = True) + self.connect(self.bondpoint_hotspots_ColorComboBox, SIGNAL("editingFinished()"), self.set_bondpoint_hotspots_color) + self.connect(self.restore_element_colors_PushButton, SIGNAL("clicked()"), self.reset_atom_and_bondpoint_colors) + + lod = env.prefs[levelOfDetail_prefs_key] + if lod == -1: + lod = 3 + self.detail_level_ComboBox.setCurrentIndex(lod) + self.connect(self.detail_level_ComboBox, SIGNAL("currentIndexChanged(int)"), self.set_level_of_detail) + self.set_ball_and_stick_atom_scale(env.prefs[diBALL_AtomRadius_prefs_key]) + self.set_CPK_atom_scale(env.prefs[cpkScaleFactor_prefs_key]) + self.ball_and_stick_atom_scale_SpinBox.setValue(round(env.prefs[diBALL_AtomRadius_prefs_key] * 100.0)) + self.CPK_atom_scale_doubleSpinBox.setValue(env.prefs[cpkScaleFactor_prefs_key]) + self.connect(self.ball_and_stick_atom_scale_SpinBox, + SIGNAL("valueChanged(int)"),self.set_ball_and_stick_atom_scale) + self.connect(self.CPK_atom_scale_doubleSpinBox, + SIGNAL("valueChanged(double)"),self.set_CPK_atom_scale) + self.connect(self.ball_and_stick_atom_scale_reset_ToolButton, + SIGNAL("clicked()"),self.reset_ball_and_stick_atom_scale) + self.connect(self.CPK_atom_scale_reset_ToolButton, + SIGNAL("clicked()"),self.reset_CPK_atom_scale) + connect_checkbox_with_boolean_pref(self.overlapping_atom_indicators_CheckBox, + indicateOverlappingAtoms_prefs_key) + connect_checkbox_with_boolean_pref(self.force_to_keep_bonds_during_transmute_CheckBox, + keepBondsDuringTransmute_prefs_key) + return + + def set_atom_highlighting_color(self): + _newColor = self.atom_highlighting_ColorComboBox.getColor() + env.prefs[atomHighlightColor_prefs_key] = _newColor + return + + def set_bondpoint_highlighting_color(self): + _newColor = self.bondpoint_highlighting_ColorComboBox.getColor() + env.prefs[bondpointHighlightColor_prefs_key] = _newColor + return + + def set_bondpoint_hotspots_color(self): + _newColor = self.bondpoint_hotspots_ColorComboBox.getColor() + env.prefs[bondpointHotspotColor_prefs_key] = _newColor + return + + def reset_atom_and_bondpoint_colors(self): + env.prefs.restore_defaults([atomHighlightColor_prefs_key, + bondpointHighlightColor_prefs_key, + bondpointHotspotColor_prefs_key]) + self.atom_highlighting_ColorComboBox.setColor(env.prefs.get_default_value(atomHighlightColor_prefs_key)) + self.bondpoint_highlighting_ColorComboBox.setColor(env.prefs.get_default_value(bondpointHighlightColor_prefs_key)) + self.bondpoint_hotspots_ColorComboBox.setColor(env.prefs.get_default_value(bondpointHotspotColor_prefs_key)) + return + + def change_element_colors(self): + """ + Display the Element Color Settings Dialog. + """ + # Since the prefs dialog is modal, the element color settings dialog must be modal. + self.w.showElementColorSettings(self) + return + + def set_level_of_detail(self, level_of_detail_item): #bruce 060215 revised this + """ + Change the level of detail, where <level_of_detail_item> is a value + between 0 and 3 where: + - 0 = low + - 1 = medium + - 2 = high + - 3 = variable (based on number of atoms in the part) + + @note: the prefs db value for 'variable' is -1, to allow for higher LOD + levels in the future. + """ + lod = level_of_detail_item + if level_of_detail_item == 3: + lod = -1 + env.prefs[levelOfDetail_prefs_key] = lod +# self.glpane.gl_update() + # the redraw this causes will (as of tonight) always recompute the correct drawLevel (in Part._recompute_drawLevel), + # and chunks will invalidate their display lists as needed to accomodate the change. [bruce 060215] + return + + def set_ball_and_stick_atom_scale(self, value): + if env.prefs[diBALL_AtomRadius_prefs_key] != value: + env.prefs[diBALL_AtomRadius_prefs_key] = round(float(value) / 100.0, 2) + if env.prefs.has_default_value(diBALL_AtomRadius_prefs_key): + self.ball_and_stick_atom_scale_reset_ToolButton.setEnabled(False) + else: + self.ball_and_stick_atom_scale_reset_ToolButton.setEnabled(True) + return + + def set_CPK_atom_scale(self, value): + if env.prefs[cpkScaleFactor_prefs_key] != value: + env.prefs[cpkScaleFactor_prefs_key] = value + # direct comparison with has_default_value didn't work on this level + # of precision + if round(env.prefs.get_default_value(cpkScaleFactor_prefs_key), 3 ) \ + == round(value, 3): + self.CPK_atom_scale_reset_ToolButton.setEnabled(False) + else: + self.CPK_atom_scale_reset_ToolButton.setEnabled(True) + return + + def reset_ball_and_stick_atom_scale(self): + _resetValue = env.prefs.get_default_value(diBALL_AtomRadius_prefs_key) + _resetValue = int((_resetValue + .005) * 100) + self.set_ball_and_stick_atom_scale(_resetValue) + self.ball_and_stick_atom_scale_SpinBox.setValue(_resetValue, + blockSignals = True) + return + + def reset_CPK_atom_scale(self): + _resetValue = env.prefs.get_default_value(cpkScaleFactor_prefs_key) + self.set_CPK_atom_scale(_resetValue) + self.CPK_atom_scale_doubleSpinBox.setValue(_resetValue, + blockSignals = True) + return + + # PAGE: BONDS ============================================================ + + def _setupPage_Bonds(self): + """ + Setup the "Bonds" page. + """ + # GROUPBOX Colors + self.bond_highlighting_ColorComboBox.setColor(env.prefs[bondHighlightColor_prefs_key]) + self.connect(self.bond_highlighting_ColorComboBox, SIGNAL("editingFinished()"), self.set_bond_highlighting_color) + self.ball_and_stick_cylinder_ColorComboBox.setColor(env.prefs[diBALL_bondcolor_prefs_key]) + self.connect(self.ball_and_stick_cylinder_ColorComboBox, SIGNAL("editingFinished()"), self.set_ball_and_stick_cylinder_color) + self.bond_stretch_ColorComboBox.setColor(env.prefs[bondStretchColor_prefs_key]) + self.connect(self.bond_stretch_ColorComboBox, SIGNAL("editingFinished()"), self.set_bond_stretch_color) + self.vane_ribbon_ColorComboBox.setColor(env.prefs[bondVaneColor_prefs_key]) + self.connect(self.vane_ribbon_ColorComboBox, SIGNAL("editingFinished()"), self.set_vane_ribbon_color) + self.connect(self.restore_bond_colors_PushButton, SIGNAL("clicked()"), self.reset_default_colors) + # GROUPBOX Miscellaneous bond settings + self.set_ball_and_stick_bond_scale(env.prefs[diBALL_BondCylinderRadius_prefs_key] * 100) + self.set_bond_line_thickness(env.prefs[linesDisplayModeThickness_prefs_key]) + self.ball_and_stick_bond_scale_SpinBox.setValue(round(env.prefs[diBALL_BondCylinderRadius_prefs_key] * 100)) + self.bond_line_thickness_SpinBox.setValue(env.prefs[linesDisplayModeThickness_prefs_key]) + self.connect(self.ball_and_stick_bond_scale_SpinBox, + SIGNAL("valueChanged(int)"),self.set_ball_and_stick_bond_scale) + self.connect(self.bond_line_thickness_SpinBox, + SIGNAL("valueChanged(int)"),self.set_bond_line_thickness) + # GROUPBOX: High order bonds + if env.prefs[pibondStyle_prefs_key] == "multicyl": + _myID = 0 + elif env.prefs[pibondStyle_prefs_key] == "vane": + _myID = 1 + else: + _myID = 2 + _checkedButton = self.high_order_bonds_RadioButtonList.getButtonById(_myID) + _checkedButton.setChecked(True) + self.connect(self.high_order_bonds_RadioButtonList.buttonGroup, SIGNAL("buttonClicked(int)"), self.set_high_order_bonds) + connect_checkbox_with_boolean_pref(self.show_bond_type_letters_CheckBox, pibondLetters_prefs_key) + connect_checkbox_with_boolean_pref(self.show_valence_errors_CheckBox, showValenceErrors_prefs_key) + connect_checkbox_with_boolean_pref(self.show_bond_stretch_indicators_CheckBox, showBondStretchIndicators_prefs_key) + return + + def set_bond_highlighting_color(self): + _newColor = self.bond_highlighting_ColorComboBox.getColor() + env.prefs[bondHighlightColor_prefs_key] = _newColor + return + + def set_ball_and_stick_cylinder_color(self): + _newColor = self.ball_and_stick_cylinder_ColorComboBox.getColor() + env.prefs[diBALL_bondcolor_prefs_key] = _newColor + return + + def set_bond_stretch_color(self): + _newColor = self.bond_stretch_ColorComboBox.getColor() + env.prefs[bondStretchColor_prefs_key] = _newColor + return + + def set_vane_ribbon_color(self): + _newColor = self.vane_ribbon_ColorComboBox.getColor() + env.prefs[bondVaneColor_prefs_key] = _newColor + return + + def reset_default_colors(self): + env.prefs.restore_defaults([bondHighlightColor_prefs_key, + bondStretchColor_prefs_key, + bondVaneColor_prefs_key, + diBALL_bondcolor_prefs_key]) + self.bond_highlighting_ColorComboBox.setColor(env.prefs.get_default_value(bondHighlightColor_prefs_key)) + self.ball_and_stick_cylinder_ColorComboBox.setColor(env.prefs.get_default_value(diBALL_bondcolor_prefs_key)) + self.bond_stretch_ColorComboBox.setColor(env.prefs.get_default_value(bondStretchColor_prefs_key)) + self.vane_ribbon_ColorComboBox.setColor(env.prefs.get_default_value(bondVaneColor_prefs_key)) + return + + def set_ball_and_stick_bond_scale(self, value): + if env.prefs[diBALL_BondCylinderRadius_prefs_key] != value: + env.prefs[diBALL_BondCylinderRadius_prefs_key] = round(float(value) / 100.0, 2) + #if env.prefs.has_default_value(diBALL_BondCylinderRadius_prefs_key): + #self.ball_and_stick_atom_scale_reset_ToolButton.setEnabled(False) + #else: + #self.ball_and_stick_atom_scale_reset_ToolButton.setEnabled(True) + return + + def set_bond_line_thickness(self, value): + if env.prefs[linesDisplayModeThickness_prefs_key] != value: + env.prefs[linesDisplayModeThickness_prefs_key] = value + #if env.prefs.has_default_value(linesDisplayModeThickness_prefs_key): + #self.ball_and_stick_atom_scale_reset_ToolButton.setEnabled(False) + #else: + #self.ball_and_stick_atom_scale_reset_ToolButton.setEnabled(True) + return + + def set_high_order_bonds(self, value): + env.prefs[pibondStyle_prefs_key] = HIGH_ORDER_BOND_STYLES[value][3] + return + + # PAGE: DNA ============================================================== + def _setupPage_DNA(self): + """ + Setup the "DNA" page. + """ + # GROUPBOX: DNA default values + # Uncomment next line when a DB Pref is made for it. + #connect_comboBox_with_pref(self.conformation_ComboBox, <SOME_VALUE>) + + connect_doubleSpinBox_with_pref(self.bases_per_turn_DoubleSpinBox, + bdnaBasesPerTurn_prefs_key) + connect_doubleSpinBox_with_pref(self.rise_DoubleSpinBox, bdnaRise_prefs_key) + self.strand1_ColorComboBox.setColor(env.prefs[dnaDefaultStrand1Color_prefs_key]) + self.connect(self.strand1_ColorComboBox, SIGNAL("editingFinished()"), self.set_strand1_color) + self.strand2_ColorComboBox.setColor(env.prefs[dnaDefaultStrand2Color_prefs_key]) + self.connect(self.strand1_ColorComboBox, SIGNAL("editingFinished()"), self.set_strand2_color) + self.segment_ColorComboBox.setColor(env.prefs[dnaDefaultSegmentColor_prefs_key]) + self.connect(self.segment_ColorComboBox, SIGNAL("editingFinished()"), self.set_segment_color) + self.connect(self.restore_DNA_colors_PushButton, SIGNAL("clicked()"), self.reset_DNA_colors) + # GROUPBOX: Strand arrowhead display options + connect_checkbox_with_boolean_pref(self.show_arrows_on_backbones_CheckBox, + arrowsOnBackBones_prefs_key) + connect_checkbox_with_boolean_pref(self.show_arrows_on_3prime_ends_CheckBox, + arrowsOnThreePrimeEnds_prefs_key) + connect_checkbox_with_boolean_pref(self.show_arrows_on_5prime_ends_CheckBox, + arrowsOnFivePrimeEnds_prefs_key) + self.three_prime_end_custom_ColorComboBox.setColor(env.prefs[dnaStrandThreePrimeArrowheadsCustomColor_prefs_key]) + self.connect(self.three_prime_end_custom_ColorComboBox, SIGNAL("editingFinished()"), self.set_three_prime_end_color) + self.five_prime_end_custom_ColorComboBox.setColor(env.prefs[dnaStrandFivePrimeArrowheadsCustomColor_prefs_key]) + self.connect(self.five_prime_end_custom_ColorComboBox, SIGNAL("editingFinished()"), self.set_five_prime_end_color) + return + + def set_strand1_color(self): + _newColor = self.strand1_ColorComboBox.getColor() + env.prefs[dnaDefaultStrand1Color_prefs_key] = _newColor + return + + def set_strand2_color(self): + _newColor = self.strand2_ColorComboBox.getColor() + env.prefs[dnaDefaultStrand2Color_prefs_key] = _newColor + return + + def set_segment_color(self): + _newColor = self.segment_ColorComboBox.getColor() + env.prefs[dnaDefaultSegmentColor_prefs_key] = _newColor + return + + def reset_DNA_colors(self): + env.prefs.restore_defaults([dnaDefaultStrand1Color_prefs_key, + dnaDefaultStrand2Color_prefs_key, + dnaDefaultSegmentColor_prefs_key]) + self.strand1_ColorComboBox.setColor(env.prefs.get_default_value(dnaDefaultStrand1Color_prefs_key)) + self.strand2_ColorComboBox.setColor(env.prefs.get_default_value(dnaDefaultStrand2Color_prefs_key)) + self.segment_ColorComboBox.setColor(env.prefs.get_default_value(dnaDefaultSegmentColor_prefs_key)) + return + + def set_three_prime_end_color(self): + _newColor = self.three_prime_end_custom_ColorComboBox.getColor() + env.prefs[dnaStrandThreePrimeArrowheadsCustomColor_prefs_key] = _newColor + return + + def set_five_prime_end_color(self): + _newColor = self.five_prime_end_custom_ColorComboBox.getColor() + env.prefs[dnaStrandFivePrimeArrowheadsCustomColor_prefs_key] = _newColor + return + + # PAGE: PLUGINS ========================================================== def _setupPage_Plugins(self): """ Setup the "Plug-ins" page. @@ -713,33 +1121,6 @@ class Preferences(PreferencesDialog): self.connect( self.choosers["Rosetta DB"].lineEdit, SIGNAL("editingFinished()"), self.set_rosetta_db_path) return - def setPrefsLogoDownloadPermissions(self, permission): - """ - Set the sponsor logos download permissions in the persistent user - preferences database. - - @param permission: The permission, where: - 0 = Always ask before downloading - 1 = Never ask before downloading - 2 = Never download - @type permission: int - """ - _permanentValue = False - _downloadValue = True - if permission == 1: - _permanentValue = True - _downloadValue = True - - elif permission == 2: - _permanentValue = True - _downloadValue = False - - else: - _permanentValue = False - - env.prefs[sponsor_permanent_permission_prefs_key] = _permanentValue - env.prefs[sponsor_download_permission_prefs_key] = _downloadValue - return def _hideOrShowWidgets(self): """ diff --git a/cad/src/experimental/prefs/PreferencesDialog.py b/cad/src/experimental/prefs/PreferencesDialog.py index fe8ce70ed..0ba331790 100644 --- a/cad/src/experimental/prefs/PreferencesDialog.py +++ b/cad/src/experimental/prefs/PreferencesDialog.py @@ -63,6 +63,11 @@ from utilities.icon_utilities import geticon DEBUG = True GDS_NAMES = ["Lines", "Tubes", "Ball and Stick", "CPK", "DNA Cylinder"] GDS_ICONS = ["Lines", "Tubes", "Ball_and_Stick", "CPK", "DNACylinder" ] +# currently, [x][3] is not used, if it does become used by radiobuttonlist. +# if that changes, this will probably break --Derrick +HIGH_ORDER_BOND_STYLES = [[ 0, "Multiple cylinders", "", "multicyl"], + [ 1, "Vanes", "", "vane"], + [ 2, "Ribbons", "", "ribbon"] ] class ContainerWidget(QFrame): """ @@ -455,7 +460,7 @@ class PreferencesDialog(QDialog, Ui_PreferencesDialog): ["Minor groove error indicator", "Base orientation indicator"], "Adjust", - "Lighting", +# "Lighting", "Plug-ins", "Undo", "Window", @@ -556,9 +561,9 @@ class PreferencesDialog(QDialog, Ui_PreferencesDialog): self.connect(self.okButton, SIGNAL("clicked()"), self.accept) self.connect(self.whatsThisToolButton, SIGNAL("clicked()"),QWhatsThis.enterWhatsThisMode) - #self.whatsThisToolButton.setIcon( - # geticon("ui/actions/Properties Manager/WhatsThis.png")) - #self.whatsThisToolButton.setIconSize(QSize(22, 22)) + self.whatsThisToolButton.setIcon( + geticon("ui/actions/Properties Manager/WhatsThis.png")) + self.whatsThisToolButton.setIconSize(QSize(22, 22)) self.whatsThisToolButton.setToolTip('Enter "What\'s This?" help mode') return @@ -867,12 +872,14 @@ class PreferencesDialog(QDialog, Ui_PreferencesDialog): setAsDefault = False) self.bases_per_turn_DoubleSpinBox = PM_DoubleSpinBox(DNA_default_values_GroupBox, label = "Bases per turn:", - suffix = "", - singleStep = 1) + suffix = "", + decimals = 2, + singleStep = .1) self.rise_DoubleSpinBox = PM_DoubleSpinBox(DNA_default_values_GroupBox, label = "Rise:", - suffix = "Angstroms", - singleStep = 10) + suffix = " Angstroms", + decimals = 3, + singleStep = .01) self.strand1_ColorComboBox = PM_ColorComboBox(DNA_default_values_GroupBox, label = "Strand 1:") self.strand2_ColorComboBox = PM_ColorComboBox(DNA_default_values_GroupBox, @@ -917,7 +924,7 @@ class PreferencesDialog(QDialog, Ui_PreferencesDialog): label = "Ball and stick cylinder:") self.bond_stretch_ColorComboBox = PM_ColorComboBox(bond_colors_GroupBox, label = "Bond stretch:") - self.Vane_Ribbon_ColorComboBox = PM_ColorComboBox(bond_colors_GroupBox, + self.vane_ribbon_ColorComboBox = PM_ColorComboBox(bond_colors_GroupBox, label = "Vane/Ribbon:") self.restore_bond_colors_PushButton = PM_PushButton(bond_colors_GroupBox, text = "Restore Default Colors", @@ -928,17 +935,17 @@ class PreferencesDialog(QDialog, Ui_PreferencesDialog): connectTitleButton = False) self.ball_and_stick_bond_scale_SpinBox = PM_SpinBox(misc_bond_settings_GroupBox, label = "Ball and stick bond scale:", + maximum = 100, suffix = "%") self.bond_line_thickness_SpinBox = PM_SpinBox(misc_bond_settings_GroupBox, label = "Bond line thickness:", + minimum = 1, suffix = "pixels") high_order_bonds_GroupBox = PM_GroupBox(misc_bond_settings_GroupBox, title = "High order bonds", connectTitleButton = False) self.high_order_bonds_RadioButtonList = PM_RadioButtonList(high_order_bonds_GroupBox, - buttonList = [[ 1, "Multiple cylinders", "cylinders"], - [ 2, "Vanes", "vanes"], - [ 3, "Ribbons", "ribbons"] ]) + buttonList = HIGH_ORDER_BOND_STYLES) self.show_bond_type_letters_CheckBox = PM_CheckBox(misc_bond_settings_GroupBox, spanWidth = True, widgetColumn = 0, @@ -972,7 +979,7 @@ class PreferencesDialog(QDialog, Ui_PreferencesDialog): label = "Origin:", labelColumn = 0, choices = _choices, setAsDefault = False) - self.rulor_color_ColorComboBox = PM_ColorComboBox(rulers_GroupBox, + self.ruler_color_ColorComboBox = PM_ColorComboBox(rulers_GroupBox, label = "Color:") self.ruler_opacity_SpinBox = PM_SpinBox(rulers_GroupBox, label = "Opacity", @@ -1111,11 +1118,28 @@ class PreferencesDialog(QDialog, Ui_PreferencesDialog): choices = _choices, setAsDefault = False) self.ball_and_stick_atom_scale_SpinBox = PM_SpinBox(misc_atom_settings_GroupBox, - label = "Ball and stick atom scale", + label = "", + maximum = 100, suffix = "%") - self.CPK_atom_scale_SpinBox = PM_SpinBox(misc_atom_settings_GroupBox, - label = "CPK atom scale", - suffix = "%") + self.ball_and_stick_atom_scale_reset_ToolButton = PM_ToolButton(misc_atom_settings_GroupBox, + iconPath = "ui/actions/Properties Manager/restore_defaults3.png") + self.CPK_atom_scale_doubleSpinBox = PM_DoubleSpinBox(misc_atom_settings_GroupBox, + label = "", + suffix = "", + decimals = 3, + singleStep = 0.005) + self.CPK_atom_scale_reset_ToolButton = PM_ToolButton(misc_atom_settings_GroupBox, + iconPath = "ui/actions/Properties Manager/restore_defaults3.png") + aWidgetList = [ ("QLabel", "Ball and stick atom scale:", 0, 0), + ("PM_SpinBox", self.ball_and_stick_atom_scale_SpinBox, 1, 0), + ("PM_ToolButton", self.ball_and_stick_atom_scale_reset_ToolButton, 2, 0), + ("QLabel", "CPK atom scale", 0, 1), + ("PM_SpinBox", self.CPK_atom_scale_doubleSpinBox, 1, 1), + ("PM_ToolButton", self.CPK_atom_scale_reset_ToolButton, 2, 1) ] + widget_grid_1 = PM_WidgetGrid(misc_atom_settings_GroupBox, + spanWidth = True, + widgetList = aWidgetList) + self.overlapping_atom_indicators_CheckBox = PM_CheckBox(misc_atom_settings_GroupBox, spanWidth = True, widgetColumn = 0, @@ -1359,18 +1383,34 @@ class PreferencesDialog(QDialog, Ui_PreferencesDialog): text = "Animate between views", widgetColumn = 0) self.view_animation_speed_Slider = PM_Slider(view_rotation_settings_GroupBox, - label = "View animation speed: ", - spanWidth = True) - labelList = [["QLabel", "slow", 0], ["QSpacerItem", 0, 0, 1], ["QLabel", "fast", 2]] - self.SF1_Label = PM_WidgetRow(view_rotation_settings_GroupBox, - spanWidth = True, - widgetList = labelList) + label = "", + minimum = -300, maximum = -25, + spanWidth = False) + self.view_animation_speed_Slider.singeleStep = .01 + self.view_animation_speed_reset_ToolButton = PM_ToolButton(view_rotation_settings_GroupBox, + iconPath = "ui/actions/Properties Manager/restore_defaults3.png") + aWidgetList = [["QLabel", "View Animation Speed: ", 0, 0], + ["PM_Slider", self.view_animation_speed_Slider, 1, 0], + ["PM_PushButton", self.view_animation_speed_reset_ToolButton, 3, 0], + ["QLabel", "slow ", 1, 1], + ["QLabel", " fast", 1, 1]] + widget_grid_1 = PM_WidgetGrid(view_rotation_settings_GroupBox, + spanWidth = True, + widgetList = aWidgetList) self.mouse_rotation_speed_Slider = PM_Slider(view_rotation_settings_GroupBox, - label = "Mouse rotation speed: ", + label = "", + minimum = 30, maximum = 100, spanWidth = True) - self.SF2_Label = PM_WidgetRow(view_rotation_settings_GroupBox, - spanWidth = True, - widgetList = labelList) + self.mouse_rotation_speed_reset_ToolButton = PM_ToolButton(view_rotation_settings_GroupBox, + iconPath = "ui/actions/Properties Manager/restore_defaults3.png") + aWidgetList = [["QLabel", "Mouse rotation speed: ", 0, 0], + ["PM_Slider", self.mouse_rotation_speed_Slider, 1, 0], + ["PM_PushButton", self.mouse_rotation_speed_reset_ToolButton, 3, 0], + ["QLabel", "slow ", 1, 1], + ["QLabel", " fast", 1, 1]] + widget_grid_2 = PM_WidgetGrid(view_rotation_settings_GroupBox, + spanWidth = True, + widgetList = aWidgetList) mouse_zoom_settings_GroupBox = PM_GroupBox(_pageContainer, title = "Mouse wheel zoom settings", connectTitleButton = False) @@ -1392,7 +1432,7 @@ class PreferencesDialog(QDialog, Ui_PreferencesDialog): setAsDefault = False) self.hover_highlighting_timeout_SpinBox = PM_DoubleSpinBox(mouse_zoom_settings_GroupBox, label = "Hover highlighting\ntimeout interval", - suffix = "seconds", + suffix = " seconds", # spanWidth = True, singleStep = .1) return |