Skip to content

Commit

Permalink
new settings-restore will start the network now
Browse files Browse the repository at this point in the history
  • Loading branch information
WanWizard committed Jan 3, 2023
1 parent 70e0670 commit d20d23d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 34 deletions.
38 changes: 9 additions & 29 deletions lib/python/Components/Network.py
Expand Up @@ -650,34 +650,14 @@ def hotplug(self, event):
pass


iNetwork = Network()

def waitForNetwork(self, timeout=15):
while timeout > 0:
gws = ni.gateways()
if 'default' in gws and len(gws['default']) > 0:
print("[waitForNetwork] Online, reload interface data")
iNetwork.getInterfaces()
return
print("[waitForNetwork] Not online yet (%d)" % (timeout))

class NetworkCheck:
def __init__(self):
self.Timer = eTimer()
self.Timer.callback.append(self.startCheckNetwork)

def startCheckNetwork(self):
self.Timer.stop()
if self.Retry > 0:
try:
gws = ni.gateways()
if 'default' in gws and len(gws['default']) > 0:
print("[NetworkCheck] CheckNetwork - Done - Reload interface data")
iNetwork.getInterfaces()
return
self.Retry = self.Retry - 1
self.Timer.start(1000, True)
except Exception as e:
print("[NetworkCheck] CheckNetwork - Error: %s" % str(e))

def Start(self, seconds=30):
self.Retry = seconds
self.Timer.start(1000, True)


def InitNetwork():
global networkCheck
networkCheck = NetworkCheck()
networkCheck.Start()
iNetwork = Network()
4 changes: 0 additions & 4 deletions lib/python/Screens/StartWizard.py
Expand Up @@ -9,7 +9,6 @@
except:
OverscanWizard = None

from Components.Network import iNetwork, NetworkCheck
from Components.Pixmap import Pixmap
from Components.ProgressBar import ProgressBar
from Components.Label import Label
Expand Down Expand Up @@ -84,9 +83,6 @@ def close(self, value):
# restore network config first, we need it to autoinstall
self.console = eConsoleAppContainer()
self.console.execute('/etc/init.d/settings-restore.sh network')
iNetwork.restartNetwork()
networkCheck = NetworkCheck()
networkCheck.Start(10)
self.session.open(AutoInstall)
MessageBox.close(self)

Expand Down
2 changes: 1 addition & 1 deletion lib/python/StartEnigma.py
Expand Up @@ -582,7 +582,7 @@ def runNextScreen(session, screensToRun, *result):

profile("Network")
import Components.Network
Components.Network.InitNetwork()
Components.Network.waitForNetwork()

profile("LCD")
import Components.Lcd
Expand Down

0 comments on commit d20d23d

Please sign in to comment.