-
Couldn't load subscription status.
- Fork 3
chore: Update themes and require Shiny v1.2.0 #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
68a6b32
b4db94e
eee0050
b40040d
c9bd61d
369b8ca
cbcdb28
7d11e90
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,25 +6,42 @@ | |||||||||||||||||||||||||||
| from shinyswatch._bsw5 import BSW5_THEME_NAME, bsw5_themes | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| def get_theme_deps(theme: shiny.ui.Theme) -> htmltools.HTMLDependency: | ||||||||||||||||||||||||||||
| if hasattr(theme, "_html_dependency"): | ||||||||||||||||||||||||||||
| # shiny < v1.2.0 | ||||||||||||||||||||||||||||
| deps = getattr(theme, "_html_dependency")() | ||||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||||
| deps = getattr(theme, "_html_dependencies")() | ||||||||||||||||||||||||||||
| # In shiny >= v1.2.0, `_html_dependencies()` returns a list of deps, but for | ||||||||||||||||||||||||||||
| # shinyswatch we're expecting the default case to be a single dependency. | ||||||||||||||||||||||||||||
| assert isinstance(deps, list) | ||||||||||||||||||||||||||||
| assert len(deps) == 1 | ||||||||||||||||||||||||||||
| deps = deps[0] | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| return deps | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
| def get_theme_deps(theme: shiny.ui.Theme) -> htmltools.HTMLDependency: | |
| if hasattr(theme, "_html_dependency"): | |
| # shiny < v1.2.0 | |
| deps = getattr(theme, "_html_dependency")() | |
| else: | |
| deps = getattr(theme, "_html_dependencies")() | |
| # In shiny >= v1.2.0, `_html_dependencies()` returns a list of deps, but for | |
| # shinyswatch we're expecting the default case to be a single dependency. | |
| assert isinstance(deps, list) | |
| assert len(deps) == 1 | |
| deps = deps[0] | |
| return deps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or did you want to use this method within the package and then we can relax our shiny version requirement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I originally had an implementation that let us relax that shiny version requirement that I took out on second thought. On the balance, I don't think it's worth maintaining the additional logic, which was repeated in a few places with slight variations because constraints and uses were different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed unused code in cbcdb28
Uh oh!
There was an error while loading. Please reload this page.