Skip to content

Commit

Permalink
Update and add initial support for battery on netbooks / laptops
Browse files Browse the repository at this point in the history
  • Loading branch information
eloaders committed Jan 14, 2012
1 parent a787295 commit 12f4218
Show file tree
Hide file tree
Showing 2 changed files with 162 additions and 36 deletions.
63 changes: 41 additions & 22 deletions src/i-nex/.src/Finfosys.class
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
' Gambas class file

Public Sub Form_Open()
Dim gnome_screenshot As Boolean = Exist("/usr/bin/gnome-screenshot")
Dim cpuz0, cpuz1, cpuz2, cpuz3, cpuz4, cpuz5, cpuz6, cpuz7, cpuz8, cpuz9, cpuz10, cpuz11 As String
If Exist("/usr/bin/gnome-screenshot") Then
If gnome_screenshot = True Then
Button2.Visible = True
Endif
If battery.battery_exist And battery.true_false = False Then
TabStrip1[9].Visible = False
Else
TabStrip1[9].Visible = True
Object.Call(battery, "_init")
Object.Call(Setting, "_init")
battery_info()
Endif
TextArea28.Visible = False
TextLabel21.Visible = False
'Procesor
Expand Down Expand Up @@ -95,25 +104,9 @@ Public Sub ComboBox1_Click()
End

Public Sub kernel()
Dim stringa, risultato, kernel, uzywanyobecniekernel As String
Dim righe As New String[]
Dim count As Integer
Dim riga As New String[]
Dim lista As New String[]
Shell "ls /boot/vmlinuz* | cut -d '/' -f 3 " Wait To TextArea47.Text
Shell "ls /boot/vmlinuz* | cut -d '/' -f 3 | wc -l" Wait To Label16.Text
Shell "uname -r" Wait To Label26.Text
'Usuwanie kerneli
Shell "bash -c /usr/bin/check_kernel" Wait To stringa
righe = Split(stringa, "\n", "%%", True)
For count = 2 To righe.Max
riga = Split(righe[count], " ", "%%", True)
risultato = Replace(riga[0], " ", "")
lista.add(risultato)
Next
ComboBox3.List = lista
ComboBox3.Index = 0
'Koniec usuwania kerneli
End

Public Sub dzwiek()
Expand All @@ -128,7 +121,7 @@ Public Sub dysk()
Dim wolnegbnadysku, dysktwardy, zajetegb, calkowitapoj, zajgb1, wolgb1, calkowite1 As String
Dim wolgb, zajgb, calkowite As Float
'SHELL "cat /proc/scsi/scsi | grep ATA | head -1 | cut -d ':' -f 3 | cut -d ' ' -f 2-3 && echo $(cat /proc/partitions | grep sda | head -n 1 | awk {'print $3'})/1024/1024 | bc && echo GB" WAIT TO dysktwardy
Shell "grep 'Vendor' /proc/scsi/scsi" Wait To dysktwardy
Shell "cat /proc/scsi/scsi" Wait To dysktwardy
Shell "echo $(df -m | grep '/' | awk {'print $4'} | head -1)/1000 | bc && echo GB" Wait To wolnegbnadysku
Shell "echo $(df -m | grep '/' | awk {'print $3'} | head -1)/1000 | bc && echo GB" Wait To zajetegb
Shell "echo $(df -m | grep '/' | awk {'print $2'} | head -1)/1000 | bc && echo GB" Wait To calkowitapoj
Expand Down Expand Up @@ -420,6 +413,26 @@ Public Sub dospam_uptime()

End

Public Sub battery_info()

TextBox7.Text = battery.Present
TextBox8.Text = battery.Design_capacity
TextBox9.Text = battery.last_full_capacity
TextBox10.Text = battery.battery_technology
TextBox11.Text = battery.design_voltage
TextBox12.Text = battery.design_capacity_warning
TextBox13.Text = battery.design_capacity_low
TextBox14.Text = battery.cycle_count
TextBox15.Text = battery.capacity_granularity_1
TextBox16.Text = battery.capacity_granularity_2
TextBox17.Text = battery.model_number
TextBox18.Text = battery.serial_number
TextBox19.Text = battery.battery_type
TextBox20.Text = battery.OEM_info

End


Public Sub Button3_Click()

About.Show
Expand Down Expand Up @@ -460,9 +473,15 @@ Public Sub Button8_Click()

End

Public Sub Button9_Click()

Options.Show

End

Public Sub Button10_Click()
'sudo apt-get -y remove
Exec ["gksu", "apt-get -y remove " & ComboBox3.Text & ""] Wait
kernel()
Message.Warning("Dla poprawności tego działania proszę\nzaktualizuj gruba poleceniem = sudo update-grub")

Object.Call(battery, "_init")
battery_info()

End
135 changes: 121 additions & 14 deletions src/i-nex/.src/Finfosys.form
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Move(0,0,474,486)
Tag = "System"
AutoResize = True
Count = 9
Count = 10
Index = 0
Text = ("CPU")
Picture = Picture["Data/Tabs/cpu.png"]
Expand Down Expand Up @@ -108,18 +108,22 @@
{ TextBox2 TextBox
Move(246,18,42,24)
Text = ("N/A")
ReadOnly = True
}
{ TextBox3 TextBox
Move(138,18,42,24)
Text = ("N/A")
ReadOnly = True
}
{ TextBox4 TextBox
Move(48,18,42,24)
Text = ("N/A")
ReadOnly = True
}
{ TextBox1 TextBox
Move(360,18,42,24)
Text = ("N/A")
ReadOnly = True
}
{ Label18 Label
Move(294,18,66,24)
Expand All @@ -128,6 +132,7 @@
{ TextBox5 TextBox
Move(72,48,42,24)
Text = ("N/A")
ReadOnly = True
}
{ Label19 Label
Move(6,48,66,24)
Expand All @@ -136,6 +141,7 @@
{ TextBox6 TextBox
Move(186,48,84,24)
Text = ("N/A")
ReadOnly = True
}
}
{ Frame2 Frame
Expand Down Expand Up @@ -550,14 +556,6 @@
Move(133,21,56,21)
Text = ("kernels:")
}
{ ComboBox3 ComboBox
Move(7,273,392,21)
Text = ("Select the kernel to remove")
}
{ Button10 Button
Move(406,273,49,21)
Text = ("Delete")
}
}
{ TextArea47 TextArea
Move(14,56,448,182)
Expand Down Expand Up @@ -696,11 +694,116 @@
ScrollBar = Scroll.None
}
}
Index = 9
Text = ("Battery")
Picture = Picture["icon:/16/battery"]
{ TextBox7 TextBox
Move(144,12,318,24)
}
{ TextBox8 TextBox
Move(144,42,318,24)
}
{ TextBox9 TextBox
Move(144,72,318,24)
}
{ TextBox10 TextBox
Move(144,102,318,24)
}
{ TextBox11 TextBox
Move(144,132,318,24)
}
{ TextBox12 TextBox
Move(144,162,318,24)
}
{ TextBox13 TextBox
Move(144,192,318,24)
}
{ TextBox14 TextBox
Move(144,222,318,24)
}
{ TextBox15 TextBox
Move(144,252,318,24)
}
{ TextBox16 TextBox
Move(144,282,318,24)
}
{ TextBox17 TextBox
Move(144,312,318,24)
}
{ TextBox18 TextBox
Move(144,342,318,24)
}
{ TextBox19 TextBox
Move(144,372,318,24)
}
{ TextBox20 TextBox
Move(144,402,318,24)
}
{ Label20 Label
Move(6,12,102,24)
Text = ("Present:")
}
{ Label21 Label
Move(6,42,102,24)
Text = ("Design capacity:")
}
{ Label22 Label
Move(6,72,102,24)
Text = ("Last full capacity:")
}
{ Label23 Label
Move(6,102,108,24)
Text = ("Battery technology:")
}
{ Label24 Label
Move(6,132,138,24)
Text = ("Design voltage:")
}
{ Label28 Label
Move(6,162,138,24)
Text = ("Design capacity warning:")
}
{ Label29 Label
Move(6,192,138,24)
Text = ("Design capacity low:")
}
{ Label30 Label
Move(6,222,138,24)
Text = ("Cycle count:")
}
{ Label31 Label
Move(6,252,138,24)
Text = ("Capacity granularity 1:")
}
{ Label32 Label
Move(6,282,138,24)
Text = ("Capacity granularity 2:")
}
{ Label33 Label
Move(6,312,138,24)
Text = ("Model number:")
}
{ Label34 Label
Move(6,342,138,24)
Text = ("Serial number:")
}
{ Label35 Label
Move(6,402,138,24)
Text = ("OEM info:")
}
{ Label36 Label
Move(6,372,138,24)
Text = ("Battery type:")
}
{ Button10 Button
Move(438,426,24,24)
Picture = Picture["icon:/16/refresh"]
}
Index = 0
}
{ Button2 Button
Move(7,497,192,21)
Text = ("Take a picture of this window")
Move(7,497,120,24)
Text = ("Take Screenshot")
Picture = Picture["icon:/16/camera"]
}
{ Button1 Button
Expand All @@ -709,15 +812,19 @@
Picture = Picture["icon:/16/cancel"]
}
{ Button3 Button
Move(354,498,21,21)
Move(330,498,21,21)
Picture = Picture["icon:/16/help"]
}
{ Label25 Label
Move(294,498,56,21)
Move(270,498,56,21)
Text = ("Label25")
}
{ Label27 Label
Move(240,498,49,21)
Move(216,498,49,21)
Text = ("i-nex v:")
}
{ Button9 Button
Move(354,498,21,21)
Picture = Picture["icon:/16/properties"]
}
}

0 comments on commit 12f4218

Please sign in to comment.