Skip to content

Commit

Permalink
Merge pull request #256 from sparkmicro/dev
Browse files Browse the repository at this point in the history
GUI improvements
  • Loading branch information
eeintech authored Sep 21, 2024
2 parents 22a91c8 + bf8560c commit f49f276
Show file tree
Hide file tree
Showing 8 changed files with 535 additions and 501 deletions.
7 changes: 7 additions & 0 deletions kintree/gui/gui.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import os
import flet as ft

from ..config import settings

from .views.common import update_theme, handle_transition
from .views.main import (
PartSearchView,
Expand All @@ -21,6 +24,10 @@ def init_gui(page: ft.Page):
page.horizontal_alignment = ft.CrossAxisAlignment.CENTER
page.vertical_alignment = ft.MainAxisAlignment.CENTER
page.scroll = ft.ScrollMode.ALWAYS

# Window Icon
page.window.icon = os.path.join(settings.PROJECT_DIR, 'gui', 'logo.ico')
page.window.title_bar_hidden = True

# Theme
update_theme(page)
Expand Down
Binary file added kintree/gui/logo.ico
Binary file not shown.
Binary file removed kintree/gui/logo.png
Binary file not shown.
33 changes: 21 additions & 12 deletions kintree/gui/views/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,19 @@

# Main AppBar
main_appbar = ft.AppBar(
leading=ft.Container(
content=ft.Image(
src=os.path.join(settings.PROJECT_DIR, 'gui', 'logo.png'),
fit=ft.ImageFit.CONTAIN,
leading=ft.WindowDragArea(
ft.Container(
content=ft.Image(
src=os.path.join(settings.PROJECT_DIR, 'gui', 'logo.ico'),
fit=ft.ImageFit.CONTAIN,
),
padding=ft.padding.only(left=10),
expand=True,
),
padding=ft.padding.only(left=10),
expand=True,
maximizable=True,
),
leading_width=40,
title=ft.Text(f'Ki-nTree | {__version__}'),
title=ft.WindowDragArea(ft.Text(f'Ki-nTree | {__version__}'), maximizable=True),
center_title=False,
bgcolor=ft.colors.SURFACE_VARIANT,
actions=[],
Expand Down Expand Up @@ -116,11 +119,17 @@ def __init__(self, page: ft.Page):

# Update application bar
if not self.appbar.actions:
self.appbar.actions.append(
ft.IconButton(
ft.icons.SETTINGS,
on_click=self.call_settings,
)
self.appbar.actions.extend(
[
ft.IconButton(
ft.icons.SETTINGS,
on_click=self.call_settings,
),
ft.IconButton(
ft.icons.CLOSE,
on_click=lambda _: page.window.close(),
),
]
)
else:
self.appbar.actions[0].on_click = self.call_settings
Expand Down
4 changes: 2 additions & 2 deletions kintree/kintree_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

def main(view='flet_app'):
if view == 'browser':
ft.app(target=kintree_gui, view=ft.WEB_BROWSER)
ft.app(target=kintree_gui, view=ft.AppView.WEB_BROWSER)
return
ft.app(target=kintree_gui, view=ft.FLET_APP)
ft.app(target=kintree_gui, view=ft.AppView.FLET_APP)
2 changes: 1 addition & 1 deletion kintree/search/element14_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def test_api(store_url=None) -> bool:
'store_url': 'www.newark.com',
'part_number': 'BLM18AG601SN1D',
'expected': {
'displayName': 'Ferrite Bead, 0603 [1608 Metric], 600 ohm, 500 mA, BLM18A Series, 0.38 ohm, ± 25%',
'displayName': 'Ferrite Bead, 0603 [1608 Metric], 600 ohm, 500 mA, EMIFIL BLM18AG Series, 0.38 ohm, ± 25%',
'brandName': 'MURATA',
'translatedManufacturerPartNumber': 'BLM18AG601SN1D',
}
Expand Down
988 changes: 503 additions & 485 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ keywords = ["inventree", "kicad", "digikey", "mouser", "component", "part", "cre
python = ">=3.9,<3.12"
digikey-api = "^1.0.0"
# digikey-api = { git = "https://github.com/hurricaneJoef/digikey-api.git", branch = "master" }
flet = "^0.23.0"
flet = "^0.24.1"
thefuzz = "^0.19.0"
inventree = "^0.14.0"
kiutils = "^1.4.0"
Expand Down

0 comments on commit f49f276

Please sign in to comment.