프로젝트

일반

사용자정보

개정판 6dbc71ea

ID6dbc71eaa9efff2885067a328910e97296a28e59
상위 f5f79e97
하위 f7e4e922, 5e9d3cd9

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

issue #622: save alert

Change-Id: I1175a57b96311598396f8eb1b451f0c9aac53d1b

차이점 보기:

DTI_PID/DTI_PID/MainWindow.py
1455 1455
                self.setWindowTitle(self.title)
1456 1456

  
1457 1457
                # save alarm
1458
                self.save_alarm_enable(True)
1458
                self.save_alarm_enable(True, True)
1459 1459
        except Exception as ex:
1460 1460
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
1461 1461
                                                           sys.exc_info()[-1].tb_lineno)
......
1463 1463

  
1464 1464
        return self.path
1465 1465

  
1466
    def save_alarm_enable(self, enable):
1466
    def save_alarm_enable(self, enable, init=False):
1467
        from datetime import datetime
1468

  
1467 1469
        app_doc_data = AppDocData.instance()
1468 1470
        configs = app_doc_data.getConfigs('Data Save', 'Time')
1469 1471
        time_min = int(configs[0].value) if 1 == len(configs) else 0
......
1472 1474
            if not self.save_timer:
1473 1475
                self.save_timer = QTimer()
1474 1476
                self.save_timer.timeout.connect(self.save_alarm)
1475
                self.save_timer.setInterval(60000 * time_min)
1477
                self.save_timer.setInterval(60000)
1478

  
1479
            if init:
1480
                self.save_timer._init_time = datetime.now()
1481
                self.save_timer._stop_time = None
1482
                self.save_timer._interval_time = datetime.now() - datetime.now()
1483

  
1484
            if self.save_timer._stop_time:
1485
                self.save_timer._interval_time = datetime.now() - self.save_timer._stop_time
1476 1486
            
1477
            if 60000 * time_min != self.save_timer.interval():
1478
                self.save_timer.setInterval(60000 * time_min)
1487
            #if 60000 * time_min != self.save_timer.interval():
1488
            #    self.save_timer.setInterval(60000)
1479 1489

  
1480 1490
            self.save_timer.start()
1481 1491
        else:
1482 1492
            if self.save_timer:
1483 1493
                self.save_timer.stop()
1494
                self.save_timer._stop_time = datetime.now()
1484 1495

  
1485 1496
    def save_alarm(self):
1497
        from datetime import datetime
1498

  
1499
        app_doc_data = AppDocData.instance()
1500
        configs = app_doc_data.getConfigs('Data Save', 'Time')
1501
        time_min = int(configs[0].value) if 1 == len(configs) else 0
1502

  
1486 1503
        self.save_timer.stop()
1487
        if self.graphicsView.hasFocus():
1504
        if self.graphicsView.hasFocus() and (datetime.now() - self.save_timer._init_time - self.save_timer._interval_time).seconds > time_min * 60:
1488 1505
            QMessageBox.information(self, self.tr('Information'), self.tr('Please save Drawing'))
1506
            self.save_timer._init_time = datetime.now()
1507
            self.save_timer._interval_time = datetime.now() - datetime.now()
1489 1508
        self.save_timer.start()
1490 1509

  
1491 1510
    def export_as_svg(self):

내보내기 Unified diff

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