diff options
author | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2008-09-23 22:26:39 +0000 |
---|---|---|
committer | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2008-09-23 22:26:39 +0000 |
commit | 6120f203d63e8d191a30ad2b379f257313d35399 (patch) | |
tree | 388f05a62496416035684b3a8084dfe2dd7d182c /navit/script | |
parent | a5bcdfb9470a506a6814a4eaa13c5cf20b7c5fb2 (diff) | |
download | navit-6120f203d63e8d191a30ad2b379f257313d35399.tar.gz |
Fix:script:Made entry actually work
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@1409 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/script')
-rwxr-xr-x | navit/script/gps_emu4 | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/navit/script/gps_emu4 b/navit/script/gps_emu4 index 98a9bef3d..eb293c78a 100755 --- a/navit/script/gps_emu4 +++ b/navit/script/gps_emu4 @@ -6,11 +6,23 @@ sub process_one_packet { $pos[$idx++]=tell(STDIN); while (<STDIN>) { - print $_; + if (!defined($match)) { + print $_; + } else { + $buffer.=$_; + } if (/^\$GPRMC/) { my($dummy,$time,$dummy)=split(/,/,$_); $entry->set_text($time); - return; + if (!defined($match)) { + return; + } + if (substr($time,0,length($match)) eq $match) { + undef $match; + print $buffer; + return; + } + $buffer=''; } } } @@ -53,6 +65,13 @@ sub add_timeout } } +sub entry +{ + $match=$entry->get_text(); + seek(STDIN,0,SEEK_SET); + process_one_packet(); +} + $oldfh = select(STDOUT); $| = 1; select($oldfh); $window = Gtk2::Window->new('toplevel'); $box = Gtk2::HBox->new(); @@ -74,6 +93,7 @@ $button->signal_connect(clicked => sub { add_timeout(0,0) ; backward() }); $box->add($button); $entry = Gtk2::Entry->new(); $entry->set_text("???"); +$entry->signal_connect(activate => \&entry); $box->add($entry); $button = Gtk2::Button->new("+"); $button->signal_connect(clicked => sub { add_timeout(0,0) ; forward() }); |