Python PySide.QtGui 模块,QListWidget() 实例源码

我们从Python开源项目中,提取了以下15个代码示例,用于说明如何使用PySide.QtGui.QListWidget()

项目:FreeCAD-PCB    作者:marmni    | 项目源码 | 文件源码
def __init__(self, model, paths, parent=None):
        QtGui.QDialog.__init__(self, parent)

        self.setWindowTitle(u'Choose model')
        #
        self.modelsList = QtGui.QListWidget()
        for i in paths:
            self.modelsList.addItem(i)

        self.modelsList.setCurrentRow(0)
        #
        buttons = QtGui.QDialogButtonBox()
        buttons.setOrientation(QtCore.Qt.Vertical)
        buttons.addButton("Cancel", QtGui.QDialogButtonBox.RejectRole)
        buttons.addButton("Choose", QtGui.QDialogButtonBox.AcceptRole)
        self.connect(buttons, QtCore.SIGNAL("accepted()"), self, QtCore.SLOT("accept()"))
        self.connect(buttons, QtCore.SIGNAL("rejected()"), self, QtCore.SLOT("reject()"))
        #
        lay = QtGui.QGridLayout(self)
        lay.addWidget(QtGui.QLabel(u"Choose one of available models for part"), 0, 0, 1, 1)
        lay.addWidget(QtGui.QLabel(u"<div style='font-weight:bold;'>{0}</div>".format(model)), 1, 0, 1, 1, QtCore.Qt.AlignHCenter)
        lay.addWidget(self.modelsList, 2, 0, 1, 1)
        lay.addWidget(buttons, 2, 1, 1, 1)
项目:NeoAnalysis    作者:neoanalysis    | 项目源码 | 文件源码
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(241, 367)
        self.gridLayout = QtGui.QGridLayout(Form)
        self.gridLayout.setSpacing(0)
        self.gridLayout.setObjectName("gridLayout")
        self.label = QtGui.QLabel(Form)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 0, 0, 1, 3)
        self.itemTree = QtGui.QTreeWidget(Form)
        self.itemTree.setObjectName("itemTree")
        self.itemTree.headerItem().setText(0, "1")
        self.itemTree.header().setVisible(False)
        self.gridLayout.addWidget(self.itemTree, 1, 0, 1, 3)
        self.label_2 = QtGui.QLabel(Form)
        self.label_2.setObjectName("label_2")
        self.gridLayout.addWidget(self.label_2, 2, 0, 1, 3)
        self.formatList = QtGui.QListWidget(Form)
        self.formatList.setObjectName("formatList")
        self.gridLayout.addWidget(self.formatList, 3, 0, 1, 3)
        self.exportBtn = QtGui.QPushButton(Form)
        self.exportBtn.setObjectName("exportBtn")
        self.gridLayout.addWidget(self.exportBtn, 6, 1, 1, 1)
        self.closeBtn = QtGui.QPushButton(Form)
        self.closeBtn.setObjectName("closeBtn")
        self.gridLayout.addWidget(self.closeBtn, 6, 2, 1, 1)
        self.paramTree = ParameterTree(Form)
        self.paramTree.setObjectName("paramTree")
        self.paramTree.headerItem().setText(0, "1")
        self.paramTree.header().setVisible(False)
        self.gridLayout.addWidget(self.paramTree, 5, 0, 1, 3)
        self.label_3 = QtGui.QLabel(Form)
        self.label_3.setObjectName("label_3")
        self.gridLayout.addWidget(self.label_3, 4, 0, 1, 3)
        self.copyBtn = QtGui.QPushButton(Form)
        self.copyBtn.setObjectName("copyBtn")
        self.gridLayout.addWidget(self.copyBtn, 6, 0, 1, 1)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
项目:NeoAnalysis    作者:neoanalysis    | 项目源码 | 文件源码
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(241, 367)
        self.gridLayout = QtGui.QGridLayout(Form)
        self.gridLayout.setSpacing(0)
        self.gridLayout.setObjectName("gridLayout")
        self.label = QtGui.QLabel(Form)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 0, 0, 1, 3)
        self.itemTree = QtGui.QTreeWidget(Form)
        self.itemTree.setObjectName("itemTree")
        self.itemTree.headerItem().setText(0, "1")
        self.itemTree.header().setVisible(False)
        self.gridLayout.addWidget(self.itemTree, 1, 0, 1, 3)
        self.label_2 = QtGui.QLabel(Form)
        self.label_2.setObjectName("label_2")
        self.gridLayout.addWidget(self.label_2, 2, 0, 1, 3)
        self.formatList = QtGui.QListWidget(Form)
        self.formatList.setObjectName("formatList")
        self.gridLayout.addWidget(self.formatList, 3, 0, 1, 3)
        self.exportBtn = QtGui.QPushButton(Form)
        self.exportBtn.setObjectName("exportBtn")
        self.gridLayout.addWidget(self.exportBtn, 6, 1, 1, 1)
        self.closeBtn = QtGui.QPushButton(Form)
        self.closeBtn.setObjectName("closeBtn")
        self.gridLayout.addWidget(self.closeBtn, 6, 2, 1, 1)
        self.paramTree = ParameterTree(Form)
        self.paramTree.setObjectName("paramTree")
        self.paramTree.headerItem().setText(0, "1")
        self.paramTree.header().setVisible(False)
        self.gridLayout.addWidget(self.paramTree, 5, 0, 1, 3)
        self.label_3 = QtGui.QLabel(Form)
        self.label_3.setObjectName("label_3")
        self.gridLayout.addWidget(self.label_3, 4, 0, 1, 3)
        self.copyBtn = QtGui.QPushButton(Form)
        self.copyBtn.setObjectName("copyBtn")
        self.gridLayout.addWidget(self.copyBtn, 6, 0, 1, 1)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
项目:sonosopencontroller    作者:codedwrench    | 项目源码 | 文件源码
def setupUi(self, sonosConnect):
        sonosConnect.setObjectName("sonosConnect")
        self.gridLayout = QtGui.QGridLayout(sonosConnect)
        self.connectList = QtGui.QListWidget(sonosConnect)
        QtGui.QListWidgetItem(self.connectList)
        self.gridLayout.addWidget(self.connectList, 0, 0, 1, 3)
        self.checkBox = QtGui.QCheckBox(sonosConnect)
        self.gridLayout.addWidget(self.checkBox, 2, 0, 1, 1)
        self.connectButton = QtGui.QPushButton(sonosConnect)
        self.gridLayout.addWidget(self.connectButton, 2, 2, 1, 1)
        self.rescanButton = QtGui.QPushButton(sonosConnect)
        self.gridLayout.addWidget(self.rescanButton, 2, 1, 1, 1)

        self.retranslateUi(sonosConnect)
        QtCore.QMetaObject.connectSlotsByName(sonosConnect)
项目:FreeCAD-PCB    作者:marmni    | 项目源码 | 文件源码
def formatPliku(self):
        page = QtGui.QWizardPage()
        page.setSubTitle(u"<span style='font-weight:bold;font-size:13px;'>File format</span>")
        #
        self.nazwaProgramu = QtGui.QLabel()
        self.formatPliku = QtGui.QLabel()

        self.ikonaProgramu = QtGui.QLabel()
        self.ikonaProgramu.setFixedSize(120, 120)
        self.ikonaProgramu.setAlignment(QtCore.Qt.AlignCenter)
        #
        self.listaFormatow = QtGui.QListWidget()
        for i, j in supSoftware.items():
            if j['export']:
                a = QtGui.QListWidgetItem(j['name'])
                a.setData(QtCore.Qt.UserRole, i)

                self.listaFormatow.addItem(a)
        QtCore.QObject.connect(self.listaFormatow, QtCore.SIGNAL("currentRowChanged (int)"), self.zmianaProgramu)
        #
        lay = QtGui.QGridLayout(page)
        lay.addWidget(self.listaFormatow, 0, 0, 4, 1)
        lay.addWidget(self.ikonaProgramu, 0, 1, 1, 1, QtCore.Qt.AlignCenter)
        lay.addWidget(self.nazwaProgramu, 1, 1, 1, 1)
        lay.addWidget(self.formatPliku, 2, 1, 1, 1)
        lay.setHorizontalSpacing(20)
        lay.setColumnMinimumWidth(1, 140)
        return page
项目:FreeCAD-PCB    作者:marmni    | 项目源码 | 文件源码
def __init__(self, parent=None):
        QtGui.QListWidget.__init__(self, parent)

        self.setFrameShape(QtGui.QFrame.NoFrame)


#***********************************************************************
#*                             GUI
#***********************************************************************
项目:FreeCAD-PCB    作者:marmni    | 项目源码 | 文件源码
def __init__(self, parent=None):
        QtGui.QListWidget.__init__(self, parent)

        self.setFrameShape(QtGui.QFrame.NoFrame)
项目:FreeCAD-PCB    作者:marmni    | 项目源码 | 文件源码
def defConstraintAreaF(self):
        ''' create constraint are dialog '''
        dial = QtGui.QDialog()
        dial.setWindowTitle("Create constraint area")
        # areas list
        lista = QtGui.QListWidget()
        for i, j in PCBconstraintAreas.items():
            a = QtGui.QListWidgetItem(j[0])
            a.setData(QtCore.Qt.UserRole, i)

            lista.addItem(a)
        lista.sortItems()
        ##########
        # przyciski
        buttons = QtGui.QDialogButtonBox()
        buttons.setOrientation(QtCore.Qt.Vertical)
        buttons.addButton("Cancel", QtGui.QDialogButtonBox.RejectRole)
        buttons.addButton("Create", QtGui.QDialogButtonBox.AcceptRole)
        dial.connect(buttons, QtCore.SIGNAL("accepted()"), dial, QtCore.SLOT("accept()"))
        dial.connect(buttons, QtCore.SIGNAL("rejected()"), dial, QtCore.SLOT("reject()"))
        ####
        lay = QtGui.QGridLayout()
        lay.addWidget(lista, 0, 0, 1, 1)
        lay.addWidget(buttons, 0, 1, 1, 1)
        dial.setLayout(lay)

        if dial.exec_():
            self.constraintAreaF(str(lista.currentItem().data(QtCore.Qt.UserRole)))
项目:PipeLine    作者:draknova    | 项目源码 | 文件源码
def initUI(self):
        self.layout = QtGui.QGridLayout()
        self.setLayout(self.layout)
        self.layout.setContentsMargins(0,0,0,0)

        self.releaseTypeLabel = QtGui.QLabel("Release Type :")
        self.releaseType = QtGui.QComboBox()
        self.releaseType.addItems(["2D","3D"])
        self.releaseType.currentIndexChanged.connect(self.currentIndexChanged)

        self.layout.addWidget(self.releaseTypeLabel,1,0)
        self.layout.addWidget(self.releaseType,1,2,1,2)


        a = QtGui.QListWidget()
        b = QtGui.QListWidget()

        self.elementForm()

        self.tab = QtGui.QTabWidget()
        self.tab.addTab(self.elementFormWidget,"Element")
        self.tab.addTab(b,"Email")
        #gesw = self.generateElementSelectionWidget()
        self.layout.addWidget(self.tab,2,0,10,4)

        self.elementFormLayout.addWidget(self.backButton,11,2)
        self.elementFormLayout.addWidget(self.nextButton,11,3)
项目:PipeLine    作者:draknova    | 项目源码 | 文件源码
def elementForm(self):
        self.elementFormWidget = QtGui.QWidget()

        self.elementFormLayout = QtGui.QGridLayout()
        self.elementFormWidget.setLayout(self.elementFormLayout)


        self.showList=QtGui.QComboBox()
        self.sqList=QtGui.QComboBox()
        self.shotList=QtGui.QComboBox()
        self.taskList=QtGui.QComboBox()

        self.userFilterLabel = QtGui.QLabel("User Filter")
        self.userFilter = QtGui.QLineEdit(str(os.getenv("USER")))

        self.renderList = QtGui.QListWidget()
        self.renderList.setSelectionMode(QtGui.QAbstractItemView.MultiSelection)

        self.generateList()

        self.backButton=QtGui.QPushButton("Back")
        self.nextButton=QtGui.QPushButton("Next")

        self.elementFormLayout.addWidget(self.showList,4,0)
        self.elementFormLayout.addWidget(self.sqList,4,1)
        self.elementFormLayout.addWidget(self.shotList,4,2)
        self.elementFormLayout.addWidget(self.taskList,4,3)
        self.elementFormLayout.addWidget(self.userFilterLabel,7,0)
        self.elementFormLayout.addWidget(self.userFilter,7,1,1,3)
        self.elementFormLayout.addWidget(self.renderList,6,0,1,4)
项目:3D_Software_and_Python    作者:p4vv37    | 项目源码 | 文件源码
def __init__(self):

        # set maya main window as parent or it will disappear quickly:
        main_window_ptr = omui.MQtUtil.mainWindow()
        mayaMainWindow = wrapInstance(long(main_window_ptr), QtGui.QWidget)

        super(GUI, self).__init__(mayaMainWindow)  # Initialize with mayaMainWindow as a parent

        self.resize(250, 150)  # Set the size of window
        self.center()
        self.setWindowTitle('Skrypt - Maya')  # Set the title of window
        self.setWindowFlags(QtCore.Qt.Tool)  # The tool window will always be kept on top of parent (maya_main_window)

        # Delete UI on close to avoid winEvent error
        # self.setAttribute(QtCore.Qt.WA_DeleteOnClose)

        grid = QtGui.QGridLayout()  # Create a grid layout
        grid_internal = QtGui.QGridLayout()
        self.label_info = QtGui.QLabel('Uruchom skrypt wciskajac `start`')  # Create a label GUI element
        btn_step = QtGui.QPushButton('Krok po kroku')  # Create a button
        btn_start = QtGui.QPushButton('Wszystkie kroki')
        self.connect(btn_start, SIGNAL("clicked()"), self.fn_no_steps)  # Connect button to function
        self.connect(btn_step, SIGNAL("clicked()"), self.fn_step)
        self.times_list = QtGui.QListWidget(self)  # Create a list widget
        btn_save = QtGui.QPushButton('Zapisz wyniki')
        btn_reset = QtGui.QPushButton('Wyczysc scene')

        grid.addWidget(self.label_info, 0, 0)  # Add the widget to the layout

        grid_internal.addWidget(btn_step, 0, 0)
        grid_internal.addWidget(btn_start, 0, 1)

        grid.addLayout(grid_internal, 1, 0)
        grid.addWidget(self.times_list, 2, 0)
        grid.addWidget(btn_save, 3, 0)
        grid.addWidget(btn_reset, 4, 0)

        self.data_table = DataTable()
        self.data_table.target_list = self.times_list
        self.data_table.target_label = self.label_info

        self.connect(btn_reset, SIGNAL("clicked()"), self.data_table.reset)
        self.connect(btn_save, SIGNAL("clicked()"), self.data_table.save)

        self.setLayout(grid)  # Set the layout of the window
项目:reconstruction    作者:microelly2    | 项目源码 | 文件源码
def dialog(points):
    print "dialog ",points.Label

    w=QtGui.QWidget()
    w.source=points

    box = QtGui.QVBoxLayout()
    w.setLayout(box)
    w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)




    l=QtGui.QLabel("Model" )
    box.addWidget(l)
    w.mode = QtGui.QListWidget()
    w.mode.addItems( ['linear','thin_plate', 'cubic','inverse','multiquadric','gaussian' ,'quintic' ])
    box.addWidget(w.mode)

    l=QtGui.QLabel("count grid lines" )
    box.addWidget(l)
    w.grid = QtGui.QLineEdit()
    w.grid.setText('20')
    box.addWidget(w.grid)

    l=QtGui.QLabel("z-scale factor" )
    box.addWidget(l)
    w.zfac = QtGui.QLineEdit()
    w.zfac.setText('10')
    box.addWidget(w.zfac)

    l=QtGui.QLabel("z-max " )
    box.addWidget(l)
    w.zmax = QtGui.QLineEdit()
    w.zmax.setText('0')
    box.addWidget(w.zmax)


    w.matplot=QtGui.QCheckBox("show Matplot")
    box.addWidget(w.matplot)

    w.colormap=QtGui.QCheckBox("show colors")
    box.addWidget(w.colormap)


#   h=QtGui.QDial()
#   h.setMaximum(100)
#   h.setMinimum(0)
#   w.ha=h

#   box.addWidget(h)

    w.r=QtGui.QPushButton("run")
    box.addWidget(w.r)
    w.r.pressed.connect(lambda :srun(w))


    w.show()
    return w
项目:OpenTimelineIO    作者:PixarAnimationStudios    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(Main, self).__init__(*args, **kwargs)

        self._current_file = None

        # window options
        self.setWindowTitle('OpenTimelineIO Viewer')
        self.resize(900, 500)

        # widgets
        self.tracks_widget = QtGui.QListWidget(parent=self)
        self.timeline_widget = otioViewWidget.timeline_widget.Timeline(
            parent=self
        )
        self.details_widget = otioViewWidget.details_widget.Details(
            parent=self
        )

        # layout
        splitter = QtGui.QSplitter(parent=self)
        self.setCentralWidget(splitter)

        widg = QtGui.QWidget(parent=self)
        layout = QtGui.QVBoxLayout()
        widg.setLayout(layout)
        layout.addWidget(self.details_widget)
        layout.addWidget(self.timeline_widget)

        splitter.addWidget(self.tracks_widget)
        splitter.addWidget(widg)
        splitter.setSizes([200, 700])

        # menu
        menubar = self.menuBar()

        file_load = QtGui.QAction('load...', menubar)
        file_load.triggered.connect(self._file_load)

        file_menu = menubar.addMenu('file')
        file_menu.addAction(file_load)

        # signals
        self.tracks_widget.itemSelectionChanged.connect(
            self._change_track
        )
        self.timeline_widget.selection_changed.connect(
            self.details_widget.set_item
        )
项目:Electrify    作者:jyapayne    | 项目源码 | 文件源码
def __init__(self, recent_projects, directory_callback, parent=None):
        super(ExistingProjectDialog, self).__init__(parent)
        self.setWindowTitle('Open Project Folder')
        self.setWindowIcon(QtGui.QIcon(get_file('files/images/icon.png')))
        self.setMinimumWidth(500)

        group_box = QtGui.QGroupBox('Existing Projects')
        gbox_layout = QtGui.QVBoxLayout()
        self.project_list = QtGui.QListWidget()

        gbox_layout.addWidget(self.project_list)
        group_box.setLayout(gbox_layout)

        self.callback = directory_callback

        self.projects = recent_projects

        for i in range(len(recent_projects)):
            project = recent_projects[i]
            text = u'{} - {}'.format(os.path.basename(project), project)
            self.project_list.addItem(text)

        self.project_list.itemClicked.connect(self.project_clicked)

        self.cancel = QtGui.QPushButton('Cancel')
        self.open = QtGui.QPushButton('Open Selected')
        self.browse = QtGui.QPushButton('Browse...')

        self.open.setEnabled(False)
        self.open.clicked.connect(self.open_clicked)

        self.browse.clicked.connect(self.browse_clicked)

        buttons = QtGui.QWidget()

        button_layout = QtGui.QHBoxLayout()
        button_layout.addWidget(self.cancel)
        button_layout.addWidget(QtGui.QWidget())
        button_layout.addWidget(self.browse)
        button_layout.addWidget(self.open)

        buttons.setLayout(button_layout)

        layout = QtGui.QVBoxLayout()
        layout.addWidget(group_box)
        layout.addWidget(buttons)

        self.setLayout(layout)
        self.cancel.clicked.connect(self.cancelled)
项目:twitterMonitor    作者:birolkuyumcu    | 项目源码 | 文件源码
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(823, 677)
        self.label = QtGui.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(10, 10, 800, 400))
        self.label.setFrameShape(QtGui.QFrame.WinPanel)
        self.label.setText("")
        self.label.setObjectName("label")
        self.listWidget = QtGui.QListWidget(Dialog)
        self.listWidget.setGeometry(QtCore.QRect(10, 470, 801, 192))
        self.listWidget.setObjectName("listWidget")
        self.widget = QtGui.QWidget(Dialog)
        self.widget.setGeometry(QtCore.QRect(10, 429, 801, 25))
        self.widget.setObjectName("widget")
        self.horizontalLayout = QtGui.QHBoxLayout(self.widget)
        self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.label_2 = QtGui.QLabel(self.widget)
        self.label_2.setObjectName("label_2")
        self.horizontalLayout.addWidget(self.label_2)
        self.lineEdit = QtGui.QLineEdit(self.widget)
        self.lineEdit.setObjectName("lineEdit")
        self.horizontalLayout.addWidget(self.lineEdit)
        self.pushButton = QtGui.QPushButton(self.widget)
        self.pushButton.setObjectName("pushButton")
        self.horizontalLayout.addWidget(self.pushButton)

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
        #
        self.pushButton.clicked.connect(self.on_buttom_pressed)
        self.listWidget.doubleClicked.connect(self.goTweet)

        #
        self.alText = u''
        self.fullText = u''
        self.twitter = Twitter(language='tr')
        self.prevId = None
        self.timer = QtCore.QTimer(Dialog)
        self.timer.timeout.connect(self.on_timer)
        self.dialog = Dialog
        self.twIds = []