Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alpha b #146

Merged
merged 5 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Source repository: https://github.com/actions/dependency-review-action
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
name: 'Dependency Review'
on: [pull_request, push]
on: pull_request

permissions:
contents: read
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ on:
schedule:
- cron: "0 0 */2 * *"

permissions:
contents: read


jobs:
build:

Test_Global:
permissions:
contents: read

runs-on: ubuntu-latest

steps:
Expand All @@ -41,3 +41,4 @@ jobs:
# - name: Main code Updated
# run: |
# python Check_MCUS.py

13 changes: 7 additions & 6 deletions .github/workflows/python-app_Alpha-b.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ on:
branches: ["Alpha-b"]
schedule:
- cron: "0 0 */2 * *"

permissions:
contents: read



jobs:
build:

Test_Global:
permissions:
contents: read

runs-on: ubuntu-latest

steps:
Expand All @@ -41,3 +41,4 @@ jobs:
# - name: Main code Updated
# run: |
# python Check_MCUS.py

10 changes: 5 additions & 5 deletions .github/workflows/python-app_Beta-b.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ on:
schedule:
- cron: "0 0 */2 * *"

permissions:
contents: read


jobs:
build:

Test_Global:
permissions:
contents: read

runs-on: ubuntu-latest

steps:
Expand Down
14 changes: 10 additions & 4 deletions Interface/GUI/Data/GUI_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
IMG_RES = (224, 224, 3)
train_epochs_def = 4
SHOW_CSAA_OS = False
Show_GUI_debug = True
# normal global
img_array = None
label = None
Expand Down Expand Up @@ -466,10 +467,10 @@ def CI_uaim(download_light_model: bool = False) -> None:
Supports downloading the full model or a smaller "light" model.
"""
if download_light_model:
Log_temp_txt = 'Downloading the light model...\n'
Log_temp_txt = 'Downloading the light model...'
Github_repo_Releases_Model_name_temp = Github_repo_Releases_Model_light_name
else:
Log_temp_txt = 'Downloading the model...\n'
Log_temp_txt = 'Downloading the model...'
Github_repo_Releases_Model_name_temp = Github_repo_Releases_Model_name
GUI_Queue['-Main_log-'].put(Log_temp_txt)
try:
Expand Down Expand Up @@ -529,7 +530,7 @@ def IEH(id: str = 'Unknown', stop: bool = True, DEV: bool = True) -> None:
logger.exception(f'Internal Error Handler [stop:{stop}|DEV:{DEV}|id:{id}]')
if DEV:
sg.popup(f'An internal error occurred.\nERROR-INFO:\n\nErr-ID:\n{id}\n\nErr-Traceback:\n{traceback.format_exc()}',
title='Internal Error (Auto Exit in 30 minutes)',
title=f'Internal Error Exit[{stop}]',
custom_text=('Exit'))
print_Color('detailed error message:', ['yellow'])
traceback.print_exc()
Expand Down Expand Up @@ -559,6 +560,11 @@ def UWL(Only_finalize: bool = False) -> None:
def main() -> None:
"""Main function for the GUI.
"""
# start
sg.SystemTray.notify(f'Pneumonia-Detection-Ai-GUI', f'Gui started.\nV{GUI_Ver}')
if Show_GUI_debug:
sg.SystemTray.notify(f'Pneumonia-Detection-Ai-GUI', f'Looks like you are a programmer\nWow.\nV{GUI_Ver}')
sg.show_debugger_window()
# global
global GUI_window
# Text print
Expand Down Expand Up @@ -722,4 +728,4 @@ def main() -> None:
['yellow', 'red'], advanced_mode=True)
else:
logger.info('GUI Imported.')
# end(EOF)
# end(EOF)
5 changes: 4 additions & 1 deletion Interface/GUI/GUI.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ setlocal enabledelayedexpansion
TITLE Pneumonia-Detection-Ai-GUI
set python_min_VER=10
set DEBUG=0
set Full_Auto=1
set arg=%1
set PV_filepath="Data\\Python Ver.tmp"
set python_path=python
Expand Down Expand Up @@ -86,9 +87,11 @@ REM Check if a package is installed and offer to install it if not
set userinput=Y
"%pip_path%" show %1 >nul
if ERRORLEVEL 1 (
if not if "%Full_Auto%"=="1" (
echo Package %1 not found. Do you want to automatically install it? [Y/n]
set /p userinput="Answer: "
if /I "%userinput%"=="Y" (
)
if /I "%userinput%"=="Y" or "%Full_Auto%"=="1"(
echo Installing package %1
"%pip_path%" install %1
if ERRORLEVEL 1 (
Expand Down
165 changes: 3 additions & 162 deletions env/Test_ENV2.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,166 +4,7 @@
from Utils.print_color_V2_NEW import print_Color_V2
from Utils.print_color_V1_OLD import print_Color
from Utils.Other import *
#!/usr/bin/env python
"""
Example of (almost) all Elements, that you can use in PySimpleGUI.
Shows you the basics including:
Naming convention for keys
Menubar format
Right click menu format
Table format
Running an async event loop
Theming your application (requires a window restart)
Displays the values dictionary entry for each element
And more!
# PySimpleGUI
import PySimpleGUI as sg

Copyright 2021, 2022, 2023 PySimpleGUI
"""

import PySimpleGUI as sg

def make_window(theme):
sg.theme(theme)
menu_def = [['&Application', ['E&xit']],
['&Help', ['&About']] ]
right_click_menu_def = [[], ['Edit Me', 'Versions', 'Nothing','More Nothing','Exit']]
graph_right_click_menu_def = [[], ['Erase','Draw Line', 'Draw',['Circle', 'Rectangle', 'Image'], 'Exit']]

# Table Data
data = [["John", 10], ["Jen", 5]]
headings = ["Name", "Score"]

input_layout = [

# [sg.Menu(menu_def, key='-MENU-')],
[sg.Text('Anything that requires user-input is in this tab!')],
[sg.Input(key='-INPUT-')],
[sg.Slider(orientation='h', key='-SKIDER-'),
sg.Image(data=sg.DEFAULT_BASE64_LOADING_GIF, enable_events=True, key='-GIF-IMAGE-'),],
[sg.Checkbox('Checkbox', default=True, k='-CB-')],
[sg.Radio('Radio1', "RadioDemo", default=True, size=(10,1), k='-R1-'), sg.Radio('Radio2', "RadioDemo", default=True, size=(10,1), k='-R2-')],
[sg.Combo(values=('Combo 1', 'Combo 2', 'Combo 3'), default_value='Combo 1', readonly=False, k='-COMBO-'),
sg.OptionMenu(values=('Option 1', 'Option 2', 'Option 3'), k='-OPTION MENU-'),],
[sg.Spin([i for i in range(1,11)], initial_value=10, k='-SPIN-'), sg.Text('Spin')],
[sg.Multiline('Demo of a Multi-Line Text Element!\nLine 2\nLine 3\nLine 4\nLine 5\nLine 6\nLine 7\nYou get the point.', size=(45,5), expand_x=True, expand_y=True, k='-MLINE-')],
[sg.Button('Button'), sg.Button('Popup'), sg.Button(image_data=sg.DEFAULT_BASE64_ICON, key='-LOGO-')]]

asthetic_layout = [[sg.T('Anything that you would use for asthetics is in this tab!')],
[sg.Image(data=sg.DEFAULT_BASE64_ICON, k='-IMAGE-')],
[sg.ProgressBar(100, orientation='h', size=(20, 20), key='-PROGRESS BAR-'), sg.Button('Test Progress bar')]]

logging_layout = [[sg.Text("Anything printed will display here!")],
[sg.Multiline(size=(60,15), font='Courier 8', expand_x=True, expand_y=True, write_only=True,
reroute_stdout=True, reroute_stderr=True, echo_stdout_stderr=True, autoscroll=True, auto_refresh=True)]
# [sg.Output(size=(60,15), font='Courier 8', expand_x=True, expand_y=True)]
]

graphing_layout = [[sg.Text("Anything you would use to graph will display here!")],
[sg.Graph((200,200), (0,0),(200,200),background_color="black", key='-GRAPH-', enable_events=True,
right_click_menu=graph_right_click_menu_def)],
[sg.T('Click anywhere on graph to draw a circle')],
[sg.Table(values=data, headings=headings, max_col_width=25,
background_color='black',
auto_size_columns=True,
display_row_numbers=True,
justification='right',
num_rows=2,
alternating_row_color='black',
key='-TABLE-',
row_height=25)]]

popup_layout = [[sg.Text("Popup Testing")],
[sg.Button("Open Folder")],
[sg.Button("Open File")]]

theme_layout = [[sg.Text("See how elements look under different themes by choosing a different theme here!")],
[sg.Listbox(values = sg.theme_list(),
size =(20, 12),
key ='-THEME LISTBOX-',
enable_events = True)],
[sg.Button("Set Theme")]]

layout = [ [sg.MenubarCustom(menu_def, key='-MENU-', font='Courier 15', tearoff=True)],
[sg.Text('Demo Of (Almost) All Elements', size=(38, 1), justification='center', font=("Helvetica", 16), relief=sg.RELIEF_RIDGE, k='-TEXT HEADING-', enable_events=True)]]
layout +=[[sg.TabGroup([[ sg.Tab('Input Elements', input_layout),
sg.Tab('Asthetic Elements', asthetic_layout),
sg.Tab('Graphing', graphing_layout),
sg.Tab('Popups', popup_layout),
sg.Tab('Theming', theme_layout),
sg.Tab('Output', logging_layout)]], key='-TAB GROUP-', expand_x=True, expand_y=True),

]]
layout[-1].append(sg.Sizegrip())
window = sg.Window('All Elements Demo', layout, right_click_menu=right_click_menu_def, right_click_menu_tearoff=True, grab_anywhere=True, resizable=True, margins=(0,0), use_custom_titlebar=True, finalize=True, keep_on_top=True)
window.set_min_size(window.size)
return window

def main():
window = make_window(sg.theme())

# This is an Event Loop
while True:
event, values = window.read(timeout=100)
# keep an animation running so show things are happening
if event not in (sg.TIMEOUT_EVENT, sg.WIN_CLOSED):
print('============ Event = ', event, ' ==============')
print('-------- Values Dictionary (key=value) --------')
for key in values:
print(key, ' = ',values[key])
if event in (None, 'Exit'):
print("[LOG] Clicked Exit!")
break

window['-GIF-IMAGE-'].update_animation(sg.DEFAULT_BASE64_LOADING_GIF, time_between_frames=100)
if event == 'About':
print("[LOG] Clicked About!")
sg.popup('PySimpleGUI Demo All Elements',
'Right click anywhere to see right click menu',
'Visit each of the tabs to see available elements',
'Output of event and values can be see in Output tab',
'The event and values dictionary is printed after every event', keep_on_top=True)
elif event == 'Popup':
print("[LOG] Clicked Popup Button!")
sg.popup("You pressed a button!", keep_on_top=True)
print("[LOG] Dismissing Popup!")
elif event == 'Test Progress bar':
print("[LOG] Clicked Test Progress Bar!")
progress_bar = window['-PROGRESS BAR-']
for i in range(100):
print("[LOG] Updating progress bar by 1 step ("+str(i)+")")
progress_bar.update(current_count=i + 1)
print("[LOG] Progress bar complete!")
elif event == "-GRAPH-":
graph = window['-GRAPH-'] # type: sg.Graph
graph.draw_circle(values['-GRAPH-'], fill_color='yellow', radius=20)
print("[LOG] Circle drawn at: " + str(values['-GRAPH-']))
elif event == "Open Folder":
print("[LOG] Clicked Open Folder!")
folder_or_file = sg.popup_get_folder('Choose your folder', keep_on_top=True)
sg.popup("You chose: " + str(folder_or_file), keep_on_top=True)
print("[LOG] User chose folder: " + str(folder_or_file))
elif event == "Open File":
print("[LOG] Clicked Open File!")
folder_or_file = sg.popup_get_file('Choose your file', keep_on_top=True)
sg.popup("You chose: " + str(folder_or_file), keep_on_top=True)
print("[LOG] User chose file: " + str(folder_or_file))
elif event == "Set Theme":
print("[LOG] Clicked Set Theme!")
theme_chosen = values['-THEME LISTBOX-'][0]
print("[LOG] User Chose Theme: " + str(theme_chosen))
window.close()
window = make_window(theme_chosen)
elif event == 'Edit Me':
sg.execute_editor(__file__)
elif event == 'Versions':
sg.popup_scrolled(__file__, sg.get_versions(), keep_on_top=True, non_blocking=True)

window.close()
exit(0)

if __name__ == '__main__':
sg.theme('black')
sg.theme('dark red')
sg.theme('dark green 7')
# sg.theme('DefaultNoMoreNagging')
main()
sg.theme_previewer()
Loading
Loading