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


Python QtGui.QIntValidator方法代码示例

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


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

示例1: load_zstack

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QIntValidator [as 别名]
def load_zstack(self):
        name = QtGui.QFileDialog.getOpenFileName(
            self, "Open zstack", filter="*.tif"
        )
        self.fname = name[0]
        try:
            self.zstack = imread(self.fname)
            self.zLy, self.zLx = self.zstack.shape[1:]
            self.Zedit.setValidator(QtGui.QIntValidator(0, self.zstack.shape[0]))
            self.zrange = [np.percentile(self.zstack,1), np.percentile(self.zstack,99)]

            self.computeZ.setEnabled(True)
            self.zloaded = True
            self.zbox.setEnabled(True)
            self.zbox.setChecked(True)
            if 'zcorr' in self.ops[0]:
                if self.zstack.shape[0]==self.ops[0]['zcorr'].shape[0]:
                    zcorr = self.ops[0]['zcorr']
                    self.zmax = np.argmax(gaussian_filter1d(zcorr.T.copy(), 2, axis=1), axis=1)
                    self.plot_zcorr()

        except Exception as e:
            print('ERROR: %s'%e) 
开发者ID:MouseLand,项目名称:suite2p,代码行数:25,代码来源:reggui.py

示例2: openFile

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QIntValidator [as 别名]
def openFile(self, filename):
        try:
            ops = np.load(filename, allow_pickle=True).item()
            self.PC = ops['regPC']
            self.Ly, self.Lx = self.PC.shape[2:]
            self.DX = ops['regDX']
            if 'tPC' in ops:
                self.tPC = ops['tPC']
            else:
                self.tPC = np.zeros((1,self.PC.shape[1]))
            good = True
        except Exception as e:
            print("ERROR: ops.npy incorrect / missing ops['regPC'] and ops['regDX']")
            print(e)
            good = False
        if good:
            self.loaded=True
            self.nPCs = self.PC.shape[1]
            self.PCedit.setValidator(QtGui.QIntValidator(1,self.nPCs))
            self.plot_frame()
            self.playButton.setEnabled(True) 
开发者ID:MouseLand,项目名称:suite2p,代码行数:23,代码来源:reggui.py

示例3: PC_on

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QIntValidator [as 别名]
def PC_on(self, plot):
        # edit buttons
        self.PCedit = QtGui.QLineEdit(self)
        self.PCedit.setValidator(QtGui.QIntValidator(1,np.minimum(self.sp.shape[0],self.sp.shape[1])))
        self.PCedit.setText('1')
        self.PCedit.setFixedWidth(60)
        self.PCedit.setAlignment(QtCore.Qt.AlignRight)
        qlabel = QtGui.QLabel('PC: ')
        qlabel.setStyleSheet('color: white;')
        self.l0.addWidget(qlabel,3,0,1,1)
        self.l0.addWidget(self.PCedit,3,1,1,1)
        self.comboBox.addItem("PC")
        self.PCedit.returnPressed.connect(self.PCreturn)
        self.compute_svd(self.bin)
        self.comboBox.currentIndexChanged.connect(self.neural_sorting)
        if plot:
            self.neural_sorting(0)
        self.PCOn.setEnabled(False) 
开发者ID:MouseLand,项目名称:suite2p,代码行数:20,代码来源:visualize.py

示例4: maInput

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QIntValidator [as 别名]
def maInput(self):

        self.ma_input = QWidget()
        self.ma_layout = QHBoxLayout(self.ma_input)

        self.ma_range_txt = QLabel()
        self.ma_range_txt.setText(QC.translate('', 'Enter time range MA'))

        self.ma_range_input = QLineEdit()
        self.ma_range_input.setValidator(QIntValidator(1, 999))
        self.ma_range_input.setPlaceholderText(QC.translate('', 'Default value: 3'))

        self.ma_layout.addWidget(self.ma_range_txt)
        self.ma_layout.addWidget(self.ma_range_input)


        self.variable_box.addWidget(self.ma_input) 
开发者ID:hANSIc99,项目名称:Pythonic,代码行数:19,代码来源:basic_ta.py

示例5: emaInput

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QIntValidator [as 别名]
def emaInput(self):

        self.ema_input = QWidget()
        self.ema_layout = QHBoxLayout(self.ema_input)

        self.ema_range_txt = QLabel()
        self.ema_range_txt.setText(QC.translate('', 'Enter time range EMA'))

        self.ema_range_input = QLineEdit()
        self.ema_range_input.setValidator(QIntValidator(1, 999))
        self.ema_range_input.setPlaceholderText(QC.translate('', 'Default value: 3'))

        self.ema_layout.addWidget(self.ema_range_txt)
        self.ema_layout.addWidget(self.ema_range_input)

        self.variable_box.addWidget(self.ema_input) 
开发者ID:hANSIc99,项目名称:Pythonic,代码行数:18,代码来源:basic_ta.py

示例6: stoInput

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QIntValidator [as 别名]
def stoInput(self):

        self.sto_input = QWidget()
        self.sto_layout = QHBoxLayout(self.sto_input)

        self.sto_range_txt = QLabel()
        self.sto_range_txt.setText(QC.translate('', 'Enter MA period'))

        self.sto_range_input = QLineEdit()
        self.sto_range_input.setValidator(QIntValidator(1, 999))
        self.sto_range_input.setPlaceholderText(QC.translate('', 'Default value: 3'))

        self.sto_layout.addWidget(self.sto_range_txt)
        self.sto_layout.addWidget(self.sto_range_input)

        self.variable_box.addWidget(self.sto_input) 
开发者ID:hANSIc99,项目名称:Pythonic,代码行数:18,代码来源:basic_ta.py

示例7: rsiInput

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QIntValidator [as 别名]
def rsiInput(self):

        self.rsi_input = QWidget()
        self.rsi_layout = QHBoxLayout(self.rsi_input)

        self.rsi_range_txt = QLabel()
        self.rsi_range_txt.setText(QC.translate('', 'Enter periods'))

        self.rsi_range_input = QLineEdit()
        self.rsi_range_input.setValidator(QIntValidator(1, 999))
        self.rsi_range_input.setPlaceholderText(QC.translate('', 'Default value: 3'))

        self.rsi_layout.addWidget(self.rsi_range_txt)
        self.rsi_layout.addWidget(self.rsi_range_input)

        self.variable_box.addWidget(self.rsi_input) 
开发者ID:hANSIc99,项目名称:Pythonic,代码行数:18,代码来源:basic_ta.py

示例8: addTare

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QIntValidator [as 别名]
def addTare(self,_):
        rows = self.taretable.rowCount()
        self.taretable.setRowCount(rows + 1)
        #add widgets to the table
        name = QLineEdit()
        name.setAlignment(Qt.AlignRight)
        name.setText("name")
        w,_,_ = self.aw.scale.readWeight(self.parent.scale_weight) # read value from scale in 'g'
        weight = QLineEdit()
        weight.setAlignment(Qt.AlignRight)
        if w > -1:
            weight.setText(str(w))
        else:
            weight.setText(str(0))
        weight.setValidator(QIntValidator(0,999,weight))
        self.taretable.setCellWidget(rows,0,name)
        self.taretable.setCellWidget(rows,1,weight) 
开发者ID:artisan-roaster-scope,项目名称:artisan,代码行数:19,代码来源:roast_properties.py

示例9: OnCreate

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QIntValidator [as 别名]
def OnCreate(self, _):
        self.setupUi(self)
        self.binsec_connect_button.clicked.connect(self.connect_binsec)
        self.dba_decode_button.clicked.connect(self.decode_button_clicked)
        self.here_decode_button.clicked.connect(self.decode_here_clicked)
        self.pinsec_ip_field.setText("192.168.56.101")
        self.pinsec_port_field.setText("5555")
        self.binsec_port_field.setValidator(QtGui.QIntValidator(0, 65535))
        self.pinsec_port_field.setValidator(QtGui.QIntValidator(0, 65535))
        self.ok = QtGui.QPixmap(":/icons/icons/oxygen/22x22/ok.png")
        self.ko = QtGui.QPixmap(":/icons/icons/oxygen/22x22/ko.png")
        self.prev_modules = sys.modules.keys()
        self.set_pinsec_visible(False) 
开发者ID:RobinDavid,项目名称:idasec,代码行数:15,代码来源:MainWidget.py

示例10: __init__

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QIntValidator [as 别名]
def __init__(self, *args, **kwargs):
        """
        Initialize the integer input field.
        """
        super().__init__(*args, **kwargs)
        self.setAttribute(QtCore.Qt.WA_MacShowFocusRect, 0)
        self.setValidator(QtGui.QIntValidator(self)) 
开发者ID:danielepantaleone,项目名称:eddy,代码行数:9,代码来源:fields.py

示例11: __init__

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QIntValidator [as 别名]
def __init__(self, parent=None):
        super(ShapeDtypeDialog, self).__init__(parent)

        self.setWindowTitle("set stack dimensions")
        self.shape = (512, 512, 1, 1)
        self.dtype = ShapeDtypeDialog.type_dict["uint16"]

        layout = QtWidgets.QVBoxLayout(self)

        self.edits = []

        grid = QtWidgets.QGridLayout()
        #
        # grid.setColumnStretch(1, 4)
        # grid.setColumnStretch(2, 4)

        for i, (t, s) in enumerate(zip(("x", "y", "z",  "t"), self.shape)):
            grid.addWidget(QtWidgets.QLabel(t), i, 0)
            edit = QtWidgets.QLineEdit(str(s))
            edit.setValidator(QtGui.QIntValidator(1,2**20))
            self.edits.append(edit)
            grid.addWidget(edit, i, 1)

        self.combo = self.create_combo()
        grid.addWidget(QtWidgets.QLabel("type"), len(self.shape), 0)
        grid.addWidget(self.combo, len(self.shape), 1)

        layout.addLayout(grid)
        # OK and Cancel buttons
        self.buttons = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel,
            Qt.Horizontal, self)

        layout.addWidget(self.buttons)

        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject) 
开发者ID:maweigert,项目名称:spimagine,代码行数:39,代码来源:shape_dtype_dialog.py

示例12: make_selection

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QIntValidator [as 别名]
def make_selection(parent):
    """ buttons to draw a square on view """
    parent.topbtns = QtGui.QButtonGroup()
    ql = QtGui.QLabel("select cells")
    ql.setStyleSheet("color: white;")
    ql.setFont(QtGui.QFont("Arial", 8, QtGui.QFont.Bold))
    parent.l0.addWidget(ql, 0, 2, 1, 2)
    pos = [2, 3, 4]
    for b in range(3):
        btn = TopButton(b, parent)
        btn.setFont(QtGui.QFont("Arial", 8))
        parent.topbtns.addButton(btn, b)
        parent.l0.addWidget(btn, 0, (pos[b]) * 2, 1, 2)
        btn.setEnabled(False)
    parent.topbtns.setExclusive(True)
    parent.isROI = False
    parent.ROIplot = 0
    ql = QtGui.QLabel("n=")
    ql.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
    ql.setStyleSheet("color: white;")
    ql.setFont(QtGui.QFont("Arial", 8, QtGui.QFont.Bold))
    parent.l0.addWidget(ql, 0, 10, 1, 1)
    parent.topedit = QtGui.QLineEdit(parent)
    parent.topedit.setValidator(QtGui.QIntValidator(0, 500))
    parent.topedit.setText("40")
    parent.ntop = 40
    parent.topedit.setFixedWidth(35)
    parent.topedit.setAlignment(QtCore.Qt.AlignRight)
    parent.topedit.returnPressed.connect(parent.top_number_chosen)
    parent.l0.addWidget(parent.topedit, 0, 11, 1, 1)

# minimize view 
开发者ID:MouseLand,项目名称:suite2p,代码行数:34,代码来源:buttons.py

示例13: __init__

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QIntValidator [as 别名]
def __init__(self,parent = None, aw = None, values = [0,0]):
        super(pointDlg,self).__init__(parent, aw)
        self.values = values
        self.setWindowTitle(QApplication.translate("Form Caption","Add Point",None))
        self.tempEdit = QLineEdit(str(int(round(self.values[1]))))
        self.tempEdit.setValidator(QIntValidator(0, 999, self.tempEdit))
        self.tempEdit.setFocus()
        self.tempEdit.setAlignment(Qt.AlignRight)
        templabel = QLabel(QApplication.translate("Label", "temp",None))
        regextime = QRegExp(r"^-?[0-9]?[0-9]?[0-9]:[0-5][0-9]$")
        self.timeEdit = QLineEdit(stringfromseconds(self.values[0],leadingzero=False))
        self.timeEdit.setAlignment(Qt.AlignRight)
        self.timeEdit.setValidator(QRegExpValidator(regextime,self))
        timelabel = QLabel(QApplication.translate("Label", "time",None))

        # connect the ArtisanDialog standard OK/Cancel buttons
        self.dialogbuttons.accepted.connect(self.return_values)
        self.dialogbuttons.rejected.connect(self.reject)
        
        buttonLayout = QHBoxLayout()
        buttonLayout.addStretch()
        buttonLayout.addWidget(self.dialogbuttons)
        grid = QGridLayout()
        grid.addWidget(timelabel,0,0)
        grid.addWidget(self.timeEdit,0,1)
        grid.addWidget(templabel,1,0)
        grid.addWidget(self.tempEdit,1,1)
        mainLayout = QVBoxLayout()
        mainLayout.addLayout(grid)
        mainLayout.addStretch()  
        mainLayout.addLayout(buttonLayout)
        self.setLayout(mainLayout)
        self.dialogbuttons.button(QDialogButtonBox.Ok).setFocus() 
开发者ID:artisan-roaster-scope,项目名称:artisan,代码行数:35,代码来源:designer.py

示例14: createTareTable

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QIntValidator [as 别名]
def createTareTable(self):
        self.taretable.clear()
        self.taretable.setRowCount(len(self.aw.qmc.container_names))
        self.taretable.setColumnCount(2)
        self.taretable.setHorizontalHeaderLabels([QApplication.translate("Table","Name",None),
                                                         QApplication.translate("Table","Weight",None)])
        self.taretable.setAlternatingRowColors(True)
        self.taretable.setEditTriggers(QTableWidget.NoEditTriggers)
        self.taretable.setSelectionBehavior(QTableWidget.SelectRows)
        self.taretable.setSelectionMode(QTableWidget.SingleSelection)
        self.taretable.setShowGrid(True)
        self.taretable.verticalHeader().setSectionResizeMode(2)
        for i in range(len(self.aw.qmc.container_names)):
            #add widgets to the table
            name = QLineEdit()
            name.setAlignment(Qt.AlignRight)
            name.setText(self.aw.qmc.container_names[i])
            weight = QLineEdit()
            weight.setAlignment(Qt.AlignRight)
            weight.setText(str(self.aw.qmc.container_weights[i]))
            weight.setValidator(QIntValidator(0,999,weight))
            
            self.taretable.setCellWidget(i,0,name)
            self.taretable.setCellWidget(i,1,weight)
        header = self.taretable.horizontalHeader()
        header.setSectionResizeMode(0, QHeaderView.Stretch)
        header.setSectionResizeMode(1, QHeaderView.Fixed)
        self.taretable.setColumnWidth(1,65)
        
########################################################################################
#####################  RECENT ROAST POPUP  ############################################# 
开发者ID:artisan-roaster-scope,项目名称:artisan,代码行数:33,代码来源:roast_properties.py

示例15: to_widget

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QIntValidator [as 别名]
def to_widget(self, opt):
        return GStringLineEditor.to_widget(self, opt,
                validator=QtGui.QIntValidator()) 
开发者ID:szsdk,项目名称:quick,代码行数:5,代码来源:quick.py


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