diff --git a/README.md b/README.md index 0af17f2..f48a875 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ and much more... - psutil - rich - python-dateutil - - netifaces (optional) + - netifaces * MPV, MPlayer or VLC installed and in your path * MKVToolNix (cli files) to insert tags, chapters and cover to recordings (optional, if MPV or VLC is to be used, but mandatory in the case of MPlayer) diff --git a/docs/themes.html b/docs/themes.html index 75de260..7462fda 100644 --- a/docs/themes.html +++ b/docs/themes.html @@ -50,7 +50,10 @@

Table of Contents <
  • Secondary windows background
  • Alternative Main Window border color
  • User themes @@ -225,7 +228,7 @@

    Theme defined secondary windows c

    This information is actually relevant to creating a new PyRadio theme, but it’s very important in order to understand how the calculated background color works.

    Calculated secondary windows color

    -

    PyRadio will use the same background color for all windows by default, provided that the theme used does not define a “Messages Border” background color.

    +

    PyRadio will use the same background color for all windows by default, provided that the theme used does not define a “Messages Borderbackground color.

    In order to use a “Messages Border” background color different than the “Stations background” color, when “Messages Border” background color is not defined in the selected theme, a config option is available; “Calculated color”.

    This config option takes a value that’s between 0 and 0.2.

    If it is 0, no color change will occur.

    @@ -233,13 +236,24 @@

    Calculated secondary windows colorThis is how this works: PyRadio will calculate the “Stations background” color perceived brightness, which will indicate whether the color is dark or light. Then depending on that, will add or subtract factor percent from its luminance value.

    Finally, a check will be made to see if this color is close to “Messages Border” foreground color, and re-adjusted as possible.

    Note: When a calculated background color is used, pressing “~” (tilde) will toggle it on and off. This setting will be valid until PyRadio terminates, or a new theme is loaded.

    +

    Optional Calculated Color in a Theme
    +

    Another way to use a different background color for secondary windows, is to provide one in the actual theme file. For example:

    +
    # Luminance Color Factor
    +# The factor to lighten or darken Stations background
    +# color, to get a calculated color used as background
    +# for secondary windows
    +# Valid values: 0 - 0.2
    +Color Factor        0.05
    +

    In this case, the value provided (i.e. 0.05) will be used the same way as the config oprion Calculated color.

    +

    In fact, if both a theme and a config factor value is provided, the value provided by the theme will be used.

    +

    Note: If the “Messages Border” theme option provides both a foreground and a background, both the calculated values provided will be ignored.

    Alternative Main Window border color

    It is also possible to change the Main Window border color. This is a feature that has been requested and implemented, but not used by default.

    To provide an alternative border color, one would just add the following to a theme file:

    # Border color for the Main Window
     # (background color will come from Stations)
     Border              #69a9a7
    -

    Note: This color will be used only when the trerminal supports more than 16 colors. This is because Pyradio already uses colors 0-15, and this border color will be declaread as color No 16.

    +

    Note: This color will be used only when the terminal supports more than 16 colors. This is because Pyradio already uses colors 0-15, and this border color will be declared as color No 16.

    User themes

    Users can easiliy create their own themes, using for example CSS color names as a resource, and

      diff --git a/docs/themes.md b/docs/themes.md index 4c41d31..5d8d0b0 100644 --- a/docs/themes.md +++ b/docs/themes.md @@ -9,6 +9,7 @@ * [Secondary windows background](#secondary-windows-background) * [Theme defined secondary windows color](#theme-defined-secondary-windows-color) * [Calculated secondary windows color](#calculated-secondary-windows-color) + * [Optional Calculated Color in a Theme](#optional-calculated-color-in-a-theme) * [Alternative Main Window border color](#alternative-main-window-border-color) * [User themes](#user-themes) * [Converting old themes](#converting-old-themes) @@ -216,7 +217,7 @@ This information is actually relevant to creating a new **PyRadio** theme, but i #### Calculated secondary windows color -**PyRadio** will use the same background color for all windows by default, provided that the theme used does not define a "*Messages Border*" background color. +**PyRadio** will use the same background color for all windows by default, provided that the theme used does not define a "*Messages Border*" **background color**. In order to use a "*Messages Border*" background color different than the "*Stations background*" color, when "*Messages Border*" background color is not defined in the selected theme, a config option is available; "**Calculated color**". @@ -232,6 +233,25 @@ Finally, a check will be made to see if this color is close to "*Messages Border **Note:** When a calculated background color is used, pressing "**~**" (**tilde**) will toggle it on and off. This setting will be valid until **PyRadio** terminates, or a new theme is loaded. +##### Optional Calculated Color in a Theme + +Another way to use a different background color for secondary windows, is to provide one in the actual theme file. For example: + +``` +# Luminance Color Factor +# The factor to lighten or darken Stations background +# color, to get a calculated color used as background +# for secondary windows +# Valid values: 0 - 0.2 +Color Factor 0.05 +``` + +In this case, the value provided (i.e. 0.05) will be used the same way as the config oprion **Calculated color**. + +In fact, if both a theme and a config factor value is provided, the value provided by the theme will be used. + +**Note:** If the "**Messages Border**" theme option provides both a foreground and a background, both the *calculated* values provided will be ignored. + ### Alternative Main Window border color It is also possible to change the **Main Window** border color. This is a feature that has been requested and implemented, but not used by default. @@ -244,7 +264,7 @@ To provide an alternative border color, one would just add the following to a th Border #69a9a7 ``` -**Note:** This color will be used **only** when the trerminal supports more than 16 colors. This is because **Pyradio** already uses colors 0-15, and this border color will be declaread as color No 16. +**Note:** This color will be used **only** when the terminal supports more than 16 colors. This is because **Pyradio** already uses colors 0-15, and this border color will be declared as color No 16. ### User themes diff --git a/pyradio/config_window.py b/pyradio/config_window.py index 4103803..f483d11 100644 --- a/pyradio/config_window.py +++ b/pyradio/config_window.py @@ -480,6 +480,7 @@ def _put_cursor(self, jump): self._start += 1 if self.__selection - self._start > visible_items: self._start = self.__selection - self._start - visible_items + 1 + self._start = self.__selection - visible_items else: if self.__selection in self._headers: self.__selection -= 1 diff --git a/pyradio/win.py b/pyradio/win.py index 5c19b74..15a2ce7 100644 --- a/pyradio/win.py +++ b/pyradio/win.py @@ -38,7 +38,7 @@ https://sourceforge.net/projects/mpv-player-windows/files/latest/download ''' zurl = [ - 'https://sourceforge.com/projects/mpv-player-windows/files/64bit/mpv-x86_64-20240421-git-b364e4a.7z/download', + 'https://sourceforge.com/projects/mpv-player-windows/files/64bit/mpv-x86_64-20240505-git-c4b6d0d.7z/download', 'https://sourceforge.net/projects/mplayerwin/files/MPlayer-MEncoder/r38151/mplayer-svn-38151-x86_64.7z/download' ]