|
@@ -293,7 +293,6 @@ func (self *TitleBar) SetSoundVolume(vol int) {
|
|
|
func (self *TitleBar) CheckBatteryStat() {
|
|
|
bat_segs := [][]int{[]int{0, 6}, []int{7, 15}, []int{16, 20}, []int{21, 30}, []int{31, 50}, []int{51, 60}, []int{61, 80}, []int{81, 90}, []int{91, 100}}
|
|
|
|
|
|
- self.Icons["battery"] = self.Icons["battery_unknown"]
|
|
|
|
|
|
if FileExists(sysgo.Battery) == false {
|
|
|
return
|
|
@@ -340,11 +339,9 @@ func (self *TitleBar) CheckBatteryStat() {
|
|
|
|
|
|
if val, ok := bat_uevent["POWER_SUPPLY_STATUS"]; ok {
|
|
|
if val == "Charging" {
|
|
|
- self.Icons["battery_charging"].SetIconIndex(cap_ge)
|
|
|
- self.Icons["battery"] = self.Icons["battery_charging"]
|
|
|
+ self.Icons["battery"].SetIconIndex(1+cap_ge)
|
|
|
} else {
|
|
|
- self.Icons["battery_discharging"].SetIconIndex(cap_ge)
|
|
|
- self.Icons["battery"] = self.Icons["battery_discharging"]
|
|
|
+ self.Icons["battery"].SetIconIndex(1+9+cap_ge)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -392,29 +389,13 @@ func (self *TitleBar) Init(main_screen *MainScreen) {
|
|
|
|
|
|
self.Icons["wifistatus"] = icon_wifi_status
|
|
|
|
|
|
- battery_charging := NewTitleBarIconItem()
|
|
|
- battery_charging.MyType = ICON_TYPES["STAT"]
|
|
|
- battery_charging.Parent = self
|
|
|
- battery_charging.ImageName = self.icon_base_path + "withcharging.png"
|
|
|
- battery_charging.Adjust(start_x+self.IconWidth+self.IconWidth+8, self.IconHeight/2+(self.BarHeight-self.IconHeight)/2, self.IconWidth, self.IconHeight, 0)
|
|
|
-
|
|
|
- self.Icons["battery_charging"] = battery_charging
|
|
|
-
|
|
|
- battery_discharging := NewTitleBarIconItem()
|
|
|
- battery_discharging.MyType = ICON_TYPES["STAT"]
|
|
|
- battery_discharging.Parent = self
|
|
|
- battery_discharging.ImageName = self.icon_base_path + "without_charging.png"
|
|
|
- battery_discharging.Adjust(start_x+self.IconWidth+self.IconWidth+8, self.IconHeight/2+(self.BarHeight-self.IconHeight)/2, self.IconWidth, self.IconHeight, 0)
|
|
|
-
|
|
|
- self.Icons["battery_discharging"] = battery_discharging
|
|
|
-
|
|
|
battery_unknown := NewTitleBarIconItem()
|
|
|
battery_unknown.MyType = ICON_TYPES["STAT"]
|
|
|
battery_unknown.Parent = self
|
|
|
- battery_unknown.ImageName = self.icon_base_path + "battery_unknown.png"
|
|
|
+ battery_unknown.ImageName = self.icon_base_path + "battery.png"
|
|
|
battery_unknown.Adjust(start_x+self.IconWidth+self.IconWidth+8, self.IconHeight/2+(self.BarHeight-self.IconHeight)/2, self.IconWidth, self.IconHeight, 0)
|
|
|
|
|
|
- self.Icons["battery_unknown"] = battery_unknown
|
|
|
+ self.Icons["battery"] = battery_unknown
|
|
|
|
|
|
self.CheckBatteryStat()
|
|
|
|