示例#1
0
    def __init_o2uk_limit_combobox (self):
        self.alert_limit_list = self.__conf.get_alerts(is_roaming = False)

        model = gtk.ListStore (gobject.TYPE_INT, gobject.TYPE_STRING)
        base_id = 0
        for limit in self.alert_limit_list:
            if limit == -1:
                model.append ([-1, _("Custom")])
                self.alert_limit_index[-1] = base_id
            else:
                limit_str = format_to_maximun_unit_with_integers(int(limit) ,"GB","MB")
                model.append ([base_id, limit_str])
                self.alert_limit_index[base_id] = base_id
            base_id = base_id + 1

        self.o2uk_limit_combobox.set_model (model)
        cell = gtk.CellRendererText()
        self.o2uk_limit_combobox.pack_start(cell, True)
        self.o2uk_limit_combobox.add_attribute(cell, 'text', 1)

        if self.alert_limit_index.keys() == [-1] :
            self.o2uk_limit_combobox.set_active(0)

        self.o2uk_limit_combobox.connect('changed', self.__on_o2uk_limit_combobox_changed)

        self.o2uk_limit_other_spinbutton.set_value( \
                self.__conf.get_imsi_based_other_monthly_limit(self.__imsi, is_roaming = False))
        self.o2uk_limit_other_spinbutton.connect('value-changed', self.__on_o2uk_limit_other_spinbutton_changed)
示例#2
0
    def __init_dialog(self):
        # Prepay/postpay user radiobutton
        is_default_prepaid = self.__conf.is_default_prepaid()
        self.common_prepaid_radiobutton.set_active(is_default_prepaid)
        self.common_postpaid_radiobutton.set_active(not is_default_prepaid)

        # Monthly limits combobox
        self._monthly_limits = self.__conf.get_monthly_limits(is_roaming=False)

        model = gtk.ListStore(gobject.TYPE_INT, gobject.TYPE_STRING)
        for limit in self._monthly_limits:
            if limit == -1:
                model.append([-1, _('Other')])
            else:
                limit_str = format_to_maximun_unit_with_integers(
                    limit, 'GB', 'MB')
                model.append([limit, limit_str])

        if self.is_monthly_limit_enabled:
            self.common_data_allowance_combobox.set_model(model)
            cell = gtk.CellRendererText()
            self.common_data_allowance_combobox.pack_start(cell, True)
            self.common_data_allowance_combobox.add_attribute(cell, 'text', 1)

            default_limit = self.__conf.get_default_selected_monthly_limit(
                False)
            index = self._monthly_limits.index(default_limit)
            self.common_data_allowance_combobox.set_active(index)

            if default_limit == -1:
                self.common_limit_other_hbox.show_all()
            else:
                self.common_limit_other_hbox.hide()
        else:
            self.common_data_allowance_combobox.set_visible(False)
            self.common_data_allowance_label.set_visible(False)
            self.common_limit_other_hbox.hide()

        # Billing period combobox
        self._days = range(1, 32)
        if tgcm.country_support == 'es':
            self._days = (1, 10, 18, 24)

        model = gtk.ListStore(gobject.TYPE_INT, gobject.TYPE_STRING)
        for i in self._days:
            model.append([i, get_month_day(i)])
        self.common_billing_period_combobox.set_model(model)

        cell = gtk.CellRendererText()
        self.common_billing_period_combobox.pack_start(cell, True)
        self.common_billing_period_combobox.add_attribute(cell, 'text', 1)

        default_day = self.__conf.get_default_billing_day()
        index = self._days.index(default_day)
        self.common_billing_period_combobox.set_active(index)

        is_fixed = self.__conf.is_default_fixed_billing_day()
        self.__enable_billing_day(not is_fixed)
示例#3
0
    def __init_dialog(self):
        # Prepay/postpay user radiobutton
        is_default_prepaid = self.__conf.is_default_prepaid()
        self.common_prepaid_radiobutton.set_active(is_default_prepaid)
        self.common_postpaid_radiobutton.set_active(not is_default_prepaid)

        # Monthly limits combobox
        self._monthly_limits = self.__conf.get_monthly_limits(is_roaming = False)

        model = gtk.ListStore(gobject.TYPE_INT, gobject.TYPE_STRING)
        for limit in self._monthly_limits:
            if limit == -1:
                model.append([-1, _('Other')])
            else:
                limit_str = format_to_maximun_unit_with_integers(limit, 'GB', 'MB')
                model.append([limit, limit_str])

        if self.is_monthly_limit_enabled:
            self.common_data_allowance_combobox.set_model(model)
            cell = gtk.CellRendererText()
            self.common_data_allowance_combobox.pack_start(cell, True)
            self.common_data_allowance_combobox.add_attribute(cell, 'text', 1)

            default_limit = self.__conf.get_default_selected_monthly_limit(False)
            index = self._monthly_limits.index(default_limit)
            self.common_data_allowance_combobox.set_active(index)

            if default_limit == -1:
                self.common_limit_other_hbox.show_all()
            else:
                self.common_limit_other_hbox.hide()
        else:
            self.common_data_allowance_combobox.set_visible(False)
            self.common_data_allowance_label.set_visible(False)
            self.common_limit_other_hbox.hide()

        # Billing period combobox
        self._days = range(1, 32)
        if tgcm.country_support == 'es':
            self._days = (1, 10, 18, 24)

        model = gtk.ListStore(gobject.TYPE_INT, gobject.TYPE_STRING)
        for i in self._days:
            model.append([i, get_month_day(i)])
        self.common_billing_period_combobox.set_model(model)

        cell = gtk.CellRendererText()
        self.common_billing_period_combobox.pack_start(cell, True)
        self.common_billing_period_combobox.add_attribute(cell, 'text', 1)

        default_day = self.__conf.get_default_billing_day()
        index = self._days.index(default_day)
        self.common_billing_period_combobox.set_active(index)

        is_fixed = self.__conf.is_default_fixed_billing_day()
        self.__enable_billing_day(not is_fixed)