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


Python QtGui.QListWidget类代码示例

本文整理汇总了Python中PySide.QtGui.QListWidget的典型用法代码示例。如果您正苦于以下问题:Python QListWidget类的具体用法?Python QListWidget怎么用?Python QListWidget使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: initUI

    def initUI(self):
        mainlay = QVBoxLayout()
        mainlay.addWidget(QLabel('<b>Deformers ({0})</b>'.format(len(self.mdl.deformers))))

        def_list = QListWidget()
        for index, el in enumerate(self.mdl.deformers):
            def_list.addItem('{0} - {1}'.format(index, el))
        #def_list.addItems(self.mdl.deformers)
        mainlay.addWidget(def_list)

        self.def_list = def_list

        btns = QHBoxLayout()
        btns.addStretch()

        save = QPushButton('Save')
        save.clicked.connect(self.save)
        close = QPushButton('Close')
        close.clicked.connect(self.close)

        btns.addWidget(save)
        btns.addWidget(close)

        mainlay.addLayout(btns)

        self.setLayout(mainlay)
        self.setGeometry(340, 340, 200, 400)
        self.setWindowTitle('MSH Suite - {0} Deformers'.format(self.mdl.name))
        self.show()
开发者ID:Schlechtwetterfront,项目名称:mshsuite,代码行数:29,代码来源:model_dialogs.py

示例2: TestWindow

class TestWindow(QMainWindow):
    
    
    def __init__(self):
        
        super(TestWindow, self).__init__()
        
        self.setWindowTitle('PySide QListWidget Problem')
        
        self._list = QListWidget(self)
        self._list.insertItems(0, [str(i + 1) for i in xrange(50)])
        
        # This line seems to be the problem. Change "Contiguous" to "Single"
        # and item deletion does not cause the list to scroll to the top.
        self._list.setSelectionMode(QAbstractItemView.ContiguousSelection)
        
        button = QPushButton('Delete', self)
        button.clicked.connect(self._on_button_clicked)
        
        box = QVBoxLayout()
        box.addWidget(self._list)
        box.addWidget(button)
        
        widget = QWidget()
        widget.setLayout(box)
        
        self.setCentralWidget(widget)


    def _on_button_clicked(self):
        l = self._list
        for item in l.selectedItems():
            l.takeItem(l.row(item))
开发者ID:HaroldMills,项目名称:Maka,代码行数:33,代码来源:TestListWidget.py

示例3: addTab

 def addTab(self, label ):
     
     layoutWidget = QWidget()
     vLayout = QVBoxLayout(layoutWidget)
     vLayout.setContentsMargins(5,5,5,5)
     
     setFolderLayout = QHBoxLayout()
     listWidget = QListWidget()
     listWidget.setSelectionMode( QAbstractItemView.ExtendedSelection )
     vLayout.addLayout( setFolderLayout )
     vLayout.addWidget( listWidget )
     
     lineEdit = QLineEdit()
     setFolderButton = QPushButton( 'Set Folder' )
     
     setFolderLayout.addWidget( lineEdit )
     setFolderLayout.addWidget( setFolderButton )
     
     QtCore.QObject.connect( setFolderButton, QtCore.SIGNAL( 'clicked()' ),  Functions.setFolder )
     QtCore.QObject.connect( listWidget, QtCore.SIGNAL( 'itemSelectionChanged()' ),  Functions.loadImagePathArea )
     QtCore.QObject.connect( lineEdit, QtCore.SIGNAL( 'textChanged()' ), Functions.lineEdited )
     
     listWidget.setObjectName( Window_global.listWidgetObjectName )
     lineEdit.setContextMenuPolicy( QtCore.Qt.NoContextMenu )
     lineEdit.setObjectName( Window_global.lineEditObjectName )
     
     lineEdit.returnPressed.connect( Functions.lineEdited )
     
     super( Tab, self ).addTab( layoutWidget, label )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:29,代码来源:getImageFromObject.py

示例4: __init__

 def __init__(self ):
     
     QWidget.__init__( self )
     layout = QVBoxLayout( self )
     
     label = QLabel()
     listWidget = QListWidget()
     listWidget.setSelectionMode( QAbstractItemView.ExtendedSelection )
     hLayout = QHBoxLayout()
     buttonLoad   = QPushButton( "LOAD")
     buttonRemove = QPushButton( "REMOVE")
     hLayout.addWidget( buttonLoad )
     hLayout.addWidget( buttonRemove )
     
     layout.addWidget( label )
     layout.addWidget( listWidget )
     layout.addLayout( hLayout )
     
     self.label = label
     self.listWidget = listWidget
     self.buttonLoad = buttonLoad
     self.buttonRemove = buttonRemove
     
     QtCore.QObject.connect( self.buttonLoad, QtCore.SIGNAL( 'clicked()' ), self.loadCommand )
     QtCore.QObject.connect( self.buttonRemove, QtCore.SIGNAL( 'clicked()' ), self.removeCommand )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:25,代码来源:__init__.py

示例5: initUI

    def initUI(self):
        grp = QGroupBox('Anim Munge')
        grplay = QGridLayout()
        self.bf1mode = QCheckBox()
        grplay.addWidget(QLabel('<b>SWBF1</b>'), 0, 1)
        grplay.addWidget(self.bf1mode, 0, 2)
        grplay.addWidget(QLabel('<b>Input</b>'), 1, 1)
        grplay.addWidget(QLabel('<b>Output</b>'), 1, 3)
        self.infiles = QListWidget()
        self.infiles.setMinimumWidth(150)
        self.infiles.addItems([os.path.basename(item) for item in self.files])
        grplay.addWidget(self.infiles, 2, 1, 1, 2)
        self.outfiles = QListWidget()
        self.outfiles.setMinimumWidth(150)
        grplay.addWidget(self.outfiles, 2, 3, 1, 2)
        self.add_params = QLineEdit()
        self.add_params.setText('Additional Params')
        self.add_params.setToolTip('<b>Additional Munge Parameters.</b> Like scale 1.5')
        grplay.addWidget(self.add_params, 0, 3, 1, 2)

        self.statlabel = QLabel('<b>AnimMunger</b>')
        grplay.addWidget(self.statlabel, 4, 1, 1, 1)
        self.animname = QLineEdit()
        self.animname.setText('AnimName')
        self.animname.setToolTip('<b>Animation Name.</b> Name of the final animation files. IE: name.zafbin, name.zaabin, name.anims.')
        grplay.addWidget(self.animname, 3, 1)
        self.type_box = QComboBox()
        self.type_box.addItems(self.types)
        self.type_box.setToolTip('<b>Munge Mode.</b> This switches munge parameters.')
        grplay.addWidget(QLabel('<b>Munge Mode:</b>'), 3, 2)
        grplay.addWidget(self.type_box, 3, 3, 1, 2)
        munge_btn = QPushButton('Munge')
        munge_btn.clicked.connect(self.munge)
        munge_btn.setToolTip('<b>Munge.</b> Munges the input files with the selected mode.')
        grplay.addWidget(munge_btn, 4, 2)
        save_out = QPushButton('Save')
        save_out.clicked.connect(self.save)
        save_out.setToolTip('<b>Save.</b> Saves the output files.')
        grplay.addWidget(save_out, 4, 3)
        cancel_btn = QPushButton('Cancel')
        cancel_btn.clicked.connect(self.cancel)
        cancel_btn.setToolTip('<b>Cancel.</b> Closes the dialog and removes all temporary files.')
        grplay.addWidget(cancel_btn, 4, 4)

        grp.setLayout(grplay)

        mainlay = QVBoxLayout()
        mainlay.addWidget(grp)

        self.setLayout(mainlay)
        self.setGeometry(340, 340, 320, 300)
        self.setWindowTitle('MSH Suite - Animation Munge')
        self.show()
开发者ID:Schlechtwetterfront,项目名称:mshsuite,代码行数:53,代码来源:misc_dialogs.py

示例6: initWidgets

    def initWidgets(self):
        self.showAllServicesItem = QListWidgetItem(self.tr("(All registered services)"))
        self.servicesListWidget = QListWidget()
        self.interfacesListWidget = QListWidget()
        self.interfacesListWidget.addItem(self.tr("(Select a service)"))
        self.attributesListWidget = QListWidget()
        self.attributesListWidget.addItem(self.tr("(Select an interface implementation)"))
        self.interfacesListWidget.setMinimumWidth(450)
        self.servicesListWidget.currentItemChanged.connect(self.reloadInterfaceImplementationsList)
        self.interfacesListWidget.currentItemChanged.connect(self.currentInterfaceImplChanged)
        self.defaultInterfaceButton = QPushButton(self.tr("Set as default implementation"))
        self.defaultInterfaceButton.setEnabled(False)
        self.defaultInterfaceButton.clicked.connect(self.setDefaultInterfaceImplementation)
        self.selectedImplRadioButton = QRadioButton(self.tr("Selected interface implementation"))
        self.defaultImplRadioButton = QRadioButton(self.tr("Default implementation"))
        self.selectedImplRadioButton.setChecked(True)
        self.radioButtons = QButtonGroup(self)
        self.radioButtons.addButton(self.selectedImplRadioButton)
        self.radioButtons.addButton(self.defaultImplRadioButton)
        self.radioButtons.buttonClicked.connect(self.reloadAttributesList)

        self.servicesGroup = QGroupBox(self.tr("Show services for:"))
        servicesLayout = QVBoxLayout()
        servicesLayout.addWidget(self.servicesListWidget)
        self.servicesGroup.setLayout(servicesLayout)

        self.interfacesGroup = QGroupBox(self.tr("Interface implementations"))
        interfacesLayout = QVBoxLayout()
        interfacesLayout.addWidget(self.interfacesListWidget)
        interfacesLayout.addWidget(self.defaultInterfaceButton)
        self.interfacesGroup.setLayout(interfacesLayout)

        self.attributesGroup = QGroupBox(self.tr("Invokable attributes"))
        attributesLayout = QVBoxLayout()
        self.attributesGroup.setLayout(attributesLayout)
        attributesLayout.addWidget(self.attributesListWidget)
        attributesLayout.addWidget(QLabel(self.tr("Show attributes for:")))
        attributesLayout.addWidget(self.selectedImplRadioButton)
        attributesLayout.addWidget(self.defaultImplRadioButton)

        self.attributesGroup.setLayout(attributesLayout)

        layout = QGridLayout()
        layout.addWidget(self.servicesGroup, 0, 0)
        layout.addWidget(self.attributesGroup, 0, 1, 2, 1)
        layout.addWidget(self.interfacesGroup, 1, 0)

        self.setLayout(layout)
开发者ID:AmerGit,项目名称:Examples,代码行数:48,代码来源:servicebrowser.py

示例7: __createContents

    def __createContents(self):
        self.contentsWidget = QListWidget()
        self.contentsWidget.setViewMode(QListView.ListMode)
        self.contentsWidget.setMovement(QListView.Static)

        toolBar = QListWidgetItem(self.contentsWidget)
        toolBar.setText(self.tr("Toolbar"))
        toolBar.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        worksheet = QListWidgetItem(self.contentsWidget)
        worksheet.setText(self.tr("Worksheet"))
        worksheet.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        computation = QListWidgetItem(self.contentsWidget)
        computation.setText(self.tr("Computation"))
        computation.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        currentItem = QSettings().value("preferences/currentitem",
                                        self.tr(QtReduceDefaults.CURRENTITEM))
        if currentItem == self.tr("Toolbar"):
            self.contentsWidget.setCurrentItem(toolBar)
        elif currentItem == self.tr("Worksheet"):
            self.contentsWidget.setCurrentItem(worksheet)
        elif currentItem == self.tr("Computation"):
            self.contentsWidget.setCurrentItem(computation)

        self.contentsWidget.currentItemChanged.connect(self.changePage)
开发者ID:webushka,项目名称:reduce,代码行数:27,代码来源:qrpreferences.py

示例8: addThreadList

    def addThreadList(self,threads):

        if not self.groupBoxThreadInfo:
            self.groupBoxThreadInfo = QGroupBox()
            self.threadInfo = QLabel("Thread Info.")
            self.groupBoxThreadInfo.setStyleSheet("QGroupBox {border: 1px solid gray; border-radius: 9px; margin-top: 0.5em} QGroupBox::title {subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;")

        if not self.threadvbox:
            self.threadvbox = QVBoxLayout()

        if not self.listThread:
            self.listThread = QListWidget()
            
        self.listThread.setFixedWidth(200)
        self.listThread.setSelectionMode(QtGui.QAbstractItemView.MultiSelection)
        QtCore.QObject.connect(self.listThread, QtCore.SIGNAL("itemClicked(QListWidgetItem *)"), self.toggleThreadDisplay)
        self.threadvbox.addWidget(self.threadInfo)
        self.threadvbox.addWidget(self.listThread)
        self.groupBoxThreadInfo.setLayout(self.threadvbox)
        self.addWidget(self.groupBoxThreadInfo)
        self.groupBoxThreadInfo.setSizePolicy(self.sizePolicy)

        for id in threads:
            item = QtGui.QListWidgetItem(id)
            self.listThread.addItem(item)
开发者ID:OpenDanbi,项目名称:Sherlock,代码行数:25,代码来源:ToolBox.py

示例9: Console

class Console():
    def __init__(self, targetLayoutContainer):
        self.textarea = QTextEdit()
        self.commits = QListWidget()
        
        self.commits.addAction(QAction('Rollback to this revision', self.commits, triggered=self.rollback))
        self.commits.setContextMenuPolicy(Qt.ActionsContextMenu)
        
        self.widget = QTabWidget()
        self.widget.addTab(self.textarea, 'Log')
        self.widget.addTab(self.commits, 'Commits')
        
        targetLayoutContainer.addWidget(self.widget)
        
    def color(self, module, function, color,  *args):
        print module, function, args
        
        prettyString = '<font color="' + color + '"><b>', module, '</b><i>::', function, '</i> --> ', ''.join(args), '</font>'
        self.textarea.append(''.join(prettyString))    
        
    def info(self, module, function, *args):
        print module, function, args
        
        prettyString = '<font color="black"><b>', module, '</b><i>::', function, '</i> --> ', ''.join(args), '</font>'
        self.textarea.append(''.join(prettyString))
        
    def error(self, module, function, *args):
        print module, function, args
        
        prettyString = '<font color="red"><b>', module, '</b><i>::', function, '</i> --> ', ''.join(args), '</font>'
        self.textarea.append(''.join(prettyString))
        
    def warn(self, module, function, *args):
        print module, function, args
        
        prettyString = '<font color="#BE9900"><b>', module, '</b><i>::', function, '</i> --> ', ''.join(args), '</font>'
        self.textarea.append(''.join(prettyString))
        
    def set_commits(self, commits):
        self.commits.clear()
        
        for commit in commits:
            self.commits.addItem(commit)
            
    def clear(self):
        self.textarea.clear()
        
    def rollback(self):
        targetCommit = self.commits.currentItem().text().split(' ')[0]
        if QMessageBox.warning(None, 'Rollback to commit?', 'All commits after ' + targetCommit + ' will be lost, proceed?', QMessageBox.Yes, QMessageBox.No) == QMessageBox.Yes:
            rollback(targetCommit)
开发者ID:cefolger,项目名称:favorites,代码行数:51,代码来源:console.py

示例10: __init__

    def __init__(self):
        generic.GenericGui.__init__(self)
        window = QWidget()
        window.setWindowTitle('quichem-pyside')

        self.compiler_view = QListWidget()
        self.compiler_view.currentRowChanged.connect(self.show_source)
        self.stacked_widget = QStackedWidget()
        self.stacked_widget.setFrameStyle(QFrame.StyledPanel | QFrame.Raised)
        self.edit = QLineEdit()
        self.edit.setPlaceholderText('Type quichem input...')
        self.edit.textChanged.connect(self.change_value)
        self.view = QWebView()
        self.view.page().mainFrame().setScrollBarPolicy(Qt.Vertical,
                                                        Qt.ScrollBarAlwaysOff)
        self.view.page().action(QWebPage.Reload).setVisible(False)
        self.view.setMaximumHeight(0)
        self.view.setUrl('qrc:/web/page.html')
        self.view.setZoomFactor(2)
        self.view.page().mainFrame().contentsSizeChanged.connect(
            self._resize_view)
        # For debugging JS:
        ## from PySide.QtWebKit import QWebSettings
        ## QWebSettings.globalSettings().setAttribute(
        ##     QWebSettings.DeveloperExtrasEnabled, True)

        button_image = QPushButton('Copy as Image')
        button_image.clicked.connect(self.set_clipboard_image)
        button_image.setToolTip('Then paste into any graphics program')
        button_word = QPushButton('Copy as MS Word Equation')
        button_word.clicked.connect(self.set_clipboard_word)
        button_html = QPushButton('Copy as Formatted Text')
        button_html.clicked.connect(self.set_clipboard_html)
        line = QFrame()
        line.setFrameShape(QFrame.HLine)
        line.setFrameShadow(QFrame.Sunken)

        button_layout = QHBoxLayout()
        button_layout.addStretch()
        button_layout.addWidget(button_image)
        button_layout.addWidget(button_word)
        button_layout.addWidget(button_html)
        source_layout = QHBoxLayout()
        source_layout.addWidget(self.compiler_view)
        source_layout.addWidget(self.stacked_widget, 1)
        QVBoxLayout(window)
        window.layout().addWidget(self.edit)
        window.layout().addWidget(self.view)
        window.layout().addLayout(button_layout)
        window.layout().addWidget(line)
        window.layout().addLayout(source_layout, 1)

        window.show()
        window.resize(window.minimumWidth(), window.height())
        # To prevent garbage collection of internal Qt object.
        self._window = window
开发者ID:spamalot,项目名称:quichem,代码行数:56,代码来源:pyside.py

示例11: __init__

 def __init__(self):
 
     QScrollArea.__init__(self)
     self.mainWidget = QListWidget()
     self.setWidget(self.mainWidget)
     self.setWidgetResizable(True)        
             
     self.setFixedWidth(200)
     
     self.setTitle()      
开发者ID:antiface,项目名称:DSP-Tool,代码行数:10,代码来源:SideBar.py

示例12: __init__

 def __init__(self, parent):
 
     QScrollArea.__init__(self)
     self.parent = parent
     self.mainWidget = QListWidget()
     self.setWidget(self.mainWidget)
     self.setWidgetResizable(True)        
             
     self.setFixedHeight(130)
     
     self.setTitle()      
开发者ID:antiface,项目名称:DSP-Tool,代码行数:11,代码来源:PropertyBar.py

示例13: managebkm

class managebkm(QDialog):
	def __init__(self, parent=None):
		super(managebkm, self).__init__(parent)
		appicom = QIcon(":/icons/njnlogo.png")
		self.setWindowIcon(appicom)
		self.setWindowTitle("Nigandu | Manage Book Marks")
		self.setFixedSize(463, 242)

		self.verticalLayoutWidget = QWidget(self)
		self.verticalLayoutWidget.setGeometry(QRect(350, 30, 101, 201))
		self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
		self.verticalLayout = QVBoxLayout(self.verticalLayoutWidget)
		self.verticalLayout.setContentsMargins(0, 0, 0, 0)
		self.verticalLayout.setObjectName("verticalLayout")

		self.sortbtn = QPushButton(self.verticalLayoutWidget)
		self.sortbtn.setText("&Sort")
		self.verticalLayout.addWidget(self.sortbtn)

		self.deletebtn = QPushButton(self.verticalLayoutWidget)
		self.deletebtn.setText("&Delete")
		self.verticalLayout.addWidget(self.deletebtn)

		self.deleteallbtn = QPushButton(self.verticalLayoutWidget)
		self.deleteallbtn.setText("Delete &All")
		self.verticalLayout.addWidget(self.deleteallbtn)

		self.closebtn = QPushButton(self.verticalLayoutWidget)
		self.closebtn.setText("&Close")
		self.verticalLayout.addWidget(self.closebtn)

		self.listWidget = QListWidget(self)
		self.listWidget.setGeometry(QRect(10, 30, 331, 201))

		self.label = QLabel(self)
		self.label.setGeometry(QRect(20, 10, 91, 25))
		font = QFont()
		font.setPointSize(10)
		self.label.setFont(font)
		self.label.setBuddy(self.listWidget)
		self.label.setText("Book Mark List:")
开发者ID:jnoortheen,项目名称:nigandu,代码行数:41,代码来源:managebkm.py

示例14: __init__

 def __init__(self, targetLayoutContainer):
     self.textarea = QTextEdit()
     self.commits = QListWidget()
     
     self.commits.addAction(QAction('Rollback to this revision', self.commits, triggered=self.rollback))
     self.commits.setContextMenuPolicy(Qt.ActionsContextMenu)
     
     self.widget = QTabWidget()
     self.widget.addTab(self.textarea, 'Log')
     self.widget.addTab(self.commits, 'Commits')
     
     targetLayoutContainer.addWidget(self.widget)
开发者ID:cefolger,项目名称:favorites,代码行数:12,代码来源:console.py

示例15: display

	def display(self):
		layout = QHBoxLayout()
		layout.setSpacing(10)

		# Left panel - repositories
		qlistWidget = QListWidget()
		for repo in self.args.user.repositories():
			qlistWidget.addItem(repo.name)
		layout.addWidget (qlistWidget)


		# Middle panel - commits
		commitsLabel = QLabel("There will be the commits")
		layout.addWidget (commitsLabel)

		# Something
		somethingLabel = QLabel("There will be something")
		layout.addWidget (somethingLabel)

		self.setLayout(layout)
		self.show()
开发者ID:FrostyX,项目名称:octopy,代码行数:21,代码来源:home.py


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