Skip to content
Browse files

Use QgsPasswordLineEdit for zip file pasword prompt.

  • Loading branch information
borysiasty committed Sep 13, 2018
1 parent 0f7a099 commit 9bd532faf662e426a4a7d2305fe6e79067cdbfb0
Showing with 16 additions and 3 deletions.
  1. +16 −3 python/pyplugin_installer/
@@ -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,
@@ -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

0 comments on commit 9bd532f

Please sign in to comment.
You can’t perform that action at this time.