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


Python QListView.setGeometry方法代码示例

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


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

示例1: SettingWindow

# 需要导入模块: from PyQt5.QtWidgets import QListView [as 别名]
# 或者: from PyQt5.QtWidgets.QListView import setGeometry [as 别名]
class SettingWindow(QWidget):
#	on_addButtonClicked=pyqtSignal()
#	on_removeButtonClicked=pyqtSignal()
#	on_okButtonClicked=pyqtSignal()
	finished=pyqtSignal()
	def __init__(self):
		QWidget.__init__(self)
		self.listview=QListView(self)
		self.addButton=QPushButton(self)
		self.removeButton=QPushButton(self)
		self.resize(630,440)
		self.okButton=QPushButton(self)
		self.listview.setGeometry(30,30,410,351)
		self.addButton.setGeometry(490,40,80,22)
		self.addButton.setText("add")
		self.addButton.clicked.connect(self.click_add)
		self.removeButton.setGeometry(490,80,80,22)
		self.removeButton.setText("remove")
		self.removeButton.clicked.connect(self.click_remove)
		self.okButton.setGeometry(490,150,80,22)
		self.okButton.setText("ok")
		self.okButton.clicked.connect(self.click_ok)
#		self.aw=null


		self.fresh()
	def click_ok(self):
		self.finished.emit()
		self.close()
	def click_add(self):
		self.aw=AddWindow()
		self.aw.show()
		self.aw.okSig.connect(self.fresh)
	def click_remove(self):
		self.remove()
	def fresh(self):
		confFile=open("conf","r")
		self.listModel=QStandardItemModel()
		self.itemList=cPickle.load(confFile)
		confFile.close()
		for  item in self.itemList:
			itemView=QStandardItem(QIcon(item.path),item.name)
			itemView.setEditable(False)
			self.listModel.appendRow(itemView)
			self.listview.setModel(self.listModel)
	def remove(self):
		index=self.listview.currentIndex().row()
		self.itemList.pop(index)
		self.listModel.removeRow(index)
		confFile=open("conf","w")
		cPickle.dump(self.itemList,confFile)
		confFile.close()
开发者ID:ganger,项目名称:linux_quick_launch_tool,代码行数:54,代码来源:settingWindow.py

示例2: keepColumn

# 需要导入模块: from PyQt5.QtWidgets import QListView [as 别名]
# 或者: from PyQt5.QtWidgets.QListView import setGeometry [as 别名]
class keepColumn(QDialog):     
    def __init__(self, parent=None):

        self.parent = parent
        self.parent.statusbar.showMessage("Keep Columns started...")
        QWidget.__init__(self,parent)
        
        self.ui = gui.keepColumnUi()
        self.ui.setupUi(self)
        
        self.columns = []
        
        self.batch_files = filedialog.askopenfilenames(parent=root, title='Choose the file(s) you want to modify')
        
        if len(self.batch_files) == 0:
            self.close()
            return
        
        self.parent.statusbar.showMessage("Checking column validity...")

        #extract columns
        for item in self.batch_files:
            self.columns.append(helpers.extract_columns(item))
 
        #check to see if all columns are equal in all the datasets
        if not helpers.are_columns_same(self.columns):
            if not helpers.columns_not_equal_message(self):
                self.close()
                return
                
        #list of items to check from        
        
        self.model = QStandardItemModel()
        
        try:
            for col in self.columns[0]:
                item = QStandardItem(col)
                item.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled) 
                item.setData(QVariant(Qt.Unchecked), Qt.CheckStateRole) 
                self.model.appendRow(item) 
        except IndexError:
            pass

        self.list = QListView(self)
        self.list.setModel(self.model) 
        self.list.setGeometry(10, 60, 380, 430)
       
        self.ui.removeBtn.clicked.connect(self.keep)
        self.ui.closeBtn.clicked.connect(self.close)
       
        self.parent.statusbar.showMessage("Welcome back!")
        self.show()
    
    def close(self):
        self.parent.statusbar.showMessage("Welcome back!")
        self.parent.ui.logOutput.append("")
        self.done(55)
        
    def keep(self):
        self.parent.statusbar.showMessage("Keep Columns in process...")
        self.columns_to_keep = []

        i = 0
        while self.model.item(i):
            if self.model.item(i).checkState() == 2:
                self.columns_to_keep.append(self.model.item(i).text())
            i += 1
        
        query = "Are you sure you want to proceed?"
        reply = QMessageBox.question(self, 'Message',query, QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
        if reply == QMessageBox.No:
            self.columns_to_keep = []
            return
        
        self.parent.statusbar.showMessage("Processing...")
        
        self.parent.ui.logOutput.append("KEPT:")
        print("KEPT:")
        
        #per file first retrieve data then filter columnarly
        for file in self.batch_files:
        
            list_colindx = []

            datablob = helpers.clean_header(file)
            for item in self.columns_to_keep:
                list_colindx.append(datablob[0].index(item))
                        
            for i in range(len(datablob)):
                datablob[i][:] = [x for i, x in enumerate(datablob[i]) if i in list_colindx]
                        
            split_name = file.split('.')
            now = time.strftime('%Y%m%d_%H%M%S', time.localtime(time.time()))
            output_file = split_name[0] + "_keep_columns_" + now + "." + split_name[1]
            
            helpers.write_out_to_file(output_file,datablob)
            
            self.parent.ui.logOutput.append("      " + str(file.split('/')[-1]))
            print("      " + str(file.split('/')[-1]))
        
#.........这里部分代码省略.........
开发者ID:micahzev,项目名称:biometric_data_manipulator,代码行数:103,代码来源:data_manipulator.py


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