Python PyQt5.QtWidgets.QTableView() Examples

The following are 27 code examples for showing how to use PyQt5.QtWidgets.QTableView(). 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: python101   Author: koduj-z-klasa   File: gui_z0.py    License: MIT License 6 votes vote down vote up
def setupUi(self, Widget):
        Widget.setObjectName("Widget")

        # tabelaryczny widok danych
        self.widok = QTableView()

        # przyciski Push ###
        self.logujBtn = QPushButton("Za&loguj")
        self.koniecBtn = QPushButton("&Koniec")

        # układ przycisków Push ###
        uklad = QHBoxLayout()
        uklad.addWidget(self.logujBtn)
        uklad.addWidget(self.koniecBtn)

        # główny układ okna ###
        ukladV = QVBoxLayout(self)
        ukladV.addWidget(self.widok)
        ukladV.addLayout(uklad)

        # właściwości widżetu ###
        self.setWindowTitle("Prosta lista zadań")
        self.resize(500, 300) 
Example 2
Project: python101   Author: koduj-z-klasa   File: gui_z3.py    License: MIT License 6 votes vote down vote up
def setupUi(self, Widget):
        Widget.setObjectName("Widget")

        # tabelaryczny widok danych
        self.widok = QTableView()

        # przyciski Push ###
        self.logujBtn = QPushButton("Za&loguj")
        self.koniecBtn = QPushButton("&Koniec")

        # układ przycisków Push ###
        uklad = QHBoxLayout()
        uklad.addWidget(self.logujBtn)
        uklad.addWidget(self.koniecBtn)

        # główny układ okna ###
        ukladV = QVBoxLayout(self)
        ukladV.addWidget(self.widok)
        ukladV.addLayout(uklad)

        # właściwości widżetu ###
        self.setWindowTitle("Prosta lista zadań")
        self.resize(500, 300) 
Example 3
Project: python101   Author: koduj-z-klasa   File: gui_z2.py    License: MIT License 6 votes vote down vote up
def setupUi(self, Widget):
        Widget.setObjectName("Widget")

        # tabelaryczny widok danych
        self.widok = QTableView()

        # przyciski Push ###
        self.logujBtn = QPushButton("Za&loguj")
        self.koniecBtn = QPushButton("&Koniec")

        # układ przycisków Push ###
        uklad = QHBoxLayout()
        uklad.addWidget(self.logujBtn)
        uklad.addWidget(self.koniecBtn)

        # główny układ okna ###
        ukladV = QVBoxLayout(self)
        ukladV.addWidget(self.widok)
        ukladV.addLayout(uklad)

        # właściwości widżetu ###
        self.setWindowTitle("Prosta lista zadań")
        self.resize(500, 300) 
Example 4
Project: ANGRYsearch   Author: DoTheEvo   File: angrysearch.py    License: GNU General Public License v2.0 5 votes vote down vote up
def focusInEvent(self, event):
        Qw.QTableView.focusInEvent(self, event)
        row = self.currentIndex().row()
        if row != -1:
            self.selectRow(row) 
Example 5
Project: ANGRYsearch   Author: DoTheEvo   File: angrysearch.py    License: GNU General Public License v2.0 5 votes vote down vote up
def keyPressEvent(self, event):
        # ENTER KEY AND NUMPAD ENTER, AND WITH SHIFT
        if event.key() == 16777220 or event.key() == 16777221:
            index = self.currentIndex()
            if event.modifiers() == Qc.Qt.ShiftModifier:
                self.parent().parent().key_press_Enter(index, shift=True)
                return
            self.parent().parent().key_press_Enter(index, shift=False)
            return

        # TAB KEY GOES TO NEXT WIDGET NOT NEXT ROW IN THE TABLE
        if event.key() == 16777217:
            self.clearSelection()
            self.parent().focusNextChild()
            return

        # SHIFT + TAB KEY
        if event.key() == 16777218:
            self.clearSelection()
            self.parent().focusPreviousChild()
            return

        Qw.QTableView.keyPressEvent(self, event) 
Example 6
Project: dash-masternode-tool   Author: Bertrand256   File: wallet_data_models.py    License: MIT License 5 votes vote down vote up
def set_view(self, table_view: QTableView):
        super().set_view(table_view)
        link_delagate = wnd_utils.HyperlinkItemDelegate(table_view)
        link_delagate.linkActivated.connect(self.hyperlink_activated)
        table_view.setItemDelegateForColumn(self.col_index_by_name('txid'), link_delagate) 
Example 7
Project: dash-masternode-tool   Author: Bertrand256   File: wallet_data_models.py    License: MIT License 5 votes vote down vote up
def set_view(self, table_view: QTableView):
        super().set_view(table_view)
        link_delagate = wnd_utils.HyperlinkItemDelegate(table_view)
        link_delagate.linkActivated.connect(self.hyperlink_activated)
        table_view.setItemDelegateForColumn(self.col_index_by_name('tx_hash'), link_delagate) 
Example 8
Project: dash-masternode-tool   Author: Bertrand256   File: ext_item_model.py    License: MIT License 5 votes vote down vote up
def get_view_horizontal_header(self):
        if isinstance(self.view, QTableView):
            return self.view.horizontalHeader()
        elif isinstance(self.view, QTreeView):
            return self.view.header()
        else:
            raise Exception('Unsupported view type: %s', str(type(self.view))) 
Example 9
Project: dash-masternode-tool   Author: Bertrand256   File: ui_find_coll_tx_dlg.py    License: MIT License 5 votes vote down vote up
def setupUi(self, ListCollateralTxsDlg):
        ListCollateralTxsDlg.setObjectName("ListCollateralTxsDlg")
        ListCollateralTxsDlg.resize(655, 286)
        ListCollateralTxsDlg.setModal(True)
        self.verticalLayout = QtWidgets.QVBoxLayout(ListCollateralTxsDlg)
        self.verticalLayout.setContentsMargins(8, 8, 8, 8)
        self.verticalLayout.setSpacing(8)
        self.verticalLayout.setObjectName("verticalLayout")
        self.lblMessage = QtWidgets.QLabel(ListCollateralTxsDlg)
        self.lblMessage.setText("")
        self.lblMessage.setWordWrap(True)
        self.lblMessage.setObjectName("lblMessage")
        self.verticalLayout.addWidget(self.lblMessage)
        self.collsTableView = QtWidgets.QTableView(ListCollateralTxsDlg)
        self.collsTableView.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContentsOnFirstShow)
        self.collsTableView.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
        self.collsTableView.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
        self.collsTableView.setShowGrid(True)
        self.collsTableView.setSortingEnabled(False)
        self.collsTableView.setObjectName("collsTableView")
        self.collsTableView.verticalHeader().setVisible(False)
        self.collsTableView.verticalHeader().setCascadingSectionResizes(True)
        self.collsTableView.verticalHeader().setHighlightSections(False)
        self.verticalLayout.addWidget(self.collsTableView)
        self.buttonBox = QtWidgets.QDialogButtonBox(ListCollateralTxsDlg)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Apply|QtWidgets.QDialogButtonBox.Close)
        self.buttonBox.setObjectName("buttonBox")
        self.verticalLayout.addWidget(self.buttonBox)

        self.retranslateUi(ListCollateralTxsDlg)
        QtCore.QMetaObject.connectSlotsByName(ListCollateralTxsDlg) 
Example 10
Project: prefix   Author: gaasedelen   File: ida_prefix.py    License: MIT License 5 votes vote down vote up
def get_selected_funcs():
    """
    Return the list of function names selected in the Functions window.
    """
    import sip
    twidget = idaapi.find_widget("Functions window")
    widget  = sip.wrapinstance(int(twidget), QtWidgets.QWidget)

    # TODO: test this
    if not widget:
        idaapi.warning("Unable to find 'Functions window'")
        return

    #
    # locate the table widget within the Functions window that actually holds
    # all the visible function metadata
    #

    table = widget.findChild(QtWidgets.QTableView)

    #
    # scrape the selected function names from the Functions window table
    #

    selected_funcs = [str(s.data()) for s in table.selectionModel().selectedRows()]

    #
    # re-map the scraped names as they appear in the function table, to their true
    # names as they are saved in the IDB. See the match_funcs(...) function
    # comment for more details
    #

    return match_funcs(selected_funcs) 
Example 11
Project: nanovna-saver   Author: NanoVNA-Saver   File: Bands.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, app: QtWidgets.QWidget):
        super().__init__()

        self.app = app
        self.setWindowTitle("Manage bands")
        self.setWindowIcon(self.app.icon)

        QtWidgets.QShortcut(QtCore.Qt.Key_Escape, self, self.hide)

        layout = QtWidgets.QVBoxLayout()
        self.setLayout(layout)
        self.setMinimumSize(500, 300)

        self.bands_table = QtWidgets.QTableView()
        self.bands_table.setModel(self.app.bands)
        self.bands_table.horizontalHeader().setStretchLastSection(True)

        layout.addWidget(self.bands_table)

        btn_add_row = QtWidgets.QPushButton("Add row")
        btn_delete_row = QtWidgets.QPushButton("Delete row")
        btn_reset_bands = QtWidgets.QPushButton("Reset bands")
        btn_layout = QtWidgets.QHBoxLayout()
        btn_layout.addWidget(btn_add_row)
        btn_layout.addWidget(btn_delete_row)
        btn_layout.addWidget(btn_reset_bands)
        layout.addLayout(btn_layout)

        btn_add_row.clicked.connect(self.app.bands.addRow)
        btn_delete_row.clicked.connect(self.deleteRows)
        btn_reset_bands.clicked.connect(self.resetBands) 
Example 12
Project: DownloaderForReddit   Author: MalloyDelacroix   File: FailedDownloadsDialog_auto.py    License: GNU General Public License v3.0 5 votes vote down vote up
def setupUi(self, failed_downloads_dialog):
        failed_downloads_dialog.setObjectName("failed_downloads_dialog")
        failed_downloads_dialog.resize(998, 512)
        font = QtGui.QFont()
        font.setPointSize(10)
        failed_downloads_dialog.setFont(font)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("Resources/Images/failed_download.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        failed_downloads_dialog.setWindowIcon(icon)
        self.gridLayout = QtWidgets.QGridLayout(failed_downloads_dialog)
        self.gridLayout.setObjectName("gridLayout")
        self.auto_display_checkbox = QtWidgets.QCheckBox(failed_downloads_dialog)
        self.auto_display_checkbox.setObjectName("auto_display_checkbox")
        self.gridLayout.addWidget(self.auto_display_checkbox, 1, 0, 1, 1)
        self.buttonBox = QtWidgets.QDialogButtonBox(failed_downloads_dialog)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.gridLayout.addWidget(self.buttonBox, 1, 1, 1, 1)
        self.splitter = QtWidgets.QSplitter(failed_downloads_dialog)
        self.splitter.setOrientation(QtCore.Qt.Vertical)
        self.splitter.setObjectName("splitter")
        self.table_view = QtWidgets.QTableView(self.splitter)
        self.table_view.setObjectName("table_view")
        self.detail_table = QtWidgets.QTableView(self.splitter)
        self.detail_table.setObjectName("detail_table")
        self.gridLayout.addWidget(self.splitter, 0, 0, 1, 2)

        self.retranslateUi(failed_downloads_dialog)
        QtCore.QMetaObject.connectSlotsByName(failed_downloads_dialog) 
Example 13
Project: guppy-proxy   Author: roglew   File: macros.py    License: MIT License 5 votes vote down vote up
def __init__(self, client, *args, **kwargs):
        self.client = client
        self.macros = []
        QWidget.__init__(self, *args, **kwargs)
        
        self.setLayout(QVBoxLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)
        
        buttonLayout = QHBoxLayout()
        new_button = QPushButton("New")
        add_button = QPushButton("Add...")
        remove_button = QPushButton("Remove")
        new_button.clicked.connect(self.new_macro)
        add_button.clicked.connect(self.browse_macro)
        remove_button.clicked.connect(self.remove_selected)
        
        # Set up table
        self.macroListModel = IntMacroListModel(self, self.client)
        self.macroListView = QTableView()
        self.macroListView.setModel(self.macroListModel)

        self.macroListView.verticalHeader().setSectionResizeMode(QHeaderView.ResizeToContents)
        self.macroListView.verticalHeader().hide()
        self.macroListView.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeToContents)
        self.macroListView.horizontalHeader().hide()
        self.macroListView.horizontalHeader().setStretchLastSection(True)

        self.macroListView.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.macroListView.setSelectionMode(QAbstractItemView.SingleSelection)
        
        buttonLayout.addWidget(new_button)
        buttonLayout.addWidget(add_button)
        buttonLayout.addWidget(remove_button)
        buttonLayout.addStretch()
        self.layout().addWidget(self.macroListView)
        self.layout().addLayout(buttonLayout) 
Example 14
Project: guppy-proxy   Author: roglew   File: reqlist.py    License: MIT License 5 votes vote down vote up
def __init__(self, client, repeater_widget=None, macro_widget=None, *args, **kwargs):
        QWidget.__init__(self, *args, **kwargs)
        self.allow_save = False

        self.client = client
        self.repeater_widget = repeater_widget
        self.macro_widget = macro_widget
        self.query = []
        self.req_view_widget = None

        self.setLayout(QStackedLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)
        
        self.tableModel = ReqListModel(self.client)
        self.tableView = QTableView()
        self.tableView.setModel(self.tableModel)

        self.tableView.verticalHeader().setSectionResizeMode(QHeaderView.ResizeToContents)
        self.tableView.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeToContents)
        self.tableView.verticalHeader().hide()
        self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows)
        #self.tableView.setSelectionMode(QAbstractItemView.SingleSelection)
        self.tableView.horizontalHeader().setStretchLastSection(True)
        
        self.tableView.selectionModel().selectionChanged.connect(self.on_select_change)
        self.tableModel.dataChanged.connect(self._paint_view)
        self.tableModel.rowsInserted.connect(self._on_rows_inserted)
        self.requestsChanged.connect(self.set_requests)
        self.requestsSelected.connect(self._updated_selected_request)
        
        self.selected_reqs = []
        
        self.layout().addWidget(self.tableView)
        self.layout().addWidget(QLabel("<b>Loading requests from data file...</b>")) 
Example 15
Project: CASC   Author: Cisco-Talos   File: casc_plugin.py    License: GNU General Public License v2.0 5 votes vote down vote up
def insert_import_item(self, ctx):
        try:
            chooser = self.FormToPySideWidget(ctx.form)
        except AttributeError:
            chooser = self.FormToPyQtWidget(ctx.form)

        #   Get the embedded table view
        table_view = chooser.findChild(QtWidgets.QTableView)
        sort_order = table_view.horizontalHeader().sortIndicatorOrder()
        sort_column = table_view.horizontalHeader().sortIndicatorSection()

        #   Get the table view's data
        model = table_view.model()
        sel = ctx.chooser_selection

        data = {}
        for row_data in table_view.selectionModel().selectedRows():
            index = row_data.row()

            address = int(model.data(model.index(index, 0), Qt.DisplayRole), 16)
            name = model.data(model.index(index, 2), Qt.DisplayRole)

            data[address] = ' '.join([x.encode('hex') for x in name]) + ' 00'

        sub_signature = [data[x] for x in sorted(data.keys())]
        try:
            notes = [x.replace(' ', '').decode('hex') for x in sub_signature]
            notes = map(unicode, notes)
        except UnicodeDecodeError:
            pass

        self.insert_custom_item(' * '.join(sub_signature), '\n'.join(notes)) 
Example 16
Project: python101   Author: koduj-z-klasa   File: gui_z1.py    License: MIT License 5 votes vote down vote up
def setupUi(self, Widget):
        Widget.setObjectName("Widget")

        # tabelaryczny widok danych
        self.widok = QTableView()

        # przyciski Push ###
        self.logujBtn = QPushButton("Za&loguj")
        self.koniecBtn = QPushButton("&Koniec")

        # układ przycisków Push ###
        uklad = QHBoxLayout()
        uklad.addWidget(self.logujBtn)
        uklad.addWidget(self.koniecBtn)

        # główny układ okna ###
        ukladV = QVBoxLayout(self)
        ukladV.addWidget(self.widok)
        ukladV.addLayout(uklad)

        # właściwości widżetu ###
        self.setWindowTitle("Prosta lista zadań")
        self.resize(500, 300) 
Example 17
Project: python101   Author: koduj-z-klasa   File: gui_z5.py    License: MIT License 5 votes vote down vote up
def setupUi(self, Widget):
        Widget.setObjectName("Widget")

        # tabelaryczny widok danych
        self.widok = QTableView()

        # przyciski Push ###
        self.logujBtn = QPushButton("Za&loguj")
        self.koniecBtn = QPushButton("&Koniec")
        self.dodajBtn = QPushButton("&Dodaj")
        self.dodajBtn.setEnabled(False)

        # układ przycisków Push ###
        uklad = QHBoxLayout()
        uklad.addWidget(self.logujBtn)
        uklad.addWidget(self.dodajBtn)
        uklad.addWidget(self.koniecBtn)

        # główny układ okna ###
        ukladV = QVBoxLayout(self)
        ukladV.addWidget(self.widok)
        ukladV.addLayout(uklad)

        # właściwości widżetu ###
        self.setWindowTitle("Prosta lista zadań")
        self.resize(500, 300) 
Example 18
Project: python101   Author: koduj-z-klasa   File: gui_z6.py    License: MIT License 5 votes vote down vote up
def setupUi(self, Widget):
        Widget.setObjectName("Widget")

        # tabelaryczny widok danych
        self.widok = QTableView()

        # przyciski Push ###
        self.logujBtn = QPushButton("Za&loguj")
        self.koniecBtn = QPushButton("&Koniec")
        self.dodajBtn = QPushButton("&Dodaj")
        self.dodajBtn.setEnabled(False)
        self.zapiszBtn = QPushButton("&Zapisz")
        self.zapiszBtn.setEnabled(False)

        # układ przycisków Push ###
        uklad = QHBoxLayout()
        uklad.addWidget(self.logujBtn)
        uklad.addWidget(self.dodajBtn)
        uklad.addWidget(self.zapiszBtn)
        uklad.addWidget(self.koniecBtn)

        # główny układ okna ###
        ukladV = QVBoxLayout(self)
        ukladV.addWidget(self.widok)
        ukladV.addLayout(uklad)

        # właściwości widżetu ###
        self.setWindowTitle("Prosta lista zadań")
        self.resize(500, 300) 
Example 19
Project: Mastering-GUI-Programming-with-Python   Author: PacktPublishing   File: csv_editor.py    License: MIT License 5 votes vote down vote up
def __init__(self):
        """MainWindow constructor.

        This widget will be our main window.
        We'll define all the UI components in here.
        """
        super().__init__()
        # Main UI code goes here

        self.tableview = qtw.QTableView()
        self.tableview.setSortingEnabled(True)
        self.setCentralWidget(self.tableview)

        # Setup the menu
        menu = self.menuBar()
        file_menu = menu.addMenu('File')
        file_menu.addAction('Open', self.select_file)
        file_menu.addAction('Save', self.save_file)

        edit_menu = menu.addMenu('Edit')
        edit_menu.addAction('Insert Above', self.insert_above)
        edit_menu.addAction('Insert Below', self.insert_below)
        edit_menu.addAction('Remove Row(s)', self.remove_rows)

        # End main UI code
        self.show()

    # File methods 
Example 20
Project: legion   Author: GoVanguard   File: gui.py    License: GNU General Public License v3.0 5 votes vote down vote up
def setupBottomPanel(self):
        self.BottomTabWidget = QtWidgets.QTabWidget(self.splitter_2)
        self.BottomTabWidget.setSizeIncrement(QtCore.QSize(0, 0))
        self.BottomTabWidget.setBaseSize(QtCore.QSize(0, 0))
        self.BottomTabWidget.setObjectName(_fromUtf8("BottomTabWidget"))

        # Process Tab
        self.ProcessTab = QtWidgets.QWidget()
        self.ProcessTab.setObjectName(_fromUtf8("ProcessesTab"))
        self.horizontalLayout_5 = QtWidgets.QHBoxLayout(self.ProcessTab)
        self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5"))
        self.ProcessesTableView = QtWidgets.QTableView(self.ProcessTab)
        self.ProcessesTableView.setObjectName(_fromUtf8("ProcessesTableView"))
        self.horizontalLayout_5.addWidget(self.ProcessesTableView)
        self.BottomTabWidget.addTab(self.ProcessTab, _fromUtf8("")) 
Example 21
Project: PyQt   Author: PyQt5   File: Ui_PluginStore.py    License: GNU General Public License v3.0 5 votes vote down vote up
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(573, 300)
        Dialog.setSizeGripEnabled(True)
        self.gridLayout = QtWidgets.QGridLayout(Dialog)
        self.gridLayout.setObjectName("gridLayout")
        self.tableView = QtWidgets.QTableView(Dialog)
        self.tableView.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
        self.tableView.setObjectName("tableView")
        self.gridLayout.addWidget(self.tableView, 0, 0, 1, 1)

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
Example 22
Project: urh   Author: jopohl   File: ui_messagetype_options.py    License: GNU General Public License v3.0 5 votes vote down vote up
def setupUi(self, DialogMessageType):
        DialogMessageType.setObjectName("DialogMessageType")
        DialogMessageType.resize(471, 359)
        self.gridLayout = QtWidgets.QGridLayout(DialogMessageType)
        self.gridLayout.setObjectName("gridLayout")
        self.cbRulesetMode = QtWidgets.QComboBox(DialogMessageType)
        self.cbRulesetMode.setObjectName("cbRulesetMode")
        self.cbRulesetMode.addItem("")
        self.cbRulesetMode.addItem("")
        self.cbRulesetMode.addItem("")
        self.gridLayout.addWidget(self.cbRulesetMode, 1, 0, 1, 2)
        self.tblViewRuleset = QtWidgets.QTableView(DialogMessageType)
        self.tblViewRuleset.setShowGrid(False)
        self.tblViewRuleset.setObjectName("tblViewRuleset")
        self.gridLayout.addWidget(self.tblViewRuleset, 2, 0, 3, 2)
        self.btnRemoveRule = QtWidgets.QToolButton(DialogMessageType)
        icon = QtGui.QIcon.fromTheme("list-remove")
        self.btnRemoveRule.setIcon(icon)
        self.btnRemoveRule.setObjectName("btnRemoveRule")
        self.gridLayout.addWidget(self.btnRemoveRule, 3, 2, 1, 1)
        self.rbAssignManually = QtWidgets.QRadioButton(DialogMessageType)
        self.rbAssignManually.setObjectName("rbAssignManually")
        self.gridLayout.addWidget(self.rbAssignManually, 0, 0, 1, 1)
        self.rbAssignAutomatically = QtWidgets.QRadioButton(DialogMessageType)
        self.rbAssignAutomatically.setObjectName("rbAssignAutomatically")
        self.gridLayout.addWidget(self.rbAssignAutomatically, 0, 1, 1, 1)
        spacerItem = QtWidgets.QSpacerItem(20, 145, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.gridLayout.addItem(spacerItem, 4, 2, 1, 1)
        self.btnAddRule = QtWidgets.QToolButton(DialogMessageType)
        icon = QtGui.QIcon.fromTheme("list-add")
        self.btnAddRule.setIcon(icon)
        self.btnAddRule.setObjectName("btnAddRule")
        self.gridLayout.addWidget(self.btnAddRule, 2, 2, 1, 1)
        self.buttonBox = QtWidgets.QDialogButtonBox(DialogMessageType)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.gridLayout.addWidget(self.buttonBox, 5, 0, 1, 2)

        self.retranslateUi(DialogMessageType) 
Example 23
Project: CASC   Author: Cisco-Talos   File: casc_plugin.py    License: GNU General Public License v2.0 4 votes vote down vote up
def insert_string_item(self, ctx):
        #   Get IDA's toplevel chooser widget
        #   For compatability with IDA 6.8 and lower
        try:
            chooser = self.FormToPySideWidget(ctx.form)
        except AttributeError:
            chooser = self.FormToPyQtWidget(ctx.form)

        #   Get the embedded table view
        table_view = chooser.findChild(QtWidgets.QTableView)
        sort_order = table_view.horizontalHeader().sortIndicatorOrder()
        sort_column = table_view.horizontalHeader().sortIndicatorSection()

        #   Get the table view's data
        model = table_view.model()
        sel = ctx.chooser_selection

        data = {}
        for row_data in table_view.selectionModel().selectedRows():
            index = row_data.row()

            address = model.data(model.index(index, 0), Qt.DisplayRole)
            address = int(address[address.index(':')+1:], 16)
            length = model.data(model.index(index, 1), Qt.DisplayRole)

            #   Don't inclue the \0 character
            length = int(length, 16) - 1
            if model.data(model.index(index, 2), Qt.DisplayRole) != 'C':
                length -= 1

            raw = ['{0:02x}'.format(IDAW.Byte(address + i)) for i in xrange(length)]

            data[address] = ' '.join(raw)

        sub_signature = [data[x] for x in sorted(data.keys())]
        try:
            notes = [x.replace(' ', '').decode('hex') for x in sub_signature]
            notes = map(unicode, notes)
        except UnicodeDecodeError:
            pass

        self.insert_custom_item(' * '.join(sub_signature), '\n'.join(notes)) 
Example 24
Project: PhyloSuite   Author: dongzhang0725   File: Ui_seqViewSetting.py    License: GNU General Public License v3.0 4 votes vote down vote up
def setupUi(self, seqViewSetting):
        seqViewSetting.setObjectName("seqViewSetting")
        seqViewSetting.resize(444, 357)
        self.verticalLayout = QtWidgets.QVBoxLayout(seqViewSetting)
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setSpacing(2)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.label_2 = QtWidgets.QLabel(seqViewSetting)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth())
        self.label_2.setSizePolicy(sizePolicy)
        self.label_2.setObjectName("label_2")
        self.horizontalLayout.addWidget(self.label_2)
        self.lineEdit_fontSet = QtWidgets.QLineEdit(seqViewSetting)
        self.lineEdit_fontSet.setStyleSheet("QLineEdit {\n"
"    border: 1px solid gray;  \n"
"    border-radius: 3px; \n"
"    background: white;  \n"
"    selection-background-color: green; \n"
"}\n"
"\n"
"QLineEdit:hover {\n"
"    border: 1px solid blue;  \n"
"}")
        self.lineEdit_fontSet.setReadOnly(True)
        self.lineEdit_fontSet.setObjectName("lineEdit_fontSet")
        self.horizontalLayout.addWidget(self.lineEdit_fontSet)
        self.toolButton = QtWidgets.QToolButton(seqViewSetting)
        self.toolButton.setText("")
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/picture/resourses/if_font_173018.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.toolButton.setIcon(icon)
        self.toolButton.setAutoRaise(True)
        self.toolButton.setObjectName("toolButton")
        self.horizontalLayout.addWidget(self.toolButton)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.label = QtWidgets.QLabel(seqViewSetting)
        self.label.setObjectName("label")
        self.verticalLayout.addWidget(self.label)
        self.tableView = QtWidgets.QTableView(seqViewSetting)
        self.tableView.setStyleSheet("QTableView {\n"
"    selection-background-color: none;\n"
"    outline: 0;\n"
"}")
        self.tableView.setObjectName("tableView")
        self.verticalLayout.addWidget(self.tableView)

        self.retranslateUi(seqViewSetting)
        QtCore.QMetaObject.connectSlotsByName(seqViewSetting) 
Example 25
Project: PhyloSuite   Author: dongzhang0725   File: Ui_parseANNT_settings.py    License: GNU General Public License v3.0 4 votes vote down vote up
def setupUi(self, ParAnnt_settings):
        ParAnnt_settings.setObjectName("ParAnnt_settings")
        ParAnnt_settings.setWindowModality(QtCore.Qt.NonModal)
        ParAnnt_settings.resize(697, 538)
        ParAnnt_settings.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu)
        self.verticalLayout = QtWidgets.QVBoxLayout(ParAnnt_settings)
        self.verticalLayout.setObjectName("verticalLayout")
        self.splitter = QtWidgets.QSplitter(ParAnnt_settings)
        self.splitter.setOrientation(QtCore.Qt.Horizontal)
        self.splitter.setObjectName("splitter")
        self.listWidget = QtWidgets.QListWidget(self.splitter)
        self.listWidget.setObjectName("listWidget")
        self.layoutWidget = QtWidgets.QWidget(self.splitter)
        self.layoutWidget.setObjectName("layoutWidget")
        self.gridLayout = QtWidgets.QGridLayout(self.layoutWidget)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setSpacing(2)
        self.gridLayout.setObjectName("gridLayout")
        self.tableView = QtWidgets.QTableView(self.layoutWidget)
        self.tableView.setAcceptDrops(True)
        self.tableView.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
        self.tableView.setSortingEnabled(True)
        self.tableView.setObjectName("tableView")
        self.tableView.horizontalHeader().setCascadingSectionResizes(False)
        self.tableView.horizontalHeader().setSortIndicatorShown(True)
        self.tableView.horizontalHeader().setStretchLastSection(True)
        self.gridLayout.addWidget(self.tableView, 0, 0, 1, 2)
        self.pushButton = QtWidgets.QPushButton(self.layoutWidget)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/picture/resourses/table_row_add_after.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pushButton.setIcon(icon)
        self.pushButton.setObjectName("pushButton")
        self.gridLayout.addWidget(self.pushButton, 1, 1, 1, 1)
        self.pushButton_2 = QtWidgets.QPushButton(self.layoutWidget)
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(":/picture/resourses/delete.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pushButton_2.setIcon(icon1)
        self.pushButton_2.setObjectName("pushButton_2")
        self.gridLayout.addWidget(self.pushButton_2, 1, 0, 1, 1)
        self.verticalLayout.addWidget(self.splitter)

        self.retranslateUi(ParAnnt_settings)
        QtCore.QMetaObject.connectSlotsByName(ParAnnt_settings) 
Example 26
Project: Mastering-GUI-Programming-with-Python   Author: PacktPublishing   File: coffee_list2.py    License: MIT License 4 votes vote down vote up
def __init__(self, coffees_model, reviews_model):
        super().__init__()
        self.setLayout(qtw.QFormLayout())

        # Coffee Fields
        self.coffee_brand = qtw.QLineEdit()
        self.layout().addRow('Brand: ', self.coffee_brand)
        self.coffee_name = qtw.QLineEdit()
        self.layout().addRow('Name: ', self.coffee_name)
        self.roast = qtw.QComboBox()
        self.layout().addRow('Roast: ', self.roast)

        # Map the coffee fields
        self.coffees_model = coffees_model
        self.mapper = qtw.QDataWidgetMapper(self)
        self.mapper.setModel(self.coffees_model)
        self.mapper.setItemDelegate(
            qts.QSqlRelationalDelegate(self))
        self.mapper.addMapping(
            self.coffee_brand,
            self.coffees_model.fieldIndex('coffee_brand')
        )
        self.mapper.addMapping(
            self.coffee_name,
            self.coffees_model.fieldIndex('coffee_name')
        )
        self.mapper.addMapping(
            self.roast,
            self.coffees_model.fieldIndex('description')
        )
        # retrieve a model for the roasts and setup the combo box
        roasts_model = coffees_model.relationModel(
            self.coffees_model.fieldIndex('description'))
        self.roast.setModel(roasts_model)
        self.roast.setModelColumn(1)
        # Cause data to be written when changed

        # Reviews
        self.reviews = qtw.QTableView()
        self.layout().addRow(self.reviews)
        self.reviews.setModel(reviews_model)
        self.reviews.hideColumn(0)
        self.reviews.hideColumn(1)
        self.reviews.horizontalHeader().setSectionResizeMode(
            4, qtw.QHeaderView.Stretch)


        # Using a custom delegate
        self.dateDelegate = DateDelegate()
        self.reviews.setItemDelegateForColumn(
            reviews_model.fieldIndex('review_date'),
            self.dateDelegate)

        # add and delete reviews
        self.new_review = qtw.QPushButton(
            'New Review', clicked=self.add_review)
        self.delete_review = qtw.QPushButton(
            'Delete Review', clicked=self.delete_review)
        self.layout().addRow(self.new_review, self.delete_review) 
Example 27
Project: PyQt   Author: PyQt5   File: Ui_MainWindow.py    License: GNU General Public License v3.0 4 votes vote down vote up
def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(486, 313)
        MainWindow.setStyleSheet("QListView::item:alternate {\n"
"   \n"
"    background-color: rgb(85, 255, 255);\n"
"}")
        MainWindow.setTabShape(QtWidgets.QTabWidget.Rounded)
        MainWindow.setDockOptions(QtWidgets.QMainWindow.AllowTabbedDocks|QtWidgets.QMainWindow.AnimatedDocks)
        self.centralWidget = QtWidgets.QWidget(MainWindow)
        self.centralWidget.setObjectName("centralWidget")
        self.verticalLayout = QtWidgets.QGridLayout(self.centralWidget)
        self.verticalLayout.setObjectName("verticalLayout")
        self.l3 = QtWidgets.QLineEdit(self.centralWidget)
        self.l3.setObjectName("l3")
        self.verticalLayout.addWidget(self.l3, 6, 0, 1, 1)
        self.l1 = QtWidgets.QLineEdit(self.centralWidget)
        self.l1.setObjectName("l1")
        self.verticalLayout.addWidget(self.l1, 4, 0, 1, 1)
        self.l2 = QtWidgets.QLineEdit(self.centralWidget)
        self.l2.setObjectName("l2")
        self.verticalLayout.addWidget(self.l2, 5, 0, 1, 1)
        self.pre_btn = QtWidgets.QPushButton(self.centralWidget)
        self.pre_btn.setObjectName("pre_btn")
        self.verticalLayout.addWidget(self.pre_btn, 1, 0, 1, 1)
        self.tableView = QtWidgets.QTableView(self.centralWidget)
        self.tableView.setObjectName("tableView")
        self.verticalLayout.addWidget(self.tableView, 0, 0, 1, 1)
        self.next_btn = QtWidgets.QPushButton(self.centralWidget)
        self.next_btn.setObjectName("next_btn")
        self.verticalLayout.addWidget(self.next_btn, 2, 0, 1, 1)
        self.listView = QtWidgets.QListView(self.centralWidget)
        self.listView.setObjectName("listView")
        self.verticalLayout.addWidget(self.listView, 0, 1, 1, 1)
        self.sub_btn = QtWidgets.QPushButton(self.centralWidget)
        self.sub_btn.setObjectName("sub_btn")
        self.verticalLayout.addWidget(self.sub_btn, 3, 0, 1, 1)
        self.l4 = QtWidgets.QLineEdit(self.centralWidget)
        self.l4.setObjectName("l4")
        self.verticalLayout.addWidget(self.l4, 7, 0, 1, 1)
        self.l5 = QtWidgets.QLineEdit(self.centralWidget)
        self.l5.setObjectName("l5")
        self.verticalLayout.addWidget(self.l5, 8, 0, 1, 1)
        MainWindow.setCentralWidget(self.centralWidget)
        self.saveaction = QtWidgets.QAction(MainWindow)
        self.saveaction.setObjectName("saveaction")
        self.action12 = QtWidgets.QAction(MainWindow)
        self.action12.setObjectName("action12")
        self.actionas = QtWidgets.QAction(MainWindow)
        self.actionas.setObjectName("actionas")
        self.actiondz = QtWidgets.QAction(MainWindow)
        self.actiondz.setObjectName("actiondz")
        self.actiongc = QtWidgets.QAction(MainWindow)
        self.actiongc.setObjectName("actiongc")
        self.actiondb = QtWidgets.QAction(MainWindow)
        self.actiondb.setObjectName("actiondb")

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)