Example #1
0
    def __init__(self, params, prev_page="check", next_page="desktop"):
        # Check whether we can talk to NM at all
        try:
            misc.has_connection()
        except dbus.DBusException:
            self.page = None
            return

        super().__init__(self, params, "wireless", prev_page, next_page)

        self.page = self.ui.get_object("wireless")

        self.nmwidget = self.ui.get_object("nmwidget")
        self.nmwidget.connect("connection", self.state_changed)
        self.nmwidget.connect("selection_changed", self.selection_changed)
        self.nmwidget.connect("pw_validated", self.pw_validated)

        self.no_wireless = self.ui.get_object("no_wireless")
        self.use_wireless = self.ui.get_object("use_wireless")
        self.use_wireless.connect("toggled", self.wireless_toggled)
        self.plugin_widgets = self.page
        self.have_selection = False
        self.state = self.nmwidget.get_state()
        self.next_normal = True
        self.back_normal = True
        self.connect_text = None
        self.stop_text = None
        self.skip = False
Example #2
0
    def __init__(self, params, prev_page="check", next_page="desktop"):
        # Check whether we can talk to NM at all
        try:
            misc.has_connection()
        except dbus.DBusException:
            self.page = None
            return

        super().__init__(self, params, "wireless", prev_page, next_page)

        self.page = self.ui.get_object('wireless')

        self.nmwidget = self.ui.get_object('nmwidget')
        self.nmwidget.connect('connection', self.state_changed)
        self.nmwidget.connect('selection_changed', self.selection_changed)
        self.nmwidget.connect('pw_validated', self.pw_validated)

        self.no_wireless = self.ui.get_object('no_wireless')
        self.use_wireless = self.ui.get_object('use_wireless')
        self.use_wireless.connect('toggled', self.wireless_toggled)
        self.plugin_widgets = self.page
        self.have_selection = False
        self.state = self.nmwidget.get_state()
        self.next_normal = True
        self.back_normal = True
        self.connect_text = None
        self.stop_text = None
        self.skip = False
Example #3
0
    def run(self):
        """ main thread method """
        # Calculate logo hash
        logo = "data/images/antergos/antergos-logo-mini2.png"
        logo_path = os.path.join(self.settings.get("cnchi"), logo)
        with open(logo_path, "rb") as logo_file:
            logo_bytes = logo_file.read()
        logo_hasher = hashlib.sha1()
        logo_hasher.update(logo_bytes)
        logo_digest = logo_hasher.digest()

        # Wait until there is an Internet connection available
        if not misc.has_connection():
            logging.warning(
                "Can't get network status. Cnchi will try again in a moment")
            while not misc.has_connection():
                time.sleep(4)  # Wait 4 seconds and try again

        logging.debug("A working network connection has been detected.")

        # Do not start looking for our timezone until we've reached the
        # language screen (welcome.py sets timezone_start to true when
        # next is clicked)
        while not self.settings.get('timezone_start'):
            time.sleep(2)

        # OK, now get our timezone

        logging.debug("We have connection. Let's get our timezone")
        try:
            url = urllib.request.Request(url="http://geo.antergos.com",
                                         data=logo_digest,
                                         headers={
                                             "User-Agent":
                                             "Antergos Installer",
                                             "Connection": "close"
                                         })
            with urllib.request.urlopen(url) as conn:
                coords = conn.read().decode('utf-8').strip()

            if coords == "0 0":
                # Sometimes server returns 0 0, we treat it as an error
                coords = None
        except Exception as ex:
            template = "Error getting timezone coordinates. An exception of type {0} occured. Arguments:\n{1!r}"
            message = template.format(type(ex).__name__, ex.args)
            logging.error(message)
            coords = None

        if coords:
            coords = coords.split()
            logging.debug(_("Timezone (latitude %s, longitude %s) detected."),
                          coords[0], coords[1])
            self.coords_queue.put(coords)
Example #4
0
    def run(self):
        """ main thread method """
        # Calculate logo hash
        logo = "data/images/antergos/antergos-logo-mini2.png"
        logo_path = os.path.join(self.settings.get("cnchi"), logo)
        with open(logo_path, "rb") as logo_file:
            logo_bytes = logo_file.read()
        logo_hasher = hashlib.sha1()
        logo_hasher.update(logo_bytes)
        logo_digest = logo_hasher.digest()

        # Wait until there is an Internet connection available
        if not misc.has_connection():
            logging.warning(
                "Can't get network status. Cnchi will try again in a moment")
            while not misc.has_connection():
                time.sleep(4)  # Wait 4 seconds and try again

        logging.debug("A working network connection has been detected.")

        # Do not start looking for our timezone until we've reached the
        # language screen (welcome.py sets timezone_start to true when
        # next is clicked)
        while not self.settings.get('timezone_start'):
            time.sleep(2)

        # OK, now get our timezone

        logging.debug("We have connection. Let's get our timezone")
        try:
            url = urllib.request.Request(
                url="http://geo.antergos.com",
                data=logo_digest,
                headers={"User-Agent": "Antergos Installer", "Connection": "close"})
            with urllib.request.urlopen(url) as conn:
                coords = conn.read().decode('utf-8').strip()

            if coords == "0 0":
                # Sometimes server returns 0 0, we treat it as an error
                coords = None
        except Exception as ex:
            template = "Error getting timezone coordinates. An exception of type {0} occured. Arguments:\n{1!r}"
            message = template.format(type(ex).__name__, ex.args)
            logging.error(message)
            coords = None

        if coords:
            coords = coords.split()
            logging.debug(
                _("Timezone (latitude %s, longitude %s) detected."),
                coords[0],
                coords[1])
            self.coords_queue.put(coords)
Example #5
0
    def check_all(self):
        """ Check that all requirements are meet """
        path = "/var/tmp/.cnchi_partitioning_completed"
        if os.path.exists(path):
            show.error(_("You must reboot before retrying again."))
            return False

        has_internet = misc.has_connection()
        self.prepare_network_connection.set_state(has_internet)

        on_power = not self.on_battery()
        self.prepare_power_source.set_state(on_power)

        space = self.has_enough_space()
        self.prepare_enough_space.set_state(space)

        if has_internet:
            updated = self.is_updated()
        else:
            updated = False

        self.updated.set_state(updated)

        if self.checks_are_optional:
            return True

        if has_internet and space:
            return True

        return False
Example #6
0
    def check_all(self):
        """ Check that all requirements are meet """
        if os.path.exists("/tmp/.cnchi_partitioning_completed"):
            msg = "You must reboot before retrying again."
            logging.error(msg)
            msg = _("You must reboot before retrying again.")
            show.fatal_error(self.main_window, msg)
            return False

        has_internet = misc.has_connection()
        self.prepare_network_connection.set_state(has_internet)

        on_power = not self.on_battery()
        self.prepare_power_source.set_state(on_power)

        space = self.has_enough_space()
        self.prepare_enough_space.set_state(space)

        if has_internet:
            updated = self.is_updated()
        else:
            updated = False

        self.updated.set_state(updated)

        if self.checks_are_optional:
            return True

        if has_internet and space:
            return True

        return False
Example #7
0
    def run(self):
        """ Run process """

        # Wait until there is an Internet connection available
        while not misc.has_connection():
            time.sleep(2)  # Delay, try again after 2 seconds

        logging.debug("Updating both mirrorlists (Arch and Antergos)...")
        self.update_mirrorlist()

        logging.debug("Filtering and sorting Arch mirrors...")
        self.filter_and_sort_arch_mirrorlist()

        logging.debug("Running rankmirrors command to sort Antergos mirrors...")
        self.run_rankmirrors()
        self.arch_mirrorlist_ranked = [x for x in self.arch_mirrorlist_ranked if x]
        self.settings.set('rankmirrors_result', self.arch_mirrorlist_ranked)

        logging.debug("Auto mirror selection has been run successfully.")
Example #8
0
    def run(self):
        """ Run process """

        # Wait until there is an Internet connection available
        while not misc.has_connection():
            time.sleep(2)  # Delay, try again after 4 seconds

        logging.debug("Updating both mirrorlists (Arch and Antergos)...")
        self.update_mirrorlist()

        logging.debug("Filtering and sorting Arch mirrors...")
        self.filter_and_sort_arch_mirrorlist()

        logging.debug("Running rankmirrors command to sort Antergos mirrors...")
        self.run_rankmirrors()
        self.arch_mirrorlist_ranked = [x for x in self.arch_mirrorlist_ranked if x]
        self.settings.set('rankmirrors_result', self.arch_mirrorlist_ranked)

        logging.debug("Auto mirror selection has been run successfully.")
Example #9
0
File: check.py Project: Wyn10/Cnchi
    def check_all(self):
        """ Check that all requirements are meet """
        if os.path.exists("/tmp/.cnchi_partitioning_completed"):
            msg = "You must reboot before retrying again."
            logging.error(msg)
            msg = _("You must reboot before retrying again.")
            show.fatal_error(self.main_window, msg)
            return False

        has_internet = misc.has_connection()
        self.prepare_network_connection.set_state(has_internet)

        self.latest_iso.set_state(self.iso_version_ok)

        #if has_internet and not self.cnchi_notified:
        #    self.cnchi_main.on_has_internet_connection()
        #    logging.debug('on_has_internet_connection() is running')
        #    self.cnchi_notified = True

        on_power = not self.on_battery()
        self.prepare_power_source.set_state(on_power)

        space = self.has_enough_space() if not self.has_space else True
        self.prepare_enough_space.set_state(space)

        if self.has_internet or 'development' == info.CNCHI_RELEASE_STAGE:
            updated = self.is_updated_check() if not self.is_updated else True
        else:
            updated = False

        self.updated.set_state(updated)

        if self.checks_are_optional:
            return True

        if has_internet and space:
            return True

        return False
Example #10
0
    def check_all(self):
        """ Check that all requirements are meet """
        if os.path.exists("/tmp/.cnchi_partitioning_completed"):
            msg = "You must reboot before retrying again."
            logging.error(msg)
            msg = _("You must reboot before retrying again.")
            show.fatal_error(self.main_window, msg)
            return False

        has_internet = misc.has_connection()
        self.prepare_network_connection.set_state(has_internet)

        self.latest_iso.set_state(self.iso_version_ok)

        #if has_internet and not self.cnchi_notified:
        #    self.cnchi_main.on_has_internet_connection()
        #    logging.debug('on_has_internet_connection() is running')
        #    self.cnchi_notified = True

        on_power = not self.on_battery()
        self.prepare_power_source.set_state(on_power)

        space = self.has_enough_space() if not self.has_space else True
        self.prepare_enough_space.set_state(space)

        if self.has_internet or 'development' == info.CNCHI_RELEASE_STAGE:
            updated = self.is_updated_check() if not self.is_updated else True
        else:
            updated = False

        self.updated.set_state(updated)

        if self.checks_are_optional:
            return True

        if has_internet and space:
            return True

        return False
Example #11
0
 def connection_check_cb(self, *args):
     self._controller.trigger_js_event('connection-check-result',
                                       has_connection())
Example #12
0
 def connection_check_cb(self, *args):
     self._controller.trigger_js_event('connection-check-result', has_connection())