mirror of
https://github.com/clockworkpi/launcher.git
synced 2025-12-14 02:38:51 +01:00
add bluetooth titlebar icon
This commit is contained in:
parent
10a91108dd
commit
a1bbeafd8b
BIN
skin/default/sys.py/gameshell/titlebar_icons/bluetooth.png
Normal file
BIN
skin/default/sys.py/gameshell/titlebar_icons/bluetooth.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 562 B |
@ -58,6 +58,7 @@ class TitleBar:
|
|||||||
self.CheckBatteryStat()
|
self.CheckBatteryStat()
|
||||||
self.SyncSoundVolume()
|
self.SyncSoundVolume()
|
||||||
self.UpdateWifiStrength()
|
self.UpdateWifiStrength()
|
||||||
|
self.CheckBluetooth()
|
||||||
SwapAndShow()
|
SwapAndShow()
|
||||||
# print("TitleBar Gobjectroundrobin")
|
# print("TitleBar Gobjectroundrobin")
|
||||||
elif self._InLowBackLight >= 0:
|
elif self._InLowBackLight >= 0:
|
||||||
@ -66,6 +67,7 @@ class TitleBar:
|
|||||||
self.CheckBatteryStat()
|
self.CheckBatteryStat()
|
||||||
self.SyncSoundVolume()
|
self.SyncSoundVolume()
|
||||||
self.UpdateWifiStrength()
|
self.UpdateWifiStrength()
|
||||||
|
self.CheckBluetooth()
|
||||||
self._InLowBackLight = 0
|
self._InLowBackLight = 0
|
||||||
|
|
||||||
return True
|
return True
|
||||||
@ -95,12 +97,12 @@ class TitleBar:
|
|||||||
return ge
|
return ge
|
||||||
|
|
||||||
def SyncSoundVolume(self):
|
def SyncSoundVolume(self):
|
||||||
try:
|
try:
|
||||||
m = alsaaudio.Mixer()
|
m = alsaaudio.Mixer()
|
||||||
vol = m.getvolume()[0]
|
vol = m.getvolume()[0]
|
||||||
except Exception,e:
|
except Exception,e:
|
||||||
print(str(e))
|
print(str(e))
|
||||||
vol = 0
|
vol = 0
|
||||||
|
|
||||||
snd_segs = [ [0,10],[10,30],[30,70],[70,100] ]
|
snd_segs = [ [0,10],[10,30],[30,70],[70,100] ]
|
||||||
|
|
||||||
@ -176,6 +178,20 @@ class TitleBar:
|
|||||||
def SetBatteryStat(self,bat):
|
def SetBatteryStat(self,bat):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def CheckBluetooth(self):
|
||||||
|
out = commands.getstatusoutput("hcitool dev | grep hci0 |cut -f3")
|
||||||
|
if len(out[1]) < 17:
|
||||||
|
print("no bluetooth", out)
|
||||||
|
self._Icons["bluetooth"]._IconIndex = 2
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
out = commands.getstatusoutput("sudo rfkill list | grep hci0 -A 2 | grep yes")
|
||||||
|
if len(out[1]) > 10:
|
||||||
|
self._Icons["bluetooth"]._IconIndex = 1
|
||||||
|
return
|
||||||
|
|
||||||
|
self._Icons["bluetooth"]._IconIndex = 0
|
||||||
|
|
||||||
def Init(self,screen):
|
def Init(self,screen):
|
||||||
|
|
||||||
|
|
||||||
@ -228,6 +244,15 @@ class TitleBar:
|
|||||||
self.SyncSoundVolume()
|
self.SyncSoundVolume()
|
||||||
|
|
||||||
|
|
||||||
|
bluetooth = MultiIconItem()
|
||||||
|
bluetooth._MyType = ICON_TYPES["STAT"]
|
||||||
|
bluetooth._Parent = self
|
||||||
|
bluetooth._ImageName = icon_base_path+"bluetooth.png"
|
||||||
|
bluetooth.Adjust(start_x+self._icon_width+self._icon_width+8,self._icon_height/2+(self._BarHeight-self._icon_height)/2,self._icon_width,self._icon_height,0)
|
||||||
|
|
||||||
|
self._Icons["bluetooth"] = bluetooth
|
||||||
|
self.CheckBluetooth()
|
||||||
|
|
||||||
round_corners = MultiIconItem()
|
round_corners = MultiIconItem()
|
||||||
round_corners._IconWidth = 10
|
round_corners._IconWidth = 10
|
||||||
round_corners._IconHeight = 10
|
round_corners._IconHeight = 10
|
||||||
@ -286,7 +311,9 @@ class TitleBar:
|
|||||||
|
|
||||||
start_x = Width-time_text_size[0]-self._ROffset-self._icon_width*3 # near by the time_text
|
start_x = Width-time_text_size[0]-self._ROffset-self._icon_width*3 # near by the time_text
|
||||||
|
|
||||||
self._Icons["sound"].NewCoord(start_x, self._icon_height/2+(self._BarHeight-self._icon_height)/2)
|
self._Icons["bluetooth"].NewCoord(start_x - self._icon_width,self._icon_height/2+(self._BarHeight-self._icon_height)/2)
|
||||||
|
|
||||||
|
self._Icons["sound"].NewCoord(start_x, self._icon_height/2+(self._BarHeight-self._icon_height)/2)
|
||||||
|
|
||||||
#self._Icons["wifi"].NewCoord(start_x+self._icon_width+5, self._icon_height/2+(self._BarHeight-self._icon_height)/2)
|
#self._Icons["wifi"].NewCoord(start_x+self._icon_width+5, self._icon_height/2+(self._BarHeight-self._icon_height)/2)
|
||||||
|
|
||||||
@ -316,6 +343,8 @@ class TitleBar:
|
|||||||
|
|
||||||
self._Icons["battery"].Draw()
|
self._Icons["battery"].Draw()
|
||||||
|
|
||||||
|
self._Icons["bluetooth"].Draw()
|
||||||
|
|
||||||
pygame.draw.line(self._CanvasHWND,self._SkinManager.GiveColor("Line"),(0,self._BarHeight),(self._Width,self._BarHeight),self._BorderWidth)
|
pygame.draw.line(self._CanvasHWND,self._SkinManager.GiveColor("Line"),(0,self._BarHeight),(self._Width,self._BarHeight),self._BorderWidth)
|
||||||
|
|
||||||
if self._HWND != None:
|
if self._HWND != None:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user