IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Modules Perl Discussion :

Net::DBus HASH attendu mais bloqué


Sujet :

Modules Perl

  1. #1
    Membre régulier
    Homme Profil pro
    Inscrit en
    Janvier 2009
    Messages
    71
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Janvier 2009
    Messages : 71
    Points : 87
    Points
    87
    Par défaut Net::DBus HASH attendu mais bloqué
    bonjour,

    je me code un petit script me permettant de me connecter et de prendre le contrôle via DBus d'une appli.

    mon code actuel :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    #!/usr/bin/perl
     
    use strict;
    use warnings;
    use Net::DBus;
     
    package CairoDock::Applet;
     
    my $object;
     
    sub connect_to_cd_applet {
    	my $applet = shift;
    	my $bus=Net::DBus->session();
    	my $service=$bus->get_service("org.cairodock.CairoDock");
    	$object=$service->get_object("/org/cairodock/CairoDock/".$applet, "org.cairodock.CairoDock.applet");
    }
     
    sub cd_applet_popupdialog {
    	my ($applet,$message,$duration) = @_;
    	&connect_to_cd_applet($applet);
    	my %dialog = (
    		"message" => $message,
    		"time-length" => $duration
    	);
    	my %widget = (
     
    	);
    	$object->PopupDialog(%dialog,%widget);
    }
    sur le wiki de l'appli, je peux lire ceci :
    dialog attributes:

    message (string) : the message of the dialog (empty by default)
    icon (string) : an icon to be displayed next to the message (same icon as the applet by default)
    time-length (int) : time length of the dialog, in second (unlimited duration by default)
    force-above (bool): true to force the dialog above (use it with parcimony, false by default)
    use-markup (bool) : true to use markups (HTML)
    buttons (string) : images of the buttons, separated by comma ";". Adding buttons will trigger an on_answer_dialog signal when the user press one of them. "ok" and "cancel" are used as keywords for the default "ok" and "cancel" buttons defined by the dock.

    widget attributes:

    type (string) : type of the widget (can be "text-entry", "scale", "list")

    text-entry attributes:

    multi-lines (bool) : true to have a multi-lines text-entry, ie a text-view (false by default)
    editable (bool) : whether the user can modify the text or not (true by default)
    visible (bool) : whether the text will be visible or not (useful to type passwords) (true by default)
    nb-chars (int) : maximum number of chars (the current number of chars will be displayed next to the entry) (infinite by default)
    initial-value (string): text initially contained in the entry (empty by default)

    scale attributes:

    min-value (double) : lower value (0 by default)
    max-value (double) : upper value (100 by default)
    nb-digit (int) : number of digits after the dot (2 by default)
    initial-value (double): value initially set to the scale (0 by default)
    min-label (string) : label displayed on the left of the scale (empty by default)
    max-label (string) : label displayed on the right of the scale (empty by default)

    list attributes:

    editable (bool) : true if a non-existing choice can be entered by the user (in this case, the content of the widget will be the selected text, and not the number of the selected line) (false by default)
    values (string) : a list of values, separated by comma ";", used to fill the combo list.
    initial-value (string or int, depending on the "editable" attribute) :
    The initial selection (the number of line or the initial text depending on
    The "editable" attribute) (0 or empty by default)
    donc je dois pouvoir passer plusieurs éléments nommés ( donc un HASH )
    ce qui m'est confirmé par l'exemple donné en python :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    self.icon.PopupDialog( {"message" : "Enter your password:", 
                 "buttons" : "ok;cancel", 
                 "icon" : "gtk-stock-edit"}, 
                 {"widget-type" : "text-entry", 
                 "visible" : false, 
                 "nb-chars" : 30} )
    mais le programme me met cette erreur :
    expected 2 params, but got 4 at /usr/lib/perl5/Net/DBus/Binding/Introspector.pm line 1115.
    donc une idée sur comment faire ?

    cordialement

    ours

  2. #2
    Membre régulier
    Homme Profil pro
    Inscrit en
    Janvier 2009
    Messages
    71
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Janvier 2009
    Messages : 71
    Points : 87
    Points
    87
    Par défaut
    re,

    résolu, il suffisait de rajouter 2 anti-slash
    donc le code devient :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    sub cd_applet_popupdialog {
    	my ($applet,$message,$duration) = @_;
    	&connect_to_cd_applet($applet);
    	my %dialog = (
    		"message" => $message,
    		"time-length" => $duration
    	);
    	my %widget = (
     
    	);
    	$object->PopupDialog(\%dialog,\%widget);
    }
    cordialement

    ours

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 8
    Dernier message: 24/08/2007, 11h18
  2. Le serveur MySQL est démarré mais bloqué
    Par marwanos dans le forum Installation
    Réponses: 9
    Dernier message: 12/03/2007, 00h22
  3. Réponses: 6
    Dernier message: 13/04/2006, 15h54
  4. erreur LOOP attendu , mais pourquoi?
    Par ahage4x4 dans le forum ASP
    Réponses: 10
    Dernier message: 23/05/2005, 16h22
  5. [VB.NET] ComboBox/Datagrid enabled mais pas en saisie
    Par Cereal123 dans le forum Windows Forms
    Réponses: 6
    Dernier message: 10/09/2004, 14h11

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo