-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
96 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "ubo-gui" | ||
version = "0.11.18" | ||
version = "0.12.0" | ||
description = "GUI sdk for Ubo Pod" | ||
authors = ["Sassan Haradji <[email protected]>"] | ||
license = "Apache-2.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
|
||
<RootWidget>: | ||
FloatLayout: | ||
id: main_layout | ||
size: root.size | ||
pos: root.pos | ||
orientation: 'vertical' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"""Notification widget.""" | ||
|
||
from __future__ import annotations | ||
|
||
import pathlib | ||
|
||
from kivy.lang.builder import Builder | ||
from kivy.metrics import dp | ||
from kivy.properties import ColorProperty, NumericProperty | ||
from kivy.uix.widget import Widget | ||
|
||
|
||
class ProgressRingWidget(Widget): | ||
"""renders a progress ring.""" | ||
|
||
progress: float = NumericProperty(defaultvalue=0, min=0, max=1) | ||
band_width: int = NumericProperty(defaultvalue=dp(4)) | ||
background_color = ColorProperty() | ||
color = ColorProperty() | ||
|
||
_progress: int = NumericProperty() | ||
|
||
|
||
Builder.load_file( | ||
pathlib.Path(__file__) | ||
.parent.joinpath('progress_ring_widget.kv') | ||
.resolve() | ||
.as_posix(), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#:kivy 2.3.0 | ||
|
||
<ProgressRingWidget>: | ||
_progress: int(self.progress * 360) | ||
width: min(*self.size) | ||
height: min(*self.size) | ||
|
||
canvas.before: | ||
Color: | ||
rgba: self.background_color | ||
|
||
Ellipse: | ||
pos: self.pos | ||
size: self.size | ||
angle_start: 0 | ||
angle_end: 360 | ||
|
||
Color: | ||
rgba: self.color | ||
|
||
Ellipse: | ||
pos: [i + dp(1) for i in self.pos] | ||
size: [i - dp(2) for i in self.size] | ||
angle_start: 0 | ||
angle_end: self._progress | ||
|
||
Color: | ||
rgba: self.background_color | ||
|
||
Ellipse: | ||
pos: [i + dp(1) + self.band_width for i in self.pos] | ||
size: [i - dp(2) - 2 * self.band_width for i in self.size] | ||
angle_start: 0 | ||
angle_end: 360 | ||
|
||
Color: | ||
rgb: 0, 0 ,0 | ||
|
||
Ellipse: | ||
pos: [i + dp(2) + self.band_width for i in self.pos] | ||
size: [i - dp(4) - 2 * self.band_width for i in self.size] | ||
angle_start: 0 | ||
angle_end: 360 |