Exemplo n.º 1
0
    def init_enigma2_transponder_data(self, srv):
        """ Transponder data initialisation """
        data = srv.data_id.split(":")
        tr_data = srv.transponder.split(":")
        tr_type = TrType(srv.transponder_type)

        self._namespace_entry.set_text(str(int(data[1], 16)))
        self._transponder_id_entry.set_text(str(int(data[2], 16)))
        self._network_id_entry.set_text(str(int(data[3], 16)))

        if tr_type is TrType.Satellite:
            self.select_active_text(self._invertion_combo_box,
                                    Inversion(tr_data[5]).name)
            if srv.system == "DVB-S2":
                self.select_active_text(self._mod_combo_box,
                                        MODULATION.get(tr_data[8]))
                self.select_active_text(self._rolloff_combo_box,
                                        ROLL_OFF.get(tr_data[9]))
                self.select_active_text(self._pilot_combo_box,
                                        Pilot(tr_data[10]).name)
                self._tr_flag_entry.set_text(tr_data[7])
                if len(tr_data) > 12:
                    self._stream_id_entry.set_text(tr_data[11])
                    self._pls_code_entry.set_text(tr_data[12])
                    self.select_active_text(self._pls_mode_combo_box,
                                            PLS_MODE.get(tr_data[13]))
        elif tr_type is TrType.Cable:
            self.select_active_text(self._invertion_combo_box,
                                    Inversion(tr_data[2]).name)
            self.select_active_text(self._mod_combo_box,
                                    C_MODULATION.get(tr_data[3]))
            self.select_active_text(self._fec_combo_box,
                                    FEC_DEFAULT.get(tr_data[4]))
            self.select_active_text(self._sys_combo_box,
                                    SystemCable(tr_data[5]).name)
        elif tr_type is TrType.Terrestrial:
            self.select_active_text(self._fec_combo_box, T_FEC.get(tr_data[2]))
            self.select_active_text(self._rate_lp_combo_box,
                                    T_FEC.get(tr_data[3]))
            # Pol -> Bandwidth
            self.select_active_text(self._pol_combo_box,
                                    BANDWIDTH.get(tr_data[1]))
            self.select_active_text(self._mod_combo_box,
                                    T_MODULATION.get(tr_data[4]))
            # Transmission Mode -> Roll off
            self.select_active_text(self._rolloff_combo_box,
                                    TRANSMISSION_MODE.get(tr_data[5]))
            # GuardInterval -> Pilot
            self.select_active_text(self._pilot_combo_box,
                                    GUARD_INTERVAL.get(tr_data[6]))
            # Hierarchy -> Pls Mode
            self.select_active_text(self._pls_mode_combo_box,
                                    HIERARCHY.get(tr_data[7]))
            self.select_active_text(self._invertion_combo_box,
                                    Inversion(tr_data[8]).name)
            self.select_active_text(self._sys_combo_box,
                                    T_SYSTEM.get(tr_data[9]))
        # Should be called last to properly initialize the reference
        self._srv_type_entry.set_text(data[4])
Exemplo n.º 2
0
    def update_data_elements(self):
        model, paths = self._services_view.get_selection().get_selected_rows()
        # Unpacking to search for an iterator for the base model
        filter_model = model.get_model()
        self._current_model = get_base_model(model)
        itr = None
        if not paths:
            # If editing from bouquet list and services list in the filter mode
            fav_model, paths = self._fav_view.get_selection(
            ).get_selected_rows()
            fav_id = fav_model[paths][7]
            for row in self._current_model:
                if row[-2] == fav_id:
                    itr = row.iter
                    break
        else:
            itr = model.get_iter(paths)
            itr = filter_model.convert_iter_to_child_iter(
                model.convert_iter_to_child_iter(itr))

        if not itr:
            return

        srv = Service(*self._current_model[itr][:Column.SRV_TOOLTIP])
        self._old_service = srv
        self._current_itr = itr
        # Service
        self._name_entry.set_text(srv.service)
        self._package_entry.set_text(srv.package)
        self._sid_entry.set_text(str(int(srv.ssid, 16)))
        # Transponder
        if self._s_type is SettingsType.ENIGMA_2:
            self._tr_type = TrType(srv.transponder_type)
        self._freq_entry.set_text(srv.freq)
        self._rate_entry.set_text(srv.rate)
        self.select_active_text(self._pol_combo_box, srv.pol)
        self.select_active_text(self._fec_combo_box, srv.fec)
        self.select_active_text(self._sys_combo_box, srv.system)
        if self._tr_type is TrType.Terrestrial:
            self.update_ui_for_terrestrial()
        elif self._tr_type is TrType.Cable:
            self.update_ui_for_cable()
        elif self._tr_type is TrType.ATSC:
            self.update_ui_for_atsc()
        else:
            self.set_sat_positions(srv.pos)

        if self._s_type is SettingsType.ENIGMA_2:
            self.init_enigma2_service_data(srv)
            self.init_enigma2_transponder_data(srv)
        elif self._s_type is SettingsType.NEUTRINO_MP:
            self.init_neutrino_data(srv)
            self.init_neutrino_ui_elements()