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


Python QtGui.QTableView方法代码示例

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


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

示例1: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QTableView [as 别名]
def __init__(self, parent=None):
        QtGui.QTableView.__init__(self, parent)
        self.model = QtGui.QStandardItemModel(parent=self)
        self.model.setHorizontalHeaderLabels(['Source', 'Destination', 'Protoco', 'Info'])
        self.setModel(self.model)
        self.setColumnWidth(0, 120)
        self.setColumnWidth(1, 120)
        self.setColumnWidth(2, 100)
        self.setColumnWidth(3, 350)
        self.setAlternatingRowColors(True)
        self.setAutoScroll(True)
        self.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) #整行选中
        self.setEditTriggers(QtGui.QTableView.NoEditTriggers) #不可编辑
        self.setSelectionMode(QtGui.QTableView.SingleSelection) #选择单行
        self.show() 
开发者ID:HatBoy,项目名称:SimpleSniffer,代码行数:17,代码来源:Sniffer.py

示例2: mouseDoubleClickEvent

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QTableView [as 别名]
def mouseDoubleClickEvent(self, QMouseEvent):
        global SELECT_ROW, SELECT_INFO, SHOW2STR, HEXSTR
        QtGui.QTableView.mouseDoubleClickEvent(self, QMouseEvent)
        pos = QMouseEvent.pos()
        item = self.indexAt(pos)
        if item:
            SELECT_ROW = int(item.row())
            SELECT_INFO = PACKETS[SELECT_ROW]
            #输出重定向数据
            show2_temp_name = tempfile.NamedTemporaryFile(prefix='show2_', dir='/tmp')
            old = sys.stdout
            show2_file = open(show2_temp_name.name, 'w')
            sys.stdout = show2_file
            SELECT_INFO.show2()
            sys.stdout = old
            show2_file.close()
            hex_temp_name = tempfile.NamedTemporaryFile(prefix='hex_', dir='/tmp')
            hex_file = open(hex_temp_name.name, 'w')
            sys.stdout = hex_file
            hexdump(SELECT_INFO)
            sys.stdout = old
            hex_file.close()
            #读取数据
            with open(show2_temp_name.name, 'r') as show2f:
                SHOW2STR = show2f.read()
            with open(hex_temp_name.name, 'r') as hexf:
                HEXSTR = hexf.read()
            print('--------------------------------------')
            print(SHOW2STR)
            print(HEXSTR)
            print('--------------------------------------')


    #添加行 
开发者ID:HatBoy,项目名称:SimpleSniffer,代码行数:36,代码来源:Sniffer.py

示例3: setupUi

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QTableView [as 别名]
def setupUi(self, SavestatesDialog):
        SavestatesDialog.setObjectName(_fromUtf8("SavestatesDialog"))
        SavestatesDialog.resize(630, 600)
        SavestatesDialog.setWindowTitle(QtGui.QApplication.translate("SavestatesDialog", "Unsupported game savestates", None, QtGui.QApplication.UnicodeUTF8))
        self.verticalLayout = QtGui.QVBoxLayout(SavestatesDialog)
        self.verticalLayout.setContentsMargins(2, 0, 2, 6)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.label = QtGui.QLabel(SavestatesDialog)
        self.label.setText(QtGui.QApplication.translate("SavestatesDialog", "Filter:", None, QtGui.QApplication.UnicodeUTF8))
        self.label.setObjectName(_fromUtf8("label"))
        self.horizontalLayout.addWidget(self.label)
        self.uiFilterLineEdit = QtGui.QLineEdit(SavestatesDialog)
        self.uiFilterLineEdit.setText(_fromUtf8(""))
        self.uiFilterLineEdit.setObjectName(_fromUtf8("uiFilterLineEdit"))
        self.horizontalLayout.addWidget(self.uiFilterLineEdit)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.uiSavestatesTblv = QtGui.QTableView(SavestatesDialog)
        self.uiSavestatesTblv.setObjectName(_fromUtf8("uiSavestatesTblv"))
        self.verticalLayout.addWidget(self.uiSavestatesTblv)
        self.uiButtonBox = QtGui.QDialogButtonBox(SavestatesDialog)
        self.uiButtonBox.setOrientation(QtCore.Qt.Horizontal)
        self.uiButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
        self.uiButtonBox.setObjectName(_fromUtf8("uiButtonBox"))
        self.verticalLayout.addWidget(self.uiButtonBox)

        self.retranslateUi(SavestatesDialog)
        QtCore.QObject.connect(self.uiButtonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), SavestatesDialog.accept)
        QtCore.QObject.connect(self.uiButtonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), SavestatesDialog.reject)
        QtCore.QMetaObject.connectSlotsByName(SavestatesDialog)
        SavestatesDialog.setTabOrder(self.uiFilterLineEdit, self.uiSavestatesTblv)
        SavestatesDialog.setTabOrder(self.uiSavestatesTblv, self.uiButtonBox) 
开发者ID:doctorguile,项目名称:pyqtggpo,代码行数:35,代码来源:savestatesdialog_ui.py

示例4: setupUi

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QTableView [as 别名]
def setupUi(self, FileManager):
        FileManager.setObjectName(_fromUtf8("FileManager"))
        FileManager.resize(977, 313)
        self.label = QtGui.QLabel(FileManager)
        self.label.setGeometry(QtCore.QRect(290, 0, 141, 61))
        self.label.setObjectName(_fromUtf8("label"))
        self.file_delete_bt = QtGui.QPushButton(FileManager)
        self.file_delete_bt.setGeometry(QtCore.QRect(760, 100, 211, 31))
        self.file_delete_bt.setObjectName(_fromUtf8("file_delete_bt"))
        self.file_mirrors_bt = QtGui.QPushButton(FileManager)
        self.file_mirrors_bt.setGeometry(QtCore.QRect(760, 60, 211, 31))
        self.file_mirrors_bt.setObjectName(_fromUtf8("file_mirrors_bt"))
        self.line = QtGui.QFrame(FileManager)
        self.line.setGeometry(QtCore.QRect(740, 60, 20, 241))
        self.line.setFrameShape(QtGui.QFrame.VLine)
        self.line.setFrameShadow(QtGui.QFrame.Sunken)
        self.line.setObjectName(_fromUtf8("line"))
        self.quit_bt = QtGui.QPushButton(FileManager)
        self.quit_bt.setGeometry(QtCore.QRect(760, 240, 211, 61))
        self.quit_bt.setObjectName(_fromUtf8("quit_bt"))
        self.files_list_tableview = QtGui.QTableView(FileManager)
        self.files_list_tableview.setGeometry(QtCore.QRect(10, 60, 731, 241))
        self.files_list_tableview.setObjectName(_fromUtf8("files_list_tableview"))
        self.file_download_bt = QtGui.QPushButton(FileManager)
        self.file_download_bt.setGeometry(QtCore.QRect(760, 140, 211, 31))
        self.file_download_bt.setObjectName(_fromUtf8("file_download_bt"))
        self.new_file_upload_bt = QtGui.QPushButton(FileManager)
        self.new_file_upload_bt.setGeometry(QtCore.QRect(760, 180, 211, 51))
        self.new_file_upload_bt.setObjectName(_fromUtf8("new_file_upload_bt"))
        self.label_2 = QtGui.QLabel(FileManager)
        self.label_2.setGeometry(QtCore.QRect(600, 20, 131, 31))
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.bucket_select_combo_box = QtGui.QComboBox(FileManager)
        self.bucket_select_combo_box.setGeometry(QtCore.QRect(740, 20, 231, 31))
        self.bucket_select_combo_box.setObjectName(_fromUtf8("bucket_select_combo_box"))

        self.retranslateUi(FileManager)
        QtCore.QMetaObject.connectSlotsByName(FileManager) 
开发者ID:lakewik,项目名称:EasyStorj,代码行数:40,代码来源:file_manager_ui.py

示例5: setupUi

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QTableView [as 别名]
def setupUi(self, BucketManager):
        BucketManager.setObjectName(_fromUtf8("BucketManager"))
        BucketManager.resize(883, 290)
        self.bucket_list_tableview = QtGui.QTableView(BucketManager)
        self.bucket_list_tableview.setGeometry(QtCore.QRect(10, 50, 671, 201))
        self.bucket_list_tableview.setObjectName(_fromUtf8("bucket_list_tableview"))
        self.label = QtGui.QLabel(BucketManager)
        self.label.setGeometry(QtCore.QRect(350, 0, 181, 51))
        self.label.setObjectName(_fromUtf8("label"))
        self.line = QtGui.QFrame(BucketManager)
        self.line.setGeometry(QtCore.QRect(690, 50, 20, 201))
        self.line.setFrameShape(QtGui.QFrame.VLine)
        self.line.setFrameShadow(QtGui.QFrame.Sunken)
        self.line.setObjectName(_fromUtf8("line"))
        self.edit_bucket_bt = QtGui.QPushButton(BucketManager)
        self.edit_bucket_bt.setGeometry(QtCore.QRect(710, 50, 161, 51))
        self.edit_bucket_bt.setObjectName(_fromUtf8("edit_bucket_bt"))
        self.delete_bucket_bt = QtGui.QPushButton(BucketManager)
        self.delete_bucket_bt.setGeometry(QtCore.QRect(710, 110, 161, 41))
        self.delete_bucket_bt.setObjectName(_fromUtf8("delete_bucket_bt"))
        self.quit_bt = QtGui.QPushButton(BucketManager)
        self.quit_bt.setGeometry(QtCore.QRect(710, 210, 161, 41))
        self.quit_bt.setObjectName(_fromUtf8("quit_bt"))
        self.label_2 = QtGui.QLabel(BucketManager)
        self.label_2.setGeometry(QtCore.QRect(630, 260, 111, 21))
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.total_buckets_label = QtGui.QLabel(BucketManager)
        self.total_buckets_label.setGeometry(QtCore.QRect(750, 260, 121, 21))
        self.total_buckets_label.setObjectName(_fromUtf8("total_buckets_label"))
        self.create_new_bucket_bt = QtGui.QPushButton(BucketManager)
        self.create_new_bucket_bt.setGeometry(QtCore.QRect(710, 160, 161, 41))
        self.create_new_bucket_bt.setObjectName(_fromUtf8("create_new_bucket_bt"))

        self.retranslateUi(BucketManager)
        QtCore.QMetaObject.connectSlotsByName(BucketManager) 
开发者ID:lakewik,项目名称:EasyStorj,代码行数:37,代码来源:bucket_manager_ui.py

示例6: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QTableView [as 别名]
def __init__(self, parent = None):
        super(PlotterTab, self).__init__(parent)
        self.layout = QtGui.QGridLayout()
        self.setLayout(self.layout)

        # data sources
        self.data_box = QtGui.QGroupBox(self, title="Data Sources")
        self.layout.addWidget(self.data_box,0,0)

        data_box_layout = QtGui.QGridLayout(self.data_box)
        self.data_box.setLayout(data_box_layout)

        self.data_source_model = DataSourceModel()
        self.data_source_table = QtGui.QTableView()
        self.data_source_table.setModel(self.data_source_model)
        self.data_source_table.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
        self.data_source_table.activated.connect(self.event_open_data_source_edit)

        data_box_layout.addWidget(self.data_source_table, 0, 0)


        self.plotter = PlotterWidget(self)
        self.plotter.set_data_source_model(self.data_source_model)
        self.layout.addWidget(self.plotter, 1,0,1,2)

        self.data_source_model.rowsInserted.connect(self.plotter.update_plot)


        # main buttons
        add_file_button = QtGui.QPushButton(self.data_box)
        add_file_button.setText("Add File")

        add_file_button.released.connect(self.event_show_select_file_dialog)
        self.layout.addWidget(add_file_button,0,1) 
开发者ID:dmayer,项目名称:time_trial,代码行数:36,代码来源:plotter_tab.py

示例7: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QTableView [as 别名]
def __init__(self,  parent = None, session = None):
        super(SettingsTab, self).__init__(parent)
        self.session = session
        self.layout = QtGui.QGridLayout()
        self.setLayout(self.layout)

        racers_box = QtGui.QGroupBox("Racer Configuration")
        racers_box_layout = QtGui.QGridLayout()
        racers_box.setLayout(racers_box_layout)
        self.layout.addWidget(racers_box,0,0)

        self.racers_table = QtGui.QTableView(self)
        self.racers_table.doubleClicked.connect(self.edit_racer)
        self.racers_table.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
        self.racers_table.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
        self.racers_table_model = SQLAlchemyTableModel(session, Racer, [
            ('name', Racer.name, 'name'),
            ('hostname', Racer.hostname, 'hostname'),
            ('location', Racer.location, 'location')])


        self.racers_table_selection_model  = QtGui.QItemSelectionModel(self.racers_table_model)
        self.racers_table.setModel(self.racers_table_selection_model.model())
        self.racers_table.setSelectionModel(self.racers_table_selection_model)


        racers_box_layout.addWidget(self.racers_table,0,0, 1, 3)

        racers_add_button = QtGui.QPushButton("Add")
        racers_add_button.released.connect(self.add_racer)
        racers_box_layout.addWidget(racers_add_button, 1, 0)

        racers_edit_button = QtGui.QPushButton("Edit")
        racers_edit_button.released.connect(self.edit_racer)
        racers_box_layout.addWidget(racers_edit_button, 1, 1)


        racers_delete_button = QtGui.QPushButton("Delete")
        racers_delete_button.released.connect(self.delete_racer)
        racers_box_layout.addWidget(racers_delete_button, 1, 2) 
开发者ID:dmayer,项目名称:time_trial,代码行数:42,代码来源:settings_tab.py

示例8: setupUi

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QTableView [as 别名]
def setupUi(self, EntityBrowser):
        EntityBrowser.setObjectName(_fromUtf8("EntityBrowser"))
        EntityBrowser.resize(650, 416)
        self.gridLayout = QtGui.QGridLayout(EntityBrowser)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.label = QtGui.QLabel(EntityBrowser)
        self.label.setObjectName(_fromUtf8("label"))
        self.gridLayout.addWidget(self.label, 3, 0, 1, 1)
        self.buttonBox = QtGui.QDialogButtonBox(EntityBrowser)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.Save)
        self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
        self.gridLayout.addWidget(self.buttonBox, 4, 0, 1, 4)
        self.label_2 = QtGui.QLabel(EntityBrowser)
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.gridLayout.addWidget(self.label_2, 3, 2, 1, 1)
        self.cboFilterColumn = QtGui.QComboBox(EntityBrowser)
        self.cboFilterColumn.setMinimumSize(QtCore.QSize(150, 30))
        self.cboFilterColumn.setObjectName(_fromUtf8("cboFilterColumn"))
        self.gridLayout.addWidget(self.cboFilterColumn, 3, 3, 1, 1)
        self.vlNotification = QtGui.QVBoxLayout()
        self.vlNotification.setObjectName(_fromUtf8("vlNotification"))
        self.gridLayout.addLayout(self.vlNotification, 0, 0, 1, 4)
        self.tbEntity = QtGui.QTableView(EntityBrowser)
        self.tbEntity.setFrameShape(QtGui.QFrame.StyledPanel)
        self.tbEntity.setFrameShadow(QtGui.QFrame.Sunken)
        self.tbEntity.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
        self.tbEntity.setAlternatingRowColors(True)
        self.tbEntity.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
        self.tbEntity.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
        self.tbEntity.setObjectName(_fromUtf8("tbEntity"))
        self.gridLayout.addWidget(self.tbEntity, 2, 0, 1, 4)
        self.txtFilterPattern = QtGui.QLineEdit(EntityBrowser)
        self.txtFilterPattern.setMinimumSize(QtCore.QSize(0, 30))
        self.txtFilterPattern.setMaxLength(50)
        self.txtFilterPattern.setObjectName(_fromUtf8("txtFilterPattern"))
        self.gridLayout.addWidget(self.txtFilterPattern, 3, 1, 1, 1)
        self.vlActions = QtGui.QVBoxLayout()
        self.vlActions.setObjectName(_fromUtf8("vlActions"))
        self.gridLayout.addLayout(self.vlActions, 1, 0, 1, 4)

        self.retranslateUi(EntityBrowser)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), EntityBrowser.reject)
        QtCore.QMetaObject.connectSlotsByName(EntityBrowser) 
开发者ID:gltn,项目名称:stdm,代码行数:46,代码来源:ui_entity_browser.py


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