当前位置: 首页>>代码示例>>Python>>正文


Python PM_LineEdit.setStyleSheet方法代码示例

本文整理汇总了Python中PM.PM_LineEdit.PM_LineEdit.setStyleSheet方法的典型用法代码示例。如果您正苦于以下问题:Python PM_LineEdit.setStyleSheet方法的具体用法?Python PM_LineEdit.setStyleSheet怎么用?Python PM_LineEdit.setStyleSheet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PM.PM_LineEdit.PM_LineEdit的用法示例。


在下文中一共展示了PM_LineEdit.setStyleSheet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: OrderDna_PropertyManager

# 需要导入模块: from PM.PM_LineEdit import PM_LineEdit [as 别名]
# 或者: from PM.PM_LineEdit.PM_LineEdit import setStyleSheet [as 别名]

#.........这里部分代码省略.........
        self.update_includeStrands()
        return
        
    def getDnaSequence(self, format = 'CSV'):
        """
        Return the complete Dna sequence information string (i.e. all strand 
        sequences) in the specified format. 
        
        @return: The Dna sequence string
        @rtype: string
        
        """
        if format == 'CSV': #comma separated values.
            separator = ','
            
        dnaSequenceString = ''
        selectedOnly = self.includeStrandsComboBox.currentIndex()
        strandList = self.getAllDnaStrands(selectedOnly)
        
        for strand in strandList:
            dnaSequenceString = dnaSequenceString + strand.name + separator
            strandSequenceString = str(strand.getStrandSequence())
            if strandSequenceString: 
                strandSequenceString = strandSequenceString.upper()
                strandLength = str(len(strandSequenceString)) + separator
                dnaSequenceString = dnaSequenceString + strandLength + strandSequenceString
                
            dnaSequenceString = dnaSequenceString + "\n"
            
        return dnaSequenceString
        
    def viewDnaOrderFile(self, openFileInEditor = True):
        """
        Writes a DNA Order file in comma-separated values (CSV) format 
        and opens it in a text editor.

        The user must save the file to a permanent location using the 
        text editor.

        @see: Ui_DnaFlyout.orderDnaCommand
        @see: writeDnaOrderFile()
        @TODO: assy.getAllDnaObjects(). 
        """
        dnaSequence = self.getDnaSequence(format = 'CSV')

        if dnaSequence: 
            tmpdir = find_or_make_Nanorex_subdir('temp')
            fileBaseName = 'DnaOrder'
            temporaryFile = os.path.join(tmpdir, "%s.csv" % fileBaseName)            
            writeDnaOrderFile(temporaryFile, 
                              self.assy,
                              self.getNumberOfBases(),
                              self.getNumberOfBases(unassignedOnly = True),
                              dnaSequence)      

            if openFileInEditor:
                open_file_in_editor(temporaryFile)
                
        return

    def update_includeStrands(self, ignoreVal = 0):
        """
        Slot method for "Include (strands)" combobox.
        """
        
        idx = self.includeStrandsComboBox.currentIndex()
        
        includeType = ["model", "selection"]
        
        _numberOfBases = self.getNumberOfBases()
        self.numberOfBasesLineEdit.setText(str(_numberOfBases) + " bases")
        
        _numberOfXBases = self.getNumberOfBases(unassignedOnly = True)
        self.numberOfXBasesLineEdit.setText(str(_numberOfXBases) + " bases")
        
        # Make the background color red if there are any unassigned bases.
        if _numberOfXBases:
            self.numberOfXBasesLineEdit.setStyleSheet(\
                "QLineEdit {"\
                "background-color: rgb(255, 0, 0)"\
                "}")
        else:
            self.numberOfXBasesLineEdit.setStyleSheet(\
                "QLineEdit {"\
                "background-color: rgb(255, 255, 255)"\
                "}")
        
        if _numberOfBases > 0:
            self.viewDnaOrderFileButton.setEnabled(True)
            msg = "Click on <b>View DNA Order File...</b> to preview a " \
                "DNA order for all DNA strands in the current %s." \
                % includeType[idx]
        else:
            self.viewDnaOrderFileButton.setEnabled(False)
            msg = "<font color=red>" \
                "There are no DNA strands in the current %s." \
                % includeType[idx]
                
        self.updateMessage(msg)
        return
开发者ID:elfion,项目名称:nanoengineer,代码行数:104,代码来源:OrderDna_PropertyManager.py


注:本文中的PM.PM_LineEdit.PM_LineEdit.setStyleSheet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。