Hi,
trying to write a plugin for drawtiming based on the Diagram plugin
for dot (graphviz)
I have exactly copied the DiagramEditor.pm and DiagramEditor.pl to
TimingEditor.pm and TimingEditor.pl
Since dot and drawtiming works almost exactly the same way, I won't
fill this space with my code, yet.

I have a problem that the application drawtiming isn't registered properly:

Near the top or the .pm file the setup for the application registering is done:

our %DEFAULTS = (
        drawtiming => 'drawtiming -o %2 %1',
);

is for whatever reason empty. When later the test is done:
sub init {
        my $self = shift;
        $self->init_settings('TimingEditor Plugin', \%DEFAULTS);

        # Test if the applications are available
        my $null = File::Spec->devnull;
        my $drawtiming = $$self{settings}{drawtiming};
    #$drawtiming = 'drawtiming -o %2 %1';
        for ($drawtiming) {
                /^(\S+)/; # match base command
        print STDERR "$1\n";
                system("which $1 > $null") == 0 and next;
                
                my $error = __('Can not find application "{name}"', name => 
$1); #.
error when external application is not found
                $self->error_dialog($error);
                #$$self{app}->unplug('TimingEditor');
                die $error."\n";
        }
}

I get the message that app "" cannot be found. I commented out the
unload of the unloading of the plugin to keep it loaded in the
preferences.

If I insert
$drawtiming = 'drawtiming -o %2 %1';
to overload the
my $drawtiming = $$self{settings}{drawtiming};
(in two places in TimingEditor.pm)
the plugin works nicely in zim and I can right-click the .png file to
get the contents of the .tim file just like the DiagramEditor loads
the .dot file from the .png file.

Somehow my registering into the settings has a snag. Any idea what to look for?

-- 
Svenn

_______________________________________________
Mailing list: https://launchpad.net/~zim-wiki
Post to     : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp

Reply via email to