mirror of
https://github.com/DYefremov/DemonEditor.git
synced 2025-12-22 16:39:42 +01:00
telnet options
This commit is contained in:
10
app/ftp.py
10
app/ftp.py
@@ -58,8 +58,8 @@ def upload_data(*, properties, download_type=DownloadDataType.ALL, remove_unused
|
|||||||
data_path = properties["data_dir_path"]
|
data_path = properties["data_dir_path"]
|
||||||
host = properties["host"]
|
host = properties["host"]
|
||||||
# telnet
|
# telnet
|
||||||
tn = telnet(host=host, user=None if profile is Profile.ENIGMA_2 else "root", password=None,
|
tn = telnet(host=host, user=properties.get("telnet_user", "root"), password=properties.get("telnet_password", ""),
|
||||||
timeout=5 if profile is Profile.ENIGMA_2 else 1)
|
timeout=properties.get("telnet_timeout", 5))
|
||||||
next(tn)
|
next(tn)
|
||||||
# terminate enigma or enigma
|
# terminate enigma or enigma
|
||||||
tn.send("init 4")
|
tn.send("init 4")
|
||||||
@@ -119,7 +119,7 @@ def send_file(file_name, path, ftp):
|
|||||||
return ftp.storbinary("STOR " + file_name, f)
|
return ftp.storbinary("STOR " + file_name, f)
|
||||||
|
|
||||||
|
|
||||||
def telnet(host, port=23, user=None, password=None, timeout=5):
|
def telnet(host, port=23, user="", password="", timeout=5):
|
||||||
try:
|
try:
|
||||||
tn = Telnet(host=host, port=port, timeout=timeout)
|
tn = Telnet(host=host, port=port, timeout=timeout)
|
||||||
except socket.timeout:
|
except socket.timeout:
|
||||||
@@ -127,11 +127,11 @@ def telnet(host, port=23, user=None, password=None, timeout=5):
|
|||||||
else:
|
else:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
command = yield
|
command = yield
|
||||||
if user is not None:
|
if user != "":
|
||||||
tn.read_until(b"login: ")
|
tn.read_until(b"login: ")
|
||||||
tn.write(user.encode("utf-8") + b"\n")
|
tn.write(user.encode("utf-8") + b"\n")
|
||||||
time.sleep(timeout)
|
time.sleep(timeout)
|
||||||
if password is not None:
|
if password != "":
|
||||||
tn.read_until(b"Password: ")
|
tn.read_until(b"Password: ")
|
||||||
tn.write(password.encode("utf-8") + b"\n")
|
tn.write(password.encode("utf-8") + b"\n")
|
||||||
time.sleep(timeout)
|
time.sleep(timeout)
|
||||||
|
|||||||
@@ -223,21 +223,7 @@ dmitry.v.yefremov@gmail.com
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="picons_radio_button">
|
<placeholder/>
|
||||||
<property name="label" translatable="yes">Picons</property>
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="sensitive">False</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="receives_default">False</property>
|
|
||||||
<property name="xalign">0</property>
|
|
||||||
<property name="draw_indicator">True</property>
|
|
||||||
<property name="group">satellites_radio_button</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">4</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
@@ -620,9 +606,12 @@ dmitry.v.yefremov@gmail.com
|
|||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkAdjustment" id="telnet_timeout_adjustment">
|
<object class="GtkAdjustment" id="telnet_timeout_adjustment">
|
||||||
<property name="upper">100</property>
|
<property name="lower">1</property>
|
||||||
|
<property name="upper">11</property>
|
||||||
|
<property name="value">1</property>
|
||||||
<property name="step_increment">1</property>
|
<property name="step_increment">1</property>
|
||||||
<property name="page_increment">10</property>
|
<property name="page_increment">10</property>
|
||||||
|
<property name="page_size">1</property>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkDialog" id="settings_dialog">
|
<object class="GtkDialog" id="settings_dialog">
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
@@ -821,7 +810,6 @@ dmitry.v.yefremov@gmail.com
|
|||||||
<child>
|
<child>
|
||||||
<object class="GtkGrid" id="telnet_settings_grid">
|
<object class="GtkGrid" id="telnet_settings_grid">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="sensitive">False</property>
|
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="column_spacing">2</property>
|
<property name="column_spacing">2</property>
|
||||||
<property name="column_homogeneous">True</property>
|
<property name="column_homogeneous">True</property>
|
||||||
@@ -907,8 +895,12 @@ dmitry.v.yefremov@gmail.com
|
|||||||
<object class="GtkSpinButton" id="telnet_timeout_spin_button">
|
<object class="GtkSpinButton" id="telnet_timeout_spin_button">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
|
<property name="tooltip_text" translatable="yes">Timeout between commands in seconds</property>
|
||||||
|
<property name="max_length">2</property>
|
||||||
<property name="primary_icon_name">alarm-symbolic</property>
|
<property name="primary_icon_name">alarm-symbolic</property>
|
||||||
|
<property name="input_purpose">number</property>
|
||||||
<property name="adjustment">telnet_timeout_adjustment</property>
|
<property name="adjustment">telnet_timeout_adjustment</property>
|
||||||
|
<property name="numeric">True</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
|
|||||||
@@ -613,6 +613,7 @@ class MainAppWindow:
|
|||||||
for v in [view, *args]:
|
for v in [view, *args]:
|
||||||
v.get_selection().unselect_all()
|
v.get_selection().unselect_all()
|
||||||
|
|
||||||
|
@run_idle
|
||||||
def on_preferences(self, item):
|
def on_preferences(self, item):
|
||||||
response = show_settings_dialog(self.__main_window, self.__options)
|
response = show_settings_dialog(self.__main_window, self.__options)
|
||||||
if response != Gtk.ResponseType.CANCEL:
|
if response != Gtk.ResponseType.CANCEL:
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ class SettingsDialog:
|
|||||||
options["telnet_user"] = self._telnet_login_field.get_text()
|
options["telnet_user"] = self._telnet_login_field.get_text()
|
||||||
options["telnet_password"] = self._telnet_password_field.get_text()
|
options["telnet_password"] = self._telnet_password_field.get_text()
|
||||||
options["telnet_port"] = self._telnet_port_field.get_text()
|
options["telnet_port"] = self._telnet_port_field.get_text()
|
||||||
options["telnet_timeout"] = self._telnet_timeout_spin_button.get_value()
|
options["telnet_timeout"] = int(self._telnet_timeout_spin_button.get_value())
|
||||||
options["services_path"] = self._services_field.get_text()
|
options["services_path"] = self._services_field.get_text()
|
||||||
options["user_bouquet_path"] = self._user_bouquet_field.get_text()
|
options["user_bouquet_path"] = self._user_bouquet_field.get_text()
|
||||||
options["satellites_xml_path"] = self._satellites_xml_field.get_text()
|
options["satellites_xml_path"] = self._satellites_xml_field.get_text()
|
||||||
|
|||||||
Reference in New Issue
Block a user