Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate old version and warn end-users about renaming #35

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# This file should be included when you package your plugin.# Mandatory items:

[general]
name=Profile Manager
name=Profile Manager (Deprecated)
qgisMinimumVersion=3.12
description=Makes handling profiles easy by giving you an UI to easily import settings from one profile to another
version=0.31
description=(Deprecated, please update to the new Profile Manager plugin.) Makes handling profiles easy by giving you an UI to easily import settings from one profile to another
version=0.31.1
author=(C) 2022 by WhereGroup GmbH
email=info@wheregroup.com

about=A QGIS Plugin that provides an UI to easily manage your profiles and import various settings from one profile to another
about=(Deprecated, please update to the new Profile Manager plugin.) A QGIS Plugin that provides an UI to easily manage your profiles and import various settings from one profile to another

repository=https://github.com/WhereGroup/profile-manager/
# End of mandatory metadata
Expand All @@ -32,12 +32,12 @@ tracker=https://github.com/WhereGroup/profile-manager/issues
experimental=True

# deprecated flag (applies to the whole plugin, not just a single version)
deprecated=False
deprecated=True

# Since QGIS 3.8, a comma separated list of plugins to be installed
# (or upgraded) can be specified.
# Check the documentation for more information.
# plugin_dependencies=
plugin_dependencies=Plugin Manager

Category of the plugin: Raster, Vector, Database or Web
# category=
Expand Down
33 changes: 28 additions & 5 deletions profile_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import time
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import QSettings, QTranslator, QCoreApplication, QSize
from PyQt5.QtWidgets import QAction, QWidget
from PyQt5.QtWidgets import QAction, QPushButton, QMessageBox, QWidget
from qgis.core import QgsUserProfileManager, Qgis
from pathlib import Path
from sys import platform
Expand Down Expand Up @@ -94,12 +94,35 @@ def __init__(self, iface):

# Declare instance attributes
self.actions = []
self.menu = self.tr(u'&Profile Manager')
self.menu = self.tr("&Profile Manager (Deprecated)")

# Check if plugin was started the first time in current QGIS session
# Must be set in initGui() to survive plugin reloads
self.first_start = None

widget = self.iface.messageBar().createMessage(
"Deprecated plugin version",
"Please manually install the new Profile Manager plugin",
)
button = QPushButton(widget)
button.setText("Instructions")
button.pressed.connect(self.more_info)
widget.layout().addWidget(button)
self.iface.messageBar().pushWidget(widget, Qgis.Warning, duration=15)

def more_info(self):
QMessageBox.critical(
None,
"Deprecated plugin",
"""The installed version of the Profile Manager plugin will not receive any updates.

Please manually uninstall it, restart QGIS, then install the *new* Profile Manager plugin from the QGIS plugin repository. The old one is now called "Profile Manager (deprecated)".

Sorry for the inconvenience and thanks for understanding!
We did significant work on the source code to make future developments easier. One of the changes requires this update.
- The Profile Manager developers""",
)

# noinspection PyMethodMayBeStatic
def tr(self, message):
"""Get the translation for a string using Qt translation API.
Expand Down Expand Up @@ -195,7 +218,7 @@ def initGui(self):
icon_path = ':/plugins/profile_manager/icon.png'
self.add_action(
icon_path,
text=self.tr(u'Profile Manager'),
text=self.tr("Profile Manager (Deprecated)"),
callback=self.run,
parent=self.iface.mainWindow())

Expand All @@ -206,8 +229,8 @@ def unload(self):
"""Removes the plugin menu item and icon from QGIS GUI."""
for action in self.actions:
self.iface.removePluginMenu(
self.tr(u'&Profile Manager'),
action)
self.tr("&Profile Manager (Deprecated)"), action
)
self.iface.removeToolBarIcon(action)

def run(self):
Expand Down