-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfront.py
209 lines (170 loc) · 5.99 KB
/
front.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
""" Seagull statup this file is run at the start of the program to outline terms and conditions,
Copyright (C) 2024 Kai Broadbent 'BlazarKnight'
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to [email protected]
"""
import flet as ft
import os
import settings.settings as st
import browser.broser as br
# Should be implemented differently later
st.init_settings()
def first_start(page):
def close_dlg(e):
st.update_setting("showtconstart", False)
dlg_modal.open = False
page.update()
dlg_modal = ft.AlertDialog(
modal=True,
title=ft.Text("show terms and condionds nexed use"),
content=ft.Text("Do you want to see this page on every startup?"),
actions=[
ft.TextButton("Yes", on_click=close_dlg),
ft.TextButton("No", on_click=close_dlg),
],
actions_alignment=ft.MainAxisAlignment.END,
on_dismiss=lambda e: print("Modal dialog dismissed!"),
)
def open_dlg_modal(e):
page.dialog = dlg_modal
dlg_modal.open = True
page.update()
def dontshoag(e):
open_dlg_modal(1)
def close_banner(e):
page.banner.open = False
page.update()
dontshoag(1)
def show_w(e):
woren.open = True
woren.update()
def show_c(e):
condis.open = True
condis.update()
page.banner = ft.Banner(
bgcolor=ft.colors.AMBER_100,
leading=ft.Icon(ft.icons.WARNING_AMBER_ROUNDED, color=ft.colors.BLUE, size=80),
content=ft.Text(
"Seagull version 1, Copyright (C) 2024 Kai Broadbent 'BlazarKnight' Seagull comes with ABSOLUTELY NO WARRANTY; for details hit `show w'. This is free software, and you are welcome to redistribute it under certain conditions; hit `show c' for details.",
color=ft.colors.RED,
size=40,
),
actions=[
ft.TextButton("show w", on_click=show_w),
ft.TextButton("show c", on_click=show_c),
ft.TextButton("I understand and accept", on_click=close_banner),
],
)
def show_banner_click(e):
page.banner.open = True
page.update()
# bottum baner stuff waren
def waren_dismissed(e):
print("Dismissed!")
def show_waren(e):
woren.open = True
woren.update()
def close_waren(e):
woren.open = False
woren.update()
woren = ft.BottomSheet(
ft.Container(
ft.Column(
[
ft.Text(open("text_to_display/warrantyfordis.txt", "r").read()),
ft.ElevatedButton("Close and accept", on_click=close_waren),
],
tight=True,
),
padding=40,
),
open=False,
on_dismiss=waren_dismissed,
is_scroll_controlled=True,
maintain_bottom_view_insets_padding=True,
)
page.overlay.append(woren)
# bottum baner stuff consis
def condis_dismissed(e):
print("Dismissed!")
def show_condis(e):
condis.open = True
condis.update()
def close_condis(e):
condisopen = False
condis.update()
wid = 10**400
cl = ft.Column(
spacing=10,
height=20000000,
width=20000000,
scroll=ft.ScrollMode.ALWAYS,
)
cl.controls.append(
ft.Text(str(open("text_to_display/condistodisplay.txt", "r").read()))
)
condis = ft.BottomSheet(
ft.Container(cl, border=ft.border.all(1)),
# content=cl.controls.append(ft.Text(str(open('text_to_display/condistodisplay.txt',"r").read()))),
# content=ft.Text(str(open('text_to_display/condistodisplay.txt',"r").read()),overflow="visible",width=wid,data="text",max_lines=wid),
show_drag_handle=True,
enable_drag=True,
open=False,
on_dismiss=condis_dismissed,
is_scroll_controlled=False,
maintain_bottom_view_insets_padding=True,
use_safe_area=True,
)
page.overlay.append(condis)
show_banner_click(2)
def searchpg(page):
def button_clicked(e):
t.value = br.wildwebser(tfinerse.value), tfaise.value
page.update()
t = ft.Text()
tfaise = ft.TextField(label="AI search")
tfinerse = ft.TextField(label="Inernet search")
b = ft.ElevatedButton(text="Submit", on_click=button_clicked)
page.add(tfaise, tfinerse, t, b)
def setuppage(page):
def button_clicked(e):
t.value = f"options selected {br.value} {uc.value}"
st.update_setting("browser", br.value)
page.update()
t = ft.Text("sory we cuently only support firefox and bascic ")
b = ft.ElevatedButton(text="options selected", on_click=button_clicked)
br = ft.Dropdown(
label="browser",
hint_text="Choose your browser",
width=100,
options=[
ft.dropdown.Option("Firefox"),
# ft.dropdown.Option("Chrome"),
# ft.dropdown.Option("Edge"),
# ft.dropdown.Option("Internet Explorer"),
# ft.dropdown.Option("safari"),
],
)
uc = ft.Dropdown(
label="interface compexety",
hint_text="Choose your complexity level",
width=100,
options=[
ft.dropdown.Option("basic"),
ft.dropdown.Option("inermedet"),
ft.dropdown.Option("advansed"),
],
)
page.add(br, uc, b, t)
def runpage(e):
ft.app(target=e)
if __name__ == "__main__":
runpage(setuppage)