def __init__(self, title=None, parent=None, flags=0, buttons=None, show_preferences_button=True, show_help_button=True): gtk.Dialog.__init__(self, title, parent, flags, buttons) self.set_has_separator(False) self.windows_dir = os.path.join(tgcm.windows_dir, "Traffic") gtk_builder_magic(self, \ filename=os.path.join(self.windows_dir, 'BillingDayChangeDialog.ui'), \ prefix='bd') self.get_children()[0].add(self.main_widget) 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.billing_day_combobox.set_model(model)
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)
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)
def __init_o2uk_bill_date_combobox (self): model = gtk.ListStore (gobject.TYPE_INT, gobject.TYPE_STRING) for i in range(1, 32): model.append ([i, get_month_day(i)]) self.o2uk_bill_date_combobox.set_model (model) cell = gtk.CellRendererText() self.o2uk_bill_date_combobox.pack_start(cell, True) self.o2uk_bill_date_combobox.add_attribute(cell, 'text', 1) self.o2uk_bill_date_combobox.connect('changed', self.__on_o2uk_bill_date_combobox_changed)
def __update_billing_period_info_label(self): if tgcm.country_support != "uk": if not self.conf.is_last_imsi_seen_valid(): billing_day = self.conf.get_default_billing_day() is_fixed = self.conf.is_default_fixed_billing_day() is_imsi_valid = False else: imsi = self.conf.get_last_imsi_seen() billing_day = self.conf.get_imsi_based_billing_day(imsi) is_fixed = self.conf.is_imsi_based_fixed_billing_day(imsi) is_imsi_valid = True billing_day_start = get_month_day(billing_day) if billing_day <= 1: billing_day_end = get_month_day(31) else: billing_day_end = get_month_day(billing_day - 1) self.message_label.set_markup("<small>%s</small>" % \ _("The billing period begins on the %s and ends on the %s of each month.") % \ (billing_day_start, billing_day_end)) self.notebook_tab_label1.set_text(_("Current period")) self.warn_uk_label.hide_all() self.warn_uk_label.set_no_show_all(True) if is_imsi_valid and not is_fixed: self.change_billing_day_linkbutton.show() else: self.change_billing_day_linkbutton.hide() else: self.message_label.hide() self.message_label.set_no_show_all(True) self.notebook_tab_label1.set_text(_("This month")) self.session_label.set_tooltip_text( _("This screen gives you information about your mobile broadband usage. 'This session' tells you about your current O2 data network or Wi-Fi connection. 'This month' shows your usage on the O2 data network only. For more information see the Help guide." )) self.change_billing_day_button.hide_all() self.change_billing_day_button.set_no_show_all(True)
def __update_billing_period_info_label (self): if tgcm.country_support != "uk" : if not self.conf.is_last_imsi_seen_valid(): billing_day = self.conf.get_default_billing_day() is_fixed = self.conf.is_default_fixed_billing_day() is_imsi_valid = False else: imsi = self.conf.get_last_imsi_seen() billing_day = self.conf.get_imsi_based_billing_day(imsi) is_fixed = self.conf.is_imsi_based_fixed_billing_day(imsi) is_imsi_valid = True billing_day_start = get_month_day(billing_day) if billing_day <= 1: billing_day_end = get_month_day(31) else: billing_day_end = get_month_day(billing_day - 1) self.message_label.set_markup("<small>%s</small>" % \ _("The billing period begins on the %s and ends on the %s of each month.") % \ (billing_day_start, billing_day_end)) self.notebook_tab_label1.set_text(_("Current period")) self.warn_uk_label.hide_all() self.warn_uk_label.set_no_show_all(True) if is_imsi_valid and not is_fixed: self.change_billing_day_linkbutton.show() else: self.change_billing_day_linkbutton.hide() else: self.message_label.hide() self.message_label.set_no_show_all(True) self.notebook_tab_label1.set_text(_("This month")) self.session_label.set_tooltip_text(_("This screen gives you information about your mobile broadband usage. 'This session' tells you about your current O2 data network or Wi-Fi connection. 'This month' shows your usage on the O2 data network only. For more information see the Help guide.")) self.change_billing_day_button.hide_all() self.change_billing_day_button.set_no_show_all(True)
def __init__(self, title=None, parent=None, flags=0, buttons=None, show_preferences_button=True, show_help_button=True): gtk.Dialog.__init__(self, title, parent, flags, buttons) self.set_has_separator(False) self.windows_dir = os.path.join(tgcm.windows_dir , "Traffic") gtk_builder_magic(self, \ filename=os.path.join(self.windows_dir, 'BillingDayChangeDialog.ui'), \ prefix='bd') self.get_children()[0].add(self.main_widget) 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.billing_day_combobox.set_model(model)