|
12 | 12 | from .cjkwrap import cjklen |
13 | 13 | from .encodings import * |
14 | 14 | from .themes import * |
| 15 | +from .server import IPsWithNumbers |
15 | 16 | from .simple_curses_widgets import SimpleCursesLineEdit, SimpleCursesHorizontalPushButtons, SimpleCursesMenu |
16 | 17 | import logging |
17 | 18 | import locale |
@@ -88,7 +89,7 @@ class PyRadioConfigWindow(object): |
88 | 89 | '|', 'Default value: True']) |
89 | 90 | _help_text.append(['Specify whether you will be asked to save a modified playlist whenever it needs saving.', '|', 'Default value: False']) |
90 | 91 | _help_text.append(None) |
91 | | - _help_text.append(['This is the IP for the Remote Control Server.', '|', 'Available options:', '- localhost', ' PyRadio will be accessible from within the current system only.', '- LAN', ' PyRadio will be accessible from any computer in the local network.', '|', r'One can see the active IP using the "\s" command from the program\'s Main Window.', '|', 'Use "Space", "Enter", "l/Right" to change the value.','|', 'Default value: localhost']) |
| 92 | + _help_text.append(['This is the IP for the Remote Control Server.', '|', 'Available options:', '- localhost : PyRadio will be accessible from within the current system only.', '- lsn : PyRadio will be accessible from any computer in the local network.', '- IP : In case the system has more than one interfaces.', '|', 'Use "Space", "Enter", "l/Right" to change the value.','|', 'Default value: localhost']) |
92 | 93 | _help_text.append( |
93 | 94 | ['This is the port used by the Remote Control Server (the port the server is listening to).', '|', 'Please make sure that a "free" port is specified here, to avoid any conflicts with existing services and daemons.', '|', 'If an invalid port number is inserted, the cursor will not move to another field.', '|', 'Valid values: 1025-65535', 'Default value: 9998']) |
94 | 95 | _help_text.append(['If set to True, the Server wiil be automatically started when PyRadio starts.', r'If set to False, one can start the Server using the "\s" command from the Main program window.', '|', 'Default value: False']) |
@@ -190,6 +191,9 @@ def __init__(self, parent, config, |
190 | 191 | for a_key in self._cnf.saved_params.keys(): |
191 | 192 | if self._cnf.saved_params[a_key] != self._cnf.params[a_key]: |
192 | 193 | self._cnf.dirty_config = True |
| 194 | + self.nip = IPsWithNumbers( |
| 195 | + default_ip=self._config_options['remote_control_server_ip'][1] |
| 196 | + ) |
193 | 197 |
|
194 | 198 | def __del__(self): |
195 | 199 | self._toggle_transparency_function = None |
@@ -803,12 +807,14 @@ def keypress(self, char): |
803 | 807 |
|
804 | 808 | elif val[0] == 'remote_control_server_ip': |
805 | 809 | if char in (curses.KEY_RIGHT, ord('l'), ord(' '), ord('\n'), curses.KEY_ENTER): |
806 | | - if self._config_options[val[0]][1] == 'localhost': |
807 | | - self._config_options[val[0]][1] = 'LAN' |
808 | | - disp = 'LAN ' |
809 | | - else: |
810 | | - self._config_options[val[0]][1] = 'localhost' |
811 | | - disp = 'localhost' |
| 810 | + self._config_options[val[0]][1] = self.nip.next() |
| 811 | + disp = self._config_options[val[0]][1].ljust(15) |
| 812 | + # if self._config_options[val[0]][1] == 'localhost': |
| 813 | + # self._config_options[val[0]][1] = 'LAN' |
| 814 | + # disp = 'LAN ' |
| 815 | + # else: |
| 816 | + # self._config_options[val[0]][1] = 'localhost' |
| 817 | + # disp = 'localhost' |
812 | 818 | self._win.addstr( |
813 | 819 | Y, 3 + len(val[1][0]), |
814 | 820 | disp, curses.color_pair(6) |
|
0 commit comments