-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the badge icon in the profile screen
- Loading branch information
1 parent
17a30c1
commit 559c863
Showing
11 changed files
with
109 additions
and
18 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,25 @@ | ||
#:kivy 2.2.1 | ||
|
||
<-CircleIconButton>: | ||
|
||
fit_mode: "cover" # the image will be cropped at the right spot | ||
|
||
canvas: | ||
Color: | ||
rgba: self.color | ||
StencilPush | ||
RoundedRectangle: | ||
pos: self.pos | ||
size: self.size | ||
radius: [100] | ||
StencilUse | ||
Rectangle: | ||
texture: self.texture | ||
size: self.norm_image_size | ||
pos: self.center_x - self.norm_image_size[0] / 2., self.center_y - self.norm_image_size[1] / 2. | ||
StencilUnUse | ||
RoundedRectangle: | ||
pos: self.pos | ||
size: self.size | ||
radius: [100] | ||
StencilPop |
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,54 @@ | ||
""" | ||
Module to create custom buttons with round transparent white background. | ||
""" | ||
|
||
############### | ||
### Imports ### | ||
############### | ||
|
||
### Kivy imports ### | ||
from kivy.uix.image import Image | ||
from kivy.uix.behaviors import ButtonBehavior | ||
from kivy.properties import ( | ||
BooleanProperty | ||
) | ||
|
||
### Local imports ### | ||
|
||
from tools.constants import ( | ||
OPACITY_ON_BUTTON_PRESS | ||
) | ||
|
||
############# | ||
### Class ### | ||
############# | ||
|
||
|
||
class CircleIconButton(ButtonBehavior, Image): | ||
""" | ||
A custom button with a white round rectangle background. | ||
""" | ||
|
||
disable_button = BooleanProperty() | ||
|
||
def __init__( | ||
self, | ||
release_function=lambda: 1 + 1, | ||
**kwargs): | ||
super().__init__(**kwargs) | ||
self.always_release = True | ||
self.release_function = release_function | ||
self.bind(disable_button=self.bind_function) | ||
|
||
def bind_function(self, base_widget, value): | ||
pass | ||
|
||
def on_press(self): | ||
if not self.disable_button: | ||
self.opacity = OPACITY_ON_BUTTON_PRESS | ||
|
||
def on_release(self): | ||
if not self.disable_button: | ||
self.release_function() | ||
self.opacity = 1 | ||
|
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