Skip to content

Commit

Permalink
Demo of Python export from PD.
Browse files Browse the repository at this point in the history
  • Loading branch information
ddcc4 committed Jan 8, 2025
1 parent de97092 commit d080a12
Show file tree
Hide file tree
Showing 4 changed files with 432 additions and 2 deletions.
61 changes: 61 additions & 0 deletions protocol-designer/src/file-data/selectors/fileCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import type { LabwareDefByDefURI } from '../../labware-defs'
import type { Selector } from '../../types'
import type { DesignerApplicationData } from '../../load-file/migration/utils/getLoadLiquidCommands'
import type { SecondOrderCommandAnnotation } from '@opentrons/shared-data/commandAnnotation/types'
import genPythonProtocol from './pythonProtocol'

// TODO: BC: 2018-02-21 uncomment this assert, causes test failures
// console.assert(!isEmpty(process.env.OT_PD_VERSION), 'Could not find application version!')
Expand Down Expand Up @@ -432,6 +433,18 @@ export const createFile: Selector<ProtocolFile> = createSelector(
designerApplication,
}

console.log(genPythonProtocol(
fileMetadata,
robotType,
initialRobotState,
labwareEntities,
labwareNicknamesById,
moduleEntities,
pipetteEntities,
ingredients,
ingredLocations,
));

return {
...protocolBase,
...deckStructure,
Expand All @@ -442,3 +455,51 @@ export const createFile: Selector<ProtocolFile> = createSelector(
}
}
)

export const createPythonFile: Selector<string> = createSelector(
getFileMetadata,
getInitialRobotState,
getRobotStateTimeline,
getRobotType,
dismissSelectors.getAllDismissedWarnings,
ingredSelectors.getLiquidGroupsById,
ingredSelectors.getLiquidsByLabwareId,
stepFormSelectors.getSavedStepForms,
stepFormSelectors.getOrderedStepIds,
stepFormSelectors.getLabwareEntities,
stepFormSelectors.getModuleEntities,
stepFormSelectors.getPipetteEntities,
uiLabwareSelectors.getLabwareNicknamesById,
labwareDefSelectors.getLabwareDefsByURI,
getStepGroups,
(
fileMetadata,
initialRobotState,
robotStateTimeline,
robotType,
dismissedWarnings,
ingredients,
ingredLocations,
savedStepForms,
orderedStepIds,
labwareEntities,
moduleEntities,
pipetteEntities,
labwareNicknamesById,
labwareDefsByURI,
stepGroups
) => {
const pythonProtocol = genPythonProtocol(
fileMetadata,
robotType,
initialRobotState,
labwareEntities,
labwareNicknamesById,
moduleEntities,
pipetteEntities,
ingredients,
ingredLocations,
);
return pythonProtocol;
}
)
Loading

0 comments on commit d080a12

Please sign in to comment.