saved
This commit is contained in:
@@ -1 +1 @@
|
|||||||
gAAAAABoRH_Q_Meahpxk7Lunh7m8alx_y11I13YKM8SbTOBFqZrqoZ6pCxNK_RMBDRXwoeJhhDCVppaX-WPMGHljzBrsTQ9mUa9yDS6Sp8t-fvZnYEcKlIoRwdqRd3b1HdyJgBxH_AjD
|
gAAAAABoRIBdnJ4AJNsIIQDrg28lJYh3WTX0jucvpvIuryz4n8sdPxEkR41zu8vmDBs-R6CRWBXnN6JZk4_-E71UVMRmYNlc3mELmowS8BupUW59BuruBiJgV4iepoWnpyj4NuiBnJjG
|
||||||
Binary file not shown.
@@ -203,37 +203,40 @@ def open_pauses_popup(screen_instance, project_name, RESOURCES_FOLDER, on_save_c
|
|||||||
file_widgets = []
|
file_widgets = []
|
||||||
|
|
||||||
for fname in files:
|
for fname in files:
|
||||||
|
row = BoxLayout(orientation='horizontal', size_hint_y=None, height=60, padding=4, spacing=8)
|
||||||
thumb_path = os.path.join(pause_img_folder, fname)
|
thumb_path = os.path.join(pause_img_folder, fname)
|
||||||
# Create a Button for the row
|
|
||||||
btn = Button(
|
|
||||||
size_hint_y=None,
|
|
||||||
height=60,
|
|
||||||
background_normal='',
|
|
||||||
background_color=(0.18, 0.18, 0.22, 1),
|
|
||||||
color=(1,1,1,1)
|
|
||||||
)
|
|
||||||
# Layout for image and label inside the button
|
|
||||||
box = BoxLayout(orientation='horizontal', spacing=8, padding=4)
|
|
||||||
img_widget = KivyImage(source=thumb_path, size_hint_x=None, width=60, allow_stretch=True, keep_ratio=True)
|
img_widget = KivyImage(source=thumb_path, size_hint_x=None, width=60, allow_stretch=True, keep_ratio=True)
|
||||||
label = Label(text=fname, color=(1,1,1,1), size_hint_x=1, halign="left", valign="middle")
|
label = Label(text=fname, color=(1,1,1,1), size_hint_x=1, halign="left", valign="middle")
|
||||||
label.bind(size=lambda inst, val: setattr(inst, 'text_size', (inst.width, None)))
|
label.bind(size=lambda inst, val: setattr(inst, 'text_size', (inst.width, None)))
|
||||||
box.add_widget(img_widget)
|
row.add_widget(img_widget)
|
||||||
box.add_widget(label)
|
row.add_widget(label)
|
||||||
btn.add_widget(box)
|
|
||||||
|
|
||||||
def make_on_release(btn, fname):
|
# Background color for selection
|
||||||
def on_release(instance):
|
with row.canvas.before:
|
||||||
|
from kivy.graphics import Color, Rectangle
|
||||||
|
row.bg_color = Color(0.18, 0.18, 0.22, 1)
|
||||||
|
row.bg_rect = Rectangle(pos=row.pos, size=row.size)
|
||||||
|
def update_bg(instance, value):
|
||||||
|
row.bg_rect.pos = row.pos
|
||||||
|
row.bg_rect.size = row.size
|
||||||
|
row.bind(pos=update_bg, size=update_bg)
|
||||||
|
|
||||||
|
# Selection logic
|
||||||
|
def make_on_touch_down(row, fname):
|
||||||
|
def on_touch_down(instance, touch):
|
||||||
|
if row.collide_point(*touch.pos):
|
||||||
if fname in selected_files:
|
if fname in selected_files:
|
||||||
selected_files.remove(fname)
|
selected_files.remove(fname)
|
||||||
btn.background_color = (0.18, 0.18, 0.22, 1)
|
row.bg_color.rgba = (0.18, 0.18, 0.22, 1)
|
||||||
else:
|
else:
|
||||||
selected_files.add(fname)
|
selected_files.add(fname)
|
||||||
btn.background_color = (0.8, 0.1, 0.1, 1)
|
row.bg_color.rgba = (0.8, 0.1, 0.1, 1)
|
||||||
return on_release
|
return False
|
||||||
btn.bind(on_release=make_on_release(btn, fname))
|
return on_touch_down
|
||||||
|
row.bind(on_touch_down=make_on_touch_down(row, fname))
|
||||||
|
|
||||||
file_widgets.append(btn)
|
file_widgets.append(row)
|
||||||
file_list_box.add_widget(btn)
|
file_list_box.add_widget(row)
|
||||||
|
|
||||||
scroll = ScrollView(size_hint=(1, 0.7))
|
scroll = ScrollView(size_hint=(1, 0.7))
|
||||||
scroll.add_widget(file_list_box)
|
scroll.add_widget(file_list_box)
|
||||||
|
|||||||
Reference in New Issue
Block a user