ui changes

This commit is contained in:
leca 2024-04-09 15:06:27 +03:00
parent 1be42eb584
commit eb26ca7418
4 changed files with 45 additions and 27 deletions

View File

@ -3,7 +3,7 @@
<template class="MemoryCardsEditScene" parent="GtkApplicationWindow"> <template class="MemoryCardsEditScene" parent="GtkApplicationWindow">
<property name="title">Memory cards edit</property> <property name="title">Memory cards edit</property>
<property name="height-request">1000</property> <property name="height-request">1000</property>
<property name="width-request">1000</property> <property name="width-request">200</property>
<child> <child>
<object class="GtkBox" id="content"> <object class="GtkBox" id="content">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
@ -43,9 +43,7 @@
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="hexpand">true</property> <property name="hexpand">true</property>
<property name="hexpand-set">true</property> <property name="hexpand-set">true</property>
<property name="vexpand">true</property> <!-- <property name="homogeneous">true</property> -->
<property name="vexpand-set">true</property>
<property name="homogeneous">true</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="halign">GTK_ALIGN_FILL</property> <property name="halign">GTK_ALIGN_FILL</property>
<property name="valign">GTK_ALIGN_FILL</property> <property name="valign">GTK_ALIGN_FILL</property>

View File

@ -6,6 +6,9 @@
<property name="width-request">512</property> <property name="width-request">512</property>
<child> <child>
<object class="GtkBox" id="content"> <object class="GtkBox" id="content">
<property name="orientation">vertical</property>
<property name="halign">GTK_ALIGN_CENTER</property>
<property name="valign">GTK_ALIGN_CENTER</property>
<child> <child>
<object class="GtkPicture" id="picture"> <object class="GtkPicture" id="picture">
<property name="halign">GTK_ALIGN_CENTER</property> <property name="halign">GTK_ALIGN_CENTER</property>

View File

@ -1,22 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<interface> <interface>
<template class="CardEntry" parent="GtkWidget"> <template class="CardEntry" parent="GtkWidget">
<child>
<object class="GtkGrid">
<child> <child>
<object class="GtkPicture" id="picture"> <object class="GtkPicture" id="picture">
<property name="halign">GTK_ALIGN_START</property> <property name="halign">GTK_ALIGN_START</property>
<property name="valign">GTK_ALIGN_CENTER</property> <property name="valign">GTK_ALIGN_CENTER</property>
<layout>
<property name="column">0</property>
</layout>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkLabel" id="hieroglyph_label"> <object class="GtkLabel" id="hieroglyph_label">
<property name="halign">GTK_ALIGN_START</property> <property name="halign">GTK_ALIGN_START</property>
<property name="valign">GTK_ALIGN_CENTER</property> <property name="valign">GTK_ALIGN_CENTER</property>
<layout>
<property name="column">1</property>
</layout>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkLabel" id="reading_label"> <object class="GtkLabel" id="reading_label">
<property name="halign">GTK_ALIGN_START</property> <property name="halign">GTK_ALIGN_START</property>
<property name="valign">GTK_ALIGN_CENTER</property> <property name="valign">GTK_ALIGN_CENTER</property>
<layout>
<property name="column">2</property>
</layout>
</object> </object>
</child> </child>
<child> <child>
@ -24,6 +35,13 @@
<property name="halign">GTK_ALIGN_END</property> <property name="halign">GTK_ALIGN_END</property>
<property name="valign">GTK_ALIGN_CENTER</property> <property name="valign">GTK_ALIGN_CENTER</property>
<property name="label">delete</property> <property name="label">delete</property>
<property name="hexpand">true</property>
<property name="hexpand-set">true</property>
<layout>
<property name="column">3</property>
</layout>
</object>
</child>
</object> </object>
</child> </child>
</template> </template>

View File

@ -139,7 +139,6 @@ impl MemoryCardsEditScene {
let connection = Connection::open(get_db_path()).unwrap(); let connection = Connection::open(get_db_path()).unwrap();
let imagepath = card.imagepath(); let imagepath = card.imagepath();
let imagename = &Path::new(&imagepath).file_name().unwrap().to_str().unwrap(); let imagename = &Path::new(&imagepath).file_name().unwrap().to_str().unwrap();
dbg!("removing {}", imagename);
fs::remove_file(get_images_store_path() + "/" + &imagename).expect("Could not remove file!"); fs::remove_file(get_images_store_path() + "/" + &imagename).expect("Could not remove file!");
connection.execute("DELETE FROM cards WHERE imagename = ?1", [&imagename]).unwrap(); connection.execute("DELETE FROM cards WHERE imagename = ?1", [&imagename]).unwrap();
self_binding.imp().query_cards(None); self_binding.imp().query_cards(None);