Use generic symbol names

This commit is contained in:
grossmj committed 2022-07-25 12:33:40 +02:00
1 parent b7f4a4cbda
commit bfbac2e93a
15 files changed
+70 -44

No files matched your search

+8 -8
View File
@@ -19,7 +19,7 @@
CLASSIC_SYMBOL_THEME = {
"cloud": ":/symbols/classic/cloud.svg",
"ethernet_switch": ":/symbols/classic/ethernet_switch.svg",
"ethernet_hub": ":/symbols/classic/hub.svg",
"hub": ":/symbols/classic/hub.svg",
"frame_relay_switch": ":/symbols/classic/frame_relay_switch.svg",
"atm_switch": ":/symbols/classic/atm_switch.svg",
"router": ":/symbols/classic/router.svg",
@@ -36,8 +36,8 @@ CLASSIC_SYMBOL_THEME = {
AFFINITY_SQUARE_BLUE_SYMBOL_THEME = {
"cloud": ":/symbols/affinity/square/blue/cloud.svg",
"ethernet_switch": ":/symbols/affinity/square/blue/switch.svg",
"ethernet_hub": ":/symbols/affinity/square/blue/hub.svg",
"frame_relay_switch.svg": ":/symbols/affinity/square/blue/isdn.svg",
"hub": ":/symbols/affinity/square/blue/hub.svg",
"frame_relay_switch": ":/symbols/affinity/square/blue/isdn.svg",
"atm_switch": ":/symbols/affinity/square/blue/atm.svg",
"router": ":/symbols/affinity/square/blue/router.svg",
"multilayer_switch": ":/symbols/affinity/square/blue/switch_multilayer.svg",
@@ -53,7 +53,7 @@ AFFINITY_SQUARE_BLUE_SYMBOL_THEME = {
AFFINITY_SQUARE_RED_SYMBOL_THEME = {
"cloud": ":/symbols/affinity/square/red/cloud.svg",
"ethernet_switch": ":/symbols/affinity/square/red/switch.svg",
"ethernet_hub": ":/symbols/affinity/square/red/hub.svg",
"hub": ":/symbols/affinity/square/red/hub.svg",
"frame_relay_switch": ":/symbols/affinity/square/red/isdn.svg",
"atm_switch": ":/symbols/affinity/square/red/atm.svg",
"router": ":/symbols/affinity/square/red/router.svg",
@@ -70,7 +70,7 @@ AFFINITY_SQUARE_RED_SYMBOL_THEME = {
AFFINITY_SQUARE_GRAY_SYMBOL_THEME = {
"cloud": ":/symbols/affinity/square/gray/cloud.svg",
"ethernet_switch": ":/symbols/affinity/square/gray/switch.svg",
"ethernet_hub": ":/symbols/affinity/square/gray/hub.svg",
"hub": ":/symbols/affinity/square/gray/hub.svg",
"frame_relay_switch": ":/symbols/affinity/square/gray/isdn.svg",
"atm_switch": ":/symbols/affinity/square/gray/atm.svg",
"router": ":/symbols/affinity/square/gray/router.svg",
@@ -87,7 +87,7 @@ AFFINITY_SQUARE_GRAY_SYMBOL_THEME = {
AFFINITY_CIRCLE_BLUE_SYMBOL_THEME = {
"cloud": ":/symbols/affinity/circle/blue/cloud.svg",
"ethernet_switch": ":/symbols/affinity/circle/blue/switch.svg",
"ethernet_hub": ":/symbols/affinity/circle/blue/hub.svg",
"hub": ":/symbols/affinity/circle/blue/hub.svg",
"frame_relay_switch": ":/symbols/affinity/circle/blue/isdn.svg",
"atm_switch": ":/symbols/affinity/circle/blue/atm.svg",
"router": ":/symbols/affinity/circle/blue/router.svg",
@@ -104,7 +104,7 @@ AFFINITY_CIRCLE_BLUE_SYMBOL_THEME = {
AFFINITY_CIRCLE_RED_SYMBOL_THEME = {
"cloud": ":/symbols/affinity/circle/red/cloud.svg",
"ethernet_switch": ":/symbols/affinity/circle/red/switch.svg",
"ethernet_hub": ":/symbols/affinity/circle/red/hub.svg",
"hub": ":/symbols/affinity/circle/red/hub.svg",
"frame_relay_switch": ":/symbols/affinity/circle/red/isdn.svg",
"atm_switch": ":/symbols/affinity/circle/red/atm.svg",
"router": ":/symbols/affinity/circle/red/router.svg",
@@ -121,7 +121,7 @@ AFFINITY_CIRCLE_RED_SYMBOL_THEME = {
AFFINITY_CIRCLE_GRAY_SYMBOL_THEME = {
"cloud": ":/symbols/affinity/circle/gray/cloud.svg",
"ethernet_switch": ":/symbols/affinity/circle/gray/switch.svg",
"ethernet_hub": ":/symbols/affinity/circle/gray/hub.svg",
"hub": ":/symbols/affinity/circle/gray/hub.svg",
"frame_relay_switch": ":/symbols/affinity/circle/gray/isdn.svg",
"atm_switch": ":/symbols/affinity/circle/gray/atm.svg",
"router": ":/symbols/affinity/circle/gray/router.svg",
+12 -2
View File
@@ -43,7 +43,7 @@ class Symbols:
# Keep a cache of symbols size
self._symbol_size_cache = {}
self._current_theme = "Classic"
self._current_theme = "Affinity-square-blue"
self._themes = BUILTIN_SYMBOL_THEMES
@property
@@ -69,7 +69,7 @@ class Symbols:
raise ControllerNotFoundError(f"Could not find symbol theme '{symbol_theme}'")
symbol_path = theme.get(symbol)
if symbol_path not in self._symbols_path:
log.warning(f"Default symbol {symbol_path} was not found")
log.warning(f"Default symbol {symbol} was not found")
return None
return symbol_path
@@ -125,7 +125,17 @@ class Symbols:
return self._symbols_path.get(symbol_id)
def resolve_symbol(self, symbol_name):
if not symbol_name.startswith(":/"):
symbol = self.get_default_symbol(symbol_name, self._current_theme)
if symbol:
return symbol
return symbol_name
def get_path(self, symbol_id):
symbol_id = self.resolve_symbol(symbol_id)
try:
return self._symbols_path[symbol_id]
except KeyError: