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

Improve CircularProgressBar.py #66

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

AhmedSaadi0
Copy link
Contributor

  • Improve overall class
  • Add start_at
  • Add end_at
  • Add child

@AhmedSaadi0
Copy link
Contributor Author

2024-12-27-054202_hyprshot

@AhmedSaadi0
Copy link
Contributor Author

Sorry I deleted min_value and max_value as that added more complexity to the draw function especially when start_at, and end_at are set 😬

@its-darsh its-darsh self-assigned this Dec 27, 2024
@its-darsh its-darsh added the enhancement New feature or request label Dec 27, 2024
@AhmedSaadi0
Copy link
Contributor Author

I'll try to reimplement it as soon as I get extra free time 🙃.

@its-darsh
Copy link
Contributor

This looks like a complete rework, I'd rather have all other properties existing as they were before, we're not looking for compatibility issues before any releases

I have a couple of notes though...


You can normalize the current value based on self's [max/min]_value
image


Internal methods should follow PyGObject's naming (prefixed with do_)


Consider using the Ruff formatter for file post-formatting

@AhmedSaadi0
Copy link
Contributor Author

I think now is ready

       self.widget = CircularProgressBar(
            # pie=True,
            size=24,
            line_width=1,
            name=name,
            style_classes=style_classes,
            value=initial_value,
            line_style="round",
            tooltip_text=f"{tooltip_text} ({initial_value})",
            child=child,
            start_at=0,
            end_at=0.5,
            min_value=0,
            max_value=100,
        )
        self.fabricator = Fabricator(
            poll_from=poll_from,
            interval=interval,
            stream=stream,
        )
        self.fabricator.connect("changed", self.update_widget)

2024-12-28-110840_hyprshot

@AhmedSaadi0
Copy link
Contributor Author

AhmedSaadi0 commented Dec 28, 2024

css style

.cpu {
  background: rgba($color: $secondary, $alpha: 0.4);
  color: rgba($secondary, 0);
  border: solid 4px rgba($secondary, 1);
}

.cpu label {
  font-family: $icon-font-family;
  font-size: 0.8rem;
  color: $secondary;
}

@AhmedSaadi0
Copy link
Contributor Author

AhmedSaadi0 commented Dec 28, 2024

I’m also considering setting radius_color = Gdk.RGBA(0.0, 0.0, 0.0, 0.0) by default. This is because the background property in CSS already handles setting the background color based on the start_at and end_at values. Therefore, there's no need to explicitly define the radius_color, as the background defined by CSS will already cover this area, so this will be the css

.cpu {
  background: rgba($color: $secondary, $alpha: 0.4); // Draws the circle background
  // color: rgba($secondary, 0); // Not needed
  border: solid 4px rgba($secondary, 1); // Draws the progress
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants