def show_game_context(self): gamelist = self.get_current_list() if gamelist[0].itemAt(gamelist[0].mapFromGlobal(QCursor.pos())) is gamelist[0].currentItem(): if gamelist[1] == 0: self.installedGames_menu.exec_(QCursor.pos()) else: self.ownedGames_menu.exec_(QCursor.pos())
def show_game_context(self): gamelist = self.get_current_list() if gamelist[0].itemAt(gamelist[0].mapFromGlobal( QCursor.pos())) is gamelist[0].currentItem(): if gamelist[1] == 0: self.installedGames_menu.exec_(QCursor.pos()) else: self.ownedGames_menu.exec_(QCursor.pos())
def mouse_position(self): """ Returns the current mouse position (in screen coordinates) as a tuple of the form: (x,y). """ position = QCursor.pos() return (position.x(), position.y())
def popup_menu(self, position): selected_row = self.view.rowAt(position.y()) if selected_row >= 0 and self._used_categories and len( self._used_categories) > 1: category_menu = QMenu(_("Categories")) selected_doc = self.model.object_at(selected_row) category_actions = [] for category in self._used_categories: a = QAction(category.full_name, category_menu) a.setData(category) a.setEnabled(selected_doc.document_category_id != category.document_category_id) category_menu.addAction(a) category_actions.append(a) action = category_menu.exec_(QCursor.pos()) if action: new_category = action.data() if selected_doc.document_category_id != new_category.document_category_id: selected_doc.document_category_id = new_category.document_category_id self.model.signal_object_change(selected_doc)
def __init__(self, define_path='', define_type=None): super(MTTFilterFileDialog, self).__init__(get_maya_window()) self.supported_node_type = sorted([ node_type for (node_type, nice, attr) in MTTSettings.SUPPORTED_TYPE ]) self.defined_path = (define_path if os.path.isdir(define_path) or define_path == SOURCEIMAGES_TAG else None) self.defined_type = (define_type if define_type in self.supported_node_type else None) self.path_edit = None self.filter_reset_btn = None self.filter_line = None self.parent_folder_btn = None self.files_model = None self.files_list = None self.bookmark_list = None self.bookmark_list_sel_model = None self.types = None # move window to cursor position win_geo = MTTSettings.value('FilterFileDialog/windowGeometry', QRect(0, 0, 400, 300)) self.setGeometry(win_geo) mouse_pos = QCursor.pos() mouse_pos.setX(mouse_pos.x() - (win_geo.width() * 0.5)) self.move(mouse_pos) self.__create_ui() self.filter_line.setFocus() self.on_change_root_path(self.defined_path or SOURCEIMAGES_TAG)
def wake_screen(): import random, time from PySide.QtGui import QCursor time.sleep(5) q = QCursor() pos = q.pos() ox, oy = pos.x(), pos.y() def rgen(): r = 300 while 1: theta = math.radians(random.random() * 360) x = r * math.cos(theta) y = r * math.sin(theta) yield ox + x, oy + y random_point = rgen() for i in range(5): x, y = random_point.next() q.setPos(x, y) time.sleep(0.1) q.setPos(ox, oy)
def loadContextMenu(self, *args): menu = QMenu(self.w_tree) path = self.w_tree.currentItem().text(0) if os.path.isdir(path): dirPath = path else: dirPath = os.path.dirname(path) if os.path.exists(dirPath): menu.addAction(unicode("Open Folder", errors='replace'), self.openFolder) menu.addAction(unicode("Copy Path", errors='replace'), self.copyPath) separator = QAction(self.w_tree) separator.setSeparator(True) menu.addAction(separator) menu.addAction(unicode("Replace Path", errors='replace'), self.replacePath) separator = QAction(self.w_tree) separator.setSeparator(True) menu.addAction(separator) if self.unusedExists(): menu.addAction(unicode("Remove Unused Files", errors='replace'), self.removeUnused) pos = QCursor.pos() point = QtCore.QPoint(pos.x() + 10, pos.y()) menu.exec_(point)
def leaveEvent(self,event): r = self.edit_panel.geometry() # Tested this, but it doesn't work : if self.edit_panel.underMouse() == False: if not self.edit_panel.rect().contains(self.edit_panel.mapFromGlobal(QCursor.pos())): self.edit_panel.hide() return super(PoppingContactDataPlateWidget,self).leaveEvent(event)
def wake_screen(): import random, time from PySide.QtGui import QCursor time.sleep(5) q = QCursor() pos = q.pos() ox, oy = pos.x(), pos.y() def rgen(): r = 300 while 1: theta = math.radians(random.random() * 360) x = r * math.cos(theta) y = r * math.sin(theta) yield ox + x, oy + y random_point = rgen() for i in range(5): x, y = random_point.next() q.setPos(x, y) time.sleep(0.1) q.setPos(ox, oy)
def menuHovered(self, action): settings = QSettings() if bool( int( settings.value(Gopt.Key.ShowMenuToolTips, Gopt.Default.ShowMenuToolTips))): tip = action.toolTip() if tip: QToolTip.showText(QCursor.pos(), tip, self)
def ExampleMenu_Execute(): """a simple example showing the use of a qmenu""" from PySide import shiboken sianchor = Application.getQtSoftimageAnchor() sianchor = shiboken.wrapInstance( long(sianchor), QWidget ) menu = ExampleMenu( sianchor ) # notice the use of QCursor and exec_ call menu.exec_(QCursor.pos())
def paintEvent(self, event): mouse_pos = self.mapFromGlobal(QCursor.pos()) is_hover = self.contentsRect().contains(mouse_pos) QPushButton.paintEvent(self, event) painter = QPainter(self) painter.drawPixmap(2, 1, self.icon) if is_hover: painter.setCompositionMode(QPainter.CompositionMode_Screen) painter.drawPixmap(2, 1, self.icon)
def loadContextMenu(self): def cmd_loadSelected(): selObjects = pymel.core.ls(sl=1) if not selObjects: return cuItem = self.treeWidget.currentItem() cuItem.setText(1, selObjects[0].name()) menu = QMenu(self.treeWidget) menu.addAction("Load Object", cmd_loadSelected) pos = QCursor.pos() point = QtCore.QPoint(pos.x() + 10, pos.y()) menu.exec_(point)
def _customMenu(self): selectedItems = self.pushupsListWidget.selectedItems() if selectedItems is not None : selectedItem = selectedItems[0] if selectedItem.parent() is not None : # Child Item selected menu = QMenu() delete = QAction(self.pushupsListWidget) delete.setText("Delete this pushup") delete.triggered.connect(self._emitDeleteSignal) menu.addAction(delete) menu.exec_(QCursor.pos()) else : # Top level Item selected menu = QMenu() delete = QAction(self.pushupsListWidget) delete.setText("Delete this day and all of its exercises") delete.triggered.connect(self._emitDeleteDaySignal) menu.addAction(delete) menu.exec_(QCursor.pos())
def _customMenu(self): selectedItems = self.pushupsListWidget.selectedItems() if selectedItems is not None: selectedItem = selectedItems[0] if selectedItem.parent() is not None: # Child Item selected menu = QMenu() delete = QAction(self.pushupsListWidget) delete.setText("Delete this pushup") delete.triggered.connect(self._emitDeleteSignal) menu.addAction(delete) menu.exec_(QCursor.pos()) else: # Top level Item selected menu = QMenu() delete = QAction(self.pushupsListWidget) delete.setText("Delete this day and all of its exercises") delete.triggered.connect(self._emitDeleteDaySignal) menu.addAction(delete) menu.exec_(QCursor.pos())
def isFocusWidget(): """ return true if the global qApp has any focused widgets """ from PySide.QtGui import QApplication, QCursor focus = False if QApplication.instance(): if QApplication.instance().focusWidget(): window = QApplication.instance().focusWidget().window() geom = window.geometry() focus = geom.contains( QCursor.pos() ) return focus
def show( evt=0 ): if cmds.window( Window_global.objectName, ex=1 ): cmds.deleteUI( Window_global.objectName ) Window_global.mainGui = Window(Window_global.mayaWin) Window_global.mainGui.setObjectName( Window_global.objectName ) pos = Window_global.mainGui.mapFromGlobal( QCursor.pos() ) Window_global.mainGui.move( pos.x()-25, pos.y()-63 ) Window_global.mainGui.resize( Window_global.width, Window_global.height ) Window_global.mainGui.show()
def wheelEvent(self, eventQWheelEvent): oldscale = self.scale self.scale += eventQWheelEvent.delta() / 1200.0 if (self.scale < 0.1): self.scale = oldscale screenpoint = self.mapFromGlobal(QCursor.pos()) dx, dy = screenpoint.x(), screenpoint.y() oldpoint = (screenpoint.x() + self.position[0], screenpoint.y() + self.position[1]) newpoint = (oldpoint[0] * (self.scale / oldscale), oldpoint[1] * (self.scale / oldscale)) self.position = (newpoint[0] - dx, newpoint[1] - dy) print(self.position[0]) print(self.position[1]) print(" ") self.update()
def set_mouse_position(self, coord): """ Update the mouse cursor position independently """ _new_pos = ViewState().getPointOnScreen(coord) #set the mouse position at the updated screen coordinate _delta_pos = _new_pos.sub(Vector(self.pos + (0.0, ))) #get screen position by adding offset to the new window position _pos = Vector(QCursor.pos().toTuple() + (0.0, )).add( Vector(_delta_pos.x, -_delta_pos.y)) QCursor.setPos(_pos[0], _pos[1]) self.coordinates = Vector(coord) self.set_position(_new_pos)
def showAttributeMenu(self, attribute): m = QMenu() m.addAction('Overlay/Filter') c = m.addMenu('Compare to') for h in self.headers: c.addAction(h) m.addAction('Sort...') choice = m.exec_(QCursor.pos()) if choice != None: choice = choice.text() if choice == 'Overlay/Filter': self.changeOverlay(attribute) elif choice == 'Sort...': # TODO pass else: self.showScatterplot(choice,attribute)
def set_mouse_position(self, view_state, coord): """ Update the mouse cursor position independently """ _new_pos = view_state.getPointOnScreen(coord) #set the mouse position at the updated screen coordinate _delta_pos = SmartTuple(_new_pos).sub(self.screen_position) #get screen position by adding offset to the new window position _pos = SmartTuple.from_values(_delta_pos[0], -_delta_pos[1])\ .add(QCursor.pos().toTuple()) QCursor.setPos(_pos[0], _pos[1]) self.screen_position = _pos self.world_position = coord
def moveEvent(self, event): if self.isFloating(): cursor_widget = self.app.widgetAt(QCursor.pos()) if cursor_widget and (self.parent() is not cursor_widget.window()): target = cursor_widget while target and not isinstance(target, (View, Window)): target = target.parent() if isinstance(target, View): if not self.isAreaAllowed(target.dock_area) or \ not target.parent().accepts_view(self): target = None if isinstance(target, Window): if target.findChild(View) or not target.accepts_view(self): target = None self.redock_target = target else: self.redock_target = None return super(View, self).moveEvent(event)
def paintEvent(self, event): mouse_pos = self.mapFromGlobal(QCursor.pos()) is_hover = self.contentsRect().contains(mouse_pos) if not self.new_ui: QPushButton.paintEvent(self, event) painter = QPainter(self) if self.new_ui and self.isChecked(): painter.setRenderHint(QPainter.Antialiasing) painter.setPen(QPen(Qt.NoPen)) painter.setBrush(self.highlight) painter.drawRoundedRect(event.rect(), 2, 2) painter.drawPixmap(2, 2, self.icon) if is_hover: painter.setCompositionMode(QPainter.CompositionMode_Screen) painter.drawPixmap(2, 2, self.icon)
def set_mouse_position(self, view_state, coord=None): """ Update the mouse cursor position independently coord - position in world coordinates """ if not coord: coord = self.world_position _new_pos = view_state.getPointOnScreen(coord) #set the mouse position at the updated screen coordinate _delta = SmartTuple._sub(_new_pos, self.screen_position) #get screen position by adding offset to the new window position _pos = SmartTuple._add((_delta[0], -_delta[1]), QCursor.pos().toTuple()) QCursor.setPos(_pos[0], _pos[1]) self.world_position = coord
def capture(self): app.processEvents() print "caught capture",('tmp_{}_{:'+self.fmt+'}.jpg').format(self.UID,self.capture_count) print "current fps",float(self.capture_count)/(time.time()-self.start_capture_time) if not self.snap_shots.queue.empty(): self.snap_shots.queue.get(0) arrow = QPixmap(self.arrow_icon); self.px = QPixmap.grabWindow(QApplication.desktop().winId()) painter = QPainter(self.px) painter.drawPixmap(QCursor.pos(), arrow) if(self.options.capture_area_sa.isChecked()): self.px2 = self.px.copy(self.options.sa_x.value(), self.options.sa_y.value(), self.options.sa_w.value(), self.options.sa_h.value()) else: self.px2 = self.px self.px2.save(('tmp_{}_{:'+self.fmt+'}.jpg').format(self.UID,self.capture_count), 'jpg') self.capture_count+=1
def __init__(self, define_path='', define_type=None): super(MTTFilterFileDialog, self).__init__(get_maya_window()) self.supported_node_type = sorted( [node_type for (node_type, nice, attr) in MTTSettings.SUPPORTED_TYPE]) self.defined_path = ( define_path if os.path.isdir(define_path) or define_path == SOURCEIMAGES_TAG else None) self.defined_type = ( define_type if define_type in self.supported_node_type else None) self.path_edit = None self.filter_reset_btn = None self.filter_line = None self.parent_folder_btn = None self.files_model = None self.files_list = None self.bookmark_list = None self.bookmark_list_sel_model = None self.types = None # move window to cursor position win_geo = MTTSettings.value( 'FilterFileDialog/windowGeometry', QRect(0, 0, 400, 300)) self.setGeometry(win_geo) mouse_pos = QCursor.pos() mouse_pos.setX(mouse_pos.x() - (win_geo.width() * 0.5)) self.move(mouse_pos) self.__create_ui() self.filter_line.setFocus() self.on_change_root_path(self.defined_path or SOURCEIMAGES_TAG)
def open_new_shader_menu(): """ Open menu using QMenu with all maps :return: """ try: from PySide.QtGui import QMenu, QAction, QCursor except: from PySide2.QtGui import QCursor from PySide2.QtWidgets import QMenu, QAction maps = SuperShader._get_maps() if not maps: return menu = QMenu(hou.ui.mainQtWindow()) menu.setStyleSheet(hou.ui.qtStyleSheet()) for m in maps: if m.get('allow_creation'): menu.addAction(QAction(m['name'], menu)) act = menu.exec_(QCursor.pos()) if not act: return new_shader_map = ([x for x in maps if x['name'] == act.text()] or [None])[0] return new_shader_map
def layout_list_contextMenu(self, pos): menu = QMenu() default_action = menu.addAction(self.tr("Reset Layout")) default_action.triggered.connect(self.on_default_layout) menu.exec_(QCursor.pos())
def paint(self, painter, option, index): """ Re-implementation of the paint method. This will render a stream item that contains an icon, the name, a description, the game being played, and a dropdown menu. """ super(StreamItemDelegate, self).paint(painter, option, index) stream = index.data() if option.state & QStyle.State_MouseOver: painter.fillRect(option.rect, option.palette.color(QPalette.Highlight)) painter.setPen(Qt.white) else: painter.setPen(Qt.black) # I'll have a rectangle pls. r = option.rect # Draw the Service icon (Twitch, etc) icon = get_service_icon(stream.service) icon_size = 16 icon_offset = (r.height()/2) - (icon_size/2) if stream.status == 0: #offline icon.paint(painter, r.left()+10, r.top()+icon_offset, icon_size, icon_size, Qt.AlignLeft | Qt.AlignVCenter, mode=QIcon.Disabled) else: icon.paint(painter, r.left()+10, r.top()+icon_offset, icon_size, icon_size, Qt.AlignLeft | Qt.AlignVCenter, mode=QIcon.Normal) # Paint the stream name painter.drawText(r.left()+40, r.top()-8, r.width(), r.height(), Qt.AlignVCenter | Qt.AlignLeft, stream.name) # Paint the game name, if any. painter.save() name_len = painter.fontMetrics().width(stream.name) font = painter.font() font.setPixelSize(9) font.setItalic(True) painter.setFont(font) painter.setPen(QColor(*get_game_colour(stream.game))) # Position of the left edge + the length of the name text + the offset of the stream name + an additional offset for padding. painter.drawText((r.left()+name_len)+40, r.top()-8, r.width(), r.height(), Qt.AlignVCenter | Qt.AlignLeft, stream.game) painter.restore() # Paint a dropdown button for options. x1 = 50; y1 = 8; iw = 9; ih = 6; orect = r.adjusted(name_len+x1, y1, -(r.width()-(name_len+x1+iw)), -(r.height()-(y1+ih))) # Rectangle to store the dropdown icon hrect = orect.adjusted(-4, -3, 6, 5) # Rectangle to hover within. hbg = orect.adjusted(-2, -1, 2, 1) # Rectangle to draw the rounded background in options_button = QStyleOptionButton() # Cursor must be translated to relative positioning via the parent widget, note that is this is not a widget. if hrect.contains(self.parent.mapFromGlobal(QCursor.pos())): # Hover event for the dropdown options button options_button.icon = self.icons["down_hover"] # Draw a background behind the icon painter.save() painter.setRenderHints(painter.Antialiasing | painter.HighQualityAntialiasing) painter.setPen(QPen(QColor(101, 99, 98))) painter.setBrush(QBrush(QColor(101, 99, 98))) painter.drawRoundRect(QRectF(hbg), 10.0, 5.0) painter.restore() else: options_button.icon = self.icons["down_default"] options_button.iconSize = QSize(iw, ih) options_button.rect = orect options_button.features = QStyleOptionButton.Flat # Paint a Push Button Control. QApplication.style().drawControl(QStyle.CE_PushButton, options_button, painter) # Paint the description/status? painter.save() if stream.status == 0: #offline painter.setPen(Qt.darkGray) painter.drawText(r.left()+40, r.top()+8, r.width(), r.height(), Qt.AlignVCenter | Qt.AlignLeft, "Offline") else: painter.setPen(Qt.darkGreen) painter.drawText(r.left()+40, r.top()+8, r.width(), r.height(), Qt.AlignVCenter | Qt.AlignLeft, stream.channel.status) painter.restore()
def handleInspectorMenu(self, pos): menu = QMenu() menu.addAction('Add') menu.addAction('Delete') menu.exec_(QCursor.pos())
def showIndividualContextMenu(self, person): actionLookup = {} m = QMenu() actionLookup['Show Details'] = m.addAction('Show Details') # TODO: Add to / remove from path targets m.addSeparator() a = m.addMenu('Set A as') b = m.addMenu('Set B as') for label1 in AppState.ADDITION_ITERATOR_ORDER: a2 = a.addMenu(label1) b2 = b.addMenu(label1) for label2 in AppState.LEVEL_OPTION_ORDER: actionLookup[('Set A as', self.additionIterators[label1], AppState.LEVEL_OPTIONS[label2])] = a2.addAction(label2) actionLookup[('Set B as', self.additionIterators[label1], AppState.LEVEL_OPTIONS[label2])] = b2.addAction(label2) m.addSeparator() actionLookup['Trim Parents'] = m.addAction('Trim Parents') actionLookup['Trim Spouses'] = m.addAction('Trim Spouses') actionLookup['Trim Children'] = m.addAction('Trim Children') if not person in self.aSet and not person in self.bSet: actionLookup['Trim Parents'].setDisabled(True) actionLookup['Trim Spouses'].setDisabled(True) actionLookup['Trim Children'].setDisabled(True) m.addSeparator() for label1 in AppState.ADDITION_ITERATOR_ORDER: temp = m.addMenu('Expand '+label1) for label2 in AppState.LEVEL_OPTION_ORDER: actionLookup[('Expand', self.additionIterators[label1], AppState.LEVEL_OPTIONS[label2])] = temp.addAction(label2) choice = m.exec_(QCursor.pos()) if choice != None: for menus,action in actionLookup.iteritems(): if action == choice: if menus == 'Show Details': self.showIndividualDetails(person) elif menus == 'Trim Parents': self.snip(person, [self.ped.CHILD_TO_PARENT]) elif menus == 'Trim Spouses': self.snip(person, [self.ped.HUSBAND_TO_WIFE, self.ped.WIFE_TO_HUSBAND]) elif menus == 'Trim Children': self.snip(person, [self.ped.PARENT_TO_CHILD]) else: assert isinstance(menus,tuple) newSet = set(menus[1](person,level=menus[2])) if menus[0] == 'Set A as': historyID = self.addPedigree(newSet) self.changePedigreeA(historyID) elif menus[0] == 'Set B as': historyID = self.addPedigree(newSet) self.changePedigreeB(historyID) elif menus[0] == 'Expand': self.expand(person, newSet) break
def show_menu(self): self.popup(QCursor.pos()) self.show()
def handleInspectorMenu(self, pos): menu = QMenu() menu.addAction("Add") menu.addAction("Delete") menu.exec_(QCursor.pos())
def on_mouse_released(self, button, pos): if button == Qt.RightButton: # right click # display the context menu self.disasm_view.instruction_context_menu(self.insn, QCursor.pos())
def setPositionByCursor(self, offsetX=0, offsetY=0): if not offsetX: offsetX = 0 if not offsetY: offsetY = 0 pos = QCursor.pos() self.move(pos.x() + offsetX, pos.y() + offsetY)
def showMenu(self, reason): # show menu also on left click self.contextMenu().exec_(QCursor.pos())
def showMenu( self ): if QRect(0, 0, self.width(), 20).contains(self.mapFromGlobal(QCursor.pos())): self._accordianWidget.emitItemMenuRequested(self)
def handleEvents(self, event, signals): att = self.axisOrder[self.findAxisIndex(event.x)] # context menu if event.contextRequested: contextMenu = QMenu(self) contextMenu.addAction(u'Select all') contextMenu.addAction(u'Select none') contextMenu.addSeparator() act = QAction(u'Hide Axis', self) contextMenu.addAction(act) if len(self.axisOrder) <= 1: act.setEnabled(False) axesMenu = QMenu(u'Show/Hide Axes', self) axesActions = QActionGroup(self) for a in self.axisOrder: act = QAction(a,self,checkable=True) if self.axes[a].visible: act.toggle() if len(self.axisOrder) <= 1: act.setEnabled(False) axesActions.addAction(act) for act in axesActions.actions(): axesMenu.addAction(act) contextMenu.addMenu(axesMenu) contextMenu.addSeparator() contextMenu.addAction(u'Use as X axis') contextMenu.addAction(u'Use as Y axis') resultAction = contextMenu.exec_(QCursor.pos()) if resultAction != None and resultAction != 0: # Select all if resultAction.text() == u'Select all': self.app.intMan.newOperation(operation.ALL,att=att.dataAxis) # Select none if resultAction.text() == u'Select none': self.app.intMan.newOperation(operation.NONE,att=att.dataAxis) # Hide axis if resultAction.text() == u'Hide Axis': self.toggleVisible(att) # Toggle axis if resultAction.actionGroup() == axesActions: self.toggleVisible(resultAction.text()) # X axis if resultAction.text() == u'Use as X axis': if self.app.currentYattribute != self.app.currentXattribute: self.axes[self.app.currentXattribute].visAxis.handle.background.setAttribute('fill',self.normalHandleColor) self.axes[self.app.currentXattribute].visAxis.handle.originalBackgroundColor = self.normalHandleColor self.axes[att].visAxis.handle.background.setAttribute('fill',self.activeHandleColor) self.axes[att].visAxis.handle.originalBackgroundColor = self.activeHandleColor self.app.notifyAxisChange(att,xAxis=True) # Y axis if resultAction.text() == u'Use as Y axis': if self.app.currentXattribute != self.app.currentYattribute: self.axes[self.app.currentYattribute].visAxis.handle.background.setAttribute('fill',self.normalHandleColor) self.axes[self.app.currentYattribute].visAxis.handle.originalBackgroundColor = self.normalHandleColor self.axes[att].visAxis.handle.background.setAttribute('fill',self.activeHandleColor) self.axes[att].visAxis.handle.originalBackgroundColor = self.activeHandleColor self.app.notifyAxisChange(att,xAxis=False) #if linesMoved: # self.highlightedLayer.refreshLines(self.app.highlightedRsNumbers) return signals
def addEffectsClicked(self): self.presenter.addEffectsClicked(QCursor.pos())
def _get_closest_editor(self): pos = QCursor.pos() key = lambda w: QtGui.QVector2D(pos - w.pos()).lengthSquared() all_widgets = self.get_dock_widgets() if all_widgets: return min(all_widgets, key=key)
def layout_list_contextMenu(self, pos): menu = QMenu() default_action = menu.addAction(self.tr("Reset Layout")) default_action.triggered.connect(self.on_default_layout) menu.exec_(QCursor.pos())
def toggleTabTabTab(): if hiero.ui.tabtabtab.isHidden(): hiero.ui.tabtabtab.showAt(QCursor.pos()) else: hiero.ui.tabtabtab.hide()
def _get_mouse_position ( self ): pos = QCursor.pos() return ( pos.x(), pos.y() )
def handleInspectorMenu(self, pos): menu = QMenu() menu.addAction('Add') menu.addAction('Delete') menu.exec_(QCursor.pos())
def _get_closest_editor(self): pos = QCursor.pos() key = lambda w: QtGui.QVector2D(pos - w.pos()).lengthSquared() all_widgets = self.get_dock_widgets() if all_widgets: return min(all_widgets, key=key)
def loadContextMenu(self): pos = QCursor.pos() point = QtCore.QPoint(pos.x() + 10, pos.y()) self.exec_(point)
def showMenu(self): self.widget.right_clicked = True # set the widget's right_clicked variable to True so that the focusOutEvent won't push anything to the undo stack as a consequence of right-clicking self.popup(QCursor.pos()) self.widget.right_clicked = False # immediately reset the widget's right_clicked variable back to False
def popup_context_menu(self, position): self.days_off_menu.exec_(QCursor.pos())
def _activate_traymenu(self, reason): if reason == QSystemTrayIcon.ActivationReason.Trigger: self.showNormal() else: self.trayIconMenu.activateWindow() self.trayIconMenu.popup(QCursor.pos())
def getMousePos(cls): pos = QCursor.pos() pos_map = Jaime.instance.view.mapFromGlobal(pos) return pos_map