Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Add GroupBoxRule import line to docs #362

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions qtile_extras/widget/groupbox2.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,20 +612,23 @@ class GroupBox2(base._Widget, base.MarginMixin, base.PaddingMixin):

Block:

Block is a rectangle that can be filled (with `block_colour`) and/or have an outline (with `block_border_width` and
`block_border_colour`). The corners of the rectangle can be curved by setting the `block_corner_radius` value.
Block is a rectangle that can be filled (with ``block_colour``) and/or have an outline (with ``block_border_width`` and
``block_border_colour``). The corners of the rectangle can be curved by setting the ``block_corner_radius`` value.

The block is positioned by using the `margin(_x)` and `margin_y` attributes. NB Currently, these are global for the widget
The block is positioned by using the ``margin(_x)`` and ``margin_y`` attributes. NB Currently, these are global for the widget
and cannot be set by rules.

Line:

Line is a straight line on the edge of the widget. A line will be drawn at the bottom of the box by default (when a `line_colour`
and `line_width have been set). The position of lines can be changed by setting the `line_position` attribute with
a LinePosition flag. For example to drawn lines at the top and bottom of the box you would set the `line_position` value to:
Line is a straight line on the edge of the widget. A line will be drawn at the bottom of the box by default (when a ``line_colour``
and ``line_width`` have been set). The position of lines can be changed by setting the ``line_position`` attribute with
a ``LinePosition`` flag. For example to drawn lines at the top and bottom of the box you would set the ``line_position`` value to:

.. code:: python

from qtile_extras.widget.groupbox2 import GroupBoxRule


GroupBoxRule.LINE_TOP | GroupBoxRule.LINE_BOTTOM

NB the line will be rendered at the edge of the box i.e. it is not currently offset by the margin value.
Expand All @@ -652,6 +655,9 @@ class GroupBox2(base._Widget, base.MarginMixin, base.PaddingMixin):

.. code:: python

from qtile_extras.widget.groupbox2 import GroupBoxRule


def draw_red_square(box):

w = 10
Expand Down Expand Up @@ -680,6 +686,9 @@ def draw_red_square(box):

.. code:: python

from qtile_extras.widget.groupbox2 import GroupBoxRule


GroupBoxRule(text_colour="00ffff").when(focused=False, occupied=True)
# ^ ^
# Format set via constructor Conditions set via when() method
Expand Down Expand Up @@ -731,6 +740,9 @@ def draw_red_square(box):

.. code:: python

from qtile_extras.widget.groupbox2 import GroupBoxRule


def has_vlc(rule, box):
for win in box.group.windows:
if "VLC" in win.name:
Expand All @@ -747,6 +759,9 @@ def has_vlc(rule, box):

.. code:: python

from qtile_extras.widget.groupbox2 import GroupBoxRule


def set_label(rule, box):
if box.focused:
rule.text = "◉"
Expand All @@ -771,6 +786,9 @@ def set_label(rule, box):

.. code:: python

from qtile_extras.widget.groupbox2 import GroupBoxRule


rules = [
GroupBoxRule(block_colour="009999").when(screen=GroupBoxRule.SCREEN_THIS),
GroupBoxRule(block_colour="999999").when(occupied=True),
Expand Down
Loading