From 93b356b38f66c378cf9e6c7d9ae362ed8a0b48ec Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Tue, 2 Mar 2010 14:19:07 +0000 Subject: [PATCH] Initial version. --- .gitignore | 1 + README | 10 +- configure.ac | 17 +++ examples/simple/10-hello.html | 1 + examples/simple/20-shell.sh | 9 ++ examples/simple/30-goodbye.html | 9 ++ examples/simple/README | 1 + examples/simple/functions | 4 + techtalk-pse | 79 ----------- techtalk-pse.pl | 284 ++++++++++++++++++++++++++++++++++++++++ 10 files changed, 332 insertions(+), 83 deletions(-) create mode 100644 examples/simple/10-hello.html create mode 100755 examples/simple/20-shell.sh create mode 100644 examples/simple/30-goodbye.html create mode 100644 examples/simple/README create mode 100644 examples/simple/functions delete mode 100755 techtalk-pse create mode 100755 techtalk-pse.pl diff --git a/.gitignore b/.gitignore index 7f8b4ca..19270b5 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ configure install-sh missing techtalk-pse.1 +techtalk-pse \ No newline at end of file diff --git a/README b/README index 8e6c5da..9d0c79a 100644 --- a/README +++ b/README @@ -13,8 +13,10 @@ For examples, see the 'examples' directory in the source. If you have been given a Tech Talk PSE directory of files and have no idea what to do, change into the directory containing the files and -run the command 'techtalk-pse'. If the talk is in the form of a ZIP -or .tar.gz file, run 'techtalk-pse /path/to/talk.zip'. +run the command 'techtalk-pse': + + cd /path/to/talk/ + techtalk-pse For dependencies, run './configure'. In brief you will need: @@ -22,9 +24,9 @@ For dependencies, run './configure'. In brief you will need: - Perl 5 - - Perl Gtk + - Perl Gtk2 - - Perl Gtk MozEmbed (http://search.cpan.org/~tsch/Gtk2-MozEmbed/) + - Perl Gtk2 MozEmbed (http://search.cpan.org/~tsch/Gtk2-MozEmbed/) To build from source: diff --git a/configure.ac b/configure.ac index 1455dea..1f8a184 100644 --- a/configure.ac +++ b/configure.ac @@ -26,5 +26,22 @@ AC_CHECK_PROG([POD2TEXT],[pod2text],[pod2text],[no]) test "x$POD2TEXT" = "xno" && AC_MSG_ERROR([pod2text must be installed]) +dnl Check for required Perl modules. +missing_perl_modules=no +for pm in Pod::Usage Getopt::Long Glib Gtk2 Gtk2::MozEmbed; do + AC_MSG_CHECKING([for $pm]) + if ! perl -M$pm -e1 >/dev/null 2>&1; then + AC_MSG_RESULT([no]) + missing_perl_modules=yes + else + AC_MSG_RESULT([yes]) + fi +done +if test "x$missing_perl_modules" = "xyes"; then + AC_MSG_FAILURE([some Perl modules required to run the program are missing]) +fi + +AC_CONFIG_FILES([techtalk-pse:techtalk-pse.pl], + [chmod 0555 techtalk-pse]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff --git a/examples/simple/10-hello.html b/examples/simple/10-hello.html new file mode 100644 index 0000000..5af67ad --- /dev/null +++ b/examples/simple/10-hello.html @@ -0,0 +1 @@ +Hello, world! diff --git a/examples/simple/20-shell.sh b/examples/simple/20-shell.sh new file mode 100755 index 0000000..eb9341d --- /dev/null +++ b/examples/simple/20-shell.sh @@ -0,0 +1,9 @@ +#!/bin/bash - + +source functions + +cat > $HISTFILE < +
  • 10-hello.html +
  • 20-shell.sh +
  • 30-goodbye.html + diff --git a/examples/simple/README b/examples/simple/README new file mode 100644 index 0000000..26cd6d5 --- /dev/null +++ b/examples/simple/README @@ -0,0 +1 @@ +A very simple, 3 slide talk. diff --git a/examples/simple/functions b/examples/simple/functions new file mode 100644 index 0000000..903777a --- /dev/null +++ b/examples/simple/functions @@ -0,0 +1,4 @@ +export PS1="$ " +export HISTFILE=/tmp/history + +TERMINAL="gnome-terminal --window --geometry=+100+100 --hide-menubar --title='Tech Talk PSE Simple example' -e '/bin/bash --norc'" diff --git a/techtalk-pse b/techtalk-pse deleted file mode 100755 index 2ab0176..0000000 --- a/techtalk-pse +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/perl -w -# -*- perl -*- -# Tech Talk PSE -# Copyright (C) 2010 Red Hat Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -use warnings; -use strict; - -=encoding utf8 - -=head1 NAME - -techtalk-pse - superior technical demonstration software - -=head1 SYNOPSIS - - cd /path/to/presentation/ - techtalk-pse - - techtalk-pse /path/to/presentation/ - - techtalk-pse /path/to/talk.zip - - techtalk-pse /path/to/talk.tar.gz - -=head1 DESCRIPTION - - - -=head1 OPTIONS - - -=cut - - - - - -1; - -=head1 SEE ALSO - -The Cognitive Style of PowerPoint, Tufte, Edward R. - -=head1 AUTHOR - -Richard W.M. Jones L - -=head1 COPYRIGHT - -Copyright (C) 2010 Red Hat Inc. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. diff --git a/techtalk-pse.pl b/techtalk-pse.pl new file mode 100755 index 0000000..0de1375 --- /dev/null +++ b/techtalk-pse.pl @@ -0,0 +1,284 @@ +#!/usr/bin/perl -w +# -*- perl -*- +# @configure_input@ +# +# Tech Talk PSE +# Copyright (C) 2010 Red Hat Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +use warnings; +use strict; +use utf8; + +use Pod::Usage; +use Getopt::Long; +use Glib qw(TRUE FALSE); +use Gtk2 -init; +use Gtk2::MozEmbed; + +=encoding utf8 + +=head1 NAME + +techtalk-pse - superior technical demonstration software + +=head1 SYNOPSIS + + cd /path/to/talk/; techtalk-pse + + techtalk-pse /path/to/talk/ + +=head1 DESCRIPTION + +Tech Talk "Platinum Supreme Edition" (PSE) is Linux Presentation +Software designed by technical people to give technical software +demonstrations to other technical people. It is designed to be simple +to use (for people who know how to use an editor and the command line) +and powerful, so that you can create informative, technically accurate +and entertaining talks and demonstrations. + +Tech Talk PSE is good at opening editors at the right place, opening +shell prompts with preloaded history, compiling and running things +during the demonstration, displaying text, photos, figures and video. + +Tech Talk PSE is I at slide effects, chart junk and bullet +points. + +This manual page covers all the documentation you will need to use +Tech Talk PSE. The next section covers running the tool from the +command line. After that there is a L section to get you +started. Then there is a detailed L section. Finally +there is a discussion on L. + +=head1 RUNNING THE TOOL FROM THE COMMAND LINE + +A Tech Talk PSE talk is not a single file, but a directory full of +files. (If you want to start a new talk, see the L section +below). To display or run the talk, change into the directory +containing all those files and run the C command: + + cd /path/to/talk/; techtalk-pse + +You can also run C without changing directory, instead +specifying the path to the talk: + + techtalk-pse /path/to/talk/ + +=head2 OPTIONS + +=over 4 + +=cut + +my $help; + +=item B<--help> + +Display brief help and exit. + +=cut + +my $last; + +=item B<--last> + +Start at the last slide. + +You cannot use this with the B<-n> / B<--start> option. + +=cut + +my $start; + +=item B<-n SLIDE> | B<--start SLIDE> + +Start at the named slide. I is the shortest unique prefix of +the slide name, so to start at a slide named +I<00010-introduction.html>, you could use I<-n 00010> or I<-n 00010-intro>, +or give the full filename I<-n 00010-introduction.html>. + +The default is to start at the first slide in the talk. + +=cut + +my $splash = 1; + +=item B<--no-splash> + +Don't display the initial "splash" screen which advertises Tech Talk +PSE to your audience. Just go straight into the talk. + +=cut + +my $verbose; + +=item B<--verbose> + +Display verbose messages, useful for debugging or tracing +what the program is doing. + +=cut + +my $version; + +=item B<--version> + +Display version number and exit. + +=cut + +GetOptions ("help|?" => \$help, + "last" => \$last, + "n=s" => \$start, + "splash!" => \$splash, + "start=s" => \$start, + "verbose" => \$verbose, + "version" => \$version, + ) or pod2usage (2); + +=back + +=cut + +pod2usage (1) if $help; +if ($version) { + print "@PACKAGE@ @VERSION@\n"; + exit +} +die "techtalk-pse: cannot use --start and --last options together\n" + if defined $last && defined $start; + +die "techtalk-pse: too many arguments\n" if @ARGV >= 2; + +# Locate the talk. +if (@ARGV > 0) { + my $d = $ARGV[0]; + if (-d $d) { + chdir $d or die "techtalk-pse: chdir: $d: $!"; + } else { + # XXX In future allow people to specify an archive and unpack + # it for them. + die "techtalk-pse: argument is not a directory" + } +} + +# MozEmbed initialization. +Gtk2::MozEmbed->set_profile_path ("$ENV{HOME}/.@PACKAGE@", "Tech Talk PSE"); + +# Get the files. +my @files; +my %groups; +sub reread_directory +{ + @files = (); + %groups = (); + + foreach (glob ("*")) { + if (/^(\d+)([A-Z])?(?:-.*)\.(html|sh|txt)$/) { + print STDERR "reading $_\n" if $verbose; + + my $seq = $1; + my $pos = $2 || "A"; + my $ext = $3; + warn "techtalk-pse: $_: command file is not executable (+x)\n" + if $ext eq "sh" && ! -x $_; + + my $h = { name => $_, seq => $1, pos => $2, ext => $3 }; + push @files, $h; + + $groups{$seq} = [] unless exists $groups{$seq}; + push @{$groups{$seq}}, $h; + } else { + print STDERR "ignoring $_\n" if $verbose; + } + } +} +reread_directory (); +print STDERR "read ", 0+@files, " files\n" if $verbose; +if (@files == 0) { + warn "techtalk-pse: no files found, continuing anyway ...\n" +} + +# Work out what slide we're starting on. +my $current; +if (defined $current) { + die "start slide not implemented yet XXX" +} +elsif (@files) { + $current = $files[0]; +} +# else $current is undefined + +if ($splash) { + my $w = Gtk2::AboutDialog->new; + $w->set_authors ("Richard W.M. Jones"); + $w->set_comments ( + "Superior technical demonstration software\n". + "\n". + "Keys\n". + "↑ — Go back one slide\n". + "↓ — Go forward one slide\n" + ); + $w->set_program_name ("Tech Talk Platinum Supreme Edition (PSE)"); + $w->set_version ("@VERSION@"); + $w->set_website ("http://people.redhat.com/~rjones"); + $w->set_license ("GNU General Public License v2 or above"); + $w->signal_connect (destroy => sub { Gtk2->main_quit }); + $w->show_all; + Gtk2->main; +} + + + + + + + + + +1; + +=head1 TUTORIAL + +=head1 REFERENCE + +=head1 WHAT MAKES A GOOD TALK + +=head1 SEE ALSO + +The Cognitive Style of PowerPoint, Tufte, Edward R. + +=head1 AUTHOR + +Richard W.M. Jones L + +=head1 COPYRIGHT + +Copyright (C) 2010 Red Hat Inc. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -- 1.8.3.1