Skip to content

Commit

Permalink
Update operation.py style and remove duplicate code
Browse files Browse the repository at this point in the history
  • Loading branch information
angelom93 committed May 6, 2024
1 parent d14fa7b commit 6b0f9c5
Showing 1 changed file with 8 additions and 35 deletions.
43 changes: 8 additions & 35 deletions field_friend/interface/components/operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ def center_map_button() -> None:
if self.field_provider.active_field is not None and len(self.field_provider.active_field.outline_wgs84) > 0:
ui.button(on_click=lambda: self.leaflet_map.m.set_center(self.field_provider.active_field.outline_wgs84[0])) \
.props('icon=place color=primary fab-mini flat').tooltip('center map on point').classes('ml-0')
ui.button(on_click=lambda: self.leaflet_map.m.set_center(self.field_provider.active_field.outline_wgs84[0])) \
.props('icon=place color=primary fab-mini flat').tooltip('center map on point').classes('ml-0')
else:
ui.icon('place').props('size=sm color=grey').classes('ml-2')
center_map_button()
Expand Down Expand Up @@ -85,23 +83,6 @@ def show_field_selection() -> None:
.classes('w-32') \
.bind_value(self.system.mowing, 'minimum_turning_radius') \
.tooltip('Set the turning radius for the mowing automation')
ui.number('Padding', value=0.5, step=0.1, min=0.0, format='%.1f') \
.props('dense outlined suffix=m').classes('w-24') \
.bind_value(system.mowing, 'padding') \
.tooltip('Set the padding for the mowing automation')
ui.number('Lane distance', value=0.5, step=0.1, min=0.0, format='%.1f') \
.props('dense outlined suffix=m') \
.classes('w-24').bind_value(system.mowing, 'lane_distance') \
.tooltip('Set the lane distance for the system. automation')
ui.number('Number of outer lanes', value=3, step=1, min=3, format='%.0f') \
.props('dense outlined').classes('w-28') \
.bind_value(system.mowing, 'number_of_outer_lanes') \
.tooltip('Set the number of outer lanes for the mowing automation')
ui.number('Min. turning radius', format='%.2f', value=0.5, step=0.05, min=0.1, max=2.0) \
.props('dense outlined suffix=m') \
.classes('w-32') \
.bind_value(self.system.mowing, 'minimum_turning_radius') \
.tooltip('Set the turning radius for the mowing automation')

with ui.column().bind_visibility_from(self.automations_toggle, 'value', value='weeding'):
ui.separator()
Expand Down Expand Up @@ -218,9 +199,6 @@ def show_field_selection() -> None:
self.with_field_planning_monitor = ui.checkbox('Use field planning', value=True) \
.bind_value(self.system.monitoring, 'use_field_planning') \
.tooltip('Set the monitoring automation to use the field planning with GNSS')
self.with_field_planning_monitor = ui.checkbox('Use field planning', value=True) \
.bind_value(self.system.monitoring, 'use_field_planning') \
.tooltip('Set the monitoring automation to use the field planning with GNSS')

with ui.row().bind_visibility_from(self.with_field_planning_monitor, 'value', value=True):
self.show_start_row()
Expand All @@ -230,20 +208,15 @@ def show_field_selection() -> None:
.props('dense outlined suffix=m').classes('w-30') \
.bind_value(self.system.monitoring, 'minimum_turning_radius') \
.tooltip('Set the turning radius for the monitoring automation')
ui.number('Min. turning radius', format='%.2f',
value=0.5, step=0.05, min=0.05, max=2.0) \
.props('dense outlined suffix=m').classes('w-30') \
.bind_value(self.system.monitoring, 'minimum_turning_radius') \
.tooltip('Set the turning radius for the monitoring automation')

with ui.column().bind_visibility_from(self.automations_toggle, 'value', value='collecting (demo)'):
with ui.row():
ui.number('Drill angle', format='%.0f', value=100, step=1, min=1, max=180) \
.props('dense outlined suffix=°').classes('w-24') \
.bind_value(self.system.coin_collecting, 'angle') \
.tooltip('Set the drill depth for the weeding automation')
ui.checkbox('with drilling', value=True) \
.bind_value(self.system.coin_collecting, 'with_drilling')
with ui.column().bind_visibility_from(self.automations_toggle, 'value', value='collecting (demo)'):
with ui.row():
ui.number('Drill angle', format='%.0f', value=100, step=1, min=1, max=180) \
.props('dense outlined suffix=°').classes('w-24') \
.bind_value(self.system.coin_collecting, 'angle') \
.tooltip('Set the drill depth for the weeding automation')
ui.checkbox('with drilling', value=True) \
.bind_value(self.system.coin_collecting, 'with_drilling')
ui.space()
with ui.row().style("margin: 1rem; width: calc(100% - 2rem);"):
with ui.column():
Expand Down

0 comments on commit 6b0f9c5

Please sign in to comment.