Added binary file format
This commit is contained in:
@@ -3,7 +3,7 @@ from pathlib import Path
|
||||
from PySide6.QtCore import QSettings, Signal
|
||||
from PySide6.QtWidgets import QDialog, QFileDialog
|
||||
|
||||
from bedit.core.libraries import default_library_paths
|
||||
from bedit.core.libraries import bundled_library_path, default_library_paths
|
||||
from bedit.gui.preferences import application_settings
|
||||
from bedit.gui.generated.ui_settings_dialog import Ui_SettingsDialog
|
||||
|
||||
@@ -56,8 +56,22 @@ class SettingsDialog(QDialog):
|
||||
settings = settings if settings is not None else application_settings()
|
||||
value = settings.value("libraries/paths", default_library_paths())
|
||||
if isinstance(value, str):
|
||||
return [value]
|
||||
return [str(path) for path in value]
|
||||
paths = [value]
|
||||
else:
|
||||
paths = [str(path) for path in value]
|
||||
bundled = bundled_library_path()
|
||||
migrated = [
|
||||
str(bundled)
|
||||
if not Path(path).exists()
|
||||
and Path(path).parent == bundled.parent
|
||||
and Path(path).suffix.lower() == ".json"
|
||||
else path
|
||||
for path in paths
|
||||
]
|
||||
if migrated != paths:
|
||||
settings.setValue("libraries/paths", migrated)
|
||||
settings.sync()
|
||||
return migrated
|
||||
|
||||
@staticmethod
|
||||
def graph_grid_size(settings: QSettings | None = None) -> int:
|
||||
@@ -79,7 +93,7 @@ class SettingsDialog(QDialog):
|
||||
self,
|
||||
"Add library",
|
||||
"",
|
||||
"BEdit libraries (*.json);;All files (*)",
|
||||
"BEdit libraries (*.beb *.bedit.json *.json);;All files (*)",
|
||||
)
|
||||
if path:
|
||||
self._append_unique_path(path)
|
||||
|
||||
Reference in New Issue
Block a user