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


Python BatchAlgorithmDialog.setVisible方法代码示例

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


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

示例1: StepDialog

# 需要导入模块: from processing.gui.BatchAlgorithmDialog import BatchAlgorithmDialog [as 别名]
# 或者: from processing.gui.BatchAlgorithmDialog.BatchAlgorithmDialog import setVisible [as 别名]
class StepDialog(QtGui.QDialog):
    
    def __init__(self, alg, mainDialog, canEdit=True):
        
        self.alg = alg
        self.mainDialog = mainDialog
        self.goForward = False
        self.goBackward = False
        
        QtGui.QDialog.__init__(self)
        
        self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowSystemMenuHint |
                            QtCore.Qt.WindowMinMaxButtonsHint)
        
        # create a tab for this algorithm
        self.tabLayout = QtGui.QGridLayout()
            
        self.algInstructions = QtGui.QTextEdit()
        self.algInstructions.setMinimumWidth(250)
        self.algInstructions.setMaximumWidth(250)
        self.algInstructions.setFontPointSize(10)
        if not canEdit:
            self.algInstructions.setReadOnly(True)
        
        self.normalModeDialog = alg.getCustomParametersDialog()
        if not self.normalModeDialog:
            self.normalModeDialog = AlgorithmDialog(alg)
        self.batchModeDialog = BatchAlgorithmDialog(alg)
        self.batchModeDialog.setHidden(True)
        # forwardButton does the job of cancel/close button
        try:
            if self.alg.name == "Field calculator":
                self.normalModeDialog.mButtonBox.removeButton(self.normalModeDialog.mButtonBox.button(QtGui.QDialogButtonBox.Cancel)) 
            else:    
                self.normalModeDialog.buttonBox.removeButton(self.normalModeDialog.buttonBox.button(QtGui.QDialogButtonBox.Close))
            self.batchModeDialog.buttonBox.removeButton(self.batchModeDialog.buttonBox.button(QtGui.QDialogButtonBox.Close)) # forwardButton does this job
        except:
            # Not all dialogs might have buttonBox
            pass
        if canEdit:
            try:
                self.normalModeDialog.progressBar.hide()
                self.batchModeDialog.progressBar.hide()
                if self.alg.name == "Field calculator":
                    self.normalModeDialog.mButtonBox.hide()
                else:
                    self.normalModeDialog.buttonBox.hide()
                self.batchModeDialog.buttonBox.hide() 
            except:
                # Not all dialogs might have buttonBox
                pass
        self.normalModeDialog.connect(self.normalModeDialog, QtCore.SIGNAL("finished(int)"), self.forward)
        self.batchModeDialog.connect(self.batchModeDialog, QtCore.SIGNAL("finished(int)"), self.forward)    
            
        self.tabLayout.addWidget(self.algInstructions,0,0)
        self.tabLayout.addWidget(self.normalModeDialog, 0, 1)
        self.tabLayout.addWidget(self.batchModeDialog, 0, 1)
        
        self.algMode = QtGui.QComboBox()  
        self.algMode.addItems([NORMAL_MODE, BATCH_MODE])
        if canEdit:
            self.algMode.connect(self.algMode, QtCore.SIGNAL("currentIndexChanged(QString)"),  self.mainDialog.changeAlgMode)
            self.tabLayout.addWidget(self.algMode, 1, 1)
        else:
            self.buttonBox = QtGui.QDialogButtonBox()
            self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
            self.backwardButton = QtGui.QPushButton()
            self.backwardButton.setText("< Previous step")
            self.buttonBox.addButton(self.backwardButton, QtGui.QDialogButtonBox.ActionRole)
            QtCore.QObject.connect(self.backwardButton, QtCore.SIGNAL("clicked()"), self.backward)
            self.forwardButton = QtGui.QPushButton()
            self.forwardButton.setText("Skip step >")
            self.buttonBox.addButton(self.forwardButton, QtGui.QDialogButtonBox.ActionRole)
            QtCore.QObject.connect(self.forwardButton, QtCore.SIGNAL("clicked()"), self.forward)
            self.closeButton = QtGui.QPushButton()
            self.closeButton.setText("Finish Workflow")
            self.buttonBox.addButton(self.closeButton, QtGui.QDialogButtonBox.ActionRole)
            QtCore.QObject.connect(self.closeButton, QtCore.SIGNAL("clicked()"), self.close)
            self.tabLayout.addWidget(self.buttonBox, 1, 1)
            
        self.setLayout(self.tabLayout)
        
        self.executed = self.normalModeDialog.executed
    
    def forward(self):
        self.goForward = True
        self.close()
        
    def backward(self):
        self.goBackward = True
        self.close()
        
    def getMode(self):
        return self.algMode.currentText()
    
    def setMode(self, mode):
        if mode == NORMAL_MODE and not self.normalModeDialog.isVisible(): 
            self.batchModeDialog.setHidden(True)
            self.normalModeDialog.setVisible(True)
        elif mode == BATCH_MODE and not self.batchModeDialog.isVisible():
#.........这里部分代码省略.........
开发者ID:DominikReisinger,项目名称:Processing-Workflow,代码行数:103,代码来源:StepDialog.py


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