updated look of CFG util
This commit is contained in:
@@ -2,7 +2,73 @@ import PySimpleGUI as sg
|
|||||||
|
|
||||||
from .imgs import WINDOW_ICON
|
from .imgs import WINDOW_ICON
|
||||||
|
|
||||||
sg.set_options(font=("Liberation Mono", 10))
|
WINDOW_BG = "#0F4C75"
|
||||||
|
|
||||||
|
PROGRESS_BG = "#FFFFFF"
|
||||||
|
PROGRESS_FULL = "#00A8CC"
|
||||||
|
|
||||||
|
MAIN_TABS_BG = "#0F4C75"
|
||||||
|
MAIN_TABS_SELECTED = MAIN_TABS_BG
|
||||||
|
MAIN_TABS_NORMAL = "#BBE1FA"
|
||||||
|
MAIN_TABS_TEXT_SELECTED = "#FFFFFF"
|
||||||
|
MAIN_TABS_TEXT_NORMAL = "#000000"
|
||||||
|
|
||||||
|
TEXT_COLOR = "#FFFFFF"
|
||||||
|
|
||||||
|
BTN_TEXT_COLOR = "#000000"
|
||||||
|
BTN_COLOR = "#3282B8"
|
||||||
|
BTN_DISABLED_COLOR = "#BBE1FA"
|
||||||
|
BTN_DISABLED_TEXT_COLOR = "#1B262C"
|
||||||
|
BTN_DISABLED = BTN_DISABLED_TEXT_COLOR, BTN_DISABLED_COLOR
|
||||||
|
BTN_BORDER = 1
|
||||||
|
|
||||||
|
INFO_BTN_TEXT_COLOR = "#000000"
|
||||||
|
INFO_BTN_BG = "#FFFFFF"
|
||||||
|
|
||||||
|
INPUT_BG = "#BBE1FA"
|
||||||
|
INPUT_TEXT = "#000000"
|
||||||
|
|
||||||
|
POOLS_TABS_BG = "#3282B8"
|
||||||
|
POOLS_TABS_SELECTED = POOLS_TABS_BG
|
||||||
|
POOLS_TABS_NORMAL = "#BBE1FA"
|
||||||
|
POOLS_TABS_TEXT_SELECTED = "#FFFFFF"
|
||||||
|
POOLS_TABS_TEXT_NORMAL = "#000000"
|
||||||
|
|
||||||
|
TABLE_BG = "#BBE1FA"
|
||||||
|
TABLE_TEXT = "#000000"
|
||||||
|
TABLE_HEADERS_COLOR = "#3282B8"
|
||||||
|
TABLE_HEADERS_TEXT_COLOR = "#000000"
|
||||||
|
TABLE_HEADERS_HOVER = "#27496D"
|
||||||
|
TABLE_BORDER = 1
|
||||||
|
TABLE_HEADER_BORDER = 3
|
||||||
|
|
||||||
|
POOLS_TABLE_BG = TABLE_BG
|
||||||
|
POOLS_TABLE_TEXT = TABLE_TEXT
|
||||||
|
POOLS_TABLE_HEADERS_COLOR = TABLE_HEADERS_COLOR
|
||||||
|
POOLS_TABLE_HEADERS_TEXT_COLOR = TABLE_HEADERS_TEXT_COLOR
|
||||||
|
POOLS_TABLE_HEADERS_HOVER = TABLE_HEADERS_HOVER
|
||||||
|
POOLS_TABLE_BORDER = 1
|
||||||
|
POOLS_TABLE_HEADER_BORDER = 3
|
||||||
|
|
||||||
|
sg.set_options(font=("Noto Mono", 10))
|
||||||
|
# Add your new theme colors and settings
|
||||||
|
|
||||||
|
|
||||||
|
sg.LOOK_AND_FEEL_TABLE["cfg_util_theme"] = {
|
||||||
|
"BACKGROUND": WINDOW_BG,
|
||||||
|
"TEXT": TEXT_COLOR,
|
||||||
|
"INPUT": INPUT_BG,
|
||||||
|
"TEXT_INPUT": INPUT_TEXT,
|
||||||
|
"SCROLL": "#142850",
|
||||||
|
"BUTTON": (BTN_TEXT_COLOR, BTN_COLOR), # Text Color, Background
|
||||||
|
"PROGRESS": (PROGRESS_FULL, PROGRESS_BG), # Filled, Empty
|
||||||
|
"BORDER": 1,
|
||||||
|
"SLIDER_DEPTH": 0,
|
||||||
|
"PROGRESS_DEPTH": 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
# Switch to use your newly created theme
|
||||||
|
sg.theme("cfg_util_theme")
|
||||||
|
|
||||||
TABLE_HEADERS = {
|
TABLE_HEADERS = {
|
||||||
"SCAN": [
|
"SCAN": [
|
||||||
@@ -123,10 +189,16 @@ async def update_prog_bar(count: int, max: int = None):
|
|||||||
def get_scan_layout():
|
def get_scan_layout():
|
||||||
scan_layout = [
|
scan_layout = [
|
||||||
[
|
[
|
||||||
sg.Text("Scan IP"),
|
sg.Text("Scan IP", background_color=MAIN_TABS_BG),
|
||||||
sg.InputText(key="scan_ip", size=(31, 1)),
|
sg.InputText(key="scan_ip", size=(31, 1)),
|
||||||
sg.Button("Scan", key="btn_scan"),
|
sg.Button(
|
||||||
sg.Push(),
|
"Scan",
|
||||||
|
key="btn_scan",
|
||||||
|
border_width=BTN_BORDER,
|
||||||
|
disabled_button_color=BTN_DISABLED,
|
||||||
|
mouseover_colors=BTN_DISABLED,
|
||||||
|
),
|
||||||
|
sg.Push(background_color=MAIN_TABS_BG),
|
||||||
sg.Button(
|
sg.Button(
|
||||||
"Sort: IP",
|
"Sort: IP",
|
||||||
disabled=True,
|
disabled=True,
|
||||||
@@ -150,9 +222,24 @@ def get_scan_layout():
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
sg.Button("ALL", key="scan_all"),
|
sg.Button(
|
||||||
sg.Button("REFRESH DATA", key="scan_refresh"),
|
"ALL",
|
||||||
sg.Button("OPEN IN WEB", key="scan_web"),
|
key="scan_all",
|
||||||
|
border_width=BTN_BORDER,
|
||||||
|
disabled_button_color=BTN_DISABLED,
|
||||||
|
),
|
||||||
|
sg.Button(
|
||||||
|
"REFRESH DATA",
|
||||||
|
key="scan_refresh",
|
||||||
|
border_width=BTN_BORDER,
|
||||||
|
disabled_button_color=BTN_DISABLED,
|
||||||
|
),
|
||||||
|
sg.Button(
|
||||||
|
"OPEN IN WEB",
|
||||||
|
key="scan_web",
|
||||||
|
border_width=BTN_BORDER,
|
||||||
|
disabled_button_color=BTN_DISABLED,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
sg.Table(
|
sg.Table(
|
||||||
@@ -163,8 +250,12 @@ def get_scan_layout():
|
|||||||
justification="center",
|
justification="center",
|
||||||
key="scan_table",
|
key="scan_table",
|
||||||
col_widths=SCAN_COL_WIDTHS,
|
col_widths=SCAN_COL_WIDTHS,
|
||||||
background_color="white",
|
background_color=TABLE_BG,
|
||||||
text_color="black",
|
text_color=TABLE_TEXT,
|
||||||
|
header_background_color=TABLE_HEADERS_COLOR,
|
||||||
|
header_text_color=TABLE_HEADERS_TEXT_COLOR,
|
||||||
|
border_width=TABLE_BORDER,
|
||||||
|
header_border_width=TABLE_HEADER_BORDER,
|
||||||
size=(TABLE_TOTAL_WIDTH, TABLE_HEIGHT),
|
size=(TABLE_TOTAL_WIDTH, TABLE_HEIGHT),
|
||||||
expand_x=True,
|
expand_x=True,
|
||||||
enable_click_events=True,
|
enable_click_events=True,
|
||||||
@@ -184,10 +275,15 @@ def get_command_layout():
|
|||||||
|
|
||||||
command_layout = [
|
command_layout = [
|
||||||
[
|
[
|
||||||
sg.Text("Custom Command"),
|
sg.Text("Custom Command", background_color=MAIN_TABS_BG),
|
||||||
sg.InputText(key="cmd_txt", expand_x=True),
|
sg.InputText(key="cmd_txt", expand_x=True),
|
||||||
sg.Button("Send Command", key="btn_cmd"),
|
sg.Button(
|
||||||
sg.Push(),
|
"Send Command",
|
||||||
|
key="btn_cmd",
|
||||||
|
border_width=BTN_BORDER,
|
||||||
|
disabled_button_color=BTN_DISABLED,
|
||||||
|
),
|
||||||
|
sg.Push(background_color=MAIN_TABS_BG),
|
||||||
sg.Button(
|
sg.Button(
|
||||||
"Sort: IP",
|
"Sort: IP",
|
||||||
disabled=True,
|
disabled=True,
|
||||||
@@ -204,10 +300,30 @@ def get_command_layout():
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
sg.Button("ALL", key="cmd_all"),
|
sg.Button(
|
||||||
sg.Button("LIGHT", key="cmd_light"),
|
"ALL",
|
||||||
sg.Button("REBOOT", key="cmd_reboot"),
|
key="cmd_all",
|
||||||
sg.Button("RESTART BACKEND", key="cmd_backend"),
|
border_width=BTN_BORDER,
|
||||||
|
disabled_button_color=BTN_DISABLED,
|
||||||
|
),
|
||||||
|
sg.Button(
|
||||||
|
"LIGHT",
|
||||||
|
key="cmd_light",
|
||||||
|
border_width=BTN_BORDER,
|
||||||
|
disabled_button_color=BTN_DISABLED,
|
||||||
|
),
|
||||||
|
sg.Button(
|
||||||
|
"REBOOT",
|
||||||
|
key="cmd_reboot",
|
||||||
|
border_width=BTN_BORDER,
|
||||||
|
disabled_button_color=BTN_DISABLED,
|
||||||
|
),
|
||||||
|
sg.Button(
|
||||||
|
"RESTART BACKEND",
|
||||||
|
key="cmd_backend",
|
||||||
|
border_width=BTN_BORDER,
|
||||||
|
disabled_button_color=BTN_DISABLED,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
sg.Tree(
|
sg.Tree(
|
||||||
@@ -218,8 +334,12 @@ def get_command_layout():
|
|||||||
justification="center",
|
justification="center",
|
||||||
key="cmd_table",
|
key="cmd_table",
|
||||||
col_widths=col_widths,
|
col_widths=col_widths,
|
||||||
background_color="white",
|
background_color=TABLE_BG,
|
||||||
text_color="black",
|
text_color=TABLE_TEXT,
|
||||||
|
header_background_color=TABLE_HEADERS_COLOR,
|
||||||
|
header_text_color=TABLE_HEADERS_TEXT_COLOR,
|
||||||
|
border_width=TABLE_BORDER,
|
||||||
|
header_border_width=TABLE_HEADER_BORDER,
|
||||||
expand_x=True,
|
expand_x=True,
|
||||||
expand_y=True,
|
expand_y=True,
|
||||||
col0_heading="Light",
|
col0_heading="Light",
|
||||||
@@ -241,10 +361,25 @@ def get_pools_layout():
|
|||||||
]
|
]
|
||||||
pools_layout = [
|
pools_layout = [
|
||||||
[
|
[
|
||||||
sg.Button("ALL", key="pools_all"),
|
sg.Button(
|
||||||
sg.Button("REFRESH DATA", key="pools_refresh"),
|
"ALL",
|
||||||
sg.Button("OPEN IN WEB", key="pools_web"),
|
key="pools_all",
|
||||||
sg.Push(),
|
border_width=BTN_BORDER,
|
||||||
|
disabled_button_color=BTN_DISABLED,
|
||||||
|
),
|
||||||
|
sg.Button(
|
||||||
|
"REFRESH DATA",
|
||||||
|
key="pools_refresh",
|
||||||
|
border_width=BTN_BORDER,
|
||||||
|
disabled_button_color=BTN_DISABLED,
|
||||||
|
),
|
||||||
|
sg.Button(
|
||||||
|
"OPEN IN WEB",
|
||||||
|
key="pools_web",
|
||||||
|
border_width=BTN_BORDER,
|
||||||
|
disabled_button_color=BTN_DISABLED,
|
||||||
|
),
|
||||||
|
sg.Push(background_color=MAIN_TABS_BG),
|
||||||
sg.Button(
|
sg.Button(
|
||||||
"Sort: IP",
|
"Sort: IP",
|
||||||
disabled=True,
|
disabled=True,
|
||||||
@@ -285,8 +420,12 @@ def get_pools_layout():
|
|||||||
max_col_width=15,
|
max_col_width=15,
|
||||||
justification="center",
|
justification="center",
|
||||||
key="pools_table",
|
key="pools_table",
|
||||||
background_color="white",
|
background_color=POOLS_TABLE_BG,
|
||||||
text_color="black",
|
text_color=POOLS_TABLE_TEXT,
|
||||||
|
header_background_color=POOLS_TABLE_HEADERS_COLOR,
|
||||||
|
header_text_color=POOLS_TABLE_HEADERS_TEXT_COLOR,
|
||||||
|
border_width=POOLS_TABLE_BORDER,
|
||||||
|
header_border_width=POOLS_TABLE_HEADER_BORDER,
|
||||||
col_widths=col_widths,
|
col_widths=col_widths,
|
||||||
size=(0, TABLE_HEIGHT),
|
size=(0, TABLE_HEIGHT),
|
||||||
expand_x=True,
|
expand_x=True,
|
||||||
@@ -294,6 +433,7 @@ def get_pools_layout():
|
|||||||
)
|
)
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
background_color=POOLS_TABS_BG,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@@ -311,8 +451,12 @@ def get_pools_layout():
|
|||||||
max_col_width=15,
|
max_col_width=15,
|
||||||
justification="center",
|
justification="center",
|
||||||
key="pools_1_table",
|
key="pools_1_table",
|
||||||
background_color="white",
|
background_color=POOLS_TABLE_BG,
|
||||||
text_color="black",
|
text_color=POOLS_TABLE_TEXT,
|
||||||
|
header_background_color=POOLS_TABLE_HEADERS_COLOR,
|
||||||
|
header_text_color=POOLS_TABLE_HEADERS_TEXT_COLOR,
|
||||||
|
border_width=POOLS_TABLE_BORDER,
|
||||||
|
header_border_width=POOLS_TABLE_HEADER_BORDER,
|
||||||
col_widths=col_widths,
|
col_widths=col_widths,
|
||||||
size=(0, TABLE_HEIGHT),
|
size=(0, TABLE_HEIGHT),
|
||||||
expand_x=True,
|
expand_x=True,
|
||||||
@@ -320,6 +464,7 @@ def get_pools_layout():
|
|||||||
)
|
)
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
background_color=POOLS_TABS_BG,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@@ -337,8 +482,12 @@ def get_pools_layout():
|
|||||||
max_col_width=15,
|
max_col_width=15,
|
||||||
justification="center",
|
justification="center",
|
||||||
key="pools_2_table",
|
key="pools_2_table",
|
||||||
background_color="white",
|
background_color=POOLS_TABLE_BG,
|
||||||
text_color="black",
|
text_color=POOLS_TABLE_TEXT,
|
||||||
|
header_background_color=POOLS_TABLE_HEADERS_COLOR,
|
||||||
|
header_text_color=POOLS_TABLE_HEADERS_TEXT_COLOR,
|
||||||
|
border_width=POOLS_TABLE_BORDER,
|
||||||
|
header_border_width=POOLS_TABLE_HEADER_BORDER,
|
||||||
col_widths=col_widths,
|
col_widths=col_widths,
|
||||||
size=(0, TABLE_HEIGHT),
|
size=(0, TABLE_HEIGHT),
|
||||||
expand_x=True,
|
expand_x=True,
|
||||||
@@ -346,9 +495,17 @@ def get_pools_layout():
|
|||||||
)
|
)
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
background_color=POOLS_TABS_BG,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
]
|
],
|
||||||
|
background_color=MAIN_TABS_BG,
|
||||||
|
title_color=POOLS_TABS_TEXT_NORMAL,
|
||||||
|
tab_background_color=POOLS_TABS_NORMAL,
|
||||||
|
selected_background_color=POOLS_TABS_SELECTED,
|
||||||
|
selected_title_color=POOLS_TABS_TEXT_SELECTED,
|
||||||
|
border_width=0,
|
||||||
|
tab_border_width=2,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
@@ -358,10 +515,25 @@ def get_pools_layout():
|
|||||||
def get_config_layout():
|
def get_config_layout():
|
||||||
config_layout = [
|
config_layout = [
|
||||||
[
|
[
|
||||||
sg.Button("IMPORT", key="cfg_import"),
|
sg.Button(
|
||||||
sg.Button("CONFIG", key="cfg_config"),
|
"IMPORT",
|
||||||
sg.Button("GENERATE", key="cfg_generate"),
|
key="cfg_import",
|
||||||
sg.Push(),
|
border_width=BTN_BORDER,
|
||||||
|
disabled_button_color=BTN_DISABLED,
|
||||||
|
),
|
||||||
|
sg.Button(
|
||||||
|
"CONFIG",
|
||||||
|
key="cfg_config",
|
||||||
|
border_width=BTN_BORDER,
|
||||||
|
disabled_button_color=BTN_DISABLED,
|
||||||
|
),
|
||||||
|
sg.Button(
|
||||||
|
"GENERATE",
|
||||||
|
key="cfg_generate",
|
||||||
|
border_width=BTN_BORDER,
|
||||||
|
disabled_button_color=BTN_DISABLED,
|
||||||
|
),
|
||||||
|
sg.Push(background_color=MAIN_TABS_BG),
|
||||||
sg.Button(
|
sg.Button(
|
||||||
"Sort: IP",
|
"Sort: IP",
|
||||||
disabled=True,
|
disabled=True,
|
||||||
@@ -385,10 +557,24 @@ def get_config_layout():
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
sg.Button("ALL", key="cfg_all"),
|
sg.Button(
|
||||||
sg.Button("OPEN IN WEB", key="cfg_web"),
|
"ALL",
|
||||||
sg.Push(),
|
key="cfg_all",
|
||||||
sg.Checkbox("Append IP to Username", key="cfg_append_ip"),
|
border_width=BTN_BORDER,
|
||||||
|
disabled_button_color=BTN_DISABLED,
|
||||||
|
),
|
||||||
|
sg.Button(
|
||||||
|
"OPEN IN WEB",
|
||||||
|
key="cfg_web",
|
||||||
|
border_width=BTN_BORDER,
|
||||||
|
disabled_button_color=BTN_DISABLED,
|
||||||
|
),
|
||||||
|
sg.Push(background_color=MAIN_TABS_BG),
|
||||||
|
sg.Checkbox(
|
||||||
|
"Append IP to Username",
|
||||||
|
key="cfg_append_ip",
|
||||||
|
background_color=MAIN_TABS_BG,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
sg.Table(
|
sg.Table(
|
||||||
@@ -398,8 +584,12 @@ def get_config_layout():
|
|||||||
max_col_width=15,
|
max_col_width=15,
|
||||||
justification="center",
|
justification="center",
|
||||||
key="cfg_table",
|
key="cfg_table",
|
||||||
background_color="white",
|
background_color=TABLE_BG,
|
||||||
text_color="black",
|
text_color=TABLE_TEXT,
|
||||||
|
header_background_color=TABLE_HEADERS_COLOR,
|
||||||
|
header_text_color=TABLE_HEADERS_TEXT_COLOR,
|
||||||
|
header_border_width=TABLE_HEADER_BORDER,
|
||||||
|
border_width=TABLE_BORDER,
|
||||||
col_widths=[
|
col_widths=[
|
||||||
IP_COL_WIDTH,
|
IP_COL_WIDTH,
|
||||||
MODEL_COL_WIDTH,
|
MODEL_COL_WIDTH,
|
||||||
@@ -426,12 +616,26 @@ layout = [
|
|||||||
[
|
[
|
||||||
sg.TabGroup(
|
sg.TabGroup(
|
||||||
[
|
[
|
||||||
[sg.Tab("Scan", get_scan_layout())],
|
[sg.Tab("Scan", get_scan_layout(), background_color=MAIN_TABS_BG)],
|
||||||
[sg.Tab("Pools", get_pools_layout())],
|
[sg.Tab("Pools", get_pools_layout(), background_color=MAIN_TABS_BG)],
|
||||||
[sg.Tab("Configure", get_config_layout())],
|
[
|
||||||
[sg.Tab("Command", get_command_layout())],
|
sg.Tab(
|
||||||
]
|
"Configure", get_config_layout(), background_color=MAIN_TABS_BG
|
||||||
)
|
)
|
||||||
|
],
|
||||||
|
[
|
||||||
|
sg.Tab(
|
||||||
|
"Command", get_command_layout(), background_color=MAIN_TABS_BG
|
||||||
|
)
|
||||||
|
],
|
||||||
|
],
|
||||||
|
tab_background_color=MAIN_TABS_NORMAL,
|
||||||
|
title_color=MAIN_TABS_TEXT_NORMAL,
|
||||||
|
selected_background_color=MAIN_TABS_BG,
|
||||||
|
selected_title_color=MAIN_TABS_TEXT_SELECTED,
|
||||||
|
border_width=0,
|
||||||
|
tab_border_width=2,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user