kopia lustrzana https://github.com/ihabunek/toot
				
				
				
			Fix how urwidgets are vendeored
Should be done inside `toot` so that it doesn't clash when people have toot installed alongside python-urwidgets.pull/545/head
							rodzic
							
								
									4b22680007
								
							
						
					
					
						commit
						f73de3e699
					
				|  | @ -48,8 +48,8 @@ packages=[ | |||
|     "toot.cli", | ||||
|     "toot.tui", | ||||
|     "toot.tui.richtext", | ||||
|     "toot.urwidgets", | ||||
|     "toot.utils", | ||||
|     "urwidgets", | ||||
| ] | ||||
| 
 | ||||
| [tool.setuptools_scm] | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| from urwid import Divider, Filler, Pile | ||||
| from toot.tui.richtext import url_to_widget | ||||
| from urwidgets import Hyperlink, TextEmbed | ||||
| from toot.urwidgets import Hyperlink, TextEmbed | ||||
| 
 | ||||
| from toot.tui.richtext.richtext import html_to_widgets | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,18 +1,6 @@ | |||
| import urwid | ||||
| from .richtext import html_to_widgets, url_to_widget | ||||
| 
 | ||||
| from toot.tui.utils import highlight_hashtags | ||||
| from toot.utils import format_content | ||||
| from typing import List | ||||
| 
 | ||||
| try: | ||||
|     from .richtext import html_to_widgets, url_to_widget | ||||
| except ImportError: | ||||
|     # Fallback if urwidgets are not available | ||||
|     def html_to_widgets(html: str) -> List[urwid.Widget]: | ||||
|         return [ | ||||
|             urwid.Text(highlight_hashtags(line)) | ||||
|             for line in format_content(html) | ||||
|         ] | ||||
| 
 | ||||
|     def url_to_widget(url: str): | ||||
|         return urwid.Text(("link", url)) | ||||
| __all__ = ( | ||||
|     "html_to_widgets", | ||||
|     "url_to_widget", | ||||
| ) | ||||
|  |  | |||
|  | @ -4,10 +4,10 @@ import unicodedata | |||
| 
 | ||||
| from bs4.element import NavigableString, Tag | ||||
| from toot.tui.constants import PALETTE | ||||
| from toot.urwidgets import Hyperlink, TextEmbed | ||||
| from toot.utils import parse_html, urlencode_url | ||||
| from typing import List, Tuple | ||||
| from urwid.util import decompose_tagmarkup | ||||
| from urwidgets import Hyperlink, TextEmbed | ||||
| 
 | ||||
| 
 | ||||
| STYLE_NAMES = [p[0] for p in PALETTE] | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 Ivan Habunek
						Ivan Habunek