프로젝트

일반

사용자정보

개정판 b98b8879

IDb98b8879434f6220ce3b32ee189dc5d96b1893a3
상위 52219509
하위 41eac0d2

함의성이(가) 약 2년 전에 추가함

add ars interface on symbol context menu

Change-Id: I64499063e6fafa1ef44ed91cd6e2282aaf4e4ce8

차이점 보기:

DTI_PID/DTI_PID/MainWindow.py
1850 1850
        self.graphicsView.useDefaultCommand()
1851 1851

  
1852 1852
    def on_ext_app_connection(self):
1853
        from TcpServer import TcpServer
1854

  
1855 1853
        app_doc_data = AppDocData.instance()
1856 1854

  
1857 1855
        tool_pane = self.ribbon.get_pane('Tool')
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py
1167 1167
            deleteAction.triggered.connect(self.contextDelete)
1168 1168
            menu.addAction(deleteAction)
1169 1169

  
1170
            deleteAction = QAction('Show on ARS', None)
1171
            deleteAction.triggered.connect(self.contextShowOnARS)
1172
            menu.addAction(deleteAction)
1173

  
1170 1174
            menu.exec_(event.screenPos())
1171 1175

  
1172 1176
    def contextDelete(self):
1173 1177
        event = QKeyEvent(QEvent.KeyPress, Qt.Key_Delete, Qt.NoModifier)
1174 1178
        self.scene().keyPressEvent(event)
1175 1179

  
1180
    def contextShowOnARS(self):
1181
        from TcpServer import TcpSocket
1182

  
1183
        app_doc_data = AppDocData.instance()
1184
        configs = app_doc_data.getAppConfigs('app', 'port call')
1185
        port = 3030
1186
        if configs and 1 == len(configs):
1187
            port = int(configs[0].value)
1188
        tcpserver = TcpSocket(port)
1189
        tcpserver.sendMessage(str(self.uid))
1190
        
1176 1191
    def contextBindSpec(self):
1177 1192
        from App import App
1178 1193
        if App.mainWnd().on_connect_spec_breaks([self]):
DTI_PID/DTI_PID/TcpServer.py
2 2
import json
3 3
from PyQt5.QtCore import *
4 4
from PyQt5.QtWidgets import QApplication, QDialog
5
from PyQt5.QtNetwork import QHostAddress, QTcpServer
5
from PyQt5.QtNetwork import QHostAddress, QTcpServer, QTcpSocket
6

  
7

  
8
class TcpSocket(QDialog):
9
    def __init__(self, port):
10
        super().__init__()
11
        self.tcpSocket = None
12
        self.port = port
13

  
14
    def sendMessage(self, msg):
15
        self.tcpSocket = QTcpSocket(self)
16
        PORT = self.port
17
        self.tcpSocket.connectToHost('127.0.0.1', PORT)
18
        if not (self.tcpSocket.waitForConnected(1000)):
19
            print("cant connect!")
20
            return
21
        
22
        ucmd = msg.encode('utf-8')
23
        self.tcpSocket.write(ucmd)
24
        self.tcpSocket.waitForBytesWritten(1000)
25

  
26
        self.tcpSocket.disconnectFromHost()
6 27

  
7 28

  
8 29
class TcpServer(QDialog):

내보내기 Unified diff

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