-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'cleanup_2023' into tooling/add-pre-commit
- Loading branch information
Showing
60 changed files
with
2,394 additions
and
3,654 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,9 @@ venv.bak/ | |
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# IDE | ||
.idea | ||
|
||
# packaging | ||
zip_build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,63 @@ | ||
### Profile Manager for QGIS3 ### | ||
### Profile Manager for QGIS ### | ||
A QGIS plugin for managing your profiles and data source connections. | ||
|
||
### Plugin for managing your profiles and datasources ### | ||
https://plugins.qgis.org/plugins/profile-manager/ | ||
|
||
### Installation ### | ||
<a href="https://github.com/WhereGroup/profile-manager/assets/7661092/a64ea854-bff3-48a0-b1ff-83f3d4eaa5b7"><img src="https://github.com/WhereGroup/profile-manager/assets/7661092/a64ea854-bff3-48a0-b1ff-83f3d4eaa5b7" width="200"></a> | ||
<a href="https://github.com/WhereGroup/profile-manager/assets/7661092/711faa86-c36c-40bc-92ab-7b73016996ae"><img src="https://github.com/WhereGroup/profile-manager/assets/7661092/711faa86-c36c-40bc-92ab-7b73016996ae" width="200"></a> | ||
<a href="https://github.com/WhereGroup/profile-manager/assets/7661092/0c646930-88d8-45fe-81c8-4a5bf4501152"><img src="https://github.com/WhereGroup/profile-manager/assets/7661092/0c646930-88d8-45fe-81c8-4a5bf4501152" width="200"></a> | ||
<a href="https://github.com/WhereGroup/profile-manager/assets/7661092/079665d6-e0ff-45fb-a65c-3b49cd9229de"><img src="https://github.com/WhereGroup/profile-manager/assets/7661092/079665d6-e0ff-45fb-a65c-3b49cd9229de" width="200"></a> | ||
|
||
To install the plugin just copy the folder in your QGIS-Profile folder under ./python/plugins/ | ||
### Installation ### | ||
To install the plugin manually just copy the folder into your QGIS profile directory under ./python/plugins/ | ||
|
||
- Windows Directory: | ||
- C:\Users\{USER}\AppData\Roaming\QGIS\QGIS3\profiles\\{PROFILE}\python\plugins\ | ||
- Linux Directory: | ||
- /home/{USER}/.local/share/QGIS/QGIS3/profiles/{PROFILE}/python/plugins | ||
- Windows directory: | ||
- `C:\Users\{USER}\AppData\Roaming\QGIS\QGIS3\profiles\{PROFILE}\python\plugins\` | ||
- Linux directory: | ||
- `~/.local/share/QGIS/QGIS3/profiles/{PROFILE}/python/plugins` | ||
- MacOS directory: | ||
- `~/Library/Application Support/QGIS/QGIS3/profiles` | ||
|
||
### Features ### | ||
- Create a new profile | ||
- Creates and initiates a new profile | ||
- Removing profile | ||
- Removes a selected profile | ||
- Copy profile | ||
- Creates a copy of a selected profile with a new name | ||
- Rename profile | ||
- Renames the profile with a name provided by the user | ||
- Importing data source connections from one profile to another | ||
- Removing data source connections from a profile | ||
- Removes the data source connection from the chosen SOURCE profile | ||
- Importing (spatial) bookmarks | ||
- Importing (data source) favourites | ||
- Importing plugins | ||
- Importing expression functions | ||
- Importing models & scripts | ||
- Importing some symbology types & label settings | ||
- Importing QGIS UI settings (e.g. hidden toolbar items) | ||
|
||
On all removal operations the user is being asked if they are certain | ||
that he wants to delete given source/profile. | ||
Additionally before every deletion a backup of the complete profiles | ||
folder is created under the following directory: | ||
- Windows directory: | ||
- `C:\Users\{USER}\QGIS Profile Manager Backup\` | ||
- Linux and MacOS directory: | ||
- `~/QGIS Profile Manager Backup/` | ||
|
||
### Known (current) limitations ### | ||
- Not all data source connections might be recognized and imported/removed | ||
- Not all data source connection types are supported | ||
- Python expression functions are not supported | ||
- Not all style things are supported, e.g. not 3D symbols, color ramps, | ||
tags, etc. | ||
- Errors might not always be communicated clearly so please TEST your | ||
migrated configurations before discarding originals! | ||
|
||
- General Features: | ||
- Create a new profile | ||
- Creates and initiates a new QGIS profile | ||
- Reomving profile | ||
- Removes the currently marked profile | ||
- Copy profile | ||
- Copies profile into a new one with a name provided by the user | ||
- Rename profile | ||
- Renames the profile with a name provided by the user | ||
- Importing Datasources from one profile to another | ||
(Datasources are chosen by checking them in a TreeView where each source is displayed) | ||
- Removing Datasources from a profile | ||
- Removes the datasources from the chosen SOURCE profile | ||
- Importing bookmarks | ||
- Importing favourites | ||
- Importing plugins | ||
- Importing functions | ||
- Importing models & scripts | ||
- Importing style & label settings | ||
- Importing QGIS UI settings (f.e. hidden toolbar items) | ||
|
||
On all removal operations the user is being asked if he is certain that he wants to delete given source/profile. | ||
Additionally before every deletion a backup of the profiles folder is created under the follwing directory: | ||
- Windows Directory: | ||
- C:\Users\\{USER}\QGISBackup\ | ||
- Linux Directory: | ||
- /home/{USER}/QGISBackup/ | ||
### Funding development ### | ||
If you consider this plugin useful and would like to see it improved, e.g. | ||
with support for more profile settings, becoming more stable, being more | ||
thoroughly documented, leave the "experimental" plugin status or whatever | ||
you desire, you can fund development. Contact us at [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,54 @@ | ||
from shutil import copy2 | ||
from os import path | ||
from configparser import RawConfigParser | ||
from os import path | ||
from shutil import copy2 | ||
|
||
from ...utils import adjust_to_operating_system | ||
|
||
|
||
def import_customizations(source_profile_path: str, target_profile_path: str): | ||
"""Imports UI customizations from source to target profile. | ||
Copies the whole QGISCUSTOMIZATION3.ini file and also transfers the [UI] section from QGIS3.ini if available | ||
TODO fix discrepancy between [UI] and [Customization]! Which one(s) exist and what do we want to transfer? | ||
class CustomizationHandler: | ||
E.g. | ||
[Customization] | ||
Browser=true | ||
Browser\AFS=false | ||
... | ||
def __init__(self, profile_manager): | ||
self.profile_manager = profile_manager | ||
self.path_source_customini = "" | ||
self.path_target_customini = "" | ||
self.parser = RawConfigParser() | ||
self.parser.optionxform = str | ||
Args: | ||
TODO | ||
""" | ||
# Copy (overwrite) the QGISCUSTOMIZATION3.ini if exist | ||
source_customini_path = adjust_to_operating_system(source_profile_path + "QGIS/QGISCUSTOMIZATION3.ini") | ||
target_customini_path = adjust_to_operating_system(target_profile_path + "QGIS/QGISCUSTOMIZATION3.ini") | ||
if path.exists(source_customini_path): | ||
copy2(source_customini_path, target_customini_path) | ||
|
||
def import_customizations(self): | ||
if path.exists(self.path_source_customini): | ||
copy2(self.path_source_customini, self.path_target_customini) | ||
# Copy [UI] section from QGIS3.ini | ||
source_qgis3ini_path = adjust_to_operating_system(source_profile_path + "QGIS/QGIS3.ini") | ||
target_qgis3ini_path = adjust_to_operating_system(target_profile_path + "QGIS/QGIS3.ini") | ||
|
||
ini_paths = self.profile_manager.get_ini_paths() | ||
source_ini_parser = RawConfigParser() | ||
source_ini_parser.optionxform = str # str = case-sensitive option names | ||
source_ini_parser.read(source_qgis3ini_path) | ||
|
||
self.parser.read(ini_paths["source"]) | ||
# TODO this is broken, right? It looks for [UI] but even in QGIS 3.10 (didnt check older) the (single) section is named [Customization] | ||
if source_ini_parser.has_section('UI'): | ||
ui_data = dict(source_ini_parser.items('UI')) | ||
|
||
if self.parser.has_section('UI'): | ||
ui_data = dict(self.parser.items('UI')) | ||
self.parser.clear() | ||
self.parser.read(ini_paths["target"]) | ||
target_ini_parser = RawConfigParser() | ||
target_ini_parser.optionxform = str # str = case-sensitive option names | ||
target_ini_parser.read(target_qgis3ini_path) | ||
|
||
for setting in ui_data: | ||
if not self.parser.has_section("UI"): | ||
self.parser["UI"] = {} | ||
|
||
self.parser.set("UI", setting, ui_data[setting]) | ||
for setting in ui_data: | ||
if not target_ini_parser.has_section("UI"): | ||
target_ini_parser["UI"] = {} | ||
|
||
with open(ini_paths["target"], 'w') as qgisconf: | ||
self.parser.write(qgisconf) | ||
target_ini_parser.set("UI", setting, ui_data[setting]) | ||
|
||
def set_path_files(self, source, target): | ||
self.path_source_customini = self.profile_manager.adjust_to_operating_system(source + "QGIS/QGISCUSTOMIZATION3.ini") | ||
self.path_target_customini = self.profile_manager.adjust_to_operating_system(target + "QGIS/QGISCUSTOMIZATION3.ini") | ||
with open(target_qgis3ini_path, 'w') as qgisconf: | ||
target_ini_parser.write(qgisconf, space_around_delimiters=False) | ||
|
Oops, something went wrong.