fce0733a8b8e39bed05be59197c1961595059309
[vuplus_openvuplus_3.0] / meta-openvuplus / recipes-vuplus / enigma2 / enigma2 / enigma2_vuplus_networksetup.patch
1 diff --git a/lib/python/Screens/NetworkSetup.py b/lib/python/Screens/NetworkSetup.py
2 index 2ea9b50..d24170d 100755
3 --- a/lib/python/Screens/NetworkSetup.py
4 +++ b/lib/python/Screens/NetworkSetup.py
5 @@ -23,6 +23,21 @@ from enigma import eTimer, ePoint, eSize, RT_HALIGN_LEFT, eListboxPythonMultiCon
6  from os import path as os_path, system as os_system, unlink
7  from re import compile as re_compile, search as re_search
8  
9 +def stopWlanConsole():
10 +       try:
11 +               from Plugins.SystemPlugins.WirelessLanSetup.Wlan import iStatus
12 +       except ImportError:
13 +               pass
14 +       else:
15 +               iStatus.stopWlanConsole()
16 +
17 +def getDataForWlanIface(iface, callback):
18 +       try:
19 +               from Plugins.SystemPlugins.WirelessLanSetup.Wlan import iStatus
20 +               iStatus.getDataForInterface(iface, callback)
21 +       except:
22 +               return False
23 +       return True
24  
25  class NetworkAdapterSelection(Screen,HelpableScreen):
26         def __init__(self, session):
27 @@ -413,7 +428,7 @@ class AdapterSetup(Screen, ConfigListScreen, HelpableScreen):
28                 self.default = None
29  
30                 if iNetwork.isWirelessInterface(self.iface):
31 -                       from Plugins.SystemPlugins.WirelessLan.Wlan import wpaSupplicant
32 +                       from Plugins.SystemPlugins.WirelessLanSetup.Wlan import wpaSupplicant
33                         self.ws = wpaSupplicant()
34                         self.encryptionlist = []
35                         self.encryptionlist.append(("Unencrypted", _("Unencrypted")))
36 @@ -766,7 +781,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen):
37                 if self["menulist"].getCurrent()[1] == 'edit':
38                         if iNetwork.isWirelessInterface(self.iface):
39                                 try:
40 -                                       from Plugins.SystemPlugins.WirelessLan.plugin import WlanScan
41 +                                       from Plugins.SystemPlugins.WirelessLanSetup.plugin import WlanScan
42                                 except ImportError:
43                                         self.session.open(MessageBox, self.missingwlanplugintxt, type = MessageBox.TYPE_INFO,timeout = 10 )
44                                 else:
45 @@ -782,7 +797,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen):
46                         self.session.open(NameserverSetup)
47                 if self["menulist"].getCurrent()[1] == 'scanwlan':
48                         try:
49 -                               from Plugins.SystemPlugins.WirelessLan.plugin import WlanScan
50 +                               from Plugins.SystemPlugins.WirelessLanSetup.plugin import WlanScan
51                         except ImportError:
52                                 self.session.open(MessageBox, self.missingwlanplugintxt, type = MessageBox.TYPE_INFO,timeout = 10 )
53                         else:
54 @@ -792,7 +807,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen):
55                                         self.showErrorMessage() # Display Wlan not available Message
56                 if self["menulist"].getCurrent()[1] == 'wlanstatus':
57                         try:
58 -                               from Plugins.SystemPlugins.WirelessLan.plugin import WlanStatus
59 +                               from Plugins.SystemPlugins.WirelessLanSetup.plugin import WlanStatus
60                         except ImportError:
61                                 self.session.open(MessageBox, self.missingwlanplugintxt, type = MessageBox.TYPE_INFO,timeout = 10 )
62                         else:
63 @@ -856,13 +871,9 @@ class AdapterSetupConfiguration(Screen, HelpableScreen):
64                 self["Statustext"].setText(_("Link:"))
65                 
66                 if iNetwork.isWirelessInterface(self.iface):
67 -                       try:
68 -                               from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus
69 -                       except:
70 +                       if not getDataForWlanIface(self.iface, self.getInfoCB):
71                                 self["statuspic"].setPixmapNum(1)
72                                 self["statuspic"].show()
73 -                       else:
74 -                               iStatus.getDataForInterface(self.iface,self.getInfoCB)
75                 else:
76                         iNetwork.getLinkState(self.iface,self.dataAvail)
77  
78 @@ -907,7 +918,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen):
79                 if ret is not None and len(ret):
80                         if ret[0] == 'ok' and (iNetwork.isWirelessInterface(self.iface) and iNetwork.getAdapterAttribute(self.iface, "up") is True):
81                                 try:
82 -                                       from Plugins.SystemPlugins.WirelessLan.plugin import WlanStatus
83 +                                       from Plugins.SystemPlugins.WirelessLanSetup.plugin import WlanStatus
84                                 except ImportError:
85                                         self.session.open(MessageBox, self.missingwlanplugintxt, type = MessageBox.TYPE_INFO,timeout = 10 )
86                                 else:   
87 @@ -922,16 +933,14 @@ class AdapterSetupConfiguration(Screen, HelpableScreen):
88  
89         def WlanStatusClosed(self, *ret):
90                 if ret is not None and len(ret):
91 -                       from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus
92 -                       iStatus.stopWlanConsole()
93 +                       stopWlanConsole()
94                         self.updateStatusbar()
95  
96         def WlanScanClosed(self,*ret):
97                 if ret[0] is not None:
98                         self.session.openWithCallback(self.AdapterSetupClosed, AdapterSetup, self.iface,ret[0])
99                 else:
100 -                       from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus
101 -                       iStatus.stopWlanConsole()
102 +                       stopWlanConsole()
103                         self.updateStatusbar()
104                         
105         def restartLan(self, ret = False):
106 @@ -975,12 +984,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen):
107                 iNetwork.stopDeactivateInterfaceConsole()
108                 iNetwork.stopActivateInterfaceConsole()
109                 iNetwork.stopPingConsole()
110 -               try:
111 -                       from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus
112 -               except ImportError:
113 -                       pass
114 -               else:
115 -                       iStatus.stopWlanConsole()
116 +               stopWlanConsole()
117  
118         def getInfoCB(self,data,status):
119                 self.LinkState = None
120 @@ -1343,15 +1347,11 @@ class NetworkAdapterTest(Screen):
121  
122         def getLinkState(self,iface):
123                 if iface in iNetwork.wlan_interfaces:
124 -                       try:
125 -                               from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus
126 -                       except:
127 -                                       self["Network"].setForegroundColorNum(1)
128 -                                       self["Network"].setText(_("disconnected"))
129 -                                       self["NetworkInfo_Check"].setPixmapNum(1)
130 -                                       self["NetworkInfo_Check"].show()
131 -                       else:
132 -                               iStatus.getDataForInterface(self.iface,self.getInfoCB)
133 +                       if not getDataForWlanIface(self.iface, self.getInfoCB):
134 +                               self["Network"].setForegroundColorNum(1)
135 +                               self["Network"].setText(_("disconnected"))
136 +                               self["NetworkInfo_Check"].setPixmapNum(1)
137 +                               self["NetworkInfo_Check"].show()
138                 else:
139                         iNetwork.getLinkState(iface,self.LinkStatedataAvail)
140  
141 @@ -1425,10 +1425,5 @@ class NetworkAdapterTest(Screen):
142         def cleanup(self):
143                 iNetwork.stopLinkStateConsole()
144                 iNetwork.stopDNSConsole()
145 -               try:
146 -                       from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus
147 -               except ImportError:
148 -                       pass
149 -               else:
150 -                       iStatus.stopWlanConsole()
151 +               stopWlanConsole()
152