Python PyQt4.QtCore 模块,SLOT 实例源码

我们从Python开源项目中,提取了以下16个代码示例,用于说明如何使用PyQt4.QtCore.SLOT

项目:SimpleSniffer    作者:HatBoy    | 项目源码 | 文件源码
def initUI(self):
        device_data = get_iface_name()
        iface_num = len(device_data)
        iface_keys = device_data.keys()
        #????
        self.radio_lists = []
        self.gridlayout = QtGui.QGridLayout()
        self.label_name = QtGui.QLabel(u'???')
        self.label_ip = QtGui.QLabel(u'IP??')
        self.label_receive = QtGui.QLabel(u'????')
        self.label_send = QtGui.QLabel(u'????')
        self.gridlayout.addWidget(self.label_name, 1, 1)
        self.gridlayout.addWidget(self.label_ip, 1, 2)
        self.gridlayout.addWidget(self.label_receive, 1, 3)
        self.gridlayout.addWidget(self.label_send, 1, 4)
        self.setLayout(self.gridlayout)
        for i in range(iface_num):
            iface_name = iface_keys[i]
            self.iface_radio = QtGui.QRadioButton(iface_name)
            if iface_name == 'eth0':
                self.iface_radio.setChecked(True)
            self.gridlayout.addWidget(self.iface_radio, i+2, 1)
            self.radio_lists.append(self.iface_radio)
            self.ip_label = QtGui.QLabel(get_ip_address(iface_name))
            self.gridlayout.addWidget(self.ip_label, i+2, 2)
            data = device_data[iface_name].split(';')
            self.receive_label = QtGui.QLabel(data[0])
            self.send_label = QtGui.QLabel(data[1])
            self.gridlayout.addWidget(self.receive_label, i+2, 3)
            self.gridlayout.addWidget(self.send_label, i+2, 4)
            self.setLayout(self.gridlayout)
        #????
        self.start_but = QtGui.QPushButton(u'??', self)
        self.start_but.clicked.connect(self.exit_me)
        self.start_but.setCheckable(False)
        self.gridlayout.addWidget(self.start_but, iface_num + 2, 2)
        self.cancel_but = QtGui.QPushButton(u'??', self)
        self.connect(self.cancel_but, QtCore.SIGNAL('clicked()'), QtCore.SLOT('close()'))
        self.cancel_but.setCheckable(False)
        self.gridlayout.addWidget(self.cancel_but, iface_num + 2, 3)
项目:base_function    作者:Rockyzsu    | 项目源码 | 文件源码
def __init__(self):
        QtGui.QMainWindow.__init__(self)
        self.setGeometry(300, 300, 180, 380)
        self.setWindowTitle('Tetris')
        self.tetrisboard = Board(self)
        self.setCentralWidget(self.tetrisboard)
        self.statusbar = self.statusBar()
        self.connect(self.tetrisboard, QtCore.SIGNAL("messageToStatusbar(QString)"),
                     self.statusbar, QtCore.SLOT("showMessage(QString)"))
        self.tetrisboard.start()
        self.center()
项目:base_function    作者:Rockyzsu    | 项目源码 | 文件源码
def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)

        self.setWindowTitle("Sig Slot Test")
        lcd = QtGui.QLCDNumber(self)
        slider = QtGui.QSlider(QtCore.Qt.Horizontal, self)
        vbox = QtGui.QVBoxLayout()
        vbox.addWidget(lcd)
        vbox.addWidget(slider)

        self.setLayout(vbox)
        self.connect(slider, QtCore.SIGNAL('valueChanged(int)'), lcd, QtCore.SLOT('display(int)'))
        self.resize(250, 250)
项目:PyFRAP    作者:alexblaessle    | 项目源码 | 文件源码
def initFileMenubar(self):

        """Creates entries of file menubar and connects actions with gui methods.
        """

        newMoleculeButton = QtGui.QAction('New Molecule', self)
        self.connect(newMoleculeButton, QtCore.SIGNAL('triggered()'), self.newMolecule)

        loadMoleculeButton = QtGui.QAction('Open Molecule', self)
        self.connect(loadMoleculeButton, QtCore.SIGNAL('triggered()'), self.loadMolecule)

        saveMoleculeButton = QtGui.QAction('Save Molecule', self)
        self.connect(saveMoleculeButton, QtCore.SIGNAL('triggered()'), self.saveMolecule)

        exitButton = QtGui.QAction('Exit', self)
        exitButton.setShortcut('Ctrl+Q')    
        self.connect(exitButton, QtCore.SIGNAL('triggered()'), QtCore.SLOT('close()'))

        self.mbFile.addAction(newMoleculeButton)
        self.mbFile.addAction(loadMoleculeButton)
        self.recentMB=self.mbFile.addMenu('&Open recent')
        self.mbFile.addAction(saveMoleculeButton)

        self.mbFile.addAction(exitButton)

        return
项目:FreeCAD-PCB    作者:marmni    | 项目源码 | 文件源码
def __init__(self, parent=None):
        QtGui.QDialog.__init__(self, parent)
        self.setWindowTitle("Convert old database to a new format")
        self.setMinimumWidth(500)
        # stary plik z modelami
        self.oldFilePath = QtGui.QLineEdit(os.path.join(__currentPath__, "param.py"))
        # nowy plik z modelami
        self.newFilePath = QtGui.QLineEdit(os.path.join(__currentPath__, "data/dane.cfg"))
        #
        self.pominDuplikaty = QtGui.QCheckBox(u"Skip duplicates")
        self.pominDuplikaty.setChecked(True)
        self.pominDuplikaty.setDisabled(True)
        #
        self.removeOld = QtGui.QCheckBox(u"Remove old database")
        self.removeOld.setChecked(True)
        # przyciski
        buttons = QtGui.QDialogButtonBox()
        buttons.addButton("Cancel", QtGui.QDialogButtonBox.RejectRole)
        buttons.addButton("Convert", QtGui.QDialogButtonBox.AcceptRole)
        self.connect(buttons, QtCore.SIGNAL("accepted()"), self.konwertuj)
        self.connect(buttons, QtCore.SIGNAL("rejected()"), self, QtCore.SLOT("reject()"))
        #
        self.mainLayout = QtGui.QGridLayout(self)
        #self.mainLayout.setContentsMargins(0, 0, 0, 0)
        self.mainLayout.addWidget(QtGui.QLabel(u"Old database"), 0, 0, 1, 1)
        self.mainLayout.addWidget(self.oldFilePath, 0, 1, 1, 1)
        self.mainLayout.addWidget(QtGui.QLabel(u"New database"), 1, 0, 1, 1)
        self.mainLayout.addWidget(self.newFilePath, 1, 1, 1, 1)

        self.mainLayout.addWidget(self.pominDuplikaty, 3, 0, 1, 2)
        self.mainLayout.addWidget(self.removeOld, 4, 0, 1, 2)
        self.mainLayout.addWidget(buttons, 5, 1, 1, 1, QtCore.Qt.AlignRight)
        self.mainLayout.setRowStretch(6, 10)
项目:specto    作者:mrknow    | 项目源码 | 文件源码
def __init__(self, parent=None):
            QtGui.QWidget.__init__(self, parent)

            self.setGeometry(300, 300, 200, 80)
            self.setWindowTitle('Hello World')

            quit = QtGui.QPushButton('Close', self)
            quit.setGeometry(10, 10, 60, 35)

            self.connect(quit, QtCore.SIGNAL('clicked()'),
                         self, QtCore.SLOT('close()'))
项目:ee-book    作者:ee-book    | 项目源码 | 文件源码
def __init__(self, page, parent=None):
        super(HelpForm, self).__init__(parent)
        QTextCodec.setCodecForTr(QTextCodec.codecForName("system"))
        QTextCodec.setCodecForCStrings(QTextCodec.codecForName("system"))
        QTextCodec.setCodecForLocale(QTextCodec.codecForName("system"))
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setAttribute(Qt.WA_GroupLeader)

        backAction = QAction(QIcon(":/back.png"), "&Back", self)
        backAction.setShortcut(QKeySequence.Back)
        homeAction = QAction(QIcon(":/home.png"), "&Home", self)
        homeAction.setShortcut("Home")
        self.pageLabel = QLabel()

        toolBar = QToolBar()
        toolBar.addAction(backAction)
        toolBar.addAction(homeAction)
        toolBar.addWidget(self.pageLabel)
        self.textBrowser = QTextBrowser()
        # self.textBrowser.

        layout = QVBoxLayout()
        layout.addWidget(toolBar)
        layout.addWidget(self.textBrowser, 1)
        self.setLayout(layout)

        self.connect(backAction, SIGNAL("triggered()"),
                     self.textBrowser, SLOT("backward()"))
        self.connect(homeAction, SIGNAL("triggered()"),
                     self.textBrowser, SLOT("home()"))
        self.connect(self.textBrowser, SIGNAL("sourceChanged(QUrl)"),
                     self.updatePageTitle)

        self.textBrowser.setSearchPaths([":/help"])
        self.textBrowser.setSource(QUrl(page))
        self.resize(400, 600)
        self.setWindowTitle("%s Help" % QApplication.applicationName())
项目:PH5    作者:PIC-IRIS    | 项目源码 | 文件源码
def clearSig (self, o) :
        def print_signals_and_slots(obj):
            for i in xrange(obj.metaObject().methodCount()):
                m = obj.metaObject().method(i)
                if m.methodType() == QtCore.QMetaMethod.MethodType.Signal:
                    print "SIGNAL: sig=", m.signature(), "hooked to nslots=",obj.receivers(QtCore.SIGNAL(m.signature()))
                elif m.methodType() == QtCore.QMetaMethod.MethodType.Slot:
                    print "SLOT: sig=", m.signature() 

        print_signals_and_slots (o)
项目:OnAirScreen    作者:saschaludwig    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(ClockWidget, self).__init__(parent)

        # astrastudio color scheme
        self.digiHourColor = QtGui.QColor(50, 50, 255, 255)
        self.digiSecondColor = QtGui.QColor(255, 153, 0, 255)
        self.digiDigitColor = QtGui.QColor(50, 50, 255, 255)

        # analog mode colors
        self.hourColor = QtGui.QColor(200, 200, 200, 255)
        self.minuteColor = QtGui.QColor(220, 220, 220, 255)
        self.circleColor = QtGui.QColor(220, 220, 220, 255)

        self.imagepath = ""

        self.setLogo()

        self.timeZoneOffset = 0
        self.clockMode = 1
        self.counter = 0

        self.timer = QtCore.QTimer(self)
        self.connect(self.timer, QtCore.SIGNAL("timeout()"), self, QtCore.SLOT("update()"))
        self.connect(self.timer, QtCore.SIGNAL("timeout()"), self.updateTime)

        self.resyncTime()
项目:siren    作者:ozsolarwind    | 项目源码 | 文件源码
def __init__(self, year, zone, solar_dir, wind_dir, tgt_dir, fmat, wrap, coords, return_code, output):
        super(RptDialog, self).__init__()
        self.parms = [str(year), str(zone), wrap, fmat, tgt_dir, solar_dir, wind_dir]
        if wrap == 'y':
            wrapy = 'Yes'
        else:
            wrapy = 'No'
        max_line = 0
        self.lines = 'Parameters:\n    Year: %s\n    Wrap year: %s\n    Time Zone: %s\n    Output Format: %s\n' \
                     % (year, wrapy, zone, fmat)
        if fmat != 'srw':
            self.lines += '    Solar Files: %s\n' % solar_dir
        self.lines += '    Wind Files: %s\n' % wind_dir
        self.lines += '    Target Folder: %s\n' % tgt_dir
        if coords != '':
            self.lines += '    Coordinates: %s\n' % coords
        self.lines += 'Return Code:\n    %s\n' % return_code
        self.lines += 'Output:\n'
        self.lines += output
        lenem = self.lines.split('\n')
        line_cnt = len(lenem)
        for i in range(line_cnt):
            max_line = max(max_line, len(lenem[i]))
        del lenem
        QtGui.QDialog.__init__(self)
        self.saveButton = QtGui.QPushButton(self.tr('&Save'))
        self.cancelButton = QtGui.QPushButton(self.tr('Cancel'))
        buttonLayout = QtGui.QHBoxLayout()
        buttonLayout.addStretch(1)
        buttonLayout.addWidget(self.saveButton)
        buttonLayout.addWidget(self.cancelButton)
        self.connect(self.saveButton, QtCore.SIGNAL('clicked()'), self,
                     QtCore.SLOT('accept()'))
        self.connect(self.cancelButton, QtCore.SIGNAL('clicked()'),
                     self, QtCore.SLOT('reject()'))
        self.widget = QtGui.QTextEdit()
        self.widget.setFont(QtGui.QFont('Courier New', 11))
        fnt = self.widget.fontMetrics()
        ln = (max_line + 5) * fnt.maxWidth()
        ln2 = (line_cnt + 2) * fnt.height()
        screen = QtGui.QDesktopWidget().availableGeometry()
        if ln > screen.width() * .67:
            ln = int(screen.width() * .67)
        if ln2 > screen.height() * .67:
            ln2 = int(screen.height() * .67)
        self.widget.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
            QtGui.QSizePolicy.Expanding))
        self.widget.resize(ln, ln2)
        self.widget.setPlainText(self.lines)
        layout = QtGui.QVBoxLayout()
        layout.addWidget(self.widget)
        layout.addLayout(buttonLayout)
        self.setLayout(layout)
        self.setWindowTitle('SIREN - Output from makeweather2')
        size = self.geometry()
        self.setGeometry(1, 1, ln + 10, ln2 + 35)
        size = self.geometry()
        self.move((screen.width() - size.width()) / 2,
            (screen.height() - size.height()) / 2)
        self.widget.show()
项目:siren    作者:ozsolarwind    | 项目源码 | 文件源码
def __init__(self, year, zone, src_dir, tgt_dir, fmat, coords, return_code, output):
        super(RptDialog, self).__init__()
        self.parms = [str(year), str(zone), fmat, tgt_dir, src_dir]
        max_line = 0
        self.lines = 'Parameters:\n    Year: %s\n    Time Zone: %s\n    Input Format: %s\n' % \
                     (year, zone, fmat)
        self.lines += '    Rainfall Files: %s\n' % src_dir
        self.lines += '    Target Folder: %s\n' % tgt_dir
        if coords != '':
            self.lines += '    Coordinates: %s\n' % coords
        self.lines += 'Return Code:\n    %s\n' % return_code
        self.lines += 'Output:\n'
        self.lines += output
        lenem = self.lines.split('\n')
        line_cnt = len(lenem)
        for i in range(line_cnt):
            max_line = max(max_line, len(lenem[i]))
        del lenem
        QtGui.QDialog.__init__(self)
        self.saveButton = QtGui.QPushButton(self.tr('&Save'))
        self.cancelButton = QtGui.QPushButton(self.tr('Cancel'))
        buttonLayout = QtGui.QHBoxLayout()
        buttonLayout.addStretch(1)
        buttonLayout.addWidget(self.saveButton)
        buttonLayout.addWidget(self.cancelButton)
        self.connect(self.saveButton, QtCore.SIGNAL('clicked()'), self,
                     QtCore.SLOT('accept()'))
        self.connect(self.cancelButton, QtCore.SIGNAL('clicked()'),
                     self, QtCore.SLOT('reject()'))
        self.widget = QtGui.QTextEdit()
        self.widget.setFont(QtGui.QFont('Courier New', 11))
        fnt = self.widget.fontMetrics()
        ln = (max_line + 5) * fnt.maxWidth()
        ln2 = (line_cnt + 2) * fnt.height()
        screen = QtGui.QDesktopWidget().availableGeometry()
        if ln > screen.width() * .67:
            ln = int(screen.width() * .67)
        if ln2 > screen.height() * .67:
            ln2 = int(screen.height() * .67)
        self.widget.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
            QtGui.QSizePolicy.Expanding))
        self.widget.resize(ln, ln2)
        self.widget.setPlainText(self.lines)
        layout = QtGui.QVBoxLayout()
        layout.addWidget(self.widget)
        layout.addLayout(buttonLayout)
        self.setLayout(layout)
        self.setWindowTitle('SIREN - Output from makerainfall2')
        size = self.geometry()
        self.setGeometry(1, 1, ln + 10, ln2 + 35)
        size = self.geometry()
        self.move((screen.width() - size.width()) / 2,
            (screen.height() - size.height()) / 2)
        self.widget.show()
项目:siren    作者:ozsolarwind    | 项目源码 | 文件源码
def __init__(self, year, zone, solar_dir, wind_dir, tgt_dir, fmat, wrap, coords, return_code, output):
        super(RptDialog, self).__init__()
        self.parms = [str(year), str(zone), wrap, fmat, tgt_dir, solar_dir, wind_dir]
        if wrap == 'y':
            wrapy = 'Yes'
        else:
            wrapy = 'No'
        max_line = 0
        self.lines = 'Parameters:\n    Year: %s\n    Wrap year: %s\n    Time Zone: %s\n    Output Format: %s\n' \
                     % (year, wrapy, zone, fmat)
        if fmat != 'srw':
            self.lines += '    Solar Files: %s\n' % solar_dir
        self.lines += '    Wind Files: %s\n' % wind_dir
        self.lines += '    Target Folder: %s\n' % tgt_dir
        if coords != '':
            self.lines += '    Coordinates: %s\n' % coords
        self.lines += 'Return Code:\n    %s\n' % return_code
        self.lines += 'Output:\n'
        self.lines += output
        lenem = self.lines.split('\n')
        line_cnt = len(lenem)
        for i in range(line_cnt):
            max_line = max(max_line, len(lenem[i]))
        del lenem
        QtGui.QDialog.__init__(self)
        self.saveButton = QtGui.QPushButton(self.tr('&Save'))
        self.cancelButton = QtGui.QPushButton(self.tr('Cancel'))
        buttonLayout = QtGui.QHBoxLayout()
        buttonLayout.addStretch(1)
        buttonLayout.addWidget(self.saveButton)
        buttonLayout.addWidget(self.cancelButton)
        self.connect(self.saveButton, QtCore.SIGNAL('clicked()'), self,
                     QtCore.SLOT('accept()'))
        self.connect(self.cancelButton, QtCore.SIGNAL('clicked()'),
                     self, QtCore.SLOT('reject()'))
        self.widget = QtGui.QTextEdit()
        self.widget.setFont(QtGui.QFont('Courier New', 11))
        fnt = self.widget.fontMetrics()
        ln = (max_line + 5) * fnt.maxWidth()
        ln2 = (line_cnt + 2) * fnt.height()
        screen = QtGui.QDesktopWidget().availableGeometry()
        if ln > screen.width() * .67:
            ln = int(screen.width() * .67)
        if ln2 > screen.height() * .67:
            ln2 = int(screen.height() * .67)
        self.widget.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
            QtGui.QSizePolicy.Expanding))
        self.widget.resize(ln, ln2)
        self.widget.setPlainText(self.lines)
        layout = QtGui.QVBoxLayout()
        layout.addWidget(self.widget)
        layout.addLayout(buttonLayout)
        self.setLayout(layout)
        self.setWindowTitle('makeweatherfiles - Output')
        size = self.geometry()
        self.setGeometry(1, 1, ln + 10, ln2 + 35)
        size = self.geometry()
        self.move((screen.width() - size.width()) / 2,
            (screen.height() - size.height()) / 2)
        self.widget.show()
项目:siren    作者:ozsolarwind    | 项目源码 | 文件源码
def __init__(self, in_file, parent=None):
        self.in_file = in_file
        try:
            s = open(self.in_file, 'r').read()
            bits = s.split('\n')
            ln = 0
            for lin in bits:
                if len(lin) > ln:
                    ln = len(lin)
            ln2 = len(bits)
        except:
            if self.in_file[self.in_file.rfind('.'):] == '.ini':
                s = ''
            else:
                s = ''
            ln = 36
            ln2 = 5
        QtGui.QDialog.__init__(self, parent)
        self.saveButton = QtGui.QPushButton(self.tr('&Save'))
        self.cancelButton = QtGui.QPushButton(self.tr('Cancel'))
        buttonLayout = QtGui.QHBoxLayout()
        buttonLayout.addStretch(1)
        buttonLayout.addWidget(self.saveButton)
        buttonLayout.addWidget(self.cancelButton)
        self.connect(self.saveButton, QtCore.SIGNAL('clicked()'), self,
                     QtCore.SLOT('accept()'))
        self.connect(self.cancelButton, QtCore.SIGNAL('clicked()'),
                     self, QtCore.SLOT('reject()'))
        self.widget = QtGui.QPlainTextEdit()
        highlight = inisyntax.IniHighlighter(self.widget.document())
        if sys.platform == 'linux2':
            self.widget.setFont(QtGui.QFont('Ubuntu Mono 13', 12))
        else:
            self.widget.setFont(QtGui.QFont('Courier New', 12))
        fnt = self.widget.fontMetrics()
        ln = (ln + 5) * fnt.maxWidth()
        ln2 = (ln2 + 4) * fnt.height()
        screen = QDesktopWidget().availableGeometry()
        if ln > screen.width() * .67:
            ln = int(screen.width() * .67)
        if ln2 > screen.height() * .67:
            ln2 = int(screen.height() * .67)
        self.widget.resize(ln, ln2)
        self.widget.setPlainText(s)
        layout = QtGui.QVBoxLayout()
        layout.addWidget(self.widget)
        layout.addLayout(buttonLayout)
        self.setLayout(layout)
        self.setWindowTitle('SIREN - Edit - ' + self.in_file[self.in_file.rfind('/') + 1:])
        size = self.geometry()
        self.setGeometry(1, 1, ln + 10, ln2 + 35)
        size = self.geometry()
        self.move((screen.width() - size.width()) / 2,
            (screen.height() - size.height()) / 2)
        self.widget.show()
项目:PH5    作者:PIC-IRIS    | 项目源码 | 文件源码
def __init__ (self, fio, cmds, info, title='X', mmax=100) :
        '''
            fio -> pforma_io object
            cmds -> list of commands
            title -> window title
            mmax -> max value for progress bar
        '''
        QtGui.QWidget.__init__ (self)
        #self.sizeHint ()
        self.fio = fio                        #   pforma_io instance
        self.cmds = cmds                      #   List of commands to monitor
        self.info = info                      #   Info about files to convert
        self.family = title                   #   Name of family A, B, C etc.
        self.cmdN = 0                         #   Command that is currently executing
        self.pee = None                       #   Process as returned by subprocess.Popen
        self.fifo = None                      #   STDOUT + STDERR of process (a pipe)
        self.fifoerr = None
        self.mmax = mmax
        self.fp = FamilyProgress (title, mmax)#   The progress bar and friends
        box = QtGui.QVBoxLayout ()
        box.addWidget (self.fp)
                                              #   Set button to start conversion
        self.fp.btn.clicked.connect (self.startConversion)
        self.running = False                  #   Not looping on output of fifo
        self.numFiles = mmax                  #   Number of files to convert
        self.cnt = 0                          #   Number of files converted
        self.seconds = TIMEOUT                #   Time out for conversion of a raw file
        self.log = []                         #   Running log of conversion (mostly from fifo)
                                              #   trddone is signal to progress bar
        #self.trddone.connect (self.fp.pbar.setValue)
        QtCore.QObject.connect (self, 
                                QtCore.SIGNAL("trddone(int)"), 
                                self.fp.pbar,
                                QtCore.SLOT("setValue(int)"),
                                QtCore.Qt.QueuedConnection)
                                              #   Wait for progress bar to display 
                                              #   before starting to monitor conversion
        wd = watchit.Watchdog (1, userHandler=self.startConversion)
        wd.start ()
        self.setLayout (box)
        self.setWindowTitle (self.family)
        self.processedFiles = {}              #   Lists of files successfully converted keyed by DAS sn
        self.monPercent = 0.01
项目:PH5    作者:PIC-IRIS    | 项目源码 | 文件源码
def __init__ (self, settings, parent = None) :
        super (SetupDialog, self).__init__ (parent)
        self.setAttribute (QtCore.Qt.WA_DeleteOnClose)

        #outfileNameLabel = QtGui.QLabel ("Output File")
        #self.outfileName = QtGui.QLineEdit ()
        #outfileNameLabel.setBuddy (self.outfileName)

        outfileFormatLabel = QtGui.QLabel ("Output Format")
        self.outfileFormat = QtGui.QComboBox ()
        outfileFormatLabel.setBuddy(self.outfileFormat)
        self.outfileFormat.addItems(["kef",])
        self.outfileFormat.setCurrentIndex (self.outfileFormat.findText (settings['outFormat']))

        fieldSeparatorLabel = QtGui.QLabel ("Column Separator")
        self.fieldSeparator = QtGui.QComboBox ()
        fieldSeparatorLabel.setBuddy (self.fieldSeparator)
        self.fieldSeparator.addItems (["comma", "semi-colon", "colon", "tab", "space"])
        self.fieldSeparator.setCurrentIndex (self.fieldSeparator.findText (settings['colSep']))

        skipLinesLabel = QtGui.QLabel ("Skip Lines")
        self.skipLines = QtGui.QSpinBox ()
        skipLinesLabel.setBuddy (self.skipLines)
        self.skipLines.setRange (0, 12)
        self.skipLines.setValue (settings['linesSkip'])

        viewLinesLabel = QtGui.QLabel ("View Lines")
        self.viewLines = QtGui.QSpinBox ()
        viewLinesLabel.setBuddy (self.viewLines)
        self.viewLines.setRange (1, 60)
        self.viewLines.setValue (settings['linesView'])


        self.settings = settings

        buttonBox = QtGui.QDialogButtonBox (QtGui.QDialogButtonBox.Apply |
                                            QtGui.QDialogButtonBox.Close)

        grid = QtGui.QGridLayout ()
        #grid.addWidget (outfileNameLabel, 0, 0); grid.addWidget (self.outfileName, 0, 1)
        grid.addWidget (outfileFormatLabel, 0, 0); grid.addWidget (self.outfileFormat, 0, 1)
        grid.addWidget (fieldSeparatorLabel, 1, 0); grid.addWidget (self.fieldSeparator, 1, 1)
        grid.addWidget (skipLinesLabel, 2, 0); grid.addWidget (self.skipLines, 2, 1)
        grid.addWidget (viewLinesLabel, 3, 0); grid.addWidget (self.viewLines, 3, 1)

        grid.addWidget (buttonBox, 4, 0, 2, -1)
        self.setLayout (grid)

        self.connect (buttonBox.button (QtGui.QDialogButtonBox.Apply),
                      QtCore.SIGNAL ("clicked ()"), self.apply)

        self.connect (buttonBox, QtCore.SIGNAL ("rejected ()"),
                      self, QtCore.SLOT ("reject ()"))
项目:PH5    作者:PIC-IRIS    | 项目源码 | 文件源码
def __init__ (self, settings, parent = None) :
        super (SetupDialog, self).__init__ (parent)
        self.setAttribute (QtCore.Qt.WA_DeleteOnClose)

        inputFileTypeLabel = QtGui.QLabel ("Input Type")
        self.inputFileType = QtGui.QComboBox ()
        inputFileTypeLabel.setBuddy (self.inputFileType)
        self.inputFileType.addItems (['receiver', 'event'])
        self.inputFileType.setCurrentIndex (self.inputFileType.findText (settings['inFormat']))

        outfileFormatLabel = QtGui.QLabel ("Output Format")
        self.outfileFormat = QtGui.QComboBox ()
        outfileFormatLabel.setBuddy(self.outfileFormat)
        self.outfileFormat.addItems(["kef", "kef"])
        self.outfileFormat.setCurrentIndex (self.outfileFormat.findText (settings['outFormat']))

        fieldSeparatorLabel = QtGui.QLabel ("Column Separator")
        self.fieldSeparator = QtGui.QComboBox ()
        fieldSeparatorLabel.setBuddy (self.fieldSeparator)
        self.fieldSeparator.addItems (["comma", "semi-colon", "colon", "tab", "space"])
        self.fieldSeparator.setCurrentIndex (self.fieldSeparator.findText (settings['colSep']))

        skipLinesLabel = QtGui.QLabel ("Skip Lines")
        self.skipLines = QtGui.QSpinBox ()
        skipLinesLabel.setBuddy (self.skipLines)
        self.skipLines.setRange (0, 12)
        self.skipLines.setValue (settings['linesSkip'])

        viewLinesLabel = QtGui.QLabel ("View Lines")
        self.viewLines = QtGui.QSpinBox ()
        viewLinesLabel.setBuddy (self.viewLines)
        self.viewLines.setRange (1, 60)
        self.viewLines.setValue (settings['linesView'])

        self.settings = settings

        buttonBox = QtGui.QDialogButtonBox (QtGui.QDialogButtonBox.Apply |
                                            QtGui.QDialogButtonBox.Close)

        grid = QtGui.QGridLayout ()
        #
        grid.addWidget (inputFileTypeLabel, 0, 0); grid.addWidget (self.inputFileType, 0, 1)
        grid.addWidget (outfileFormatLabel, 1, 0); grid.addWidget (self.outfileFormat, 1, 1)
        grid.addWidget (fieldSeparatorLabel, 2, 0); grid.addWidget (self.fieldSeparator, 2, 1)
        grid.addWidget (skipLinesLabel, 3, 0); grid.addWidget (self.skipLines, 3, 1)
        grid.addWidget (viewLinesLabel, 4, 0); grid.addWidget (self.viewLines, 4, 1)

        grid.addWidget (buttonBox, 5, 0, 2, -1)
        self.setLayout (grid)

        self.connect (buttonBox.button (QtGui.QDialogButtonBox.Apply),
                      QtCore.SIGNAL ("clicked ()"), self.apply)

        self.connect (buttonBox, QtCore.SIGNAL ("rejected ()"),
                      self, QtCore.SLOT ("reject ()"))

        self.setWindowTitle ("Configure")
        #self.changed = QtCore.Signal ()