Skip to content

File not found error when battery percentage nears 0 #3341

Description

@joseppc

When the battery is 5% or less, the application crashes with .../pixmaps/blueman-battery-0.png”: No such file or directory (4). Backtrace:

ManagerDeviceList.py:528:_update_power_levels:gi.repository.GLib.GError: g-file-error-quark: Failed to open file “/usr/share/blueman/pixmaps/blueman-battery-0.png”: No such file or directory (4)

Traceback (most recent call last):
  File "/usr/lib/python3.14/site-packages/blueman/gui/manager/ManagerDeviceList.py", line 443, in _check_power_levels
    self._update_power_levels(tree_iter, device, cinfo)
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.14/site-packages/blueman/gui/manager/ManagerDeviceList.py", line 528, in _update_power_levels
    icon = GdkPixbuf.Pixbuf.new_from_file_at_scale(os.path.join(PIXMAP_PATH, icon_name), w, h, True)
gi.repository.GLib.GError: g-file-error-quark: Failed to open file “/usr/share/blueman/pixmaps/blueman-battery-0.png”: No such file or directory (4)

Local variables in innermost frame:
self: <ManagerDeviceList.ManagerDeviceList object at 0x7f77f9c9da00 (blueman+gui+manager+ManagerDeviceList+ManagerDeviceList at 0x5613c8d668e0)>
tree_iter: <Gtk.TreeIter object at 0x7f77f9d49a20 (GtkTreeIter at 0x5613c91e8710)>
device: <Device.Device object at 0x7f77f9ccf740 (blueman+bluez+Device+Device at 0x5613c8e1f980)>
cinfo: <_blueman.conn_info object at 0x7f77fa4ce730>
row: {'cell_fader': <GtkAnimation.CellFade object at 0x7f77f9cb5d00 (blueman+gui+GtkAnimation+CellFade at 0x5613c8e26060)>, 'battery': 14.0, 'rssi': 100.0, 'tpl': 100.0}
bars: {'battery': 5, 'rssi': 100.0, 'tpl': 100.0}
obj_path: '/org/bluez/hci0/dev_90_E5_B1_6C_6D_5A'
w: 14
h: 48
name: 'battery'
perc: 5
icon_name: 'blueman-battery-0.png'

This rounding returns 0 when perc is 5 or less:

path = PIXMAP_PATH / f"blueman-{name}-{int(round(perc, -1))}.png"

but the file blueman-battery-0.png is not available in pixmaps.

It possibly affects the other fields in the bars dictionary that lack an icon when the percentage nears 0.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions