aaaaaa
This commit is contained in:
@@ -6,6 +6,7 @@ from kivy.uix.textinput import TextInput
|
||||
from kivy.uix.filechooser import FileChooserIconView
|
||||
from kivy.uix.widget import Widget
|
||||
from kivy.graphics import Color, Rectangle, Line
|
||||
from kivy.uix.scrollview import ScrollView
|
||||
import os
|
||||
import json
|
||||
import shutil
|
||||
@@ -41,11 +42,18 @@ def open_pauses_popup(screen_instance, project_name, RESOURCES_FOLDER, on_save_c
|
||||
except Exception as e:
|
||||
return "Unknown place"
|
||||
|
||||
# Main layout for popup (vertical)
|
||||
layout = BoxLayout(orientation='vertical', spacing=14, padding=14)
|
||||
|
||||
# Scrollable area for pauses
|
||||
pauses_layout = BoxLayout(orientation='vertical', spacing=14, size_hint_y=None, padding=0)
|
||||
pauses_layout.bind(minimum_height=pauses_layout.setter('height'))
|
||||
|
||||
for idx, pause in enumerate(pauses):
|
||||
# Main vertical box for this pause
|
||||
pause_box = BoxLayout(
|
||||
orientation='vertical',
|
||||
spacing=12, # <-- Increase this value for more space between children
|
||||
spacing=6,
|
||||
padding=[6, 0, 6, 4],
|
||||
size_hint_y=None,
|
||||
height=170
|
||||
@@ -53,38 +61,40 @@ def open_pauses_popup(screen_instance, project_name, RESOURCES_FOLDER, on_save_c
|
||||
with pause_box.canvas.before:
|
||||
Color(0.20, 0.20, 0.25, 1)
|
||||
pause_box.bg_rect = Rectangle(pos=pause_box.pos, size=pause_box.size)
|
||||
pause_box.bind(pos=lambda inst, val: setattr(pause_box.bg_rect, 'pos', inst.pos),
|
||||
size=lambda inst, val: setattr(pause_box.bg_rect, 'size', inst.size))
|
||||
Color(0.3, 0.5, 0.9, 1) # Border color
|
||||
pause_box.border_line = Line(rectangle=(pause_box.x, pause_box.y, pause_box.width, pause_box.height), width=1.2)
|
||||
def update_pause_box(instance, value, box=pause_box):
|
||||
box.bg_rect.pos = box.pos
|
||||
box.bg_rect.size = box.size
|
||||
box.border_line.rectangle = (box.x, box.y, box.width, box.height)
|
||||
pause_box.bind(pos=update_pause_box, size=update_pause_box)
|
||||
|
||||
# --- Row 1: Name label ---
|
||||
name_row = BoxLayout(orientation='vertical', size_hint_y=None, height=20, padding=[0,0,0,0])
|
||||
title_label = Label(
|
||||
text=f"[b]Pause {idx+1}[/b]",
|
||||
markup=True,
|
||||
font_size=15,
|
||||
color=(1, 1, 1, 1),
|
||||
size_hint_y=None,
|
||||
height=20,
|
||||
size_hint_y=0.2, # 20% of the pause_box height
|
||||
halign="center",
|
||||
valign="middle"
|
||||
)
|
||||
def update_title_size(instance, value):
|
||||
instance.text_size = (instance.width, None)
|
||||
title_label.bind(width=update_title_size)
|
||||
name_row.add_widget(title_label)
|
||||
pause_box.add_widget(name_row)
|
||||
pause_box.add_widget(title_label)
|
||||
|
||||
# --- Row 2: Location group ---
|
||||
place_group = BoxLayout(orientation='vertical', spacing=1, padding=2, size_hint_y=None, height=34)
|
||||
place_group = BoxLayout(orientation='vertical', spacing=4, padding=4, size_hint_y=0.4)
|
||||
with place_group.canvas.before:
|
||||
Color(0.3, 0.5, 0.9, 0.3)
|
||||
place_group.border_rect = Rectangle(pos=place_group.pos, size=place_group.size)
|
||||
Color(0.3, 0.5, 0.9, 1)
|
||||
place_group.border_line = Line(rectangle=(place_group.x, place_group.y, place_group.width, place_group.height), width=1)
|
||||
def update_place_group(instance, value):
|
||||
place_group.border_rect.pos = place_group.pos
|
||||
place_group.border_rect.size = place_group.size
|
||||
place_group.border_line.rectangle = (place_group.x, place_group.y, place_group.width, place_group.height)
|
||||
def update_place_group(instance, value, box=place_group):
|
||||
box.border_rect.pos = box.pos
|
||||
box.border_rect.size = box.size
|
||||
box.border_line.rectangle = (box.x, box.y, box.width, box.height)
|
||||
place_group.bind(pos=update_place_group, size=update_place_group)
|
||||
|
||||
suggested_place = suggest_location_name(pause["location"]["latitude"], pause["location"]["longitude"])
|
||||
@@ -148,16 +158,16 @@ def open_pauses_popup(screen_instance, project_name, RESOURCES_FOLDER, on_save_c
|
||||
pause_box.add_widget(place_group)
|
||||
|
||||
# --- Row 3: Pictures group ---
|
||||
photo_group = BoxLayout(orientation='vertical', spacing=1, padding=2, size_hint_y=None, height=38)
|
||||
photo_group = BoxLayout(orientation='vertical', spacing=1, padding=2, size_hint_y=0.4)
|
||||
with photo_group.canvas.before:
|
||||
Color(0.2, 0.8, 0.5, 0.2)
|
||||
photo_group.border_rect = Rectangle(pos=photo_group.pos, size=photo_group.size)
|
||||
Color(0.2, 0.8, 0.5, 1)
|
||||
photo_group.border_line = Line(rectangle=(photo_group.x, photo_group.y, photo_group.width, photo_group.height), width=1)
|
||||
def update_photo_group(instance, value):
|
||||
photo_group.border_rect.pos = photo_group.pos
|
||||
photo_group.border_rect.size = photo_group.size
|
||||
photo_group.border_line.rectangle = (photo_group.x, photo_group.y, photo_group.width, photo_group.height)
|
||||
def update_photo_group(instance, value, box=photo_group):
|
||||
box.border_rect.pos = box.pos
|
||||
box.border_rect.size = box.size
|
||||
box.border_line.rectangle = (box.x, box.y, box.width, box.height)
|
||||
photo_group.bind(pos=update_photo_group, size=update_photo_group)
|
||||
|
||||
pause_img_folder = os.path.join(project_folder, f"pause_{idx+1}")
|
||||
@@ -240,7 +250,12 @@ def open_pauses_popup(screen_instance, project_name, RESOURCES_FOLDER, on_save_c
|
||||
Line(points=[0, 1, 1000, 1], width=1)
|
||||
pause_box.add_widget(sep)
|
||||
|
||||
layout.add_widget(pause_box)
|
||||
pauses_layout.add_widget(pause_box)
|
||||
|
||||
scroll = ScrollView(size_hint=(1, 1))
|
||||
scroll.add_widget(pauses_layout)
|
||||
|
||||
layout.add_widget(scroll)
|
||||
|
||||
# Save all and close
|
||||
save_all_btn = Button(text="Save All & Close", size_hint_y=None, height=44, background_color=(0.341, 0.235, 0.980, 1), color=(1,1,1,1))
|
||||
|
||||
Reference in New Issue
Block a user