개정판 83c6d692
add read only
Change-Id: I76baf8f6463bf3ccd259d8e00707bfd37836c9d6
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
87 | 87 |
self._titleBlockProperties = None |
88 | 88 |
self.needReOpening = None |
89 | 89 |
self.SpecBreakUpDownIndicator = [] |
90 |
self.readOnly = False |
|
90 | 91 |
|
91 | 92 |
# item members are used only recognition except tracerLineNos for trim line no |
92 | 93 |
self.equipments = [] |
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
308 | 308 |
project = app_doc_data.getCurrentProject() |
309 | 309 |
version = QCoreApplication.applicationVersion() |
310 | 310 |
title = f"{App.NAME}({version}) - {project.name}: " \ |
311 |
f"{app_doc_data.activeDrawing.name if app_doc_data.activeDrawing else ''}"
|
|
311 |
f"{app_doc_data.activeDrawing.name if app_doc_data.activeDrawing and not app_doc_data.readOnly else (app_doc_data.activeDrawing.name + '(read-only)' if app_doc_data.activeDrawing else '')}"
|
|
312 | 312 |
#title = f"{App.NAME} : ID2 " \ |
313 | 313 |
# f"{app_doc_data.activeDrawing.name if app_doc_data.activeDrawing else ''}" |
314 | 314 |
|
... | ... | |
1304 | 1304 |
"""ask to user to save drawing or not when drawing is modified""" |
1305 | 1305 |
|
1306 | 1306 |
app_doc_data = AppDocData.instance() |
1307 |
if app_doc_data.activeDrawing and app_doc_data.activeDrawing.modified: |
|
1307 |
if app_doc_data.activeDrawing and app_doc_data.activeDrawing.modified and not app_doc_data.readOnly:
|
|
1308 | 1308 |
#if QMessageBox.Yes == QMessageBox.question(self, self.tr("Question"), |
1309 | 1309 |
# self.tr("Do you want to save drawing?"), |
1310 | 1310 |
# QMessageBox.Yes | QMessageBox.No): |
... | ... | |
1327 | 1327 |
try: |
1328 | 1328 |
app_doc_data = AppDocData.instance() |
1329 | 1329 |
|
1330 |
# read-only |
|
1331 |
if app_doc_data.readOnly: |
|
1332 |
QMessageBox.warning(self, self.tr('Warning'), "We can't save because the drawing is read-only.") |
|
1333 |
return |
|
1334 |
|
|
1330 | 1335 |
if app_doc_data.imgName is None: |
1331 | 1336 |
self.showImageSelectionMessageBox() |
1332 | 1337 |
return |
... | ... | |
2253 | 2258 |
if not pdf: |
2254 | 2259 |
occupied = app_doc_data.set_occupying_drawing(drawing.UID) |
2255 | 2260 |
if occupied: |
2256 |
QMessageBox.about(self.graphicsView, self.tr("Notice"), |
|
2257 |
self.tr(f"The drawing is locked for editing by another user({occupied})")) |
|
2258 |
return |
|
2261 |
#QMessageBox.about(self.graphicsView, self.tr("Notice"), |
|
2262 |
# self.tr(f"The drawing is locked for editing by another user({occupied})")) |
|
2263 |
reply = QMessageBox.question(self, self.tr('Warning'), |
|
2264 |
self.tr(f"The drawing is locked for editing by another user({occupied}).\nDo you want to open as read-only?"), |
|
2265 |
QMessageBox.Yes, QMessageBox.No) |
|
2266 |
if reply == QMessageBox.Yes: |
|
2267 |
app_doc_data.readOnly = True |
|
2268 |
else: |
|
2269 |
return |
|
2270 |
else: |
|
2271 |
app_doc_data.readOnly = False |
|
2259 | 2272 |
|
2260 | 2273 |
# save alarm |
2261 | 2274 |
if timer: |
... | ... | |
2382 | 2395 |
self.on_ocr_unknown_items() |
2383 | 2396 |
|
2384 | 2397 |
# save alarm |
2385 |
if timer: |
|
2398 |
if timer and not app_doc_data.readOnly:
|
|
2386 | 2399 |
self.save_alarm_enable(True, True) |
2387 | 2400 |
except Exception as ex: |
2388 | 2401 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \ |
... | ... | |
3274 | 3287 |
from datetime import datetime |
3275 | 3288 |
from License import QLicenseDialog |
3276 | 3289 |
|
3290 |
app_doc_data = AppDocData.instance() |
|
3291 |
|
|
3292 |
# read-only |
|
3293 |
if app_doc_data.readOnly: |
|
3294 |
QMessageBox.warning(self, self.tr('Warning'), "We can't recognize because the drawing is read-only.") |
|
3295 |
return |
|
3296 |
|
|
3277 | 3297 |
# save alarm |
3278 | 3298 |
self.save_alarm_enable(False) |
3279 | 3299 |
|
3280 |
app_doc_data = AppDocData.instance() |
|
3281 | 3300 |
current_drawing, currentPid = None, None |
3282 | 3301 |
|
3283 | 3302 |
if self.graphicsView.hasImage(): |
내보내기 Unified diff