Ejemplo n.º 1
0
    def _save_system_time(self):
        """
        Returning False from this method removes the timer that would
        otherwise call it again and again.

        """

        self._start_updating_timer = None

        if not conf.system.can_set_system_clock:
            return False

        month = self._get_combo_selection(self._monthCombo)[0]
        if not month:
            return False

        year = self._get_combo_selection(self._yearCombo)[0]
        if not year:
            return False

        hours = int(self._hoursLabel.get_text())
        if not self._radioButton24h.get_active():
            hours = self._to_24h(hours, self._amPmLabel.get_text())

        minutes = int(self._minutesLabel.get_text())

        day = self._get_combo_selection(self._dayCombo)[0]
        #day may be None if there is no such in the selected year and month
        if day:
            isys.set_system_date_time(year,
                                      month,
                                      day,
                                      hours,
                                      minutes,
                                      tz=self._tz)

        #start the timer only when the spoke is shown
        if self._shown and not self._update_datetime_timer:
            self._update_datetime_timer = Timer()
            self._update_datetime_timer.timeout_sec(1, self._update_datetime)

        #run only once (after first 2 seconds of inactivity)
        return False
Ejemplo n.º 2
0
    def on_start_clicked(self, *args):
        """ Go through the process of validating entry contents and then
            attempt to add the device.
        """
        # First update widgets
        self._startButton.hide()
        self._okButton.set_sensitive(False)
        self._cancelButton.set_sensitive(False)
        self._deviceEntry.set_sensitive(False)
        self._conditionNotebook.set_current_page(1)

        # Initialize.
        config_error = None
        device = None
        device_name = self._deviceEntry.get_text().strip()

        # Check the format of the given device name.
        if not DASD_DEVICE_NUMBER.match(device_name):
            config_error = "Incorrect format of the given device number."
        else:
            try:
                # Get full device name.
                device = blockdev.s390.sanitize_dev_input(device_name)
            except (blockdev.S390Error, ValueError) as e:
                config_error = str(e)

        # Process the configuration error.
        if config_error:
            self._errorLabel.set_text(config_error)
            self._deviceEntry.set_sensitive(True)
            self._cancelButton.set_sensitive(True)
            self._conditionNotebook.set_current_page(2)
        # Run the discovery.
        else:
            # Discover.
            self._spinner.start()
            threadMgr.add(AnacondaThread(name=constants.THREAD_DASD_DISCOVER,
                                         target=self._discover,
                                         args=(device,)))

            # Periodically call the check till it is done.
            Timer().timeout_msec(250, self._check_discover)
Ejemplo n.º 3
0
 def stop(self):
     """Stop the module's loop."""
     DBus.disconnect()
     Timer().timeout_sec(1, self.loop.quit)
Ejemplo n.º 4
0
 def _add_modify_watcher(self, widget):
     # If the payload fetching thread is still running, the user can't go to
     # modify the software selection screen.  Thus, we have to set the button
     # insensitive and wait until software selection is ready to go.
     if not self._software_is_ready():
         Timer().timeout_sec(1, self._check_for_storage_thread, widget)
Ejemplo n.º 5
0
 def stop(self):
     self.unpublish()
     Timer().timeout_sec(1, self.loop.quit)