def __init__(self, ctrl): height = 450 # define the max height of the main window GLADE_FILE = os.path.join(GLADE_DIR, "main.glade") super(MainView, self).__init__(ctrl, GLADE_FILE, 'main_window', register=False, domain=APP_SLUG_NAME) # Usage statistics self.usage_user_limit = int(config.get('preferences', 'traffic_threshold', CFG_PREFS_DEFAULT_USAGE_USER_LIMIT)) self.usage_max_value = int(config.get('preferences', 'max_traffic', CFG_PREFS_DEFAULT_USAGE_MAX_VALUE)) self.usage_units = UNIT_KB self.usage_bars = {} self.bearer = 'gprs' # 'gprs' or 'umts' self.signal = 0 # -1, 0, 25, 50, 75, 100 self.setup_view(height) ctrl.register_view(self) self.throbber = None ctrl.update_usage_view() self.setup_treeview(ctrl)
def update_bars_user_limit(self): self.usage_user_limit = int(config.get('preferences', 'traffic_threshold', CFG_PREFS_DEFAULT_USAGE_USER_LIMIT)) self.usage_max_value = int(config.get('preferences', 'max_traffic', CFG_PREFS_DEFAULT_USAGE_MAX_VALUE)) for bar in self.usage_bars.values(): bar.set_user_limit(units_to_bytes(self.usage_user_limit, UNIT_MB)) bar.set_max_value(units_to_bytes(self.usage_max_value, UNIT_MB))
def load(self): self.warn_limit = self.conf.get('preferences', 'warn_limit', True) self.transfer_limit = self.conf.get('preferences', 'transfer_limit', 50.0) # ok lets load the SMS preferences from the configuration file. # but take care! If the config file is absent set to default values. self.use_alternate_smsc = self.conf.get('preferences', 'use_alternate_smsc', False) self.smsc_profile = self.conf.get('preferences', 'smsc_profile', 'Vodafone UK United Kingdon') self.smsc_number = self.conf.get('preferences', 'smsc_number', '') self.sms_validity = self.conf.get('preferences', 'sms_validity', CFG_PREFS_DEFAULT_SMS_VALIDITY) self.sms_confirmation = self.conf.get('preferences', 'sms_confirmation', CFG_PREFS_DEFAULT_SMS_CONFIRMATION) # load the user preferences self.exit_without_confirmation = config.get('preferences', 'exit_without_confirmation', CFG_PREFS_DEFAULT_EXIT_WITHOUT_CONFIRMATION) self.show_icon = config.get('preferences', 'show_icon', CFG_PREFS_DEFAULT_TRAY_ICON) self.close_minimizes = config.get('preferences', 'close_minimizes', CFG_PREFS_DEFAULT_CLOSE_MINIMIZES) self.manage_pin = config.get('preferences', 'manage_pin_by_keyring', False) self.use_global_menu = config.get('preferences', 'use_global_menu', False) # ok lets load the application values from configuration file self.browser = config.get('preferences', 'browser', CFG_PREFS_DEFAULT_BROWSER) self.mail = config.get('preferences', 'mail', CFG_PREFS_DEFAULT_EMAIL) # ok lets load the usage values from configuration file self.max_traffic = config.get('preferences', 'max_traffic', 100) self.traffic_threshold = config.get('preferences', 'traffic_threshold', 10) self.usage_notification = config.get('preferences', 'usage_notification', False)
def load(self): self.warn_limit = self.conf.get('preferences', 'warn_limit', True) self.transfer_limit = self.conf.get('preferences', 'transfer_limit', 50.0) # ok lets load the SMS preferences from the configuration file. # but take care! If the config file is absent set to default values. self.use_alternate_smsc = self.conf.get('preferences', 'use_alternate_smsc', False) self.smsc_profile = self.conf.get('preferences', 'smsc_profile', 'Vodafone UK United Kingdon') self.smsc_number = self.conf.get('preferences', 'smsc_number', '') self.sms_validity = self.conf.get('preferences', 'sms_validity', CFG_PREFS_DEFAULT_SMS_VALIDITY) self.sms_confirmation = self.conf.get( 'preferences', 'sms_confirmation', CFG_PREFS_DEFAULT_SMS_CONFIRMATION) # load the user preferences self.exit_without_confirmation = config.get( 'preferences', 'exit_without_confirmation', CFG_PREFS_DEFAULT_EXIT_WITHOUT_CONFIRMATION) self.show_icon = config.get('preferences', 'show_icon', CFG_PREFS_DEFAULT_TRAY_ICON) self.close_minimizes = config.get('preferences', 'close_minimizes', CFG_PREFS_DEFAULT_CLOSE_MINIMIZES) self.manage_pin = config.get('preferences', 'manage_pin_by_keyring', False) self.use_global_menu = config.get('preferences', 'use_global_menu', False) # ok lets load the application values from configuration file self.browser = config.get('preferences', 'browser', CFG_PREFS_DEFAULT_BROWSER) self.mail = config.get('preferences', 'mail', CFG_PREFS_DEFAULT_EMAIL) # ok lets load the usage values from configuration file self.max_traffic = config.get('preferences', 'max_traffic', 100) self.traffic_threshold = config.get('preferences', 'traffic_threshold', 10) self.usage_notification = config.get('preferences', 'usage_notification', False)