Skip to content

Commit

Permalink
Merge pull request #43 from romanin-rf/dev
Browse files Browse the repository at this point in the history
Update 0.8.4
  • Loading branch information
romanin-rf authored Dec 11, 2023
2 parents 8bef247 + f7f29c6 commit 24843ca
Show file tree
Hide file tree
Showing 23 changed files with 293 additions and 157 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

| Version | Date | Tag | Changelog |
| ------- | ---- | --- | --------- |
| [v0.8.4](https://github.com/romanin-rf/SeaPlayer/releases/tag/v0.8.4) | 11.12.2023 | **STABLE** | - Added widgets: `Rheostat`, `ClickableLabel`<br>- Added widget: Rheostat<br>- Added a new widget: `PopUp`<br>- Fixed all language<br>- More attempts to make `Confiturate` screen clearer<br>- Moved all `CSS` from `objects.tcss` to `DEFAULT_CSS` separately for each widget |
| [v0.8.3](https://github.com/romanin-rf/SeaPlayer/releases/tag/v0.8.3) | 10.12.2023 | **STABLE** | - Added plugin `VKMusic`<br>- Added priority system for codecs<br>- Added system handhers of value<br>- Fixed `build.py`<br>- Moved method `load_plugin_info` in `seaplayer.plug.pluginloader` |
| [v0.8.2](https://github.com/romanin-rf/SeaPlayer/releases/tag/v0.8.2) | 08.12.2023 | **STABLE** | - Added language merge (for translating plugins)<br>- Fixed in translation files (`Log Menu Enable` -> `Logging` )<br>- Changed `object.css` (classes will no longer be used to specify standard properties)<br>- Improved widget `FillLabel` |
| [v0.8.1](https://github.com/romanin-rf/SeaPlayer/releases/tag/v0.8.1) | 07.12.2023 | **STABLE** | - Revisioned of the LanguageLoader<br>- Added new language: `Українська` |
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "SeaPlayer"
version = "0.8.3"
version = "0.8.4"
description = "SeaPlayer is a player that works in the terminal."
repository = "https://github.com/romanin-rf/SeaPlayer"
authors = ["Romanin <semina054@gmail.com>"]
Expand Down
4 changes: 4 additions & 0 deletions seaplayer/css/configurate.tcss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Configurate {
align-vertical: middle;
align-horizontal: center;
}
117 changes: 0 additions & 117 deletions seaplayer/css/objects.tcss
Original file line number Diff line number Diff line change
@@ -1,119 +1,2 @@
/* ! Music List */
MusicListView {
height: 1fr;
}

MusicListViewItem {
height: 4;
}

MusicListViewItem .title-label {
height: 1;
color: #cacaca;
}

MusicListViewItem .subtitle-label {
height: 1;
color: #a9a9a9;
}

/* ! IndeterminateProgress */
IndeterminateProgress { height: 1; }

/* ! Rheostat */
RheostatBar { height: 1; }
Rheostat { height: 4; }
Rheostat Horizontal {
align-horizontal: center;
width: 1fr;
}

/* ! Image Label */
StandartImageLabel {
height: 1fr;
width: 1fr;
align: center middle;
text-align: center;
}

AsyncImageLabel {
height: 1fr;
width: 1fr;
align: center middle;
text-align: center;
}

/* ! Configurate List */
ConfigurateList {
border: solid cadetblue;
height: 1fr;
width: 1fr;
}

ConfigurateListItem {
border: solid dodgerblue;
background: #0000;
border-title-color: #aaaaaa;
border-subtitle-color: #6b6b6b;
height: auto;
}

/* ! Log Menu */
LogMenu {
background: $surface;
color: $text;
height: 50vh;
dock: bottom;
layer: notes;
border-top: hkey $primary;
offset-y: 0;
transition: offset 400ms in_out_cubic;
padding: 0 1 1 1;
}

LogMenu:focus {
offset: 0 0 !important;
}

LogMenu.--hidden {
offset-y: 100%;
}

/* ! Nofy */
Nofy {
layer: nofys;
background: $background;
margin: 2 4;
padding: 1 2;
width: auto;
height: auto;
}

CallNofy {
layer: nofys;
background: $background;
margin: 2 4;
padding: 1 2;
width: auto;
height: auto;
}

/* ! PopUp */
PopUp {
layer: popups;
background: $background;
align: center middle;
content-align: center middle;
width: auto;
height: auto;
padding: 1 2 1 2;
}

/* ! FullLabel */
FillLabel {
height: 1fr;
width: 1fr;
}

/* ! Any Elements CSS */
.pass-one-width { width: 1; }
2 changes: 2 additions & 0 deletions seaplayer/css/seaplayer.tcss
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* ! Main Screen */
#_default {
layout: horizontal;
align-horizontal: center;
align-vertical: middle;
}

.screen-box {
Expand Down
3 changes: 2 additions & 1 deletion seaplayer/langs/en-eng.properties
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,5 @@ configurate.keys.volume_minus.desc="Turn down the volume."
words.on="On"
words.off="Off"
words.currect="Currect"
words.restart_required="restart required"
words.restart_required="restart required"
words.second.char="s"
3 changes: 2 additions & 1 deletion seaplayer/langs/ru-rus.properties
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,5 @@ configurate.keys.volume_minus.desc="Убавить громкость."
words.on="Включено"
words.off="Отключено"
words.currect="Текущий"
words.restart_required="требуется перезагрузка"
words.restart_required="требуется перезагрузка"
words.second.char="с"
1 change: 1 addition & 0 deletions seaplayer/langs/uk-ukr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,4 @@ words.on="Увімкнено"
words.off="Вимкнено"
words.currect="Поточний"
words.restart_required="потрібна перезавантаження"
words.second.char="с"
18 changes: 18 additions & 0 deletions seaplayer/objects/Configurate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@

# ! Child Class
class ConfigurateListItem(Container):
DEFAULT_CSS = """
ConfigurateListItem {
border: solid dodgerblue;
background: #0000;
border-title-color: #aaaaaa;
border-subtitle-color: #6b6b6b;
height: auto;
}
"""

def __init__(
self,
*children,
Expand All @@ -25,5 +35,13 @@ async def updating(self, title: Optional[str]="", desc: Optional[str]="") -> Non

# ! Main Class
class ConfigurateList(ScrollableContainer):
DEFAULT_CSS = """
ConfigurateList {
border: solid cadetblue;
height: 1fr;
width: 1fr;
}
"""

def __init__(self, *children, **kwargs) -> None:
super().__init__(*children, **kwargs)
2 changes: 2 additions & 0 deletions seaplayer/objects/DataOptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# > Typing
from typing import Optional, Callable

# ! Child Class
class DataOption(Option):
def __init__(
self,
Expand All @@ -17,6 +18,7 @@ def __init__(
self.selected = selected
self.data = data

# ! Main Class
class DataOptionList(OptionList):
def __init__(
self,
Expand Down
19 changes: 18 additions & 1 deletion seaplayer/objects/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@

# ! Main Class
class StandartImageLabel(Label):
DEFAULT_CSS = """
StandartImageLabel {
height: 1fr;
width: 1fr;
align: center middle;
text-align: center;
}
"""

def __init__(
self,
default_image: Image.Image,
Expand All @@ -33,12 +42,20 @@ async def on_resize(self) -> None:

async def update_image(self, image: Optional[Image.Image]=None) -> None:
self.image = image

image, resample = (self.default_image, Resampling.NEAREST) if (self.image is None) else (self.image, self.image_resample)
self.image_text = await asyncio.to_thread(Pixels.from_image, image, (self.size[0], self.size[1]), resample)
self.update(self.image_text)

class AsyncImageLabel(Label):
DEFAULT_CSS = """
AsyncImageLabel {
height: 1fr;
width: 1fr;
align: center middle;
text-align: center;
}
"""

def __init__(
self,
default_image: Image.Image,
Expand Down
78 changes: 73 additions & 5 deletions seaplayer/objects/Labels.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
from textual.widgets import Label
from rich.segment import Segments, Segment
from textual.widgets import Label, Button
from rich.style import Style
from rich.console import RenderableType
from rich.segment import Segments, Segment
# > Typing
from typing import Optional
from typing import Optional, Union, Callable, Awaitable
from inspect import iscoroutinefunction

# ! Main Class
# ! Fill Label Class
class FillLabel(Label):
DEFAULT_CSS = """
FillLabel {
height: 1fr;
width: 1fr;
}
"""

def _gen(self) -> Segments:
return Segments([Segment(self.__chr, self.__style) for i in range((self.size[0] * self.size[1]))])

Expand All @@ -21,4 +30,63 @@ def __init__(
self.update(self._gen())

async def on_resize(self) -> None:
self.update(self._gen())
self.update(self._gen())

# ! Clickable Label Class
class ClickableLabel(Label, Button, can_focus=True):
DEFAULT_CSS = """
ClickableLabel {
width: auto;
min-width: 1;
height: auto;
min-height: 1;
color: $text;
text-style: bold;
text-align: center;
content-align: center middle;
}
ClickableLabel:focus {
text-style: bold reverse;
}
ClickableLabel:hover {
color: $text;
}
ClickableLabel.-active {
tint: $background 30%;
}
"""
def __init__(
self,
renderable: RenderableType="",
callback: Union[Callable[[], None], Callable[[], Awaitable[None]]]=lambda: None,
*,
expand: bool=False,
shrink: bool=False,
markup: bool=True,
name: Optional[str]=None,
id: Optional[str]=None,
classes: Optional[str]=None,
disabled: bool=False
) -> None:
super().__init__(
renderable,
expand=expand,
shrink=shrink,
markup=markup,
name=name,
id=id,
classes=classes,
disabled=disabled
)
self.__callback = callback

@property
def callback_awaitable(self) -> bool:
return iscoroutinefunction(self.__callback)

async def _on_click(self, event) -> None:
await super()._on_click(event)
if self.callback_awaitable:
await self.__callback()
else:
self.__callback()
23 changes: 20 additions & 3 deletions seaplayer/objects/Log.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,28 @@
# ! Vars
console = Console()

# ! Types
RETURN = TypeVar('RETURN')

# ! Main Class
class LogMenu(RichLog):
DEFAULT_CSS = """
LogMenu {
background: $surface;
color: $text;
height: 75vh;
dock: bottom;
layer: notes;
border-top: hkey $primary;
offset-y: 0;
transition: offset 400ms in_out_cubic;
padding: 0 1 1 1;
}
LogMenu:focus {
offset: 0 0 !important;
}
LogMenu.--hidden {
offset-y: 100%;
}
"""

def __init__(self, chap_max_width: int=8, enable_logging: bool=True, **kwargs):
self.enable_logging = enable_logging
self.chap_max_width = chap_max_width
Expand Down
Loading

0 comments on commit 24843ca

Please sign in to comment.