Skip to content

Commit

Permalink
hard-code available flow themes
Browse files Browse the repository at this point in the history
attempts to fix #166
  • Loading branch information
leon-thomm committed Oct 9, 2023
1 parent bf3d000 commit 0c116d5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
13 changes: 4 additions & 9 deletions ryven-editor/ryven/main/Ryven.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,17 @@ def run(*args_,
"""

# Process command line and method's arguments
# QT_API environment is set in config.py now. If other qt Backends are installed "from ryven.gui_env import init_node_guis_env" and the static method get_available_flow_themes() from config.py can throw errors if the environment is not set before!
conf: Config = process_args(use_sysargs, *args_, **kwargs)

from ryven.node_env import init_node_env
from ryven.gui_env import init_node_guis_env # Qt dependency


#
# Qt application setup
#

# QtPy API
# !!! Temporarily moved into config.py !!!
# os.environ['QT_API'] = conf.qt_api

# Init environment
os.environ['RYVEN_MODE'] = 'gui'
os.environ['QT_API'] = conf.qt_api
from ryven.node_env import init_node_env
from ryven.gui_env import init_node_guis_env # Qt dependency
init_node_env()
init_node_guis_env()

Expand Down
2 changes: 1 addition & 1 deletion ryven-editor/ryven/main/args_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def parse_sys_args(just_defaults=False) -> Config:
# Display

group = parser.add_argument_group('display')

group.add_argument(
'-w', '--window-theme',
choices=Config.get_available_window_themes(),
Expand Down
10 changes: 6 additions & 4 deletions ryven-editor/ryven/main/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class Config:
window_geometry: Optional[str] = None
window_title: str = 'Ryven'
qt_api: str = 'pyside2'
os.environ['QT_API'] = self.qt_api
src_code_edits_enabled: bool = False

@staticmethod
Expand All @@ -47,9 +46,12 @@ def get_available_window_themes() -> Set[str]:

@staticmethod
def get_available_flow_themes() -> Set[str]:
# FIXME: this is not stable api; expose it properly in ryvencore-qt
from ryvencore_qt.src.Design import Design
return {t.name for t in Design().flow_themes}
# TODO: expose this in ryvencore_qt without requiring Qt import, since QT_API is not set yet
return {
"Toy", "Tron", "Ghost", "Blender", "Simple",
"Ueli", "pure dark", "colorful dark", "pure light",
"colorful light", "Industrial", "Fusion"
}

@staticmethod
def get_available_performance_modes() -> Set[str]:
Expand Down

0 comments on commit 0c116d5

Please sign in to comment.