Easily above average code for Python. I'm going to pick on one method:
def _set_float_icon(self, is_floating: bool):
""" set the float icon depending on the status of the parent dock widget """
if is_floating:
self.float_button.setIcon(self.icon_dock)
else:
self.float_button.setIcon(self.icon_float)
First, Python does have ternary expressions so you can
self.float_button.setIcon(self.icon_dock if is_floating else self.icon_float)
Second, what does this code do?
foo._set_float_icon(true)
Kind of surprising that it sets the icon to icon_dock
right? There are two easy fixes:
- Use
*, is_floating: bool
so you have to name the parameter when you call it. - I'd probably rename it to
_update_float_icon()
or something.
Also use Black or Ruff to auto-format your code (it's pretty well formatted already but those will still improve it and for zero effort).