[tuxdroid-svn] r947 - in software/gadgets/gmail/trunk: . gmail gmail/Data gmail/Pictures gmail/Pict
Status: Beta
Brought to you by:
ks156
Author: jerome Date: 2008-03-22 14:15:32 +0100 (Sat, 22 Mar 2008) New Revision: 947 Added: software/gadgets/gmail/trunk/gmail/Data/ software/gadgets/gmail/trunk/gmail/Data/default_behavior.py software/gadgets/gmail/trunk/gmail/Pictures/ software/gadgets/gmail/trunk/gmail/Pictures/Icons/ software/gadgets/gmail/trunk/gmail/Pictures/Icons/gadget.png software/gadgets/gmail/trunk/gmail/Scripts/ software/gadgets/gmail/trunk/gmail/Scripts/Python/ software/gadgets/gmail/trunk/gmail/Scripts/Python/GUI/ software/gadgets/gmail/trunk/gmail/Scripts/Python/GUI/conf/ software/gadgets/gmail/trunk/gmail/Scripts/Python/GUI/conf/other.glade software/gadgets/gmail/trunk/gmail/Scripts/Python/GUI/conf/other.pyp software/gadgets/gmail/trunk/gmail/Scripts/Python/GUI/widget/ software/gadgets/gmail/trunk/gmail/Scripts/Python/GUI/widget/other.glade software/gadgets/gmail/trunk/gmail/Scripts/Python/GUI/widget/other.pyp software/gadgets/gmail/trunk/gmail/Scripts/Python/init.pyp software/gadgets/gmail/trunk/gmail/Scripts/Python/lgconstants.py software/gadgets/gmail/trunk/gmail/Scripts/Python/libgmail.py software/gadgets/gmail/trunk/gmail/Scripts/Python/main.pyp software/gadgets/gmail/trunk/gmail/Scripts/Python/notify.pyp software/gadgets/gmail/trunk/gmail/Strings/ software/gadgets/gmail/trunk/gmail/Strings/fr_ALL.xml software/gadgets/gmail/trunk/gmail/about.xml software/gadgets/gmail/trunk/gmail/libgmail.py software/gadgets/gmail/trunk/gmail/parts.xml software/gadgets/gmail/trunk/gmail/settings.xml software/gadgets/gmail/trunk/gmail/strings.xml Modified: software/gadgets/gmail/trunk/gmail.tgf Log: * Updated libgmail library, the new version of these library work with the old interface, gmail gadget works again. * Improved texts filters. Added: software/gadgets/gmail/trunk/gmail/Data/default_behavior.py =================================================================== --- software/gadgets/gmail/trunk/gmail/Data/default_behavior.py (rev 0) +++ software/gadgets/gmail/trunk/gmail/Data/default_behavior.py 2008-03-22 13:15:32 UTC (rev 947) @@ -0,0 +1,18 @@ +#!/usr/bin/python +# -*- coding: latin-1 -*- +import sys +sys.path.append('/opt/tuxdroid/api/python') +from tux import * +# ----------------------------------------------------------------------------- +# Object "tux" is created by tux.py +# Your script begins here +# ----------------------------------------------------------------------------- +tux.cmd.wings_on(8, 5) +tux.cmd.mouth_on_free() +tux.tts.speak("You have one or more new emails") +tux.sys.wait(1.0) +tux.cmd.mouth_on_free() +# ----------------------------------------------------------------------------- +# End of your script +# ----------------------------------------------------------------------------- +tux.destroy() Added: software/gadgets/gmail/trunk/gmail/Pictures/Icons/gadget.png =================================================================== (Binary files differ) Property changes on: software/gadgets/gmail/trunk/gmail/Pictures/Icons/gadget.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software/gadgets/gmail/trunk/gmail/Scripts/Python/GUI/conf/other.glade =================================================================== --- software/gadgets/gmail/trunk/gmail/Scripts/Python/GUI/conf/other.glade (rev 0) +++ software/gadgets/gmail/trunk/gmail/Scripts/Python/GUI/conf/other.glade 2008-03-22 13:15:32 UTC (rev 947) @@ -0,0 +1,774 @@ +<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> +<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> + +<glade-interface> + +<widget class="GtkWindow" id="window1"> + <property name="height_request">470</property> + <property name="visible">True</property> + <property name="title" translatable="yes">Parameters</property> + <property name="type">GTK_WINDOW_TOPLEVEL</property> + <property name="window_position">GTK_WIN_POS_NONE</property> + <property name="modal">False</property> + <property name="resizable">True</property> + <property name="destroy_with_parent">False</property> + <property name="decorated">True</property> + <property name="skip_taskbar_hint">False</property> + <property name="skip_pager_hint">False</property> + <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> + <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> + <property name="focus_on_map">True</property> + <property name="urgency_hint">False</property> + + <child> + <widget class="GtkVBox" id="vbox1"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkFrame" id="frame4"> + <property name="border_width">5</property> + <property name="visible">True</property> + <property name="label_xalign">0</property> + <property name="label_yalign">0.5</property> + <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property> + + <child> + <widget class="GtkAlignment" id="alignment7"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">12</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkFixed" id="fixed5"> + <property name="visible">True</property> + + <child> + <widget class="GtkButton" id="button_remote"> + <property name="width_request">62</property> + <property name="height_request">27</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Set</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <signal name="clicked" handler="on_button_remote_clicked" last_modification_time="Sat, 22 Sep 2007 00:55:36 GMT"/> + </widget> + <packing> + <property name="x">256</property> + <property name="y">0</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label_remote"> + <property name="width_request">336</property> + <property name="height_request">16</property> + <property name="visible">True</property> + <property name="label" translatable="yes">Current : None</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">True</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="x">0</property> + <property name="y">0</property> + </packing> + </child> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GtkLabel" id="label11"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Remote</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="type">label_item</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkFrame" id="frame5"> + <property name="border_width">5</property> + <property name="visible">True</property> + <property name="label_xalign">0</property> + <property name="label_yalign">0.5</property> + <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property> + + <child> + <widget class="GtkAlignment" id="alignment8"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">12</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkFixed" id="fixed6"> + <property name="visible">True</property> + + <child> + <widget class="GtkSpinButton" id="delay_spinbutton"> + <property name="width_request">120</property> + <property name="height_request">26</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="climb_rate">1</property> + <property name="digits">0</property> + <property name="numeric">False</property> + <property name="update_policy">GTK_UPDATE_ALWAYS</property> + <property name="snap_to_ticks">False</property> + <property name="wrap">False</property> + <property name="adjustment">1 1 3600 1 10 10</property> + </widget> + <packing> + <property name="x">112</property> + <property name="y">0</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label13"> + <property name="width_request">336</property> + <property name="height_request">16</property> + <property name="visible">True</property> + <property name="label" translatable="yes">Interval (sec) :</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">True</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="x">0</property> + <property name="y">8</property> + </packing> + </child> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GtkLabel" id="label12"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Update</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="type">label_item</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkFrame" id="frame6"> + <property name="border_width">5</property> + <property name="visible">True</property> + <property name="label_xalign">0</property> + <property name="label_yalign">0.5</property> + <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property> + + <child> + <widget class="GtkAlignment" id="alignment9"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">12</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkFixed" id="fixed7"> + <property name="visible">True</property> + + <child> + <widget class="GtkEntry" id="login_entry"> + <property name="width_request">160</property> + <property name="height_request">27</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">True</property> + <property name="visibility">True</property> + <property name="max_length">0</property> + <property name="text" translatable="yes"></property> + <property name="has_frame">True</property> + <property name="invisible_char">•</property> + <property name="activates_default">False</property> + </widget> + <packing> + <property name="x">0</property> + <property name="y">32</property> + </packing> + </child> + + <child> + <widget class="GtkEntry" id="password_entry"> + <property name="width_request">160</property> + <property name="height_request">27</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">True</property> + <property name="visibility">False</property> + <property name="max_length">0</property> + <property name="text" translatable="yes"></property> + <property name="has_frame">True</property> + <property name="invisible_char">*</property> + <property name="activates_default">False</property> + </widget> + <packing> + <property name="x">168</property> + <property name="y">32</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="login_label"> + <property name="width_request">160</property> + <property name="height_request">16</property> + <property name="visible">True</property> + <property name="label" translatable="yes">Login :</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">True</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="x">0</property> + <property name="y">8</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="password_label"> + <property name="width_request">168</property> + <property name="height_request">16</property> + <property name="visible">True</property> + <property name="label" translatable="yes">Password :</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">True</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="x">168</property> + <property name="y">8</property> + </packing> + </child> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GtkLabel" id="label14"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Gmail account</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="type">label_item</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkFrame" id="frame7"> + <property name="border_width">5</property> + <property name="visible">True</property> + <property name="label_xalign">0</property> + <property name="label_yalign">0.5</property> + <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property> + + <child> + <widget class="GtkAlignment" id="alignment10"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">12</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkFixed" id="fixed8"> + <property name="visible">True</property> + + <child> + <widget class="GtkCheckButton" id="behavior_checkbutton"> + <property name="width_request">102</property> + <property name="height_request">22</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Behavior</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="on_behavior_checkbutton_toggled" last_modification_time="Sun, 02 Sep 2007 13:32:32 GMT"/> + </widget> + <packing> + <property name="x">0</property> + <property name="y">0</property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="test_button"> + <property name="width_request">62</property> + <property name="height_request">27</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Test</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <signal name="clicked" handler="on_test_button_clicked" last_modification_time="Sun, 02 Sep 2007 13:32:39 GMT"/> + </widget> + <packing> + <property name="x">248</property> + <property name="y">26</property> + </packing> + </child> + + <child> + <widget class="GtkFileChooserButton" id="behavior_filechooserbutton"> + <property name="width_request">208</property> + <property name="height_request">32</property> + <property name="visible">True</property> + <property name="title" translatable="yes">Sélectionner un fichier</property> + <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property> + <property name="local_only">True</property> + <property name="show_hidden">False</property> + <property name="do_overwrite_confirmation">False</property> + <property name="width_chars">-1</property> + </widget> + <packing> + <property name="x">3</property> + <property name="y">24</property> + </packing> + </child> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GtkLabel" id="label18"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Notification</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="type">label_item</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkFrame" id="frame8"> + <property name="border_width">5</property> + <property name="visible">True</property> + <property name="label_xalign">0</property> + <property name="label_yalign">0.5</property> + <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property> + + <child> + <widget class="GtkAlignment" id="alignment11"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">12</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkFixed" id="fixed9"> + <property name="visible">True</property> + + <child> + <widget class="GtkCheckButton" id="sender_checkbutton"> + <property name="width_request">152</property> + <property name="height_request">22</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Read sender</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="on_sender_checkbutton_toggled" last_modification_time="Sun, 02 Sep 2007 13:32:59 GMT"/> + </widget> + <packing> + <property name="x">0</property> + <property name="y">0</property> + </packing> + </child> + + <child> + <widget class="GtkCheckButton" id="subject_checkbutton"> + <property name="width_request">152</property> + <property name="height_request">22</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Read subject</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="on_subject_checkbutton_toggled" last_modification_time="Sun, 02 Sep 2007 13:33:07 GMT"/> + </widget> + <packing> + <property name="x">0</property> + <property name="y">24</property> + </packing> + </child> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GtkLabel" id="label19"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>TTS</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="type">label_item</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkFixed" id="fixed3"> + <property name="visible">True</property> + + <child> + <widget class="GtkButton" id="button2"> + <property name="width_request">96</property> + <property name="height_request">32</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <signal name="clicked" handler="on_accept_clicked" last_modification_time="Wed, 11 Jul 2007 19:53:32 GMT"/> + + <child> + <widget class="GtkAlignment" id="alignment4"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">0</property> + <property name="yscale">0</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">0</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkHBox" id="hbox2"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">2</property> + + <child> + <widget class="GtkImage" id="image2"> + <property name="visible">True</property> + <property name="stock">gtk-ok</property> + <property name="icon_size">4</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label5"> + <property name="visible">True</property> + <property name="label" translatable="yes">Accept</property> + <property name="use_underline">True</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + </child> + </widget> + </child> + </widget> + <packing> + <property name="x">256</property> + <property name="y">0</property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="button3"> + <property name="width_request">96</property> + <property name="height_request">32</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <signal name="clicked" handler="on_cancel_clicked" last_modification_time="Thu, 09 Aug 2007 13:50:03 GMT"/> + + <child> + <widget class="GtkAlignment" id="alignment5"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">0</property> + <property name="yscale">0</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">0</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkHBox" id="hbox3"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">2</property> + + <child> + <widget class="GtkImage" id="image3"> + <property name="visible">True</property> + <property name="stock">gtk-cancel</property> + <property name="icon_size">4</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label6"> + <property name="visible">True</property> + <property name="label" translatable="yes">Cancel</property> + <property name="use_underline">True</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + </child> + </widget> + </child> + </widget> + <packing> + <property name="x">152</property> + <property name="y">0</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + </child> +</widget> + +</glade-interface> Added: software/gadgets/gmail/trunk/gmail/Scripts/Python/GUI/conf/other.pyp =================================================================== --- software/gadgets/gmail/trunk/gmail/Scripts/Python/GUI/conf/other.pyp (rev 0) +++ software/gadgets/gmail/trunk/gmail/Scripts/Python/GUI/conf/other.pyp 2008-03-22 13:15:32 UTC (rev 947) @@ -0,0 +1,158 @@ +bindtextdomain("params", "") + +class Window(SimpleGladeApp): + + def __init__(self, + path=_me.get_path('root') + '/Scripts/Python/GUI/conf/other.glade', + root="window1", + domain="params", **kwargs): + """ + Constructor + """ + SimpleGladeApp.__init__(self, path, root, domain, **kwargs) + + def new(self): + """ + On new window + """ + self.updates_commons() + self.updates_specifics() + + def make_execute(self, path): + tux.sys.shell('chmod -f %s' % path) + + def updates_commons(self): + """ + Updates common widgets + """ + # Window title + txt = "%s : %s" % (_me.string('name_to_read'), + _me.string('gui_conf_window_title')) + self.get_widget("window1").set_title(txt) + + # Remote Frame + txt = _me.string('gui_conf_remote_title') + self.get_widget("label11").set_text(txt) + + txt = "%s : None" % _me.string('gui_conf_current_bind_lb') + self.get_widget("label_remote").set_text(txt) + + txt = _me.string('gui_conf_remote_set_bt') + self.get_widget("button_remote").set_label(txt) + + # Update Frame + txt = _me.string('gui_conf_update_title') + self.get_widget("label12").set_text(txt) + + txt = "%s : " % _me.string('gui_conf_delay_lb') + self.get_widget("label13").set_text(txt) + + value = _me.get_var('notify_delay') + self.get_widget("delay_spinbutton").set_value(value) + + # Bottom buttons + txt = _me.string('gui_conf_cancel_bt') + self.get_widget("label6").set_text(txt) + + txt = _me.string('gui_conf_accept_bt') + self.get_widget("label5").set_text(txt) + + def updates_specifics(self): + """ + Updates specific widgets + """ + txt = _me.string('gui_conf_account_title') + self.get_widget("label14").set_text(txt) + + txt = _me.get_param('login') + self.get_widget("login_entry").set_text(txt) + + txt = _me.string('gui_conf_login_lb') + self.get_widget("login_label").set_text(txt) + + txt = _me.get_param('password') + self.get_widget("password_entry").set_text(txt) + + txt = _me.string('gui_conf_password_lb') + self.get_widget("password_label").set_text(txt) + + txt = _me.string('gui_conf_notification_title') + self.get_widget("label18").set_text(txt) + + txt = _me.string('gui_conf_reading_title') + self.get_widget("label19").set_text(txt) + + value = _me.get_param('have_a_behavior') + self.get_widget("behavior_checkbutton").set_active(value) + + value = _me.get_param('read_sender') + self.get_widget("sender_checkbutton").set_active(value) + + value = _me.get_param('read_subject') + self.get_widget("subject_checkbutton").set_active(value) + + if _me.get_param('behavior_file') == 'empty': + _me.set_param('behavior_file', _me.get_path('data') + '/default_behavior.py') + + txt = _me.get_param('behavior_file') + if os.path.isfile(txt): + self.get_widget('behavior_filechooserbutton').set_filename(txt) + else: + txt = _me.get_path('data') + '/default_behavior.py' + self.get_widget('behavior_filechooserbutton').set_filename(txt) + + + def on_behavior_checkbutton_toggled(self, widget, *args): + _me.set_param('have_a_behavior', widget.get_active()) + + def on_button_remote_clicked(self, widget, *args): + """ + On button 'set' remote clicked + """ + def remote_set_caption(): + tux.sys.wait(0.1) + gadgets['Manager'].gui('remote').window.set_captions(gadgets[_me.get_name()]) + if gadgets.has_key('Manager'): + if not gadgets['Manager'].gui('remote').showed(): + gadgets['Manager'].gui('remote').show() + thread.start_new_thread(remote_set_caption, ()) + + + def on_behavior_filechooserbutton_selection_changed(self, widget, *args): + filename = widget.get_filename() + if filename != "": + filename = filename.replace('%20', ' ') + _me.set_param('behavior_file', filename) + + + def on_test_button_clicked(self, widget, *args): + """ + On button 'test' remote clicked + """ + #txt = self.get_widget('behavior_filechooserbutton').get_filename() + #if os.path.isfile(txt): + # self.make_execute(txt) + # _me.set_param('behavior_file', txt) + self.on_behavior_filechooserbutton_selection_changed(self.get_widget('behavior_filechooserbutton')) + _me.notify._actuator() + + + + def on_accept_clicked(self, widget, *args): + """ + On button 'accept' clicked + """ + _me.set_var('notify_delay', int(self.get_widget("delay_spinbutton").get_value())) + _me.set_param('login', self.get_widget("login_entry").get_text()) + _me.set_param('password', self.get_widget("password_entry").get_text()) + _me.set_param('have_a_behavior', self.get_widget("behavior_checkbutton").get_active()) + _me.set_param('read_sender', self.get_widget("sender_checkbutton").get_active()) + _me.set_param('read_subject', self.get_widget("subject_checkbutton").get_active()) + + self.get_widget("window1").destroy() + + def on_cancel_clicked(self, widget, *args): + """ + On button 'cancel' clicked + """ + self.get_widget("window1").destroy() Added: software/gadgets/gmail/trunk/gmail/Scripts/Python/GUI/widget/other.glade =================================================================== --- software/gadgets/gmail/trunk/gmail/Scripts/Python/GUI/widget/other.glade (rev 0) +++ software/gadgets/gmail/trunk/gmail/Scripts/Python/GUI/widget/other.glade 2008-03-22 13:15:32 UTC (rev 947) @@ -0,0 +1,101 @@ +<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> +<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> + +<glade-interface> + +<widget class="GtkWindow" id="window1"> + <property name="visible">True</property> + <property name="title" translatable="yes">Widget</property> + <property name="type">GTK_WINDOW_TOPLEVEL</property> + <property name="window_position">GTK_WIN_POS_NONE</property> + <property name="modal">False</property> + <property name="resizable">False</property> + <property name="destroy_with_parent">False</property> + <property name="decorated">True</property> + <property name="skip_taskbar_hint">False</property> + <property name="skip_pager_hint">False</property> + <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> + <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> + <property name="focus_on_map">True</property> + <property name="urgency_hint">False</property> + + <child> + <widget class="GtkFrame" id="frame1"> + <property name="visible">True</property> + <property name="label_xalign">0</property> + <property name="label_yalign">0.5</property> + <property name="shadow_type">GTK_SHADOW_IN</property> + + <child> + <widget class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">12</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkFixed" id="fixed1"> + <property name="visible">True</property> + + <child> + <widget class="GtkLabel" id="label2"> + <property name="width_request">192</property> + <property name="height_request">16</property> + <property name="visible">True</property> + <property name="label" translatable="yes">...</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">True</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="x">0</property> + <property name="y">8</property> + </packing> + </child> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b></b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="type">label_item</property> + </packing> + </child> + </widget> + </child> +</widget> + +</glade-interface> Added: software/gadgets/gmail/trunk/gmail/Scripts/Python/GUI/widget/other.pyp =================================================================== --- software/gadgets/gmail/trunk/gmail/Scripts/Python/GUI/widget/other.pyp (rev 0) +++ software/gadgets/gmail/trunk/gmail/Scripts/Python/GUI/widget/other.pyp 2008-03-22 13:15:32 UTC (rev 947) @@ -0,0 +1,16 @@ +bindtextdomain("params", "") + +class Window(SimpleGladeApp): + + def __init__(self, + path=_me.get_path('root') + '/Scripts/Python/GUI/widget/other.glade', + root="window1", + domain="params", **kwargs): + SimpleGladeApp.__init__(self, path, root, domain, **kwargs) + + def new(self): + self.get_widget("window1").set_title(_me.string('name_to_read')) + #thread.start_new_thread(self.update, ()) + + def update(self): + _me.update_informations() Added: software/gadgets/gmail/trunk/gmail/Scripts/Python/init.pyp =================================================================== --- software/gadgets/gmail/trunk/gmail/Scripts/Python/init.pyp (rev 0) +++ software/gadgets/gmail/trunk/gmail/Scripts/Python/init.pyp 2008-03-22 13:15:32 UTC (rev 947) @@ -0,0 +1,89 @@ +import sys + +sys.path.append(_me.get_path('root') + '/Scripts/Python') + +import libgmail + + +def error_message(error_msg): + """ + Create an error box with an error message passed in params + """ + dialog = GdgDialog('Gmail gadget error', error_msg) + + + +def set_filter(string_name): + """ + Get the current position of < and > operators. + """ + str_1 = '\u003c/b\u003e\u003c/span\u003e' + str_2 = '\u003e\u003cb\u003e' + str_3 = '\u003c/b\u003e' + str_4 = '\u003cb\u003e' + + _LENGHT = len(str_1) + pos_str_1 = string_name.find(str_1) + + if (pos_str_1 != -1): + j = _LENGHT + final_string = '' + while j != pos_str_1: + final_string = final_string + string_name[j] + j += 1 + else: + final_string = string_name + + if final_string.find(str_2) != -1: + tmp = '' + vlue = final_string.find(str_2) + while vlue != len(final_string): + tmp += final_string[vlue] + vlue += 1 + final_string = tmp + + vlue = final_string.find(str_2) + len(str_2) + tmp = '' + while vlue != len(final_string): + tmp += final_string[vlue] + vlue += 1 + final_string = tmp + + if final_string.find(str_3) != -1: + tmp = '' + vlue = final_string.find(str_3) + j = 0 + while j != vlue: + tmp += final_string[j] + j += 1 + final_string = tmp + + + if final_string.find(str_4) != -1: + tmp = '' + vlue = final_string.find(str_4) + len(str_4) + while vlue != len(final_string): + tmp += final_string[vlue] + vlue += 1 + final_string = tmp + + return final_string + + + +def set_author_filter(string_name): + """ + Set a filter to delete html's balises. + """ + pos_base = string_name.find('>') + string_result = '' + pos_base += 1 + while pos_base != len(string_name): + string_result = string_result + string_name[pos_base] + pos_base += 1 + return _me.get_funct('set_filter')(string_result) + + +_me.insert_funct('set_filter', set_filter) +_me.insert_funct('set_author_filter', set_author_filter) +_me.insert_funct('error_message', error_message) Added: software/gadgets/gmail/trunk/gmail/Scripts/Python/lgconstants.py =================================================================== --- software/gadgets/gmail/trunk/gmail/Scripts/Python/lgconstants.py (rev 0) +++ software/gadgets/gmail/trunk/gmail/Scripts/Python/lgconstants.py 2008-03-22 13:15:32 UTC (rev 947) @@ -0,0 +1,231 @@ +# +# Generated file -- DO NOT EDIT +# +# Note: This file is now edited! 2005-04-25 +# +# constants.py -- Useful constants extracted from Gmail Javascript code +# +# Source version: 44f09303f2d4f76f +# +# Generated: 2004-08-10 13:08 UTC +# + + +URL_LOGIN = "https://www.google.com/accounts/ServiceLoginBoxAuth" +URL_GMAIL = "https://mail.google.com/mail/" + + +# Constants with names not from the Gmail Javascript: +U_SAVEDRAFT_VIEW = "sd" + +D_DRAFTINFO = "di" +# NOTE: All other DI_* field offsets seem to match the MI_* field offsets +DI_BODY = 19 + +versionWarned = False # If the Javascript version is different have we + # warned about it? + + +js_version = '44f09303f2d4f76f' + +D_VERSION = "v" +D_QUOTA = "qu" +D_DEFAULTSEARCH_SUMMARY = "ds" +D_THREADLIST_SUMMARY = "ts" +D_THREADLIST_END = "te" +D_THREAD = "t" +D_CONV_SUMMARY = "cs" +D_CONV_END = "ce" +D_MSGINFO = "mi" +D_MSGBODY = "mb" +D_MSGATT = "ma" +D_COMPOSE = "c" +D_CONTACT = "co" +D_CATEGORIES = "ct" +D_CATEGORIES_COUNT_ALL = "cta" +D_ACTION_RESULT = "ar" +D_SENDMAIL_RESULT = "sr" +D_PREFERENCES = "p" +D_PREFERENCES_PANEL = "pp" +D_FILTERS = "fi" +D_GAIA_NAME = "gn" +D_INVITE_STATUS = "i" +D_END_PAGE = "e" +D_LOADING = "l" +D_LOADED_SUCCESS = "ld" +D_LOADED_ERROR = "le" +D_QUICKLOADED = "ql" +QU_SPACEUSED = 0 +QU_QUOTA = 1 +QU_PERCENT = 2 +QU_COLOR = 3 +TS_START = 0 +TS_NUM = 1 +TS_TOTAL = 2 +TS_ESTIMATES = 3 +TS_TITLE = 4 +TS_TIMESTAMP = 5 + 1 +TS_TOTAL_MSGS = 6 + 1 +T_THREADID = 0 +T_UNREAD = 1 +T_STAR = 2 +T_DATE_HTML = 3 +T_AUTHORS_HTML = 4 +T_FLAGS = 5 +T_SUBJECT_HTML = 6 +T_SNIPPET_HTML = 7 +T_CATEGORIES = 8 +T_ATTACH_HTML = 9 +T_MATCHING_MSGID = 10 +T_EXTRA_SNIPPET = 11 +CS_THREADID = 0 +CS_SUBJECT = 1 +CS_TITLE_HTML = 2 +CS_SUMMARY_HTML = 3 +CS_CATEGORIES = 4 +CS_PREVNEXTTHREADIDS = 5 +CS_THREAD_UPDATED = 6 +CS_NUM_MSGS = 7 +CS_ADKEY = 8 +CS_MATCHING_MSGID = 9 +MI_FLAGS = 0 +MI_NUM = 1 +MI_MSGID = 2 +MI_STAR = 3 +MI_REFMSG = 4 +MI_AUTHORNAME = 5 +MI_AUTHORFIRSTNAME = 6 # ? -- Name supplied by rj +MI_AUTHOREMAIL = 6 + 1 +MI_MINIHDRHTML = 7 + 1 +MI_DATEHTML = 8 + 1 +MI_TO = 9 + 1 +MI_CC = 10 + 1 +MI_BCC = 11 + 1 +MI_REPLYTO = 12 + 1 +MI_DATE = 13 + 1 +MI_SUBJECT = 14 + 1 +MI_SNIPPETHTML = 15 + 1 +MI_ATTACHINFO = 16 + 1 +MI_KNOWNAUTHOR = 17 + 1 +MI_PHISHWARNING = 18 + 1 +A_ID = 0 +A_FILENAME = 1 +A_MIMETYPE = 2 +A_FILESIZE = 3 +CT_NAME = 0 +CT_COUNT = 1 +AR_SUCCESS = 0 +AR_MSG = 1 +SM_COMPOSEID = 0 +SM_SUCCESS = 1 +SM_MSG = 2 +SM_NEWTHREADID = 3 +CMD_SEARCH = "SEARCH" +ACTION_TOKEN_COOKIE = "GMAIL_AT" +U_VIEW = "view" +U_PAGE_VIEW = "page" +U_THREADLIST_VIEW = "tl" +U_CONVERSATION_VIEW = "cv" +U_COMPOSE_VIEW = "cm" +U_PRINT_VIEW = "pt" +U_PREFERENCES_VIEW = "pr" +U_JSREPORT_VIEW = "jr" +U_UPDATE_VIEW = "up" +U_SENDMAIL_VIEW = "sm" +U_AD_VIEW = "ad" +U_REPORT_BAD_RELATED_INFO_VIEW = "rbri" +U_ADDRESS_VIEW = "address" +U_ADDRESS_IMPORT_VIEW = "ai" +U_SPELLCHECK_VIEW = "sc" +U_INVITE_VIEW = "invite" +U_ORIGINAL_MESSAGE_VIEW = "om" +U_ATTACHMENT_VIEW = "att" +U_DEBUG_ADS_RESPONSE_VIEW = "da" +U_SEARCH = "search" +U_INBOX_SEARCH = "inbox" +U_STARRED_SEARCH = "starred" +U_ALL_SEARCH = "all" +U_DRAFTS_SEARCH = "drafts" +U_SENT_SEARCH = "sent" +U_SPAM_SEARCH = "spam" +U_TRASH_SEARCH = "trash" +U_QUERY_SEARCH = "query" +U_ADVANCED_SEARCH = "adv" +U_CREATEFILTER_SEARCH = "cf" +U_CATEGORY_SEARCH = "cat" +U_AS_FROM = "as_from" +U_AS_TO = "as_to" +U_AS_SUBJECT = "as_subj" +U_AS_SUBSET = "as_subset" +U_AS_HAS = "as_has" +U_AS_HASNOT = "as_hasnot" +U_AS_ATTACH = "as_attach" +U_AS_WITHIN = "as_within" +U_AS_DATE = "as_date" +U_AS_SUBSET_ALL = "all" +U_AS_SUBSET_INBOX = "inbox" +U_AS_SUBSET_STARRED = "starred" +U_AS_SUBSET_SENT = "sent" +U_AS_SUBSET_DRAFTS = "drafts" +U_AS_SUBSET_SPAM = "spam" +U_AS_SUBSET_TRASH = "trash" +U_AS_SUBSET_ALLSPAMTRASH = "ast" +U_AS_SUBSET_READ = "read" +U_AS_SUBSET_UNREAD = "unread" +U_AS_SUBSET_CATEGORY_PREFIX = "cat_" +U_THREAD = "th" +U_PREV_THREAD = "prev" +U_NEXT_THREAD = "next" +U_DRAFT_MSG = "draft" +U_START = "start" +U_ACTION = "act" +U_ACTION_TOKEN = "at" +U_INBOX_ACTION = "ib" +U_MARKREAD_ACTION = "rd" +U_MARKUNREAD_ACTION = "ur" +U_MARKSPAM_ACTION = "sp" +U_UNMARKSPAM_ACTION = "us" +U_MARKTRASH_ACTION = "tr" +U_ADDCATEGORY_ACTION = "ac_" +U_REMOVECATEGORY_ACTION = "rc_" +U_ADDSTAR_ACTION = "st" +U_REMOVESTAR_ACTION = "xst" +U_ADDSENDERTOCONTACTS_ACTION = "astc" +U_DELETEMESSAGE_ACTION = "dm" +U_DELETE_ACTION = "dl" +U_EMPTYSPAM_ACTION = "es_" +U_EMPTYTRASH_ACTION = "et_" +U_SAVEPREFS_ACTION = "prefs" +U_ADDRESS_ACTION = "a" +U_CREATECATEGORY_ACTION = "cc_" +U_DELETECATEGORY_ACTION = "dc_" +U_RENAMECATEGORY_ACTION = "nc_" +U_CREATEFILTER_ACTION = "cf" +U_REPLACEFILTER_ACTION = "rf" +U_DELETEFILTER_ACTION = "df_" +U_ACTION_THREAD = "t" +U_ACTION_MESSAGE = "m" +U_ACTION_PREF_PREFIX = "p_" +U_REFERENCED_MSG = "rm" +U_COMPOSEID = "cmid" +U_COMPOSE_MODE = "cmode" +U_COMPOSE_SUBJECT = "su" +U_COMPOSE_TO = "to" +U_COMPOSE_CC = "cc" +U_COMPOSE_BCC = "bcc" +U_COMPOSE_BODY = "body" +U_PRINT_THREAD = "pth" +CONV_VIEW = "conv" +TLIST_VIEW = "tlist" +PREFS_VIEW = "prefs" +HIST_VIEW = "hist" +COMPOSE_VIEW = "comp" +HIDDEN_ACTION = 0 +USER_ACTION = 1 +BACKSPACE_ACTION = 2 + +# TODO: Get these on the fly? +STANDARD_FOLDERS = [U_INBOX_SEARCH, U_STARRED_SEARCH, + U_ALL_SEARCH, U_DRAFTS_SEARCH, + U_SENT_SEARCH, U_SPAM_SEARCH] + Added: software/gadgets/gmail/trunk/gmail/Scripts/Python/libgmail.py =================================================================== --- software/gadgets/gmail/trunk/gmail/Scripts/Python/libgmail.py (rev 0) +++ software/gadgets/gmail/trunk/gmail/Scripts/Python/libgmail.py 2008-03-22 13:15:32 UTC (rev 947) @@ -0,0 +1,1659 @@ +#!/usr/bin/env python +# +# libgmail -- Gmail access via Python +# +## To get the version number of the available libgmail version. +## Reminder: add date before next release. This attribute is also +## used in the setup script. +Version = '0.1.8' # (Nov 2007) + +# Original author: fol...@my... +# Maintainers: Waseem (wd...@mi...) and Stas Z (st...@li...) +# +# License: GPL 2.0 +# +# NOTE: +# You should ensure you are permitted to use this script before using it +# to access Google's Gmail servers. +# +# +# Gmail Implementation Notes +# ========================== +# +# * Folders contain message threads, not individual messages. At present I +# do not know any way to list all messages without processing thread list. +# + +LG_DEBUG=0 +from lgconstants import * + +import os,pprint +import re +import urllib +import urllib2 +import mimetypes +import types +from cPickle import load, dump + +from email.MIMEBase import MIMEBase +from email.MIMEText import MIMEText +from email.MIMEMultipart import MIMEMultipart + +GMAIL_URL_LOGIN = "https://www.google.com/accounts/ServiceLoginBoxAuth" +GMAIL_URL_GMAIL = "https://mail.google.com/mail/?ui=1&" + +# Set to any value to use proxy. +PROXY_URL = None # e.g. libgmail.PROXY_URL = 'myproxy.org:3128' + +# TODO: Get these on the fly? +STANDARD_FOLDERS = [U_INBOX_SEARCH, U_STARRED_SEARCH, + U_ALL_SEARCH, U_DRAFTS_SEARCH, + U_SENT_SEARCH, U_SPAM_SEARCH] + +# Constants with names not from the Gmail Javascript: +# TODO: Move to `lgconstants.py`? +U_SAVEDRAFT_VIEW = "sd" + +D_DRAFTINFO = "di" +# NOTE: All other DI_* field offsets seem to match the MI_* field offsets +DI_BODY = 19 + +versionWarned = False # If the Javascript version is different have we + # warned about it? + + +RE_SPLIT_PAGE_CONTENT = re.compile("D\((.*?)\);", re.DOTALL) + +class GmailError(Exception): + ''' + Exception thrown upon gmail-specific failures, in particular a + failure to log in and a failure to parse responses. + + ''' + pass + +class GmailSendError(Exception): + ''' + Exception to throw if we're unable to send a message + ''' + pass + +def _parsePage(pageContent): + """ + Parse the supplied HTML page and extract useful information from + the embedded Javascript. + + """ + lines = pageContent.splitlines() + data = '\n'.join([x for x in lines if x and x[0] in ['D', ')', ',', ']']]) + #data = data.replace(',,',',').replace(',,',',') + data = re.sub(',{2,}', ',', data) + + result = [] + try: + exec data in {'__builtins__': None}, {'D': lambda x: result.append(x)} + except SyntaxError,info: + print info + raise GmailError, 'Failed to parse data returned from gmail.' + + items = result + itemsDict = {} + namesFoundTwice = [] + for item in items: + name = item[0] + try: + parsedValue = item[1:] + except Exception: + parsedValue = [''] + if itemsDict.has_key(name): + # This handles the case where a name key is used more than + # once (e.g. mail items, mail body etc) and automatically + # places the values into list. + # TODO: Check this actually works properly, it's early... :-) + + if len(parsedValue) and type(parsedValue[0]) is types.ListType: + for item in parsedValue: + itemsDict[name].append(item) + else: + itemsDict[name].append(parsedValue) + else: + if len(parsedValue) and type(parsedValue[0]) is types.ListType: + itemsDict[name] = [] + for item in parsedValue: + itemsDict[name].append(item) + else: + itemsDict[name] = [parsedValue] + + return itemsDict + +def _splitBunches(infoItems):# Is this still needed ?? Stas + """ + Utility to help make it easy to iterate over each item separately, + even if they were bunched on the page. + """ + result= [] + # TODO: Decide if this is the best approach. + for group in infoItems: + if type(group) == tuple: + result.extend(group) + else: + result.append(group) + return result + +class SmartRedirectHandler(urllib2.HTTPRedirectHandler): + def __init__(self, cookiejar): + self.cookiejar = cookiejar + + def http_error_302(self, req, fp, code, msg, headers): + # The location redirect doesn't seem to change + # the hostname header appropriately, so we do + # by hand. (Is this a bug in urllib2?) + new_host = re.match(r'http[s]*://(.*?\.google\.com)', + headers.getheader('Location')) + if new_host: + req.add_header("Host", new_host.groups()[0]) + result = urllib2.HTTPRedirectHandler.http_error_302( + self, req, fp, code, msg, headers) + return result + +class CookieJar: + """ + A rough cookie handler, intended to only refer to one domain. + + Does no expiry or anything like that. + + (The only reason this is here is so I don't have to require + the `ClientCookie` package.) + + """ + + def __init__(self): + """ + """ + self._cookies = {} + + + def extractCookies(self, headers, nameFilter = None): + """ + """ + # TODO: Do this all more nicely? + for cookie in headers.getheaders('Set-Cookie'): + name, value = (cookie.split("=", 1) + [""])[:2] + if LG_DEBUG: print "Extracted cookie `%s`" % (name) + if not nameFilter or name in nameFilter: + self._cookies[name] = value.split(";")[0] + if LG_DEBUG: print "Stored cookie `%s` value `%s`" % (name, self._cookies[name]) + if self._cookies[name] == "EXPIRED": + if LG_DEBUG: + print "We got an expired cookie: %s:%s, deleting." % (name, self._cookies[name]) + del self._cookies[name] + + + def addCookie(self, name, value): + """ + """ + self._cookies[name] = value + + + def setCookies(self, request): + """ + """ + request.add_header('Cookie', + ";".join(["%s=%s" % (k,v) + ... [truncated message content] |