Example #1
0
    def test_stop_the_process(self):
        data_dic_s = {}
        data_dic_sw = {}
        data_dic_d = {}

        data_dic_sw['frec_init'] = 10000
        data_dic_sw['frec_end']  = 1000000
        data_dic_sw['frec_number_point'] =  101
        data_dic_sw['power'] = '-6'
        data_dic_sw['ip'] = '192.168.1.34'
        data_dic_sw['port'] = '5023'

        data_dic_s['sweep'] = data_dic_sw

        controller = Coordinator(data_dic_s,data_dic_d)
        self.assertFalse(controller.end_sweep,msg='wrong initialization')
        controller.start()
        time.sleep(1)
        controller.stop_the_process()
        time.sleep(1)
        print controller.end_sweep
        self.assertTrue(controller.end_sweep,msg='fail to stop')
Example #2
0
    def configure_and_turn_on_sources(self, instance):
        source_dictionary = self.source.get_configurations()
        data_dictionary = self.data.get_configurations()
        function_dictionary = self.proces.get_configurations()
        # processing_dictionary = {}
        print data_dictionary

        if not self.coordinator == None:
            self.coordinator.stop_the_process()
        try:
            self.coordinator = Coordinator(source_dictionary, data_dictionary, function_dictionary)
        except FailToConnectTelnet:
            print "No se puede connectar"
            return

        # coordinator runs in a new thread
        self.coordinator.start()
Example #3
0
class RootWidget(BoxLayout):
    def __init__(self):
        super(RootWidget, self).__init__(orientation="vertical", size=(800, 400))
        self.menu = BoxLayout(orientation="horizontal", size_hint=(1, None), size=(1, 40))
        self.panels = BoxLayout(orientation="horizontal")

        button_start = Button(text="Start", size_hint=(0.4, 1), font_size=14)
        button_start.bind(on_press=self.configure_and_turn_on_sources)

        button_stop = Button(text="Stop", size_hint=(0.4, 1), font_size=14)
        button_stop.bind(on_press=self.turn_off)

        button_super_controller = Button(text="Launch Multiple Rutines", size_hint=(0.8, 1))
        button_super_controller.bind(on_press=self.super_controller)

        self.menu.add_widget(button_super_controller)
        self.menu.add_widget(button_start)
        self.menu.add_widget(button_stop)

        self.proces = DataPanel()
        self.data = ExtractPanel()
        self.source = SourcePanel()

        self.data.pass_source(self.source.pass_sources())
        self.data.pass_functions(self.proces.pass_functions())

        self.panels.add_widget(self.proces, 0)
        self.panels.add_widget(self.data, 1)
        self.panels.add_widget(self.source, 2)

        self.add_widget(self.menu)
        self.add_widget(self.panels)

        self.coordinator = None
        self.super_coordinator = None

        self.data.activate_extract(self.get_bram_dictionary)

    def configure_and_turn_on_sources(self, instance):
        source_dictionary = self.source.get_configurations()
        data_dictionary = self.data.get_configurations()
        function_dictionary = self.proces.get_configurations()
        # processing_dictionary = {}
        print data_dictionary

        if not self.coordinator == None:
            self.coordinator.stop_the_process()
        try:
            self.coordinator = Coordinator(source_dictionary, data_dictionary, function_dictionary)
        except FailToConnectTelnet:
            print "No se puede connectar"
            return

        # coordinator runs in a new thread
        self.coordinator.start()

    def configure_super_controller(self, configuration_list):
        """this methos gets the configuratio to run
        multiple routines."""
        print "super controller starter"

        keys = configuration_list.keys()
        keys.sort()

        full_dictionary = []

        for path_key in keys:
            path = configuration_list[path_key]

            self.data.load_data(path)

            source_dictionary = self.source.get_configurations()
            data_dictionary = self.data.get_configurations()
            function_dictionary = self.proces.get_configurations()

            full_dictionary.append((source_dictionary, data_dictionary, function_dictionary))

        self.super_coordinator = SuperCoordinator(full_dictionary)
        self.super_coordinator.start()

    def turn_off(self, instance):
        self.stop_the_sources()

    def stop_the_sources(self):
        self.stop_coordinator()
        self.stop_super_coordinator()

    def stop_super_coordinator(self):
        if self.super_coordinator == None:
            return
        self.super_coordinator.stop_the_process()

    def stop_coordinator(self):
        if self.coordinator == None:
            return
        self.coordinator.stop_the_process()

    def get_bram_dictionary(self):
        free_run = self.data.get_configurations()["roach"]["bram"]
        self.proces.update_free_run_dictionary(free_run)

    def super_controller(self, instance):
        pannel = SuperControllerGUI(self)
        popup = Popup(
            title="Choose Rutines", content=pannel, auto_dismiss=False, size_hint=(None, None), size=(400, 400)
        )
        pannel.add_popup(popup)

        popup.open()