예제 #1
0
def detectionLogEcho(newDevice):
    '''writes detection info log messages'''
    removeLastHandler() # New file for each device
    registerFileLogHandler(sett.LOG_DIR + getLogName())
    if len(newDevice['partitions']) > 1:
        logger.info(msg.MULTIPARTITION)
    else:
        device = getDeviceName(newDevice['partitions'][0])
        logger.info(msg.singlePartition(device))
예제 #2
0
파일: gui.py 프로젝트: mcyprian/checkpoint
 def deviceDetected(self):
     """
     State machine handling function, prints detection message
     and asks user if new device is going to be scanned
     """
     print("State Detected")
     detectionLogEcho(self.detector.detectedDevice)
     if len(self.detector.detectedDevice["partitions"]) > 1:
         self.newEvent(self.app.setLabelMsg, label=self.app.info, text=msg.MULTIPARTITION)
     else:
         device = getDeviceName(self.detector.detectedDevice["partitions"][0])
         self.newEvent(self.app.setLabelMsg, label=self.app.info, text=msg.singlePartition(device))
     self.shared.buttonPushed.clear()
     self.newEvent(showWidget, widget=self.app.mainButton)
     if SELECT_FILES:
         self.newEvent(showWidget, widget=self.app.specialStateButton)
     self.newEvent(self.app.mainButton.config, text=msg.SCAN_BUTTON)
     self.newEvent(self.app.specialStateButton.config, text=msg.SCAN_SELECTED_BUTTON)
     self.shared.buttonPushed.wait()
     self.newEvent(hideWidget, widget=self.app.specialStateButton)
     self.newEvent(hideWidget, widget=self.app.mainButton)
     if self.shared.specialState.isSet():
         return States.SCAN_SELECTED
     return States.SCANNING