this post was submitted on 09 Feb 2025
31 points (100.0% liked)

Python

6628 readers
116 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

๐Ÿ“… Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

๐Ÿ Python project:
๐Ÿ’“ Python Community:
โœจ Python Ecosystem:
๐ŸŒŒ Fediverse
Communities
Projects
Feeds

founded 2 years ago
MODERATORS
 

I'm working on a project that needs lots of toolbars on screen at once, even though not all of them will be used at the same time. So, I'm modelling this 'foldable' dock widget after what I remember Photoshop panels used to be like.

It's a work in progress, but would like to hear constructive suggestions.

https://blocks.programming.dev/0101100101/42c5d67f86c049baa3500aa38e439f8a

you are viewing a single comment's thread
view the rest of the comments
[โ€“] logging_strict@programming.dev 1 points 1 day ago* (last edited 1 day ago)
from PySide6.QtWidgets import QDockWidget, QWidget, QToolButton, QStyle, QHBoxLayout, QStyleFactory, QSizePolicy, \
    QApplication, QVBoxLayout, QLabel, QSlider, QMainWindow, QSizeGrip

No code should be more than 80 characters UNLESS it's unavoidable like with a long regex. Hard limit is normally 88 characters.

Should be

from PySide6.QtWidgets import (
    QDockWidget,
    QWidget,
    QToolButton,
    QStyle,
    QHBoxLayout,
    QStyleFactory,
    QSizePolicy,
    QApplication,
    QVBoxLayout,
    QLabel,
    QSlider,
    QMainWindow,
    QSizeGrip,
)

Or add parenthesis and the last comma. black will reformat it. Then use isort to fix imports ordering.

Get that you are sharing this as a gist. Normally code like this is broken up into multiple modules so it's easier on the eyes and less going on.