コード例 #1
0
ファイル: test_angr_gui.py プロジェクト: angr/binsync
 def click_sync_menu(self, table, obj_name):
     """
     Syncs from the first entry in a context menu for a given table and menu object name
     """
     table.contextMenuEvent(
         QContextMenuEvent(QContextMenuEvent.Mouse, QPoint(0, 0)))
     context_menu = next(
         filter(
             lambda x: isinstance(x, QMenu) and x.objectName() == obj_name,
             QApplication.topLevelWidgets()))
     # triple check we got the right menu
     assert (context_menu.objectName() == obj_name)
     sync_action = next(
         filter(lambda x: x.text() == "Sync", context_menu.actions()))
     sync_action.trigger()
コード例 #2
0
ファイル: frontend.py プロジェクト: whattheserver/py3qterm
 def mousePressEvent(self, event):
     button = event.button()
     if button == Qt.RightButton:
         ctx_event = QContextMenuEvent(QContextMenuEvent.Mouse, event.pos())
         self.contextMenuEvent(ctx_event)
         self._press_pos = None
     elif button == Qt.LeftButton:
         self._press_pos = event.pos()
         self._selection = None
         self.update_screen()
     elif button == Qt.MiddleButton:
         self._press_pos = None
         self._selection = None
         text = str(self._clipboard.text(QClipboard.Selection))
         self.send(text.encode("utf-8"))