コード例 #1
0
    def show_dialog_remove_song(self, song_rowview):
        """
        Show a dialog to ask for confirmation of the removal.
        :param song_rowview:
        :return:
        """
        text=f"Are you sure want to remove [color={get_hex_from_color(Songs.app.theme_cls.primary_color)}][b]{str(song_rowview.song_entry_obj.file_path.stem)}[/b][/color] from the list? This action cannot be undone."

        CU.show_ok_cancel_dialog(title=f"Are You Sure?",
                                 text=text,
                                 size_hint=(.7, .4),
                                 text_button_ok="Remove",
                                 text_button_cancel="Cancel",
                                 ok_callback_set=lambda *args, **kwargs: (self.remove_song(song_rowview, args), self.refresh_list()),
                                 cancel_callback_set=lambda *args, **kwargs: (toast(f"Canceled removal of {str(song_rowview.song_entry_obj.file_path.stem)}")))
コード例 #2
0
    def on_stop(self, *args, **kwargs):
        # Important: *args and **kwargs can both be passed to a method, *args takes care of all unexpected
        # (variable amount) of positional arguments and **kwargs takes care of all unexpected (variable amount)
        # of named arguments.
        CU.show_ok_cancel_dialog(
            title="Confirmation dialog",
            text=
            f"Are you sure you want to [color={get_hex_from_color(self.theme_cls.primary_color)}][b]quit[/b][/color] {CU.tfs.dic['APP_NAME'].value}?",
            size_hint=(0.5, 0.3),
            text_button_ok="Yes",
            text_button_cancel="No",
            ok_callback_set=lambda *args, **kwargs: self.stop(),
            cancel_callback_set=lambda *args, **kwargs: toast("Not quitting"))

        return True