Skip to content

Commit

Permalink
- fixing Config Window PgDn selection position
Browse files Browse the repository at this point in the history
- updating Windows Media Players links
- updating docs
  • Loading branch information
s-n-g committed May 5, 2024
1 parent 959d1d5 commit 9b478a2
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
20 changes: 17 additions & 3 deletions docs/themes.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ <h2 id="table-of-contents">Table of Contents <span style="padding-left: 10px;"><
<li><a href="#secondary-windows-background">Secondary windows background</a>
<ul>
<li><a href="#theme-defined-secondary-windows-color">Theme defined secondary windows color</a></li>
<li><a href="#calculated-secondary-windows-color">Calculated secondary windows color</a></li>
<li><a href="#calculated-secondary-windows-color">Calculated secondary windows color</a>
<ul>
<li><a href="#optional-calculated-color-in-a-theme">Optional Calculated Color in a Theme</a></li>
</ul></li>
</ul></li>
<li><a href="#alternative-main-window-border-color">Alternative Main Window border color</a></li>
<li><a href="#user-themes">User themes</a>
Expand Down Expand Up @@ -225,21 +228,32 @@ <h4 id="theme-defined-secondary-windows-color">Theme defined secondary windows c
</ol>
<p>This information is actually relevant to creating a new <strong>PyRadio</strong> theme, but it’s very important in order to understand how the calculated background color works.</p>
<h4 id="calculated-secondary-windows-color">Calculated secondary windows color</h4>
<p><strong>PyRadio</strong> will use the same background color for all windows by default, provided that the theme used does not define a “<em>Messages Border</em>” background color.</p>
<p><strong>PyRadio</strong> will use the same background color for all windows by default, provided that the theme used does not define a “<em>Messages Border</em><strong>background color</strong>.</p>
<p>In order to use a “<em>Messages Border</em>” background color different than the “<em>Stations background</em>” color, when “<em>Messages Border</em>” background color is not defined in the selected theme, a config option is available; “<strong>Calculated color</strong>”.</p>
<p>This config option takes a value that’s between 0 and 0.2.</p>
<p>If it is 0, no color change will occur.</p>
<p>Otherwise, the value acts as a percentage (a <strong>factor</strong>), which indicates how much the luminance of the “<em>Stations background</em>” color will change to produce the new background color.</p>
<p>This is how this works: <strong>PyRadio</strong> will calculate the “<em>Stations background</em>” color perceived brightness, which will indicate whether the color is dark or light. Then depending on that, will add or subtract <strong>factor</strong> percent from its luminance value.</p>
<p>Finally, a check will be made to see if this color is close to “<em>Messages Border</em>” foreground color, and re-adjusted as possible.</p>
<p style="margin: 1.5em 4em 0 4em; text-indent: -2.5em;"><strong>Note:</strong> When a calculated background color is used, pressing “<strong>~</strong>” (<strong>tilde</strong>) will toggle it on and off. This setting will be valid until <strong>PyRadio</strong> terminates, or a new theme is loaded.</p>
<h5 id="optional-calculated-color-in-a-theme">Optional Calculated Color in a Theme</h5>
<p>Another way to use a different background color for secondary windows, is to provide one in the actual theme file. For example:</p>
<pre># 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</pre>
<p>In this case, the value provided (i.e. 0.05) will be used the same way as the config oprion <strong>Calculated color</strong>.</p>
<p>In fact, if both a theme and a config factor value is provided, the value provided by the theme will be used.</p>
<p style="margin: 1.5em 4em 0 4em; text-indent: -2.5em;"><strong>Note:</strong> If the “<strong>Messages Border</strong>” theme option provides both a foreground and a background, both the <em>calculated</em> values provided will be ignored.</p>
<h3 id="alternative-main-window-border-color">Alternative Main Window border color</h3>
<p>It is also possible to change the <strong>Main Window</strong> border color. This is a feature that has been requested and implemented, but not used by default.</p>
<p>To provide an alternative border color, one would just add the following to a theme file:</p>
<pre># Border color for the Main Window
# (background color will come from Stations)
Border #69a9a7</pre>
<p style="margin: 1.5em 4em 0 4em; text-indent: -2.5em;"><strong>Note:</strong> This color will be used <strong>only</strong> when the trerminal supports more than 16 colors. This is because <strong>Pyradio</strong> already uses colors 0-15, and this border color will be declaread as color No 16.</p>
<p style="margin: 1.5em 4em 0 4em; text-indent: -2.5em;"><strong>Note:</strong> This color will be used <strong>only</strong> when the terminal supports more than 16 colors. This is because <strong>Pyradio</strong> already uses colors 0-15, and this border color will be declared as color No 16.</p>
<h3 id="user-themes">User themes</h3>
<p>Users can easiliy create their own themes, using for example <a target="_blank" href="https://www.cssportal.com/css3-color-names/">CSS color names</a> as a resource, and</p>
<ol type="1">
Expand Down
24 changes: 22 additions & 2 deletions docs/themes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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**".

Expand All @@ -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.
Expand All @@ -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

Expand Down
1 change: 1 addition & 0 deletions pyradio/config_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyradio/win.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
]

Expand Down

0 comments on commit 9b478a2

Please sign in to comment.