|
4 | 4 | from Utility import ROOTPATH, GOLD
|
5 | 5 | from textwrap import TextWrapper
|
6 | 6 |
|
7 |
| -class ListTile(ft.IconButton): |
8 |
| - def __init__(self, txt, prog= 'd'): |
9 |
| - super().__init__() |
10 |
| - self.txt = txt |
11 |
| - self.on_click = self.onclick |
12 |
| - self.fin = False |
13 |
| - if prog == 'd': |
14 |
| - vis = [True,False,False] |
15 |
| - self.fin = False |
16 |
| - elif prog == 'p': |
17 |
| - vis = [False,False,True] |
18 |
| - else: |
19 |
| - self.fin = True |
20 |
| - vis = [False,True,False] |
21 |
| - self.prg = ft.Ref[ft.ProgressBar]() |
22 |
| - self.ico = ft.Ref[ft.Icon]() |
23 |
| - self.exit = ft.Ref[ft.Icon]() |
| 7 | +# class ListTile(ft.IconButton): # check |
| 8 | +# def __init__(self, txt, prog= 'd'): |
| 9 | +# super().__init__() |
| 10 | +# self.txt = txt |
| 11 | +# self.on_click = self.onclick |
| 12 | +# self.fin = False |
| 13 | +# if prog == 'd': |
| 14 | +# vis = [True,False,False] |
| 15 | +# self.fin = False |
| 16 | +# elif prog == 'p': |
| 17 | +# vis = [False,False,True] |
| 18 | +# else: |
| 19 | +# self.fin = True |
| 20 | +# vis = [False,True,False] |
| 21 | +# self.prg = ft.Ref[ft.ProgressBar]() |
| 22 | +# self.ico = ft.Ref[ft.Icon]() |
| 23 | +# self.exit = ft.Ref[ft.Icon]() |
24 | 24 |
|
25 |
| - self.text_container = ft.Text(txt, size= 12) |
| 25 | +# self.text_container = ft.Text(txt, size= 12) |
26 | 26 |
|
27 |
| - self.content= ft.Container( |
28 |
| - ft.Row([ |
29 |
| - self.text_container, |
30 |
| - ft.ProgressBar(width=60, ref= self.prg, visible= vis[0]), |
31 |
| - ft.Icon(name= ft.Icons.DONE, color= GOLD, ref= self.ico, visible= vis[1]), |
32 |
| - ft.Icon(name= ft.Icons.CANCEL, color= GOLD, ref= self.exit, visible= vis[2]) |
33 |
| - ], alignment= ft.MainAxisAlignment.SPACE_BETWEEN), |
34 |
| - bgcolor= ft.Colors.with_opacity(0.1, GOLD), |
35 |
| - border_radius= 60, |
36 |
| - padding= 15, |
37 |
| - expand= True) |
| 27 | +# self.content= ft.Container( |
| 28 | +# ft.Row([ |
| 29 | +# self.text_container, |
| 30 | +# ft.ProgressBar(width=60, ref= self.prg, visible= vis[0]), |
| 31 | +# ft.Icon(name= ft.Icons.DONE, color= GOLD, ref= self.ico, visible= vis[1]), |
| 32 | +# ft.Icon(name= ft.Icons.CANCEL, color= GOLD, ref= self.exit, visible= vis[2]) |
| 33 | +# ], alignment= ft.MainAxisAlignment.SPACE_BETWEEN), |
| 34 | +# bgcolor= ft.Colors.with_opacity(0.1, GOLD), |
| 35 | +# border_radius= 60, |
| 36 | +# padding= 15, |
| 37 | +# expand= True) |
38 | 38 |
|
39 |
| - def onclick(self, e): |
40 |
| - if self.fin: |
41 |
| - self.page.go(f'/lib/{self.txt}') |
| 39 | +# def onclick(self, e): |
| 40 | +# if self.fin: |
| 41 | +# self.page.go(f'/lib/{self.txt}') |
42 | 42 |
|
43 |
| - def done(self, prog='d'): |
44 |
| - if prog == 'd': |
45 |
| - self.prg.current.visible = True |
46 |
| - self.ico.current.visible = False |
47 |
| - self.exit.current.visible = False |
48 |
| - self.fin = False |
49 |
| - self.update() |
50 |
| - else: |
51 |
| - self.exit.current.visible = False |
52 |
| - self.prg.current.visible = False |
53 |
| - self.ico.current.visible = True |
54 |
| - self.fin = True |
55 |
| - self.update() |
| 43 | +# def done(self, prog='d'): |
| 44 | +# if prog == 'd': |
| 45 | +# self.prg.current.visible = True |
| 46 | +# self.ico.current.visible = False |
| 47 | +# self.exit.current.visible = False |
| 48 | +# self.fin = False |
| 49 | +# self.update() |
| 50 | +# else: |
| 51 | +# self.exit.current.visible = False |
| 52 | +# self.prg.current.visible = False |
| 53 | +# self.ico.current.visible = True |
| 54 | +# self.fin = True |
| 55 | +# self.update() |
56 | 56 |
|
57 |
| -class BookProgressSheet(ft.BottomSheet): |
58 |
| - def __init__(self, height: ft.OptionalNumber = None): |
59 |
| - self.body = ft.Ref[ft.Column]() |
60 |
| - self.list_body = ft.ListView([], expand= True) |
61 |
| - super().__init__( |
62 |
| - show_drag_handle = True, |
63 |
| - content = ft.Column( |
64 |
| - ref= self.body, |
65 |
| - controls=[ |
66 |
| - ft.ElevatedButton( |
67 |
| - "x", |
68 |
| - height= 5, |
69 |
| - width= 100, |
70 |
| - on_click= self.onclose, |
71 |
| - visible= False, |
72 |
| - bgcolor= ft.Colors.with_opacity(0.3, ft.Colors.INVERSE_SURFACE) |
73 |
| - ), |
74 |
| - ft.Text('Latest Adds'), |
75 |
| - self.list_body, |
76 |
| - ], |
77 |
| - horizontal_alignment= ft.CrossAxisAlignment.CENTER, |
78 |
| - expand=True |
79 |
| - ) |
80 |
| - ) |
| 57 | +# class BookProgressSheet(ft.BottomSheet): |
| 58 | +# def __init__(self, height: ft.OptionalNumber = None): |
| 59 | +# self.body = ft.Ref[ft.Column]() |
| 60 | +# self.list_body = ft.ListView([], expand= True) |
| 61 | +# super().__init__( |
| 62 | +# show_drag_handle = True, |
| 63 | +# content = ft.Column( |
| 64 | +# ref= self.body, |
| 65 | +# controls=[ |
| 66 | +# ft.ElevatedButton( |
| 67 | +# "x", |
| 68 | +# height= 5, |
| 69 | +# width= 100, |
| 70 | +# on_click= self.onclose, |
| 71 | +# visible= False, |
| 72 | +# bgcolor= ft.Colors.with_opacity(0.3, ft.Colors.INVERSE_SURFACE) |
| 73 | +# ), |
| 74 | +# ft.Text('Latest Adds'), |
| 75 | +# self.list_body, |
| 76 | +# ], |
| 77 | +# horizontal_alignment= ft.CrossAxisAlignment.CENTER, |
| 78 | +# expand=True |
| 79 | +# ) |
| 80 | +# ) |
81 | 81 |
|
82 |
| - self.shadow = ft.BoxShadow( |
83 |
| - blur_style= ft.ShadowBlurStyle.OUTER, |
84 |
| - blur_radius= 4, |
85 |
| - color= ft.Colors.with_opacity(0.2, ft.Colors.INVERSE_SURFACE), |
86 |
| - ) |
87 |
| - self.height = height |
| 82 | +# self.shadow = ft.BoxShadow( |
| 83 | +# blur_style= ft.ShadowBlurStyle.OUTER, |
| 84 | +# blur_radius= 4, |
| 85 | +# color= ft.Colors.with_opacity(0.2, ft.Colors.INVERSE_SURFACE), |
| 86 | +# ) |
| 87 | +# self.height = height |
88 | 88 |
|
89 |
| - # height |
90 |
| - @property |
91 |
| - def height(self) -> ft.OptionalNumber: |
92 |
| - return self._get_attr("height") |
| 89 | +# # height |
| 90 | +# @property |
| 91 | +# def height(self) -> ft.OptionalNumber: |
| 92 | +# return self._get_attr("height") |
93 | 93 |
|
94 |
| - @height.setter |
95 |
| - def height(self, value: ft.OptionalNumber): |
96 |
| - self._set_attr("height", value) |
| 94 | +# @height.setter |
| 95 | +# def height(self, value: ft.OptionalNumber): |
| 96 | +# self._set_attr("height", value) |
97 | 97 |
|
98 |
| - def clear(self): |
99 |
| - dts: list = self.page.client_storage.get_keys('Book') |
100 |
| - dts.remove('Book.hist') |
101 |
| - self.page.client_storage.set('Book.hist', []) |
102 |
| - # add clear the path |
| 98 | +# def clear(self): |
| 99 | +# dts: list = self.page.client_storage.get_keys('Book') |
| 100 | +# dts.remove('Book.hist') |
| 101 | +# self.page.client_storage.set('Book.hist', []) |
| 102 | +# # add clear the path |
103 | 103 |
|
104 |
| - for i in dts: |
105 |
| - self.page.client_storage.remove(i) |
106 |
| - shutil.rmtree(os.path.join(ROOTPATH,'Books',f'{i.split(".")[-1]}')) |
| 104 | +# for i in dts: |
| 105 | +# self.page.client_storage.remove(i) |
| 106 | +# shutil.rmtree(os.path.join(ROOTPATH,'Books',f'{i.split(".")[-1]}')) |
107 | 107 |
|
108 |
| - def onclose(self, e): |
109 |
| - # self.visible = False |
110 |
| - if self.expand == True: |
111 |
| - self.expand = False |
112 |
| - self.open = False |
113 |
| - for i in self.body.current.controls[1:]: |
114 |
| - i.visible = False |
115 |
| - else: |
116 |
| - self.expand = True |
117 |
| - self.open = True |
118 |
| - for i in self.body.current.controls[1:]: |
119 |
| - i.visible = True |
120 |
| - self.update() |
| 108 | +# def onclose(self, e): |
| 109 | +# # self.visible = False |
| 110 | +# if self.expand == True: |
| 111 | +# self.expand = False |
| 112 | +# self.open = False |
| 113 | +# for i in self.body.current.controls[1:]: |
| 114 | +# i.visible = False |
| 115 | +# else: |
| 116 | +# self.expand = True |
| 117 | +# self.open = True |
| 118 | +# for i in self.body.current.controls[1:]: |
| 119 | +# i.visible = True |
| 120 | +# self.update() |
121 | 121 |
|
122 |
| - def popup(self): |
123 |
| - self.page.open(self) |
124 |
| - self.page.update() |
| 122 | +# def popup(self): |
| 123 | +# self.page.open(self) |
| 124 | +# self.page.update() |
125 | 125 |
|
126 |
| - def did_mount(self): |
127 |
| - past_hist:list = self.page.client_storage.get('Book.hist') |
128 |
| - if past_hist != None: |
129 |
| - books = self.page.client_storage.get_keys('Book') |
| 126 | +# def did_mount(self): |
| 127 | +# past_hist:list = self.page.client_storage.get('Book.hist') |
| 128 | +# if past_hist != None: |
| 129 | +# books = self.page.client_storage.get_keys('Book') |
130 | 130 |
|
131 |
| - past_hist.reverse() |
132 |
| - w = TextWrapper(25) |
| 131 | +# past_hist.reverse() |
| 132 | +# w = TextWrapper(25) |
133 | 133 |
|
134 |
| - for i in past_hist: |
135 |
| - p = 'f' if 'Book.'+i in books else 'd' |
136 |
| - i = w.fill(i) |
137 |
| - self.list_body.controls.append(ListTile(i, p)) |
138 |
| - return super().did_mount() |
| 134 | +# for i in past_hist: |
| 135 | +# p = 'f' if 'Book.'+i in books else 'd' |
| 136 | +# i = w.fill(i) |
| 137 | +# self.list_body.controls.append(ListTile(i, p)) |
| 138 | +# return super().did_mount() |
0 commit comments