Fix for web
This commit is contained in:
22
gui.py
22
gui.py
@ -70,31 +70,31 @@ def get_screen_size():
|
||||
screen_width, screen_height = window.get_screen_size()
|
||||
window.close()
|
||||
|
||||
COMPACT_LAYOUT = screen_width <= 1280 or screen_height <= 800
|
||||
COMPACT_LAYOUT = True
|
||||
|
||||
margin_w, margin_h = WINDOW_MARGIN
|
||||
min_w, min_h = MIN_WINDOW_SIZE
|
||||
|
||||
window_width = min(screen_width, max(min_w, screen_width - margin_w))
|
||||
window_height = min(screen_height, max(min_h, screen_height - margin_h))
|
||||
window_height = min(screen_height, max(min_h, screen_height - margin_h))//2
|
||||
WINDOW_SIZE = (window_width, window_height)
|
||||
|
||||
if COMPACT_LAYOUT:
|
||||
SET_TEXT_WIDTH = 30
|
||||
SET_TEXT_WIDTH_NEW = 34
|
||||
graph_width = min(int(screen_width / 3.6), int(window_width / 3.1))
|
||||
graph_height = max(110, int(screen_height / 6.5))
|
||||
H_SEPARATOR_PAD = (1, 12)
|
||||
OUTPUT_TEXT_PAD = (5, (12, 5))
|
||||
graph_width = min(int(screen_width / 7.2), int(window_width / 5.6))
|
||||
graph_height = max(90, int(screen_height / 16))
|
||||
H_SEPARATOR_PAD = (1, 8)
|
||||
OUTPUT_TEXT_PAD = (5, (8, 3))
|
||||
else:
|
||||
SET_TEXT_WIDTH = 34
|
||||
SET_TEXT_WIDTH_NEW = 40
|
||||
graph_width = int(screen_width / 3.5)
|
||||
graph_height = int(screen_width / (3 * 2.75))
|
||||
H_SEPARATOR_PAD = (1, 20)
|
||||
OUTPUT_TEXT_PAD = (5, (20, 5))
|
||||
graph_width = int(screen_width / 4)
|
||||
graph_height = int(screen_width / (3 * 3.5))
|
||||
H_SEPARATOR_PAD = (1, 15)
|
||||
OUTPUT_TEXT_PAD = (5, (15, 5))
|
||||
|
||||
graph_width = max(220, graph_width)
|
||||
graph_width = max(180, graph_width)
|
||||
GRAPH_CANVAS_SIZE = (graph_width, graph_height)
|
||||
|
||||
return WINDOW_SIZE
|
||||
|
||||
Reference in New Issue
Block a user