def _on_device_unplugged(self, title="", description=""): ciclop_scan.stop() scanner_autocheck.cancel() laser_triangulation.cancel() platform_extrinsics.cancel() self.toolbar.update_status(False) driver.disconnect() dlg = wx.MessageDialog(self, description, title, wx.OK | wx.ICON_ERROR) dlg.ShowModal() dlg.Destroy()
def on_close(self, event): try: if ciclop_scan.is_scanning: ciclop_scan.stop() time.sleep(0.5) driver.board.set_unplug_callback(None) driver.camera.set_unplug_callback(None) driver.disconnect() for workbench in self.workbench: workbench.on_disconnect() except: pass self.Show(False) self.Destroy()
def on_stop_tool_clicked(self, event): paused = ciclop_scan._inactive ciclop_scan.pause() dlg = wx.MessageDialog(self, _("Your current scanning will be stopped.\n" "Are you sure you want to stop?"), _("Stop scanning"), wx.YES_NO | wx.ICON_QUESTION) result = dlg.ShowModal() == wx.ID_YES dlg.Destroy() if result: self.scanning = False ciclop_scan.stop() # Flush video image_capture.capture_texture() image_capture.capture_texture() image_capture.capture_texture() self.on_scan_finished() else: if not paused: ciclop_scan.resume()