Skip to content

Commit b093340

Browse files
author
Gerrishon
committed
update
1 parent 464f4a9 commit b093340

File tree

4 files changed

+50
-10
lines changed

4 files changed

+50
-10
lines changed

src/quo/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,4 @@ def print(
124124
from quo.i_o.termui import confirm, echo
125125
from quo.shortcuts.utils import container
126126

127-
__version__ = "2023.1"
127+
__version__ = "2023.2"

src/quo/color/__init__.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
from quo.style.webcolors import NAMED_COLORS
44
from .rgb import *
55

6-
def Color(color:str = None):
7-
#User input (default text color)
6+
7+
def Color(style:str="", fg:str="", bg:str=""):
88
from quo.style.style import Style
9+
if fg or bg != "":
10+
return Style.add({' ':"fg:"+str(fg) + " bg:"+str(bg)})
11+
if style != "":
12+
return Style.add({' ':style})
913

10-
return Style.add({' ':color})
1114

src/quo/prompt.py

+42-5
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,8 @@ def __init__(
484484
int: bool = False,
485485
auto_suggest: Optional[AutoSuggest] = None,
486486
style: Optional[BaseStyle] = None,
487+
fg: Optional[str] = "",
488+
bg: Optional[str] = "",
487489
style_transformation: Optional[StyleTransformation] = None,
488490
swap_light_and_dark_colors: FilterOrBool = False,
489491
color_depth: Optional[ColorDepth] = None,
@@ -543,7 +545,6 @@ def __init__(
543545
self.int = int
544546
self.action = action
545547
self.bottom_toolbar = bottom_toolbar
546-
self.style = style
547548
self.style_transformation = style_transformation
548549
self.swap_light_and_dark_colors = swap_light_and_dark_colors
549550
self.color_depth = true_color #color_dept
@@ -579,6 +580,15 @@ def __init__(
579580
self.layout = self._create_layout()
580581
self.app = self._create_application(editing_mode, erase_when_done)
581582

583+
if fg or bg != "":
584+
from quo.style.style import Style
585+
586+
setStyle = Style.add({' ':"fg:"+str(fg) + " bg:"+str(bg)})
587+
self.style = setStyle
588+
else:
589+
self.style=style
590+
591+
582592
if bind_:
583593
from quo.keys import bind as _bind
584594

@@ -1064,7 +1074,14 @@ class itself. For these, passing in ``None`` will keep the current
10641074
# then we loose the advantage of mypy and pyflakes to be able
10651075
# to verify the code.
10661076
if text is not None:
1067-
self.text = text
1077+
import re
1078+
1079+
if re.search("^<.*>$", str(text)) is not None:
1080+
from quo.text.html import Text
1081+
inpText = Text(str(text))
1082+
self.text = inpText
1083+
else:
1084+
self.text = text
10681085
if editing_mode is not None:
10691086
self.editing_mode = editing_mode
10701087
if refresh_interval is not None:
@@ -1084,7 +1101,13 @@ class itself. For these, passing in ``None`` will keep the current
10841101
if bind is not None:
10851102
self.bind = bind
10861103
if bottom_toolbar is not None:
1087-
self.bottom_toolbar = bottom_toolbar
1104+
import re
1105+
if re.search("^<.*>$", str(bottom_toolbar)) is not None:
1106+
from quo.text.html import Text
1107+
bttmtlbrText = Text(str(bottom_toolbar))
1108+
self.bottom_toolbar= bttmtlbrText
1109+
else:
1110+
self.bottom_toolbar = bottom_toolbar
10881111
if style is not None:
10891112
self.style = style
10901113
if color_depth is not None:
@@ -1096,7 +1119,13 @@ class itself. For these, passing in ``None`` will keep the current
10961119
if swap_light_and_dark_colors is not None:
10971120
self.swap_light_and_dark_colors = swap_light_and_dark_colors
10981121
if rprompt is not None:
1099-
self.rprompt = rprompt
1122+
import re
1123+
if re.search("^<.*>$", str(rprompt)) is not None:
1124+
from quo.text.html import Text
1125+
rprmptText = Text(str(rprompt))
1126+
self.rprompt = rprmptText
1127+
else:
1128+
self.rprompt = rprompt
11001129
if multiline is not None:
11011130
self.multiline = multiline
11021131
if elicit_continuation is not None:
@@ -1124,7 +1153,15 @@ class itself. For these, passing in ``None`` will keep the current
11241153
if input_processors is not None:
11251154
self.input_processors = input_processors
11261155
if placeholder is not None:
1127-
self.placeholder = placeholder
1156+
import re
1157+
1158+
if re.search("^<.*>$", str(placeholder)) is not None:
1159+
from quo.text.html import Text
1160+
plchldrText = Text(str(placeholder))
1161+
self.placeholder= plchldrText
1162+
else:
1163+
self.placeholder = placeholder
1164+
11281165
if reserve_space_for_menu is not None:
11291166
self.reserve_space_for_menu = reserve_space_for_menu
11301167
if system_prompt is not None:

src/quo/widget/core.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ class Frame:
483483

484484
def __init__(
485485
self,
486-
body: AnyContainer=None,
486+
body: AnyContainer,
487487
title: AnyFormattedText = "",
488488
style: str = "",
489489
width: AnyDimension = None,

0 commit comments

Comments
 (0)