프로젝트

일반

사용자정보

개정판 eb8b59ed

IDeb8b59ed12eeb2b36c94717ec8d66f25fc9cfbf3
상위 58e46c3b
하위 685f4df9, 427ae4f8

GeunHo Song 이(가) 약 2년 전에 추가함

issue #000 Save, Save As가지 기능에 대해 Context Menu 제공

차이점 보기:

HYTOS/HYTOS/QtImageViewer.py
106 106
        # set currentAttribute
107 107
        self.currentAttribute = ''
108 108

  
109
        self.menu = QMenu(self.mainWindow)
110

  
111
        self.contextMenuGroup = QActionGroup(self)
112
        self.lineContextMenuGroup = QActionGroup(self)
113
        self.selectionToolMenu = QAction(QIcon(":/images/Selection.svg"), 'Selection Tool')
114
        self.selectionToolMenu.setCheckable(True)
115
        self.selectionHandToolMenu = QAction(QIcon(":/images/Hand.svg"), 'Hand Tool')
116
        self.selectionHandToolMenu.setCheckable(True)
117
        self.streamLineToolMenu = QAction(QIcon(":/images/Stream_Line.svg"), 'Stream Line')
118
        self.streamLineToolMenu.setCheckable(True)
119

  
120
        self.selectionToolMenu.toggled.connect(self.selection_toolMenu_toggle)
121
        self.selectionHandToolMenu.toggled.connect(self.selection_handToolMenu_toggle)
122
        self.streamLineToolMenu.toggled.connect(self.stream_line_toolmenu_toggle)
123

  
124
        self.contextMenuGroup.addAction(self.selectionHandToolMenu)
125
        self.contextMenuGroup.addAction(self.selectionToolMenu)
126

  
127
        self.lineContextMenuGroup.addAction(self.streamLineToolMenu)
128
        # Menu Order
129
        self.menu.addAction(self.selectionToolMenu)
130
        self.menu.addAction(self.selectionHandToolMenu)
131
        self.menu.addAction(self.streamLineToolMenu)
132

  
133

  
134

  
109 135
    '''
110 136
        @brief      Return Pixmap Handler
111 137
        @author     Jeongwoo
......
213 239

  
214 240
        return fileName
215 241

  
242
    def contextMenuEvent(self, event):  # real signature unknown; restored from __doc__
243
        from App import App
244
        try:
245
            if not self.scene.selectedItems():
246
                scenePos = self.mapToGlobal(event.pos())
247
                scenePos = QPoint(scenePos.x(), scenePos.y())
248
                self.menu.exec(scenePos)
249
            else:
250
                self.selection_toolMenu_toggle(True)
251
                super(QtImageViewer, self).contextMenuEvent(event)
252

  
253
        except Exception as ex:
254
            from App import App
255
            from AppDocData import MessageType
256

  
257
            message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \
258
                      f"{sys.exc_info()[-1].tb_lineno}"
259
            App.mainWnd().addMessage.emit(MessageType.Error, message)
216 260
    def selection_handToolMenu_toggle(self, checked):
217 261
        if checked and self.command is not None:
218 262
            self.command = HandCommand.HandCommand(self)
......
225 269
            self.setDragMode(QGraphicsView.RubberBandDrag)
226 270
        #self.selectionToolMenu.setChecked(checked)
227 271

  
272
    def stream_line_toolmenu_toggle(self, checked):
273
        import PlaceStreamlineCommand
274
        if self.command is not None:
275
            self.command.reset()
276

  
277
        self.mainWindow.actionLine.setChecked(True)
278
        if not hasattr(self.mainWindow.actionLine, 'tag'):
279
            self.mainWindow.actionLine.tag = PlaceStreamlineCommand.PlaceStreamlineCommand(self.mainWindow.graphicsView)
280
            self.mainWindow.actionLine.tag.onSuccess.connect(self.mainWindow.on_stream_line_created)
281
            self.mainWindow.actionLine.tag.onRejected.connect(self.mainWindow.onCommandRejected)
282

  
283
        self.command = self.mainWindow.actionLine.tag
284

  
228 285
    def zoom_rect(self, rect: QRectF) -> None:
229 286
        """zoom window within given rectangle"""
230 287
        self.fitInView(rect, Qt.KeepAspectRatio)

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)