예제 #1
0
 def _get_checkboxs(c4: Column, c5: Column) -> Tuple[bool, bool]:
     viz = c5.checkbox("Visual Only")
     c5.markdown(
         "<div style='height:57px'></div>",
         unsafe_allow_html=True)  # Vertical spacing for button alignment
     agl = c4.checkbox("AGL")
     return viz, agl
예제 #2
0
    def _get_waypoint_data(self, c1: Column, c2: Column, wp_options: dict,
                           marker_colors: dict) -> tuple:
        wp_name: str = c1.text_input(label="Waypoint Name",
                                     value=f"WP{self.current_wp + 1}")
        wp_altitude = float(
            c1.text_input(label='Waypoint Altitude (ft)', value="10000"))

        wp_type: str = c2.selectbox('Select Waypoint Type',
                                    list(wp_options.keys()))
        marker_color: str = c2.selectbox('Select Waypoint Aircraft',
                                         list(marker_colors.keys()))
        return wp_name, wp_altitude, wp_type, marker_color
예제 #3
0
    def test_enqueue_same_id(self):
        cursor = LockedCursor(index=123)
        dg = DeltaGenerator(cursor=cursor)
        self.assertEqual(123, dg._cursor.index)

        test_data = "some test data"
        text_proto = TextProto()
        text_proto.body = test_data
        new_dg = dg._enqueue("text", text_proto)

        self.assertEqual(dg._cursor, new_dg._cursor)

        msg = self.get_message_from_queue()
        self.assertEqual(123, msg.metadata.delta_id)
        self.assertEqual(msg.delta.new_element.text.body, test_data)
예제 #4
0
    def test_enqueue(self, container):
        dg = DeltaGenerator(container=container)
        self.assertEqual(0, dg._cursor.index)
        self.assertEqual(container, dg._container)

        test_data = "some test data"
        text_proto = TextProto()
        text_proto.body = test_data
        new_dg = dg._enqueue("text", text_proto)

        self.assertNotEqual(dg, new_dg)
        self.assertEqual(1, dg._cursor.index)
        self.assertEqual(container, new_dg._container)

        element = self.get_delta_from_queue().new_element
        self.assertEqual(element.text.body, test_data)
예제 #5
0
 def _redo(self, c4: Column):
     if c4.button("Redo"):
         self.map = self._get_map()
         self.current_wp = min(self.current_wp + 1, len(self.waypoints))
         for wp in self.waypoints[:self.current_wp]:
             wp.marker.add_to(self.map)
         self._add_lines(self.waypoints[:self.current_wp])
예제 #6
0
 def _undo(self, c4: Column):
     if c4.button("Undo"):
         self.map = self._get_map()
         self.current_wp = max(self.current_wp - 1, 0)
         for wp in self.waypoints[:self.current_wp]:
             wp.marker.add_to(self.map)
         self._add_lines(self.waypoints[:self.current_wp])
예제 #7
0
    def test_enqueue_same_id(self):
        cursor = LockedCursor(root_container=RootContainer.MAIN, index=123)
        dg = DeltaGenerator(root_container=RootContainer.MAIN, cursor=cursor)
        self.assertEqual(123, dg._cursor.index)

        test_data = "some test data"
        text_proto = TextProto()
        text_proto.body = test_data
        new_dg = dg._enqueue("text", text_proto)

        self.assertEqual(dg._cursor, new_dg._cursor)

        msg = self.get_message_from_queue()
        # The last element in delta_path is the delta's index in its container.
        self.assertEqual(make_delta_path(RootContainer.MAIN, (), 123),
                         msg.metadata.delta_path)
        self.assertEqual(msg.delta.new_element.text.body, test_data)
예제 #8
0
 def test_enqueue_null(self):
     # Test "Null" Delta generators
     dg = DeltaGenerator(container=None)
     new_dg = dg._enqueue("empty", EmptyProto())
     self.assertEqual(dg, new_dg)
예제 #9
0
 def test_constructor_with_id(self):
     """Test DeltaGenerator() with an id."""
     cursor = LockedCursor(index=1234)
     dg = DeltaGenerator(cursor=cursor)
     self.assertTrue(dg._cursor.is_locked)
     self.assertEqual(dg._cursor.index, 1234)
예제 #10
0
 def test_constructor(self):
     """Test default DeltaGenerator()."""
     dg = DeltaGenerator()
     self.assertFalse(dg._cursor.is_locked)
     self.assertEqual(dg._cursor.index, 0)
예제 #11
0
 def _get_mission(self, c2: Column):
     mission = c2.file_uploader("Drop Mission Here", type=['miz'])
     if mission:
         self.selected_mission = mission.name
         with open("temp.miz", 'wb') as file:
             file.write(mission.read())
예제 #12
0
 def _add_metric(column: DeltaGenerator, metric_label: str,
                 metric_value: str) -> None:
     column.metric(metric_label, metric_value)
예제 #13
0
def write_operation_info(kiara: Kiara,
                         operation_id: str,
                         container: DeltaGenerator = st):

    # this retrieve the object for the operation we are interested in
    operation: Operation = kiara.operation_mgmt.profiles[operation_id]

    # this is all operation specific data that is available, pick what you need
    container.markdown("## Operation info")
    container.markdown("### Type metadata")
    type_metadata = operation.module_cls.get_type_metadata()
    container.write(type_metadata.dict())
    # you can access specific elements via the Python object attributes, like:
    # type_metadata.context.references
    container.markdown(("### Inputs"))
    for field_name, schema in operation.input_schemas.items():
        container.write(f"#### {field_name}")
        container.write(schema.dict())
    container.markdown(("### Outputs"))
    for field_name, schema in operation.output_schemas.items():
        container.write(f"#### {field_name}")
        container.write(schema.dict())