page turning figured out. Must make get_text recursive so that you can call it again once you are done reading.
This commit is contained in:
parent
87cdb7239e
commit
2670e6ffd4
@ -15,7 +15,7 @@
|
||||
<cargoProject FILE="$PROJECT_DIR$/Cargo.toml" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="81820af5-b0ad-4ac7-a939-e3db68fc7214" name="Changes" comment="set termion as backend, curses as frontend. setup for new page turning system to accomodate cursive">
|
||||
<list default="true" id="81820af5-b0ad-4ac7-a939-e3db68fc7214" name="Changes" comment="Figured out how to call a function upon pressing a button without throwing an error. Solution: Open the file every time the button is pressed and go to specified page. File outlasts s function, so error called every time function is called.">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/main.rs" afterDir="false" />
|
||||
</list>
|
||||
@ -190,7 +190,15 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1697339218296</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="8" />
|
||||
<task id="LOCAL-00008" summary="Figured out how to call a function upon pressing a button without throwing an error. Solution: Open the file every time the button is pressed and go to specified page. File outlasts s function, so error called every time function is called.">
|
||||
<option name="closed" value="true" />
|
||||
<created>1699028520042</created>
|
||||
<option name="number" value="00008" />
|
||||
<option name="presentableId" value="LOCAL-00008" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699028520042</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="9" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
@ -236,7 +244,8 @@
|
||||
<MESSAGE value="Fixed stack underflow bug. Must find more elegant solution later." />
|
||||
<MESSAGE value="Created initial display" />
|
||||
<MESSAGE value="set termion as backend, curses as frontend. setup for new page turning system to accomodate cursive" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="set termion as backend, curses as frontend. setup for new page turning system to accomodate cursive" />
|
||||
<MESSAGE value="Figured out how to call a function upon pressing a button without throwing an error. Solution: Open the file every time the button is pressed and go to specified page. File outlasts s function, so error called every time function is called." />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Figured out how to call a function upon pressing a button without throwing an error. Solution: Open the file every time the button is pressed and go to specified page. File outlasts s function, so error called every time function is called." />
|
||||
</component>
|
||||
<component name="XSLT-Support.FileAssociations.UIState">
|
||||
<expand />
|
||||
|
16
src/main.rs
16
src/main.rs
@ -83,9 +83,21 @@ fn get_text(s: &mut Cursive, mut page_num: &i32, direction: &str) {
|
||||
s.pop_layer();
|
||||
let args: Vec<String> = env::args().collect();
|
||||
let filename = &args[1];
|
||||
let doc = EpubDoc::new(&epub_file);
|
||||
let doc = EpubDoc::new(filename);
|
||||
let mut doc = doc.unwrap();
|
||||
let mut usize_num = *page_num as usize;
|
||||
usize_num = usize_num + 1;
|
||||
let title = doc.mdata("title");
|
||||
|
||||
s.add_layer(Dialog::text("D has been pressed! Congratulations! You figured this shit out!"));
|
||||
doc.set_current_page(usize_num);
|
||||
let content = doc.get_current_str();
|
||||
let str_content = content.unwrap();
|
||||
let text = html_module::main(str_content.0);
|
||||
s.add_layer(Dialog::around(TextView::new(text))
|
||||
.title(title + " page: " + &page_num.to_string())
|
||||
.scrollable()
|
||||
.scroll_x(true),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user