From 6ed931bd5a6978bf69303d4eb69eab406983fbf1 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Tue, 18 Aug 2009 02:08:37 +0200 Subject: * digital/avr/modules/path/test: - add obstacle button. --- digital/avr/modules/path/test/avrconfig.h | 2 +- digital/avr/modules/path/test/test_path.py | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) (limited to 'digital') diff --git a/digital/avr/modules/path/test/avrconfig.h b/digital/avr/modules/path/test/avrconfig.h index 476fee86..8da6dbc6 100644 --- a/digital/avr/modules/path/test/avrconfig.h +++ b/digital/avr/modules/path/test/avrconfig.h @@ -31,7 +31,7 @@ /** Report function name. */ #define AC_PATH_REPORT_CALLBACK path_report /** Number of possible obstacles. */ -#define AC_PATH_OBSTACLES_NB 2 +#define AC_PATH_OBSTACLES_NB 10 /** Number of points per obstacle. */ #define AC_PATH_OBSTACLES_POINTS_NB 8 diff --git a/digital/avr/modules/path/test/test_path.py b/digital/avr/modules/path/test/test_path.py index 58939ff6..498e6017 100644 --- a/digital/avr/modules/path/test/test_path.py +++ b/digital/avr/modules/path/test/test_path.py @@ -148,6 +148,20 @@ class TestPath (Frame): orient = 'horizontal', from_ = 0, to = 16, command = self.escape_changed) self.escapeScale.pack (side = 'top') + self.newObstacleFrame = LabelFrame (self.rightFrame) + self.newObstacleFrame.pack (side = 'top') + self.newObstacleRadius = Scale (self.newObstacleFrame, + label = 'Radius', orient = 'horizontal', + from_ = 50, to = 500, resolution = 50) + self.newObstacleRadius.pack (side = 'top') + self.newObstacleFactor = Scale (self.newObstacleFrame, + label = 'Factor', orient = 'horizontal', + from_ = 0, to = 16, resolution = 1) + self.newObstacleFactor.pack (side = 'top') + self.newObstacle = Button (self.newObstacleFrame, + text = 'New obstacle', command = self.new_obstacle) + self.newObstacleFrame.configure (labelanchor = 'n', + labelwidget = self.newObstacle) self.areaview = AreaView (border_min, border_max, self) self.areaview.pack (expand = True, fill = 'both') self.areaview.bind ('<1>', self.click) @@ -196,6 +210,13 @@ class TestPath (Frame): self.areaview.area.escape = value self.update () + def new_obstacle (self): + radius = self.newObstacleRadius.get () + factor = self.newObstacleFactor.get () + self.areaview.area.obstacles.append (Obstacle ((750, 750), radius, + factor)) + self.update () + if __name__ == '__main__': app = TestPath ((0, 0), (1500, 1500)) app.mainloop () -- cgit v1.2.3