Python PyQt5.QtWidgets.QTableWidget() Examples

The following are 30 code examples for showing how to use PyQt5.QtWidgets.QTableWidget(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module PyQt5.QtWidgets , or try the search function .

Example 1
Project: pkmeter   Author: pkkid   File: pkconfig.py    License: BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def _init_datatable(self):
        template = ElementTree.fromstring("""
          <vframe>
            <hframe>
              <QLineEdit id='filter' name='input_xlarge' placeholder='Filter'/>
              <stretch/><pushbutton text='Refresh' click='refresh_datatable'/>
            </hframe>
            <vframe id='table'/>
          </vframe>""")
        # Build the datatable
        self.datatable_wrap = PKWidget(template, self)
        datatable = QtWidgets.QTableWidget(0, 3, parent=None)
        datatable.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
        datatable.setHorizontalHeaderLabels(['Variable', 'Value', 'Type   '])
        datatable.horizontalHeader().setSectionResizeMode(0, QtWidgets.QHeaderView.Interactive)
        datatable.horizontalHeader().setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch)
        datatable.horizontalHeader().setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents)
        datatable.horizontalHeader().resizeSection(0, 200)
        datatable.verticalHeader().setVisible(False)
        datatable.verticalHeader().setDefaultSectionSize(19)
        datatable.setParent(self.datatable_wrap)
        self.datatable_wrap.manifest.table.layout().addWidget(datatable)
        # Connect the filter input
        self.datatable_wrap.manifest.filter.textChanged.connect(self.filter_datatable)
        return datatable 
Example 2
Project: ddt4all   Author: cedricp   File: dataeditor.py    License: GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent=None):
        super(buttonEditor, self).__init__(parent)
        self.ecurequestsparser = None

        self.layout = None
        self.layouth = widgets.QHBoxLayout()
        self.buttontable = widgets.QTableWidget()
        self.layoutv = widgets.QVBoxLayout()

        self.layouth.addWidget(self.buttontable)
        self.layouth.addLayout(self.layoutv)

        self.buttondata = buttonData()
        self.layoutv.addWidget(self.buttondata)

        self.setLayout(self.layouth)

        self.buttontable.setFixedWidth(250)
        self.buttontable.setColumnCount(2)
        self.buttontable.verticalHeader().hide()
        self.buttontable.setSelectionBehavior(widgets.QAbstractItemView.SelectRows)
        self.buttontable.setSelectionMode(widgets.QAbstractItemView.SingleSelection)
        #self.buttontable.setShowGrid(False)
        self.buttontable.itemSelectionChanged.connect(self.selection_changed)
        self.enable_view(False) 
Example 3
Project: sparrow-wifi   Author: ghostop14   File: telemetry.py    License: GNU General Public License v3.0 6 votes vote down vote up
def createTable(self):
        # Set up location table
        self.locationTable = QTableWidget(self)
        self.locationTable.setColumnCount(8)
        self.locationTable.setGeometry(10, 10, self.geometry().width()/2-20, self.geometry().height()/2)
        self.locationTable.setShowGrid(True)
        self.locationTable.setHorizontalHeaderLabels(['macAddr','SSID', 'Strength', 'Timestamp','GPS', 'Latitude', 'Longitude', 'Altitude'])
        self.locationTable.resizeColumnsToContents()
        self.locationTable.setRowCount(0)
        self.locationTable.horizontalHeader().setSectionResizeMode(1, QHeaderView.Stretch)
        
        self.ntRightClickMenu = QMenu(self)
        newAct = QAction('Copy', self)        
        newAct.setStatusTip('Copy data to clipboard')
        newAct.triggered.connect(self.onCopy)
        self.ntRightClickMenu.addAction(newAct)
        
        self.locationTable.setContextMenuPolicy(Qt.CustomContextMenu)
        self.locationTable.customContextMenuRequested.connect(self.showNTContextMenu) 
Example 4
Project: sparrow-wifi   Author: ghostop14   File: telemetry.py    License: GNU General Public License v3.0 6 votes vote down vote up
def createTable(self):
        # Set up location table
        self.locationTable = QTableWidget(self)
        self.locationTable.setColumnCount(10)
        self.locationTable.setGeometry(10, 10, self.geometry().width()/2-20, self.geometry().height()/2)
        self.locationTable.setShowGrid(True)
        self.locationTable.setHorizontalHeaderLabels(['macAddr','Name', 'RSSI', 'TX Power', 'Est Range (m)', 'Timestamp','GPS', 'Latitude', 'Longitude', 'Altitude'])
        self.locationTable.resizeColumnsToContents()
        self.locationTable.setRowCount(0)
        self.locationTable.horizontalHeader().setSectionResizeMode(1, QHeaderView.Stretch)
        
        self.ntRightClickMenu = QMenu(self)
        newAct = QAction('Copy', self)        
        newAct.setStatusTip('Copy data to clipboard')
        newAct.triggered.connect(self.onCopy)
        self.ntRightClickMenu.addAction(newAct)
        
        self.locationTable.setContextMenuPolicy(Qt.CustomContextMenu)
        self.locationTable.customContextMenuRequested.connect(self.showNTContextMenu) 
Example 5
Project: CNNArt   Author: thomaskuestner   File: network_interface.py    License: Apache License 2.0 6 votes vote down vote up
def createGUI(self):

        length = len(self.DataSetsHist)
        self.table = QTableWidget(length, 2)
        self.table.setHorizontalHeaderLabels(["Images", "Using for"])
        self.table.verticalHeader().setVisible(True)
        self.table.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents)

        for i in range(length):
            imageItem = QTableWidgetItem(self.DataSetsHist[i])
            selectItem = QtWidgets.QComboBox()
            selectItem.addItems(['Training', 'Validation', 'Test'])
            self.table.setItem(i, 0, imageItem)
            self.table.setCellWidget(i, 1, selectItem)

        self.table.resizeColumnToContents(0)
        self.table.horizontalHeader().setStretchLastSection(False)
        self.table.cellClicked.connect(self.updateRecord)

        self.layout.addWidget(self.table, 0, 0)
        self.setLayout(self.layout)
        self.setGeometry(800, 200, 550, 200)
        self.setWindowTitle("Select Datasets for Training & Test Network")
        self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) 
Example 6
Project: opensnitch   Author: evilsocket   File: stats.py    License: GNU General Public License v3.0 6 votes vote down vote up
def _setup_table(self, name, columns):
        table = self.findChild(QtWidgets.QTableWidget, name)

        ncols = len(columns)
        table.setColumnCount(ncols)
        table.setHorizontalHeaderLabels(columns)

        header = table.horizontalHeader()       
        header.setVisible(True)

        if 'Connections' in columns:
            for col_idx, _ in enumerate(columns):
                header.setSectionResizeMode(col_idx, \
                        QtWidgets.QHeaderView.Stretch if col_idx == 0 else QtWidgets.QHeaderView.ResizeToContents)

        else:
            for col_idx, _ in enumerate(columns):
                header.setSectionResizeMode(col_idx, QtWidgets.QHeaderView.ResizeToContents)

        return table 
Example 7
Project: Openroast   Author: Roastero   File: recipeeditorwindow.py    License: GNU General Public License v3.0 6 votes vote down vote up
def create_steps_spreadsheet(self):
        """Creates Recipe Steps table. It does not populate the table in this
        method."""
        recipeStepsTable = QtWidgets.QTableWidget()
        recipeStepsTable.setShowGrid(False)
        recipeStepsTable.setAlternatingRowColors(True)
        recipeStepsTable.setCornerButtonEnabled(False)
        recipeStepsTable.horizontalHeader().setSectionResizeMode(1)
        recipeStepsTable.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection)

        # Steps spreadsheet
        recipeStepsTable.setColumnCount(4)
        recipeStepsTable.setHorizontalHeaderLabels(["Temperature",
            "Fan Speed", "Section Time", "Modify"])

        return recipeStepsTable 
Example 8
Project: urh   Author: jopohl   File: ui_modulation_parameters_dialog.py    License: GNU General Public License v3.0 6 votes vote down vote up
def setupUi(self, DialogModulationParameters):
        DialogModulationParameters.setObjectName("DialogModulationParameters")
        DialogModulationParameters.resize(303, 286)
        DialogModulationParameters.setModal(True)
        self.verticalLayout = QtWidgets.QVBoxLayout(DialogModulationParameters)
        self.verticalLayout.setObjectName("verticalLayout")
        self.tblSymbolParameters = QtWidgets.QTableWidget(DialogModulationParameters)
        self.tblSymbolParameters.setShowGrid(False)
        self.tblSymbolParameters.setRowCount(2)
        self.tblSymbolParameters.setObjectName("tblSymbolParameters")
        self.tblSymbolParameters.setColumnCount(2)
        item = QtWidgets.QTableWidgetItem()
        self.tblSymbolParameters.setHorizontalHeaderItem(0, item)
        item = QtWidgets.QTableWidgetItem()
        self.tblSymbolParameters.setHorizontalHeaderItem(1, item)
        self.tblSymbolParameters.horizontalHeader().setVisible(True)
        self.tblSymbolParameters.verticalHeader().setVisible(False)
        self.verticalLayout.addWidget(self.tblSymbolParameters)
        self.buttonBox = QtWidgets.QDialogButtonBox(DialogModulationParameters)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.verticalLayout.addWidget(self.buttonBox)

        self.retranslateUi(DialogModulationParameters) 
Example 9
Project: QualCoder   Author: ccbogel   File: ui_dialog_manage_attributes.py    License: MIT License 6 votes vote down vote up
def setupUi(self, Dialog_manage_attributes):
        Dialog_manage_attributes.setObjectName("Dialog_manage_attributes")
        Dialog_manage_attributes.resize(546, 569)
        self.gridLayout = QtWidgets.QGridLayout(Dialog_manage_attributes)
        self.gridLayout.setObjectName("gridLayout")
        self.pushButton_add = QtWidgets.QPushButton(Dialog_manage_attributes)
        self.pushButton_add.setObjectName("pushButton_add")
        self.gridLayout.addWidget(self.pushButton_add, 0, 0, 1, 1)
        self.pushButton_delete = QtWidgets.QPushButton(Dialog_manage_attributes)
        self.pushButton_delete.setObjectName("pushButton_delete")
        self.gridLayout.addWidget(self.pushButton_delete, 0, 1, 1, 1)
        self.tableWidget = QtWidgets.QTableWidget(Dialog_manage_attributes)
        self.tableWidget.setObjectName("tableWidget")
        self.tableWidget.setColumnCount(0)
        self.tableWidget.setRowCount(0)
        self.gridLayout.addWidget(self.tableWidget, 1, 0, 1, 2)

        self.retranslateUi(Dialog_manage_attributes)
        QtCore.QMetaObject.connectSlotsByName(Dialog_manage_attributes) 
Example 10
Project: simnibs   Author: simnibs   File: main_gui.py    License: GNU General Public License v3.0 5 votes vote down vote up
def createTable(self):
        table =  QtWidgets.QTableWidget(0,4)
        table.setHorizontalHeaderLabels(("Current", "Position", "Shape", "Name"))
        #table.setColumnWidth(3,1)
        table.setShowGrid(False)
        #table.horizontalHeader().setResizeMode(2, QtWidgets.QHeaderView.Stretch)
        table.verticalHeader().hide()
        table.cellDoubleClicked.connect(self.tableLeftClick)
        return table 
Example 11
Project: simnibs   Author: simnibs   File: main_gui.py    License: GNU General Public License v3.0 5 votes vote down vote up
def createTable(self):
        table =  QtWidgets.QTableWidget(0,4)
        table.setHorizontalHeaderLabels(("dI/dt", "Skin Distance", "  Position  ", " Name "))
        table.setShowGrid(False)
        table.horizontalHeader().setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch)
        table.verticalHeader().hide()
        table.cellDoubleClicked.connect(self.tableLeftClick)
        return table 
Example 12
Project: simnibs   Author: simnibs   File: main_gui.py    License: GNU General Public License v3.0 5 votes vote down vote up
def setCondTable(self):
        self.condTable = QtWidgets.QTableWidget(0,2)
        self.condTable.setHorizontalHeaderLabels(("Name", "Value")) 
        self.condTable.setShowGrid(False)
        self.condTable.horizontalHeader().setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch)
        self.condTable.verticalHeader().hide()


        self.setRowValues()

    #Sets up each row 
Example 13
Project: ocelot   Author: ocelot-collab   File: ebeam_table_ui.py    License: GNU General Public License v3.0 5 votes vote down vote up
def setupUi(self, Ebeam_Table):
        Ebeam_Table.setObjectName("Ebeam_Table")
        Ebeam_Table.resize(700, 500)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(Ebeam_Table.sizePolicy().hasHeightForWidth())
        Ebeam_Table.setSizePolicy(sizePolicy)
        self.gridLayout_2 = QtWidgets.QGridLayout(Ebeam_Table)
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.table = QtWidgets.QTableWidget(Ebeam_Table)
        self.table.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
        self.table.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
        self.table.setRowCount(0)
        self.table.setColumnCount(2)
        self.table.setObjectName("table")
        item = QtWidgets.QTableWidgetItem()
        item.setTextAlignment(QtCore.Qt.AlignCenter)
        self.table.setHorizontalHeaderItem(0, item)
        item = QtWidgets.QTableWidgetItem()
        item.setTextAlignment(QtCore.Qt.AlignCenter)
        self.table.setHorizontalHeaderItem(1, item)
        self.table.verticalHeader().setVisible(False)
        self.gridLayout_2.addWidget(self.table, 0, 1, 1, 1)

        self.retranslateUi(Ebeam_Table)
        QtCore.QMetaObject.connectSlotsByName(Ebeam_Table) 
Example 14
Project: pyleecan   Author: Eomys   File: Ui_WMachineTable.py    License: Apache License 2.0 5 votes vote down vote up
def setupUi(self, WMachineTable):
        WMachineTable.setObjectName("WMachineTable")
        WMachineTable.resize(290, 357)
        WMachineTable.setMinimumSize(QtCore.QSize(290, 0))
        WMachineTable.setMaximumSize(QtCore.QSize(282, 16777215))
        self.verticalLayout = QtWidgets.QVBoxLayout(WMachineTable)
        self.verticalLayout.setObjectName("verticalLayout")
        self.in_name = QtWidgets.QLabel(WMachineTable)
        self.in_name.setAlignment(QtCore.Qt.AlignCenter)
        self.in_name.setObjectName("in_name")
        self.verticalLayout.addWidget(self.in_name)
        self.tab_param = QtWidgets.QTableWidget(WMachineTable)
        self.tab_param.setMinimumSize(QtCore.QSize(270, 0))
        self.tab_param.setMaximumSize(QtCore.QSize(260, 16777215))
        self.tab_param.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
        self.tab_param.setSizeAdjustPolicy(
            QtWidgets.QAbstractScrollArea.AdjustToContents
        )
        self.tab_param.setAlternatingRowColors(True)
        self.tab_param.setColumnCount(2)
        self.tab_param.setObjectName("tab_param")
        self.tab_param.setRowCount(0)
        item = QtWidgets.QTableWidgetItem()
        self.tab_param.setHorizontalHeaderItem(0, item)
        item = QtWidgets.QTableWidgetItem()
        self.tab_param.setHorizontalHeaderItem(1, item)
        self.tab_param.horizontalHeader().setCascadingSectionResizes(False)
        self.tab_param.horizontalHeader().setStretchLastSection(True)
        self.tab_param.verticalHeader().setVisible(False)
        self.tab_param.verticalHeader().setCascadingSectionResizes(False)
        self.verticalLayout.addWidget(self.tab_param)
        self.b_mmf = QtWidgets.QPushButton(WMachineTable)
        self.b_mmf.setObjectName("b_mmf")
        self.verticalLayout.addWidget(self.b_mmf)

        self.retranslateUi(WMachineTable)
        QtCore.QMetaObject.connectSlotsByName(WMachineTable) 
Example 15
Project: ddt4all   Author: cedricp   File: sniffer.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent=None):
        super(sniffer, self).__init__(parent)
        self.ecu_file = None
        self.ecurequests = None
        self.snifferthread = None
        self.currentrequest = None
        self.names = []
        self.oktostart = False
        self.ecu_filter = ""

        hlayout = widgets.QHBoxLayout()

        self.framecombo = widgets.QComboBox()

        self.startbutton = widgets.QPushButton(">>")
        self.addressinfo = widgets.QLabel("0000")

        self.startbutton.setCheckable(True)
        self.startbutton.toggled.connect(self.startmonitoring)

        self.addressinfo.setFixedWidth(90)
        self.startbutton.setFixedWidth(90)

        hlayout.addWidget(self.addressinfo)
        hlayout.addWidget(self.framecombo)
        hlayout.addWidget(self.startbutton)

        vlayout = widgets.QVBoxLayout()
        self.setLayout(vlayout)

        vlayout.addLayout(hlayout)

        self.table = widgets.QTableWidget()
        vlayout.addWidget(self.table)

        self.framecombo.activated.connect(self.change_frame) 
Example 16
Project: ddt4all   Author: cedricp   File: dataeditor.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, dataitem, parent=None):
        super(numericListPanel, self).__init__(parent)
        self.setFrameStyle(widgets.QFrame.Sunken)
        self.setFrameShape(widgets.QFrame.Box)
        self.data = dataitem

        layoutv = widgets.QVBoxLayout()
        layout = widgets.QGridLayout()
        labelnob = widgets.QLabel(_("Number of bits"))
        lablelsigned = widgets.QLabel(_("Signed"))
        newitem = widgets.QPushButton(_("Add item"))
        delitem = widgets.QPushButton(_("Del item"))

        newitem.clicked.connect(self.add_item)
        delitem.clicked.connect(self.def_item)

        layout.addWidget(labelnob, 0, 0)
        layout.addWidget(lablelsigned, 1, 0)
        layout.addWidget(newitem, 2, 0)
        layout.addWidget(delitem, 2, 1)

        self.inputnob = widgets.QSpinBox()
        self.inputnob.setRange(1, 32)
        self.inputsigned = widgets.QCheckBox()

        layout.addWidget(self.inputnob, 0, 1)
        layout.addWidget(self.inputsigned, 1, 1)

        layoutv.addLayout(layout)

        self.itemtable = widgets.QTableWidget()
        self.itemtable.setRowCount(1)
        self.itemtable.setColumnCount(2)
        self.itemtable.verticalHeader().hide()
        self.itemtable.setSelectionBehavior(widgets.QAbstractItemView.SelectRows)
        self.itemtable.setSelectionMode(widgets.QAbstractItemView.SingleSelection)

        layoutv.addWidget(self.itemtable)

        self.setLayout(layoutv)
        self.init() 
Example 17
Project: reaper   Author: ScriptSmith   File: progress.py    License: GNU General Public License v3.0 5 votes vote down vote up
def create_snapshot(self):
        self.snapshotCheckBox = QtWidgets.QCheckBox("Show snapshot")
        self.snapshotCheckBox.toggled.connect(self.toggle_snapshot)
        self.layout.addWidget(self.snapshotCheckBox)

        self.snapshot = QtWidgets.QTableWidget()
        self.snapshot.verticalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Fixed)
        self.snapshot.horizontalHeader().setSectionResizeMode(
            QtWidgets.QHeaderView.Interactive
        )
        self.snapshot.horizontalHeader().setCascadingSectionResizes(True)
        self.layout.addWidget(self.snapshot) 
Example 18
Project: grap   Author: AirbusCyber   File: QtShim.py    License: MIT License 5 votes vote down vote up
def get_QTableWidget():
    """QTableWidget getter."""

    try:
        import PySide.QtGui as QtGui
        return QtGui.QTableWidget
    except ImportError:
        import PyQt5.QtWidgets as QtWidgets
        return QtWidgets.QTableWidget 
Example 19
Project: python   Author: Yeah-Kun   File: select.py    License: Apache License 2.0 5 votes vote down vote up
def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1279, 677)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.tableWidget = QtWidgets.QTableWidget(self.centralwidget)
        self.tableWidget.setGeometry(QtCore.QRect(150, 80, 441, 331))
        self.tableWidget.setObjectName("tableWidget")
        self.tableWidget.setColumnCount(0)
        self.tableWidget.setRowCount(0)
        self.pushButton = QtWidgets.QPushButton(self.centralwidget) # 生成相对应的对象
        self.pushButton.setGeometry(QtCore.QRect(310, 510, 171, 61))# 确定该对象的位置以及大小
        self.pushButton.setObjectName("pushButton")                 # 设置名字,加载对象
        self.checkBox = QtWidgets.QCheckBox(self.centralwidget)
        self.checkBox.setGeometry(QtCore.QRect(870, 530, 91, 19))
        self.checkBox.setObjectName("checkBox")
        self.textBrowser = QtWidgets.QTextBrowser(self.centralwidget)
        self.textBrowser.setGeometry(QtCore.QRect(750, 90, 421, 321))
        self.textBrowser.setObjectName("textBrowser")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1279, 23))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow) 
Example 20
Project: CNNArt   Author: thomaskuestner   File: predefined_networks.py    License: Apache License 2.0 5 votes vote down vote up
def createGUI(self):

        tableData = pd.read_csv('DLart/networks.csv')
        self.networkHist = []
        for i in range(pd.DataFrame.count(tableData)['name']):
            self.networkHist.append(tableData.iloc[i]['name'])
        length = len(self.networkHist)
        self.table = QTableWidget(length, 2)
        self.table.setHorizontalHeaderLabels(["Network Name", "Network Path"])
        self.table.verticalHeader().setVisible(True)
        self.table.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents)

        self.table.cellDoubleClicked.connect(self.editCell)
        self.table.cellChanged.connect(self.cellChanged)

        for i in range(length):
            name = tableData.at[i,'name']
            nameItem = QTableWidgetItem(name)
            nameItem.setFlags(nameItem.flags() | Qt.ItemIsEditable)
            path = tableData.at[i,'path'].replace(".", "/") + '.py'
            pathItem = QTableWidgetItem(path)
            self.table.setItem(i, 0, nameItem)
            self.table.setItem(i, 1, pathItem)

        self.table.resizeColumnToContents(0)
        self.table.horizontalHeader().setStretchLastSection(True)

        self.layout = QGridLayout()
        self.layout.addWidget(self.table, 0, 0)
        self.setLayout(self.layout)

        self.setWindowTitle("Predefined Neural Networks Editor") 
Example 21
Project: CNNArt   Author: thomaskuestner   File: predefined_label.py    License: Apache License 2.0 5 votes vote down vote up
def createGUI(self):
        length = len(self.labelHist)
        tableData = pandas.read_csv('configGUI/predefined_label.csv')

        self.table = QTableWidget(length, 2)
        self.table.setHorizontalHeaderLabels(["Label Name", "Label Color"])
        self.table.verticalHeader().setVisible(True)
        self.table.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents)

        self.table.cellDoubleClicked.connect(self.editCell)
        self.table.cellChanged.connect(self.cellChanged)

        for i in range(length):
            name = tableData.at[i,'label name']
            nameItem = QTableWidgetItem(name)
            nameItem.setFlags(nameItem.flags() | Qt.ItemIsEditable)
            color = QColor(tableData.at[i,'label color'])
            colorItem = QTableWidgetItem()
            colorItem.setData(Qt.DisplayRole, color)
            colorItem.setFlags(colorItem.flags() | Qt.ItemIsEditable)
            self.table.setItem(i, 0, nameItem)
            self.table.setItem(i, 1, colorItem)

        self.table.resizeColumnToContents(0)

        self.layout = QGridLayout()
        self.layout.addWidget(self.table, 0, 0)
        self.setLayout(self.layout)

        self.setWindowTitle("Predefined Label Editor") 
Example 22
Project: universal_tool_template.py   Author: shiningdesign   File: universal_tool_template_1116.py    License: MIT License 5 votes vote down vote up
def setLang(self, langName):
        lang_data = self.memoData['lang'][langName]
        for ui_name in lang_data.keys():
            if ui_name in self.uiList.keys() and lang_data[ui_name] != '':
                ui_element = self.uiList[ui_name]
                # '' means no translation availdanle in that data file
                if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ):
                    # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
                    ui_element.setText(lang_data[ui_name])
                elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ):
                    # uiType: QMenu, QGroupBox
                    ui_element.setTitle(lang_data[ui_name])
                elif isinstance(ui_element, QtWidgets.QTabWidget):
                    # uiType: QTabWidget
                    tabCnt = ui_element.count()
                    tabNameList = lang_data[ui_name].split(';')
                    if len(tabNameList) == tabCnt:
                        for i in range(tabCnt):
                            if tabNameList[i] != '':
                                ui_element.setTabText(i,tabNameList[i])
                elif isinstance(ui_element, QtWidgets.QComboBox):
                    # uiType: QComboBox
                    itemCnt = ui_element.count()
                    itemNameList = lang_data[ui_name].split(';')
                    ui_element.clear()
                    ui_element.addItems(itemNameList)
                elif isinstance(ui_element, QtWidgets.QTreeWidget):
                    # uiType: QTreeWidget
                    labelCnt = ui_element.headerItem().columnCount()
                    labelList = lang_data[ui_name].split(';')
                    ui_element.setHeaderLabels(labelList)
                elif isinstance(ui_element, QtWidgets.QTableWidget):
                    # uiType: QTableWidget
                    colCnt = ui_element.columnCount()
                    headerList = lang_data[ui_name].split(';')
                    cur_table.setHorizontalHeaderLabels( headerList )
                elif isinstance(ui_element, (str, unicode) ):
                    # uiType: string for msg
                    self.uiList[ui_name] = lang_data[ui_name] 
Example 23
Project: universal_tool_template.py   Author: shiningdesign   File: universal_tool_template_1020.py    License: MIT License 5 votes vote down vote up
def setLang(self, langName):
        lang_data = self.memoData['lang'][langName]
        for ui_name in lang_data.keys():
            if ui_name in self.uiList.keys() and lang_data[ui_name] != '':
                ui_element = self.uiList[ui_name]
                # '' means no translation availdanle in that data file
                if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ):
                    # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
                    ui_element.setText(lang_data[ui_name])
                elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ):
                    # uiType: QMenu, QGroupBox
                    ui_element.setTitle(lang_data[ui_name])
                elif isinstance(ui_element, QtWidgets.QTabWidget):
                    # uiType: QTabWidget
                    tabCnt = ui_element.count()
                    tabNameList = lang_data[ui_name].split(';')
                    if len(tabNameList) == tabCnt:
                        for i in range(tabCnt):
                            if tabNameList[i] != '':
                                ui_element.setTabText(i,tabNameList[i])
                elif isinstance(ui_element, QtWidgets.QComboBox):
                    # uiType: QComboBox
                    itemCnt = ui_element.count()
                    itemNameList = lang_data[ui_name].split(';')
                    ui_element.clear()
                    ui_element.addItems(itemNameList)
                elif isinstance(ui_element, QtWidgets.QTreeWidget):
                    # uiType: QTreeWidget
                    labelCnt = ui_element.headerItem().columnCount()
                    labelList = lang_data[ui_name].split(';')
                    ui_element.setHeaderLabels(labelList)
                elif isinstance(ui_element, QtWidgets.QTableWidget):
                    # uiType: QTableWidget
                    colCnt = ui_element.columnCount()
                    headerList = lang_data[ui_name].split(';')
                    cur_table.setHorizontalHeaderLabels( headerList )
                elif isinstance(ui_element, (str, unicode) ):
                    # uiType: string for msg
                    self.uiList[ui_name] = lang_data[ui_name] 
Example 24
Project: universal_tool_template.py   Author: shiningdesign   File: GearBox_template_1010.py    License: MIT License 5 votes vote down vote up
def setLang(self, langName):
        lang_data = self.memoData['lang'][langName]
        for ui_name in lang_data.keys():
            if ui_name in self.uiList.keys() and lang_data[ui_name] != '':
                ui_element = self.uiList[ui_name]
                # '' means no translation availdanle in that data file
                if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ):
                    # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
                    ui_element.setText(lang_data[ui_name])
                elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ):
                    # uiType: QMenu, QGroupBox
                    ui_element.setTitle(lang_data[ui_name])
                elif isinstance(ui_element, QtWidgets.QTabWidget):
                    # uiType: QTabWidget
                    tabCnt = ui_element.count()
                    tabNameList = lang_data[ui_name].split(';')
                    if len(tabNameList) == tabCnt:
                        for i in range(tabCnt):
                            if tabNameList[i] != '':
                                ui_element.setTabText(i,tabNameList[i])
                elif isinstance(ui_element, QtWidgets.QComboBox):
                    # uiType: QComboBox
                    itemCnt = ui_element.count()
                    itemNameList = lang_data[ui_name].split(';')
                    ui_element.clear()
                    ui_element.addItems(itemNameList)
                elif isinstance(ui_element, QtWidgets.QTreeWidget):
                    # uiType: QTreeWidget
                    labelCnt = ui_element.headerItem().columnCount()
                    labelList = lang_data[ui_name].split(';')
                    ui_element.setHeaderLabels(labelList)
                elif isinstance(ui_element, QtWidgets.QTableWidget):
                    # uiType: QTableWidget
                    colCnt = ui_element.columnCount()
                    headerList = lang_data[ui_name].split(';')
                    cur_table.setHorizontalHeaderLabels( headerList )
                elif isinstance(ui_element, (str, unicode) ):
                    # uiType: string for msg
                    self.uiList[ui_name] = lang_data[ui_name] 
Example 25
Project: universal_tool_template.py   Author: shiningdesign   File: universal_tool_template_1115.py    License: MIT License 5 votes vote down vote up
def setLang(self, langName):
        lang_data = self.memoData['lang'][langName]
        for ui_name in lang_data.keys():
            if ui_name in self.uiList.keys() and lang_data[ui_name] != '':
                ui_element = self.uiList[ui_name]
                # '' means no translation availdanle in that data file
                if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ):
                    # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
                    ui_element.setText(lang_data[ui_name])
                elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ):
                    # uiType: QMenu, QGroupBox
                    ui_element.setTitle(lang_data[ui_name])
                elif isinstance(ui_element, QtWidgets.QTabWidget):
                    # uiType: QTabWidget
                    tabCnt = ui_element.count()
                    tabNameList = lang_data[ui_name].split(';')
                    if len(tabNameList) == tabCnt:
                        for i in range(tabCnt):
                            if tabNameList[i] != '':
                                ui_element.setTabText(i,tabNameList[i])
                elif isinstance(ui_element, QtWidgets.QComboBox):
                    # uiType: QComboBox
                    itemCnt = ui_element.count()
                    itemNameList = lang_data[ui_name].split(';')
                    ui_element.clear()
                    ui_element.addItems(itemNameList)
                elif isinstance(ui_element, QtWidgets.QTreeWidget):
                    # uiType: QTreeWidget
                    labelCnt = ui_element.headerItem().columnCount()
                    labelList = lang_data[ui_name].split(';')
                    ui_element.setHeaderLabels(labelList)
                elif isinstance(ui_element, QtWidgets.QTableWidget):
                    # uiType: QTableWidget
                    colCnt = ui_element.columnCount()
                    headerList = lang_data[ui_name].split(';')
                    cur_table.setHorizontalHeaderLabels( headerList )
                elif isinstance(ui_element, (str, unicode) ):
                    # uiType: string for msg
                    self.uiList[ui_name] = lang_data[ui_name] 
Example 26
Project: universal_tool_template.py   Author: shiningdesign   File: universal_tool_template_1100.py    License: MIT License 5 votes vote down vote up
def setLang(self, langName):
        lang_data = self.memoData['lang'][langName]
        for ui_name in lang_data.keys():
            if ui_name in self.uiList.keys() and lang_data[ui_name] != '':
                ui_element = self.uiList[ui_name]
                # '' means no translation availdanle in that data file
                if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ):
                    # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
                    ui_element.setText(lang_data[ui_name])
                elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ):
                    # uiType: QMenu, QGroupBox
                    ui_element.setTitle(lang_data[ui_name])
                elif isinstance(ui_element, QtWidgets.QTabWidget):
                    # uiType: QTabWidget
                    tabCnt = ui_element.count()
                    tabNameList = lang_data[ui_name].split(';')
                    if len(tabNameList) == tabCnt:
                        for i in range(tabCnt):
                            if tabNameList[i] != '':
                                ui_element.setTabText(i,tabNameList[i])
                elif isinstance(ui_element, QtWidgets.QComboBox):
                    # uiType: QComboBox
                    itemCnt = ui_element.count()
                    itemNameList = lang_data[ui_name].split(';')
                    ui_element.clear()
                    ui_element.addItems(itemNameList)
                elif isinstance(ui_element, QtWidgets.QTreeWidget):
                    # uiType: QTreeWidget
                    labelCnt = ui_element.headerItem().columnCount()
                    labelList = lang_data[ui_name].split(';')
                    ui_element.setHeaderLabels(labelList)
                elif isinstance(ui_element, QtWidgets.QTableWidget):
                    # uiType: QTableWidget
                    colCnt = ui_element.columnCount()
                    headerList = lang_data[ui_name].split(';')
                    cur_table.setHorizontalHeaderLabels( headerList )
                elif isinstance(ui_element, (str, unicode) ):
                    # uiType: string for msg
                    self.uiList[ui_name] = lang_data[ui_name] 
Example 27
Project: universal_tool_template.py   Author: shiningdesign   File: universal_tool_template_1110.py    License: MIT License 5 votes vote down vote up
def setLang(self, langName):
        lang_data = self.memoData['lang'][langName]
        for ui_name in lang_data.keys():
            if ui_name in self.uiList.keys() and lang_data[ui_name] != '':
                ui_element = self.uiList[ui_name]
                # '' means no translation availdanle in that data file
                if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ):
                    # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
                    ui_element.setText(lang_data[ui_name])
                elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ):
                    # uiType: QMenu, QGroupBox
                    ui_element.setTitle(lang_data[ui_name])
                elif isinstance(ui_element, QtWidgets.QTabWidget):
                    # uiType: QTabWidget
                    tabCnt = ui_element.count()
                    tabNameList = lang_data[ui_name].split(';')
                    if len(tabNameList) == tabCnt:
                        for i in range(tabCnt):
                            if tabNameList[i] != '':
                                ui_element.setTabText(i,tabNameList[i])
                elif isinstance(ui_element, QtWidgets.QComboBox):
                    # uiType: QComboBox
                    itemCnt = ui_element.count()
                    itemNameList = lang_data[ui_name].split(';')
                    ui_element.clear()
                    ui_element.addItems(itemNameList)
                elif isinstance(ui_element, QtWidgets.QTreeWidget):
                    # uiType: QTreeWidget
                    labelCnt = ui_element.headerItem().columnCount()
                    labelList = lang_data[ui_name].split(';')
                    ui_element.setHeaderLabels(labelList)
                elif isinstance(ui_element, QtWidgets.QTableWidget):
                    # uiType: QTableWidget
                    colCnt = ui_element.columnCount()
                    headerList = lang_data[ui_name].split(';')
                    cur_table.setHorizontalHeaderLabels( headerList )
                elif isinstance(ui_element, (str, unicode) ):
                    # uiType: string for msg
                    self.uiList[ui_name] = lang_data[ui_name] 
Example 28
Project: universal_tool_template.py   Author: shiningdesign   File: universal_tool_template_1010.py    License: MIT License 5 votes vote down vote up
def setLang(self, langName):
        lang_data = self.memoData['lang'][langName]
        for ui_name in lang_data.keys():
            if ui_name in self.uiList.keys() and lang_data[ui_name] != '':
                ui_element = self.uiList[ui_name]
                # '' means no translation availdanle in that data file
                if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ):
                    # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
                    ui_element.setText(lang_data[ui_name])
                elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ):
                    # uiType: QMenu, QGroupBox
                    ui_element.setTitle(lang_data[ui_name])
                elif isinstance(ui_element, QtWidgets.QTabWidget):
                    # uiType: QTabWidget
                    tabCnt = ui_element.count()
                    tabNameList = lang_data[ui_name].split(';')
                    if len(tabNameList) == tabCnt:
                        for i in range(tabCnt):
                            if tabNameList[i] != '':
                                ui_element.setTabText(i,tabNameList[i])
                elif isinstance(ui_element, QtWidgets.QComboBox):
                    # uiType: QComboBox
                    itemCnt = ui_element.count()
                    itemNameList = lang_data[ui_name].split(';')
                    ui_element.clear()
                    ui_element.addItems(itemNameList)
                elif isinstance(ui_element, QtWidgets.QTreeWidget):
                    # uiType: QTreeWidget
                    labelCnt = ui_element.headerItem().columnCount()
                    labelList = lang_data[ui_name].split(';')
                    ui_element.setHeaderLabels(labelList)
                elif isinstance(ui_element, QtWidgets.QTableWidget):
                    # uiType: QTableWidget
                    colCnt = ui_element.columnCount()
                    headerList = lang_data[ui_name].split(';')
                    cur_table.setHorizontalHeaderLabels( headerList )
                elif isinstance(ui_element, (str, unicode) ):
                    # uiType: string for msg
                    self.uiList[ui_name] = lang_data[ui_name] 
Example 29
Project: guppy-proxy   Author: roglew   File: hexteditor.py    License: MIT License 5 votes vote down vote up
def __init__(self):
        QWidget.__init__(self)
        self.setLayout(QVBoxLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)
        self.layout().setSpacing(0)

        self.data = bytearray()
        self.datatable = QTableWidget()
        self.datatable.cellChanged.connect(self._cell_changed)
        self.datatable.horizontalHeader().setStretchLastSection(True)
        self.row_size = 16
        self.read_only = False
        self.redraw_table()
        self.layout().addWidget(self.datatable) 
Example 30
Project: hase   Author: hase-project   File: viewtable.py    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
def __init__(self, parent: QTableWidget = None) -> None:
        super(RegTableWidget, self).__init__(parent)
        # self.setSizeAdjustPolicy(QAbstractScrollArea.AdjustToContents)