Skip to content

Commit 4c30681

Browse files
committed
Padding updates for new flet version. Cancel button for installer
1 parent 4b8fa80 commit 4c30681

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

installer/src/main.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ def download_latest_release(download_dir, pb):
7171
for chunk in download_response.iter_content(chunk_size=8192):
7272
file.write(chunk)
7373
downloaded_size += len(chunk)
74+
pb.value = (downloaded_size / total_size)/2
75+
pb.update()
7476
return file_path
7577

7678

@@ -95,6 +97,7 @@ def main(page: ft.Page):
9597

9698
# UI Config
9799
done = ft.TextButton("Done", on_click=lambda _: page.window.close(), style=ft.ButtonStyle(shape=ft.RoundedRectangleBorder(radius=5)), visible=False)
100+
cancel = ft.TextButton("Cancel", on_click=lambda _: page.window.close(), style=ft.ButtonStyle(shape=ft.RoundedRectangleBorder(radius=5)), visible=True)
98101
step = ft.Text("Downloading...", size=15)
99102
pb = ft.ProgressBar(width=430, bar_height=5, height=5)
100103

@@ -108,6 +111,7 @@ def main(page: ft.Page):
108111
step,
109112
pb,
110113
ft.Row([
114+
cancel,
111115
done
112116
], expand=True)
113117
],
@@ -124,12 +128,12 @@ def main(page: ft.Page):
124128
step.value = "Downloading..."
125129
pb.value = 0.0
126130
page.update()
127-
zip_path = download_latest_release(temp_dir, pb, step)
131+
zip_path = download_latest_release(temp_dir, pb)
128132

129133
# Define the Program Files directory
130134
# program_files_dir = os.path.join(os.environ['ProgramFiles'], 'Subconscious')
131135
program_files_dir = "./"
132-
step.value = f"Installing to {program_files_dir}..."
136+
step.value = f"Installing to {os.path.abspath(program_files_dir)}..."
133137
pb.value = 0.50
134138
page.update()
135139

@@ -143,6 +147,7 @@ def main(page: ft.Page):
143147
extract_to_program_files(zip_path, program_files_dir)
144148
# create_shortcut(os.path.join(program_files_dir, "subconscious.exe"), "Subconscious")
145149
done.visible = True
150+
cancel.visible = False
146151
step.value = "Installation completed successfully!"
147152
pb.value = 1.0
148153
page.update()

src/components/main_window.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def __init__(self, lang, settings, update_llms, llm_configured):
4747

4848
self.message_form = ft.TextField(
4949
hint_text=self.l.chatwindow.hint,
50+
hint_style=ft.TextStyle(weight=ft.FontWeight.NORMAL),
5051
autofocus=True,
5152
shift_enter=True,
5253
min_lines=1,
@@ -247,7 +248,7 @@ def render_settings(title, key, val):
247248
ft.Text(spans=[
248249
ft.TextSpan("Visit us at: "),
249250
ft.TextSpan(
250-
"subconscious.chat",
251+
"Subconscious.chat",
251252
ft.TextStyle(decoration=ft.TextDecoration.UNDERLINE),
252253
url="https://subconscious.chat/",
253254
on_enter=self.highlight_link,
@@ -392,7 +393,7 @@ def new_llm_config(self, event, slug=None, provider=None, model=None, api_key=No
392393
border=ft.InputBorder.NONE, border_color=ft.colors.TRANSPARENT,
393394
bgcolor=ft.colors.TRANSPARENT, border_radius=5, multiline=False,
394395
clip_behavior=ft.ClipBehavior.HARD_EDGE,
395-
content_padding=ft.padding.only(10, -14, 2, 2),
396+
content_padding=ft.padding.only(10, 0, 2, 2),
396397
dense=True, hint_text="Enter the LLM model name",
397398
hint_style=ft.TextStyle(color=ft.colors.SECONDARY, weight=ft.FontWeight.NORMAL),
398399
),
@@ -419,7 +420,7 @@ def new_llm_config(self, event, slug=None, provider=None, model=None, api_key=No
419420
border=ft.InputBorder.NONE, border_color=ft.colors.TRANSPARENT,
420421
bgcolor=ft.colors.TRANSPARENT, border_radius=5, multiline=False,
421422
clip_behavior=ft.ClipBehavior.HARD_EDGE,
422-
content_padding=ft.padding.only(10, -14, 2, 2),
423+
content_padding=ft.padding.only(10, 0, 2, 2),
423424
dense=True, password=True, hint_text="Enter the LLM API key if required",
424425
hint_style=ft.TextStyle(color=ft.colors.SECONDARY, weight=ft.FontWeight.NORMAL)
425426
),
@@ -464,7 +465,7 @@ def new_llm_config(self, event, slug=None, provider=None, model=None, api_key=No
464465
border=ft.InputBorder.NONE, border_color=ft.colors.TRANSPARENT,
465466
bgcolor=ft.colors.TRANSPARENT, border_radius=5, multiline=False,
466467
clip_behavior=ft.ClipBehavior.HARD_EDGE,
467-
content_padding=ft.padding.only(10, -14, 2, 2),
468+
content_padding=ft.padding.only(10, 0, 2, 2),
468469
dense=True, hint_text="Alias for this model configuration",
469470
hint_style=ft.TextStyle(color=ft.colors.SECONDARY, weight=ft.FontWeight.NORMAL),
470471
),
@@ -544,7 +545,7 @@ def chatwindow(self):
544545
content=ft.Column([
545546
ft.Container(
546547
border_radius=ft.BorderRadius(5, 5, 5, 5),
547-
padding=ft.padding.only(4, -15, 4, 0),
548+
padding=ft.padding.only(4, -5, 4, 0),
548549
margin=ft.margin.only(0, 0, 0, 0),
549550
bgcolor=ft.colors.SECONDARY_CONTAINER,
550551
content=ft.Column(

src/subconscious.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def main(page: ft.Page):
7777
self.page = page
7878
page.padding = 0
7979
page.spacing = 0
80+
page.title = "Subconscious"
8081
page.locale_configuration
8182
page.window.min_width = 500
8283
page.bgcolor = ft.colors.BACKGROUND
@@ -189,7 +190,7 @@ def __initialize_tray_icon(self):
189190

190191
self.__tray_icon = pystray.Icon(
191192
name="Subconscious",
192-
icon=Image.open("./assets/logo.png"),
193+
icon=Image.open("./assets/favicon.ico"),
193194
title="Subconscious",
194195
menu=pystray.Menu(
195196
pystray.MenuItem("Open Subconscious", self.__default_tray_option, default=True),

0 commit comments

Comments
 (0)