Example #1
0
    def __init__(self, script_id, device_id, **kwargs):
        super(StepPickerListScreen, self).__init__(**kwargs)

        self.script_id = script_id
        self.device_id = device_id
        self.params_names = None
        self.params_descriptions = None
        self.params_set = []
        self.step_chosen = None
        self.last_application_id_chosen = None

        layout = FloatLayout()
        root = build()
        root.data = [StepRecycleViewItem().build(root_widget=self, text=item.name, step_id=item.id)
                     for item in get_steps()]

        layout.add_widget(root)

        back_button_image = resource_path('assets/back_button.png')
        back_button = ImageButton(
            size_hint=(.11, .11),
            font_size=50,
            pos_hint={'center_x': .08, 'center_y': .08},
            image_source=back_button_image
        )
        back_button.bind(on_release=self.go_back)

        layout.add_widget(back_button)

        self.add_widget(layout)
    def __init__(self, user_step_command_id, **kwargs):
        super(UserStepViewerScreen, self).__init__(**kwargs)
        self.user_step_command_id = user_step_command_id

        layout = FloatLayout()

        steps_text = ""
        steps = get_user_steps(self.user_step_command_id)
        for step in steps:
            if step.command.is_adb:
                steps_text += "adb "
            steps_text += step.command.value + "\n\n"

        steps_label = Label(
            text=steps_text,
            font_size=40,
            halign="left",
            valign="top",
            text_size=(dp(750), dp(350)),
            pos_hint={'center_x': .5, 'center_y': .7}
        )
        layout.add_widget(steps_label)

        back_button_image = resource_path('assets/back_button.png')
        back_button = ImageButton(
            size_hint=(image_buttons_width, image_buttons_height),
            pos_hint={'center_x': .08, 'center_y': buttons_bottom_alignment_value},
            image_source=back_button_image
        )
        back_button.bind(on_release=self.go_back)
        layout.add_widget(back_button)

        delete_button_image = resource_path('assets/delete_button.png')
        delete_script_button = ImageButton(
            size_hint=(image_buttons_width, image_buttons_height),
            background_color=negative_button_background,
            pos_hint={'center_x': .9, 'center_y': buttons_bottom_alignment_value},
            image_source=delete_button_image
        )
        delete_script_button.bind(on_release=self.optionally_delete_user_step)
        layout.add_widget(delete_script_button)

        self.add_widget(layout)
Example #3
0
    def __init__(self, **kwargs):
        super(ScriptListViewerScreen, self).__init__(**kwargs)

        layout = FloatLayout()
        self.root = build()
        self.update_scripts_list()

        layout.add_widget(self.root)

        back_button_image = resource_path('assets/back_button.png')
        back_button = ImageButton(size_hint=(.11, .11),
                                  pos_hint={
                                      'center_x': .08,
                                      'center_y': .08
                                  },
                                  image_source=back_button_image)
        back_button.bind(on_press=self.go_back)

        layout.add_widget(back_button)

        self.add_widget(layout)
    def __init__(self, script_id=None, **kwargs):
        super(ScriptEditorScreen, self).__init__(**kwargs)
        self.script_id = script_id

        if script_id is None:
            created_script = create_script_in_database()
            self.script_id = created_script.id

        self.selected_device_id = None

        layout = FloatLayout()

        buttons_right_alignment_value = .85
        buttons_width = .23
        buttons_height = .13
        buttons_font_size = 45

        self.add_step_button = Button(text="Add step",
                                      size_hint=(buttons_width,
                                                 buttons_height),
                                      font_size=buttons_font_size,
                                      pos_hint={
                                          'center_x':
                                          buttons_right_alignment_value,
                                          'center_y': .9
                                      })
        self.add_step_button.bind(on_release=self.show_steps_list)
        layout.add_widget(self.add_step_button)

        self.select_device_button = Button(text="Select device",
                                           size_hint=(buttons_width,
                                                      buttons_height),
                                           font_size=buttons_font_size,
                                           pos_hint={
                                               'center_x':
                                               buttons_right_alignment_value,
                                               'center_y': .75
                                           })
        self.select_device_button.bind(on_release=self.show_connected_devices)
        self.update_add_step_button_state()
        layout.add_widget(self.select_device_button)

        delete_script_button = ImageButton(
            size_hint=(image_buttons_width, image_buttons_height),
            background_color=negative_button_background,
            pos_hint={
                'center_x': .56,
                'center_y': buttons_bottom_alignment_value
            },
            image_source=resource_path('assets/delete_button.png'))
        delete_script_button.bind(on_release=self.optionally_delete_script)
        layout.add_widget(delete_script_button)

        duplicate_script_button = ImageButton(
            size_hint=(image_buttons_width, image_buttons_height),
            background_color=neutral_button_background,
            pos_hint={
                'center_x': .68,
                'center_y': buttons_bottom_alignment_value
            },
            image_source=resource_path('assets/duplicate_button.png'))
        duplicate_script_button.bind(on_release=self.on_duplicate_button_click)
        layout.add_widget(duplicate_script_button)

        self.run_script_button = ImageButton(
            size_hint=(image_buttons_width, image_buttons_height),
            background_color=positive_button_background,
            pos_hint={
                'center_x': .80,
                'center_y': buttons_bottom_alignment_value
            },
            image_source=resource_path('assets/run_button.png'))
        self.run_script_button.bind(on_release=self.run_script)
        layout.add_widget(self.run_script_button)

        save_button = ImageButton(
            size_hint=(image_buttons_width, image_buttons_height),
            background_color=positive_button_background,
            pos_hint={
                'center_x': .92,
                'center_y': buttons_bottom_alignment_value
            },
            image_source=resource_path('assets/save_button.png'))
        save_button.bind(on_release=self.on_save_button_click)
        layout.add_widget(save_button)

        back_button_image = resource_path('assets/back_button.png')
        back_button = ImageButton(size_hint=(image_buttons_width,
                                             image_buttons_height),
                                  pos_hint={
                                      'center_x': .08,
                                      'center_y':
                                      buttons_bottom_alignment_value
                                  },
                                  image_source=back_button_image)
        back_button.bind(on_release=self.go_back)
        layout.add_widget(back_button)

        self.user_steps_list = build()
        self.update_user_steps_list()
        layout.add_widget(self.user_steps_list)

        self.add_widget(layout)
Example #5
0
    def show_pop_up_layout_for_parameter(self, param_name):
        layout = FloatLayout()

        popup = Popup(
            title='Add asked parameter',
            content=layout,
            size_hint=(0.5, 0.5),
            title_align="center",
            title_size="20sp"
        )

        param_name_label = Label(
            text=param_name,
            font_size=40,
            text_size=(dp(350), dp(150)),
            halign="center",
            valign="top",
            pos_hint={'center_x': .5, 'center_y': .65}

        )
        layout.add_widget(param_name_label)

        if param_name in self.params_descriptions:
            param_description = self.params_descriptions[param_name]

            help_button_image = resource_path('assets/help_button.png')
            help_param_button = ImageButton(
                size_hint=(.08, .12),
                background_color=(1, 1, 1, 1),
                pos_hint={'center_x': .8, 'center_y': .92},
                image_source=help_button_image
            )
            help_param_button.bind(on_release=lambda x: show_info_popup("Info", param_description))
            layout.add_widget(help_param_button)

        param_input = TextInput(
            font_size=40,
            halign="center",
            multiline=True,
            size_hint=(.8, .4),
            padding=[10, 10, 10, 10],
            pos_hint={'center_x': .5, 'center_y': .6}
        )
        layout.add_widget(param_input)
        if param_name == "Application id":
            self.optionally_prefill_last_application_id(param_input)

        cancel_button = Button(
            text="Cancel",
            size_hint=(.3, .25),
            font_size=35,
            pos_hint={'center_x': .3, 'center_y': .2}
        )
        cancel_button.bind(on_press=lambda x: popup.dismiss())
        layout.add_widget(cancel_button)

        add_button = Button(
            text="Add",
            size_hint=(.3, .25),
            font_size=35,
            pos_hint={'center_x': .7, 'center_y': .2}
        )
        add_button.bind(on_press=lambda x: self.on_save_param(param_name, param_input.text, popup))
        layout.add_widget(add_button)

        popup.open()