2222
2323import os
2424import gi
25+ import typing
2526
2627gi .require_version ("Gtk" , "4.0" )
2728from gi .repository import Gtk
@@ -43,12 +44,17 @@ class RequiredPluginDialog(Gtk.ApplicationWindow):
4344
4445 __gtype_name__ = "RequiredPluginDialog"
4546
46- lbl_header = Gtk .Template .Child ()
47- lbl_message = Gtk .Template .Child ()
48- btn_extra_link = Gtk .Template .Child ()
47+ lbl_header : Gtk . Label = Gtk .Template .Child ()
48+ lbl_message : Gtk . Label = Gtk .Template .Child ()
49+ btn_extra_link : Gtk . LinkButton = Gtk .Template .Child ()
4950
5051 def __init__ (
51- self , plugin_id , plugin_name , message , on_quit , on_disable_plugin , application
52+ self ,
53+ plugin_name : str ,
54+ message : typing .Union [str , PluginDependency ],
55+ on_quit : typing .Callable [[], None ],
56+ on_disable_plugin : typing .Callable [[], None ],
57+ application : Gtk .Application ,
5258 ):
5359 super ().__init__ (application = application )
5460
@@ -61,27 +67,28 @@ def __init__(
6167
6268 if isinstance (message , PluginDependency ):
6369 self .lbl_message .set_label (_ (message .message ))
64- self .btn_extra_link .set_uri (message .link )
70+ if message .link is not None :
71+ self .btn_extra_link .set_uri (message .link )
6572 self .btn_extra_link .set_visible (True )
6673 else :
6774 self .lbl_message .set_label (_ (message ))
6875
69- def show (self ):
76+ def show (self ) -> None :
7077 """Show the dialog."""
7178 self .present ()
7279
7380 @Gtk .Template .Callback ()
74- def on_window_delete (self , * args ):
81+ def on_window_delete (self , * args ) -> None :
7582 """Window close event handler."""
7683 self .destroy ()
7784 self .on_quit ()
7885
7986 @Gtk .Template .Callback ()
80- def on_close_clicked (self , * args ):
87+ def on_close_clicked (self , * args ) -> None :
8188 self .destroy ()
8289 self .on_quit ()
8390
8491 @Gtk .Template .Callback ()
85- def on_disable_plugin_clicked (self , * args ):
92+ def on_disable_plugin_clicked (self , * args ) -> None :
8693 self .destroy ()
8794 self .on_disable_plugin ()
0 commit comments