Python PyQt5.QtCore.Qt.CustomContextMenu() Examples
The following are 30
code examples of PyQt5.QtCore.Qt.CustomContextMenu().
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 also want to check out all available functions/classes of the module
PyQt5.QtCore.Qt
, or try the search function
.
Example #1
Source File: structs.py From heap-viewer with GNU General Public License v3.0 | 7 votes |
def _create_gui(self): columns = ['offset','name','size','value'] self.tree = QtWidgets.QTreeWidget() self.tree.setAttribute(Qt.WA_MacShowFocusRect, 0) self.tree.setColumnCount(len(columns)) self.tree.setHeaderLabels(columns) self.tree.setContextMenuPolicy(Qt.CustomContextMenu) self.tree.customContextMenuRequested.connect(self.context_menu) hbox = QtWidgets.QHBoxLayout() lbl_address = QtWidgets.QLabel("Address:") lbl_address.setStyleSheet("font-weight: bold;") hbox.addWidget(lbl_address) self.lbl_hex_addr = QtWidgets.QLabel() hbox.addWidget(self.lbl_hex_addr) hbox.addStretch(1) layout = QtWidgets.QVBoxLayout() layout.addLayout(hbox) layout.addWidget(self.tree) #layout.setSpacing(0) layout.setContentsMargins(0, 0, 0, 0) self.setLayout(layout)
Example #2
Source File: downloadview.py From qutebrowser with GNU General Public License v3.0 | 6 votes |
def __init__(self, model, parent=None): super().__init__(parent) if not utils.is_mac: self.setStyle(QStyleFactory.create('Fusion')) stylesheet.set_register(self) self.setResizeMode(QListView.Adjust) self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed) self.setFocusPolicy(Qt.NoFocus) self.setFlow(QListView.LeftToRight) self.setSpacing(1) self._menu = None model.rowsInserted.connect(functools.partial(update_geometry, self)) model.rowsRemoved.connect(functools.partial(update_geometry, self)) model.dataChanged.connect(functools.partial(update_geometry, self)) self.setModel(model) self.setWrapping(True) self.setContextMenuPolicy(Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.show_context_menu) self.clicked.connect(self.on_clicked)
Example #3
Source File: backtrace.py From Dwarf with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent=None): super(BacktraceWidget, self).__init__(parent=parent) self._app_window = parent self._app_window.dwarf.onBackTrace.connect(self.set_backtrace) self._model = QStandardItemModel(0, 2) self._model.setHeaderData(0, Qt.Horizontal, 'Address') self._model.setHeaderData(1, Qt.Horizontal, 'Symbol') self.setModel(self._model) self.header().setSectionResizeMode(0, QHeaderView.ResizeToContents) self.header().setSectionResizeMode(1, QHeaderView.ResizeToContents) self.doubleClicked.connect(self._item_double_clicked) self.setContextMenuPolicy(Qt.CustomContextMenu) self.customContextMenuRequested.connect(self._on_context_menu) self._mode = 'native'
Example #4
Source File: telemetry.py From sparrow-wifi with GNU General Public License v3.0 | 6 votes |
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
Source File: telemetry.py From sparrow-wifi with GNU General Public License v3.0 | 6 votes |
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 #6
Source File: view.py From equant with GNU General Public License v2.0 | 6 votes |
def create_func_doc(self): self.func_doc = QWidget() self.func_doc_layout = QVBoxLayout() self.func_doc_layout.setSpacing(0) self.func_doc_layout.setContentsMargins(0, 0, 0, 0) self.func_doc_line = QLabel() self.func_doc_line.setText('函数简介') self.func_doc_line.setObjectName("FuncDetailLabel") self.func_content = QTextBrowser() self.func_content.setObjectName("FuncContent") self.func_content.setContextMenuPolicy(Qt.CustomContextMenu) self.func_content.customContextMenuRequested[QPoint].connect(self.func_doc_right_menu) self.func_doc_layout.addWidget(self.func_doc_line) self.func_doc_layout.addWidget(self.func_content) self.func_doc.setLayout(self.func_doc_layout) self.func_doc.setContentsMargins(0, 0, 0, 0)
Example #7
Source File: videolist.py From vidcutter with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent=None): super(VideoList, self).__init__(parent) self.parent = parent self.theme = self.parent.theme self._progressbars = [] self.setMouseTracking(True) self.setDropIndicatorShown(True) self.setFixedWidth(190) self.setAttribute(Qt.WA_MacShowFocusRect, False) self.setContentsMargins(0, 0, 0, 0) self.setItemDelegate(VideoItem(self)) self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) self.setUniformItemSizes(True) self.setDragEnabled(True) self.setDragDropMode(QAbstractItemView.InternalMove) self.setContextMenuPolicy(Qt.CustomContextMenu) self.setAlternatingRowColors(True) self.setVerticalScrollMode(QAbstractItemView.ScrollPerPixel) self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.setObjectName('cliplist') self.setStyleSheet('QListView::item { border: none; }') self.opacityEffect = OpacityEffect(0.3) self.opacityEffect.setEnabled(False) self.setGraphicsEffect(self.opacityEffect)
Example #8
Source File: devices_widget.py From parsec-cloud with GNU Affero General Public License v3.0 | 6 votes |
def __init__(self, device_name, is_current_device, certified_on): super().__init__() self.setupUi(self) self.is_current_device = is_current_device self.label_icon.apply_style() self.device_name = device_name self.certified_on = certified_on self.label_device_name.setText(self.device_name) if self.is_current_device: self.label_is_current.setText("({})".format(_("TEXT_DEVICE_IS_CURRENT"))) self.setContextMenuPolicy(Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.show_context_menu) effect = QGraphicsDropShadowEffect(self) effect.setColor(QColor(0x99, 0x99, 0x99)) effect.setBlurRadius(10) effect.setXOffset(2) effect.setYOffset(2) self.setGraphicsEffect(effect)
Example #9
Source File: custom.py From heap-viewer with GNU General Public License v3.0 | 6 votes |
def __init__(self, labels, parent=None): super(TTable, self).__init__(parent) self.labels = labels self.setColumnCount(len(labels)) self.setHorizontalHeaderLabels(labels) self.verticalHeader().hide() self.setContextMenuPolicy(Qt.CustomContextMenu) self.horizontalHeader().model().setHeaderData(0, Qt.Horizontal, Qt.AlignJustify, Qt.TextAlignmentRole) self.horizontalHeader().setStretchLastSection(1) self.setSelectionMode(QtWidgets.QTableView.SingleSelection) self.setSelectionBehavior(QtWidgets.QTableView.SelectRows) self.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
Example #10
Source File: generate_protocol_tab.py From MDT with GNU Lesser General Public License v3.0 | 6 votes |
def setupUi(self, tab_content): super().setupUi(tab_content) self._tab_content = tab_content self.loadProtocolButton.clicked.connect(lambda: self._select_protocol()) self.saveButton.clicked.connect(lambda: self._save_protocol()) self.loadColumnButton.clicked.connect(lambda: self._load_column_action()) self.loadGB.clicked.connect(lambda: self._load_g_and_b()) self.clearButton.clicked.connect(self._clear_table) self.protocol_table.setSortingEnabled(True) headers = self.protocol_table.horizontalHeader() headers.setContextMenuPolicy(Qt.CustomContextMenu) headers.customContextMenuRequested.connect(self.show_header_context_menu) headers.setSelectionMode(QAbstractItemView.SingleSelection)
Example #11
Source File: uamodeler.py From opcua-modeler with GNU General Public License v3.0 | 6 votes |
def setup_context_menu_tree(self): self.ui.treeView.setContextMenuPolicy(Qt.CustomContextMenu) self.ui.treeView.customContextMenuRequested.connect(self._show_context_menu_tree) self._contextMenu = QMenu() # tree view menu self._contextMenu.addAction(self.ui.actionCopy) self._contextMenu.addAction(self.ui.actionPaste) self._contextMenu.addAction(self.ui.actionDelete) self._contextMenu.addSeparator() self._contextMenu.addAction(self.tree_ui.actionReload) self._contextMenu.addSeparator() self._contextMenu.addAction(self.ui.actionAddFolder) self._contextMenu.addAction(self.ui.actionAddObject) self._contextMenu.addAction(self.ui.actionAddVariable) self._contextMenu.addAction(self.ui.actionAddProperty) self._contextMenu.addAction(self.ui.actionAddMethod) self._contextMenu.addAction(self.ui.actionAddObjectType) self._contextMenu.addAction(self.ui.actionAddVariableType) self._contextMenu.addAction(self.ui.actionAddDataType)
Example #12
Source File: namespace_widget.py From opcua-modeler with GNU General Public License v3.0 | 6 votes |
def __init__(self, view): QObject.__init__(self, view) self.view = view self.model = QStandardItemModel() self.view.setModel(self.model) delegate = MyDelegate(self.view, self) delegate.error.connect(self.error.emit) self.view.setItemDelegate(delegate) self.node = None self.view.header().setSectionResizeMode(1) self.addNamespaceAction = QAction("Add Namespace", self.model) self.addNamespaceAction.triggered.connect(self.add_namespace) self.removeNamespaceAction = QAction("Remove Namespace", self.model) self.removeNamespaceAction.triggered.connect(self.remove_namespace) self.view.setContextMenuPolicy(Qt.CustomContextMenu) self.view.customContextMenuRequested.connect(self.showContextMenu) self._contextMenu = QMenu() self._contextMenu.addAction(self.addNamespaceAction) self._contextMenu.addAction(self.removeNamespaceAction)
Example #13
Source File: refnodesets_widget.py From opcua-modeler with GNU General Public License v3.0 | 6 votes |
def __init__(self, view): QObject.__init__(self, view) self.view = view self.model = QStandardItemModel() self.view.setModel(self.model) self.nodesets = [] self.server_mgr = None self.view.header().setSectionResizeMode(1) addNodeSetAction = QAction("Add Reference Node Set", self.model) addNodeSetAction.triggered.connect(self.add_nodeset) self.removeNodeSetAction = QAction("Remove Reference Node Set", self.model) self.removeNodeSetAction.triggered.connect(self.remove_nodeset) self.view.setContextMenuPolicy(Qt.CustomContextMenu) self.view.customContextMenuRequested.connect(self.showContextMenu) self._contextMenu = QMenu() self._contextMenu.addAction(addNodeSetAction) self._contextMenu.addAction(self.removeNodeSetAction)
Example #14
Source File: widget.py From IDArling with GNU General Public License v3.0 | 5 votes |
def __init__(self, plugin): super(StatusWidget, self).__init__() self._plugin = plugin # Create the sub-widgets def new_label(): widget = QLabel() widget.setAutoFillBackground(False) widget.setAttribute(Qt.WA_PaintOnScreen) widget.setAttribute(Qt.WA_TranslucentBackground) return widget self._servers_text_widget = new_label() self._servers_icon_widget = new_label() self._invites_text_widget = new_label() self._invites_icon_widget = new_label() self._users_text_widget = new_label() self._users_icon_widget = new_label() # Set a custom context menu policy self.setContextMenuPolicy(Qt.CustomContextMenu) self.customContextMenuRequested.connect(self._context_menu) # Timer signaling it is time to update the widget self._timer = QTimer() self._timer.setInterval(1000) self._timer.timeout.connect(self.refresh)
Example #15
Source File: parameter_tree.py From Grabber with GNU General Public License v3.0 | 5 votes |
def __init__(self, profile: dict, parent=None): """ Data table: All data is in column 0. -- 0 - Visual name. 32 - main data entry, name of parents, full data for children 33 - 0 for parent, 1 for children, 3 for custom option. 34 - Name of item that needs to be checked 35 - index for children used for active option 37 - List of QModelIndex to items that this depends on. """ super().__init__(parent=parent) self.favorite = False self.setExpandsOnDoubleClick(False) # self.setHeaderHidden(True) self.setRootIsDecorated(False) self.setHeaderHidden(True) # self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.setContextMenuPolicy(Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.contextMenu) # self.header().setSectionResizeMode(0,QHeaderView.ResizeToContents) # self.headerItem().setResizeMode(QHeaderView.ResizeToContents) # self.setItemWidget() if isinstance(profile, dict): self.load_profile(profile) else: raise TypeError(f'Expected dict, not type {type(profile)}') self.setSortingEnabled(True) self.sortByColumn(0, Qt.AscendingOrder) self.itemChanged.connect(self.make_exclusive) self.itemChanged.connect(self.check_dependency)
Example #16
Source File: panel_data.py From Dwarf with GNU General Public License v3.0 | 5 votes |
def __init__(self, app): super(DataPanel, self).__init__(app) self.app = app self.data = {} self.setOrientation(Qt.Horizontal) self._key_list_model = QStandardItemModel(0, 1) self.key_lists = DwarfListView(parent=self.app) self.key_lists.setHeaderHidden(True) self.key_lists.setModel(self._key_list_model) self.key_lists.selectionModel().selectionChanged.connect(self.item_selected) self.key_lists.setContextMenuPolicy(Qt.CustomContextMenu) self.key_lists.customContextMenuRequested.connect(self._on_context_menu) self.addWidget(self.key_lists) self.editor = QPlainTextEdit() self.addWidget(self.editor) self.hex_view = HexEditor(self.app) self.hex_view.have_context_menu = False self.hex_view.setVisible(False) self.addWidget(self.hex_view) #self.setStretchFactor(0, 8) self.setStretchFactor(1, 4) self.setStretchFactor(2, 4)
Example #17
Source File: dropdown_widget.py From Grabber with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent=None): super(DropDown, self).__init__(parent=parent) self.setDuplicatesEnabled(False) self.setContextMenuPolicy(Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.contextMenu)
Example #18
Source File: first.py From FIRST-plugin-ida with GNU General Public License v2.0 | 5 votes |
def init_signals(self): if not self.should_show: return super(FIRSTUI.CheckAll, self).init_signals() self.select_highest_ranked.stateChanged.connect(self.select_highest) self.filter_sub_funcs_only.stateChanged.connect(self.filter_only_subs) self.tree_view.clicked.connect(self.tree_clicked) # A reference is needed to the dialog or else it closes quickly # after showing self.history_dialogs = [] self.tree_view.setContextMenuPolicy(Qt.CustomContextMenu) self.tree_view.customContextMenuRequested.connect(self.custom_menu)
Example #19
Source File: Directory.py From Hydra with GNU General Public License v3.0 | 5 votes |
def __init__(self, callback, app=None, palette=None): super().__init__() directoryFont = QFont() self.app = app self.palette = palette self.currentPath: str = "" self.indexPath: str = "" directoryFont.setFamily(editor["directoryFont"]) directoryFont.setPointSize(editor["directoryFontSize"]) self.open_callback = callback self.setContextMenuPolicy(Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.openMenu) self.setFont(directoryFont) self.layout = QHBoxLayout() self.model = QFileSystemModel() self.setModel(self.model) self.model.setRootPath(QDir.rootPath()) self.setMaximumWidth(300) self.setIndentation(10) self.setAnimated(True) self.newFile() self.deleteFile() self.setSortingEnabled(True) self.setWindowTitle("Dir View") self.hideColumn(1) self.resize(200, 600) self.hideColumn(2) self.confirmation = MessageBox(self) self.hideColumn(3) self.doubleClicked.connect(self.openFile)
Example #20
Source File: history.py From gridsync with GNU General Public License v3.0 | 5 votes |
def __init__(self, gateway, deduplicate=True, max_items=30): super(HistoryListWidget, self).__init__() self.gateway = gateway self.deduplicate = deduplicate self.max_items = max_items palette = self.palette() self.base_color = palette.base().color() self.highlighted_color = BlendedColor( self.base_color, palette.highlight().color(), 0.88 ) # Was #E6F1F7 self.highlighted = None self.action_icon = QIcon(resource("dots-horizontal-triple.png")) self.setContextMenuPolicy(Qt.CustomContextMenu) self.setFocusPolicy(Qt.NoFocus) self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) # self.setSelectionMode(QAbstractItemView.ExtendedSelection) self.setSelectionMode(QAbstractItemView.NoSelection) # self.setStyleSheet("QListWidget::item:hover { background: #E6F1F7 }") self.setVerticalScrollMode(QAbstractItemView.ScrollPerPixel) self.sb = self.verticalScrollBar() self.sb.valueChanged.connect(self.update_visible_widgets) self.itemDoubleClicked.connect(self.on_double_click) self.customContextMenuRequested.connect(self.on_right_click) self.gateway.monitor.file_updated.connect(self.add_item) self.gateway.monitor.check_finished.connect( self.update_visible_widgets )
Example #21
Source File: __main__.py From Python-Application with GNU General Public License v3.0 | 5 votes |
def _set_table_style(self): # 开启水平与垂直滚轴 self.table.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) self.table.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn) # 设置 5 行 8 列 的表格 self.table.setColumnCount(8) self.table.setRowCount(5) # 设置标准宽度 self.width = self.screen.width() // 8 # 设置单元格的宽度 for i in range(8): self.table.setColumnWidth(i, self.width) # 设置单元格的高度 # 设置纵横比为 4 : 3 for i in range(5): self.table.setRowHeight(i, self.width * 4 // 3) # 隐藏标题栏 self.table.verticalHeader().setVisible(False) self.table.horizontalHeader().setVisible(False) # 禁止编辑 self.table.setEditTriggers(QAbstractItemView.NoEditTriggers) # 不显示网格线 self.table.setShowGrid(False) # 将单元格绑定右键菜单 # 点击单元格,调用 self.generateMenu 函数 self.table.setContextMenuPolicy(Qt.CustomContextMenu) self.table.customContextMenuRequested.connect(self.generate_menu)
Example #22
Source File: __main__.py From Python-Application with GNU General Public License v3.0 | 5 votes |
def _setTableStyle(self): # 开启水平与垂直滚轴 self.table.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) self.table.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn) # 设置 5 行 8 列 的表格 self.table.setColumnCount(8) self.table.setRowCount(5) # 设置标准宽度 self.width = self.screen.width()// 8 # 设置单元格的宽度 for i in range(8): self.table.setColumnWidth(i, self.width) # 设置单元格的高度 # 设置纵横比为 4 : 3 for i in range(5): self.table.setRowHeight(i, self.width * 4 // 3) # 隐藏标题栏 self.table.verticalHeader().setVisible(False) self.table.horizontalHeader().setVisible(False) # 禁止编辑 self.table.setEditTriggers(QAbstractItemView.NoEditTriggers) # 不显示网格线 self.table.setShowGrid(False) # 将单元格绑定右键菜单 # 点击单元格,调用 self.generateMenu 函数 self.table.setContextMenuPolicy(Qt.CustomContextMenu) self.table.customContextMenuRequested.connect(self.generateMenu)
Example #23
Source File: cases.py From QualCoder with MIT License | 5 votes |
def __init__(self, app, parent_textEdit): sys.excepthook = exception_handler self.app = app self.parent_textEdit = parent_textEdit QtWidgets.QDialog.__init__(self) self.ui = Ui_Dialog_cases() self.ui.setupUi(self) font = 'font: ' + str(self.app.settings['fontsize']) + 'pt ' font += '"' + self.app.settings['font'] + '";' self.setStyleSheet(font) self.load_cases_and_attributes() self.ui.pushButton_add.clicked.connect(self.add_case) self.ui.pushButton_delete.clicked.connect(self.delete_case) self.ui.tableWidget.itemChanged.connect(self.cell_modified) self.ui.tableWidget.cellClicked.connect(self.cell_selected) self.ui.pushButton_addfiles.clicked.connect(self.add_file_to_case) self.ui.pushButton_openfile.clicked.connect(self.select_file) self.ui.pushButton_add_attribute.clicked.connect(self.add_attribute) self.ui.pushButton_autoassign.clicked.connect(self.automark) self.ui.pushButton_view.clicked.connect(self.view) self.ui.pushButton_import_cases.clicked.connect(self.import_cases_and_attributes) self.ui.textBrowser.setText("") self.ui.textBrowser.setAutoFillBackground(True) self.ui.textBrowser.setContextMenuPolicy(Qt.CustomContextMenu) self.ui.textBrowser.customContextMenuRequested.connect(self.textBrowser_menu) self.ui.textBrowser.setOpenLinks(False) self.ui.textBrowser.anchorClicked.connect(self.link_clicked) self.fill_tableWidget() self.ui.splitter.setSizes([1, 1, 0])
Example #24
Source File: import_survey.py From QualCoder with MIT License | 5 votes |
def __init__(self, app, parent_textEdit): ''' Need to comment out the connection accept signal line in ui_Dialog_Import.py. Otherwise get a double-up of accept signals. ''' sys.excepthook = exception_handler self.app = app self.parent_textEdit = parent_textEdit self.delimiter = "," self.fields = [] self.filepath = "" # Set up the user interface from Designer. QtWidgets.QDialog.__init__(self) self.ui = Ui_Dialog_Import() self.ui.setupUi(self) font = 'font: ' + str(self.app.settings['fontsize']) + 'pt ' font += '"' + self.app.settings['font'] + '";' self.setStyleSheet(font) self.ui.lineEdit_delimiter.setText(self.delimiter) self.ui.lineEdit_delimiter.textChanged.connect(self.options_changed) self.ui.comboBox_quote.currentIndexChanged['QString'].connect(self.options_changed) self.ui.tableWidget.setHorizontalHeaderLabels([""]) self.ui.tableWidget.horizontalHeader().setContextMenuPolicy(Qt.CustomContextMenu) self.ui.tableWidget.horizontalHeader().customContextMenuRequested.connect(self.table_menu) cur = self.app.conn.cursor() cur.execute("select name from attribute_type where caseOrFile='case'") result = cur.fetchall() self.preexisting_fields = [] for row in result: self.preexisting_fields.append({'name': row[0]}) self.get_csv_file() if self.fields == []: super(DialogImportSurvey, self).reject() self.parent_textEdit.append(_("Survey not imported.")) self.fill_tableWidget()
Example #25
Source File: dialog_sql.py From QualCoder with MIT License | 5 votes |
def __init__(self, app, parent_textEdit): sys.excepthook = exception_handler QtWidgets.QDialog.__init__(self) self.app = app self.parent_textEdit = parent_textEdit self.queryTime = "" self.queryFilters = "" textEditSql = "" # Set up the user interface from Designer. self.ui = Ui_Dialog_sql() self.ui.setupUi(self) font = 'font: ' + str(self.app.settings['fontsize']) + 'pt ' font += '"' + self.app.settings['font'] + '";' self.setStyleSheet(font) #self.setWindowTitle("Query: " + self.queryname) self.ui.treeWidget.setContextMenuPolicy(Qt.CustomContextMenu) highlighter = Highlighter(self.ui.textEdit_sql) self.ui.textEdit_sql.setContextMenuPolicy(Qt.CustomContextMenu) self.ui.textEdit_sql.customContextMenuRequested.connect(self.sql_menu) # fill textEdit_sql from queryname self.ui.textEdit_sql.setText(textEditSql) self.ui.tableWidget_results.setContextMenuPolicy(Qt.CustomContextMenu) self.ui.tableWidget_results.customContextMenuRequested.connect(self.table_menu) # Add tables and fields to treeWidget self.get_schema_update_treeWidget() self.ui.treeWidget.itemClicked.connect(self.get_item) self.ui.pushButton_runSQL.clicked.connect(self.run_SQL) self.ui.pushButton_export.clicked.connect(self.export_file) self.ui.splitter.setSizes([20, 180]) self.ui.splitter_2.setSizes([10, 290])
Example #26
Source File: mainwindow.py From opcua-client-gui with GNU General Public License v3.0 | 5 votes |
def setup_context_menu_tree(self): self.ui.treeView.setContextMenuPolicy(Qt.CustomContextMenu) self.ui.treeView.customContextMenuRequested.connect(self._show_context_menu_tree) self._contextMenu = QMenu() self.addAction(self.ui.actionCopyPath) self.addAction(self.ui.actionCopyNodeId) self._contextMenu.addSeparator() self._contextMenu.addAction(self.ui.actionCall) self._contextMenu.addSeparator()
Example #27
Source File: file_table.py From parsec-cloud with GNU Affero General Public License v3.0 | 5 votes |
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.previous_selection = [] self.setColumnCount(len(Column)) h_header = self.horizontalHeader() h_header.setDefaultAlignment(Qt.AlignLeft | Qt.AlignVCenter) for col in Column: h_header.setSectionResizeMode(col, QHeaderView.Fixed) self.setColumnWidth(Column.ICON, 50) self.setColumnWidth( Column.NAME, max(self.size().width() - FileTable.FIXED_COL_SIZE, FileTable.NAME_COL_MIN_SIZE), ) self.setColumnWidth(Column.CREATED, 200) self.setColumnWidth(Column.UPDATED, 200) self.setColumnWidth(Column.SIZE, 100) v_header = self.verticalHeader() v_header.setSectionResizeMode(QHeaderView.Fixed) v_header.setDefaultSectionSize(48) self.setItemDelegate(ItemDelegate()) self.setContextMenuPolicy(Qt.CustomContextMenu) self.itemSelectionChanged.connect(self.change_selection) self.customContextMenuRequested.connect(self.show_context_menu) self.cellDoubleClicked.connect(self.item_double_clicked) self.cellClicked.connect(self.item_clicked) self.current_user_role = WorkspaceRole.OWNER self.paste_disabled = True effect = QGraphicsDropShadowEffect(self) effect.setColor(QColor(34, 34, 34, 25)) effect.setBlurRadius(8) effect.setXOffset(0) effect.setYOffset(2) self.setGraphicsEffect(effect)
Example #28
Source File: first.py From FIRST-plugin-ida with GNU General Public License v2.0 | 5 votes |
def init_signals(self): if self.should_show: super(FIRSTUI.CheckAll, self).init_signals() self.tree_view.clicked.connect(self.tree_clicked) # A reference is needed to the dialog or else it closes quickly # after showing self.history_dialogs = [] self.tree_view.setContextMenuPolicy(Qt.CustomContextMenu) self.tree_view.customContextMenuRequested.connect(self.custom_menu)
Example #29
Source File: part-4.py From Writer-Tutorial with MIT License | 5 votes |
def initUI(self): self.text = QtWidgets.QTextEdit(self) # Set the tab stop width to around 33 pixels which is # more or less 8 spaces self.text.setTabStopWidth(33) self.initToolbar() self.initFormatbar() self.initMenubar() self.setCentralWidget(self.text) # Initialize a statusbar for the window self.statusbar = self.statusBar() # If the cursor position changes, call the function that displays # the line and column number self.text.cursorPositionChanged.connect(self.cursorPosition) # We need our own context menu for tables self.text.setContextMenuPolicy(Qt.CustomContextMenu) self.text.customContextMenuRequested.connect(self.context) self.text.textChanged.connect(self.changed) self.setGeometry(100,100,1030,800) self.setWindowTitle("Writer") self.setWindowIcon(QtGui.QIcon("icons/icon.png"))
Example #30
Source File: users_widget.py From parsec-cloud with GNU Affero General Public License v3.0 | 5 votes |
def __init__( self, user_id, user_display, is_current_user, is_admin, certified_on, is_revoked, current_user_is_admin, ): super().__init__() self.setupUi(self) self.current_user_is_admin = current_user_is_admin self.is_admin = is_admin self.is_revoked = is_revoked self._is_revoked = is_revoked self.certified_on = certified_on self.is_current_user = is_current_user self.user_id = user_id self.user_display = user_display self.label_username.setText(user_display) self.user_icon.apply_style() self.setContextMenuPolicy(Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.show_context_menu) self.label_created_on.setText(format_datetime(self.certified_on, full=True)) self.label_role.setText( _("TEXT_USER_ROLE_ADMIN") if self.is_admin else _("TEXT_USER_ROLE_CONTRIBUTOR") ) if self.is_current_user: self.label_user_is_current.setText("({})".format(_("TEXT_USER_IS_CURRENT"))) effect = QGraphicsDropShadowEffect(self) effect.setColor(QColor(0x99, 0x99, 0x99)) effect.setBlurRadius(10) effect.setXOffset(2) effect.setYOffset(2) self.setGraphicsEffect(effect)