def initialise(self):
     i = 0
     self.add_menu_item(
         MenuItem(i, "Exit current menu").set_as_exit_option())
     i += 1
     self.add_menu_item(
         MenuItem(i, "Process Learning Data",
                  lambda: self.process_learning_data()))
 def initialise(self):
     self.add_menu_item(MenuItem(0, "Exit menu").set_as_exit_option())
     self.add_menu_item(MenuItem(1, "Demo sub menu", menu=DemoSubMenu()))
     self.add_menu_item(
         MenuItem(2, "Show hidden menu item",
                  lambda: self.__should_show_hidden_menu__()))
     self.add_hidden_menu_item(
         MenuItem(3, "Hidden menu item",
                  lambda: print("I was a hidden menu item")))
Beispiel #3
0
 def initialise(self):
     self.add_menu_item(MenuItem(0, "Exit menu").set_as_exit_option())
     self.add_menu_item(
         MenuItem(
             1, "Stop",
             lambda: [print("Stop"),
                      self.m.enable(),
                      self.m.disable()]))
     self.add_menu_item(
         MenuItem(
             2, "Forward", lambda: [
                 print("move forward"),
                 self.m.move_forward(infinite_move),
                 print("moving")
             ]))
     self.add_menu_item(
         MenuItem(
             3, "Backward", lambda: [
                 print("move backward"),
                 self.m.move_backward(infinite_move),
                 print("moving")
             ]))
     self.add_menu_item(
         MenuItem(
             4, "Left", lambda: [
                 print("move left"),
                 self.m.slide_left(infinite_move),
                 print("moving")
             ]))
     self.add_menu_item(
         MenuItem(
             5, "Right", lambda: [
                 print("move right"),
                 self.m.slide_right(infinite_move),
                 print("moving")
             ]))
     self.add_menu_item(
         MenuItem(
             6, "Concerning Left", lambda: [
                 print("concerning left"),
                 self.m.concerning_left(infinite_move),
                 print("moving")
             ]))
     self.add_menu_item(
         MenuItem(
             7, "Concerning Right", lambda: [
                 print("concerning right"),
                 self.m.concerning_right(infinite_move),
                 print("moving")
             ]))
     self.add_menu_item(
         MenuItem(
             8, "Rotate Right", lambda: [
                 print("rotate right"),
                 self.m.rotate_right(infinite_move),
                 print("moving")
             ]))
 def initialise(self):
     i = 0
     self.add_menu_item(
         MenuItem(i, "Exit current menu").set_as_exit_option())
     i += 1
     self.add_menu_item(
         MenuItem(i, "Load Test Data", lambda: self.load_test_data()))
     i += 1
     self.add_menu_item(
         MenuItem(i, "Load New Data", lambda: self.load_new_data()))
     i += 1
     self.add_menu_item(
         MenuItem(i, "Pull Team Data", lambda: self.pull_team_data()))
     i += 1
     self.add_menu_item(
         MenuItem(i, "Save to  Database", lambda: self.save_to_database()))
 def initialise(self):
     self.add_menu_item(MenuItem(0, "Exit menu").set_as_exit_option())
     self.add_menu_item(MenuItem(1, "Stop", lambda: [print("Stop"), self.m.stop()]))
     self.add_menu_item(MenuItem(2, "Forward",
                                 lambda: [print("move forward"),
                                          self.m.move_forward(),
                                          print("moving")
                                          ]))
     self.add_menu_item(MenuItem(3, "Backward",
                                 lambda: [print("move backward"),
                                          self.m.move_backward(),
                                          print("moving")
                                          ]))
     self.add_menu_item(MenuItem(4, "Left",
                                 lambda: [print("move left"),
                                          self.m.slide_left(),
                                          print("moving")
                                          ]))
     self.add_menu_item(MenuItem(5, "Right",
                                 lambda: [print("move right"),
                                          self.m.slide_right(),
                                          print("moving")
                                          ]))
     self.add_menu_item(MenuItem(6, "Rotate Right",
                                 lambda: [print("rotate right"),
                                          self.m.rotate_left(),
                                          print("moving")
                                          ]))
Beispiel #6
0
    def __init__(self, station_list=None):
        super().__init__("Radio Player Menu")
        if station_list is None:
            station_list = []

        for i in range(len(station_list)):
            if i < maxitems():  # The very first item is the exit option, so not "<=".
                self.add_menu_item(
                    MenuItem(
                        i,
                        "{:<30}".format(station_list[i]["name"][:30]) + " " +  # force 35 character fixed length
                        "{:<5}".format(station_list[i]["codec"][:5]) + " " +   # force 5 character fixed length
                        "{:<5}".format(station_list[i]["bitrate"][:5]) + " " +
                        station_list[i]["url"],
                        lambda url=station_list[i]["url"]: subprocess.run([player(), options(), url])
                    )
                )
            else:
                break
Beispiel #7
0
 def initialise(self):
     self.add_menu_item(MenuItem(100, "Exit menu").set_as_exit_option())
     self.add_menu_item(
         MenuItem(101, "Display map",
                  lambda: print(self.map.original_matrix)))
     self.add_menu_item(
         MenuItem(102, "Solve using B&B",
                  self.create_handler(self.atsp.branch_and_bound)))
     self.add_menu_item(
         MenuItem(
             103, "Find first solution using B&B",
             self.create_handler(
                 self.atsp.first_branch_and_bound_solution)))
     self.add_menu_item(
         MenuItem(104, "Solve using brute force",
                  self.create_handler(self.atsp.brute_force)))
     self.add_menu_item(
         MenuItem(105, "Solve using simulated annealing", self.sa_menu))
     self.add_menu_item(
         MenuItem(106, "Solve using genetic algorithm", self.ga_menu))
Beispiel #8
0
 def initialise(self):
     self.add_menu_item(MenuItem(0, "Exit menu").set_as_exit_option())
     self.add_menu_item(MenuItem(1, "Forward", print("move forward")))
     self.add_menu_item(
         MenuItem(2, "Backward", lambda: print("move backward")))
 def initialise(self):
     self.add_menu_item(
         MenuItem(0, "Exit current menu").set_as_exit_option())
     self.add_menu_item(
         MenuItem(1, "Demo sub menu item",
                  lambda: print("Demo sub menu item selected")))
Beispiel #10
0
 def initialise(self):
     self.add_menu_item(MenuItem(maxitems(), "Exit menu").set_as_exit_option())
 def initialise(self):
     self.add_menu_item(MenuItem(0, "Exit menu").set_as_exit_option())
     self.add_menu_item(
         MenuItem(1, "Get Player Data ", menu=PlayerDataSubMenu()))
     self.add_menu_item(
         MenuItem(2, "Machine Learning", menu=MachineLearingSubMenu()))
Beispiel #12
0
 def initialise(self):
     self.add_menu_item(MenuItem(100, "退出").set_as_exit_option())
     self.add_menu_item(MenuItem(101, "查询学生", lambda: search()))
     self.add_menu_item(MenuItem(102, "统计班级学生数", lambda: student()))
     self.add_menu_item(MenuItem(103, "查询班级中选课情况", lambda: status()))