1- from qgis .PyQt .QtWidgets import QApplication , QDialog , QMessageBox , QStyle
1+ from qgis .PyQt .QtGui import QIcon
2+ from qgis .PyQt .QtWidgets import QApplication , QDialog , QLineEdit , QMessageBox , QStyle
23
34from ..core .settings import Settings
45from ..utils .plugin_utils import PluginUtils
@@ -11,7 +12,16 @@ def __init__(self, parent=None):
1112 QDialog .__init__ (self , parent )
1213 self .setupUi (self )
1314
15+ self .githubToken_lineEdit .setEchoMode (QLineEdit .EchoMode .Password )
1416 self .githubToken_lineEdit .setText (Settings ().github_token .value ())
17+
18+ # Toggle visibility action inside the line edit
19+ self ._toggle_token_action = self .githubToken_lineEdit .addAction (
20+ QIcon (PluginUtils .get_plugin_icon_path ("eye.svg" )),
21+ QLineEdit .ActionPosition .TrailingPosition ,
22+ )
23+ self ._toggle_token_action .setToolTip (self .tr ("Show/hide token" ))
24+ self ._toggle_token_action .triggered .connect (self .__toggle_token_visibility )
1525 self .allow_multiple_modules_checkBox .setChecked (Settings ().allow_multiple_modules .value ())
1626 self .show_experimental_modules_checkBox .setChecked (
1727 Settings ().show_experimental_modules .value ()
@@ -40,6 +50,12 @@ def accept(self):
4050 Settings ().log_show_module .setValue (self .log_show_module_checkBox .isChecked ())
4151 super ().accept ()
4252
53+ def __toggle_token_visibility (self ):
54+ if self .githubToken_lineEdit .echoMode () == QLineEdit .EchoMode .Password :
55+ self .githubToken_lineEdit .setEchoMode (QLineEdit .EchoMode .Normal )
56+ else :
57+ self .githubToken_lineEdit .setEchoMode (QLineEdit .EchoMode .Password )
58+
4359 def __show_github_token_help (self ):
4460 QMessageBox .information (
4561 self ,
0 commit comments