| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 078918e commit 98c4c66
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -645,8 +645,8 @@ def __draw_rounded_rect_with_border_vertical_split_font_shapes(self, width: int, | |||
| 645 | 645 | return requires_recoloring | |
| 646 | 646 | ||
| 647 | 647 | def draw_rounded_progress_bar_with_border(self, width: Union[float, int], height: Union[float, int], corner_radius: Union[float, int], | |
| 648 | - border_width: Union[float, int], progress_value: float, orientation: str) -> bool: | ||
| 649 | - """ Draws a rounded bar on the canvas, which is split in half according to the argument 'progress_value' (0 - 1). | ||
| 648 | + border_width: Union[float, int], progress_value_1: float, progress_value_2: float, orientation: str) -> bool: | ||
| 649 | + """ Draws a rounded bar on the canvas, and onntop sits a progress bar from value 1 to value 2 (range 0-1, left to right, bottom to top). | ||
| 650 | 650 | The border elements get the 'border_parts' tag", the main elements get the 'inner_parts' tag and | |
| 651 | 651 | the progress elements get the 'progress_parts' tag. The 'orientation' argument defines from which direction the progress starts (n, w, s, e). | |
| 652 | 652 | ||
@@ -668,13 +668,13 @@ def draw_rounded_progress_bar_with_border(self, width: Union[float, int], height | |||
| 668 | 668 | ||
| 669 | 669 | if self.preferred_drawing_method == "polygon_shapes" or self.preferred_drawing_method == "circle_shapes": | |
| 670 | 670 | return self.__draw_rounded_progress_bar_with_border_polygon_shapes(width, height, corner_radius, border_width, inner_corner_radius, | |
| 671 | - progress_value, orientation) | ||
| 671 | + progress_value_1, progress_value_2, orientation) | ||
| 672 | 672 | elif self.preferred_drawing_method == "font_shapes": | |
| 673 | 673 | return self.__draw_rounded_progress_bar_with_border_font_shapes(width, height, corner_radius, border_width, inner_corner_radius, | |
| 674 | - progress_value, orientation) | ||
| 674 | + progress_value_1, progress_value_2, orientation) | ||
| 675 | 675 | ||
| 676 | 676 | def __draw_rounded_progress_bar_with_border_polygon_shapes(self, width: int, height: int, corner_radius: int, border_width: int, inner_corner_radius: int, | |
| 677 | - progress_value: float, orientation: str) -> bool: | ||
| 677 | + progress_value_1: float, progress_value_2: float, orientation: str) -> bool: | ||
| 678 | 678 | ||
| 679 | 679 | requires_recoloring = self.__draw_rounded_rect_with_border_polygon_shapes(width, height, corner_radius, border_width, inner_corner_radius) | |
| 680 | 680 | ||
@@ -691,32 +691,32 @@ def __draw_rounded_progress_bar_with_border_polygon_shapes(self, width: int, hei | |||
| 691 | 691 | ||
| 692 | 692 | if orientation == "w": | |
| 693 | 693 | self._canvas.coords("progress_line_1", | |
| 694 | + border_width + inner_corner_radius + (width - 2 * border_width - 2 * inner_corner_radius) * progress_value_1, | ||
| 694 | 695 | border_width + inner_corner_radius, | |
| 696 | + border_width + inner_corner_radius + (width - 2 * border_width - 2 * inner_corner_radius) * progress_value_2, | ||
| 695 | 697 | border_width + inner_corner_radius, | |
| 696 | - border_width + inner_corner_radius + (width - 2 * border_width - 2 * inner_corner_radius) * progress_value, | ||
| 697 | - border_width + inner_corner_radius, | ||
| 698 | - border_width + inner_corner_radius + (width - 2 * border_width - 2 * inner_corner_radius) * progress_value, | ||
| 698 | + border_width + inner_corner_radius + (width - 2 * border_width - 2 * inner_corner_radius) * progress_value_2, | ||
| 699 | 699 | height - (border_width + inner_corner_radius) + bottom_right_shift, | |
| 700 | - border_width + inner_corner_radius, | ||
| 700 | + border_width + inner_corner_radius + (width - 2 * border_width - 2 * inner_corner_radius) * progress_value_1, | ||
| 701 | 701 | height - (border_width + inner_corner_radius) + bottom_right_shift) | |
| 702 | 702 | ||
| 703 | 703 | elif orientation == "s": | |
| 704 | 704 | self._canvas.coords("progress_line_1", | |
| 705 | 705 | border_width + inner_corner_radius, | |
| 706 | - border_width + inner_corner_radius + (height - 2 * border_width - 2 * inner_corner_radius) * (1 - progress_value), | ||
| 706 | + border_width + inner_corner_radius + (height - 2 * border_width - 2 * inner_corner_radius) * (1 - progress_value_2), | ||
| 707 | 707 | width - (border_width + inner_corner_radius), | |
| 708 | - border_width + inner_corner_radius + (height - 2 * border_width - 2 * inner_corner_radius) * (1 - progress_value), | ||
| 708 | + border_width + inner_corner_radius + (height - 2 * border_width - 2 * inner_corner_radius) * (1 - progress_value_2), | ||
| 709 | 709 | width - (border_width + inner_corner_radius), | |
| 710 | - height - (border_width + inner_corner_radius) + bottom_right_shift, | ||
| 710 | + border_width + inner_corner_radius + (height - 2 * border_width - 2 * inner_corner_radius) * (1 - progress_value_1), | ||
| 711 | 711 | border_width + inner_corner_radius, | |
| 712 | - height - (border_width + inner_corner_radius) + bottom_right_shift) | ||
| 712 | + border_width + inner_corner_radius + (height - 2 * border_width - 2 * inner_corner_radius) * (1 - progress_value_1)) | ||
| 713 | 713 | ||
| 714 | 714 | self._canvas.itemconfig("progress_line_1", width=inner_corner_radius * 2) | |
| 715 | 715 | ||
| 716 | 716 | return requires_recoloring | |
| 717 | 717 | ||
| 718 | 718 | def __draw_rounded_progress_bar_with_border_font_shapes(self, width: int, height: int, corner_radius: int, border_width: int, inner_corner_radius: int, | |
| 719 | - progress_value: float, orientation: str) -> bool: | ||
| 719 | + progress_value_1: float, progress_value_2: float, orientation: str) -> bool: | ||
| 720 | 720 | ||
| 721 | 721 | requires_recoloring, requires_recoloring_2 = False, False | |
| 722 | 722 | ||
@@ -754,29 +754,33 @@ def __draw_rounded_progress_bar_with_border_font_shapes(self, width: int, height | |||
| 754 | 754 | ("inner_oval_1", "inner_oval_4")) | |
| 755 | 755 | ||
| 756 | 756 | # set positions of progress corner parts | |
| 757 | - self._canvas.coords("progress_oval_1_a", border_width + inner_corner_radius, border_width + inner_corner_radius, inner_corner_radius) | ||
| 758 | - self._canvas.coords("progress_oval_1_b", border_width + inner_corner_radius, border_width + inner_corner_radius, inner_corner_radius) | ||
| 759 | - self._canvas.coords("progress_oval_2_a", border_width + inner_corner_radius + (width - 2 * border_width - 2 * inner_corner_radius) * progress_value, | ||
| 757 | + self._canvas.coords("progress_oval_1_a", border_width + inner_corner_radius + (width - 2 * border_width - 2 * inner_corner_radius) * progress_value_1, | ||
| 758 | + border_width + inner_corner_radius, inner_corner_radius) | ||
| 759 | + self._canvas.coords("progress_oval_1_b", border_width + inner_corner_radius + (width - 2 * border_width - 2 * inner_corner_radius) * progress_value_1, | ||
| 760 | + border_width + inner_corner_radius, inner_corner_radius) | ||
| 761 | + self._canvas.coords("progress_oval_2_a", border_width + inner_corner_radius + (width - 2 * border_width - 2 * inner_corner_radius) * progress_value_2, | ||
| 760 | 762 | border_width + inner_corner_radius, inner_corner_radius) | |
| 761 | - self._canvas.coords("progress_oval_2_b", border_width + inner_corner_radius + (width - 2 * border_width - 2 * inner_corner_radius) * progress_value, | ||
| 763 | + self._canvas.coords("progress_oval_2_b", border_width + inner_corner_radius + (width - 2 * border_width - 2 * inner_corner_radius) * progress_value_2, | ||
| 762 | 764 | border_width + inner_corner_radius, inner_corner_radius) | |
| 763 | - self._canvas.coords("progress_oval_3_a", border_width + inner_corner_radius + (width - 2 * border_width - 2 * inner_corner_radius) * progress_value, | ||
| 765 | + self._canvas.coords("progress_oval_3_a", border_width + inner_corner_radius + (width - 2 * border_width - 2 * inner_corner_radius) * progress_value_2, | ||
| 764 | 766 | height - border_width - inner_corner_radius, inner_corner_radius) | |
| 765 | - self._canvas.coords("progress_oval_3_b", border_width + inner_corner_radius + (width - 2 * border_width - 2 * inner_corner_radius) * progress_value, | ||
| 767 | + self._canvas.coords("progress_oval_3_b", border_width + inner_corner_radius + (width - 2 * border_width - 2 * inner_corner_radius) * progress_value_2, | ||
| 768 | + height - border_width - inner_corner_radius, inner_corner_radius) | ||
| 769 | + self._canvas.coords("progress_oval_4_a", border_width + inner_corner_radius + (width - 2 * border_width - 2 * inner_corner_radius) * progress_value_1, | ||
| 770 | + height - border_width - inner_corner_radius, inner_corner_radius) | ||
| 771 | + self._canvas.coords("progress_oval_4_b", border_width + inner_corner_radius + (width - 2 * border_width - 2 * inner_corner_radius) * progress_value_1, | ||
| 766 | 772 | height - border_width - inner_corner_radius, inner_corner_radius) | |
| 767 | - self._canvas.coords("progress_oval_4_a", border_width + inner_corner_radius, height - border_width - inner_corner_radius, inner_corner_radius) | ||
| 768 | - self._canvas.coords("progress_oval_4_b", border_width + inner_corner_radius, height - border_width - inner_corner_radius, inner_corner_radius) | ||
| 769 | 773 | ||
| 770 | 774 | # set positions of progress rect parts | |
| 771 | 775 | self._canvas.coords("progress_rectangle_1", | |
| 772 | - border_width + inner_corner_radius, | ||
| 776 | + border_width + inner_corner_radius + (width - 2 * border_width - 2 * inner_corner_radius) * progress_value_1, | ||
| 773 | 777 | border_width, | |
| 774 | - border_width + inner_corner_radius + (width - 2 * border_width - 2 * inner_corner_radius) * progress_value, | ||
| 778 | + border_width + inner_corner_radius + (width - 2 * border_width - 2 * inner_corner_radius) * progress_value_2, | ||
| 775 | 779 | height - border_width) | |
| 776 | 780 | self._canvas.coords("progress_rectangle_2", | |
| 777 | - border_width, | ||
| 781 | + border_width + 2 * inner_corner_radius + (width - 2 * inner_corner_radius - 2 * border_width) * progress_value_1, | ||
| 778 | 782 | border_width + inner_corner_radius, | |
| 779 | - border_width + 2 * inner_corner_radius + (width - 2 * inner_corner_radius - 2 * border_width) * progress_value, | ||
| 783 | + border_width + 2 * inner_corner_radius + (width - 2 * inner_corner_radius - 2 * border_width) * progress_value_2, | ||
| 780 | 784 | height - inner_corner_radius - border_width) | |
| 781 | 785 | ||
| 782 | 786 | # vertical orientation from the bottom | |
@@ -786,29 +790,33 @@ def __draw_rounded_progress_bar_with_border_font_shapes(self, width: int, height | |||
| 786 | 790 | ||
| 787 | 791 | # set positions of progress corner parts | |
| 788 | 792 | self._canvas.coords("progress_oval_1_a", border_width + inner_corner_radius, | |
| 789 | - border_width + inner_corner_radius + (height - 2 * border_width - 2 * inner_corner_radius) * (1 - progress_value), inner_corner_radius) | ||
| 793 | + border_width + inner_corner_radius + (height - 2 * border_width - 2 * inner_corner_radius) * (1 - progress_value_2), inner_corner_radius) | ||
| 790 | 794 | self._canvas.coords("progress_oval_1_b", border_width + inner_corner_radius, | |
| 791 | - border_width + inner_corner_radius + (height - 2 * border_width - 2 * inner_corner_radius) * (1 - progress_value), inner_corner_radius) | ||
| 795 | + border_width + inner_corner_radius + (height - 2 * border_width - 2 * inner_corner_radius) * (1 - progress_value_2), inner_corner_radius) | ||
| 792 | 796 | self._canvas.coords("progress_oval_2_a", width - border_width - inner_corner_radius, | |
| 793 | - border_width + inner_corner_radius + (height - 2 * border_width - 2 * inner_corner_radius) * (1 - progress_value), inner_corner_radius) | ||
| 797 | + border_width + inner_corner_radius + (height - 2 * border_width - 2 * inner_corner_radius) * (1 - progress_value_2), inner_corner_radius) | ||
| 794 | 798 | self._canvas.coords("progress_oval_2_b", width - border_width - inner_corner_radius, | |
| 795 | - border_width + inner_corner_radius + (height - 2 * border_width - 2 * inner_corner_radius) * (1 - progress_value), inner_corner_radius) | ||
| 796 | - self._canvas.coords("progress_oval_3_a", width - border_width - inner_corner_radius, height - border_width - inner_corner_radius, inner_corner_radius) | ||
| 797 | - self._canvas.coords("progress_oval_3_b", width - border_width - inner_corner_radius, height - border_width - inner_corner_radius, inner_corner_radius) | ||
| 798 | - self._canvas.coords("progress_oval_4_a", border_width + inner_corner_radius, height - border_width - inner_corner_radius, inner_corner_radius) | ||
| 799 | - self._canvas.coords("progress_oval_4_b", border_width + inner_corner_radius, height - border_width - inner_corner_radius, inner_corner_radius) | ||
| 799 | + border_width + inner_corner_radius + (height - 2 * border_width - 2 * inner_corner_radius) * (1 - progress_value_2), inner_corner_radius) | ||
| 800 | + self._canvas.coords("progress_oval_3_a", width - border_width - inner_corner_radius, | ||
| 801 | + border_width + inner_corner_radius + (height - 2 * border_width - 2 * inner_corner_radius) * (1 - progress_value_1), inner_corner_radius) | ||
| 802 | + self._canvas.coords("progress_oval_3_b", width - border_width - inner_corner_radius, | ||
| 803 | + border_width + inner_corner_radius + (height - 2 * border_width - 2 * inner_corner_radius) * (1 - progress_value_1), inner_corner_radius) | ||
| 804 | + self._canvas.coords("progress_oval_4_a", border_width + inner_corner_radius, | ||
| 805 | + border_width + inner_corner_radius + (height - 2 * border_width - 2 * inner_corner_radius) * (1 - progress_value_1), inner_corner_radius) | ||
| 806 | + self._canvas.coords("progress_oval_4_b", border_width + inner_corner_radius, | ||
| 807 | + border_width + inner_corner_radius + (height - 2 * border_width - 2 * inner_corner_radius) * (1 - progress_value_1), inner_corner_radius) | ||
| 800 | 808 | ||
| 801 | 809 | # set positions of progress rect parts | |
| 802 | 810 | self._canvas.coords("progress_rectangle_1", | |
| 803 | 811 | border_width + inner_corner_radius, | |
| 804 | - border_width + (height - 2 * border_width - 2 * inner_corner_radius) * (1 - progress_value), | ||
| 812 | + border_width + (height - 2 * border_width - 2 * inner_corner_radius) * (1 - progress_value_2), | ||
| 805 | 813 | width - border_width - inner_corner_radius, | |
| 806 | - height - border_width) | ||
| 814 | + border_width + (height - 2 * border_width - 2 * inner_corner_radius) * (1 - progress_value_1)) | ||
| 807 | 815 | self._canvas.coords("progress_rectangle_2", | |
| 808 | 816 | border_width, | |
| 809 | - border_width + inner_corner_radius + (height - 2 * border_width - 2 * inner_corner_radius) * (1 - progress_value), | ||
| 817 | + border_width + inner_corner_radius + (height - 2 * border_width - 2 * inner_corner_radius) * (1 - progress_value_2), | ||
| 810 | 818 | width - border_width, | |
| 811 | - height - inner_corner_radius - border_width) | ||
| 819 | + border_width + inner_corner_radius + (height - 2 * border_width - 2 * inner_corner_radius) * (1 - progress_value_1)) | ||
| 812 | 820 | ||
| 813 | 821 | return requires_recoloring or requires_recoloring_2 | |
| 814 | 822 | ||
@@ -847,7 +855,7 @@ def __draw_rounded_slider_with_border_and_button_polygon_shapes(self, width: int | |||
| 847 | 855 | ||
| 848 | 856 | # draw normal progressbar | |
| 849 | 857 | requires_recoloring = self.__draw_rounded_progress_bar_with_border_polygon_shapes(width, height, corner_radius, border_width, inner_corner_radius, | |
| 850 | - slider_value, orientation) | ||
| 858 | + 0, slider_value, orientation) | ||
| 851 | 859 | ||
| 852 | 860 | # create slider button part | |
| 853 | 861 | if not self._canvas.find_withtag("slider_parts"): | |
@@ -886,7 +894,7 @@ def __draw_rounded_slider_with_border_and_button_font_shapes(self, width: int, h | |||
| 886 | 894 | ||
| 887 | 895 | # draw normal progressbar | |
| 888 | 896 | requires_recoloring = self.__draw_rounded_progress_bar_with_border_font_shapes(width, height, corner_radius, border_width, inner_corner_radius, | |
| 889 | - slider_value, orientation) | ||
| 897 | + 0, slider_value, orientation) | ||
| 890 | 898 | ||
| 891 | 899 | # create 4 circles (if not needed, then less) | |
| 892 | 900 | if not self._canvas.find_withtag("slider_oval_1_a"): | |
| Back | FazBrowse Home | New Git URL |
0 commit comments