def connect_device(self): self.__device_engine = None if "--dummy-device" in sys.argv: debug_trace("USE DUMMY DEVICE") import dummyDevice dev = dummyDevice.DummyDevice() else: if not pymtp_available: msg = "pymtp is not or incorrectly installed on your system.\nThis is needed to access you device.\nGoto http://nick125.com/projects/pymtp to grab it and get installation instruction " notify_error(msg, title="pymtp not available", sender=self.window) self.__show_connected_state(False) return dev = MTPDevice() self.__device_engine = DeviceEngine(dev) try: self.__device_engine.connect_device() except Exception, exc: msg = "No device was found.\nPlease verify it was correctly plugged" notify_error(msg, title="No device found", exception=exc, sender=self.window) self.__device_engine = None self.__show_connected_state(False) return