66
77from .qfit_config_dialog import QfitConfigDialog
88from .qfit_dockwidget import QfitDockWidget
9+ from .ui .about_dock import QfitAboutDock
910
1011MENU_NAME = "&qfit"
1112
@@ -15,8 +16,10 @@ def __init__(self, iface):
1516 self .iface = iface
1617 self .activities_action = None
1718 self .config_action = None
19+ self .about_action = None
1820 self .dockwidget = None
1921 self ._config_dialog = None
22+ self ._about_dock = None
2023
2124 def initGui (self ):
2225 icon_path = os .path .join (os .path .dirname (__file__ ), "icon.png" )
@@ -31,6 +34,10 @@ def initGui(self):
3134 self .config_action .triggered .connect (self .show_config )
3235 self .iface .addPluginToMenu (MENU_NAME , self .config_action )
3336
37+ self .about_action = QAction (icon , "About" , self .iface .mainWindow ())
38+ self .about_action .triggered .connect (self .show_about )
39+ self .iface .addPluginToMenu (MENU_NAME , self .about_action )
40+
3441 def unload (self ):
3542 if self .activities_action is not None :
3643 self .iface .removePluginMenu (MENU_NAME , self .activities_action )
@@ -41,11 +48,20 @@ def unload(self):
4148 self .iface .removePluginMenu (MENU_NAME , self .config_action )
4249 self .config_action = None
4350
51+ if self .about_action is not None :
52+ self .iface .removePluginMenu (MENU_NAME , self .about_action )
53+ self .about_action = None
54+
4455 if self .dockwidget is not None :
4556 self .iface .removeDockWidget (self .dockwidget )
4657 self .dockwidget .deleteLater ()
4758 self .dockwidget = None
4859
60+ if self ._about_dock is not None :
61+ self .iface .removeDockWidget (self ._about_dock )
62+ self ._about_dock .deleteLater ()
63+ self ._about_dock = None
64+
4965 if self ._config_dialog is not None :
5066 self ._config_dialog .close ()
5167 self ._config_dialog .deleteLater ()
@@ -70,6 +86,15 @@ def show_config(self):
7086 self ._config_dialog .raise_ ()
7187 self ._config_dialog .activateWindow ()
7288
89+ def show_about (self ):
90+ if self ._about_dock is None :
91+ self ._about_dock = QfitAboutDock (parent = self .iface .mainWindow ())
92+ self .iface .addDockWidget (Qt .RightDockWidgetArea , self ._about_dock )
93+ self ._about_dock .setFloating (True )
94+ self ._about_dock .show ()
95+ self ._about_dock .raise_ ()
96+ self ._about_dock .activateWindow ()
97+
7398 def _refresh_dock_configuration (self ) -> None :
7499 if self .dockwidget is not None :
75100 self .dockwidget .refresh_configuration_from_settings ()
0 commit comments