From 56d7d222d6541eecf8c47f1b3fea0b60c96afddb Mon Sep 17 00:00:00 2001 From: Marat Fayzullin Date: Sun, 27 Oct 2024 21:08:58 -0400 Subject: [PATCH] Now showing "None" for no underlying modulation. --- htdocs/lib/settings/BookmarkTable.js | 13 ++++++++----- owrx/controllers/settings/bookmarks.py | 10 +++++++--- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/htdocs/lib/settings/BookmarkTable.js b/htdocs/lib/settings/BookmarkTable.js index 007a1780..23158ec2 100644 --- a/htdocs/lib/settings/BookmarkTable.js +++ b/htdocs/lib/settings/BookmarkTable.js @@ -177,8 +177,8 @@ ModulationEditor.prototype = new Editor(); ModulationEditor.prototype.getInputHtml = function() { return ''; }; @@ -197,9 +197,12 @@ UnderlyingEditor.prototype = new Editor(); UnderlyingEditor.prototype.getInputHtml = function() { return ''; }; diff --git a/owrx/controllers/settings/bookmarks.py b/owrx/controllers/settings/bookmarks.py index 3db40a91..9bde869c 100644 --- a/owrx/controllers/settings/bookmarks.py +++ b/owrx/controllers/settings/bookmarks.py @@ -2,7 +2,7 @@ from owrx.controllers.template import WebpageController from owrx.controllers.admin import AuthorizationMixin from owrx.controllers.settings import SettingsBreadcrumb from owrx.bookmarks import Bookmark, Bookmarks -from owrx.modes import Modes +from owrx.modes import Modes, AnalogMode from owrx.breadcrumb import Breadcrumb, BreadcrumbItem, BreadcrumbMixin import json import math @@ -44,7 +44,11 @@ class BookmarksController(AuthorizationMixin, BreadcrumbMixin, WebpageController """.format( bookmarks="".join(self.render_bookmark(b) for b in bookmarks) if bookmarks else emptyText, - modes=json.dumps({m.modulation: m.name for m in Modes.getAvailableModes()}), + modes=json.dumps({m.modulation: { + "name" : m.name, + "analog" : isinstance(m, AnalogMode), + "underlying" : m.underlying if hasattr(m, "underlying") else [] + } for m in Modes.getAvailableModes()}), ) def render_bookmark(self, bookmark: Bookmark): @@ -93,7 +97,7 @@ class BookmarksController(AuthorizationMixin, BreadcrumbMixin, WebpageController modulation=name1 if mode1 is None else mode1.modulation, underlying=name2 if mode2 is None else mode2.modulation, modulation_name=name1 if mode1 is None else mode1.name, - underlying_name=name2 if mode2 is None else mode2.name, + underlying_name="None" if not name2 else name2 if mode2 is None else mode2.name, description=bookmark.getDescription(), scannable="true" if scan else "false", scannable_check="✓" if scan else "",