Esempio n. 1
0
  def __init__(self, config_name, parent=None):
    super(ReplaceI18NDialog, self).__init__(parent)
    self.parent = parent
    grid_layout = QGridLayout()
    grid_layout.addWidget(QLabel(u'表单名字/序号'), 0, 0)
    self.sheet_index_input = QLineEdit(config_name, self)
    grid_layout.addWidget(self.sheet_index_input, 0, 1)

    grid_layout.addWidget(QLabel(u'列'), 1, 0)
    self.column_input = QLineEdit("1", self)
    int_validator = QIntValidator()
    int_validator.setRange(1, 100)
    self.column_input.setValidator(int_validator)
    grid_layout.addWidget(self.column_input, 1, 1)

    grid_layout.addWidget(QLabel(u'文件'), 2, 0)
    self.file_input = QLineEdit("", self)
    grid_layout.addWidget(self.file_input, 2, 1)
    select_file_btn = QPushButton(u'选择')
    grid_layout.addWidget(select_file_btn, 2, 2)

    do_btn = QPushButton(u'替换')
    main_layout = QVBoxLayout()
    main_layout.addLayout(grid_layout)
    main_layout.addWidget(do_btn)
    self.setLayout(main_layout)

    self.connect(select_file_btn, SIGNAL("clicked()"), self.select_file)
    self.connect(do_btn, SIGNAL("clicked()"), self.replace)
Esempio n. 2
0
 def __init__(self):
     QWidget.__init__(self)
     self.setupUi(self)
     self.pushButton_Add.clicked.connect(self.addIP)
     validator = QIntValidator()
     validator.setRange(0, 255)
     self.lineEdit_IP_1.setValidator(validator)
     self.lineEdit_IP_2.setValidator(validator)
     self.lineEdit_IP_3.setValidator(validator)
     self.lineEdit_IP_4.setValidator(validator)
Esempio n. 3
0
 def __init__(self):
     QWidget.__init__(self)
     self.setupUi(self)
     self.pushButton_Add.clicked.connect(self.addIP)
     validator = QIntValidator()
     validator.setRange(0,255)
     self.lineEdit_IP_1.setValidator(validator)
     self.lineEdit_IP_2.setValidator(validator)
     self.lineEdit_IP_3.setValidator(validator)
     self.lineEdit_IP_4.setValidator(validator)
Esempio n. 4
0
    def __init__(self, parent=None):
        super(QWidget, self).__init__(parent)
        # Create the four widgets:

        # 1, the line number widget
        self.lnum = QLineEdit()
        self.lnum.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        # allow up to 5 digits, and ensure only digits can be entered.
        val = QIntValidator()
        val.setRange(1,99999) # Line numbers start at 1
        self.lnum.setValidator(val)
        self.setWidth(self.lnum, 6)
        # connect the lnum ReturnPressed signal to our slot for that
        self.connect(self.lnum, SIGNAL("returnPressed()"), self.moveLine)

        # 2, the column number display
        self.cnum = QLabel()
        self.cnum.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        self.setWidth(self.cnum, 3)

        # 3, the png field. Scan image filenames are not always numeric!
        self.image = QLineEdit()
        self.image.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.setWidth(self.image, 6)
        #val = QIntValidator()
        #val.setRange(1,9999) # png numbers start at 1
        #self.image.setValidator(val)
        # Connect the image ReturnPressed signal to our slot for that
        self.connect(self.image, SIGNAL("returnPressed()"), self.movePng)

        # 4, the folio display
        self.folio = QLabel()
        self.folio.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        self.setWidth(self.folio, 12)

        # Make a layout frame and lay the four things out in it with captions
        # Line [      ] Column (  )    Image [      ] Folio (   )

        hb = QHBoxLayout()
        hb.addWidget(self.makeCaption(u"Line"))
        hb.addWidget(self.lnum)
        hb.addWidget(self.makeCaption(u"Column"))
        hb.addWidget(self.cnum)

        hb.addSpacing(5) # Qt doc doesn't say what the units are!

        hb.addWidget(self.makeCaption(u"Image"))
        hb.addWidget(self.image)
        hb.addWidget(self.makeCaption(u"Folio"))
        hb.addWidget(self.folio)

        hb.addStretch() # add stretch on the right to make things compact left
        self.setLayout(hb) # make it our layout