def __load_data(self, data_used, data_used_roaming, data_limit, billing_period): data_used_string = format_to_maximun_unit(data_used, "GB", "MB", "KB", "Bytes") self.data_used_label.set_markup("<b>%s</b>" % data_used_string) data_used_roaming_string = format_to_maximun_unit( data_used_roaming, "GB", "MB", "KB", "Bytes") self.roaming_data_used_label.set_markup("<b>%s</b>" % data_used_roaming_string) if tgcm.country_support != 'es': data_limit_string = format_to_maximun_unit(data_limit, "GB", "MB", "KB", "Bytes") self.transference_limit_label.set_markup("<b>%s</b>" % data_limit_string) data_available = 0 if (data_used > data_limit) else (data_limit - data_used) data_available_string = format_to_maximun_unit( data_available, "GB", "MB", "KB", "Bytes") self.available_data_label.set_markup("<b>%s</b>" % data_available_string) progressbar_fraction = float(data_used) / data_limit if progressbar_fraction > 1: progressbar_fraction = 1.0 progressbar_fraction = round(progressbar_fraction * 100) self.__load_progressbar_image(progressbar_fraction) if tgcm.country_support == "uk": if progressbar_fraction >= 100: self.warning_exceeded_label.show() else: self.warning_exceeded_label.hide()
def __load_data(self, data_used, data_used_roaming, data_limit, billing_period): data_used_string = format_to_maximun_unit(data_used ,"GB","MB","KB","Bytes") self.data_used_label.set_markup("<b>%s</b>" % data_used_string) data_used_roaming_string = format_to_maximun_unit(data_used_roaming, "GB", "MB", "KB", "Bytes") self.roaming_data_used_label.set_markup("<b>%s</b>" % data_used_roaming_string) if tgcm.country_support!='es': data_limit_string = format_to_maximun_unit(data_limit ,"GB","MB","KB","Bytes") self.transference_limit_label.set_markup("<b>%s</b>" % data_limit_string) data_available = 0 if (data_used > data_limit) else (data_limit - data_used) data_available_string = format_to_maximun_unit(data_available, "GB", "MB", "KB", "Bytes") self.available_data_label.set_markup("<b>%s</b>" % data_available_string) progressbar_fraction = float(data_used) / data_limit if progressbar_fraction > 1: progressbar_fraction = 1.0 progressbar_fraction = round(progressbar_fraction * 100) self.__load_progressbar_image(progressbar_fraction) if tgcm.country_support == "uk" : if progressbar_fraction >= 100: self.warning_exceeded_label.show() else: self.warning_exceeded_label.hide()
def on_get_value(self, rowref, column): if column == 0: # Object return rowref elif column == 1: # IsNew pixmap if rowref['unseen']: icon_theme = gtk.icon_theme_get_default() return icon_theme.load_icon('emblem-new', 10, gtk.ICON_LOOKUP_USE_BUILTIN) else: return None elif column == 2: # Title title = rowref['title'] if rowref['unread']: title = '<b>%s</b>' % title return title elif column == 3: # Date return self.date_to_str(rowref['updated_parsed']) elif column == 4: # DateNum entry_id = rowref['id'] if entry_id not in self.data_weights: weight = time.mktime(rowref['updated_parsed']) if rowref['unread']: weight = weight * 100 if rowref['unseen']: weight = weight * 100 self.data_weights[entry_id] = weight return self.data_weights[entry_id] elif column == 5: # Size length = int(rowref['links'][0]['length']) return format_to_maximun_unit(length, "GB", "MB", "KB", "Bytes") return
def __updated_traffic_info_cb(self, widget, in_data, out_data): if tgcm.country_support == "uk": return self.__t_speed = '%s/s' % format_to_maximun_unit( in_data * 8, "GBits", "MBits", "KBits", "Bits") self.emit('connection_speed_changed', self.__t_speed)
def __create_vars (self): self.__wifi_tooltips = [ _('Very low Wi-Fi coverage'), _('Low Wi-Fi coverage'), _('Good Wi-Fi coverage level'), _('Very good Wi-Fi coverage'), _('Excellent Wi-Fi coverage'), ] self.__wwan_tooltips = [ _('Very low coverage level'), _('Low coverage level'), _('Good coverage level'), _('Very good coverage level'), _('Excellent coverage level'), ] self.vars = {} self.dyn_vars = {} self.vars ["wwan.homezone"] = False self.vars ["wwan.roaming"] = False self.vars ["wwan.device.status"] = _("Switched off") self.vars ["wwan.device.in"] = False self.vars ["wwan.device.on"] = False self.vars ["wwan.device.init"] = False self.vars ["wwan.signal"] = 0 self.vars ["wifi.signal"] = 0 self.vars ["lan.signal"] = 0 self.vars ["lan.signal.description"] = _("LAN connectivity") self.vars ["available.signal"] = 0 self.vars ["available.signal.description"] = "" self.vars ["available.signal.wwan"] = False self.vars ["available.signal.wifi"] = False self.vars ["available.signal.lan"] = False self.vars ["available.connection"] = "" self.vars ["available.connection.description"] = "" self.vars ["app.connected"] = False self.vars ["app.connecting"] = False self.vars ["app.connection.wwan"] = True self.vars ["app.connection.wifi"] = False self.vars ["app.connection.lan"] = False self.vars ["app.connection.seconds"] = "" self.vars ["app.connection.bytes"] = "" self.vars ["app.connection.speed"] = format_to_maximun_unit(0, "GBits","MBits","KBits","Bits") + "/s" self.vars ["app.connection.signal"] = 0 self.vars ["app.connection.signal.description"] = "" self.vars ["app.connection.tech.description"] = "" self.vars ["str.connection"] = "" self.vars ["app.connection.progress"] = 0 self.vars ["wwan.device"] = _("No device") self.vars ["wwan.device.description"] = _("Device: No device") self.vars ["wwan.operator"] = "" self.vars ["wwan.rat"] = "" # traffic self.vars ["traffic.available"] = self.config.is_traffic_available() #self.vars ["user.prepay"] = theApp.pay_type()==pay_t_pre self.vars ["str.user.data.available"] = "" self.vars ["str.user.data.available.data"] = "" if tgcm.country_support=='es': self.vars ["str.user.data.available.label"] = _("Data used") else: self.vars ["str.user.data.available.label"] = _("Available data") self.vars ["str.user.data.used"] = "" self.vars ["str.user.data.used.data"] = "" self.vars ["str.user.data.limit.data"] = "" self.vars ["str.user.data.used.label"] = _("You've used") self.vars ["user.data.used"] = 0 self.vars ["user.data.description"] = "" # localizables self.vars ["str.mintotray"] = _("Minimize to system tray") self.vars ["str.minimize"] = _("Minimize") self.vars ["str.srvmore"] = _("More...") self.vars ["str.srvaddressbook"] = _("Contacts") self.vars ["str.srvwifi"] = self.config.get_wifi_service_name() #_("Wi-Fi areas") self.vars ["str.srvfavorites"] = _("Favourites") self.vars ["str.srvsms"] = _("SMS") self.vars ["str.srvprepay"] = _("Prepay") self.vars ["str.srvrecargasaldo"] = _("Top-up") self.vars ["str.close"] = _("Close %s") % self.config.get_app_name() self.vars ["str.exit"] = _("Close %s") % self.config.get_app_name() self.vars ["wwan.signal.description"] = "" self.vars ["wifi.signal.description"] = "" self.vars ["str.smartconnect"] = _("Smart Connection") self.vars ["str.smartconnect.description"] = _('Get connected launching Smart Connection') self.vars ["str.connect.status"] = _("Disconnected") self.vars ["str.connect.statustext"] = _("Status") if tgcm.country_support != "uk": self.vars ["str.getconnected"] = _("Get connected to the default connection") else: self.vars ["str.getconnected"] = "" self.vars ["str.disconnect"] = _("Disconnect") self.vars ["str.connect"] = _("Connect") self.vars ["str.cancel"] = _("Cancel") self.dyn_vars ["str.disconnect.description"] = self.__get_str_disconnect_description self.vars ["str.settings"] = _("Settings") self.vars ["str.settings.description"] = "IDS_MW_TTIP_BTNCFG" self.vars ["str.help"] = _("Help") self.vars ["str.help.description"] = "IDS_MW_TTIP_BTNAYU" self.vars ["str.prepaypage"] = "IDS_PREPAY_BTN" #self.vars ["str.prepaypage.description"] = theApp.m_iconfig.prepay_url() self.vars ["str.networks"] = _("Available networks") self.vars ["str.networkstooltip"] = _("Available mobile networks") self.vars ["str.traffic"] = _("Traffic") self.vars ["str.apptitle"] = self.config.get_app_name() # notifiers self.vars ["notifier.generic.text"] = "" self.vars ["notifier.traffic.text"] = "" self.vars ["notifier.error.text"] = "" self.vars ["notifier.error.title"] = "IDS_ERROR_NOTIFIER_TITLE"
def _on_data_usage_changed(self, traffic_manager, nbytes): if nbytes <= 0: nbytes = 0 self._data_usage = _('Data usage: %s') % \ format_to_maximun_unit(nbytes,"GBits","MBits","KBits","Bits")
def __update_session_data_transfered_cb(self, traffic_manager, bytes): if bytes <= 0 : self.data_transfered_label.set_markup("<b>--</b>") else: self.data_transfered_label.set_markup("<b>%s</b>" % \ format_to_maximun_unit(bytes, "GB", "MB", "KB", "Bytes"))
def __updated_traffic_info_cb(self, widget, in_data, out_data): if tgcm.country_support == "uk": return self.__t_speed = '%s/s' % format_to_maximun_unit(in_data * 8, "GBits","MBits","KBits","Bits") self.emit('connection_speed_changed', self.__t_speed)
def __update_session_data_transfered_cb(self, traffic_manager, bytes): if bytes <= 0: self.data_transfered_label.set_markup("<b>--</b>") else: self.data_transfered_label.set_markup("<b>%s</b>" % \ format_to_maximun_unit(bytes, "GB", "MB", "KB", "Bytes"))
def __create_vars(self): self.__wifi_tooltips = [ _('Very low Wi-Fi coverage'), _('Low Wi-Fi coverage'), _('Good Wi-Fi coverage level'), _('Very good Wi-Fi coverage'), _('Excellent Wi-Fi coverage'), ] self.__wwan_tooltips = [ _('Very low coverage level'), _('Low coverage level'), _('Good coverage level'), _('Very good coverage level'), _('Excellent coverage level'), ] self.vars = {} self.dyn_vars = {} self.vars["wwan.homezone"] = False self.vars["wwan.roaming"] = False self.vars["wwan.device.status"] = _("Switched off") self.vars["wwan.device.in"] = False self.vars["wwan.device.on"] = False self.vars["wwan.device.init"] = False self.vars["wwan.signal"] = 0 self.vars["wifi.signal"] = 0 self.vars["lan.signal"] = 0 self.vars["lan.signal.description"] = _("LAN connectivity") self.vars["available.signal"] = 0 self.vars["available.signal.description"] = "" self.vars["available.signal.wwan"] = False self.vars["available.signal.wifi"] = False self.vars["available.signal.lan"] = False self.vars["available.connection"] = "" self.vars["available.connection.description"] = "" self.vars["app.connected"] = False self.vars["app.connecting"] = False self.vars["app.connection.wwan"] = True self.vars["app.connection.wifi"] = False self.vars["app.connection.lan"] = False self.vars["app.connection.seconds"] = "" self.vars["app.connection.bytes"] = "" self.vars["app.connection.speed"] = format_to_maximun_unit( 0, "GBits", "MBits", "KBits", "Bits") + "/s" self.vars["app.connection.signal"] = 0 self.vars["app.connection.signal.description"] = "" self.vars["app.connection.tech.description"] = "" self.vars["str.connection"] = "" self.vars["app.connection.progress"] = 0 self.vars["wwan.device"] = _("No device") self.vars["wwan.device.description"] = _("Device: No device") self.vars["wwan.operator"] = "" self.vars["wwan.rat"] = "" # traffic self.vars["traffic.available"] = self.config.is_traffic_available() #self.vars ["user.prepay"] = theApp.pay_type()==pay_t_pre self.vars["str.user.data.available"] = "" self.vars["str.user.data.available.data"] = "" if tgcm.country_support == 'es': self.vars["str.user.data.available.label"] = _("Data used") else: self.vars["str.user.data.available.label"] = _("Available data") self.vars["str.user.data.used"] = "" self.vars["str.user.data.used.data"] = "" self.vars["str.user.data.limit.data"] = "" self.vars["str.user.data.used.label"] = _("You've used") self.vars["user.data.used"] = 0 self.vars["user.data.description"] = "" # localizables self.vars["str.mintotray"] = _("Minimize to system tray") self.vars["str.minimize"] = _("Minimize") self.vars["str.srvmore"] = _("More...") self.vars["str.srvaddressbook"] = _("Contacts") self.vars["str.srvwifi"] = self.config.get_wifi_service_name( ) #_("Wi-Fi areas") self.vars["str.srvfavorites"] = _("Favourites") self.vars["str.srvsms"] = _("SMS") self.vars["str.srvprepay"] = _("Prepay") self.vars["str.srvrecargasaldo"] = _("Top-up") self.vars["str.close"] = _("Close %s") % self.config.get_app_name() self.vars["str.exit"] = _("Close %s") % self.config.get_app_name() self.vars["wwan.signal.description"] = "" self.vars["wifi.signal.description"] = "" self.vars["str.smartconnect"] = _("Smart Connection") self.vars["str.smartconnect.description"] = _( 'Get connected launching Smart Connection') self.vars["str.connect.status"] = _("Disconnected") self.vars["str.connect.statustext"] = _("Status") if tgcm.country_support != "uk": self.vars["str.getconnected"] = _( "Get connected to the default connection") else: self.vars["str.getconnected"] = "" self.vars["str.disconnect"] = _("Disconnect") self.vars["str.connect"] = _("Connect") self.vars["str.cancel"] = _("Cancel") self.dyn_vars[ "str.disconnect.description"] = self.__get_str_disconnect_description self.vars["str.settings"] = _("Settings") self.vars["str.settings.description"] = "IDS_MW_TTIP_BTNCFG" self.vars["str.help"] = _("Help") self.vars["str.help.description"] = "IDS_MW_TTIP_BTNAYU" self.vars["str.prepaypage"] = "IDS_PREPAY_BTN" #self.vars ["str.prepaypage.description"] = theApp.m_iconfig.prepay_url() self.vars["str.networks"] = _("Available networks") self.vars["str.networkstooltip"] = _("Available mobile networks") self.vars["str.traffic"] = _("Traffic") self.vars["str.apptitle"] = self.config.get_app_name() # notifiers self.vars["notifier.generic.text"] = "" self.vars["notifier.traffic.text"] = "" self.vars["notifier.error.text"] = "" self.vars["notifier.error.title"] = "IDS_ERROR_NOTIFIER_TITLE"
def __update_session_data_transfered_cb(self, traffic_manager, bytes): self.data_transfered_label.set_markup("<small><b>%s</b></small>" % \ format_to_maximun_unit(bytes,"GB","MB","KB","Bytes") )