コード例 #1
0
ファイル: gtk_ui.py プロジェクト: grimpy/pyconnman
 def service_changed(self, service, propertyname, propertyvalue):
     if propertyname == "Strength":
         icon = icons.get_icon_by_strenght(propertyvalue)
         self.status_icon.set_from_file(icon)
     elif propertyname == "State":
         self.notify.update("Connman", "Sevice %s is now %s" % (service.name, propertyvalue))
         self.notify.show()
         if service.state in ("failure", "online", "ready"):
             self.spinner_connect.reset()
コード例 #2
0
ファイル: gtk_ui.py プロジェクト: grimpy/pyconnman
 def check_status_icon(self, service=None):
     icon = icons.TYPE_UNKOWN
     tooltip = "Not connected"
     if not service:
         service = self.connman.get_default_service()
     if not service:
         icon = icons.TYPE_NONE
         type_ = None
     else:
         type_ = service.type
     if type_ in ("wifi", "3G", "bluetooth"):
         #register signal checker
         strenght = service.properties['Strength']
         icon = icons.get_icon_by_strenght(strenght)
     elif type_ == "ethernet":
         icon = icons.TYPE_WIRED
     if icon != icons.TYPE_NONE:
         self.spinner_connect.reset()
     if service:
         ipinfo = service.properties['IPv4']
         tooltip = "Connected to %s\nAddress %s/%s\nGateway %s" % (service, ipinfo.get('Address'), ipinfo.get('Netmask'), ipinfo.get('Gateway'))
     self.status_icon.set_tooltip(tooltip)
     self.status_icon.set_from_file(icon)