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


Python QTableWidgetItem.setFlags方法代码示例

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


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

示例1: add_link

# 需要导入模块: from PySide.QtGui import QTableWidgetItem [as 别名]
# 或者: from PySide.QtGui.QTableWidgetItem import setFlags [as 别名]
    def add_link( self, url ):

        """
            Adds a link to the link widget.

            Only adds if its not already present.
        """

        if url not in self.links:

            self.links.add( url )


            rowCounts = self.links_ui.rowCount()
            nextRow = rowCounts + 1
            nextPosition = rowCounts    # row count is the length, but position is zero-based

            self.links_ui.setRowCount( nextRow )

            urlEntry = QTableWidgetItem( url )
            statusEntry = QTableWidgetItem( '' )

            statusEntry.setTextAlignment( Qt.AlignCenter )

            urlEntry.setFlags( urlEntry.flags() & ~Qt.ItemIsEditable ) # not editable
            statusEntry.setFlags( statusEntry.flags() & ~Qt.ItemIsEditable ) # not editable

            self.links_ui.setItem( nextPosition, 0, urlEntry )
            self.links_ui.setItem( nextPosition, 1, statusEntry )


                # check if online
            stream = Stream( url.split() )

            stream.is_online( statusEntry )
开发者ID:ckorn,项目名称:livestreamer-ui,代码行数:37,代码来源:main.py

示例2: set_abbreviations

# 需要导入模块: from PySide.QtGui import QTableWidgetItem [as 别名]
# 或者: from PySide.QtGui.QTableWidgetItem import setFlags [as 别名]
    def set_abbreviations(self, empire):
        """ Clears the abbreviations table, then adds the abbreviations for the current 
        empire to it.

        Arguments:
            empire (lacuna.empire.MyEmpire): The empire whose abbreviations we'll show.
        """
        self.init_for_data()
        self.widget.setSortingEnabled(False)
        row = 0
        for n in sorted(empire.planet_names):
            self.num_planets += 1
            itm_name = QTableWidgetItem(n)
            try:
                itm_abbrv = QTableWidgetItem(self.parent.app.abbrv.get_abbrv(n))
            except KeyError as e:
                itm_abbrv = QTableWidgetItem("<None>")
            fl = itm_name.flags()
            fl &= ~Qt.ItemIsEditable
            itm_name.setFlags(fl)
            self.widget.insertRow(row)
            self.widget.setItem(row, 0, itm_name)
            self.widget.setItem(row, 1, itm_abbrv)
            row += 1
        self.widget.setSortingEnabled(True)
        self.widget.itemChanged.connect(self.update)
        self.resize(True)
开发者ID:PGMacDesign,项目名称:MontyLacuna,代码行数:29,代码来源:abbreviations_table.py

示例3: _showMostReferenced

# 需要导入模块: from PySide.QtGui import QTableWidgetItem [as 别名]
# 或者: from PySide.QtGui.QTableWidgetItem import setFlags [as 别名]
    def _showMostReferenced(self):
        """
        Shows the most referenced functions.
        """
        self._console_output("Calculating most referenced functions...")
        self.table_label.setText("Most referenced functions")

        most_referenced = self.ba.most_referenced_functions()

        self.table.setColumnCount(3)
        self.table.setHorizontalHeaderLabels(("Address", "References", "Name"))
        self.table.clearContents()
        self.table.setRowCount(0)

        idx = 0

        # Fill with contents
        for f_ea, (ref_nr, ref_name) in most_referenced:

            self.table.insertRow(idx)
            addr_item = QTableWidgetItem("%x" % f_ea)
            addr_item.setFlags(addr_item.flags() ^ QtCore.Qt.ItemIsEditable)
            ref_item =  cw.NumQTableWidgetItem("%d" % ref_nr)
            name_item = QTableWidgetItem(ref_name)

            self.table.setItem(idx, 0, addr_item)
            self.table.setItem(idx, 1, ref_item)
            self.table.setItem(idx, 2, name_item)

            idx += 1
开发者ID:h0wl,项目名称:JARVIS,代码行数:32,代码来源:BinaryAnalysisWidget.py

示例4: coloredTableWidgetItem

# 需要导入模块: from PySide.QtGui import QTableWidgetItem [as 别名]
# 或者: from PySide.QtGui.QTableWidgetItem import setFlags [as 别名]
 def coloredTableWidgetItem(self, text, color, userData=None):
     item = QTableWidgetItem(text)
     item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)
     item.setForeground(color)
     if userData:
         item.setData(Qt.UserRole, userData)
     return item
开发者ID:elricbk,项目名称:pyenvelopes,代码行数:9,代码来源:MainForm.py

示例5: _markImmCompares

# 需要导入模块: from PySide.QtGui import QTableWidgetItem [as 别名]
# 或者: from PySide.QtGui.QTableWidgetItem import setFlags [as 别名]
    def _markImmCompares(self):
        """
        Marks the immediate compares within the current function
        """
        self.output_window.append("Marking all immediate compares...")
        self.table_label.setText("Immediate compares within current function")

        INS_COLOR = 0x2020c0

        self.table.setColumnCount(2)
        self.table.setHorizontalHeaderLabels(("Address", "Disassembly"))
        self.table.clearContents()
        self.table.setRowCount(0)

        idx = 0
        for cmp_ea, dis in self.ba.find_imm_compares():

            self.table.insertRow(idx)

            addr_item = QTableWidgetItem("%x" % cmp_ea)
            addr_item.setFlags(addr_item.flags() ^ QtCore.Qt.ItemIsEditable)
            dis_item =  cw.NumQTableWidgetItem("%s" % dis)

            self.table.setItem(idx, 0, addr_item)
            self.table.setItem(idx, 1, dis_item)

            misc.set_ins_color(cmp_ea, INS_COLOR)
            idx += 1
开发者ID:h0wl,项目名称:JARVIS,代码行数:30,代码来源:BinaryAnalysisWidget.py

示例6: readTableFromList

# 需要导入模块: from PySide.QtGui import QTableWidgetItem [as 别名]
# 或者: from PySide.QtGui.QTableWidgetItem import setFlags [as 别名]
    def readTableFromList(self, mytable, mylist):
        """
        mylist contains triples of (name, value, modifyable)
        """
        mytable.clear()
        mytable.setRowCount(0)
        for (ind, (name, string_value, modifyable, var_type)) in enumerate(
                sorted(mylist, key=lambda x: x[0])):
            # sort list to get a reproducible table
            mytable.insertRow(ind)
            mytable.setItem(ind, 0, QTableWidgetItem(name))
            value_item = QTableWidgetItem(string_value)
            if not modifyable:
                value_item.setFlags(value_item.flags() & Qt.ItemIsEditable)
            mytable.setItem(ind, 1, value_item)
            type_item = QTableWidgetItem(str(var_type))
            type_item.setFlags(type_item.flags() & Qt.ItemIsEditable)

            mytable.setItem(ind, 2, type_item)

        header = mytable.horizontalHeader()

        try:
            # this is Qt4
            header.setResizeMode(0, QHeaderView.ResizeToContents)
            header.setResizeMode(1, QHeaderView.Stretch)
        except AttributeError:
            # this is Qt5
            header.setSectionResizeMode(0, QHeaderView.ResizeToContents)
            header.setSectionResizeMode(1, QHeaderView.Stretch)
开发者ID:joha2,项目名称:pyrate,代码行数:32,代码来源:TaskPanel_ClassWithOptimizableVariables_Edit.py

示例7: append

# 需要导入模块: from PySide.QtGui import QTableWidgetItem [as 别名]
# 或者: from PySide.QtGui.QTableWidgetItem import setFlags [as 别名]
 def append(self, l):
     r = self.rowCount()
     self.insertRow(r)
     for i, x in enumerate(l):
         item = QTableWidgetItem("%s" % x)
         item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)
         self.setItem(r, i, item)
开发者ID:team-soran,项目名称:noisy,代码行数:9,代码来源:widget.py

示例8: _patchBinary

# 需要导入模块: from PySide.QtGui import QTableWidgetItem [as 别名]
# 或者: from PySide.QtGui.QTableWidgetItem import setFlags [as 别名]
    def _patchBinary(self):
        """
        Exports the current function code, ascii hex encoded
        This is useful to import into tools like miasm and alike
        """
        self._console_output("Patching the original binary...")
        pl = patch_binary()

        if not pl:
            self._console_output("[!] No bytes to patch", err = True)
            return

        self.table.setColumnCount(3)
        self.table.setHorizontalHeaderLabels(('File offset', 'Original', 'Patched'))
        self.table_label.setText("Patched bytes exported to file")
        self.table.clearContents()
        self.table.setRowCount(0)

        # Fill with contents
        for idx, (fpos, o, p) in enumerate(pl):

            self.table.insertRow(idx)
            fpos_item = QTableWidgetItem("%x" % fpos)
            fpos_item.setFlags(fpos_item.flags() ^ QtCore.Qt.ItemIsEditable)
            orig_item = QTableWidgetItem("%x" % o)
            patch_item = QTableWidgetItem("%x" % p)

            self.table.setItem(idx, 0, fpos_item)
            self.table.setItem(idx, 1, orig_item)
            self.table.setItem(idx, 2, patch_item)

        self._console_output("Done patching. Look in the same directory as the original for a .patched file")
开发者ID:pombredanne,项目名称:JARVIS-1,代码行数:34,代码来源:ImportExportWidget.py

示例9: _showConnectedIO

# 需要导入模块: from PySide.QtGui import QTableWidgetItem [as 别名]
# 或者: from PySide.QtGui.QTableWidgetItem import setFlags [as 别名]
    def _showConnectedIO(self):
        """
        Shows a list of functions dealing with IO and
        connected to the current function
        """
        self._console_output("Calculating file & network IO...")
        io_list = self.ba.input_to_function()

        if not io_list:
            self._console_output("[!] No (obvious) IO connecting to this function", err = True)
            return

        self.table.setColumnCount(2)
        self.table.setHorizontalHeaderLabels(("Caller", "Name"))

        self.table_label.setText("Connected IO")
        self.table.clearContents()
        self.table.setRowCount(0)

        for idx, caller in enumerate(io_list):
            self.table.insertRow(idx)

            addr_item = QTableWidgetItem("%08x" % caller)
            addr_item.setFlags(addr_item.flags() ^ QtCore.Qt.ItemIsEditable)
            name_item = QTableWidgetItem("%s" % misc.get_function_name(caller))

            self.table.setItem(idx, 0, addr_item)
            self.table.setItem(idx, 1, name_item)
开发者ID:h0wl,项目名称:JARVIS,代码行数:30,代码来源:BinaryAnalysisWidget.py

示例10: _showStringXrefs

# 需要导入模块: from PySide.QtGui import QTableWidgetItem [as 别名]
# 或者: from PySide.QtGui.QTableWidgetItem import setFlags [as 别名]
    def _showStringXrefs(self):
        """
        Displays string references in a table
        Optionally Shannon's misc.entropy as well
        """

        # Retrieve some config values
        show_misc_entropy = self.config.calculate_entropy
        show_unique_s = self.config.display_unique_strings

        self._console_output("Calculating string references...")

        self.ba.calculate_strings_list()
        s_ref_list = self.ba.get_string_references()

        # Found any references at all?
        nrows = len(s_ref_list)
        if not nrows:
            self._console_output("[!] No string references found", err = True)
            return

        if show_misc_entropy:
            self.table.setColumnCount(3)
            self.table.setHorizontalHeaderLabels(
                ("Address", "String", "Entropy"))

        else:
            self.table.setColumnCount(2)
            self.table.setHorizontalHeaderLabels(("Address", "String"))

        self.table_label.setText("String references in current function")
        self.table.clearContents()
        self.table.setRowCount(0)

        # Fill the table
        displayed_strings = []

        idx = 0
        for (addr, s) in s_ref_list:
            if show_unique_s and s in displayed_strings:
                continue

            displayed_strings.append(s)

            self.table.insertRow(idx)
            addr_item = QTableWidgetItem("%08x" % addr)
            addr_item.setFlags(addr_item.flags() ^ QtCore.Qt.ItemIsEditable)
            string_item = QTableWidgetItem(s.decode('utf-8'))
            string_item.setFlags(string_item.flags() ^ QtCore.Qt.ItemIsEditable)

            self.table.setItem(idx, 0, addr_item)
            self.table.setItem(idx, 1, string_item)

            if show_misc_entropy:
                misc_entropy_item = cw.NumQTableWidgetItem("%.4f" % misc.entropy(s))
                self.table.setItem(idx, 2, misc_entropy_item)

            idx += 1
开发者ID:chubbymaggie,项目名称:JARVIS,代码行数:60,代码来源:BinaryAnalysisWidget.py

示例11: _showImportTrace

# 需要导入模块: from PySide.QtGui import QTableWidgetItem [as 别名]
# 或者: from PySide.QtGui.QTableWidgetItem import setFlags [as 别名]
    def _showImportTrace(self):
        """
        This is the GUI part of the PIN trace import functionality
        """
        self._console_output("Importing PIN trace information from file...")

        # Color for the basic blocks hit during the trace
        col = QtGui.QColorDialog.getColor()
        if col.isValid():
            # IDA works with BGR (annoying)
            ida_color = misc.pyside_to_ida_color(col.name())

        else:
            # Probably closed the QColorDialog
            self._console_output("[!] Problem getting color for trace. Aborting.")
            return

        try:
            imported_info_dict = self.ie.ti.import_data(ida_color)

        except:
            self._console_output("[!] Problem importing from file", err = True)
            self._console_output(traceback.format_exc(), err = True)
            return

        self.table.setColumnCount(5)
        self.table.setHorizontalHeaderLabels(
            ('Thread ID', 'From', 'To', 'From (name)', 'To (name)'))
        self.table_label.setText("Imported information from PIN trace")
        self.table.clearContents()
        self.table.setRowCount(0)

        # Fill with contents
        # TODO: This could be better in a QTree or maybe adding
        # a dropdown to select the thread id...
        idx = 0
        for tid, call_list in imported_info_dict.iteritems():
            self._console_output("Processing Thread ID %d" % tid)

            for u_ea, v_ea in call_list:

                self.table.insertRow(idx)
                tid_item = QTableWidgetItem("%d" % tid)
                u_item = QTableWidgetItem("%x" % u_ea)
                u_item.setFlags(u_item.flags() ^ QtCore.Qt.ItemIsEditable)
                v_item = QTableWidgetItem("%x" % v_ea)
                v_item.setFlags(v_item.flags() ^ QtCore.Qt.ItemIsEditable)
                from_item = QTableWidgetItem(misc.get_function_name(u_ea))
                to_item = QTableWidgetItem(misc.get_function_name(v_ea))

                self.table.setItem(idx, 0, tid_item)
                self.table.setItem(idx, 1, u_item)
                self.table.setItem(idx, 2, v_item)
                self.table.setItem(idx, 3, from_item)
                self.table.setItem(idx, 4, to_item)

                idx += 1
开发者ID:chubbymaggie,项目名称:JARVIS,代码行数:59,代码来源:ImportExportWidget.py

示例12: append_row

# 需要导入模块: from PySide.QtGui import QTableWidgetItem [as 别名]
# 或者: from PySide.QtGui.QTableWidgetItem import setFlags [as 别名]
    def append_row(self, cols, element_id=None):
        rowCount = self.list.rowCount()
        self.list.insertRow(rowCount)

        for index, value in enumerate(cols):
            col = QTableWidgetItem(value)
            col.element_id = element_id
            col.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
            self.list.setItem(rowCount, index, col)
开发者ID:socek,项目名称:bluebaker,代码行数:11,代码来源:view.py

示例13: _showAllFunctions

# 需要导入模块: from PySide.QtGui import QTableWidgetItem [as 别名]
# 或者: from PySide.QtGui.QTableWidgetItem import setFlags [as 别名]
    def _showAllFunctions(self):
        """
        Populates the functions list.
        From this it is possible to select endpoints to
        create a ConnectGraph for example
        """
        self._console_output("Displaying all known functions...")

        current_ea, _ = misc.function_boundaries()

        func_list = self.ba.get_all_functions()
        if not func_list:
            return

        self.table.setColumnCount(2)
        self.table.setHorizontalHeaderLabels(("Address", "Name"))

        self.table_label.setText("Functions in current binary")
        self.table.clearContents()
        self.table.setRowCount(0)

        # Current table index
        c_idx = 0

        for idx, (f_ea, f_name) in enumerate(func_list):
            self.table.insertRow(idx)

            addr_item = QTableWidgetItem("%08x" % f_ea)
            addr_item.setFlags(addr_item.flags() ^ QtCore.Qt.ItemIsEditable)
            name_item = QTableWidgetItem("%s" % f_name)

            if f_ea == current_ea:
                current_ea_item = addr_item
                c_idx = idx

            self.table.setItem(idx, 0, addr_item)
            self.table.setItem(idx, 1, name_item)

        # Conveniently scroll to the current EA
        self.table.scrollToItem(
            #current_ea_item,
            self.table.item(c_idx, 0),
            QtGui.QAbstractItemView.PositionAtTop
            )
开发者ID:h0wl,项目名称:JARVIS,代码行数:46,代码来源:BinaryAnalysisWidget.py

示例14: _commentsInThisFunction

# 需要导入模块: from PySide.QtGui import QTableWidgetItem [as 别名]
# 或者: from PySide.QtGui.QTableWidgetItem import setFlags [as 别名]
    def _commentsInThisFunction(self):
        """
        Shows all comments within the current function
        """
        show_unique_c = self.config.display_unique_comments

        msg = "Searching comments within function '" + \
            misc.get_function_name() + "'"
        self._console_output(msg)

        comment_list = self.ba.comments_in_function()

        # Found any comment at all?
        nrows = len(comment_list)
        if not nrows:
            self._console_output("[!] No comments found", err = True)
            return

        self.table.setColumnCount(2)
        self.table_label.setText("Comments within current function")
        self.table.setHorizontalHeaderLabels(("Address", "Comments"))
        self.table.clearContents()
        self.table.setRowCount(0)

        # Fill with contents
        displayed_comments = []

        idx = 0
        for (addr, comment) in comment_list:
            if show_unique_c and comment in displayed_comments:
                continue

            displayed_comments.append(comment)

            self.table.insertRow(idx)
            addr_item = QTableWidgetItem("%08x" % addr)
            addr_item.setFlags(addr_item.flags() ^ QtCore.Qt.ItemIsEditable)
            comment_item = QTableWidgetItem(comment)

            self.table.setItem(idx, 0, addr_item)
            self.table.setItem(idx, 1, comment_item)

            idx += 1
开发者ID:chubbymaggie,项目名称:JARVIS,代码行数:45,代码来源:BinaryAnalysisWidget.py

示例15: _callsInThisFunction

# 需要导入模块: from PySide.QtGui import QTableWidgetItem [as 别名]
# 或者: from PySide.QtGui.QTableWidgetItem import setFlags [as 别名]
    def _callsInThisFunction(self):
        """
        Shows all calls within the current function
        """
        msg = "Calls within function '" + misc.get_function_name()
        self._console_output(msg)

        show_unique_calls = self.config.display_unique_calls
        callee_list = self.ba.calls_in_function()

        nrows = len(callee_list)
        if not nrows:
            self._console_output("[!] No calls found", err = True)
            return

        self.table_label.setText("Calls within current function")
        self.table.setColumnCount(2)
        self.table.setHorizontalHeaderLabels(("Address", "Callee"))
        self.table.clearContents()
        self.table.setRowCount(0)

        # Fill with contents
        shown_calls = []

        idx = 0
        for (addr, callee) in callee_list:

            if show_unique_calls and callee in shown_calls:
                continue

            shown_calls.append(callee)

            self.table.insertRow(idx)
            addr_item = QTableWidgetItem("%08x" % addr)
            addr_item.setFlags(addr_item.flags() ^ QtCore.Qt.ItemIsEditable)
            callee_item =  QTableWidgetItem(callee)
            callee_item.setFlags(addr_item.flags() ^ QtCore.Qt.ItemIsEditable)

            self.table.setItem(idx, 0, addr_item)
            self.table.setItem(idx, 1, callee_item)

            idx += 1
开发者ID:h0wl,项目名称:JARVIS,代码行数:44,代码来源:BinaryAnalysisWidget.py


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