From 2b6ac48fe0c09be04fba2b239cc979e2aab8d6fa Mon Sep 17 00:00:00 2001 From: Spiros Georgaras Date: Sun, 26 Jun 2022 16:15:02 +0300 Subject: [PATCH] - version 0.8.9.21 (0.9-beta18) - updating docs --- Changelog | 9 +- README.html | 117 ++++++++++++++--- README.md | 118 +++++++++++++++--- pyradio.1 | 85 ++++++++++++- pyradio/__init__.py | 2 +- pyradio/config.py | 4 +- pyradio/main.py | 2 +- pyradio/radio.py | 23 ++-- pyradio/themes/classic_by_obsdg.pyradio-theme | 2 +- 9 files changed, 307 insertions(+), 55 deletions(-) diff --git a/Changelog b/Changelog index 8862b71c..e5c301de 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,12 @@ +2022-06-26 s-n-g + * version 0.8.9.21 (0.9-beta18) + * Theme Selection window partly rewritten + * Converting themes to using CSS colors + * Themes updated and new themes added + * Updated docs + 2022-05-22 s-n-g - * version 0.8.9.20 (0.9-beta-17) + * version 0.8.9.20 (0.9-beta17) * going back to history will ask to save a modified playlist * fixing #157 (python2 only) * other minor changes diff --git a/README.html b/README.html index 5c66260d..4742bf7e 100644 --- a/README.html +++ b/README.html @@ -98,6 +98,11 @@

Table of Contents <
  • Copying and pasting - Registers
  • PyRadio Themes
  • Mouse support
  • @@ -153,8 +158,15 @@

    Requirements Changelog Top

     
    +2022-06-26 s-n-g
    +    * version 0.8.9.21 (0.9-beta18)
    +    * Theme Selection window partly rewritten
    +    * Converting themes to using CSS colors
    +    * Themes updated and new themes added
    +    * Updated docs
    +
     2022-05-22 s-n-g
    -    * version 0.8.9.20 (0.9-beta-17)
    +    * version 0.8.9.20 (0.9-beta17)
         * going back to history will ask to save a modified playlist
         * fixing #157 (python2 only)
         * other minor changes
    @@ -1182,29 +1194,100 @@ 

    Copying and pasting - Registers PyRadio Themes Top

    PyRadio comes with 6 preconfigured (hard coded) themes:

      -
    1. dark (8 color theme). This is the appearance PyRadio has always had. Enabled by default.
    2. -
    3. light (8 color theme). A theme for light terminal background settings.
    4. -
    5. dark_16_colors (16 color theme). “dark” theme alternative.
    6. -
    7. light_16_colors (16 color theme). “light” them alternative.
    8. -
    9. white_on_black or wob (256 color b&w theme). A theme for dark terminal background settings.
    10. -
    11. black_on_white or bow (256 color b&w theme). A theme for light terminal background settings.
    12. +
    13. dark (8 color theme).
      +This is the appearance PyRadio has always had. Enabled by default.
    14. +
    15. light
      +A theme for light terminal background settings.
    16. +
    17. dark_16_colors
      +“dark” theme alternative.
    18. +
    19. light_16_colors
      +“light” them alternative.
    20. +
    21. white_on_black or wob (b&w theme).
      +A theme for dark terminal background settings.
    22. +
    23. black_on_white or bow (b&w theme).
      +A theme for light terminal background settings.
    24. +
    +

    Furthermore, a number of themes (these are actual files saved in the themes installation directory) are also available:

    +
      +
    • classic_by_obsdg
      +A clasic theme by The OpenBSD Guy, originally created on OpenBSD.
    • +
    • cupcake_by_edunfelt and fairyflossy_by_edunfelt
      +Two themes by edunfelt inspired by the base16 project.
    • +
    • gruvbox_dark_by_sng and gruvbox_light_by_sng
      +Two themes based on the gruvbox theme.
    • +
    • pastel_based_by_sng
      +A dim but colorful theme.
    • +
    +

    Contrary to the old styling method, which was terminal and palette dependent, a new styling method has been implemented; actual CSS colors can now be defined.

    +

    Theme sample / template:

    +
    # Main foreground and background
    +Stations            #8b8198 #fbf1f2
    +
    +# Playing station text color
    +# (background color will come from Stations)
    +Active Station      #d57e85
    +
    +# Status bar foreground and background
    +Status Bar          #fbf1f2 #d57e85
    +
    +# Normal cursor foreground and background
    +Normal Cursor       #fbf1f2 #dcb16c
    +
    +# Cursor foreground and background
    +# when cursor on playing station
    +Active Cursor       #fbf1f2 #d57e85
    +
    +# Cursor foreground and background
    +# This is the Line Editor cursor
    +Edit Cursor         #fbf1f2 #bfb9c6
    +
    +# Text color for extra function indication
    +# and jump numbers within the status bar
    +# (background color will come from Stations)
    +Extra Func          #69a9a7
    +
    +# Text color for URL
    +# (background color will come from Stations)
    +PyRadio URL         #a3b367
    +
    +# Message window borser foreground
    +# (background color will come from Stations)
    +Messages Border     #a3b367
    +

    Pressing “t” will bring up the Theme selection window, which can be used to activate a theme and set the default one.

    +

    Note: If the theme selected in the “Theme selection window”, (or requested using the “-t” command line option), is in any way invalid, or is of the old format, PyRadio will fall-back to the “dark” theme and will display a relevant message.

    +

    The “Theme selection window” will remain open after activating a theme, so that the user can inspect the visual result and easily change it, if desired. Then, when he is satisfied with the activated theme, the window will have to be manually closed (by pressing “q” or any other relevant key - pressing “?” will bring up its help).

    +

    CSS color themes restrictions

    +

    Using CSS colors imposes a couple of restrictions on the type of terminals PyRadio will be able to run:

    +
      +
    1. The TERM variable must be set (Linux and MacOs only).
      +
      +PyRadio will set it to “xterm-256color” if not set.
      +
      +Furthermore, if TERM is set to anything like “xterm”, ”screen” or “tmux“, PyRadio will set it to”xterm-256color*” as well.

    2. +
    3. Terminals that do not support at least 16 colors will not be able to display any of the new themes. The same goes for terminals that do not support changing their colors (through the curses library).
      +
      +These terminal will default to the old “dark” theme, displaying whatever colors the active palette dictates.

    4. +
    5. There are a couple of terminals (that I know of) which will permit changing their colors but will not be able to present the changed color on the fly.
      +
      +This means that, in order for a theme change to take full effect, PyRadio will have to be restarted.

    -

    Furthermore, three 256-color system themes (these are actual files saved in the themes installation directory) are also available:

    +

    User themes

    +

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

      -
    1. brown_by_sng
    2. -
    3. pink_by_sng
    4. -
    5. purple_by_sng
    6. +
    7. Save the theme provided as a template above in their themes folder using any (short) file name and a “.pyradio-theme” file extension.
      +
      +For this reason, a folder called “themes” will probably have to be created in PyRadio config directory (~/.config/pyradio or **%APPDATA* on Windows)

    8. +
    9. Customize it as desired

    10. +
    11. Load it from the “Theme selection window” (it will be found under “User Themes”).

    -

    The visual result of an applied theme greatly depends on the terminal settings (e.g. foreground and background color settings, palette used, number of colors supported, real or pseudo-transparency support, etc.)

    -

    Pressing “t” will bring up the Theme selection window, which can be used to activate a theme and set the default one.

    -

    Note: Themes that use more colors than those supported by the terminal in use, will not be present in the Theme selection window. Furthermore, if a such at theme is set as default (or requested using the “-t” command line option), PyRadio will fall-back to the “dark” theme (or the “light” theme, if the terminal supports 8 colors and default theme is set to “light_16_colors”), and will display a relevant message at program startup.

    -

    The Theme selection window will remain open after activating a theme, so that the user can inspect the visual result and easily change it, if desired. Then, when he is satisfied with the activated theme, the window will have to be manually closed (by pressing “q” or any other relevant key - pressing “?” will bring up its help).

    -

    The use of custom themes and theme editing is not implemented yet; these are features for future releases.

    +

    Converting old themes

    +

    An old theme (using the old format) can be asily converted to the new format, using the script found at this gist.

    +

    Note: In order to get the color intended to be used, the same palette as the one used when the original theme was created, must be used.

    Using transparency

    PyRadio themes are able to be used with a transparent background.

    Pressing “T” will toggle the transparency setting and save this state in PyRadio’s configuration file (transparency is off by default).

    Setting transparency on, will actually force PyRadio to not use its own background color, effectively making it to display whatever is on the terminal (color/picture/transparency). The visual result depends on terminal settings and whether a compositor is running.

    -

    When the Theme selection window is visible, a “[T]” string displayed at its bottom right corner will indicate that transparency is on.

    +

    When the “Theme selection window” is visible, a “[T]” string displayed at its bottom right corner will indicate that transparency is on.

    Mouse support Top

    Being a console application, PyRadio was never intended to work with a mouse.

    Furthermore, when using the mouse on a console application, the result is highly dependent on the terminal used and the way it implements mouse support.

    diff --git a/README.md b/README.md index 6b29617e..12e4ef28 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,9 @@ Ben Dowling - [https://github.com/coderholic](https://github.com/coderholic) * [Displaying Station Info](#displaying-station-info) * [Copying and pasting - Registers](#copying-and-pasting---registers) * [PyRadio Themes](#pyradio-themes) + * [CSS color themes restrictions](#css-color-themes-restrictions) + * [User themes](#user-themes) + * [Converting old themes](#converting-old-themes) * [Using transparency](#using-transparency) * [Mouse support](#mouse-support) * [Titles logging](#titles-logging) @@ -710,28 +713,113 @@ To **paste** the *unnamed* register to a playlist or register, one would press: **PyRadio** comes with 6 preconfigured (hard coded) themes: -1. **dark** (8 color theme). This is the appearance **PyRadio** has always had. Enabled by default. -2. **light** (8 color theme). A theme for light terminal background settings. -3. **dark_16_colors** (16 color theme). "**dark**" theme alternative. -4. **light_16_colors** (16 color theme). "**light**" them alternative. -5. **white_on_black** or **wob** (256 color b&w theme). A theme for dark terminal background settings. -6. **black_on_white** or **bow** (256 color b&w theme). A theme for light terminal background settings. +1. **dark** (8 color theme). \ +This is the appearance **PyRadio** has always had. Enabled by default. +2. **light** \ +A theme for light terminal background settings. +3. **dark_16_colors** \ +"**dark**" theme alternative. +4. **light_16_colors** \ +"**light**" them alternative. +5. **white_on_black** or **wob** (b&w theme). \ +A theme for dark terminal background settings. +6. **black_on_white** or **bow** (b&w theme). \ +A theme for light terminal background settings. + +Furthermore, a number of themes (these are actual files saved in the **themes** installation directory) are also available: + +- **classic_by_obsdg** \ +A clasic theme by [The OpenBSD Guy](https://github.com/OpenBSDGuy), originally created on [OpenBSD](https://www.openbsd.org/). +- **cupcake_by_edunfelt** and **fairyflossy_by_edunfelt** \ +Two themes by [edunfelt](https://github.com/edunfelt) inspired by the [base16](https://github.com/base16-project) project. +- **gruvbox_dark_by_sng** and **gruvbox_light_by_sng** \ +Two themes based on the [gruvbox](https://github.com/morhetz/gruvbox) theme. +- **pastel_based_by_sng** \ +A dim but colorful theme. + +Contrary to the old styling method, which was terminal and palette dependent, a new styling method has been implemented; actual CSS colors can now be defined. + +Theme sample / template: -Furthermore, three 256-color system themes (these are actual files saved in the **themes** installation directory) are also available: +``` +# Main foreground and background +Stations #8b8198 #fbf1f2 + +# Playing station text color +# (background color will come from Stations) +Active Station #d57e85 + +# Status bar foreground and background +Status Bar #fbf1f2 #d57e85 + +# Normal cursor foreground and background +Normal Cursor #fbf1f2 #dcb16c + +# Cursor foreground and background +# when cursor on playing station +Active Cursor #fbf1f2 #d57e85 + +# Cursor foreground and background +# This is the Line Editor cursor +Edit Cursor #fbf1f2 #bfb9c6 -1. **brown_by_sng** -2. **pink_by_sng** -3. **purple_by_sng** +# Text color for extra function indication +# and jump numbers within the status bar +# (background color will come from Stations) +Extra Func #69a9a7 -The visual result of an applied theme greatly depends on the terminal settings (e.g. foreground and background color settings, palette used, number of colors supported, real or pseudo-transparency support, etc.) +# Text color for URL +# (background color will come from Stations) +PyRadio URL #a3b367 + +# Message window borser foreground +# (background color will come from Stations) +Messages Border #a3b367 +``` Pressing "**t**" will bring up the *Theme selection window*, which can be used to activate a theme and set the default one. -**Note:** Themes that use more colors than those supported by the terminal in use, will not be present in the *Theme selection window*. Furthermore, if a such at theme is set as default (or requested using the "**-t**" command line option), **PyRadio** will fall-back to the "**dark**" theme (or the "**light**" theme, if the terminal supports 8 colors and default theme is set to "*light_16_colors*"), and will display a relevant message at program startup. +**Note:** If the theme selected in the "*Theme selection window*", (or requested using the "**-t**" command line option), is in any way invalid, or is of the old format, **PyRadio** will fall-back to the "**dark**" theme and will display a relevant message. + +The "*Theme selection window*" will remain open after activating a theme, so that the user can inspect the visual result and easily change it, if desired. Then, when he is satisfied with the activated theme, the window will have to be manually closed (by pressing "**q**" or any other relevant key - pressing "**?**" will bring up its help). + +### CSS color themes restrictions + +Using CSS colors imposes a couple of restrictions on the type of terminals **PyRadio** will be able to run: + +1. The TERM variable must be set *(Linux and MacOs only)*. \ +\ +**PyRadio** will set it to "*xterm-256color*" if not set. \ +\ +Furthermore, if TERM is set to anything like "**xterm***", "**screen***" or "**tmux***", **PyRadio** will set it to "*xterm-256color*" as well. + +2. Terminals that do not support at least 16 colors will not be able to display any of the new themes. The same goes for terminals that do not support changing their colors (through the **curses** library). \ +\ +These terminal will default to the old "**dark**" theme, displaying whatever colors the active palette dictates. + +3. There are a couple of terminals (that I know of) which will permit changing their colors but will not be able to present the changed color on the fly. \ +\ +This means that, in order for a theme change to take full effect, **PyRadio** will have to be restarted. + +### User themes + +Users can easiliy create their own themes, using for example [CSS color names](https://www.cssportal.com/css3-color-names/) as a resource, and + +1. Save the theme provided as a template above in their themes folder using any (short) file name and a "**.pyradio-theme**" file extension. \ +\ +For this reason, a folder called "**themes**" will probably have to be created in **PyRadio** config directory (**~/.config/pyradio** or **%APPDATA\pyradio** on Windows) + + +2. Customize it as desired + +3. Load it from the "*Theme selection window*" (it will be found under "**User Themes**"). + + +#### Converting old themes -The *Theme selection window* will remain open after activating a theme, so that the user can inspect the visual result and easily change it, if desired. Then, when he is satisfied with the activated theme, the window will have to be manually closed (by pressing "**q**" or any other relevant key - pressing "**?**" will bring up its help). +An old theme (using the old format) can be asily converted to the new format, using the script found at [this gist](https://gist.github.com/s-n-g/65aa6ae12e135481bf3a503ece4e92d2). -The use of custom themes and theme editing is not implemented yet; these are features for future releases. +**Note:** In order to get the color intended to be used, the same palette as the one used when the original theme was created, must be used. ### Using transparency @@ -741,7 +829,7 @@ Pressing "**T**" will toggle the transparency setting and save this state in ** Setting transparency on, will actually force **PyRadio** to not use its own background color, effectively making it to display whatever is on the terminal (color/picture/transparency). The visual result depends on terminal settings and whether a compositor is running. -When the *Theme selection window* is visible, a "**[T]**" string displayed at its bottom right corner will indicate that transparency is *on*. +When the "*Theme selection window*" is visible, a "**[T]**" string displayed at its bottom right corner will indicate that transparency is *on*. ## Mouse support diff --git a/pyradio.1 b/pyradio.1 index c6d4227a..dcfb725b 100644 --- a/pyradio.1 +++ b/pyradio.1 @@ -1,7 +1,7 @@ .\" Copyright (C) 2011 Ben Dowling .\" This manual is freely distributable under the terms of the GPL. .\" -.TH pyradio 1 "May 2022" PyRadio +.TH pyradio 1 "June 2022" PyRadio .SH Name .PP @@ -801,6 +801,7 @@ To \fBpaste\fR the \fIunnamed\fR register to a playlist or register, one would p \fBPyRadio\fR comes with 6 preconfigured (hard coded) themes: +.RS 5 .IP \fBdark\fR\ (8\ color\ theme) This is the appearance \fBPyRadio\fR has always had. Enabled by default. .IP \fBlight\fR\ (8\ color\ theme) @@ -814,21 +815,95 @@ A theme for dark terminal background settings. .IP \fBblack_on_white\fR\ or\ \fBbow\fR\ (256\ color\ b&w\ theme) A theme for light terminal background settings. +.RE .PP -Furthermore, three 256-color system themes (these are actual files saved in the \fIthemes\fR installation directory) are also available: \fBbrown_by_sng\fR, \fBpink_by_sng\fR and \fBpurple_by_sng\fR. +Furthermore, a number of \fISystem Themes\fR (these are actual files saved in the \fIthemes\fR installation directory) are also available: + +.RS 5 +.IP \fBclassic_by_obsdg\fR +A clasic theme by \fBThe OpenBSD Guy\fR (\fIhttps://github.com/OpenBSDGuy\fR), originally created on \fBOpenBSD\fR (\fIhttps://www.openbsd.org/\fR). +.IP \fBcupcake_by_edunfelt\fR and \fBfairyflossy_by_edunfelt\fR +Two themes by \fBedunfelt\fR (\fIhttps://github.com/edunfelt\fR) inspired by the \fBbase16\fR (\fIhttps://github.com/base16-project\fR) project. +.IP \fBgruvbox_dark_by_sng\fR and \fBgruvbox_light_by_sng\fR +Two themes based on the \fBgruvbox\fR (\fIhttps://github.com/morhetz/gruvbox\fR) theme. +.IP \fBpastel_based_by_sng\fR +A dim but colorful theme. +.RE .PP -The visual result of an applied theme greatly depends on the terminal settings (e.g. foreground and background color settings, palette used, number of colors supported, real or pseudo-transparency support, etc.) +Contrary to the old styling method, which was terminal and palette dependent, a new styling method has been implemented; actual \fICSS colors\fR can now be defined. Pressing "\fBt\fR" will bring up the \fITheme selection window\fR, which can be used to activate a theme and set the default one. .IP \fBNote\fR -Themes that use more colors than those supported by the terminal in use, will not be present in the \fITheme selection window\fR. Furthermore, if a such a theme is set as default (or requested using the "\fB-t\fR" command line option), \fBPyRadio\fR will fall-back to the "\fBdark\fR" theme, (or the "\fBlight\fR" theme, if the terminal supports 8 colors and default theme is set to "\fIlight_16_colors\fR"), and will display a relevant messages at program startup. +If the theme selected in the \fITheme selection window\fR, (or requested using the "\fB-t\fR" command line option), is in any way invalid, or is of the old format, **PyRadio** will fall-back to the "\fBdark\fR" theme and will display a relevant message. .PP The \fITheme selection window\fR will remain open after activating a theme, so that the user can inspect the visual result and easily change it, if desired. Then, when he is satisfied with the activated theme, the window will have to be manually closed (by pressing "\fBq\fR" or any other relevant key - pressing "\fB?\fR" will bring up its help). -The use of custom themes and theme editing is not implemented yet; theses are features for future releases. +.PP +\fBCSS color themes restrictions\fR + +Using CSS colors imposes a couple of restrictions on the type of terminals \fBpyradio\fR will be able to run: + +.RS 5 +.IP 1. 3 +The TERM variable must be set (\fILinux and MacOs only\fR). + +\fBpyradio\fR will set it to "\fIxterm-256color\fR" if not set. + +Furthermore, if TERM is set to anything like "\fIxterm*\fR", "\fIscreen*\fR" or "\fItmux*\fR", \fBpyradio\fR will set it to "\fIxterm-256color\fR" as well. + +.IP 2. 3 +Terminals that do not support at least 16 colors will not be able to display any of the new themes. The same goes for terminals that do not support changing their colors (through the \fBcurses\fR library). + +These terminal will default to the old "\fBdark\fR" theme, displaying whatever colors the active palette dictates. + +.IP 3. 3 +There are a couple of terminals (that I know of) which will permit changing their colors but will not be able to present the changed color on the fly. + +This means that, in order for a theme change to take full effect, \fBpyradio\fR will have to be restarted. + +.RE +.PP +\fBUser themes\fR + +Users can easiliy create their own themes, using for example \fBCSS color names\fR (\fIhttps://www.cssportal.com/css3-color-names/\fR) as a resource, and + +.RS 5 +.IP 1. 3 +Copy (and rename) one of the \fISystem Themes\fR to the user's \fBthemes\fR folder. This folder may not already exist; it must be created in \fBpyradio\fR config directory (\fI~/.config/pyradio\fR). + +To gain access to the \fISystem Themes\fR, execute the following commands + +\fIcd `python -c 'import site; print(site.getusersitepackages())'`\fR +.BR +\fIcd pyradio/themes\fR + +(you may have to use \fIpython2\fR or \fIpython3\fR instead of plain \fIpython\fR, depending on your OS and distribution). + +.IP 2. 3 +Customize it as desired + +.IP 3. 3 +Load it from the \fITheme selection window\fR (it will be found under "\fBUser Themes\fR"). + +.RE +.PP +\fBConverting old themes\fR + +An old theme (using the old format) can be asily converted to the new format, using the script found at \fBthis gist\fR (\fIhttps://gist.github.com/s-n-g/65aa6ae12e135481bf3a503ece4e92d2\fR). + +.IP \fBNote: +In order to get the color intended to be used, the same palette as the one used when the original theme was created, must be used. + + + + + + + + .PP \fBUsing Transparency\fR diff --git a/pyradio/__init__.py b/pyradio/__init__.py index e17a92fc..ed11c08d 100644 --- a/pyradio/__init__.py +++ b/pyradio/__init__.py @@ -1,6 +1,6 @@ " pyradio -- Console radio player. " -version_info = (0, 8, 9, 20) +version_info = (0, 8, 9, 21) # Set it to True if new stations have been # added to the package's stations.csv diff --git a/pyradio/config.py b/pyradio/config.py index 6d2df91d..d1d1db3b 100644 --- a/pyradio/config.py +++ b/pyradio/config.py @@ -1761,8 +1761,8 @@ def read_config(self): logger.info('Default playlist "({}") does not exist; reverting to "stations"'.format(self.opts['default_station'][1])) self.opts['default_playlist'][1] = 'stations' self.opts['default_station'][1] = 'False' - for n in self.opts.keys(): - logger.error(' {0}: {1} '.format(n, self.opts[n])) + # for n in self.opts.keys(): + # logger.error(' {0}: {1} '.format(n, self.opts[n])) return 0 def get_last_playlist(self): diff --git a/pyradio/main.py b/pyradio/main.py index d5ae3cea..04caea78 100644 --- a/pyradio/main.py +++ b/pyradio/main.py @@ -53,7 +53,7 @@ def shell(): if not sys.platform.startswith('win'): if not sys.platform.startswith('win'): term = getenv('TERM') - print('TERM = {}'.format(term)) + # print('TERM = {}'.format(term)) if term is None: print('== Warning: TERM is not set. Using xterm-256color') environ['TERM'] = 'xterm-256color' diff --git a/pyradio/radio.py b/pyradio/radio.py index 9b2513e8..477f7232 100644 --- a/pyradio/radio.py +++ b/pyradio/radio.py @@ -511,12 +511,12 @@ def playing(self, value): self._update_history_positions_in_list() def _save_colors(self): - if curses.can_change_color(): + if curses.can_change_color() and curses.COLORS >= 16: for i in range(0, 16): self._saved_colors[i] = curses.color_content(i) def restore_colors(self): - if curses.can_change_color(): + if curses.can_change_color() and curses.COLORS >= 16: for i in range(0,16): curses.init_color( i, @@ -531,11 +531,10 @@ def setup(self, stdscr): self._save_colors() # curses.savetty() self.setup_return_status = True - # if not curses.has_colors() or not curses.can_change_color(): if not curses.has_colors(): self.setup_return_status = False return - if not curses.can_change_color(): + if not curses.can_change_color() or curses.COLORS < 16: curses.init_pair(1, curses.COLOR_CYAN, curses.COLOR_BLACK) curses.init_pair(2, curses.COLOR_BLUE, curses.COLOR_BLACK) curses.init_pair(3, curses.COLOR_YELLOW, curses.COLOR_BLACK) @@ -562,10 +561,9 @@ def setup(self, stdscr): except: pass - if curses.can_change_color(): + if curses.can_change_color() and curses.COLORS >= 16: self._theme._transparent = self._cnf.use_transparency self._theme.config_dir = self._cnf.stations_dir - logger.error('========= HERE =======') ret, ret_theme_name = self._theme.readAndApplyTheme(self._theme_name) if ret == 0: self._theme_name = self._theme.applied_theme_name @@ -1177,7 +1175,7 @@ def _wait_for_theme_to_change(self, file, a_lock, stop, func): logger.debug('File watch thread stopped on: {}'.format(file)) def run(self): - self._watch_theme() + # self._watch_theme() self._register_signals_handlers() if self.ws.operation_mode == self.ws.DEPENDENCY_ERROR: self.log.write(msg="Dependency missing. Press any key to exit....", error_msg=True) @@ -1324,8 +1322,9 @@ def ctrl_c_handler(self, signum, frame): self.restore_colors() def _wait_for_threads(self): - self.stop_watch_theme_thread = True - self._watch_theme_thread.join() + if self._watch_theme_thread: + self.stop_watch_theme_thread = True + self._watch_theme_thread.join() if self._update_notification_thread: if self._update_notification_thread.is_alive(): self.stop_update_notification_thread = True @@ -1705,7 +1704,7 @@ def readPlaylists(self): return num_of_playlists, playing def _show_theme_selector_from_config(self): - if not curses.can_change_color(): + if not curses.can_change_color() or curses.COLORS < 16: # TODO show msg self._show_colors_cannot_change() return @@ -4048,7 +4047,7 @@ def _toggle_transparency(self, changed_from_config_window=False, force_value=Non ''' if self.ws.window_mode == self.ws.CONFIG_MODE and not changed_from_config_window: return - if not curses.can_change_color(): + if not curses.can_change_color() or curses.COLORS < 16: # TODO show msg self._show_colors_cannot_change() return @@ -5449,7 +5448,7 @@ def keypress(self, char): self._reset_status_bar_right() self._config_win = None self.theme_forced_selection = None - if not curses.can_change_color(): + if not curses.can_change_color() or curses.COLORS < 16: # TODO show msg self._show_colors_cannot_change() return diff --git a/pyradio/themes/classic_by_obsdg.pyradio-theme b/pyradio/themes/classic_by_obsdg.pyradio-theme index f133901f..16a98381 100644 --- a/pyradio/themes/classic_by_obsdg.pyradio-theme +++ b/pyradio/themes/classic_by_obsdg.pyradio-theme @@ -26,7 +26,7 @@ Extra Func #80a2be # Text color for URL # (background color will come from Stations) -PyRadio URL #000000 +PyRadio URL #80a2be # Message window borser foreground # (background color will come from Stations)