def _connect_checkboxes_to_global_prefs_keys(self, isConnect = True):
        """
        #doc
        """
        if not isConnect:
            return

        #ORDER of items in tuples checkboxes and prefs_keys is IMPORTANT!
        checkboxes = (
            self.arrowsOnThreePrimeEnds_checkBox,
            self.arrowsOnFivePrimeEnds_checkBox,
            self.strandThreePrimeArrowheadsCustomColorCheckBox,
            self.strandFivePrimeArrowheadsCustomColorCheckBox,
            self.arrowsOnBackBones_checkBox)

        prefs_keys = (
            self._prefs_key_arrowsOnThreePrimeEnds(),
            self._prefs_key_arrowsOnFivePrimeEnds(),
            self._prefs_key_useCustomColorForThreePrimeArrowheads(),
            self._prefs_key_useCustomColorForFivePrimeArrowheads(),
            arrowsOnBackBones_prefs_key)

        for checkbox, prefs_key in zip(checkboxes, prefs_keys):
            connect_checkbox_with_boolean_pref(checkbox, prefs_key)

        return
    def _loadJoinOptionsGroupbox(self, pmGroupBox):
        """
        Load widgets in this group box.
        """

        self.clickToJoinDnaStrandsCheckBox = \
            PM_CheckBox(pmGroupBox ,
                        text         = 'Click on strand to join',
                        widgetColumn = 0,
                        spanWidth = True)

        connect_checkbox_with_boolean_pref(
            self.clickToJoinDnaStrandsCheckBox,
            joinStrandsCommand_clickToJoinDnaStrands_prefs_key )

        self.recursive_clickToJoinDnaStrandsCheckBox = \
            PM_CheckBox(pmGroupBox ,
                        text         = 'Recursively join strands',
                        widgetColumn = 1,
                        spanWidth = True)

        connect_checkbox_with_boolean_pref(
            self.recursive_clickToJoinDnaStrandsCheckBox,
            joinStrandsCommand_recursive_clickToJoinDnaStrands_prefs_key)

        if not env.prefs[joinStrandsCommand_clickToJoinDnaStrands_prefs_key]:
            self.recursive_clickToJoinDnaStrandsCheckBox.setEnabled(False)
 def _loadJoinOptionsGroupbox(self, pmGroupBox):
     """
     Load widgets in this group box.
     """        
     
     self.clickToJoinDnaStrandsCheckBox = \
         PM_CheckBox(pmGroupBox ,
                     text         = 'Click on strand to join',
                     widgetColumn = 0, 
                     spanWidth = True)
     
     connect_checkbox_with_boolean_pref(
         self.clickToJoinDnaStrandsCheckBox, 
         joinStrandsCommand_clickToJoinDnaStrands_prefs_key )
     
     self.recursive_clickToJoinDnaStrandsCheckBox = \
         PM_CheckBox(pmGroupBox ,
                     text         = 'Recursively join strands',
                     widgetColumn = 1, 
                     spanWidth = True)
     
     connect_checkbox_with_boolean_pref(
         self.recursive_clickToJoinDnaStrandsCheckBox, 
         joinStrandsCommand_recursive_clickToJoinDnaStrands_prefs_key)
     
     if not env.prefs[joinStrandsCommand_clickToJoinDnaStrands_prefs_key]:
         self.recursive_clickToJoinDnaStrandsCheckBox.setEnabled(False)
 def connect_or_disconnect_signals(self, isConnect): 
     """
     Connect or disconnect widget signals sent to their slot methods.
     @param isConnect: If True the widget will send the signals to the slot 
                       method. 
     @type  isConnect: boolean
     @see: L{BuildAtoms_Command.connect_or_disconnect_signals} where this is called
     """
             
     if isConnect and self.isAlreadyConnected:
         if debug_flags.atom_debug:
             print_compact_stack("warning: attempt to connect widgets"\
                                 "in this PM that are already connected." )
         return 
     
     if not isConnect and self.isAlreadyDisconnected:
         if debug_flags.atom_debug:
             print_compact_stack("warning: attempt to disconnect widgets"\
                                 "in this PM that are already disconnected.")
         return
     
     self.isAlreadyConnected = isConnect
     self.isAlreadyDisconnected = not isConnect
     
     if isConnect:
         change_connect = self.w.connect
     else:
         change_connect = self.w.disconnect
     
     change_connect(self.atomChooserComboBox, 
                  SIGNAL("currentIndexChanged(int)"), 
                  self._updateAtomChooserGroupBoxes)
     
   
     change_connect(self.selectionFilterCheckBox,
                    SIGNAL("stateChanged(int)"),
                    self.set_selection_filter)
     
     change_connect(self.showSelectedAtomInfoCheckBox,
                    SIGNAL("stateChanged(int)"),
                    self.toggle_selectedAtomPosGroupBox)        
     
     change_connect(self.xCoordOfSelectedAtom,
                  SIGNAL("valueChanged(double)"), 
                  self._moveSelectedAtom)
     
     change_connect(self.yCoordOfSelectedAtom,
                  SIGNAL("valueChanged(double)"), 
                  self._moveSelectedAtom)
     
     change_connect(self.zCoordOfSelectedAtom,
                  SIGNAL("valueChanged(double)"), 
                  self._moveSelectedAtom)
     
     connect_checkbox_with_boolean_pref(self.waterCheckBox,
                                            buildModeWaterEnabled_prefs_key)                   
     
     connect_checkbox_with_boolean_pref(self.highlightingCheckBox, 
                                        buildModeHighlightingEnabled_prefs_key)
Example #5
0
    def _connect_checkboxes_to_global_prefs_keys(self):
        """
        """
        connect_checkbox_with_boolean_pref(self.gridPlaneCheckBox,
                                           PlanePM_showGrid_prefs_key)

        connect_checkbox_with_boolean_pref(self.gpDisplayLabels,
                                           PlanePM_showGridLabels_prefs_key)
 def _connect_showCursorTextCheckBox(self):
     """
     Connect the show cursor text checkbox with user prefs_key.
     Overrides 
     DnaOrCnt_PropertyManager._connect_showCursorTextCheckBox
     """
     connect_checkbox_with_boolean_pref(
         self.showCursorTextCheckBox , 
         dnaSegmentEditCommand_showCursorTextCheckBox_prefs_key)
 def _connect_showCursorTextCheckBox(self):
     """
     Connect the show cursor text checkbox with user prefs_key.
     Overrides
     DnaOrCnt_PropertyManager._connect_showCursorTextCheckBox
     """
     connect_checkbox_with_boolean_pref(
         self.showCursorTextCheckBox,
         insertNanotubeEditCommand_showCursorTextCheckBox_prefs_key)
    def _loadSelectionOptionsGroupBox(self, inPmGroupBox):
        """
        Load widgets in the Selection Options group box.
        @param inPmGroupBox: The Selection Options box in the PM
        @type  inPmGroupBox: L{PM_GroupBox} 
        """

        self.selectionFilterCheckBox = \
            PM_CheckBox( inPmGroupBox,
                         text  = "Enable atom selection filter",
                         widgetColumn = 0,
                         state        = Qt.Unchecked  )
        self.selectionFilterCheckBox.setDefaultValue(False)

        self.filterlistLE = PM_LineEdit(inPmGroupBox,
                                        label="",
                                        text="",
                                        setAsDefault=False,
                                        spanWidth=True)
        self.filterlistLE.setReadOnly(True)

        if self.selectionFilterCheckBox.isChecked():
            self.filterlistLE.setEnabled(True)
        else:
            self.filterlistLE.setEnabled(False)

        self.showSelectedAtomInfoCheckBox = \
            PM_CheckBox(
                inPmGroupBox,
                text  = "Show Selected Atom Info",
                widgetColumn = 0,
                state        = Qt.Unchecked)

        self.selectedAtomPosGroupBox = \
            PM_GroupBox( inPmGroupBox, title = "")
        self._loadSelectedAtomPosGroupBox(self.selectedAtomPosGroupBox)

        self.toggle_selectedAtomPosGroupBox(show=0)
        self.enable_or_disable_selectedAtomPosGroupBox(bool_enable=False)

        self.reshapeSelectionCheckBox = \
            PM_CheckBox( inPmGroupBox,
                         text         = 'Dragging reshapes selection',
                         widgetColumn = 0,
                         state        = Qt.Unchecked  )

        connect_checkbox_with_boolean_pref(self.reshapeSelectionCheckBox,
                                           reshapeAtomsSelection_prefs_key)

        env.prefs[reshapeAtomsSelection_prefs_key] = False

        self.waterCheckBox = \
            PM_CheckBox( inPmGroupBox,
                         text         = "Z depth filter (water surface)",
                         widgetColumn = 0,
                         state        = Qt.Unchecked  )
    def _loadSelectionOptionsGroupBox(self, inPmGroupBox):
        """
        Load widgets in the Selection Options group box.
        @param inPmGroupBox: The Selection Options box in the PM
        @type  inPmGroupBox: L{PM_GroupBox}
        """

        self.selectionFilterCheckBox = \
            PM_CheckBox( inPmGroupBox,
                         text  = "Enable atom selection filter",
                         widgetColumn = 0,
                         state        = Qt.Unchecked  )
        self.selectionFilterCheckBox.setDefaultValue(False)

        self.filterlistLE = PM_LineEdit( inPmGroupBox,
                                         label        = "",
                                         text         = "",
                                         setAsDefault = False,
                                         spanWidth    = True )
        self.filterlistLE.setReadOnly(True)

        if self.selectionFilterCheckBox.isChecked():
            self.filterlistLE.setEnabled(True)
        else:
            self.filterlistLE.setEnabled(False)

        self.showSelectedAtomInfoCheckBox = \
            PM_CheckBox(
                inPmGroupBox,
                text  = "Show Selected Atom Info",
                widgetColumn = 0,
                state        = Qt.Unchecked)

        self.selectedAtomPosGroupBox = \
            PM_GroupBox( inPmGroupBox, title = "")
        self._loadSelectedAtomPosGroupBox(self.selectedAtomPosGroupBox)

        self.toggle_selectedAtomPosGroupBox(show = 0)
        self.enable_or_disable_selectedAtomPosGroupBox( bool_enable = False)

        self.reshapeSelectionCheckBox = \
            PM_CheckBox( inPmGroupBox,
                         text         = 'Dragging reshapes selection',
                         widgetColumn = 0,
                         state        = Qt.Unchecked  )

        connect_checkbox_with_boolean_pref( self.reshapeSelectionCheckBox,
                                            reshapeAtomsSelection_prefs_key )

        env.prefs[reshapeAtomsSelection_prefs_key] = False

        self.waterCheckBox = \
            PM_CheckBox( inPmGroupBox,
                         text         = "Z depth filter (water surface)",
                         widgetColumn = 0,
                         state        = Qt.Unchecked  )
    def _connect_checkboxes_to_global_prefs_keys(self):
        """
        """
        connect_checkbox_with_boolean_pref(
            self.gridPlaneCheckBox ,
            PlanePM_showGrid_prefs_key)

        connect_checkbox_with_boolean_pref(
            self.gpDisplayLabels,
            PlanePM_showGridLabels_prefs_key)
 def __init__(self, widgets, checkbox = None, checkbox_prefs_key = None):
     """
     Set the data widgets, and if given, the checkbox widget and its prefs key, both optional.
     If checkbox and its prefs_key are both there, connect them. If neither is provided, always update.
     """
     self.watch_motion_buttongroup, self.update_number_spinbox, self.update_units_combobox = widgets
     self.checkbox = checkbox
     self.checkbox_prefs_key = checkbox_prefs_key
     if checkbox and checkbox_prefs_key:
         from widgets.prefs_widgets import connect_checkbox_with_boolean_pref
         connect_checkbox_with_boolean_pref(checkbox , checkbox_prefs_key)
    def _addCheckBoxes(self, paramsForCheckBoxes):
        """
        Creates PM_CheckBoxes within the groupbox and also connects each one
        with its individual prefs key.
        """
        for checkBoxText, prefs_key in paramsForCheckBoxes:
            checkBox = PM_CheckBox(self, text=checkBoxText, widgetColumn=self._checkBoxColumn, state=Qt.Checked)

            connect_checkbox_with_boolean_pref(checkBox, prefs_key)

            self.checkBoxes.append(checkBox)
Example #13
0
 def __init__(self, widgets, checkbox=None, checkbox_prefs_key=None):
     """
     Set the data widgets, and if given, the checkbox widget and its prefs key, both optional.
     If checkbox and its prefs_key are both there, connect them. If neither is provided, always update.
     """
     self.watch_motion_buttongroup, self.update_number_spinbox, self.update_units_combobox = widgets
     self.checkbox = checkbox
     self.checkbox_prefs_key = checkbox_prefs_key
     if checkbox and checkbox_prefs_key:
         from widgets.prefs_widgets import connect_checkbox_with_boolean_pref
         connect_checkbox_with_boolean_pref(checkbox, checkbox_prefs_key)
    def connect_or_disconnect_signals(self, isConnect):
        """
        Connect or disconnect widget signals sent to their slot methods.
        @param isConnect: If True the widget will send the signals to the slot
                          method.
        @type  isConnect: boolean
        @see: L{BuildAtoms_Command.connect_or_disconnect_signals} where this is called
        """

        if isConnect and self.isAlreadyConnected:
            if debug_flags.atom_debug:
                print_compact_stack("warning: attempt to connect widgets"\
                                    "in this PM that are already connected." )
            return

        if not isConnect and self.isAlreadyDisconnected:
            if debug_flags.atom_debug:
                print_compact_stack("warning: attempt to disconnect widgets"\
                                    "in this PM that are already disconnected.")
            return

        self.isAlreadyConnected = isConnect
        self.isAlreadyDisconnected = not isConnect

        if isConnect:
            change_connect = self.w.connect
        else:
            change_connect = self.w.disconnect

        change_connect(self.atomChooserComboBox,
                       SIGNAL("currentIndexChanged(int)"),
                       self._updateAtomChooserGroupBoxes)

        change_connect(self.selectionFilterCheckBox,
                       SIGNAL("stateChanged(int)"), self.set_selection_filter)

        change_connect(self.showSelectedAtomInfoCheckBox,
                       SIGNAL("stateChanged(int)"),
                       self.toggle_selectedAtomPosGroupBox)

        change_connect(self.xCoordOfSelectedAtom,
                       SIGNAL("valueChanged(double)"), self._moveSelectedAtom)

        change_connect(self.yCoordOfSelectedAtom,
                       SIGNAL("valueChanged(double)"), self._moveSelectedAtom)

        change_connect(self.zCoordOfSelectedAtom,
                       SIGNAL("valueChanged(double)"), self._moveSelectedAtom)

        connect_checkbox_with_boolean_pref(self.waterCheckBox,
                                           buildModeWaterEnabled_prefs_key)

        connect_checkbox_with_boolean_pref(
            self.highlightingCheckBox, buildModeHighlightingEnabled_prefs_key)
 def _loadBreakOptionsGroupbox(self, pmGroupBox):
     """
     Load widgets in this group box.
     """
             
     self.assignColorToBrokenDnaStrandsCheckBox = \
         PM_CheckBox(pmGroupBox ,
                     text         = 'Assign new color to broken strands',
                     widgetColumn = 1   )
     
     connect_checkbox_with_boolean_pref(
         self.assignColorToBrokenDnaStrandsCheckBox, 
         assignColorToBrokenDnaStrands_prefs_key )
    def connect_or_disconnect_signals(self, isConnect):
        """
        Connect or disconnect widget signals sent to their slot methods.
        This can be overridden in subclasses. By default it does nothing.
        @param isConnect: If True the widget will send the signals to the slot 
                          method. 
        @type  isConnect: boolean
        """
        #TODO: This is a temporary fix for a bug. When you invoke a 
        #temporary mode  entering such a temporary mode keeps the signals of 
        #PM from the previous mode connected (
        #but while exiting that temporary mode and reentering the 
        #previous mode, it atucally reconnects the signal! This gives rise to 
        #lots  of bugs. This needs more general fix in Temporary mode API. 
        # -- Ninad 2008-01-09 (similar comment exists in MovePropertyManager.py

        if isConnect and self.isAlreadyConnected:
            if debug_flags.atom_debug:
                print_compact_stack("warning: attempt to connect widgets"\
                                    "in this PM that are already connected." )
            return 

        if not isConnect and self.isAlreadyDisconnected:
            if debug_flags.atom_debug:
                print_compact_stack("warning: attempt to disconnect widgets"\
                                    "in this PM that are already disconnected.")
            return

        self.isAlreadyConnected = isConnect
        self.isAlreadyDisconnected = not isConnect

        if isConnect:
            change_connect = self.win.connect     
        else:
            change_connect = self.win.disconnect 

        self.segmentListWidget.connect_or_disconnect_signals(isConnect) 
        change_connect(self.addSegmentsToolButton, 
                       SIGNAL("toggled(bool)"), 
                       self.activateAddSegmentsTool)
        change_connect(self.removeSegmentsToolButton, 
                       SIGNAL("toggled(bool)"), 
                       self.activateRemoveSegmentsTool)

        change_connect(self.makeCrossoverPushButton,
                       SIGNAL("clicked()"),
                       self._makeAllCrossovers)
        
        connect_checkbox_with_boolean_pref(
             self.crossoversBetGivenSegmentsOnly_checkBox,
            makeCrossoversCommand_crossoverSearch_bet_given_segments_only_prefs_key)
Example #17
0
    def connect_or_disconnect_signals(self, isConnect):
        """
        Connect or disconnect widget signals sent to their slot methods.
        This can be overridden in subclasses. By default it does nothing.
        @param isConnect: If True the widget will send the signals to the slot 
                          method. 
        @type  isConnect: boolean
        """
        #TODO: This is a temporary fix for a bug. When you invoke a
        #temporary mode  entering such a temporary mode keeps the signals of
        #PM from the previous mode connected (
        #but while exiting that temporary mode and reentering the
        #previous mode, it atucally reconnects the signal! This gives rise to
        #lots  of bugs. This needs more general fix in Temporary mode API.
        # -- Ninad 2008-01-09 (similar comment exists in MovePropertyManager.py

        if isConnect and self.isAlreadyConnected:
            if debug_flags.atom_debug:
                print_compact_stack("warning: attempt to connect widgets"\
                                    "in this PM that are already connected." )
            return

        if not isConnect and self.isAlreadyDisconnected:
            if debug_flags.atom_debug:
                print_compact_stack("warning: attempt to disconnect widgets"\
                                    "in this PM that are already disconnected.")
            return

        self.isAlreadyConnected = isConnect
        self.isAlreadyDisconnected = not isConnect

        if isConnect:
            change_connect = self.win.connect
        else:
            change_connect = self.win.disconnect

        self.segmentListWidget.connect_or_disconnect_signals(isConnect)
        change_connect(self.addSegmentsToolButton, SIGNAL("toggled(bool)"),
                       self.activateAddSegmentsTool)
        change_connect(self.removeSegmentsToolButton, SIGNAL("toggled(bool)"),
                       self.activateRemoveSegmentsTool)

        change_connect(self.makeCrossoverPushButton, SIGNAL("clicked()"),
                       self._makeAllCrossovers)

        connect_checkbox_with_boolean_pref(
            self.crossoversBetGivenSegmentsOnly_checkBox,
            makeCrossoversCommand_crossoverSearch_bet_given_segments_only_prefs_key
        )
    def _addCheckBoxes(self, paramsForCheckBoxes):
        """
        Creates PM_CheckBoxes within the groupbox and also connects each one
        with its individual prefs key.
        """
        for checkBoxText, prefs_key in paramsForCheckBoxes:
            checkBox = \
                PM_CheckBox( self,
                             text  = checkBoxText,
                             widgetColumn = self._checkBoxColumn,
                             state        = Qt.Checked)

            connect_checkbox_with_boolean_pref(checkBox, prefs_key)

            self.checkBoxes.append(checkBox)
    def _loadBreakOptionsGroupbox(self, pmGroupBox):
        """
        Load widgets in this group box.
        """

        self.assignColorToBrokenDnaStrandsCheckBox = \
            PM_CheckBox(pmGroupBox ,
                        text         = 'Assign new color to broken strands',
                        widgetColumn = 0,
                        spanWidth = True)

        connect_checkbox_with_boolean_pref(
            self.assignColorToBrokenDnaStrandsCheckBox,
            assignColorToBrokenDnaStrands_prefs_key )



        self.basesBeforeNextBreakSpinBox = \
            PM_SpinBox( pmGroupBox,
                        label         =  "Break Every:",
                        value         =  3,
                        setAsDefault  =  False,
                        minimum       =  1,
                        maximum       =  10000,
                        suffix       = " bases"
                        )

        connect_spinBox_with_pref(
            self.basesBeforeNextBreakSpinBox,
            breakStrandsCommand_numberOfBasesBeforeNextBreak_prefs_key)

        self.breakAllStrandsButton = PM_PushButton(
            pmGroupBox,
            label = "",
            text  = "do it" )


        self._dnaStrandChooserGroupBox = PM_ObjectChooser(
            pmGroupBox,
            self.command,
            modelObjectType = self.win.assy.DnaStrand,
            title = "Choose strands " )

        if not DEBUG_BREAK_OPTIONS_FEATURE:
            self._dnaStrandChooserGroupBox.hide()
            self.breakAllStrandsButton.hide()
            self.basesBeforeNextBreakSpinBox.hide()
    def _loadGroupBox2(self, pmGroupBox):
        """
        Load widgets in group box.
        """
        #background color combo box
        self.backgroundColorComboBox  = \
            PM_ComboBox( pmGroupBox,
                         label     =  "Color:",
                         spanWidth = False)

        self._loadBackgroundColorItems()

        self.enableFogCheckBox = \
            PM_CheckBox( pmGroupBox, text = "Enable fog" )

        connect_checkbox_with_boolean_pref( self.enableFogCheckBox, fogEnabled_prefs_key )
        return
Example #21
0
    def _loadBreakOptionsGroupbox(self, pmGroupBox):
        """
        Load widgets in this group box.
        """

        self.assignColorToBrokenDnaStrandsCheckBox = \
            PM_CheckBox(pmGroupBox ,
                        text         = 'Assign new color to broken strands',
                        widgetColumn = 0,
                        spanWidth = True)

        connect_checkbox_with_boolean_pref(
            self.assignColorToBrokenDnaStrandsCheckBox,
            assignColorToBrokenDnaStrands_prefs_key)



        self.basesBeforeNextBreakSpinBox = \
            PM_SpinBox( pmGroupBox,
                        label         =  "Break Every:",
                        value         =  3,
                        setAsDefault  =  False,
                        minimum       =  1,
                        maximum       =  10000,
                        suffix       = " bases"
                        )

        connect_spinBox_with_pref(
            self.basesBeforeNextBreakSpinBox,
            breakStrandsCommand_numberOfBasesBeforeNextBreak_prefs_key)

        self.breakAllStrandsButton = PM_PushButton(pmGroupBox,
                                                   label="",
                                                   text="do it")

        self._dnaStrandChooserGroupBox = PM_ObjectChooser(
            pmGroupBox,
            self.command,
            modelObjectType=self.win.assy.DnaStrand,
            title="Choose strands ")

        if not DEBUG_BREAK_OPTIONS_FEATURE:
            self._dnaStrandChooserGroupBox.hide()
            self.breakAllStrandsButton.hide()
            self.basesBeforeNextBreakSpinBox.hide()
Example #22
0
    def _connect_checkboxes_to_global_prefs_keys(self, isConnect=True):
        """
        #doc
        """
        if not isConnect:
            return

        #ORDER of items in tuples checkboxes and prefs_keys is IMPORTANT!
        checkboxes = (self.arrowsOnThreePrimeEnds_checkBox,
                      self.arrowsOnFivePrimeEnds_checkBox,
                      self.strandThreePrimeArrowheadsCustomColorCheckBox,
                      self.strandFivePrimeArrowheadsCustomColorCheckBox,
                      self.arrowsOnBackBones_checkBox)

        prefs_keys = (self._prefs_key_arrowsOnThreePrimeEnds(),
                      self._prefs_key_arrowsOnFivePrimeEnds(),
                      self._prefs_key_useCustomColorForThreePrimeArrowheads(),
                      self._prefs_key_useCustomColorForFivePrimeArrowheads(),
                      arrowsOnBackBones_prefs_key)

        for checkbox, prefs_key in zip(checkboxes, prefs_keys):
            connect_checkbox_with_boolean_pref(checkbox, prefs_key)

        return
Example #23
0
    def __init__(self, win):
        QDialog.__init__(self, win)  # win is parent.
        self.setupUi(self)
        self.watch_motion_buttongroup = QButtonGroup()
        self.watch_motion_buttongroup.setExclusive(True)
        for obj in self.watch_motion_groupbox.children():
            if isinstance(obj, QAbstractButton):
                self.watch_motion_buttongroup.addButton(obj)

        #fix some icon problems
        self.setWindowIcon(
            geticon('ui/border/MinimizeEnergy.png'))

        self.connect(self.cancel_btn,
                     SIGNAL("clicked()"),
                     self.cancel_btn_clicked)
        self.connect(self.ok_btn,
                     SIGNAL("clicked()"),
                     self.ok_btn_clicked)
        self.connect(self.restore_btn,
                     SIGNAL("clicked()"),
                     self.restore_defaults_btn_clicked)

        self.whatsthis_btn.setIcon(
            geticon('ui/actions/Properties Manager/WhatsThis.png'))
        self.whatsthis_btn.setIconSize(QSize(22, 22))
        self.whatsthis_btn.setToolTip('Enter "What\'s This?" help mode')

        self.connect(self.whatsthis_btn,
                     SIGNAL("clicked()"),
                     QWhatsThis.enterWhatsThisMode)

        connect_checkbox_with_boolean_pref(
            self.electrostaticsForDnaDuringMinimize_checkBox,
            electrostaticsForDnaDuringMinimize_prefs_key)

        connect_checkbox_with_boolean_pref(
            self.enableNeighborSearching_check_box,
            neighborSearchingInGromacs_prefs_key)

        self.connect(self.minimize_engine_combobox, SIGNAL("activated(int)"), self.update_minimize_engine)

        self.minimize_engine_combobox.setCurrentIndex(
            env.prefs[Minimize_minimizationEngine_prefs_key])

        self.connect(self.endRmsDoubleSpinBox, SIGNAL("valueChanged(double)"), self.changeEndRms)
        self.connect(self.endMaxDoubleSpinBox, SIGNAL("valueChanged(double)"), self.changeEndMax)
        self.connect(self.cutoverRmsDoubleSpinBox, SIGNAL("valueChanged(double)"), self.changeCutoverRms)
        self.connect(self.cutoverMaxDoubleSpinBox, SIGNAL("valueChanged(double)"), self.changeCutoverMax)

        self.endRmsDoubleSpinBox.setSpecialValueText("Automatic")
        self.endMaxDoubleSpinBox.setSpecialValueText("Automatic")
        self.cutoverRmsDoubleSpinBox.setSpecialValueText("Automatic")
        self.cutoverMaxDoubleSpinBox.setSpecialValueText("Automatic")

        self.win = win
        self.previousParams = None
        self.setup_ruc()
        self.seltype = 'All'
        self.minimize_selection_enabled = True #bruce 080513

        # Assign "What's This" text for all widgets.
        from commands.MinimizeEnergy.WhatsThisText_for_MinimizeEnergyDialog import whatsThis_MinimizeEnergyDialog
        whatsThis_MinimizeEnergyDialog(self)

        self.update_widgets() # to make sure self attrs are set
        return
    def connect_or_disconnect_signals(self, isConnect):
        """
        Connect or disconnect widget signals sent to their slot methods.
        This can be overridden in subclasses. By default it does nothing.
        @param isConnect: If True the widget will send the signals to the slot
                          method.
        @type  isConnect: boolean
        """
        if isConnect:
            change_connect = self.win.connect
        else:
            change_connect = self.win.disconnect

        # Favorite buttons signal-slot connections.
        change_connect( self.applyFavoriteButton,
                        SIGNAL("clicked()"),
                       self.applyFavorite)

        change_connect( self.addFavoriteButton,
                        SIGNAL("clicked()"),
                       self.addFavorite)

        change_connect( self.deleteFavoriteButton,
                        SIGNAL("clicked()"),
                       self.deleteFavorite)

        change_connect( self.saveFavoriteButton,
                        SIGNAL("clicked()"),
                       self.saveFavorite)

        change_connect( self.loadFavoriteButton,
                        SIGNAL("clicked()"),
                       self.loadFavorite)

        # Current display settings groupbox.
        change_connect( self.dnaRenditionComboBox,
                      SIGNAL("currentIndexChanged(int)"),
                      self.change_dnaRendition )

        # Axis options.
        change_connect( self.axisShapeComboBox,
                      SIGNAL("currentIndexChanged(int)"),
                      self.win.userPrefs.change_dnaStyleAxisShape )

        change_connect( self.axisScaleDoubleSpinBox,
                      SIGNAL("valueChanged(double)"),
                      self.win.userPrefs.change_dnaStyleAxisScale )

        change_connect( self.axisColorComboBox,
                      SIGNAL("currentIndexChanged(int)"),
                      self.win.userPrefs.change_dnaStyleAxisColor )

        change_connect( self.axisEndingStyleComboBox,
                      SIGNAL("currentIndexChanged(int)"),
                      self.win.userPrefs.change_dnaStyleAxisEndingStyle )

        # Strands options.
        change_connect( self.strandsShapeComboBox,
                      SIGNAL("currentIndexChanged(int)"),
                      self.win.userPrefs.change_dnaStyleStrandsShape )

        change_connect( self.strandsScaleDoubleSpinBox,
                      SIGNAL("valueChanged(double)"),
                      self.win.userPrefs.change_dnaStyleStrandsScale )

        change_connect( self.strandsColorComboBox,
                      SIGNAL("currentIndexChanged(int)"),
                      self.win.userPrefs.change_dnaStyleStrandsColor )

        change_connect( self.strandsArrowsComboBox,
                      SIGNAL("currentIndexChanged(int)"),
                      self.win.userPrefs.change_dnaStyleStrandsArrows )

        # Structs options.
        change_connect( self.strutsShapeComboBox,
                      SIGNAL("currentIndexChanged(int)"),
                      self.win.userPrefs.change_dnaStyleStrutsShape )

        change_connect( self.strutsScaleDoubleSpinBox,
                      SIGNAL("valueChanged(double)"),
                      self.win.userPrefs.change_dnaStyleStrutsScale )

        change_connect( self.strutsColorComboBox,
                      SIGNAL("currentIndexChanged(int)"),
                      self.win.userPrefs.change_dnaStyleStrutsColor )

        # Nucleotides options.
        change_connect( self.nucleotidesShapeComboBox,
                      SIGNAL("currentIndexChanged(int)"),
                      self.win.userPrefs.change_dnaStyleBasesShape )

        change_connect( self.nucleotidesScaleDoubleSpinBox,
                      SIGNAL("valueChanged(double)"),
                      self.win.userPrefs.change_dnaStyleBasesScale )

        change_connect( self.nucleotidesColorComboBox,
                      SIGNAL("currentIndexChanged(int)"),
                      self.win.userPrefs.change_dnaStyleBasesColor )

        connect_checkbox_with_boolean_pref(
            self.dnaStyleBasesDisplayLettersCheckBox,
            dnaStyleBasesDisplayLetters_prefs_key)

        # Dna Strand labels option.

        change_connect( self.standLabelColorComboBox,
                      SIGNAL("currentIndexChanged(int)"),
                      self.change_dnaStrandLabelsDisplay )
Example #25
0
    def connect_or_disconnect_signals(self, isConnect):
        """
        Connect or disconnect widget signals sent to their slot methods.
        This can be overridden in subclasses. By default it does nothing.
        @param isConnect: If True the widget will send the signals to the slot
                          method.
        @type  isConnect: boolean
        """
        if isConnect:
            change_connect = self.win.connect
        else:
            change_connect = self.win.disconnect

        # Favorite buttons signal-slot connections.
        change_connect(self.applyFavoriteButton, SIGNAL("clicked()"),
                       self.applyFavorite)

        change_connect(self.addFavoriteButton, SIGNAL("clicked()"),
                       self.addFavorite)

        change_connect(self.deleteFavoriteButton, SIGNAL("clicked()"),
                       self.deleteFavorite)

        change_connect(self.saveFavoriteButton, SIGNAL("clicked()"),
                       self.saveFavorite)

        change_connect(self.loadFavoriteButton, SIGNAL("clicked()"),
                       self.loadFavorite)

        # Current display settings groupbox.
        change_connect(self.dnaRenditionComboBox,
                       SIGNAL("currentIndexChanged(int)"),
                       self.change_dnaRendition)

        # Axis options.
        change_connect(self.axisShapeComboBox,
                       SIGNAL("currentIndexChanged(int)"),
                       self.win.userPrefs.change_dnaStyleAxisShape)

        change_connect(self.axisScaleDoubleSpinBox,
                       SIGNAL("valueChanged(double)"),
                       self.win.userPrefs.change_dnaStyleAxisScale)

        change_connect(self.axisColorComboBox,
                       SIGNAL("currentIndexChanged(int)"),
                       self.win.userPrefs.change_dnaStyleAxisColor)

        change_connect(self.axisEndingStyleComboBox,
                       SIGNAL("currentIndexChanged(int)"),
                       self.win.userPrefs.change_dnaStyleAxisEndingStyle)

        # Strands options.
        change_connect(self.strandsShapeComboBox,
                       SIGNAL("currentIndexChanged(int)"),
                       self.win.userPrefs.change_dnaStyleStrandsShape)

        change_connect(self.strandsScaleDoubleSpinBox,
                       SIGNAL("valueChanged(double)"),
                       self.win.userPrefs.change_dnaStyleStrandsScale)

        change_connect(self.strandsColorComboBox,
                       SIGNAL("currentIndexChanged(int)"),
                       self.win.userPrefs.change_dnaStyleStrandsColor)

        change_connect(self.strandsArrowsComboBox,
                       SIGNAL("currentIndexChanged(int)"),
                       self.win.userPrefs.change_dnaStyleStrandsArrows)

        # Structs options.
        change_connect(self.strutsShapeComboBox,
                       SIGNAL("currentIndexChanged(int)"),
                       self.win.userPrefs.change_dnaStyleStrutsShape)

        change_connect(self.strutsScaleDoubleSpinBox,
                       SIGNAL("valueChanged(double)"),
                       self.win.userPrefs.change_dnaStyleStrutsScale)

        change_connect(self.strutsColorComboBox,
                       SIGNAL("currentIndexChanged(int)"),
                       self.win.userPrefs.change_dnaStyleStrutsColor)

        # Nucleotides options.
        change_connect(self.nucleotidesShapeComboBox,
                       SIGNAL("currentIndexChanged(int)"),
                       self.win.userPrefs.change_dnaStyleBasesShape)

        change_connect(self.nucleotidesScaleDoubleSpinBox,
                       SIGNAL("valueChanged(double)"),
                       self.win.userPrefs.change_dnaStyleBasesScale)

        change_connect(self.nucleotidesColorComboBox,
                       SIGNAL("currentIndexChanged(int)"),
                       self.win.userPrefs.change_dnaStyleBasesColor)

        connect_checkbox_with_boolean_pref(
            self.dnaStyleBasesDisplayLettersCheckBox,
            dnaStyleBasesDisplayLetters_prefs_key)

        # Dna Strand labels option.

        change_connect(self.standLabelColorComboBox,
                       SIGNAL("currentIndexChanged(int)"),
                       self.change_dnaStrandLabelsDisplay)
Example #26
0
    def __init__(self, win, part, previous_movie = None, suffix = ""):
        """
        use previous_movie (if passed) for default values,
        otherwise use the same ones last ok'd by user
        (whether or not that sim got aborted), or default values if that never happened in this session;
        on success or failure, make a new Movie and store it as self.movie
        """
        QDialog.__init__(self, win) # win is parent.
        self.setupUi(self)

        self.setWindowIcon(geticon('ui/border/RunDynamics.png'))

        self.whatsthis_btn.setIcon(
            geticon('ui/actions/Properties Manager/WhatsThis.png'))
        self.whatsthis_btn.setIconSize(QSize(22, 22))
        self.whatsthis_btn.setToolTip('Enter "What\'s This?" help mode')

        self.connect(self.whatsthis_btn,
                     SIGNAL("clicked()"),
                     QWhatsThis.enterWhatsThisMode)

        self.watch_motion_buttongroup = QButtonGroup()
        self.watch_motion_buttongroup.setExclusive(True)
        for obj in self.watch_motion_groupbox.children():
            if isinstance(obj, QAbstractButton):
                self.watch_motion_buttongroup.addButton(obj)
        self.connect(self.run_sim_btn,SIGNAL("clicked()"),self.createMoviePressed)
        self.connect(self.cancel_btn,SIGNAL("clicked()"),self.close)
        qt4todo('self.connect(self.watch_motion_groupbox,SIGNAL("toggled(bool)"),self.setEnabled) ???')
        self.watch_motion_groupbox.setEnabled(True)
        ## self.part = part
            # not yet needed, though in future we might display info
            # about this Part in the dialog, to avoid confusion
            # if it's not the main Part.
        connect_checkbox_with_boolean_pref(self.potential_energy_checkbox,
                                           Potential_energy_tracefile_prefs_key)

        connect_checkbox_with_boolean_pref(
            self.electrostaticsForDnaDuringDynamics_checkBox,
            electrostaticsForDnaDuringDynamics_prefs_key)

        self.assy = part.assy # used only for assy.filename
        self.suffix = suffix
        self.previous_movie = previous_movie or _stickyParams or Movie(self.assy) # used only for its parameter settings
            # note: as of bruce 060601 fixing bug 1840, previous_movie is no longer ever passed by caller.
        self.movie = Movie(self.assy) # public attr used by client code after we return; always a Movie even on failure.
            # (we need it here since no extra method runs on failure, tho that could probably be fixed)
            # bruce 050325 changes:
            # We make a new Movie here (but only when we return with success).
            # But we use default param settings from prior movie.
            # Caller should pass info about default filename (including uniqueness
            #  when on selection or in clipboard item) -- i.e. the suffix.
            # We should set the params and filename using a Movie method, or warn it we did so,
            # or do them in its init... not yet cleaned up. ###@@@
            # self.movie is now a public attribute.
            #bruce 050329 comment: couldn't we set .movie to None, until we learn we succeeded? ###e ###@@@
        self.setup()
        self.watch_motion_groupbox.setWhatsThis(
            """<b>Watch motion in real time</b>
            <p>
            Enables real time graphical updates during simulation runs.
            """)
        self.update_number_spinbox.setWhatsThis(
            """<b>Update every <i>n units.</u></b>
            <p>
            Specify how often to update the model during the simulation.
            This allows the user to monitor simulation results while the
            simulation is running.
            </p>""")
        self.update_units_combobox.setWhatsThis(
            """<b>Update every <i>n units.</u></b>
            <p>
            Specify how often to update the model during the simulation.
            This allows the user to monitor simulation results while the
            simulation is running.
            </p>""")
        self.update_every_rbtn.setWhatsThis(
            """<b>Update every <i>n units.</u></b>
            <p>
            Specify how often to update the model during the simulation.
            This allows the user to monitor simulation results while the
            simulation is running.</p>""")
        self.update_asap_rbtn.setWhatsThis(
            """<b>Update as fast as possible</b>
            <p>
            Update every 2 seconds, or faster (up to 20x/sec) if it doesn't
            slow down the simulation by more than 20%.
            </p>""")
        self.temperatureSpinBox.setWhatsThis(
            """<b>Temperature</b>
            <p>
            The temperature of the simulation in Kelvin
            (300 K = room temperature)</p>""")
        self.totalFramesSpinBox.setWhatsThis(
            """<b>Total frames</b>
            <p>
            The total number of (movie) frames to create for the simulation run.
            </p>""")
        self.stepsPerFrameDoubleSpinBox.setWhatsThis(
            """<b>Steps per frame</b>
            <p>
            The time duration between frames in femtoseconds.
            </p>""")
        self.setWhatsThis(
            """<b>Run Dynamics</b>
            <p>
            The is the main dialog for configuring and launching a
            Molecular Dynamics simulation run. Specify the simulation parameters
            and click <b>Run Simulation</b> to launch.</p>
            <p>
            <img source=\"ui/actions/Simulation/PlayMovie.png\"><br>
            The <b>Play Movie</b> command can be used to play back the
            simulation.
            </p>""")

        if not debug_pref("GROMACS: Enable for Run Dynamics", Choice_boolean_False,
                          prefs_key=True):
            # Hide the Simulation engine groupbox altogether.
            self.md_engine_groupbox.setHidden(True)

        self.exec_()
    def _loadGroupBox3(self, pmGroupBox):
        """
        Load widgets in the grid plane group box.

        @param pmGroupBox: The grid  group box in the PM.
        @type  pmGroupBox: L{PM_GroupBox}
        """
        self.gridPlaneCheckBox = \
            PM_CheckBox( pmGroupBox,
                         text         = "Show grid",
                         widgetColumn  = 0,
                         setAsDefault = True,
                         spanWidth = True
                         )

        connect_checkbox_with_boolean_pref(
            self.gridPlaneCheckBox ,
            PlanePM_showGrid_prefs_key)


        self.gpXSpacingDoubleSpinBox  =  \
            PM_DoubleSpinBox( pmGroupBox,
                              label         =  "X Spacing:",
                              value         =  4.000,
                              setAsDefault  =  True,
                              minimum       =  1.00,
                              maximum       =  200.0,
                              decimals      =  3,
                              singleStep    =  1.0,
                              spanWidth = False)

        self.gpYSpacingDoubleSpinBox  =  \
            PM_DoubleSpinBox( pmGroupBox,
                              label         =  "Y Spacing:",
                              value         =  4.000,
                              setAsDefault  =  True,
                              minimum       =  1.00,
                              maximum       =  200.0,
                              decimals      =  3,
                              singleStep    =  1.0,
                              spanWidth = False)

        lineTypeChoices = [ 'Dotted (default)',
                            'Dashed',
                            'Solid' ]

        self.gpLineTypeComboBox = \
            PM_ComboBox( pmGroupBox ,
                         label         =  "Line type:",
                         choices       =  lineTypeChoices,
                         setAsDefault  =  True)

        hhColorList = [ black, orange, red, magenta,
                        cyan, blue, white, yellow, gray ]
        hhColorNames = [ "Black (default)", "Orange", "Red", "Magenta",
                         "Cyan", "Blue", "White", "Yellow", "Other color..." ]

        self.gpColorTypeComboBox = \
            PM_ColorComboBox( pmGroupBox,
                              colorList = hhColorList,
                              colorNames = hhColorNames,
                              color = black )

        self.pmGroupBox5 = PM_GroupBox( pmGroupBox )

        self.gpDisplayLabels =\
            PM_CheckBox( self.pmGroupBox5,
                         text         = "Display labels",
                         widgetColumn  = 0,
                         state        = Qt.Unchecked,
                         setAsDefault = True,
                         spanWidth = True )

        originChoices = [ 'Lower left (default)',
                          'Upper left',
                          'Lower right',
                          'Upper right' ]

        self.gpOriginComboBox = \
            PM_ComboBox( self.pmGroupBox5 ,
                         label         =  "Origin:",
                         choices       =  originChoices,
                         setAsDefault  =  True )

        positionChoices = [ 'Origin axes (default)',
                            'Plane perimeter' ]

        self.gpPositionComboBox = \
            PM_ComboBox( self.pmGroupBox5 ,
                         label         =  "Position:",
                         choices       =  positionChoices,
                         setAsDefault  =  True)

        self._showHideGPWidgets()

        if env.prefs[PlanePM_showGridLabels_prefs_key]:
            self.displayLabels = True
            self.gpOriginComboBox.setEnabled( True )
            self.gpPositionComboBox.setEnabled( True )
        else:
            self.displayLabels = False
            self.gpOriginComboBox.setEnabled( False )
            self.gpPositionComboBox.setEnabled( False )

        return
Example #28
0
    def _loadGroupBox3(self, pmGroupBox):
        """
        Load widgets in the grid plane group box.

        @param pmGroupBox: The grid  group box in the PM.
        @type  pmGroupBox: L{PM_GroupBox}
        """
        self.gridPlaneCheckBox = \
            PM_CheckBox( pmGroupBox,
                         text         = "Show grid",
                         widgetColumn  = 0,
                         setAsDefault = True,
                         spanWidth = True
                         )

        connect_checkbox_with_boolean_pref(self.gridPlaneCheckBox,
                                           PlanePM_showGrid_prefs_key)


        self.gpXSpacingDoubleSpinBox  =  \
            PM_DoubleSpinBox( pmGroupBox,
                              label         =  "X Spacing:",
                              value         =  4.000,
                              setAsDefault  =  True,
                              minimum       =  1.00,
                              maximum       =  200.0,
                              decimals      =  3,
                              singleStep    =  1.0,
                              spanWidth = False)

        self.gpYSpacingDoubleSpinBox  =  \
            PM_DoubleSpinBox( pmGroupBox,
                              label         =  "Y Spacing:",
                              value         =  4.000,
                              setAsDefault  =  True,
                              minimum       =  1.00,
                              maximum       =  200.0,
                              decimals      =  3,
                              singleStep    =  1.0,
                              spanWidth = False)

        lineTypeChoices = ['Dotted (default)', 'Dashed', 'Solid']

        self.gpLineTypeComboBox = \
            PM_ComboBox( pmGroupBox ,
                         label         =  "Line type:",
                         choices       =  lineTypeChoices,
                         setAsDefault  =  True)

        hhColorList = [
            black, orange, red, magenta, cyan, blue, white, yellow, gray
        ]
        hhColorNames = [
            "Black (default)", "Orange", "Red", "Magenta", "Cyan", "Blue",
            "White", "Yellow", "Other color..."
        ]

        self.gpColorTypeComboBox = \
            PM_ColorComboBox( pmGroupBox,
                              colorList = hhColorList,
                              colorNames = hhColorNames,
                              color = black )

        self.pmGroupBox5 = PM_GroupBox(pmGroupBox)

        self.gpDisplayLabels =\
            PM_CheckBox( self.pmGroupBox5,
                         text         = "Display labels",
                         widgetColumn  = 0,
                         state        = Qt.Unchecked,
                         setAsDefault = True,
                         spanWidth = True )

        originChoices = [
            'Lower left (default)', 'Upper left', 'Lower right', 'Upper right'
        ]

        self.gpOriginComboBox = \
            PM_ComboBox( self.pmGroupBox5 ,
                         label         =  "Origin:",
                         choices       =  originChoices,
                         setAsDefault  =  True )

        positionChoices = ['Origin axes (default)', 'Plane perimeter']

        self.gpPositionComboBox = \
            PM_ComboBox( self.pmGroupBox5 ,
                         label         =  "Position:",
                         choices       =  positionChoices,
                         setAsDefault  =  True)

        self._showHideGPWidgets()

        if env.prefs[PlanePM_showGridLabels_prefs_key]:
            self.displayLabels = True
            self.gpOriginComboBox.setEnabled(True)
            self.gpPositionComboBox.setEnabled(True)
        else:
            self.displayLabels = False
            self.gpOriginComboBox.setEnabled(False)
            self.gpPositionComboBox.setEnabled(False)

        return