summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <git@njw.me.uk>2011-08-31 18:24:59 +0100
committerNick White <git@njw.me.uk>2011-08-31 18:24:59 +0100
commit89c7c8fe61bb7a1b3059e43b96a97d80df2d9835 (patch)
tree1b02aeb65498db938132190f2083c2d6200bb354
parentdf47386c77816575cecbc54f89f85c95bf08bd5a (diff)
Add basic tcl/tk gui
-rw-r--r--getgbook.c1
-rw-r--r--gui.tcl24
2 files changed, 25 insertions, 0 deletions
diff --git a/getgbook.c b/getgbook.c
index d1d6e4a..862d90c 100644
--- a/getgbook.c
+++ b/getgbook.c
@@ -128,6 +128,7 @@ int getpage(Page *page)
}
printf("%d downloaded\n", page->num);
+ fflush(stdout);
return 0;
}
diff --git a/gui.tcl b/gui.tcl
new file mode 100644
index 0000000..08d3f04
--- /dev/null
+++ b/gui.tcl
@@ -0,0 +1,24 @@
+#!/usr/bin/tclsh
+# See COPYING file for copyright and license details.
+package require Tk
+
+set bin [list getgbook getabook]
+
+proc go {} {
+ set cmd "[.bin get [.bin curselection]] [.id get]"
+ set out [open "|$cmd" "r"]
+ while {![eof $out]} {
+ .txt insert end [gets $out]
+ .txt insert end "\n"
+ update
+ }
+}
+
+label .lab -text "book id"
+entry .id
+listbox .bin -listvariable bin -exportselection 0
+.bin selection set 0
+button .dl -text "download" -command go
+text .txt
+
+pack .lab .id .bin .dl .txt