Ejemplo n.º 1
0
    def populate_wired_panel(self):
        if os.path.isfile(self.reboot_required_file):
            # 'NFS Network Settings'
            # 'The displayed network configuration may be out dated - A reboot is recommended before proceeding'
            DIALOG.ok(lang(32036), lang(32038))
        # Clear wired network Panel
        self.hide_controls(ALL_WIRED_CONTROLS)
        if osmc_network.is_ethernet_enabled():
            self.current_network_config = self.get_wired_config()
            if self.current_network_config:
                interface = self.current_network_config['Interface']
                if osmc_network.has_internet_connection():
                    # 'Status'                               'Connected'
                    status = lang(32044) + ': ' + interface + ' (' + lang(
                        32046) + ')'
                else:
                    # 'Status'                               'No internet'
                    status = lang(32044) + ': ' + interface + ' (' + lang(
                        32047) + ')'
                self.wired_status_label.setLabel(status)
                self.toggle_controls(True, ALL_WIRED_CONTROLS)
                self.update_manual_DHCP_button(WIRED_DHCP_MANUAL_BUTTON,
                                               WIRED_IP_VALUES,
                                               WIRED_IP_LABELS)
                self.populate_ip_controls(self.current_network_config,
                                          WIRED_IP_VALUES)

                # enable reset and apply button
                self.update_apply_reset_button('WIRED')

            else:  # no wired connection
                self.hide_controls(WIRED_IP_VALUES + WIRELESS_IP_VALUES)
                # 'Status'     'no wired connection'
                status = lang(32044) + ': ' + lang(32049)
                self.wired_status_label.setLabel(status)
                self.clear_ip_controls(WIRED_IP_VALUES)
        else:  # Disabled
            self.clear_ip_controls(WIRED_IP_VALUES)
            self.hide_controls(ALL_WIRED_CONTROLS)
            # 'Status'     'disabled'
            status = lang(32044) + ': ' + lang(32048)
            self.wired_status_label.setLabel(status)
            self.update_apply_reset_button('WIRED')

        adapterRadioButton = self.getControl(WIRED_ADAPTER_TOGGLE)
        adapterRadioButton.setSelected(osmc_network.is_ethernet_enabled())
        adapterRadioButton.setEnabled(True)

        waitForNetworkRadioButton = self.getControl(WIRED_WAIT_FOR_NETWORK)
        waitForNetworkRadioButton.setSelected(
            osmc_network.is_connman_wait_for_network_enabled())
        waitForNetworkRadioButton.setEnabled(True)
Ejemplo n.º 2
0
 def toggle_ethernet(self):
     self.hide_controls(ALL_WIRED_CONTROLS)
     #                          'Status'              'Configuring...'
     self.wired_status_label.setLabel(lang(32044) + ' : ' + lang(32016))
     osmc_network.toggle_ethernet_state(not osmc_network.is_ethernet_enabled())
     # 5 second wait to allow connman to make the changes before refreshing
     time.sleep(2)
Ejemplo n.º 3
0
    def populate_wired_panel(self):
        if os.path.isfile(self.reboot_required_file):
            # 'NFS Network Settings'
            # 'The displayed network configuration may be out dated - A reboot is recommended before proceeding'
            DIALOG.ok(lang(32036), lang(32038))
        # Clear wired network Panel
        #                           'Status'             'Checking...'
        self.status_label.setLabel(lang(32044) + ': ' + lang(32045))
        if osmc_network.is_ethernet_enabled():
            self.current_network_config = self.get_wired_config()
            log(self.current_network_config)
            if self.current_network_config:
                self.toggle_controls(True, ALL_WIRED_CONTROLS)

                interface = self.current_network_config['Interface']

                if self.current_network_config['State'] in ('online'):
                    #         'Status'                               'Connected'
                    status = lang(32044) + ': ' + interface + ' (' + lang(
                        32046) + ')'
                elif self.current_network_config['State'] in ('ready'):
                    #         'Status'                               'No internet'
                    status = lang(32044) + ': ' + interface + ' (' + lang(
                        32047) + ')'
                else:
                    #                 'Status'
                    status = status = lang(32044) + ' ' + interface
                self.status_label.setLabel(status)
                self.update_manual_DHCP_button(WIRED_DHCP_MANUAL_BUTTON,
                                               WIRED_IP_VALUES,
                                               WIRED_IP_LABELS)

                self.populate_ip_controls(self.current_network_config,
                                          WIRED_IP_VALUES)

                # enable reset and apply button
                self.toggle_controls(False,
                                     [WIRED_RESET_BUTTON, WIRED_APPLY_BUTTON])

            else:  # no wired connection
                self.toggle_controls(False, ALL_WIRED_CONTROLS)
                status = lang(32044) + ': ' + lang(32048)
                self.status_label.setLabel(status)

        adapterRadioButton = self.getControl(WIRED_ADAPTER_TOGGLE)
        adapterRadioButton.setSelected(osmc_network.is_ethernet_enabled())
        adapterRadioButton.setEnabled(True)
Ejemplo n.º 4
0
    def populate_wired_panel(self):
        if os.path.isfile(self.reboot_required_file):
            # 'NFS Network Settings'
            # 'The displayed network configuration may be out dated - A reboot is recommended before proceeding'
            DIALOG.ok(lang(32036), lang(32038))
        # Clear wired network Panel
        self.hide_controls(ALL_WIRED_CONTROLS)
        if osmc_network.is_ethernet_enabled():
            self.current_network_config = self.get_wired_config()
            if self.current_network_config:
                interface = self.current_network_config['Interface']
                if osmc_network.has_internet_connection():
                    # 'Status'                               'Connected'
                    status = lang(32044) + ': ' + interface + ' (' + lang(32046) + ')'
                else:
                    # 'Status'                               'No internet'
                    status = lang(32044) + ': ' + interface + ' (' + lang(32047) + ')'
                self.wired_status_label.setLabel(status)
                self.toggle_controls(True, ALL_WIRED_CONTROLS)
                self.update_manual_DHCP_button(WIRED_DHCP_MANUAL_BUTTON, WIRED_IP_VALUES, WIRED_IP_LABELS)
                self.populate_ip_controls(self.current_network_config, WIRED_IP_VALUES)

                # enable reset and apply button
                self.update_apply_reset_button('WIRED')

            else:  # no wired connection
                self.hide_controls(WIRED_IP_VALUES + WIRELESS_IP_VALUES)
                # 'Status'     'no wired connection'
                status = lang(32044) + ': ' + lang(32049)
                self.wired_status_label.setLabel(status)
                self.clear_ip_controls(WIRED_IP_VALUES)
        else:  # Disabled
            self.clear_ip_controls(WIRED_IP_VALUES)
            self.hide_controls(ALL_WIRED_CONTROLS)
            # 'Status'     'disabled'
            status = lang(32044) + ': ' + lang(32048)
            self.wired_status_label.setLabel(status)
            self.update_apply_reset_button('WIRED')

        adapterRadioButton = self.getControl(WIRED_ADAPTER_TOGGLE)
        adapterRadioButton.setSelected(osmc_network.is_ethernet_enabled())
        adapterRadioButton.setEnabled(True)

        waitForNetworkRadioButton = self.getControl(WIRED_WAIT_FOR_NETWORK)
        waitForNetworkRadioButton.setSelected(osmc_network.is_connman_wait_for_network_enabled())
        waitForNetworkRadioButton.setEnabled(True)
Ejemplo n.º 5
0
 def toggle_ethernet(self):
     self.show_busy_dialogue()
     self.hide_controls(ALL_WIRED_CONTROLS)
     # 'Status'              'Configuring...'
     self.wired_status_label.setLabel(lang(32044) + ' : ' + lang(32016))
     osmc_network.toggle_ethernet_state(
         not osmc_network.is_ethernet_enabled())
     # 5 second wait to allow connman to make the changes before refreshing
     time.sleep(2)
     self.clear_busy_dialogue()
Ejemplo n.º 6
0
 def toggle_ethernet(self):
     #                           'Status'             'Checking...'
     self.status_label.setLabel(lang(32044) + ': ' + lang(32045))
     self.toggle_controls(False, ALL_WIRED_CONTROLS)
     #                          'Status'              'Configuring...'
     self.status_label.setLabel(lang(32044) + ' : ' + lang(32016))
     osmc_network.toggle_ethernet_state(
         not osmc_network.is_ethernet_enabled())
     # 5 second wait to allow connman to make the changes before refreshing
     time.sleep(5)
Ejemplo n.º 7
0
    def setup_networking_from_preseed(self):
        wired = False
        connected = False

        if self.preseed_data['Interface'].startswith(
                'wlan') and osmc_network.is_wifi_available():
            if not osmc_network.is_wifi_enabled():
                self.toggle_wifi()
            ssid = self.preseed_data['SSID']
            encrypted = False
            preseed_password = None
            if 'Password' in self.preseed_data:
                encrypted = True
                preseed_password = self.preseed_data['Password']

            connected = self.connect_to_wifi(ssid, encrypted, preseed_password,
                                             True)

        if self.preseed_data is None or self.preseed_data[
                'Interface'].startswith('eth') or not connected:
            wired = True
            if not osmc_network.is_ethernet_enabled():
                self.toggle_ethernet()
            self.current_network_config = self.get_wired_config()
            connected = True

        if connected:
            if self.preseed_data is None or 'dhcp' in self.preseed_data[
                    'Method']:
                self.current_network_config['Method'] = 'dhcp'
            else:
                self.current_network_config['Method'] = 'manual'
                self.current_network_config['Address'] = self.preseed_data[
                    'Address']
                self.current_network_config['Netmask'] = self.preseed_data[
                    'Netmask']
                if 'Gateway' in self.preseed_data:
                    self.current_network_config['Gateway'] = self.preseed_data[
                        'Gateway']
                if 'DNS_1' in self.preseed_data:
                    self.current_network_config['DNS_1'] = self.preseed_data[
                        'DNS_1']
                if 'DNS_2' in self.preseed_data:
                    self.current_network_config['DNS_2'] = self.preseed_data[
                        'DNS_2']

            osmc_network.apply_network_changes(self.current_network_config)

        if wired:
            self.populate_wired_panel()
        else:
            self.populate_wifi_panel(False)
Ejemplo n.º 8
0
    def setup_networking_from_preseed(self):
        wired = False
        connected = False

        if self.preseed_data['Interface'].startswith('wlan') and osmc_network.is_wifi_available():
            if not osmc_network.is_wifi_enabled():
                self.toggle_wifi()
            ssid = self.preseed_data['SSID']
            encrypted = False
            preseed_password = None
            if 'Password' in self.preseed_data:
                encrypted = True
                preseed_password = self.preseed_data['Password']

            connected = self.connect_to_wifi(ssid, encrypted, preseed_password, True)

        if self.preseed_data is None or self.preseed_data['Interface'].startswith('eth') or not connected:
            wired = True
            if not osmc_network.is_ethernet_enabled():
                self.toggle_ethernet()
            self.current_network_config = self.get_wired_config()
            connected = True

        if connected:
            if self.preseed_data is None or 'dhcp' in self.preseed_data['Method']:
                self.current_network_config['Method'] = 'dhcp'
            else:
                self.current_network_config['Method'] = 'manual'
                self.current_network_config['Address'] = self.preseed_data['Address']
                self.current_network_config['Netmask'] = self.preseed_data['Netmask']
                if 'Gateway' in self.preseed_data:
                    self.current_network_config['Gateway'] = self.preseed_data['Gateway']
                if 'DNS_1' in self.preseed_data:
                    self.current_network_config['DNS_1'] = self.preseed_data['DNS_1']
                if 'DNS_2' in self.preseed_data:
                    self.current_network_config['DNS_2'] = self.preseed_data['DNS_2']

            osmc_network.apply_network_changes(self.current_network_config)


        if wired:
            self.populate_wired_panel()
        else:
            self.populate_wifi_panel(False)