개정판 22913e4b
initial upload DEXPI converter
Change-Id: Icf4b388af48faa18cc65d27af4c17b53e55084a4
DTI_PID/DTI_PID/App.py | ||
---|---|---|
15 | 15 |
from PluginScope import PluginScope |
16 | 16 |
|
17 | 17 |
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__))) |
18 |
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), 'Commands')) |
|
18 | 19 |
from AppDocData import AppDocData |
20 |
from AutoSaveCommand import AutoSaveCommand |
|
19 | 21 |
|
20 | 22 |
|
21 | 23 |
def plugin(name): |
... | ... | |
132 | 134 |
|
133 | 135 |
selectedProject = dlg.showDialog() |
134 | 136 |
if selectedProject is not None: |
137 |
cmd = AutoSaveCommand() |
|
138 |
|
|
135 | 139 |
AppDocData.instance().setCurrentProject(selectedProject) |
136 | 140 |
# AppDocData.instance().ex = exceptionHandler |
137 | 141 |
app._mainWnd = MainWindow.instance() |
DTI_PID/DTI_PID/AppWebService.py | ||
---|---|---|
130 | 130 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
131 | 131 |
return [] |
132 | 132 |
|
133 |
def request_upload_training_data(self, name, tiles, xmls):
|
|
133 |
def request_upload_training_data(self, project_name, tiles, xmls) -> bool:
|
|
134 | 134 |
""" main code """ |
135 | 135 |
try: |
136 | 136 |
if not self.test_connection(): |
... | ... | |
138 | 138 |
|
139 | 139 |
upload_data = '/training/upload_training_data' |
140 | 140 |
|
141 |
data = { 'name':name, 'count':len(tiles) + len(xmls), 'tiles':[], 'xmls':[] }
|
|
141 |
data = {'name': project_name, 'count': len(tiles) + len(xmls), 'tiles': [], 'xmls': []}
|
|
142 | 142 |
|
143 | 143 |
for tile in tiles: |
144 | 144 |
with open(tile.encode('utf-8'), 'rb') as stream: |
... | ... | |
156 | 156 |
with open(xml.encode('utf-8'), 'r') as stream: |
157 | 157 |
rects = stream.read() |
158 | 158 |
#bts = base64.b64encode(rects).decode() |
159 |
data['xmls'].append((os.path.basename(xml) , rects))
|
|
159 |
data['xmls'].append((os.path.basename(xml), rects)) |
|
160 | 160 |
|
161 | 161 |
response = requests.post(self._url + upload_data, data=json.dumps(data)) |
162 | 162 |
count = response.json()['count'] |
163 | 163 |
|
164 |
if data['count'] == count: |
|
165 |
return True |
|
166 |
else: |
|
167 |
return False |
|
164 |
return data['count'] == count |
|
168 | 165 |
except Exception as ex: |
169 | 166 |
from App import App |
170 | 167 |
from AppDocData import MessageType |
171 | 168 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
172 | 169 |
sys.exc_info()[-1].tb_lineno) |
173 | 170 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
174 |
return False |
|
171 |
|
|
172 |
return False |
|
175 | 173 |
|
176 | 174 |
def request_execute_training(self, name, classes, bigs): |
175 |
"""request symbol training on server""" |
|
177 | 176 |
try: |
178 | 177 |
if not self.test_connection(): |
179 | 178 |
return [] |
180 | 179 |
|
181 | 180 |
training_model = '/training/training_model' |
182 | 181 |
|
183 |
data = { 'name':name, 'classes':classes, 'bigs':bigs }
|
|
182 |
data = {'name': name, 'classes': classes, 'bigs': bigs}
|
|
184 | 183 |
|
185 | 184 |
response = requests.post(self._url + training_model, data=json.dumps(data)) |
186 | 185 |
count = response.json()['count'] |
187 | 186 |
|
188 |
if count == 1: |
|
189 |
return True |
|
190 |
else: |
|
191 |
return False |
|
187 |
return count == 1 |
|
192 | 188 |
except Exception as ex: |
193 | 189 |
from App import App |
194 | 190 |
from AppDocData import MessageType |
195 | 191 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
196 | 192 |
sys.exc_info()[-1].tb_lineno) |
197 | 193 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
198 |
return False |
|
194 |
|
|
195 |
return False |
DTI_PID/DTI_PID/Commands/AbstractCommand.py | ||
---|---|---|
2 | 2 |
|
3 | 3 |
from PyQt5.QtCore import pyqtSignal, QObject |
4 | 4 |
|
5 |
|
|
5 | 6 |
class AbstractCommand(QObject): |
6 | 7 |
def __init__(self, imageViewer): |
7 | 8 |
super(AbstractCommand, self).__init__() |
DTI_PID/DTI_PID/Commands/AutoSaveCommand.py | ||
---|---|---|
1 |
# coding: utf-8 |
|
2 |
""" This is SaveWork command module """ |
|
3 |
import os.path |
|
4 |
import sys |
|
5 |
from enum import Enum |
|
6 |
from PyQt5.QtCore import * |
|
7 |
from SingletonInstance import SingletonInstance |
|
8 |
|
|
9 |
|
|
10 |
class AutoSaveCommand(SingletonInstance): |
|
11 |
display_message = pyqtSignal(Enum, str) |
|
12 |
show_progress = pyqtSignal(int) |
|
13 |
|
|
14 |
def __init__(self, interval=60000): |
|
15 |
self._interval = interval |
|
16 |
|
|
17 |
self.timer = QTimer() |
|
18 |
self.timer.timeout.connect(self.save) |
|
19 |
self.timer.start(interval) |
|
20 |
|
|
21 |
def save(self): |
|
22 |
"""save""" |
|
23 |
pass |
DTI_PID/DTI_PID/DEXPI/Shape.py | ||
---|---|---|
1 |
# coding: utf-8 |
|
2 |
""" This is Shape module """ |
|
3 |
|
|
4 |
from xml.etree.ElementTree import Element, SubElement, dump, ElementTree, parse, tostring |
|
5 |
|
|
6 |
|
|
7 |
class Line: |
|
8 |
def __init__(self, start: complex, end: complex): |
|
9 |
self.start = start |
|
10 |
self.end = end |
|
11 |
|
|
12 |
def to_xml(self): |
|
13 |
xml = Element('Line') |
|
14 |
presentation_node = SubElement(xml, 'Presentation') |
|
15 |
presentation_node.attrib['Layer'] = '125' |
|
16 |
presentation_node.attrib['Color'] = '0' |
|
17 |
presentation_node.attrib['LineType'] = '1' |
|
18 |
presentation_node.attrib['LineWeight'] = '0.35' |
|
19 |
presentation_node.attrib['R'] = '0' |
|
20 |
presentation_node.attrib['G'] = '0' |
|
21 |
presentation_node.attrib['B'] = '0' |
|
22 |
extent_node = SubElement(xml, 'Extent') |
|
23 |
min_node = SubElement(extent_node, 'Min') |
|
24 |
min_node.attrib['X'] = str(min(self.start.real, self.end.real)) |
|
25 |
min_node.attrib['Y'] = str(min(self.start.imag, self.end.imag)) |
|
26 |
min_node.attrib['Z'] = '0' |
|
27 |
max_node = SubElement(extent_node, 'Max') |
|
28 |
max_node.attrib['X'] = str(max(self.start.real, self.end.real)) |
|
29 |
max_node.attrib['Y'] = str(max(self.start.imag, self.end.imag)) |
|
30 |
max_node.attrib['Z'] = '0' |
|
31 |
coordinate_node = SubElement(xml, 'Coordinate') |
|
32 |
coordinate_node.attrib['X'] = str(self.start.real) |
|
33 |
coordinate_node.attrib['Y'] = str(self.start.imag) |
|
34 |
coordinate_node.attrib['Z'] = '0' |
|
35 |
coordinate_node = SubElement(xml, 'Coordinate') |
|
36 |
coordinate_node.attrib['X'] = str(self.end.real) |
|
37 |
coordinate_node.attrib['Y'] = str(self.end.imag) |
|
38 |
coordinate_node.attrib['Z'] = '0' |
|
39 |
|
|
40 |
return xml |
|
41 |
|
|
42 |
|
|
43 |
class GenericAttributes: |
|
44 |
def __init__(self, item): |
|
45 |
self.item = item |
|
46 |
pass |
|
47 |
|
|
48 |
def to_xml(self): |
|
49 |
xml = Element('GenericAttributes') |
|
50 |
xml.attrib['Set'] = 'ID2Properties' |
|
51 |
|
|
52 |
attrs = self.item.getAttributes() |
|
53 |
xml.attrib['Number'] = str(len(attrs)) |
|
54 |
for key, value in attrs.items(): |
|
55 |
generic_attribute_node = SubElement(xml, 'GenericAttribute') |
|
56 |
generic_attribute_node.attrib['Name'] = key.Attribute |
|
57 |
generic_attribute_node.attrib['Value'] = value if value else '' |
|
58 |
generic_attribute_node.attrib['Format'] = key.AttributeType |
|
59 |
|
|
60 |
return xml |
|
61 |
|
|
62 |
|
|
63 |
class ConnectionPoints: |
|
64 |
def __init__(self, connectors): |
|
65 |
self.connectors = connectors |
|
66 |
|
|
67 |
def to_xml(self): |
|
68 |
xml = Element('ConnectionPoints') |
|
69 |
xml.attrib['NumPoints'] = str(len(self.connectors)) |
|
70 |
|
|
71 |
min_x, min_y = None, None |
|
72 |
max_x, max_y = None, None |
|
73 |
for conn in self.connectors: |
|
74 |
center = conn.center() |
|
75 |
min_x = center[0] if min_x is None or min_x > center[0] else min_x |
|
76 |
max_x = center[0] if max_x is None or max_x < center[0] else max_x |
|
77 |
min_y = center[1] if min_y is None or min_y > center[1] else min_y |
|
78 |
max_y = center[1] if max_y is None or max_y < center[1] else max_y |
|
79 |
|
|
80 |
extent_node = SubElement(xml, 'Extent') |
|
81 |
min_node = SubElement(extent_node, 'Min') |
|
82 |
min_node.attrib['X'] = str(min_x) |
|
83 |
min_node.attrib['Y'] = str(min_y) |
|
84 |
min_node.attrib['Z'] = '0' |
|
85 |
max_node = SubElement(extent_node, 'Max') |
|
86 |
max_node.attrib['X'] = str(max_x) |
|
87 |
max_node.attrib['Y'] = str(max_y) |
|
88 |
max_node.attrib['Z'] = '0' |
|
89 |
|
|
90 |
for idx, conn in enumerate(self.connectors): |
|
91 |
node = SubElement(xml, 'Node') |
|
92 |
node.attrib['ID'] = str(conn.uid) |
|
93 |
node.attrib['Name'] = f"conn{idx}" |
|
94 |
position_node = SubElement(node, 'Position') |
|
95 |
location_node = SubElement(position_node, 'Location') |
|
96 |
location_node.attrib['X'] = str(conn.center()[0]) |
|
97 |
location_node.attrib['Y'] = str(conn.center()[1]) |
|
98 |
location_node.attrib['Z'] = '0' |
|
99 |
axis_node = SubElement(position_node, 'Axis') |
|
100 |
axis_node.attrib['X'] = '0' |
|
101 |
axis_node.attrib['Y'] = '0' |
|
102 |
axis_node.attrib['Z'] = '1' |
|
103 |
reference_node = SubElement(position_node, 'Reference') |
|
104 |
reference_node.attrib['X'] = '1' |
|
105 |
reference_node.attrib['Y'] = '0' |
|
106 |
reference_node.attrib['Z'] = '0' |
|
107 |
|
|
108 |
generic_attributes_node = SubElement(xml, 'GenericAttributes') |
|
109 |
generic_attributes_node.attrib['Number'] = str(len(self.connectors)) |
|
110 |
for idx in range(len(self.connectors)): |
|
111 |
generic_attribute_node = SubElement(generic_attributes_node, 'GenericAttribute') |
|
112 |
generic_attribute_node.attrib['Name'] = f"NodeName{idx}" |
|
113 |
generic_attribute_node.attrib['Value'] = f"conn{idx}" |
|
114 |
generic_attribute_node.attrib['Format'] = 'string' |
|
115 |
|
|
116 |
return xml |
DTI_PID/DTI_PID/DEXPI/__init__.py | ||
---|---|---|
1 |
"""imports""" |
|
2 |
from PyQt5.QtWidgets import * |
|
3 |
|
|
4 |
|
|
5 |
def scene_to_dexpi(path, name, scene: QGraphicsScene) -> None: |
|
6 |
from xml.etree.ElementTree import Element, SubElement, dump, ElementTree, parse |
|
7 |
from .formatter import Formatter |
|
8 |
|
|
9 |
formatter = Formatter() |
|
10 |
data = formatter.to_dexpi(name, scene) |
|
11 |
ElementTree(data).write(path, encoding='utf-8', xml_declaration=True) |
DTI_PID/DTI_PID/DEXPI/formatter.py | ||
---|---|---|
1 |
# coding: utf-8 |
|
2 |
""" This is DEXPI formatter module """ |
|
3 |
|
|
4 |
import sys |
|
5 |
import os |
|
6 |
from xml.etree.ElementTree import Element, SubElement, dump, ElementTree, parse, tostring |
|
7 |
from PyQt5.QtWidgets import * |
|
8 |
|
|
9 |
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '..\\Shapes')) |
|
10 |
|
|
11 |
|
|
12 |
class Formatter: |
|
13 |
PlantModel = 'PlantModel' |
|
14 |
PlantInformation = 'PlantInformation' |
|
15 |
|
|
16 |
def __init__(self): |
|
17 |
pass |
|
18 |
|
|
19 |
def to_dexpi(self, name: str, scene: QGraphicsScene): |
|
20 |
"""convert all items in scene to dexpi format""" |
|
21 |
from datetime import date, datetime |
|
22 |
|
|
23 |
def formatter(item): |
|
24 |
pass |
|
25 |
|
|
26 |
def extent_node(parent, scene): |
|
27 |
extent = SubElement(parent, 'Extent') |
|
28 |
rect = scene.itemsBoundingRect() |
|
29 |
_min = SubElement(extent, 'Min') |
|
30 |
_min.attrib['X'] = str(int(rect.left())) |
|
31 |
_min.attrib['Y'] = str(int(rect.top())) |
|
32 |
_min.attrib['Z'] = '0' |
|
33 |
_max = SubElement(extent, 'Max') |
|
34 |
_max.attrib['X'] = str(int(rect.right())) |
|
35 |
_max.attrib['Y'] = str(int(rect.bottom())) |
|
36 |
_max.attrib['Z'] = '0' |
|
37 |
|
|
38 |
return extent |
|
39 |
|
|
40 |
def drawing(name, parent, scene: QGraphicsScene): |
|
41 |
_drawing = SubElement(parent, 'Drawing') |
|
42 |
_drawing.attrib['Name'] = name |
|
43 |
_drawing.attrib['Type'] = 'PID' |
|
44 |
_drawing.attrib['Title'] = '' |
|
45 |
presentation = SubElement(_drawing, 'Presentation') |
|
46 |
presentation.attrib['Layer'] = '' |
|
47 |
presentation.attrib['Color'] = '16777215' |
|
48 |
presentation.attrib['LineType'] = '' |
|
49 |
presentation.attrib['LineWeight'] = '' |
|
50 |
presentation.attrib['R'] = '1.000' |
|
51 |
presentation.attrib['G'] = '1.000' |
|
52 |
presentation.attrib['B'] = '1.000' |
|
53 |
|
|
54 |
extent = extent_node(_drawing, scene) |
|
55 |
|
|
56 |
return _drawing |
|
57 |
|
|
58 |
def shape_catalogue_node(parent, scene): |
|
59 |
from SymbolSvgItem import SymbolSvgItem |
|
60 |
from svg.path import Path, Line, Arc, CubicBezier, QuadraticBezier, parse_path |
|
61 |
from svg.path.path import Move |
|
62 |
from .Shape import Line as DEXPI_Line, ConnectionPoints, GenericAttributes |
|
63 |
|
|
64 |
node = SubElement(parent, 'ShapeCatalogue') |
|
65 |
node.attrib['Name'] = 'ShapeCatalogue' |
|
66 |
|
|
67 |
catalogue = set() |
|
68 |
items = [item for item in scene.items() if issubclass(type(item), SymbolSvgItem)] |
|
69 |
for item in items: |
|
70 |
type_str = f"{item.type}/{item.name}" |
|
71 |
if type_str not in catalogue: |
|
72 |
shape_node = SubElement(node, 'Nozzle' if item.type == 'Nozzles' else 'Equipment') |
|
73 |
shape_node.attrib['ComponentClass'] = item.type |
|
74 |
shape_node.attrib['ComponentName'] = item.name |
|
75 |
shape_node.attrib['Status'] = 'Current' |
|
76 |
presentation_node = SubElement(shape_node, 'Presentation') |
|
77 |
presentation_node.attrib['Layer'] = '0' |
|
78 |
presentation_node.attrib['Color'] = '0' |
|
79 |
presentation_node.attrib['LineType'] = '0' |
|
80 |
presentation_node.attrib['LineWeight'] = '0.1' |
|
81 |
presentation_node.attrib['R'] = '0' |
|
82 |
presentation_node.attrib['G'] = '0' |
|
83 |
presentation_node.attrib['B'] = '0' |
|
84 |
|
|
85 |
generic_attributes = GenericAttributes(item) |
|
86 |
shape_node.append(generic_attributes.to_xml()) |
|
87 |
|
|
88 |
svg = item.to_svg(parent=None) |
|
89 |
paths = svg[0].findall('path') |
|
90 |
for path in paths: |
|
91 |
path_ele = parse_path(path.attrib['d']) |
|
92 |
for idx, ele in enumerate(path_ele): |
|
93 |
if type(ele) is Move: |
|
94 |
pass |
|
95 |
elif type(ele) is Line: |
|
96 |
line = DEXPI_Line(ele.start, ele.end) |
|
97 |
shape_node.append(line.to_xml()) |
|
98 |
elif type(ele) is Arc: |
|
99 |
pass |
|
100 |
elif type(ele) is CubicBezier: |
|
101 |
pass |
|
102 |
elif type(ele) is QuadraticBezier: |
|
103 |
pass |
|
104 |
|
|
105 |
connection_points_node = ConnectionPoints(item.connectors) |
|
106 |
shape_node.append(connection_points_node.to_xml()) |
|
107 |
|
|
108 |
catalogue.add(type_str) |
|
109 |
|
|
110 |
return node |
|
111 |
|
|
112 |
def equipment(parent): |
|
113 |
pass |
|
114 |
|
|
115 |
def piping_network_system(parent): |
|
116 |
pass |
|
117 |
|
|
118 |
today = date.today() |
|
119 |
|
|
120 |
xml = Element(Formatter.PlantModel) # Root Node |
|
121 |
xml.attrib['xmlns:xsi'] = 'http://www.w3.org/2001/XMLSchema-instance' |
|
122 |
xml.attrib['xsi:noNamespaceSchemaLocation'] = 'XMpLantPIDProfileSchema_4.0.1.xsd' |
|
123 |
node = Element(Formatter.PlantInformation) |
|
124 |
node.attrib['SchemaVersion'] = '4.0.1' |
|
125 |
node.attrib['OriginatingSystem'] = 'Comos' |
|
126 |
node.attrib['Date'] = today.strftime("%Y-%m-%d") |
|
127 |
node.attrib['Time'] = datetime.now().strftime('%H:%M:%S') |
|
128 |
node.attrib['Is3D'] = 'no' |
|
129 |
node.attrib['Units'] = 'px' |
|
130 |
node.attrib['Discipline'] = 'PID' |
|
131 |
SubElement(node, 'UnitsOfMeasure').attrib['Distance'] = 'px' |
|
132 |
xml.append(node) |
|
133 |
extent = extent_node(xml, scene) |
|
134 |
|
|
135 |
"""drawing""" |
|
136 |
drawing_node = drawing(name, xml, scene) |
|
137 |
shape_catalogue_node = shape_catalogue_node(xml, scene) |
|
138 |
equipment_node = equipment(xml) |
|
139 |
piping_network_system_node = piping_network_system(xml) |
|
140 |
|
|
141 |
for item in scene.items(): |
|
142 |
formatter(item) |
|
143 |
|
|
144 |
return xml |
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
2329 | 2329 |
item = self.symbolTreeWidget.currentItem() |
2330 | 2330 |
if item: |
2331 | 2331 |
self.symbolTreeWidget.showSymbolEditorDialog(item, 0) |
2332 |
elif event.key() == Qt.Key_F6: |
|
2333 |
from DEXPI import scene_to_dexpi |
|
2334 |
|
|
2335 |
app_doc_data = AppDocData.instance() |
|
2336 |
scene_to_dexpi('D:\\Temp\\DEXPI.xml', app_doc_data.activeDrawing.name, self.graphicsView.scene()) |
|
2332 | 2337 |
|
2333 | 2338 |
QMainWindow.keyPressEvent(self, event) |
2334 | 2339 |
except Exception as ex: |
DTI_PID/DTI_PID/RecognitionDialog.py | ||
---|---|---|
3409 | 3409 |
finally: |
3410 | 3410 |
loop.quit() |
3411 | 3411 |
|
3412 |
def add_predata_to_scene(self, drawing, scene, symbol, text, line, unknown, package) -> None: |
|
3413 |
""" add predata to scene """ |
|
3412 |
def add_predata_to_scene(self, drawing, scene, symbol: bool, text: bool, line: bool, unknown: bool, package: bool) \ |
|
3413 |
-> None: |
|
3414 |
"""add predata to scene""" |
|
3414 | 3415 |
from LoadCommand import LoadCommand |
3415 | 3416 |
from App import App |
3416 | 3417 |
|
... | ... | |
3420 | 3421 |
cmd.execute((drawing, scene), symbol=symbol, text=text, line=line, unknown=unknown, |
3421 | 3422 |
package=package, update=False) |
3422 | 3423 |
except Exception as ex: |
3423 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
3424 |
sys.exc_info()[-1].tb_lineno) |
|
3424 |
from App import App |
|
3425 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \ |
|
3426 |
f"{sys.exc_info()[-1].tb_lineno}" |
|
3425 | 3427 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
3426 | 3428 |
finally: |
3427 | 3429 |
self.cond.wakeAll() |
3428 | 3430 |
|
3429 | 3431 |
def clear_scene(self, scene1, scene2, scene3) -> None: |
3430 |
""" clear scenes """
|
|
3432 |
"""clear scenes"""
|
|
3431 | 3433 |
|
3432 | 3434 |
try: |
3433 | 3435 |
scene1.clear() |
... | ... | |
3436 | 3438 |
|
3437 | 3439 |
except Exception as ex: |
3438 | 3440 |
from App import App |
3439 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
|
|
3440 |
sys.exc_info()[-1].tb_lineno)
|
|
3441 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \
|
|
3442 |
f"{sys.exc_info()[-1].tb_lineno}"
|
|
3441 | 3443 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
3442 | 3444 |
finally: |
3443 | 3445 |
self.cond.wakeAll() |
... | ... | |
3453 | 3455 |
cmd.display_message.connect(App.mainWnd().onAddMessage) |
3454 | 3456 |
cmd.execute(scene, find_symbol, replace_symbol, replace_action, condition) |
3455 | 3457 |
except Exception as ex: |
3456 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
|
|
3457 |
sys.exc_info()[-1].tb_lineno)
|
|
3458 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \
|
|
3459 |
f"{sys.exc_info()[-1].tb_lineno}"
|
|
3458 | 3460 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
3459 | 3461 |
finally: |
3460 | 3462 |
self.cond.wakeAll() |
DTI_PID/DTI_PID/TrainingImageListDialog.py | ||
---|---|---|
44 | 44 |
# noisePassList = ['.', '\"', '\'', ',', '`', '-', '+'] |
45 | 45 |
|
46 | 46 |
class EmittingStream(QObject): |
47 |
""" |
|
48 |
This is EmittingStream class |
|
49 |
""" |
|
47 |
"""This is EmittingStream class""" |
|
50 | 48 |
textWritten = pyqtSignal(str) |
51 | 49 |
|
52 | 50 |
def write(self, text): |
DTI_PID/DTI_PID/TrainingSymbolImageListDialog.py | ||
---|---|---|
17 | 17 |
#// for remove noise |
18 | 18 |
#noisePassList = ['.', '\"', '\'', ',', '`', '-', '+'] |
19 | 19 |
|
20 |
|
|
20 | 21 |
class QTrainingSymbolImageListDialog(QDialog): |
21 | 22 |
""" |
22 | 23 |
This is training image list dialog class |
DTI_PID/WebServer/app/__init__.py | ||
---|---|---|
4 | 4 |
from flask import Flask, render_template, Blueprint |
5 | 5 |
from flask_restx import Api, fields, marshal_with, Resource, reqparse |
6 | 6 |
from app.recognition.index import recognition_service |
7 |
from app.training.index import training_service |
|
7 |
# from app.training.index import training_service
|
|
8 | 8 |
from app.api.controllers.ProjectController import api as project_ns |
9 | 9 |
from app.api.controllers.ModelController import api as model_ns |
10 | 10 |
from app.api.controllers.license_controller import api as license_ns |
... | ... | |
34 | 34 |
# 위에서 추가한 파일을 연동해주는 역할 |
35 | 35 |
# app.register_blueprint(license_service) |
36 | 36 |
app.register_blueprint(recognition_service) |
37 |
app.register_blueprint(training_service) |
|
37 |
# app.register_blueprint(training_service)
|
|
38 | 38 |
app.register_blueprint(license_service) |
39 | 39 |
|
40 | 40 |
api = Api(app, |
DTI_PID/WebServer/app/api/controllers/TrainingController.py | ||
---|---|---|
85 | 85 |
else: |
86 | 86 |
return False |
87 | 87 |
|
88 |
return jsonify({'count': 1}) |
|
88 |
return jsonify({'count': 1}) |
내보내기 Unified diff