當前位置: 首頁>>代碼示例>>Python>>正文


Python PM_ToolButton.isChecked方法代碼示例

本文整理匯總了Python中PM.PM_ToolButton.PM_ToolButton.isChecked方法的典型用法代碼示例。如果您正苦於以下問題:Python PM_ToolButton.isChecked方法的具體用法?Python PM_ToolButton.isChecked怎麽用?Python PM_ToolButton.isChecked使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PM.PM_ToolButton.PM_ToolButton的用法示例。


在下文中一共展示了PM_ToolButton.isChecked方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: PM_ObjectChooser

# 需要導入模塊: from PM.PM_ToolButton import PM_ToolButton [as 別名]
# 或者: from PM.PM_ToolButton.PM_ToolButton import isChecked [as 別名]

#.........這裏部分代碼省略.........
                        iconPath  = self._addIcon,
                        spanWidth = True  )
        self._addToolButton.setCheckable(True)
        self._addToolButton.setAutoRaise(True)
        
        self._removeToolButton = PM_ToolButton(
                        self, 
                        text = "Remove items from the list",
                        iconPath  = self._removeIcon,
                        spanWidth = True  )
        self._removeToolButton.setCheckable(True)
        self._removeToolButton.setAutoRaise(True)
        
        #Widgets to include in the widget row. 
        widgetList = [
            ('QLabel', "  Add/Remove Items:", 0),
            ('QSpacerItem', 5, 5, 1),
            ('PM_ToolButton', self._addToolButton, 2),
             ('QSpacerItem', 5, 5, 3),
            ('PM_ToolButton', self._removeToolButton, 4),                      
            ('QSpacerItem', 5, 5, 5) ]
        
        widgetRow = PM_WidgetRow(self,
                                 title     = '',
                                 widgetList = widgetList,
                                 label = "",
                                 spanWidth = True )
    
    def isAddToolActive(self): 
        """
        Returns True if the add objects tool is active.
        """
            
        if self._addToolButton.isChecked():
            #For safety
            if not self._removeToolButton.isChecked():         
                return True   
            
        return False            
    
    def isRemoveToolActive(self):
        """
        Returns True if the remove segments tool (which removes the segments 
        from the list of segments ) is active
        """
        if self._removeToolButton.isChecked():
            if not self._addToolButton.isChecked():
                #For safety
                return True               
        return False
    
    def hasFocus(self):
        """
        Checks if the list widget that lists dnasegments (that will undergo 
        special operations such as 'resizing them at once or making 
        crossovers between the segments etc) has the 
        Qt focus. This is used to just remove items from the list widget 
        (without actually 'deleting' the corresponding Dnasegment in the GLPane)
        @see: MultipleDnaSegment_GraphicsMode.keyPressEvent() where it is called
        """
        if self._listWidget.hasFocus():
            return True        
        return False
    
    
    def activateAddTool(self,enable):
開發者ID:elfion,項目名稱:nanoengineer,代碼行數:70,代碼來源:PM_ObjectChooser.py

示例2: _loadSegmentListWidget

# 需要導入模塊: from PM.PM_ToolButton import PM_ToolButton [as 別名]
# 或者: from PM.PM_ToolButton.PM_ToolButton import isChecked [as 別名]
class ListWidgetItems_PM_Mixin:


    def _loadSegmentListWidget(self, pmGroupBox):
        self.segmentListWidget = PM_SelectionListWidget(
            pmGroupBox,
            self.win,
            label = "",
            heightByRows = 12)

        self.segmentListWidget.setFocusPolicy(Qt.StrongFocus)
        self.segmentListWidget.setFocus()
        self.setFocusPolicy(Qt.StrongFocus)

        self.addSegmentsToolButton = PM_ToolButton(
                        pmGroupBox,
                        text = "Add segments to the list",
                        iconPath  = "ui/actions/Properties Manager"\
                        "/AddSegment_To_ResizeSegmentList.png",
                        spanWidth = True  )
        self.addSegmentsToolButton.setCheckable(True)
        self.addSegmentsToolButton.setAutoRaise(True)

        self.removeSegmentsToolButton = PM_ToolButton(
                        pmGroupBox,
                        text = "Remove segments from the list",
                        iconPath  = "ui/actions/Properties Manager"\
                        "/RemoveSegment_From_ResizeSegmentList.png",
                        spanWidth = True  )
        self.removeSegmentsToolButton.setCheckable(True)
        self.removeSegmentsToolButton.setAutoRaise(True)

        #Widgets to include in the widget row.
        widgetList = [
            ('QLabel', "  Add/Remove Segments:", 0),
            ('QSpacerItem', 5, 5, 1),
            ('PM_ToolButton', self.addSegmentsToolButton, 2),
             ('QSpacerItem', 5, 5, 3),
            ('PM_ToolButton', self.removeSegmentsToolButton, 4),
            ('QSpacerItem', 5, 5, 5) ]

        widgetRow = PM_WidgetRow(pmGroupBox,
                                 title     = '',
                                 widgetList = widgetList,
                                 label = "",
                                 spanWidth = True )

    def listWidgetHasFocus(self):
        """
        Checks if the list widget that lists dnasegments (that will undergo
        special operations such as 'resizing them at once or making
        crossovers between the segments etc) has the
        Qt focus. This is used to just remove items from the list widget
        (without actually 'deleting' the corresponding Dnasegment in the GLPane)
        @see: MultipleDnaSegment_GraphicsMode.keyPressEvent() where it is called
        """
        if self.segmentListWidget.hasFocus():
            return True
        return False


    def updateListWidgets(self):
        self.updateSegmentListWidget()

    def updateSegmentListWidget(self):
        """
        Update the list of segments shown in the segments list widget
        @see: self.updateListWidgets, self.updateStrandListWidget
        """

        segmentList = []

        segmentList = self.command.getSegmentList()


        if segmentList:
            self.segmentListWidget.insertItems(
                row = 0,
                items = segmentList)
        else:
            self.segmentListWidget.clear()



    def isAddSegmentsToolActive(self):
        """
        Returns True if the add segments tool (which adds the segments to the
        list of segments) is active
        """

        if self.addSegmentsToolButton.isChecked():
            #For safety
            if not self.removeSegmentsToolButton.isChecked():
                return True

        return False

    def isRemoveSegmentsToolActive(self):
        """
        Returns True if the remove segments tool (which removes the segments
#.........這裏部分代碼省略.........
開發者ID:alaindomissy,項目名稱:nanoengineer,代碼行數:103,代碼來源:ListWidgetItems_PM_Mixin.py


注:本文中的PM.PM_ToolButton.PM_ToolButton.isChecked方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。