fix broken parsing

This commit is contained in:
leca 2024-04-17 10:03:03 +03:00
parent 0ad6550d0b
commit b32b469f0f
2 changed files with 7 additions and 7 deletions

View File

@ -37,14 +37,13 @@
<property name="valign">GTK_ALIGN_FILL</property>
<property name="vexpand">true</property>
<child>
<object class="GtkBox" id="cards_container">
<object class="GtkListBox" id="cards_container">
<property name="valign">GTK_ALIGN_FILL</property>
<property name="halign">GTK_ALIGN_FILL</property>
<property name="orientation">vertical</property>
<!-- <property name="orientation">vertical</property> -->
<property name="hexpand">true</property>
<property name="hexpand-set">true</property>
<!-- <property name="homogeneous">true</property> -->
<property name="orientation">vertical</property>
<property name="halign">GTK_ALIGN_FILL</property>
<property name="valign">GTK_ALIGN_FILL</property>
</object>

View File

@ -14,6 +14,7 @@ use gtk::glib::object::ObjectExt;
use gtk::glib::{clone, closure_local};
use gtk::prelude::WidgetExt;
use gtk::subclass::prelude::*;
use gtk::ListBox;
use gtk::{gio, glib, Box, Button, CompositeTemplate, ScrolledWindow, SearchEntry, Window};
use gtk::{prelude::*, FileDialog};
use rusqlite::Connection;
@ -27,7 +28,7 @@ pub struct MemoryCardsEditScene {
#[template_child]
pub add_button: TemplateChild<Button>,
#[template_child]
pub cards_container: TemplateChild<Box>,
pub cards_container: TemplateChild<ListBox>,
#[template_child]
pub cards_scrolled_window: TemplateChild<ScrolledWindow>,
#[template_child]
@ -94,7 +95,7 @@ impl ObjectImpl for MemoryCardsEditScene {
impl MemoryCardsEditScene {
pub fn clear_displaying_card(&self) {
let c: &Box = self.cards_container.as_ref();
let c: &ListBox = self.cards_container.as_ref();
while c.first_child() != None {
c.remove(&c.first_child().unwrap());
@ -135,7 +136,7 @@ impl MemoryCardsEditScene {
}
pub fn update_card_list(&self) {
let c: &Box = self.cards_container.as_ref();
let c: &ListBox = self.cards_container.as_ref();
self.clear_displaying_card();
@ -162,7 +163,7 @@ impl MemoryCardsEditScene {
let reading_end = hieroglyph_and_reading.find(")").unwrap();
let hieroglyph = hieroglyph_and_reading[..reading_start-1].to_owned();
let reading = hieroglyph_and_reading[reading_start..reading_end].to_owned();
let reading = hieroglyph_and_reading[reading_start+1..reading_end].to_owned();
let translation = card.translation();
//setting corresponding properties