show_snackbar.py
1 ''' 2 QuickSave allows you to download videos from YotuTube 3 Copyright (C) 2025 Andrés Chaparro 4 5 This program is free software: you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation, either version 3 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program. If not, see <https://www.gnu.org/licenses/>. 17 ''' 18 19 from kivymd.uix.snackbar import MDSnackbar, MDSnackbarSupportingText 20 from kivy.metrics import dp 21 22 ''' 23 This class allows you 24 to display a custom message 25 on the screen 26 ''' 27 28 class ShowSnackbar(): 29 30 @staticmethod 31 def show(message): 32 ''' 33 displays a pop-up message 34 ''' 35 try: 36 MDSnackbar( 37 MDSnackbarSupportingText( 38 text=message, 39 ), 40 y=dp(24), 41 orientation="horizontal", 42 pos_hint={"center_x": 0.5}, 43 size_hint_x=0.5, 44 ).open() 45 except Exception as e: 46 ShowSnackbar.show(f"Error: {e}") 47 print(f"Error: {e}")