1
by eloaders
2.1 |
1 |
' Gambas class file
|
2 |
||
3 |
||
4 |
PUBLIC SUB Form_Open()
|
|
5 |
DIM cpuz0, cpuz1, cpuz2, cpuz3, cpuz4, cpuz5 AS String
|
|
6 |
TextLabel10.Visible = FALSE
|
|
7 |
TextArea28.Visible = FALSE
|
|
8 |
TextLabel21.Visible = FALSE
|
|
9 |
'End dpkg installed |
|
10 |
'Procesor
|
|
11 |
SHELL "ls /sys/devices/system/cpu/ | grep -v save | sed -n '1p'" WAIT TO cpuz0 |
|
12 |
SHELL "ls /sys/devices/system/cpu/ | grep -v save | sed -n '2p'" WAIT TO cpuz1 |
|
13 |
SHELL "ls /sys/devices/system/cpu/ | grep -v save | sed -n '3p'" WAIT TO cpuz2 |
|
14 |
SHELL "ls /sys/devices/system/cpu/ | grep -v save | sed -n '4p'" WAIT TO cpuz3 |
|
15 |
SHELL "ls /sys/devices/system/cpu/ | grep -v save | sed -n '5p'" WAIT TO cpuz4 |
|
16 |
SHELL "ls /sys/devices/system/cpu/ | grep -v save | sed -n '6p'" WAIT TO cpuz5 |
|
17 |
|
|
18 |
cpuz0 = Replace(cpuz0, "\n", "")
|
|
19 |
cpuz1 = Replace(cpuz1, "\n", "")
|
|
20 |
cpuz2 = Replace(cpuz2, "\n", "")
|
|
21 |
cpuz3 = Replace(cpuz3, "\n", "")
|
|
22 |
cpuz4 = Replace(cpuz4, "\n", "")
|
|
23 |
cpuz5 = Replace(cpuz5, "\n", "")
|
|
24 |
IF (cpuz0 = "cpu0") = TRUE THEN
|
|
25 |
ComboBox1.Add("Procesor0")
|
|
26 |
ENDIF
|
|
27 |
||
28 |
IF (cpuz1 = "cpu1") = TRUE THEN
|
|
29 |
ComboBox1.Add("Procesor1")
|
|
30 |
ENDIF
|
|
31 |
||
32 |
IF (cpuz2 = "cpu2") = TRUE THEN
|
|
33 |
ComboBox1.Add("Procesor2")
|
|
34 |
ENDIF
|
|
35 |
||
36 |
IF (cpuz3 = "cpu3") = TRUE THEN
|
|
37 |
ComboBox1.Add("Procesor3")
|
|
38 |
ENDIF
|
|
39 |
||
40 |
IF (cpuz4 = "cpu4") = TRUE THEN
|
|
41 |
ComboBox1.Add("Procesor4")
|
|
42 |
ENDIF
|
|
43 |
||
44 |
IF (cpuz5 = "cpu5") = TRUE THEN
|
|
45 |
ComboBox1.Add("Procesor5")
|
|
46 |
ENDIF
|
|
47 |
||
48 |
dospam_uptime()
|
|
49 |
System()
|
|
50 |
bios()
|
|
51 |
kernel()
|
|
52 |
internet()
|
|
53 |
dzwiek()
|
|
54 |
grafika()
|
|
55 |
dysk()
|
|
56 |
ComboBox1.Text = "Procesor0"
|
|
57 |
Label25.Text = Application.version
|
|
58 |
'Okno na środku |
|
59 |
ME.Center |
|
60 |
||
61 |
END
|
|
62 |
||
63 |
||
64 |
PUBLIC SUB ComboBox1_Click() |
|
65 |
||
66 |
Wykrywanie_procesorow() |
|
67 |
||
68 |
END
|
|
69 |
||
70 |
PUBLIC SUB kernel() |
|
71 |
DIM stringa, risultato, kernel, uzywanyobecniekernel AS String |
|
72 |
DIM righe AS NEW string[] |
|
73 |
DIM count AS Integer |
|
74 |
DIM riga AS NEW String[] |
|
75 |
DIM lista AS NEW String[] |
|
76 |
SHELL "ls /boot/vmlinuz* | cut -d '/' -f 3 " WAIT TO TextArea47.Text |
|
77 |
SHELL "ls /boot/vmlinuz* | cut -d '/' -f 3 | wc -l" WAIT TO Label16.Text |
|
78 |
SHELL "uname -r" WAIT TO Label26.Text |
|
79 |
'Usuwanie kerneli
|
|
80 |
SHELL "dpkg-query -W --showformat='${Package}\n' | grep 'linux-image'" TO stringa |
|
81 |
|
|
82 |
righe = Split(stringa, "\n", "%%", TRUE)
|
|
83 |
|
|
84 |
FOR count = 2 TO righe.Max
|
|
85 |
|
|
86 |
riga = Split(righe[count], " ", "%%", TRUE)
|
|
87 |
|
|
88 |
risultato = Replace(riga[0], " ", "")
|
|
89 |
lista.add(risultato)
|
|
90 |
NEXT
|
|
91 |
|
|
92 |
ComboBox3.List = lista
|
|
93 |
ComboBox3.Index = 0
|
|
94 |
'Koniec usuwania kerneli |
|
95 |
||
96 |
END
|
|
97 |
||
98 |
PUBLIC SUB dzwiek() |
|
99 |
||
100 |
DIM kartadzwiekowa, kartadzwiekowa2 AS String |
|
101 |
SHELL "lspci | grep 'udio' | cut -d ':' -f 3 | cut -d '(' -f 1" WAIT TO kartadzwiekowa |
|
102 |
TextArea18.Text = kartadzwiekowa |
|
103 |
||
104 |
END
|
|
105 |
||
106 |
PUBLIC SUB dysk() |
|
107 |
DIM wolnegbnadysku, dysktwardy, zajetegb, calkowitapoj AS String |
|
108 |
DIM wolgb, zajgb, calkowite AS Float |
|
109 |
'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 |
|
110 |
SHELL "cat /proc/scsi/scsi | grep 'Vendor'" WAIT TO dysktwardy |
|
111 |
SHELL "echo $(df -m | grep '/' | awk {'print $4'} | head -1)/1000 | bc && echo GB" WAIT TO wolnegbnadysku |
|
112 |
SHELL "echo $(df -m | grep '/' | awk {'print $3'} | head -1)/1000 | bc && echo GB" WAIT TO zajetegb |
|
113 |
SHELL "echo $(df -m | grep '/' | awk {'print $2'} | head -1)/1000 | bc && echo GB" WAIT TO calkowitapoj |
|
114 |
'Progress |
|
115 |
SHELL "df -m | grep / | awk {'print $4'} | head -n 1" WAIT TO wolgb |
|
116 |
SHELL "df -m | grep / | awk {'print $3'} | head -n 1" WAIT TO zajgb |
|
117 |
SHELL "df -m | grep / | awk {'print $2'} | head -n 1" WAIT TO calkowite |
|
118 |
TextLabel1.Text = wolnegbnadysku |
|
119 |
TextArea24.Text = dysktwardy |
|
120 |
TextLabel6.Text = zajetegb |
|
121 |
TextLabel13.Text = calkowitapoj |
|
122 |
ProgressBar2.Value = wolgb / calkowite |
|
123 |
ProgressBar3.Value = zajgb / calkowite |
|
124 |
END
|
|
125 |
||
126 |
PUBLIC SUB bios() |
|
127 |
DIM bios_vendor, bios_version, bios_date, board_name, board_vendor AS String |
|
128 |
SHELL "cat /sys/devices/virtual/dmi/id/bios_vendor" TO bios_vendor |
|
129 |
SHELL "cat /sys/devices/virtual/dmi/id/bios_version" TO bios_version |
|
130 |
SHELL "cat /sys/devices/virtual/dmi/id/bios_date" TO bios_date |
|
131 |
SHELL "cat /sys/devices/virtual/dmi/id/board_vendor" TO board_vendor |
|
132 |
SHELL "cat /sys/devices/virtual/dmi/id/board_name" TO board_name |
|
133 |
TextArea25.Text = bios_vendor |
|
134 |
TextArea26.Text = bios_version |
|
135 |
TextArea27.Text = bios_date |
|
136 |
TextArea15.Text = board_vendor |
|
137 |
TextArea16.Text = board_name |
|
138 |
END
|
|
139 |
||
140 |
PUBLIC SUB System() |
|
141 |
DIM hostname, dist, release, arch, gcc, timezone, xorg_version, glx_version AS String |
|
142 |
SHELL "cat /etc/timezone" WAIT TO timezone |
|
143 |
SHELL "hostname" WAIT TO hostname |
|
144 |
SHELL "cat /etc/issue.net" WAIT TO dist |
|
145 |
SHELL "sed 's/DISTRIB_RELEASE=//' /etc/lsb-release | sed -n '2p'" WAIT TO release |
|
146 |
SHELL "uname -m" WAIT TO arch |
|
147 |
SHELL "gcc -dumpversion" WAIT TO gcc |
|
148 |
SHELL "xdpyinfo | grep 'X.Org version:' | sed -n '1p' | cut -d ':' -f 2" WAIT TO xorg_version |
|
149 |
SHELL "glxinfo | grep 'GLX version:' | sed -n '1p' | cut -d ':' -f 2" WAIT TO glx_version |
|
150 |
||
151 |
TextArea31.Text = gcc |
|
152 |
TextArea33.Text = hostname |
|
153 |
TextArea29.Text = dist |
|
154 |
TextArea32.Text = release |
|
155 |
TextArea36.Text = arch |
|
156 |
TextArea30.Text = timezone |
|
157 |
TextArea34.Text = xorg_version |
|
158 |
TextArea35.Text = glx_version |
|
159 |
END
|
|
160 |
||
161 |
PUBLIC SUB grafika() |
|
162 |
DIM stringa, risultato, gpu, opengl_vendor_string, opengl_renderer_string, opengl_version_string, rozdzielczosc AS String |
|
163 |
DIM righe AS NEW string[] |
|
164 |
DIM count AS Integer |
|
165 |
DIM riga AS NEW String[] |
|
166 |
DIM lista AS NEW String[] |
|
167 |
SHELL "lspci | grep 'VGA' | cut -d ':' -f3 | cut -d '(' -f 1" WAIT TO gpu |
|
168 |
SHELL "glxinfo | grep 'OpenGL vendor string:' | sed -n '1p' | cut -d ':' -f 2" WAIT TO opengl_vendor_string |
|
169 |
SHELL "glxinfo | grep 'OpenGL renderer string:' | sed -n '1p' | cut -d ':' -f 2" WAIT TO opengl_renderer_string |
|
170 |
SHELL "glxinfo | grep 'OpenGL version string:' | sed -n '1p' | cut -d ':' -f 2" WAIT TO opengl_version_string |
|
171 |
SHELL "xdpyinfo | grep 'dimensions:' | cut -d ':' -f 2" WAIT TO rozdzielczosc |
|
172 |
'Zmiana rozdzielczości
|
|
173 |
SHELL "xrandr" TO stringa
|
|
174 |
|
|
175 |
righe = Split(stringa, "\n", "%%", TRUE)
|
|
176 |
|
|
177 |
FOR count = 2 TO righe.Max
|
|
178 |
|
|
179 |
riga = Split(righe[count], " ", "%%", TRUE)
|
|
180 |
|
|
181 |
risultato = Replace(riga[0], " ", "")
|
|
182 |
lista.add(risultato)
|
|
183 |
NEXT
|
|
184 |
|
|
185 |
ComboBox2.List = lista
|
|
186 |
ComboBox2.Index = 0
|
|
187 |
'Koniec zmiany rozdzielczości |
|
188 |
||
189 |
TextArea17.Text = gpu |
|
190 |
TextArea19.Text = opengl_vendor_string |
|
191 |
TextArea20.Text = opengl_renderer_string |
|
192 |
TextArea21.Text = opengl_version_string |
|
193 |
TextArea38.Text = rozdzielczosc |
|
194 |
Global.kartagraficzna() |
|
195 |
END
|
|
196 |
||
197 |
||
198 |
PUBLIC SUB internet() |
|
199 |
DIM domyslnaprzegladarka, network_controller, ethernet_controller AS String |
|
200 |
SHELL "x-www-browser -version" WAIT TO domyslnaprzegladarka |
|
201 |
SHELL "lspci | grep 'Network' | cut -d ':' -f 3 | cut -d '(' -f 1" WAIT TO network_controller |
|
202 |
SHELL "lspci | grep 'Ethernet' | cut -d ':' -f 3 | cut -d '(' -f 1" WAIT TO ethernet_controller |
|
203 |
'SHELL "ss -a" WAIT TO ssa
|
|
204 |
TextArea46.Text = domyslnaprzegladarka
|
|
205 |
TextArea22.Text = network_controller
|
|
206 |
TextArea23.Text = ethernet_controller
|
|
207 |
'TextArea48.Text = ssa |
|
208 |
END
|
|
209 |
||
210 |
||
211 |
PUBLIC SUB Wykrywanie_procesorow() |
|
212 |
DIM eloaders, eloaders2, eloaders3, obrazekcpu, cpu, vendor_id, flags, cpu_MHz, model, stepping, cpu_family, bogomips, address_sizes, cache_size, ldata, linstruction AS String |
|
213 |
||
214 |
IF ComboBox1.Text = "Procesor0" THEN |
|
215 |
eloaders = "1p" |
|
216 |
eloaders2 = "cpu0" |
|
217 |
eloaders3 = "1p" |
|
218 |
ENDIF
|
|
219 |
IF ComboBox1.Text = "Procesor1" THEN |
|
220 |
eloaders = "2p" |
|
221 |
eloaders2 = "cpu1" |
|
222 |
eloaders3 = "3p" |
|
223 |
ENDIF
|
|
224 |
IF ComboBox1.Text = "Procesor2" THEN |
|
225 |
eloaders = "3p" |
|
226 |
eloaders2 = "cpu2" |
|
227 |
eloaders3 = "5p" |
|
228 |
ENDIF
|
|
229 |
IF ComboBox1.Text = "Procesor3" THEN |
|
230 |
eloaders = "4p" |
|
231 |
eloaders2 = "cpu3" |
|
232 |
eloaders3 = "7p" |
|
233 |
ENDIF
|
|
234 |
IF ComboBox1.Text = "Procesor4" THEN |
|
235 |
eloaders = "5p" |
|
236 |
eloaders2 = "cpu4" |
|
237 |
eloaders3 = "9p" |
|
238 |
ENDIF
|
|
239 |
IF ComboBox1.Text = "Procesor5" THEN |
|
240 |
eloaders = "6p" |
|
241 |
eloaders2 = "cpu5" |
|
242 |
eloaders3 = "11p" |
|
243 |
ENDIF
|
|
244 |
||
245 |
SHELL "cat /proc/cpuinfo | grep 'vendor_id' | sed -n '" & eloaders & "' | cut -d ':' -f 2" WAIT TO obrazekcpu |
|
246 |
SHELL "cat /proc/cpuinfo | grep 'model name'| sed -n '" & eloaders & "' | cut -d ':' -f 2" WAIT TO cpu |
|
247 |
SHELL "cat /proc/cpuinfo | grep 'vendor_id' | sed -n '" & eloaders & "' | cut -d ':' -f 2" WAIT TO vendor_id |
|
248 |
SHELL "cat /proc/cpuinfo | grep 'flags' | sed -n '" & eloaders & "' | cut -d ':' -f 2" WAIT TO flags |
|
249 |
SHELL "cat /proc/cpuinfo | grep 'cpu MHz' | sed -n '" & eloaders & "' | cut -d ':' -f 2" WAIT TO cpu_MHz |
|
250 |
SHELL "cat /proc/cpuinfo | grep 'model' | sed -n '" & eloaders3 & "' | cut -d ':' -f 2" WAIT TO model |
|
251 |
SHELL "cat /proc/cpuinfo | grep 'stepping' | sed -n '" & eloaders & "' | cut -d ':' -f 2" WAIT TO stepping |
|
252 |
SHELL "cat /proc/cpuinfo | grep 'cpu family' | sed -n '" & eloaders & "' | cut -d ':' -f 2" WAIT TO cpu_family |
|
253 |
SHELL "cat /proc/cpuinfo | grep 'bogomips' | sed -n '" & eloaders & "' | cut -d ':' -f 2" WAIT TO bogomips |
|
254 |
SHELL "cat /proc/cpuinfo | grep 'address sizes' | sed -n '" & eloaders & "' | cut -d ':' -f 2" WAIT TO address_sizes |
|
255 |
SHELL "cat /proc/cpuinfo | grep 'cache size' | sed -n '" & eloaders & "' | cut -d ':' -f 2" WAIT TO cache_size |
|
256 |
SHELL "cat /sys/devices/system/cpu/" & eloaders2 & "/cache/index0/size" WAIT TO ldata |
|
257 |
SHELL "cat /sys/devices/system/cpu/" & eloaders2 & "/cache/index1/size" WAIT TO linstruction |
|
258 |
||
259 |
TextArea1.Text = cpu |
|
260 |
TextArea3.Text = flags |
|
261 |
TextArea4.Text = vendor_id |
|
262 |
TextArea5.Text = cpu_MHz |
|
263 |
TextArea7.Text = model |
|
264 |
TextArea8.Text = stepping |
|
265 |
TextArea6.Text = cpu_family |
|
266 |
TextArea9.Text = bogomips |
|
267 |
TextArea10.Text = address_sizes |
|
268 |
TextArea12.Text = cache_size |
|
269 |
TextArea13.Text = ldata |
|
270 |
TextArea11.Text = linstruction |
|
271 |
||
272 |
Global.ikonaprocka() |
|
273 |
||
274 |
END
|
|
275 |
||
276 |
PUBLIC SUB Button2_Click() |
|
277 |
||
278 |
SHELL "gnome-screenshot -w" |
|
279 |
||
280 |
END
|
|
281 |
||
282 |
PUBLIC SUB Button1_Click() |
|
283 |
||
284 |
Finfosys.Close |
|
285 |
||
286 |
END
|
|
287 |
||
288 |
PUBLIC SUB dospam_uptime() |
|
289 |
DIM uptime, total, used, freee, shared, buffers, cached, usedonthistime, swaptotal AS String |
|
290 |
DIM dospam, totpam, totalswap, usedswap AS Float |
|
291 |
SHELL "echo `free -m | grep 'Mem' | awk {'print $2'}` MB" WAIT TO total |
|
292 |
SHELL "echo `free -m | awk {'print $2'} | sed -n '2p'` MB" WAIT TO used |
|
293 |
SHELL "echo `free -m | awk {'print $3'} | sed -n '2p'` MB" WAIT TO freee |
|
294 |
SHELL "echo `free -m | awk {'print $4'} | sed -n '2p'` MB" WAIT TO shared |
|
295 |
SHELL "echo `free -m | awk {'print $5'} | sed -n '2p'` MB" WAIT TO buffers |
|
296 |
SHELL "echo `free -m | awk {'print $6'} | sed -n '2p'` MB" WAIT TO cached |
|
297 |
SHELL "free -m | grep - | awk {'print $3'}" TO dospam |
|
298 |
SHELL "echo `free -m | grep - | awk {'print $3'}` MB" TO usedonthistime |
|
299 |
SHELL "free -m | grep Mem | awk {'print $2'}" WAIT TO totpam |
|
300 |
SHELL "echo `free -m | grep 'Swap:' | awk {'print $2'}` MB" WAIT TO swaptotal |
|
301 |
'Obliczanie zajętości swap
|
|
302 |
SHELL "swapon -s | awk {'print $3'} | sed -n '2p'" WAIT TO totalswap |
|
303 |
SHELL "swapon -s | awk {'print $4'} | sed -n '2p'" WAIT TO usedswap |
|
304 |
TextArea39.Text = total
|
|
305 |
TextArea40.Text = used
|
|
306 |
TextArea41.Text = freee
|
|
307 |
TextArea42.Text = shared
|
|
308 |
TextArea43.Text = buffers
|
|
309 |
TextArea44.Text = cached
|
|
310 |
TextLabel7.Text = usedonthistime
|
|
311 |
TextArea45.Text = swaptotal
|
|
312 |
TextLabel24.Text = usedswap / 1000
|
|
313 |
SHELL "uptime" TO uptime
|
|
314 |
TextArea37.Text = uptime
|
|
315 |
|
|
316 |
ProgressBar1.Value = dospam / totpam
|
|
317 |
ProgressBar4.Value = usedswap / totalswap
|
|
318 |
||
319 |
END
|
|
320 |
||
321 |
PUBLIC SUB Button3_Click()
|
|
322 |
||
323 |
About.Show
|
|
324 |
||
325 |
END
|
|
326 |
||
327 |
PUBLIC SUB Button5_Click()
|
|
328 |
||
329 |
dospam_uptime()
|
|
330 |
||
331 |
END
|
|
332 |
||
333 |
PUBLIC SUB Button6_Click()
|
|
334 |
||
335 |
dospam_uptime()
|
|
336 |
||
337 |
END
|
|
338 |
||
339 |
PUBLIC SUB Button4_Click()
|
|
340 |
||
341 |
Desktop.Open("http://www.cpu-world.com/cgi-bin/SearchSite.pl?SEARCH=" & TextArea1.Text & "&PROCESS=Search")
|
|
342 |
||
343 |
END
|
|
344 |
||
345 |
PUBLIC SUB Button7_Click()
|
|
346 |
DIM dpkg AS String
|
|
347 |
SHELL "cat /var/lib/dpkg/status | grep '^Status: install ok installed' | wc -l" WAIT TO dpkg |
|
348 |
TextLabel10.Visible = TRUE
|
|
349 |
TextArea28.Visible = TRUE
|
|
350 |
TextLabel21.Visible = TRUE
|
|
351 |
TextArea28.Text = dpkg
|
|
352 |
||
353 |
END
|
|
354 |
||
355 |
PUBLIC SUB Button9_Click()
|
|
356 |
||
357 |
Last1.Show
|
|
358 |
||
359 |
END
|
|
360 |
||
361 |
PUBLIC SUB Button8_Click()
|
|
362 |
||
363 |
SHELL "xrandr -s " & ComboBox2.Text & "" WAIT
|
|
364 |
grafika()
|
|
365 |
||
366 |
END
|
|
367 |
||
368 |
PUBLIC SUB Button10_Click()
|
|
369 |
'sudo apt-get -y remove |
|
370 |
EXEC ["gksu", "sudo apt-get -y remove " & ComboBox3.Text & ""] WAIT |
|
371 |
kernel() |
|
372 |
Message.Warning("Dla poprawności tego działania proszę\nzaktualizuj gruba poleceniem = sudo update-grub") |
|
373 |
END
|