def handleSelectionChange(self):
        self.choose = self.ui.admin.currentText()
        if self.choose == '':
            return
        total = self.adminDic[self.choose]["Total"]
        self.ui.queue.setRowCount(total)
        Activate = self.adminDic[self.choose]["Activate"]
        isActivate = QTableWidgetItem()
        isActivate.setText(Activate)
        self.ui.detail.setItem(0, 1, isActivate)

        n = len(self.adminDic[self.choose]["Usr"])
        number = QTableWidgetItem()
        number.setText(str(n))
        self.ui.detail.setItem(0, 2, number)

        n = total - n
        number = QTableWidgetItem()
        number.setText(str(n))
        self.ui.detail.setItem(0, 3, number)

        number = QTableWidgetItem()
        number.setText(str(n))
        self.ui.detail.setItem(0, 4, number)

        i = 0
        self.ui.queue.clear()
        for each in self.adminDic[self.choose]["Usr"]:
            item = QTableWidgetItem()
            item.setText(each)
            self.ui.queue.setItem(i, 0, item)
            i += 1
Exemplo n.º 2
0
 def change_table(self):
     self.ui.tableWidget.setRowCount(len(self.students))
     for i in range(len(self.students)):
         for j in range(4):
             item = QTableWidgetItem()
             item.setText(str(self.students[i][j]))
             self.ui.tableWidget.setItem(i, j, item)
Exemplo n.º 3
0
 def set_segment_text(self, row, col, txt):
     with self.segments_edit_semaphore:
         item = self.table_segments.item(row, col)
         if item is None:
             item = QTableWidgetItem()
             self.table_segments.setItem(row, col, item)
         item.setText(str(txt))
 def __createListItem(self, name, lightType):
     item = QTableWidgetItem()
     item.setText(name)
     itemIcon = QTWI.QTableWidgetIcon(path='%s.svg' % lightType)
     statusIcon = QTWI.QTableWidgetIcon(renderer=self.iconRenderer,
                                        rendered=True)
     return itemIcon, item, statusIcon
Exemplo n.º 5
0
 def change_table_fee(self):
     self.fees = 0
     termstart = self.ui.spinBox.value()
     termend = self.ui.spinBox_2.value()
     self.sql = "select course_id,course_name,credit,tuition,term_start,term_end from s_c natural join course where stu_id = " + username + " and term_start>= " + str(
         termstart) + " and term_end <= " + str(termend)
     cursor.execute(self.sql)
     self.fee = cursor.fetchall()
     self.term_count = []
     self.ui.tableWidget_3.setRowCount(len(self.fee))
     for i in range(len(self.fee)):
         self.term_count.append(self.fee[i][4])
         self.term_count.append(self.fee[i][5])
         for j in range(4):
             if j == 3:
                 self.fees += self.fee[i][j]
             item = QTableWidgetItem()
             item.setText(str(self.fee[i][j]))
             self.ui.tableWidget_3.setItem(i, j, item)
     self.sql = "select major_fee from major where major_id =  " + str(
         self.information[5])[0:4]
     cursor.execute(self.sql)
     self.major_fee = cursor.fetchone()
     self.ui.label_5.setText(str(self.major_fee[0]))
     self.year = 1
     if len(self.term_count) != 0:
         self.year = max(self.term_count) - min(self.term_count)
     self.ui.label_3.setText(
         str(self.major_fee[0] * 2 * self.year + self.fees))
Exemplo n.º 6
0
 def addline(self):
     line = [
         addDialog.ui.a.value(),
         addDialog.ui.b.value(),
         addDialog.ui.c.value()
     ]
     row = self.ui.table.rowCount()
     self.ui.table.insertRow(row)
     for i in range(3):
         item = QTableWidgetItem()
         item.setText(f'{line[i]}')
         self.ui.table.setItem(row, i, item)
     addDialog.close()
     if self.hasLP is False:
         return
     else:
         self.p, ans = self.LP.add(line)
         if self.p is not None:
             self.ui.print.appendPlainText(
                 '目标点:({:.3f},{:.3f})\n'
                 '函数值:[{:.3f}]\n'
                 '---------------------------'.format(
                     self.p[0], self.p[1], ans))
             self.plot()
         else:
             self.ui.print.appendPlainText('无解!\n'
                                           '---------------------------')
             QMessageBox.warning(self.ui.add, '无解', '约束范围内无解!')
Exemplo n.º 7
0
    def update_pubs(self):
        self.pubs_table.setRowCount(
            len(self.tags_metadata[self.selected_tag_index]['papers']))

        i = 0
        for paper in self.tags_metadata[self.selected_tag_index]['papers']:
            item1 = QTableWidgetItem()
            self.pubs_table.setItem(i, 0, item1)
            item1.setText(paper['title'])
            item1.setFlags(Qt.ItemIsEnabled)

            item2 = QTableWidgetItem()
            self.pubs_table.setItem(i, 1, item2)
            item2.setText(PapersWindow.getAuthorString(paper['authors']))
            item2.setFlags(Qt.ItemIsEnabled)

            item3 = QTableWidgetItem()
            self.pubs_table.setItem(i, 2, item3)
            if 'tags' in paper:
                item3.setText(PapersWindow.getTagsString(paper['tags']))
            else:
                item3.setText('')
            item3.setFlags(Qt.ItemIsEnabled)

            item4 = QTableWidgetItem()
            self.pubs_table.setItem(i, 3, item4)
            item4.setText(str(paper['year']))
            item4.setFlags(Qt.ItemIsEnabled)

            i += 1
Exemplo n.º 8
0
    def update_row(self, row_index, key, value):
        """
        Updates a table row by index, with key and value.

        :param row_index: Index of the row to be updated
        :param key: Key for that row
        :param value: Value for that row
        :return: None
        """

        # Disconnecting cellChanged event so we don't get a feedback loop
        self.table.cellChanged.disconnect()

        for column_index, cell_text in enumerate([key, value]):
            item = QTableWidgetItem()
            item.setText(str(cell_text))

            if column_index != 1:
                # noinspection PyUnresolvedReferences
                item.setFlags(Qt.ItemIsEnabled)

            self.table.setItem(row_index, column_index, item)

        # Connecting the cellChanged event again
        self.table.cellChanged.connect(self.handle_cell_change)

        self.table.resizeColumnsToContents()
Exemplo n.º 9
0
    def refreshTable(self):
        global database
        self.cuentas = database.getAllAccounts()
        self.tabla_cuentas.clearContents()

        row = 0
        for entry in self.cuentas:
            self.tabla_cuentas.setRowCount(row + 1)

            item = QTableWidgetItem(entry[1])
            item.setTextAlignment(4)

            self.tabla_cuentas.setItem(row, 0, QTableWidgetItem(item))
            item.setText(entry[2])
            self.tabla_cuentas.setItem(row, 1, QTableWidgetItem(item))
            item.setText(entry[3])
            self.tabla_cuentas.setItem(row, 2, QTableWidgetItem(item))
            item.setText(len(entry[4]) * str("*"))
            self.tabla_cuentas.setItem(row, 3, QTableWidgetItem(item))
            item.setText(entry[5])
            self.tabla_cuentas.setItem(row, 4, QTableWidgetItem(item))
            item.setText(str(entry[0]))
            self.tabla_cuentas.setItem(row, 5, QTableWidgetItem(item))

            row += 1
    def __init__(self, nf_settings_path):
        super(batch_file_viewer, self).__init__(parent=None)
        self.nf_settings_parser = custom_config_parser()
        self.nf_settings_parser.load(nf_settings_path)
        self.setRowCount(20)
        self.setColumnCount(2)
        # Fill all places so there are no "None" types in the table
        for row in range(self.rowCount()):
            for column in range(self.columnCount()):
                item = QTableWidgetItem()
                item.setText('')
                self.setItem(row, column, item)

        self.original_background = item.background()
        self.clipboard = QGuiApplication.clipboard()

        self.cellChanged.connect(
            self.check_cell)  # Needs to be after "filling for loop" above
        self.header = self.horizontalHeader()
        self.header.setSectionResizeMode(0, QHeaderView.Stretch)
        self.setHorizontalHeaderLabels(["MS files", "Label"])
        self.header.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.header.customContextMenuRequested.connect(self.right_click_menu)
        self.saved_text = ''
        self.store_re_text = ''
Exemplo n.º 11
0
def reporte_generar(self):
    self.ui.total_registros.setText("")
    if self.ui.combo_reporte_municipio.currentIndex() == 0:
        pass
    elif (self.ui.combo_reporte_municipio.currentIndex() !=
          0) and (self.ui.combo_reporte_candidato.currentIndex() == 0):
        self.ui.tabla_reportes.clearContents()
        self.ui.tabla_reportes.setRowCount(0)
        mun = self.ui.combo_reporte_municipio.currentText()
        resultado = Query_reporte.reporte_id_municipio(mun)
        resultado_2 = Query_reporte.busqueda_solo_municipio(resultado[0][0])
        self.ui.tabla_reportes.setRowCount(len(resultado_2))
        for filas in range(len(resultado_2)):
            for columnas in range(10):
                if columnas <= 7:
                    item = QTableWidgetItem()
                    item.setText(str(resultado_2[filas][columnas + 1]))
                    self.ui.tabla_reportes.setItem(filas, columnas, item)
                else:
                    f = QPixmap()
                    f.loadFromData(resultado_2[filas][columnas + 1])
                    label = QLabel()
                    label.setPixmap(f)
                    label.setScaledContents(True)
                    label.setMaximumHeight(50)
                    label.setMaximumWidth(100)
                    self.ui.tabla_reportes.setCellWidget(
                        filas, columnas, label)

    elif (self.ui.combo_reporte_municipio.currentIndex() !=
          0) and (self.ui.combo_reporte_candidato.currentIndex() != 0):
        self.ui.tabla_reportes.clearContents()
        self.ui.tabla_reportes.setRowCount(0)
        mun = self.ui.combo_reporte_municipio.currentText()
        col = self.ui.combo_reporte_candidato.currentText()
        resultado_mun = Query_reporte.reporte_id_municipio(mun)
        resultado_col = Query_reporte.reporte_id_candidato(col)
        resultado = Query_reporte.busqueda_municipio_candidato(
            resultado_mun[0][0], resultado_col[0][0])
        self.ui.tabla_reportes.setRowCount(len(resultado))
        for filas in range(len(resultado)):
            for columnas in range(10):
                if columnas <= 7:
                    item = QTableWidgetItem()
                    item.setText(str(resultado[filas][columnas + 1]))
                    self.ui.tabla_reportes.setItem(filas, columnas, item)
                else:
                    label = QLabel()
                    f = QPixmap()
                    f.loadFromData(resultado[filas][columnas + 1])
                    label.setPixmap(f)
                    label.setScaledContents(True)
                    label.setMaximumHeight(50)
                    label.setMaximumWidth(100)
                    self.ui.tabla_reportes.setCellWidget(
                        filas, columnas, label)

    filas_mostradas = self.ui.tabla_reportes.rowCount()
    self.ui.total_registros.setText(str(filas_mostradas))
 def initadminInfo(self):
     self.ui.adminInfo.setRowCount(0)
     admin = self.admin
     for each in admin:
         self.ui.adminInfo.insertRow(0)
         item = QTableWidgetItem()
         item.setText(each)
         self.ui.adminInfo.setItem(0, 0, item)
 def addRow_with_items(self):
     item = QTableWidgetItem()
     item.setText('')
     self.setRowCount(self.rowCount() + 1)
     self.setItem(self.rowCount() - 1, 0, item)    # Note: new rowcount here
     label = QTableWidgetItem()
     label.setText('')
     self.setItem(self.rowCount() - 1, 1, label)
Exemplo n.º 14
0
 def update_row(self, row_number, node_name, key, new_value):
     for column_index, cell_text in enumerate([node_name, key, new_value]):
         item = QTableWidgetItem()
         item.setText(cell_text)
         if column_index != 2:
             item.setFlags(Qt.ItemIsEnabled)
         self.cellChanged.disconnect()
         self.setItem(row_number, column_index, item)
         self.cellChanged.connect(self.handle_cell_change)
     self.resizeColumnsToContents()
Exemplo n.º 15
0
 def change_table_score(self):
     self.sql = "select term_start,course_id,course_name,t_name,credit,score from s_c natural join course natural join teacher natural join t_c where stu_id = " + username
     cursor.execute(self.sql)
     self.scores = cursor.fetchall()
     self.ui.tableWidget_2.setRowCount(len(self.scores))
     for i in range(len(self.scores)):
         for j in range(6):
             item = QTableWidgetItem()
             item.setText(str(self.scores[i][j]))
             self.ui.tableWidget_2.setItem(i, j, item)
Exemplo n.º 16
0
    def loadStudyData(self):
        """
        Function for loading data from our database and
        into the application

        Parameters
        ----------
        database : [SQL Lite Object]
            Database object that we connect to it
            through the db_model

        Return
        ----------
        None
        """
        # initialize ui
        ui = self.ui
        helper = self.helper
        tasks = helper.select_from_db(
            """SELECT task_name, study_time, notes FROM to_do_tasks""")

        for row_number, task in enumerate(tasks):
            # insert rows into the application for as
            # many tasks as we have
            ui.studyWidget.insertRow(row_number)

            # loop through the task to get the amount of columns
            # since we have rows and columns we insert data
            # piece by piece
            for column_number, data in enumerate(task):
                # store the data the appropriate object
                # numerics don't get viewed properly in tablewidget items
                cell = QTableWidgetItem()
                cell.setText(data)
                cell.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)

                # disable functionality for all cells except the notes cell
                # and also edit the alignment for the notes
                if column_number == 2:
                    cell.setTextAlignment(Qt.AlignLeft | Qt.AlignTop)
                else:
                    # disable options
                    cell.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)

                # add the data into the cell
                ui.studyWidget.setItem(row_number, column_number, cell)

                # Load finished task functionality into the table
                finishedTask = QPushButton('Finished Task')
                finishedTask.clicked.connect(self.levelMessageBox)
                ui.studyWidget.setCellWidget(
                    row_number, 3, finishedTask)\
Exemplo n.º 17
0
 def setDefault(self, default=None):
     if default != None:
         # create a 2 column table
         keys = list(default.keys())
         keys_count = len(keys)
         self.setRowCount(keys_count)
         self.setColumnCount(2)
         for i in range(keys_count):
             k, v = QTableWidgetItem(), QTableWidgetItem()
             k.setText(str(keys[i]))
             v.setText(str(default[keys[i]]))
             self.setItem(i, 0, k)
             self.setItem(i, 1, v)
Exemplo n.º 18
0
 def update_table_item(self, row, timelog_info):
     column = -1
     for timelog in timelog_info:
         column += 1
         item = QTableWidgetItem()
         item.setFlags(item.flags() & ~QtCore.Qt.ItemIsEditable)
         if column == 2:
             timelog += " hour"
         item.setText(timelog)
         if not column == 3:
             item.setTextAlignment(QtCore.Qt.AlignRight
                                   | QtCore.Qt.AlignVCenter)
         self.tableWidgetTimelog.setItem(row, column, item)
Exemplo n.º 19
0
def obtener_municipio(self):
    resultado_municipio = Query_municipio.obtener_municipio_bd()
    if resultado_municipio == []:
        QMessageBox.about(self, "INFORMACION",
                          "Aun no has ingresado ningun municipio")
    elif resultado_municipio != []:
        self.ui.lista_municipio.clear()
        self.ui.lista_municipio.setRowCount(len(resultado_municipio))
        self.ui.lista_municipio.setColumnCount(1)
        for filas in range(len(resultado_municipio)):
            item = QTableWidgetItem()
            item.setText(resultado_municipio[filas][0])
            self.ui.lista_municipio.setItem(filas, 0, item)
Exemplo n.º 20
0
    def set_item_slot(self, tick: dict):
        local_symbol = tick['local_symbol']
        if local_symbol not in self.cur_ticks:
            return
        if local_symbol not in self.cur_row_map:  # 不在table ,插入row
            self.cur_row_map.append(local_symbol)
            self.tableWidget.insertRow(self.item_row)
            self.insert_(self.item_row, tick)
            self.item_row += 1

        else:  # 已在table中 ,更新对应row
            row = self.cur_row_map.index(local_symbol)
            for i, col in enumerate(market_table_column):
                try:
                    if col == "last_price":  # 对最新价动态颜色表示涨跌
                        old = self.tableWidget.item(row, i)
                        if old:  # 非空
                            old = float(old.text())
                            new = float(tick[col])
                            difference = new - old
                            item = QTableWidgetItem(str(new))
                            if difference > 0:  # 涨
                                item.setTextColor(QColor('red'))
                            elif difference < 0:  # 跌
                                item.setTextColor(QColor('green'))
                            else:
                                continue
                        else:  # None
                            item = QTableWidgetItem(str(tick[col]))
                    elif col == "inc_day_interest":
                        data = tick['open_interest'] - tick['pre_open_interest']
                        item = QTableWidgetItem(str(data))
                        # item.setTextColor()
                    # elif col == "inc_now_interest": # 现增仓
                    #     item = ''
                    elif col == "limit":  # 涨跌
                        data = tick['last_price'] - tick['pre_close']
                        item = QTableWidgetItem(str(data))
                    elif col == "limit1":  # 涨幅
                        data = (tick['last_price'] -
                                tick['pre_close'] / tick['pre_close']) * 0.01
                        item = QTableWidgetItem(str(data))
                    else:
                        item = QTableWidgetItem(str(tick.get(col, "---")))
                except (ValueError, ZeroDivisionError) as e:
                    item = QTableWidgetItem(str(tick.get(col, "---")))
                if item.text().isdigit():
                    item.setText("%0.2f" % float(item.text()))
                if col in yellow:
                    item.setTextColor(QColor(199, 199, 9))
                self.tableWidget.setItem(row, i, item)
    def on_job_done(self, done_processes):
        self.clear()
        self.fix_header()
        # If more jobs than rows
        if len(self.jobs) >= self.rowCount():
            self.setRowCount(len(self.jobs))
            for row in range(self.rowCount()):
                for column in range(self.columnCount()):
                    item = QTableWidgetItem()
                    item.setText('')
                    self.setItem(row, column, item)  # Note: new rowcount here

        jobs_check_rows = []
        row = 0
        for job in self.jobs:
            if job in self.jobs_check:
                jobs_check_rows.append(row)
            job = [i.replace('\n', '') for i in job]
            for column in range(self.columnCount() - 1):
                item = self.item(row, column)
                if len(job) - 1 >= column:
                    if job[column] == 'COMPLETED':
                        item.setForeground(QColor(0, 255, 150))
                    elif job[column] in self.options:
                        item.setForeground(QColor(255, 0, 0))
                    else:
                        pass
                    item.setText(job[column])
            row += 1

        for job, out, row in zip(self.jobs_check, done_processes,
                                 jobs_check_rows):
            out = out.split('\t')
            second_last_item = self.item(row, self.columnCount() - 2)
            last_item = self.item(row, self.columnCount() - 1)
            if any("run_quandenser.sh" in line for line in out):
                second_last_item.setForeground(QColor('red'))
                second_last_item.setText("RUNNING")
            else:
                # Check stdout file
                label = check_stdout(job[1] + '/' + 'stdout.txt')
                if label == 'COMPLETED':
                    second_last_item.setForeground(QColor(0, 255, 150))
                else:
                    second_last_item.setForeground(QColor(255, 0, 0))
                second_last_item.setText(label)
                self.update_job_file(job, label)
            if second_last_item.text() == "RUNNING":
                button = kill_button(job[0], self.jobs_path,
                                     job)  # job[0] = pid
                self.setCellWidget(row, self.columnCount() - 1, button)
 def searchbaobiao(self):
     try:
         conn = pymysql.connect(host="192.168.61.159",
                                user="******",
                                password="******",
                                database="shoulou",
                                charset="UTF8")
     except:
         print("error")
         conn.close()
         sys.exit()
     cur2 = conn.cursor()
     cur1 = conn.cursor()
     cur = conn.cursor()
     selectSQL = 'select yonghu from loupan'
     print(selectSQL)
     cur.execute(selectSQL)
     selectSQL1 = 'select loupanid from loupan'
     print(selectSQL1)
     cur1.execute(selectSQL1)
     selectSQL2 = 'select hetongid from hetong'
     print(selectSQL2)
     cur2.execute(selectSQL2)
     cur3 = conn.cursor()
     selectSQL3 = 'select shoukuanid from shoukuan'
     print(selectSQL3)
     cur3.execute(selectSQL2)
     method = self.ui.tableWidget_5.rowCount()
     print(method)
     method = int(method)
     for i in range(method):
         self.ui.tableWidget_5.removeRow(0)
     for row in cur.fetchall():
         i = 0
         print(row)
         self.ui.tableWidget_6.insertRow(0)
         item = QTableWidgetItem()
         item.setText(str(row[0]))
         self.ui.tableWidget_6.setItem(i, 0, item)
     for row in cur1.fetchall():
         i = 0
         print(row)
         self.ui.tableWidget_6.insertRow(0)
         item = QTableWidgetItem()
         item.setText(str(row[0]))
         self.ui.tableWidget_6.setItem(i, 1, item)
     for row in cur2.fetchall():
         i = 0
         print(row)
         self.ui.tableWidget_6.insertRow(0)
         item = QTableWidgetItem()
         item.setText(str(row[0]))
         self.ui.tableWidget_6.setItem(i, 2, item)
     for row in cur3.fetchall():
         i = 0
         print(row)
         self.ui.tableWidget_6.insertRow(0)
         item = QTableWidgetItem()
         item.setText(str(row[0]))
         self.ui.tableWidget_6.setItem(i, 3, item)
Exemplo n.º 23
0
    def change_table_x(self):
        self.sql = "select course_id,course_name,t_name,credit,time from course natural join t_c natural join teacher where course_type = '选修'"
        cursor.execute(self.sql)
        self.xlessons = cursor.fetchall()
        self.ui.tableWidget_5.setRowCount(len(self.xlessons))
        for i in range(len(self.xlessons)):
            for j in range(5):
                item = QTableWidgetItem()
                item.setText(str(self.xlessons[i][j]))
                self.ui.tableWidget_5.setItem(i, j, item)

        self.ui.comboBox_2.clear()
        for lesson in self.xlessons:
            self.ui.comboBox_2.addItem(str(lesson[0]))
Exemplo n.º 24
0
    def update_authors(self):
        i = 0
        for author in self.authors:
            item1 = QTableWidgetItem()
            self.author_table.setItem(i, 0, item1)
            item1.setText(author['name'])
            item1.setFlags(Qt.ItemIsEnabled)

            item2 = QTableWidgetItem()
            self.author_table.setItem(i, 1, item2)
            item2.setText(str(author['pubs']))
            item2.setFlags(Qt.ItemIsEnabled)

            i += 1
Exemplo n.º 25
0
    def setHorizontalHeaderItems(self, type):
        """
        Sets the horizontal header items.
        """
        parameter = self.headerItemDefaultParameter(type)

        for column in range(0, self.columnCount()):

            number = column

            item = QTableWidgetItem()
            item.setTextAlignment(Qt.AlignCenter)
            item.setText(self.headerItemText(number, type, parameter))

            self.setHorizontalHeaderItem(column, item)
Exemplo n.º 26
0
    def update_tags(self):
        i = 0
        self.tags_table.setRowCount(len(self.tags_metadata))
        for tag in self.tags_metadata:
            item1 = QTableWidgetItem()
            self.tags_table.setItem(i, 0, item1)
            item1.setText(tag['name'])
            item1.setFlags(Qt.ItemIsEnabled)

            item2 = QTableWidgetItem()
            self.tags_table.setItem(i, 1, item2)
            item2.setText(str(len(tag['papers'])))
            item2.setFlags(Qt.ItemIsEnabled)

            i += 1
Exemplo n.º 27
0
    def setVerticalHeaderItems(self, type):
        """
        Sets the vertical header items.
        """
        parameter = self.headerItemDefaultParameter(type)

        for row in range(0, self.rowCount()):

            number = row

            item = QTableWidgetItem()
            item.setTextAlignment(Qt.AlignCenter)
            item.setText(self.headerItemText(number, type, parameter))

            self.setVerticalHeaderItem(row, item)
 def add_action(self, action_name):
     row = self.actionTableWidget.rowCount()
     self.actionTableWidget.insertRow(row)
     item = QTableWidgetItem()
     item.setText(str(action_name))
     item.setData(Qt.UserRole, None)
     self.actionTableWidget.setItem(row, 0, item)
     #add button
     self.actionTableWidget.setItem(row, 1, QTableWidgetItem())
     button = QPushButton()
     button.setText("Add Constraint")
     self.actionTableWidget.setCellWidget(row, 1, button)
     func = partial(self.set_constraint_in_row, row)
     button.clicked.connect(func)
     return item
Exemplo n.º 29
0
    def createRow(self, pos, key, val, pin):
        newKeyItem = QTableWidgetItem()
        newKeyItem.setText(key)
        newValItem = QTableWidgetItem()
        newValItem.setText(val)

        color = PySide2.QtGui.QColor(200, 220, 200)
        if bool(pin):
            # newKeyItem.setIcon(QIcon.fromTheme('emblem-important'));
            newKeyItem.setIcon(IconFactory.getIcon('push_pin'))
            newKeyItem.setBackground(color)
            newValItem.setBackground(color)
        self.insertRow(pos)
        self.setItem(pos, 0, newKeyItem)
        self.setItem(pos, 1, newValItem)
Exemplo n.º 30
0
    def show_query_resluts(self, header: list, rows: list) -> None:
        self.wrapped_table.setColumnCount(len(header))
        self.wrapped_table.setRowCount(len(rows))

        for i, c_name in enumerate(header):
            self.wrapped_table.setHorizontalHeaderItem(
                i, QTableWidgetItem(c_name))

        for i, row in enumerate(rows):
            for j, value in enumerate(row):
                item = QTableWidgetItem()
                item.setData(0, value)
                if item.text() == "":
                    item.setText(str(
                        value))  # use str representation for unsupported types
                self.wrapped_table.setItem(i, j, item)