-
-
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.
- Loading branch information
1 parent
bd2aef3
commit dd78112
Showing
10 changed files
with
139 additions
and
11 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
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,49 @@ | ||
#:kivy 2.2.1 | ||
#:import PATH_IMAGES tools.path.PATH_IMAGES | ||
|
||
<ThreeStars>: | ||
|
||
# Star one | ||
Image: | ||
id: star_one_contour | ||
pos_hint: {"center_x":0.125,"center_y":0.5} | ||
size_hint: (0.25,1) | ||
source: PATH_IMAGES + "star.png" | ||
fit_mode: "contain" | ||
Image: | ||
id: star_one | ||
pos_hint: {"center_x":0.125,"center_y":0.5} | ||
size_hint: (0.25,1) | ||
source: PATH_IMAGES + "star_full.png" | ||
fit_mode: "contain" | ||
color: root.star_one_color | ||
|
||
# Star two | ||
Image: | ||
id: star_two_contour | ||
pos_hint: {"center_x":0.5,"center_y":0.5} | ||
size_hint: (0.25,1) | ||
source: PATH_IMAGES + "star.png" | ||
fit_mode: "contain" | ||
Image: | ||
id: star_two | ||
pos_hint: {"center_x":0.5,"center_y":0.5} | ||
size_hint: (0.25,1) | ||
source: PATH_IMAGES + "star_full.png" | ||
fit_mode: "contain" | ||
color: root.star_two_color | ||
|
||
# Star three | ||
Image: | ||
id: star_three_contour | ||
pos_hint: {"center_x":0.875,"center_y":0.5} | ||
size_hint: (0.25,1) | ||
source: PATH_IMAGES + "star.png" | ||
fit_mode: "contain" | ||
Image: | ||
id: star_three_contour | ||
pos_hint: {"center_x":0.875,"center_y":0.5} | ||
size_hint: (0.25,1) | ||
source: PATH_IMAGES + "star_full.png" | ||
fit_mode: "contain" | ||
color: root.star_three_color |
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,63 @@ | ||
""" | ||
Module to create three stars with a certain filling ratio | ||
""" | ||
|
||
############### | ||
### Imports ### | ||
############### | ||
|
||
### Kivy imports ### | ||
from kivy.uix.widget import Widget | ||
from kivy.uix.relativelayout import RelativeLayout | ||
from kivy.properties import ( | ||
NumericProperty, | ||
ListProperty | ||
) | ||
|
||
############# | ||
### Class ### | ||
############# | ||
|
||
|
||
class ThreeStars(RelativeLayout): | ||
|
||
star_one_color = ListProperty([0.5, 0.5, 0.5, 1.]) | ||
star_two_color = ListProperty([0.5, 0.5, 0.5, 1.]) | ||
star_three_color = ListProperty([0.5, 0.5, 0.5, 1.]) | ||
star_color_dict = {1: star_one_color, | ||
2: star_two_color, | ||
3: star_three_color} | ||
stars_number = NumericProperty() | ||
primary_color = ListProperty([0.5, 0.5, 0.5, 1.]) | ||
secondary_color = ListProperty([1., 1., 1., 1.]) | ||
|
||
def __init__( | ||
self, | ||
primary_color=[1., 1., 1., 1.], | ||
secondary_color=[0.5, 0.5, 0.5, 1.], | ||
**kwargs): | ||
|
||
self.primary_color = primary_color | ||
self.secondary_color = secondary_color | ||
|
||
self.bind(stars_number=self.change_stars_number) | ||
super().__init__(**kwargs) | ||
|
||
def change_stars_number(self, base_widget, value): | ||
""" | ||
Change the number of stars displayed. | ||
""" | ||
|
||
# self.stars_number = stars_number | ||
if self.stars_number > 0: | ||
self.star_one_color = self.primary_color | ||
else: | ||
self.star_one_color = self.secondary_color | ||
if self.stars_number > 1: | ||
self.star_two_color = self.primary_color | ||
else: | ||
self.star_two_color = self.secondary_color | ||
if self.stars_number > 2: | ||
self.star_three_color = self.primary_color | ||
else: | ||
self.star_three_color = self.secondary_color |
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 |
---|---|---|
|
@@ -15,7 +15,6 @@ | |
) | ||
from tools.kivy_tools import ( | ||
ImprovedScreen, | ||
ImageButton | ||
) | ||
|
||
|
||
|
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