Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
atareao committed Sep 8, 2024
2 parents 3d41c12 + 1ee9efa commit 9a6aaff
Show file tree
Hide file tree
Showing 7 changed files with 207 additions and 72 deletions.
1 change: 1 addition & 0 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Depends: ${misc:Depends}, ${python:Depends},
python3-cairocffi,
gir1.2-gtk-3.0,
gir1.2-gdkpixbuf-2.0,
glxinfo,
wmctrl,
mesa-utils
Description: CPU-G shows useful information about your computer
Expand Down
41 changes: 41 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[project]
name = "cpu-g"
version = "0.16.3"
description = "Add your description here"
authors = [
{ name = "Lorenzo Carbonell <[email protected]", email = "[email protected]" }
]
dependencies = [
"cycler==0.12.1",
"contourpy==1.2.0",
"dbus-python==1.3.2",
"fonttools==4.47.0",
"kiwisolver==1.4.5",
"matplotlib==3.8.2",
"numpy==1.26.3",
"packaging==23.2",
"pillow==10.2.0",
"psutil==5.9.7",
"pycairo==1.25.1",
"pygobject==3.46.0",
"pyparsing==3.1.1",
"python-dateutil==2.8.2",
"six==1.16.0",
]
readme = "README.md"
requires-python = ">= 3.8"
license = { text = "MIT" }

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.rye]
managed = true
dev-dependencies = []

[tool.hatch.metadata]
allow-direct-references = true

[tool.hatch.build.targets.wheel]
packages = ["src/cpu_g"]
54 changes: 54 additions & 0 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# generated by rye
# use `rye lock` or `rye sync` to update this lockfile
#
# last locked with the following flags:
# pre: false
# features: []
# all-features: false
# with-sources: false
# generate-hashes: false
# universal: false

-e file:.
contourpy==1.2.0
# via cpu-g
# via matplotlib
cycler==0.12.1
# via cpu-g
# via matplotlib
dbus-python==1.3.2
# via cpu-g
fonttools==4.47.0
# via cpu-g
# via matplotlib
kiwisolver==1.4.5
# via cpu-g
# via matplotlib
matplotlib==3.8.2
# via cpu-g
numpy==1.26.3
# via contourpy
# via cpu-g
# via matplotlib
packaging==23.2
# via cpu-g
# via matplotlib
pillow==10.2.0
# via cpu-g
# via matplotlib
psutil==5.9.7
# via cpu-g
pycairo==1.25.1
# via cpu-g
# via pygobject
pygobject==3.46.0
# via cpu-g
pyparsing==3.1.1
# via cpu-g
# via matplotlib
python-dateutil==2.8.2
# via cpu-g
# via matplotlib
six==1.16.0
# via cpu-g
# via python-dateutil
54 changes: 54 additions & 0 deletions requirements.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# generated by rye
# use `rye lock` or `rye sync` to update this lockfile
#
# last locked with the following flags:
# pre: false
# features: []
# all-features: false
# with-sources: false
# generate-hashes: false
# universal: false

-e file:.
contourpy==1.2.0
# via cpu-g
# via matplotlib
cycler==0.12.1
# via cpu-g
# via matplotlib
dbus-python==1.3.2
# via cpu-g
fonttools==4.47.0
# via cpu-g
# via matplotlib
kiwisolver==1.4.5
# via cpu-g
# via matplotlib
matplotlib==3.8.2
# via cpu-g
numpy==1.26.3
# via contourpy
# via cpu-g
# via matplotlib
packaging==23.2
# via cpu-g
# via matplotlib
pillow==10.2.0
# via cpu-g
# via matplotlib
psutil==5.9.7
# via cpu-g
pycairo==1.25.1
# via cpu-g
# via pygobject
pygobject==3.46.0
# via cpu-g
pyparsing==3.1.1
# via cpu-g
# via matplotlib
python-dateutil==2.8.2
# via cpu-g
# via matplotlib
six==1.16.0
# via cpu-g
# via python-dateutil
15 changes: 0 additions & 15 deletions requirements.txt

This file was deleted.

50 changes: 25 additions & 25 deletions src/cpug.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import datetime
import sys
from matplotlib.figure import Figure
from matplotlib.backends.backend_gtk3cairo import FigureCanvasGTK3Cairo as\
from matplotlib.backends.backend_gtk3cairo import FigureCanvasGTK3Cairo as \
FigureCanvas
import matplotlib.ticker as ticker
from investigator import Investigator
Expand All @@ -49,7 +49,7 @@


class CPUG(Gtk.Window):
"""Description"""

def __init__(self):
Gtk.Window.__init__(self)
self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
Expand Down Expand Up @@ -1054,45 +1054,45 @@ def get_battery_duration(self):
self.battery_data2.set_text('--')
current_level = bd.get_percentage()
self.battery_level_value.set_text(
locale.format('%.2f', current_level) + _(' %'))
locale.format_string('%.2f', current_level) + _(' %'))
self.battery_level.set_value(current_level)
inv = Investigator()
self.battery_capacity_level.set_text(
'%s' % inv.battery_info('capacity-level'))
self._aux_set_text(
self.battery_voltage_now,
inv.battery_info('voltage-now'),
locale.format(
locale.format_string(
'%.2f',
inv.battery_info('voltage-now')/1000000) + _(' V'))
self._aux_set_text(
self.battery_min_voltage_design,
inv.battery_info('voltage-min-design'),
locale.format(
locale.format_string(
'%.2f',
inv.battery_info('voltage-min-design')/1000000) + _(' V'))
self._aux_set_text(
self.battery_charge_now,
inv.battery_info('charge-now'),
locale.format(
locale.format_string(
'%.2f',
inv.battery_info('charge-now')/1000000) + _(' Ah'))
self._aux_set_text(
self.battery_charge_full,
inv.battery_info('charge-full'),
locale.format(
locale.format_string(
'%.2f',
inv.battery_info('charge-full')/1000000) + _(' Ah'))
self._aux_set_text(
self.battery_charge_full_design,
inv.battery_info('charge-full-design'),
locale.format(
locale.format_string(
'%.2f',
inv.battery_info('charge-full-design')/1000000) + _(' Ah'))
self._aux_set_text(
self.battery_current_now,
inv.battery_info('current-now'),
locale.format(
locale.format_string(
'%.2f',
inv.battery_info('current-now')/1000000) + _(' A'))
return True
Expand All @@ -1104,40 +1104,40 @@ def uptime_update(self):
def ram_update(self):
values = Investigator().raminfo()
self.ram_total.set_text(
locale.format('%.1f', values['total'], True) + ' ' + _('MB'))
locale.format_string('%.1f', values['total'], True) + ' ' + _('MB'))
self.ram_available.set_text(
locale.format('%.1f', values['available'], True) + ' ' + _('MB'))
locale.format_string('%.1f', values['available'], True) + ' ' + _('MB'))
self.ram_available_progress.set_value(
values['available']/values['total'])
self.ram_used.set_text(
locale.format('%.1f', values['used'], True) + ' ' + _('MB'))
locale.format_string('%.1f', values['used'], True) + ' ' + _('MB'))
self.ram_used_progress.set_value(values['used']/values['total'])
self.ram_free.set_text(
locale.format('%.1f', values['free'], True) + ' ' + _('MB'))
locale.format_string('%.1f', values['free'], True) + ' ' + _('MB'))
self.ram_free_progress.set_value(values['free']/values['total'])
self.ram_active.set_text(
locale.format('%.1f', values['active'], True) + ' ' + _('MB'))
locale.format_string('%.1f', values['active'], True) + ' ' + _('MB'))
self.ram_inactive.set_text(
locale.format('%.1f', values['inactive'], True) + ' ' + _('MB'))
locale.format_string('%.1f', values['inactive'], True) + ' ' + _('MB'))
self.ram_buffers.set_text(
locale.format('%.1f', values['buffers'], True) + ' ' + _('MB'))
locale.format_string('%.1f', values['buffers'], True) + ' ' + _('MB'))
self.ram_cached.set_text(
locale.format('%.1f', values['cached'], True) + ' ' + _('MB'))
locale.format_string('%.1f', values['cached'], True) + ' ' + _('MB'))
values = Investigator().swapinfo()
self.swap_total.set_text(
locale.format('%.1f', values['total'], True) + ' ' + _('MB'))
locale.format_string('%.1f', values['total'], True) + ' ' + _('MB'))
if values['total'] == 0:
values['total'] = 1
self.swap_used.set_text(
locale.format('%.1f', values['used'], True) + ' ' + _('MB'))
locale.format_string('%.1f', values['used'], True) + ' ' + _('MB'))
self.swap_used_progress.set_value(values['used']/values['total'])
self.swap_free.set_text(
locale.format('%.1f', values['free'], True) + ' ' + _('MB'))
locale.format_string('%.1f', values['free'], True) + ' ' + _('MB'))
self.swap_free_progress.set_value(values['free']/values['total'])
self.swap_sin.set_text(
locale.format('%.1f', values['sin'], True) + ' ' + _('MB'))
locale.format_string('%.1f', values['sin'], True) + ' ' + _('MB'))
self.swap_sout.set_text(
locale.format('%.1f', values['sout'], True) + ' ' + _('MB'))
locale.format_string('%.1f', values['sout'], True) + ' ' + _('MB'))
return True

def close_application(self, widget):
Expand Down Expand Up @@ -1266,7 +1266,7 @@ def update_info(self):
xoptions=Gtk.AttachOptions.FILL,
yoptions=Gtk.AttachOptions.FILL,
xpadding=5, ypadding=5)
entry.set_text(locale.format(
entry.set_text(locale.format_string(
'%.2f', device['total']/1024/1024, True) + ' ' + _('MB'))
label = Gtk.Label(_('Used space'))
label.set_alignment(0, 0.5)
Expand All @@ -1279,7 +1279,7 @@ def update_info(self):
xoptions=Gtk.AttachOptions.FILL,
yoptions=Gtk.AttachOptions.FILL,
xpadding=5, ypadding=5)
entry.set_text(locale.format(
entry.set_text(locale.format_string(
'%.2f', device['used']/1024/1024, True) + ' ' + _('MB'))
disk_used_progress = Gtk.LevelBar()
disk_used_progress.set_min_value(0)
Expand All @@ -1300,7 +1300,7 @@ def update_info(self):
xoptions=Gtk.AttachOptions.FILL,
yoptions=Gtk.AttachOptions.FILL,
xpadding=5, ypadding=5)
entry.set_text(locale.format(
entry.set_text(locale.format_string(
'%.2f', device['free']/1024/1024, True) + ' ' + _('MB'))
disk_free_progress = Gtk.LevelBar()
disk_free_progress.set_min_value(0)
Expand Down
Loading

0 comments on commit 9a6aaff

Please sign in to comment.