Skip to content
Merged
23 changes: 22 additions & 1 deletion napari_plugin_manager/qt_plugin_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
QListWidget,
QListWidgetItem,
QMenu,
QMessageBox,
QPushButton,
QSizePolicy,
QSplitter,
Expand Down Expand Up @@ -531,6 +532,26 @@ def _action_requested(self):
if self.action_button.objectName() == 'install_button'
else InstallerActions.UNINSTALL
)
if (
tool == InstallerTools.PIP
and action == InstallerActions.INSTALL
and ON_BUNDLE
):
button_clicked = QMessageBox.warning(
self,
trans._('PyPI installation on bundle'),
trans._(
'Installing from PyPI does not take into account existing installed packages, '
'so it can break existing installations. '
'If this happens the only solution is to reinstall the bundle.\n\n'
'Are you sure you want to install from PyPI?'
),
buttons=QMessageBox.StandardButton.Ok
| QMessageBox.StandardButton.Cancel,
defaultButton=QMessageBox.StandardButton.Cancel,
)
if button_clicked != QMessageBox.StandardButton.Ok:
return
self.actionRequested.emit(self.item, self.name, action, version, tool)

def _update_requested(self):
Expand Down Expand Up @@ -1215,7 +1236,7 @@ def _setup_ui(self):
self.working_indicator.setMovie(mov)
mov.start()

visibility_direct_entry = not running_as_constructor_app()
visibility_direct_entry = not ON_BUNDLE
self.direct_entry_edit = QLineEdit(self)
self.direct_entry_edit.installEventFilter(self)
self.direct_entry_edit.returnPressed.connect(self._install_packages)
Expand Down