Пример #1
0
    def __init__(self,
                 parentWidget,
                 title='Clipboard',
                 win=None,
                 elementViewer=None):
        """
        Appends a PM_Clipboard groupbox widget to I{parentWidget},a L{PM_Dialog}

        @param parentWidget: The parent dialog (Property manager) containing
                             this  widget.
        @type  parentWidget: L{PM_Dialog}

        @param title: The title (button) text.
        @type  title: str

        @param win: MainWindow object
        @type  win: L{MWsemantics} or None

        @param elementViewer: The associated preview pane groupbox. If provided,
                              The selected item in L{self.clipboardListWidget}
                              is shown (previewed) by L{elementViewer}.
                              The object being previewed can then be deposited
                              into the 3D workspace.
        @type  elementViewer: L{PM_PreviewGroupBox} or None

        """

        self.w = win
        self.elementViewer = elementViewer
        self.elementViewer.setDisplay(diTUBES)
        self.pastableItems = None

        PM_GroupBox.__init__(self, parentWidget, title)

        self._loadClipboardGroupbox()
Пример #2
0
    def __init__(self, parentWidget, title="Clipboard", win=None, elementViewer=None):

        """
        Appends a PM_Clipboard groupbox widget to I{parentWidget},a L{PM_Dialog}
                
        @param parentWidget: The parent dialog (Property manager) containing 
                             this  widget.
        @type  parentWidget: L{PM_Dialog}
        
        @param title: The title (button) text.
        @type  title: str
        
        @param win: MainWindow object
        @type  win: L{MWsemantics} or None
        
        @param elementViewer: The associated preview pane groupbox. If provided, 
                              The selected item in L{self.clipboardListWidget}
                              is shown (previewed) by L{elementViewer}.
                              The object being previewed can then be deposited 
                              into the 3D workspace.
        @type  elementViewer: L{PM_PreviewGroupBox} or None
        
        """

        self.w = win
        self.elementViewer = elementViewer
        self.elementViewer.setDisplay(diTUBES)
        self.pastableItems = None

        PM_GroupBox.__init__(self, parentWidget, title)

        self._loadClipboardGroupbox()
Пример #3
0
 def __init__(self, 
              parentWidget,
              glpane = None,
              title = 'Preview'
              ):
     """
     Appends a PM_PreviewGroupBox widget to I{parentWidget},a L{PM_Dialog}
             
     @param parentWidget: The parent dialog (Property manager) containing 
                          this  widget.
     @type  parentWidget: L{PM_Dialog}
     
     @param glpane: GLPane object used in construction of the 
                    L{self.elementViewer}
     @type  glpane: L{GLPane} or None
     
     @param title: The title (button) text.
     @type  title: str      
     
     """
     PM_GroupBox.__init__(self, parentWidget, title)
     
     self.glpane = glpane 
     self.parentWidget = parentWidget        
     self._loadPreviewGroupBox()
    def __init__(self,
                 parentWidget,
                 paramsForCheckBoxes=(),
                 checkBoxColumn=1,
                 title=''):
        """
        @param parentWidget: The parent dialog or group box containing this
                             widget.
        @type  parentWidget: L{PM_Dialog} or L{PM_GroupBox}
        
        @param title: The title (button) text. If empty, no title is added.
        @type  title: str
        
        @param paramsForCheckBoxes: A list object that contains tuples like the
               following : ('checkBoxTextString' , preference_key). The 
               checkboxes will be constucted by looping over this list.
        @type paramsForCheckBoxes:list
        @param checkBoxColumn: The widget column in which all the checkboxes
               will be inserted. 
        @type  checkBoxColumn: int
        
        @see: DnaDuplexPropertyManager._loadDisplayOptionsGroupBox for an 
              example use.
        """
        PM_GroupBox.__init__(self, parentWidget, title=title)

        self._checkBoxColumn = checkBoxColumn

        #Also maintain all checkboxes created by this class in this list,
        #just in case the caller needs them. (need access methods for this)
        self.checkBoxes = []

        #Create checkboxes and also connect them to their preference keys.
        self._addCheckBoxes(paramsForCheckBoxes)
Пример #5
0
    def __init__(self,
                 parentWidget,
                 glpane = None,
                 title = 'Preview'
                 ):
        """
        Appends a PM_PreviewGroupBox widget to I{parentWidget},a L{PM_Dialog}

        @param parentWidget: The parent dialog (Property manager) containing
                             this  widget.
        @type  parentWidget: L{PM_Dialog}

        @param glpane: GLPane object used in construction of the
                       L{self.elementViewer}
        @type  glpane: L{GLPane} or None

        @param title: The title (button) text.
        @type  title: str

        """
        PM_GroupBox.__init__(self, parentWidget, title)

        self.glpane = glpane
        self.parentWidget = parentWidget
        self._loadPreviewGroupBox()
    def __init__(self,
                 parentWidget,
                 paramsForCheckBoxes=(),
                 checkBoxColumn=1,
                 title=''):
        """
        @param parentWidget: The parent dialog or group box containing this
                             widget.
        @type  parentWidget: L{PM_Dialog} or L{PM_GroupBox}
        
        @param title: The title (button) text. If empty, no title is added.
        @type  title: str
        
        @param paramsForCheckBoxes: A list object that contains tuples like the
               following : ('checkBoxTextString' , preference_key). The 
               checkboxes will be constucted by looping over this list.
        @type paramsForCheckBoxes:list
        @param checkBoxColumn: The widget column in which all the checkboxes
               will be inserted. 
        @type  checkBoxColumn: int
        
        @see: DnaDuplexPropertyManager._loadDisplayOptionsGroupBox for an 
              example use.
        """
        PM_GroupBox.__init__(self, parentWidget, title=title)

        self._checkBoxColumn = checkBoxColumn

        #Also maintain all checkboxes created by this class in this list,
        #just in case the caller needs them. (need access methods for this)
        self.checkBoxes = []

        #Create checkboxes and also connect them to their preference keys.
        self._addCheckBoxes(paramsForCheckBoxes)
Пример #7
0
    def __init__(self,
                 parentWidget,
                 title='Part Library',
                 win=None,
                 elementViewer=None):
        self.w = win
        self.elementViewer = elementViewer
        # piotr 080410 changed diTUBES to diTrueCPK
        self.elementViewer.setDisplay(diTrueCPK)
        self.partLib = None
        self.newModel = None

        PM_GroupBox.__init__(self, parentWidget, title)

        self._loadPartLibGroupBox()
Пример #8
0
    def __init__(self, 
                 parentWidget,
                 title = 'Part Library',
                 win   = None,
                 elementViewer = None
                 ):            
        self.w = win
        self.elementViewer = elementViewer
        # piotr 080410 changed diTUBES to diTrueCPK
        self.elementViewer.setDisplay(diTrueCPK)
        self.partLib = None
        self.newModel = None

        PM_GroupBox.__init__(self, parentWidget, title)

        self._loadPartLibGroupBox()
Пример #9
0
    def __init__(
        self,
        parentWidget,
        parentPropMgr=None,
        title="Molecular Modeling Kit",
        element="",
        elementViewer=None,
    ):
        """
        Appends a AtomChooser widget (see subclasses) to the bottom of
        I{parentWidget}, a Property Manager dialog.
        (or as a sub groupbox for Atom Chooser  GroupBox.)

        @param parentWidget: The parent PM_Dialog or PM_groupBox containing this
                             widget.
        @type  parentWidget: PM_Dialog or PM_GroupBox

        @param parentPropMgr: The parent Property Manager
        @type  parentPropMgr: PM_Dialog or None

        @param title: The button title on the group box containing the
                      Element Chooser.
        @type  title: str

        @param element: The initially selected element. It can be either an
                        element symbol or name.
        @type  element: str
        """

        PM_GroupBox.__init__(self, parentWidget, title)

        self.element = self._periodicTable.getElement(element)
        self.elementViewer = elementViewer
        self.updateElementViewer()

        if parentPropMgr:
            self.parentPropMgr = parentPropMgr
        else:
            self.parentPropMgr = parentWidget

        self._addGroupBoxes()
        self.connect_or_disconnect_signals(True)
    def __init__(self,
                 parentWidget,
                 parentPropMgr   = None,
                 title           = "Molecular Modeling Kit",
                 element         = "",
                 elementViewer   =  None,
                 ):
        """
        Appends a AtomChooser widget (see subclasses) to the bottom of
        I{parentWidget}, a Property Manager dialog.
        (or as a sub groupbox for Atom Chooser  GroupBox.)

        @param parentWidget: The parent PM_Dialog or PM_groupBox containing this
                             widget.
        @type  parentWidget: PM_Dialog or PM_GroupBox

        @param parentPropMgr: The parent Property Manager
        @type  parentPropMgr: PM_Dialog or None

        @param title: The button title on the group box containing the
                      Element Chooser.
        @type  title: str

        @param element: The initially selected element. It can be either an
                        element symbol or name.
        @type  element: str
        """

        PM_GroupBox.__init__(self, parentWidget, title)

        self.element = self._periodicTable.getElement(element)
        self.elementViewer = elementViewer
        self.updateElementViewer()

        if parentPropMgr:
            self.parentPropMgr = parentPropMgr
        else:
            self.parentPropMgr = parentWidget

        self._addGroupBoxes()
        self.connect_or_disconnect_signals(True)
Пример #11
0
    def __init__(self, parentWidget, title="Message"):
        """
        PM_MessageGroupBox constructor.

        @param parentWidget: the PM_Dialog containing this message groupbox.
        @type  parentWidget: PM_Dialog

        @param title: The title on the collapse button
        @type  title: str
        """

        PM_GroupBox.__init__(self, parentWidget, title)

        self.vBoxLayout.setMargin(0)
        self.vBoxLayout.setSpacing(0)

        self.gridLayout.setMargin(0)
        self.gridLayout.setSpacing(0)

        self.MessageTextEdit = PM_TextEdit(
            self,
            label='',
            spanWidth=True,
            addToParent=False,
            ##cursorPosition = 'beginning'
        )
        # We pass addToParent = False to suppress the usual call by
        # PM_TextEdit.__init__ of self.addPmWidget(new textedit widget),
        # since we need to add it to self in a different way (below).
        # [bruce 071103 refactored this from what used to be a special case
        #  in PM_TextEdit.__init__ based on self being an instance of
        #  PM_MessageGroupBox.]

        # Needed for Intel MacOS. Otherwise, the horizontal scrollbar
        # is displayed in the MessageGroupBox. Mark 2007-05-24.
        # Shouldn't be needed with _setHeight() in PM_TextEdit.

        #Note 2008-06-17: We now permit a vertical scrollbar in message groupbox
        #--Ninad

        self.MessageTextEdit.setHorizontalScrollBarPolicy(
            Qt.ScrollBarAlwaysOff)

        # Add self.MessageTextEdit to self's vBoxLayout.
        self.vBoxLayout.addWidget(self.MessageTextEdit)
        # We should be calling the PM's getMessageTextEditPalette() method,
        # but that will take some extra work which I will do soon. Mark 2007-06-21
        self.MessageTextEdit.setPalette(
            getPalette(None, QPalette.Base, pmMessageBoxColor))
        self.MessageTextEdit.setReadOnly(True)
        #@self.MessageTextEdit.labelWidget = None # Never has one. Mark 2007-05-31
        self._widgetList.append(self.MessageTextEdit)
        self._rowCount += 1

        # wrapWrapMode seems to be set to QTextOption.WrapAnywhere on MacOS,
        # so let's force it here. Mark 2007-05-22.
        self.MessageTextEdit.setWordWrapMode(QTextOption.WordWrap)

        parentWidget.MessageTextEdit = self.MessageTextEdit

        # These two policies very important. Mark 2007-05-22
        self.setSizePolicy(
            QSizePolicy(QSizePolicy.Policy(QSizePolicy.Preferred),
                        QSizePolicy.Policy(QSizePolicy.Fixed)))

        self.MessageTextEdit.setSizePolicy(
            QSizePolicy(QSizePolicy.Policy(QSizePolicy.Preferred),
                        QSizePolicy.Policy(QSizePolicy.Fixed)))

        self.setWhatsThis("""<b>Messages</b>
                          <p>This prompts the user for a requisite operation and/or displays 
helpful messages to the user.</p>""")

        # Hide until insertHtmlMessage() loads a message.
        self.hide()
 def __init__(self, 
              parentWidget,
              title = "",
              label = '',
              labelColumn = 0,
              spanWidth   = True 
              ):
     """
     Appends a PM_CoordinateSpinBoxes groupbox widget to I{parentWidget},
     a L{PM_Groupbox} or a L{PM_Dialog}
             
     @param parentWidget: The parent groupbox or dialog (Property manager) 
                          containing this  widget.
     @type  parentWidget: L{PM_GroupBox} or L{PM_Dialog} 
     
     @param title: The title (button) text.
     @type  title: str        
     
     @param label:      The label for the coordinate spinbox.
     @type  label:      str
     
     @param labelColumn: The column in the parentWidget's grid layout to 
                         which this widget's label will be added. 
                         The labelColum can only be E{0} or E{1}
     @type  labelColumn: int
     
     @param spanWidth: If True, the widget and its label will span the width
                      of the group box. Its label will appear directly above
                      the widget (unless the label is empty) and is left 
                      justified.
     @type  spanWidth: bool (default False)
     """
     
     # Intializing label, labelColumn etc is needed before doing 
     # PM_GroupBox.__init__. This is done so that 
     # self.parentWidget.addPmWidget(self) done at the end of __init__
     # works properly. 
     # 'self.parentWidget.addPmWidget(self)' is done to avoid a bug where a 
     # groupbox is always appended as the 'last widget' when its 
     # parentWidget is also a groupbox. This is due to other PM widgets 
     #(e.g. PM_PushButton)add themselves to their parent widget in their 
     #__init__ using self.parentWidget.addPmWidget(self). So doing the
     #same thing here. More general fix is needed in PM_GroupBox code
     # --Ninad 2007-11-14
     self.label = label
     self.labelColumn = labelColumn
     self.spanWidth = spanWidth
     
     if label: # Create this widget's QLabel.
         self.labelWidget = QLabel()
         self.labelWidget.setText(label)
         
     PM_GroupBox.__init__(self, parentWidget, title)
     
     #Initialize attributes
     self.xSpinBox = None
     self.ySpinBox = None
     self.zSpinBox = None
     
     self._loadCoordinateSpinBoxes()
     
     self.parentWidget.addPmWidget(self)
Пример #13
0
    def __init__(self,
                 parentWidget,
                 title='',
                 widgetList=[],
                 alignment=None,
                 label='',
                 labelColumn=0,
                 spanWidth=True):
        """
        Appends a PM_WidgetGrid (a group box widget) to the bottom of 
        I{parentWidget},the Property Manager Group box.
        
        @param parentWidget: The parent group box containing this widget.
        @type  parentWidget: PM_GroupBox 
        
        @param title: The group box title.
        @type  title: str
        
        @param widgetList: A list of I{widget info lists}. There is one widget
                           info list for each widget in the grid. The widget
                           info list contains custom information about the 
                           widget but the following items are always present:
                           - First Item       : Widget Type (str),
                           - Second Last Item : Column (int), 
                           - Last Item        : Row (int).
        @type  widgetList: list
        
        @param alignment:  The alignment of the widget row in the parent 
                           groupbox. Based on its value,spacer items is added 
                           to the grid layout of the parent groupbox. 
        @type  alignment:  str
        
        @param label:      The label for the widget row. .
        @type  label:      str
        
        @param labelColumn: The column in the parentWidget's grid layout to 
                            which this widget's label will be added. 
                            The labelColum can only be E{0} or E{1}
        @type  labelColumn: int
        
        @param spanWidth: If True, the widget and its label will span the width
                         of the group box. Its label will appear directly above
                         the widget (unless the label is empty) and is left 
                         justified.
        @type  spanWidth: bool (default False)
        
       
        """

        self.label = label
        self.labelColumn = labelColumn
        self.spanWidth = spanWidth

        if label:  # Create this widget's QLabel.
            self.labelWidget = QLabel()
            self.labelWidget.setText(label)

        PM_GroupBox.__init__(self, parentWidget, title)

        # These are needed to properly maintain the height of the grid if
        # all labels in a row are hidden via hide().
        self.vBoxLayout.setMargin(0)
        self.vBoxLayout.setSpacing(0)

        self.gridLayout.setMargin(0)
        self.gridLayout.setSpacing(0)

        self.parentWidget = parentWidget
        self.widgetList = widgetList

        self.alignment = alignment

        self.loadWidgets()
Пример #14
0
 def __init__(self, 
              parentWidget, 
              title        = '', 
              label = '',
              labelColumn = 0,
              buttonList   = [],
              checkedId    = -1,
              setAsDefault = False, 
              spanWidth   = True, 
              borders = True
              ):
     """
     Appends a PM_RadioButtonList widget to the bottom of I{parentWidget}, 
     the Property Manager dialog or group box.
     
     @param parentWidget: The parent group box containing this widget.
     @type  parentWidget: PM_GroupBox or PM_Dialog
     
     @param title: The group box title.
     @type  title: str
     
     @param label:      The label for the coordinate spinbox.
     @type  label:      str
     
     @param labelColumn: The column in the parentWidget's grid layout to 
                         which this widget's label will be added. 
                         The labelColum can only be E{0} or E{1}
     @type  labelColumn: int
             
     
     @param buttonList: A list of I{button info lists}. There is one button
                        info list for each radio button in the list. The 
                        button info list contains the following three items:
                        1). Button Id (int), 
                        2). Button text (str),
                        3). Button tool tip (str).
     @type  buttonList: list
     
     @param spanWidth: If True, the widget and its label will span the width
                      of the group box. Its label will appear directly above
                      the widget (unless the label is empty) and is left 
                      justified.
     @type  spanWidth: bool (default False)
     
     
     @param borders: If true (default), this widget will have borders displayed. 
                     otherwise the won't be any outside borders around the 
                     set of radio buttons this class provides
     @type borders: boolean
     """
     
     # Intializing label, labelColumn etc is needed before doing 
     # PM_GroupBox.__init__. This is done so that 
     # self.parentWidget.addPmWidget(self) done at the end of __init__
     # works properly. 
     # 'self.parentWidget.addPmWidget(self)' is done to avoid a bug where a 
     # groupbox is always appended as the 'last widget' when its 
     # parentWidget is also a groupbox. This is due to other PM widgets 
     #(e.g. PM_PushButton)add themselves to their parent widget in their 
     #__init__ using self.parentWidget.addPmWidget(self). So doing the
     #same thing here. More general fix is needed in PM_GroupBox code
     # --Ninad 2007-11-14 (comment copied from PM_coordinateSpinBoxes)
     self.label = label
     self.labelColumn = labelColumn
     self.spanWidth = spanWidth
     
     if label: # Create this widget's QLabel.
         self.labelWidget = QLabel()
         self.labelWidget.setText(label)
         
     
     PM_GroupBox.__init__(self, parentWidget, title)
     
     # These are needed to properly maintain the height of the grid if 
     # all buttons in a row are hidden via hide().
     self.vBoxLayout.setMargin(0)
     self.vBoxLayout.setSpacing(0)
     
     self.buttonGroup = QButtonGroup()
     self.buttonGroup.setExclusive(True)
     
     self.parentWidget = parentWidget
     self.buttonList   = buttonList
     
     if setAsDefault:
         self.setDefaultCheckedId(checkedId)
     
     self.buttonsById   = {}
     self.buttonsByText = {}
         
     # Create radio button list from button info.
     for buttonInfo in buttonList:
         buttonId       = buttonInfo[0]
         buttonText     = buttonInfo[1]
         buttonToolTip  = buttonInfo[2]
         
         button = QRadioButton(self)
         
         button.setText(buttonText)
         button.setToolTip(buttonToolTip) # Not working.
         button.setCheckable(True)
         if checkedId == buttonId:
             button.setChecked(True)
         self.buttonGroup.addButton(button, buttonId)
         self.vBoxLayout.addWidget(button)
         
         self.buttonsById[buttonId]    = button
         self.buttonsByText[buttonText] = button
         
     if isinstance(self.parentWidget, PM_GroupBox):
         self.parentWidget.addPmWidget(self)
     else:   
         #@@ Should self be added to self.parentWidget's widgetList?
         #don't know. Retaining old code -- Ninad 2008-06-23
         self._widgetList.append(self)            
         self._rowCount += 1
     
     if not borders:
         #reset the style sheet so that there are no borders around the 
         #radio button set this class provides. 
         self.setStyleSheet(self._getAlternateStyleSheet())
    def __init__(self,
                 parentWidget,
                 title = "Message"
                 ):
        """
        PM_MessageGroupBox constructor.

        @param parentWidget: the PM_Dialog containing this message groupbox.
        @type  parentWidget: PM_Dialog

        @param title: The title on the collapse button
        @type  title: str
        """

        PM_GroupBox.__init__(self, parentWidget, title)

        self.vBoxLayout.setMargin(0)
        self.vBoxLayout.setSpacing(0)

        self.gridLayout.setMargin(0)
        self.gridLayout.setSpacing(0)


        self.MessageTextEdit = PM_TextEdit(self,
                                           label='',
                                           spanWidth = True,
                                           addToParent = False,
                                           ##cursorPosition = 'beginning'
                                       )
            # We pass addToParent = False to suppress the usual call by
            # PM_TextEdit.__init__ of self.addPmWidget(new textedit widget),
            # since we need to add it to self in a different way (below).
            # [bruce 071103 refactored this from what used to be a special case
            #  in PM_TextEdit.__init__ based on self being an instance of
            #  PM_MessageGroupBox.]

        # Needed for Intel MacOS. Otherwise, the horizontal scrollbar
        # is displayed in the MessageGroupBox. Mark 2007-05-24.
        # Shouldn't be needed with _setHeight() in PM_TextEdit.

        #Note 2008-06-17: We now permit a vertical scrollbar in message groupbox
        #--Ninad

        self.MessageTextEdit.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)

        # Add self.MessageTextEdit to self's vBoxLayout.
        self.vBoxLayout.addWidget(self.MessageTextEdit)
        # We should be calling the PM's getMessageTextEditPalette() method,
        # but that will take some extra work which I will do soon. Mark 2007-06-21
        self.MessageTextEdit.setPalette(getPalette( None,
                                                    QPalette.Base,
                                                    pmMessageBoxColor))
        self.MessageTextEdit.setReadOnly(True)
        #@self.MessageTextEdit.labelWidget = None # Never has one. Mark 2007-05-31
        self._widgetList.append(self.MessageTextEdit)
        self._rowCount += 1


        # wrapWrapMode seems to be set to QTextOption.WrapAnywhere on MacOS,
        # so let's force it here. Mark 2007-05-22.
        self.MessageTextEdit.setWordWrapMode(QTextOption.WordWrap)

        parentWidget.MessageTextEdit = self.MessageTextEdit

        # These two policies very important. Mark 2007-05-22
        self.setSizePolicy(
            QSizePolicy(QSizePolicy.Policy(QSizePolicy.Preferred),
                        QSizePolicy.Policy(QSizePolicy.Fixed)))

        self.MessageTextEdit.setSizePolicy(
            QSizePolicy(QSizePolicy.Policy(QSizePolicy.Preferred),
                        QSizePolicy.Policy(QSizePolicy.Fixed)))

        self.setWhatsThis("""<b>Messages</b>
                          <p>This prompts the user for a requisite operation and/or displays
helpful messages to the user.</p>""")

        # Hide until insertHtmlMessage() loads a message.
        self.hide()
    def __init__(self,
                 parentWidget,
                 title='',
                 label='',
                 labelColumn=0,
                 buttonList=[],
                 checkedId=-1,
                 setAsDefault=False,
                 spanWidth=True,
                 borders=True):
        """
        Appends a PM_RadioButtonList widget to the bottom of I{parentWidget}, 
        the Property Manager dialog or group box.
        
        @param parentWidget: The parent group box containing this widget.
        @type  parentWidget: PM_GroupBox or PM_Dialog
        
        @param title: The group box title.
        @type  title: str
        
        @param label:      The label for the coordinate spinbox.
        @type  label:      str
        
        @param labelColumn: The column in the parentWidget's grid layout to 
                            which this widget's label will be added. 
                            The labelColum can only be E{0} or E{1}
        @type  labelColumn: int
                
        
        @param buttonList: A list of I{button info lists}. There is one button
                           info list for each radio button in the list. The 
                           button info list contains the following three items:
                           1). Button Id (int), 
                           2). Button text (str),
                           3). Button tool tip (str).
        @type  buttonList: list
        
        @param spanWidth: If True, the widget and its label will span the width
                         of the group box. Its label will appear directly above
                         the widget (unless the label is empty) and is left 
                         justified.
        @type  spanWidth: bool (default False)
        
        
        @param borders: If true (default), this widget will have borders displayed. 
                        otherwise the won't be any outside borders around the 
                        set of radio buttons this class provides
        @type borders: boolean
        """

        # Intializing label, labelColumn etc is needed before doing
        # PM_GroupBox.__init__. This is done so that
        # self.parentWidget.addPmWidget(self) done at the end of __init__
        # works properly.
        # 'self.parentWidget.addPmWidget(self)' is done to avoid a bug where a
        # groupbox is always appended as the 'last widget' when its
        # parentWidget is also a groupbox. This is due to other PM widgets
        #(e.g. PM_PushButton)add themselves to their parent widget in their
        #__init__ using self.parentWidget.addPmWidget(self). So doing the
        #same thing here. More general fix is needed in PM_GroupBox code
        # --Ninad 2007-11-14 (comment copied from PM_coordinateSpinBoxes)
        self.label = label
        self.labelColumn = labelColumn
        self.spanWidth = spanWidth

        if label:  # Create this widget's QLabel.
            self.labelWidget = QLabel()
            self.labelWidget.setText(label)

        PM_GroupBox.__init__(self, parentWidget, title)

        # These are needed to properly maintain the height of the grid if
        # all buttons in a row are hidden via hide().
        self.vBoxLayout.setMargin(0)
        self.vBoxLayout.setSpacing(0)

        self.buttonGroup = QButtonGroup()
        self.buttonGroup.setExclusive(True)

        self.parentWidget = parentWidget
        self.buttonList = buttonList

        if setAsDefault:
            self.setDefaultCheckedId(checkedId)

        self.buttonsById = {}
        self.buttonsByText = {}

        # Create radio button list from button info.
        for buttonInfo in buttonList:
            buttonId = buttonInfo[0]
            buttonText = buttonInfo[1]
            buttonToolTip = buttonInfo[2]

            button = QRadioButton(self)

            button.setText(buttonText)
            button.setToolTip(buttonToolTip)  # Not working.
            button.setCheckable(True)
            if checkedId == buttonId:
                button.setChecked(True)
            self.buttonGroup.addButton(button, buttonId)
            self.vBoxLayout.addWidget(button)

            self.buttonsById[buttonId] = button
            self.buttonsByText[buttonText] = button

        if isinstance(self.parentWidget, PM_GroupBox):
            self.parentWidget.addPmWidget(self)
        else:
            #@@ Should self be added to self.parentWidget's widgetList?
            #don't know. Retaining old code -- Ninad 2008-06-23
            self._widgetList.append(self)
            self._rowCount += 1

        if not borders:
            #reset the style sheet so that there are no borders around the
            #radio button set this class provides.
            self.setStyleSheet(self._getAlternateStyleSheet())
Пример #17
0
    def __init__(self,
                 parentWidget,
                 title="",
                 label='',
                 labelColumn=0,
                 spanWidth=True):
        """
        Appends a PM_CoordinateSpinBoxes groupbox widget to I{parentWidget},
        a L{PM_Groupbox} or a L{PM_Dialog}

        @param parentWidget: The parent groupbox or dialog (Property manager)
                             containing this  widget.
        @type  parentWidget: L{PM_GroupBox} or L{PM_Dialog}

        @param title: The title (button) text.
        @type  title: str

        @param label:      The label for the coordinate spinbox.
        @type  label:      str

        @param labelColumn: The column in the parentWidget's grid layout to
                            which this widget's label will be added.
                            The labelColum can only be E{0} or E{1}
        @type  labelColumn: int

        @param spanWidth: If True, the widget and its label will span the width
                         of the group box. Its label will appear directly above
                         the widget (unless the label is empty) and is left
                         justified.
        @type  spanWidth: bool (default False)
        """

        # Intializing label, labelColumn etc is needed before doing
        # PM_GroupBox.__init__. This is done so that
        # self.parentWidget.addPmWidget(self) done at the end of __init__
        # works properly.
        # 'self.parentWidget.addPmWidget(self)' is done to avoid a bug where a
        # groupbox is always appended as the 'last widget' when its
        # parentWidget is also a groupbox. This is due to other PM widgets
        #(e.g. PM_PushButton)add themselves to their parent widget in their
        #__init__ using self.parentWidget.addPmWidget(self). So doing the
        #same thing here. More general fix is needed in PM_GroupBox code
        # --Ninad 2007-11-14
        self.label = label
        self.labelColumn = labelColumn
        self.spanWidth = spanWidth

        if label:  # Create this widget's QLabel.
            self.labelWidget = QLabel()
            self.labelWidget.setText(label)

        PM_GroupBox.__init__(self, parentWidget, title)

        #Initialize attributes
        self.xSpinBox = None
        self.ySpinBox = None
        self.zSpinBox = None

        self._loadCoordinateSpinBoxes()

        self.parentWidget.addPmWidget(self)
Пример #18
0
 def __init__(self, 
              parentWidget,
              title     = '',
              widgetList = [],
              alignment = None,
              label = '',
              labelColumn = 0,
              spanWidth   = True                 
              ):
     
     
     """
     Appends a PM_WidgetGrid (a group box widget) to the bottom of 
     I{parentWidget},the Property Manager Group box.
     
     @param parentWidget: The parent group box containing this widget.
     @type  parentWidget: PM_GroupBox 
     
     @param title: The group box title.
     @type  title: str
     
     @param widgetList: A list of I{widget info lists}. There is one widget
                        info list for each widget in the grid. The widget
                        info list contains custom information about the 
                        widget but the following items are always present:
                        - First Item       : Widget Type (str),
                        - Second Last Item : Column (int), 
                        - Last Item        : Row (int).
     @type  widgetList: list
     
     @param alignment:  The alignment of the widget row in the parent 
                        groupbox. Based on its value,spacer items is added 
                        to the grid layout of the parent groupbox. 
     @type  alignment:  str
     
     @param label:      The label for the widget row. .
     @type  label:      str
     
     @param labelColumn: The column in the parentWidget's grid layout to 
                         which this widget's label will be added. 
                         The labelColum can only be E{0} or E{1}
     @type  labelColumn: int
     
     @param spanWidth: If True, the widget and its label will span the width
                      of the group box. Its label will appear directly above
                      the widget (unless the label is empty) and is left 
                      justified.
     @type  spanWidth: bool (default False)
     
    
     """
      
     
     self.label = label
     self.labelColumn = labelColumn
     self.spanWidth = spanWidth
     
     if label: # Create this widget's QLabel.
         self.labelWidget = QLabel()
         self.labelWidget.setText(label)
     
     PM_GroupBox.__init__(self, parentWidget, title)
     
     # These are needed to properly maintain the height of the grid if 
     # all labels in a row are hidden via hide().
     self.vBoxLayout.setMargin(0)
     self.vBoxLayout.setSpacing(0)
     
     self.gridLayout.setMargin(0)
     self.gridLayout.setSpacing(0)
                  
     self.parentWidget = parentWidget
     self.widgetList   = widgetList
                 
     self.alignment = alignment
     
     self.loadWidgets()