summaryrefslogtreecommitdiff
path: root/navit/script
diff options
context:
space:
mode:
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2008-09-23 22:26:39 +0000
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2008-09-23 22:26:39 +0000
commit6120f203d63e8d191a30ad2b379f257313d35399 (patch)
tree388f05a62496416035684b3a8084dfe2dd7d182c /navit/script
parenta5bcdfb9470a506a6814a4eaa13c5cf20b7c5fb2 (diff)
downloadnavit-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-xnavit/script/gps_emu424
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() });