Skip to content


Use QgsPasswordLineEdit for zip file pasword prompt.
Browse files Browse the repository at this point in the history
  • Loading branch information
borysiasty committed Sep 13, 2018
1 parent 0f7a099 commit 9bd532f
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions python/pyplugin_installer/
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
import zipfile

from qgis.PyQt.QtCore import Qt, QObject, QDir, QUrl, QFileInfo, QFile
from qgis.PyQt.QtWidgets import QMessageBox, QLabel, QFrame, QApplication, QFileDialog, QInputDialog, QLineEdit
from qgis.PyQt.QtWidgets import QApplication, QDialog, QDialogButtonBox, QFrame, QMessageBox, QLabel, QVBoxLayout
from qgis.PyQt.QtNetwork import QNetworkRequest

import qgis
from qgis.core import Qgis, QgsApplication, QgsNetworkAccessManager, QgsSettings
from qgis.gui import QgsMessageBar
from qgis.gui import QgsMessageBar, QgsPasswordLineEdit
from qgis.utils import (iface, startPlugin, unloadPlugin, loadPlugin,
reloadPlugin, updateAvailablePlugins)
from .installer_data import (repositories, plugins, officialRepo,
Expand Down Expand Up @@ -577,7 +577,20 @@ def installFromZipFile(self, filePath):
msg ='Wrong password. Please enter a correct password to the zip file.')
msg ='The zip file is encrypted. Please enter password.')
password, keepTrying = QInputDialog.getText(iface.mainWindow(),'Enter password'), msg, QLineEdit.Password)
# Display a password dialog with QgsPasswordLineEdit
dlg = QDialog()
dlg.setWindowTitle('Enter password'))
buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal)
lePass = QgsPasswordLineEdit()
layout = QVBoxLayout()
keepTrying = dlg.exec_()
password = lePass.text()
infoString ="Failed to unzip the plugin package\n{}.\nProbably it is broken".format(filePath))
keepTrying = False
Expand Down

0 comments on commit 9bd532f

Please sign in to comment.