Git Version | Version Git
|
lesebas, Wednesday 18 September 2013 à 22:46
|
|
Subscription date : 24 November 2008
Messages : 298
|
Un p'tit UP... je n'ai pas du trop comprendre comment on mettait les "print"! |
|
matttbe, Thursday 19 September 2013 à 20:09
|
|
Subscription date : 24 January 2009
Messages : 12573
|
Il y a bien un print (on voit un "45" dans le debug) mais un 'print' sans rien... ne fait rien
Mais il faut en rajouter beaucoup d'autresprint ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
Par exemple: from CDApplet import CDApplet, _
try:
import glib import gtk import libxml2 except:
from gi.repository import GLib as glib
from gi.repository import Gtk as gtk
from gi.repository import Gdk as gdk
from lxml import etree
import base64 try: import urllib.request as _urllib except:
import urllib2 as _urllib import re import os import sys import webbrowser
import SVGmaker import inspect
class Menu(gtk.Menu):
def __init__(self, inbox):
gtk.Menu.__init__(self)
for mail in inbox:
if mail['title'] == None or len(mail['title']) == 0:
mail['title'] = '<i>(' + _('No Subject') + ')</i>'
string = '<b>'+mail['author']+':</b>\n'+mail['title']
menu_item = gtk.ImageMenuItem()
menu_item.set_label('')
try:
menu_item.set_image(gtk.image_new_from_file('./img/menu-gmail.png'))
except:
menu_item.set_image(gtk.Image.new_from_file('./img/menu-gmail.png'))
menu_item.get_children()[0].set_markup(string)
menu_item.url = mail['link']
menu_item.connect('activate', self.open_mail, mail)
self.append(menu_item)
menu_item.show()
if inbox.index(mail) != len(inbox) - 1:
sep = gtk.SeparatorMenuItem()
self.append(sep)
sep.show()
self.show()
def open_mail(self, menu, mail=None):
""" Opens the mail URL """
try:
link = mail['link']
webbrowser.open(link)
except webbrowser.Error:
os.popen('x-www-browser https://mail.google.com/mail')
class Gmail(CDApplet):
"""
Main applet calling other agents to verify messages and sending signal
to Cairo-Dock's icon.
"""
def __init__(self):
self.account = {} self.config = {} self.flag = None self.path = sys.argv[3][0:-10] self.subpath = self.path+'../../../.Gmail_subscription' self.svgpath = self.path+'emblem.svg' self.wav = os.path.abspath("./snd/pop.wav")
self.rep = False CDApplet.__init__(self)
def get_config(self, keyfile):
"""
Gets configuration from configuration file.
"""
self.config['notify'] = keyfile.getboolean('Configuration', 'NOTIFY')
self.config['anim'] = keyfile.getboolean('Configuration', 'ANIM')
self.config['how'] = keyfile.get('Configuration', 'HOW')
self.config['dia'] = keyfile.getboolean('Configuration', 'DIA')
self.config['sound'] = keyfile.getboolean('Configuration', 'SOUND')
self.config['update'] = keyfile.getint('Configuration', 'UPDATE') * 60000
self.config['count'] = keyfile.getboolean('Configuration', 'COUNT')
self.config['info'] = keyfile.get('Configuration', 'INFO')
wav = keyfile.get('Configuration', 'WAV')
if len(wav) > 0:
self.wav = os.path.abspath(wav)
if len(self.config['how']) == 0:
self.config['how'] = 'default'
if self.account.get('count', 0) > 0:
self.update_display()
if self.flag == 'error':
self.error('')
def check_subscription(self):
"""
Checks which accounts the user subsribed to, gets usernames and
passwords as well as how often the account should be checked.
"""
self.flag = None
try:
file = open(self.subpath, 'r')
sub = file.read()
file.close()
except:
message = _("Please fill in your Gmail account.")
self.error(message)
return
if len(sub) < 1:
message = _("Please fill in your Gmail account.")
self.error(message)
return
account = base64.b64decode(sub.strip('\n').encode('ascii')).decode().split('\n')
if len(account) != 2:
message = _("Please fill in your Gmail account.")
self.error(message)
return
self.account = {'username': account[0],
'password': account[1],
'count': 0,
'diff': 0}
self.check_mail()
self.repeat()
def add_subscription(self, request=None):
"""
Prompts user to add subscription details.
"""
if request == 'username':
self.flag = 'username'
message = _("Please, enter your Gmail username:")
self.icon.PopupDialog({"message" : message, "buttons" : "gtk-go-forward-ltr;cancel"},
{"widget-type" : "text-entry"})
elif request == 'password':
self.flag = 'password'
message = _("Please, enter your Gmail password:")
self.icon.PopupDialog({"message" : message, "buttons" : "ok;cancel"},
{"widget-type" : "text-entry", "visible" : False})
else:
file = open(self.subpath, 'wb')
file.write(base64.b64encode(str(self.account['username']+ \
'\n'+self.account['password']).encode('ascii')))
file.close()
self.check_subscription()
def check_mail_loop(self):
self.check_mail()
return True
def new_mail(self):
try:
link = 'https://mail.google.com/mail/#compose'
webbrowser.open(link)
except webbrowser.Error:
os.popen('x-www-browser '+link)
def check_mail(self, animate=False): """
Checks for new mail and requests notifications.
"""
if animate:
self.icon.Animate('busy',100)
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
data = self.request_gmail()
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
if data == None:
if animate:
self.icon.Animate('',0)
return
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
xml = data.read()
self.account['inbox'] = self.get_inbox(xml)
if animate:
self.icon.Animate('',0)
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
if self.account['inbox'] == None:
return
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
count = len(self.account['inbox'])
self.account['diff'] = count - self.account['count']
self.account['count'] = count
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]) + " diff: " + str (self.account['diff']))
if self.account['diff'] != 0:
self.update_display()
if self.account['count'] > 0:
self.send_alert()
elif self.config['anim'] == True: self.icon.DemandsAttention(False, '')
def get_inbox(self, xml_data):
"""
Counts the unreade messages from the XML inbox content.
"""
inbox = []
try:
try:
tree = libxml2.parseDoc(xml_data)
path = tree.xpathNewContext()
path.xpathRegisterNs('purl', 'http://purl.org/atom/ns#')
entries = path.xpathEval('//purl:entry')
if len(entries) > 0:
for entry in entries:
path.setContextNode(entry)
mail = {}
mail['title'] = path.xpathEval('purl:title')[0].content
mail['summary'] = path.xpathEval('purl:summary')[0].content
mail['link'] = path.xpathEval('purl:link')[0].prop('href')
mail['author'] = path.xpathEval('purl:author/purl:name')[0].content
inbox.append(mail)
except:
tree = etree.fromstring(xml_data)
namespaces = {'purl':'http://purl.org/atom/ns#'}
entries = tree.xpath('purl:entry', namespaces = namespaces)
if len(entries) > 0:
for entry in entries:
mail = {}
mail['title'] = entry.xpath('purl:title', namespaces = namespaces)[0].text
mail['summary'] = entry.xpath('purl:summary', namespaces = namespaces)[0].text
mail['link'] = entry.xpath('purl:link', namespaces = namespaces)[0].get('href')
mail['author'] = entry.xpath('purl:author/purl:name', namespaces = namespaces)[0].text
inbox.append(mail)
return inbox
except:
message = _("WARNING: there was an error reading XML content.")
self.error(message)
return None
def request_gmail(self):
"""
Authenticates and requests inbox content from Gmail.
"""
gmailfeed = 'https://mail.google.com/mail/feed/atom/'
request = _urllib.Request(gmailfeed)
error = None
try:
handle = _urllib.urlopen(request)
except IOError as err:
error = err
if not hasattr(error, 'code') or error.code != 401:
message = _("WARNING: Gmail applet failed to connect to Gmail atom feed.")
self.error(message)
return None
authline = error.headers['www-authenticate']
authobject = re.compile(
r'''(?:\s*www-authenticate\s*:)?\s*(\w*)\s+realm=['"]([^'"]+)['"]''',
re.IGNORECASE)
matchobject = authobject.match(authline)
if not matchobject:
message = _("WARNING: Gmail atom feed is badly formed: ")
m = message + authline
self.error(m)
return None
scheme = matchobject.group(1)
if scheme.lower() != 'basic':
message = _("WARNING: Gmail Applet is not equipped for authentication other than BASIC.")
return self.error(message)
account = ('%s:%s' % (self.account['username'], self.account['password'])).encode('ascii')
base64string = base64.encodestring(account)[:-1].decode()
authheader = "Basic %s" % base64string
request.add_header("Authorization", authheader)
try:
handle = _urllib.urlopen(request)
except IOError as error:
message = _("WARNING: Gmail username or password may be wrong.")
self.error(message)
return None
return handle
def update_display(self):
"""
Updates applet icon either with quickinfo or svg emblem.
Only if new mail count is superior to 0.
"""
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
if self.config['count'] == False:
self.icon.SetQuickInfo('')
self.icon.SetIcon(os.path.abspath('./icon'))
return
if self.config['info'] == 'quickinfo':
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
self.icon.SetIcon(os.path.abspath('./icon'))
if self.account['count'] == 0:
self.icon.SetQuickInfo('')
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
else:
self.icon.SetQuickInfo(str(self.account['count']))
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
else:
self.icon.SetQuickInfo('')
if self.account['count'] == 0:
self.icon.SetIcon(os.path.abspath("./icon"))
else:
size = self.config['info'].split()[0]
SVG = SVGmaker.add_counter(self.account['count'], size)
svg = open(self.svgpath, 'w')
svg.write(SVG)
svg.close()
self.icon.SetIcon(self.svgpath)
def error(self, message):
"""
Warns the user if an error occured.
"""
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
if self.flag == 'error':
return
if self.config['info'] != 'quickinfo':
self.icon.SetQuickInfo('')
size = self.config['info'].split()[0]
file = './img/gmail-error-'+size+'.svg'
self.icon.SetIcon(os.path.abspath(file))
else:
self.icon.SetIcon(os.path.abspath('./icon'))
self.icon.SetQuickInfo(_('Error!'))
if self.flag != None:
return
self.flag = 'error'
self.account['count'] = -99 self.icon.ShowDialog(message, 4)
def send_alert(self):
"""
Notifies user according to requirements.
"""
if self.config['notify'] == False:
return
if self.account['diff'] <= 0:
return
if self.config['anim'] == True:
self.icon.DemandsAttention(True, self.config['how'])
if self.config['dia'] == True:
if self.account['count'] > 1:
message = _("You have %s new emails") % (str(self.account['count']))
else:
message = _("You have 1 new email")
self.icon.ShowDialog(message, 3)
if self.config['sound'] == True:
try:
os.popen('aplay ' + self.wav)
except:
self.wav = os.path.abspath("./snd/pop.wav")
def repeat(self):
"""
Timer for postman to check messages.
Will continue as long as check_messages returns True
"""
if self.rep == True:
pass
self.rep = True
glib.timeout_add(self.config['update'], self.check_mail_loop)
def begin(self):
"""
First method ran by CairoDock when applet is launched.
"""
self.check_subscription()
def on_answer_dialog(self, key, content):
"""
Processes dialogue input for username and password.
"""
if key == 0 or key == CDApplet.DIALOG_KEY_ENTER:
if len(content) > 0:
if self.flag == 'username':
self.account['username'] = format(content)
self.add_subscription('password')
elif self.flag == 'password':
self.account['password'] = format(content)
self.add_subscription()
else:
pass
else:
message = _("Sorry, there was no input!")
self.error(message)
def on_build_menu(self):
"""
Appends items to right-click menu.
"""
message_add_label = _("Add or change subscription")
message_add_tooltip = _("Use this to add or change your Gmail account details.")
message_middle_click = _("middle-click")
message_check_label = _("Check inbox now")
message_check_tooltip = _("Check Gmail inbox now if you can't wait.")
message_new_mail = _("Write a mail")
self.icon.AddMenuItems([{"widget-type" : CDApplet.MENU_ENTRY,
"label": message_add_label,
"icon" : "gtk-add",
"menu" : CDApplet.MAIN_MENU_ID,
"id" : 1,
"tooltip" : message_add_tooltip},
{"widget-type" : CDApplet.MENU_ENTRY,
"label": message_check_label + " (" + message_middle_click + ")",
"icon" : "gtk-refresh",
"menu" : CDApplet.MAIN_MENU_ID,
"id" : 2,
"sensitive" : (len(self.account) > 1), "tooltip" : message_check_tooltip},
{"widget-type" : CDApplet.MENU_ENTRY,
"label": message_new_mail,
"icon" : "gtk-new",
"menu" : CDApplet.MAIN_MENU_ID,
"id" : 3}])
def on_menu_select(self, iNumEntry):
"""
Launches methods according to menu selection.
"""
if iNumEntry == 1:
self.add_subscription('username')
elif iNumEntry == 2:
self.check_mail(True)
elif iNumEntry == 3:
self.new_mail()
def on_click(self, iState):
"""
Launches Gmail in default browser or application.
"""
if len(self.account) <= 1: self.add_subscription('username')
else:
if self.account['count'] < 1: self.check_mail(True)
else: m = Menu(self.account['inbox'])
m.popup(parent_menu_shell=None, parent_menu_item=None, func=self.get_xy, data=(400, 400),
button=1, activate_time=0)
def on_middle_click(self):
"""
Check for new mails now.
"""
self.check_mail(True)
def get_xy(self, m, data):
icondata = self.icon.GetAll()
iconContainer = icondata['container']
iconOrientation = icondata['orientation']
iconWidth = icondata['width']
iconHeight = icondata['height']
iconPosX = icondata['x']
iconPosY = icondata['y']
try:
menuWidth, menuHeight = m.size_request()
screenHeight = gtk.gdk.screen_height()
except:
window = m.get_parent_window()
menuWidth = window.get_width()
menuHeight = window.get_height()
screen = gdk.Screen.get_default()
screenHeight = screen.get_height()
if iconContainer == 1: if iconPosY['y'] < (screenHeight / 2):
iconOrientation = 1
else:
iconOrientation = 0
if iconOrientation == 0:
x = iconPosX - (menuWidth / 2)
y = iconPosY - (iconHeight / 2) - menuHeight
else:
x = iconPosX - (menuWidth / 2)
y = iconPosY + (iconHeight / 2)
return (x, y, True)
if __name__ == "__main__":
gmail = Gmail()
gmail.run()
|
|
lesebas, Thursday 19 September 2013 à 22:42
|
|
Subscription date : 24 November 2008
Messages : 298
|
Bon j'ai tenté pas d'en mettre un maximum mais moi ça ne me parle pas...
[sebastien@Vulpus cairo-dock-plugins-extras-bzr]$ cairo-dock
warning : (/var/abs/local/yaourtbuild/cairo-dock-bzr/src/cairo-dock-core/src/implementations/cairo-dock-glx.c:_initialize_opengl_backend:179)
couldn't find an appropriate visual, trying to get one without Stencil buffer
(it may cause some little deterioration in the rendering) ...
============================================================================
Cairo-Dock version : 3.2.99.beta2
Compiled date : Sep 16 2013 22:58:09
Built with GTK : 3.8
Running with OpenGL: 0
============================================================================
sh : ligne 1 : 2111 Processus arrêté ./"Google" 1 "/org/cairodock/CairoDock/Google" "/home/sebastien/.config/cairo-dock/current_theme/plug-ins/Google/Google.conf" "/home/sebastien/.config/cairo-dock" cairo-dock 2104
libreoffice-writer -> pClassAppli->cStartupWMClass: libreoffice-writer
warning : (/var/abs/local/yaourtbuild/cairo-dock-bzr/src/cairo-dock-core/src/gldit/cairo-dock-packages.c:cairo_dock_list_net_packages:640)
couldn't retrieve packages on http://download.tuxfamily.org/glxdock/themes (check that your connection is alive, or retry later)
warning : (/var/abs/local/yaourtbuild/cairo-dock-bzr/src/cairo-dock-core/src/gldit/cairo-dock-packages.c:cairo_dock_list_packages:712)
while listing distant packages in 'http://download.tuxfamily.org/glxdock/themes/third-party/3.3.0' : Couldn't download file 'http://download.tuxfamily.org/glxdock/themes/third-party/3.3.0/list.conf' (Couldn't resolve host name)
shotwell -> pClassAppli->cStartupWMClass: (null)
wine -> pClassAppli->cStartupWMClass: (null)
gimp -> pClassAppli->cStartupWMClass: (null)
xfce4-terminal -> pClassAppli->cStartupWMClass: (null)
chromium -> pClassAppli->cStartupWMClass: (null)
thunderbird -> pClassAppli->cStartupWMClass: (null)
libreoffice-calc -> pClassAppli->cStartupWMClass: libreoffice-calc
cairo_dock_set_image_on_icon (/usr/share/cairo-dock/plug-ins/Dbus/third-party/Google/icon)
GldiShortkey '<Control>F12' failed!
warning : (/var/abs/local/yaourtbuild/cairo-dock-bzr/src/cairo-dock-core/src/gldit/cairo-dock-keybinder.c:init_object:455)
Couldn't bind '<Control>F12' (Se déconnecter: Afficher le menu de déconnexion)
This shortkey is probably already used by another applet or another application
cairo_dock_set_image_on_icon (/usr/share/cairo-dock/plug-ins/Dbus/third-party/Screensaver_inhibitor/icon)
warning : (/var/abs/local/yaourtbuild/cairo-dock-plugins-bzr/src/cairo-dock-plug-ins/weather/src/applet-read-data.c:cd_weather_get_distant_data:308)
while downloading current conditions data:
http://xml.weather.com/weather/local/FRXX6146?cc=*&unit=m -> Couldn't download file 'http://xml.weather.com/weather/local/FRXX6146?cc=*&unit=m' (Couldn't resolve host name)
cairo_dock_set_image_on_icon (/usr/share/cairo-dock/plug-ins/Dbus/third-party/Gmail/icon)
cairo_dock_set_image_on_icon (/home/sebastien/.config/cairo-dock/extras/dustbin/Silver/trashcan_empty.svg)
File "./Gmail", line 395
else:
^
SyntaxError: invalid syntax
cairo_dock_set_image_on_icon (/usr/share/cairo-dock/plug-ins/showDesktop/icon.png)
GldiShortkey '<Control>F4' failed!
warning : (/var/abs/local/yaourtbuild/cairo-dock-bzr/src/cairo-dock-core/src/gldit/cairo-dock-keybinder.c:init_object:455)
Couldn't bind '<Control>F4' (Afficher le Bureau: Exposé de tous les bureaux)
This shortkey is probably already used by another applet or another application
cairo_dock_set_image_on_icon (/usr/share/cairo-dock/plug-ins/Dbus/third-party/Screensaver_inhibitor/icon.svg)
cairo_dock_set_image_on_icon (/home/sebastien/.config/cairo-dock/extras/weather/7degrees/na.png)
cairo_dock_set_image_on_icon (/home/sebastien/.config/cairo-dock/extras/dustbin/Silver/trashcan_full.svg)
pacmanxg -> pClassAppli->cStartupWMClass: (null)
wicd-client ---> (null)
_cd_find_volume_name_from_drive_name: assertion `pDrive != NULL' failed
_cd_find_volume_name_from_drive_name: assertion `pDrive != NULL' failed
[+] Google: Applet started
warning : (/var/abs/local/yaourtbuild/cairo-dock-plugins-bzr/src/cairo-dock-plug-ins/weather/src/applet-read-data.c:cd_weather_get_distant_data:308)
while downloading current conditions data:
http://xml.weather.com/weather/local/FRXX6146?cc=*&unit=m -> Couldn't download file 'http://xml.weather.com/weather/local/FRXX6146?cc=*&unit=m' (Couldn't resolve host name)
warning : (/var/abs/local/yaourtbuild/cairo-dock-plugins-bzr/src/cairo-dock-plug-ins/weather/src/applet-read-data.c:cd_weather_get_distant_data:308)
while downloading current conditions data:
http://xml.weather.com/weather/local/FRXX6146?cc=*&unit=m -> Couldn't download file 'http://xml.weather.com/weather/local/FRXX6146?cc=*&unit=m' (Couldn't resolve host name)
warning : (/var/abs/local/yaourtbuild/cairo-dock-plugins-bzr/src/cairo-dock-plug-ins/weather/src/applet-read-data.c:cd_weather_get_distant_data:308)
while downloading current conditions data:
http://xml.weather.com/weather/local/FRXX6146?cc=*&unit=m -> Couldn't download file 'http://xml.weather.com/weather/local/FRXX6146?cc=*&unit=m' (Couldn't resolve host name)
[Edit]Par contre avec la rev 429 je n'ai plus accès au menu Gmail (vérifier, ajouter un compte)... et ça ne récupère plus mes message même avec le wifi actif...... ha si... c'est ma version modifiée qui ne marche pas :
from CDApplet import CDApplet, _
try:
import glib import gtk import libxml2 except:
from gi.repository import GLib as glib
from gi.repository import Gtk as gtk
from gi.repository import Gdk as gdk
from lxml import etree
import base64 try: import urllib.request as _urllib except:
import urllib2 as _urllib import re import os import sys import webbrowser
import SVGmaker import inspect
print (inspect.getframeinfo(inspect.currentframe())[1])
class Menu(gtk.Menu):
def __init__(self, inbox):
gtk.Menu.__init__(self)
for mail in inbox:
if mail['title'] == None or len(mail['title']) == 0:
mail['title'] = '<i>(' + _('No Subject') + ')</i>'
string = '<b>'+mail['author']+':</b>\n'+mail['title']
menu_item = gtk.ImageMenuItem()
menu_item.set_label('')
try:
menu_item.set_image(gtk.image_new_from_file('./img/menu-gmail.png'))
except:
menu_item.set_image(gtk.Image.new_from_file('./img/menu-gmail.png'))
menu_item.get_children()[0].set_markup(string)
menu_item.url = mail['link']
menu_item.connect('activate', self.open_mail, mail)
self.append(menu_item)
menu_item.show()
if inbox.index(mail) != len(inbox) - 1:
sep = gtk.SeparatorMenuItem()
self.append(sep)
sep.show()
self.show()
def open_mail(self, menu, mail=None):
""" Opens the mail URL """
try:
link = mail['link']
webbrowser.open(link)
except webbrowser.Error:
os.popen('x-www-browser https://mail.google.com/mail')
class Gmail(CDApplet):
"""
Main applet calling other agents to verify messages and sending signal
to Cairo-Dock's icon.
"""
def __init__(self):
self.account = {} self.config = {} self.flag = None self.path = sys.argv[3][0:-10] self.subpath = self.path+'../../../.Gmail_subscription' self.svgpath = self.path+'emblem.svg' self.wav = os.path.abspath("./snd/pop.wav")
self.rep = False CDApplet.__init__(self)
def get_config(self, keyfile):
"""
Gets configuration from configuration file.
"""
self.config['notify'] = keyfile.getboolean('Configuration', 'NOTIFY')
self.config['anim'] = keyfile.getboolean('Configuration', 'ANIM')
self.config['how'] = keyfile.get('Configuration', 'HOW')
self.config['dia'] = keyfile.getboolean('Configuration', 'DIA')
self.config['sound'] = keyfile.getboolean('Configuration', 'SOUND')
self.config['update'] = keyfile.getint('Configuration', 'UPDATE') * 60000
self.config['count'] = keyfile.getboolean('Configuration', 'COUNT')
self.config['info'] = keyfile.get('Configuration', 'INFO')
wav = keyfile.get('Configuration', 'WAV')
if len(wav) > 0:
self.wav = os.path.abspath(wav)
if len(self.config['how']) == 0:
self.config['how'] = 'default'
if self.account.get('count', 0) > 0:
self.update_display()
if self.flag == 'error':
self.error('')
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
def check_subscription(self):
"""
Checks which accounts the user subsribed to, gets usernames and
passwords as well as how often the account should be checked.
"""
self.flag = None
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
try:
file = open(self.subpath, 'r')
sub = file.read()
file.close()
except:
message = _("Please fill in your Gmail account.")
self.error(message)
return
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
if len(sub) < 1:
message = _("Please fill in your Gmail account.")
self.error(message)
return
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
account = base64.b64decode(sub.strip('\n').encode('ascii')).decode().split('\n')
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
if len(account) != 2:
message = _("Please fill in your Gmail account.")
self.error(message)
return
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
self.account = {'username': account[0],
'password': account[1],
'count': 0,
'diff': 0}
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
self.check_mail()
self.repeat()
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
def add_subscription(self, request=None):
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
"""
Prompts user to add subscription details.
"""
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
if request == 'username':
self.flag = 'username'
message = _("Please, enter your Gmail username:")
self.icon.PopupDialog({"message" : message, "buttons" : "gtk-go-forward-ltr;cancel"},
{"widget-type" : "text-entry"})
elif request == 'password':
self.flag = 'password'
message = _("Please, enter your Gmail password:")
self.icon.PopupDialog({"message" : message, "buttons" : "ok;cancel"},
{"widget-type" : "text-entry", "visible" : False})
else:
file = open(self.subpath, 'wb')
file.write(base64.b64encode(str(self.account['username']+ \
'\n'+self.account['password']).encode('ascii')))
file.close()
self.check_subscription()
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
def check_mail_loop(self):
self.check_mail()
return True
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
def new_mail(self):
try:
link = 'https://mail.google.com/mail/#compose'
webbrowser.open(link)
except webbrowser.Error:
os.popen('x-www-browser '+link)
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
def check_mail(self, animate=False): print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
"""
Checks for new mail and requests notifications.
"""
if animate:
self.icon.Animate('busy',100)
data = self.request_gmail()
if data == None:
if animate:
self.icon.Animate('',0)
return
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
xml = data.read()
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
self.account['inbox'] = self.get_inbox(xml)
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
if animate:
self.icon.Animate('',0)
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
if self.account['inbox'] == None:
return
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
count = len(self.account['inbox'])
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
self.account['diff'] = count - self.account['count']
self.account['count'] = count
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
if self.account['diff'] != 0:
self.update_display()
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
if self.account['count'] > 0:
self.send_alert()
elif self.config['anim'] == True: self.icon.DemandsAttention(False, '')
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
def get_inbox(self, xml_data):
"""
Counts the unreade messages from the XML inbox content.
"""
inbox = []
try:
try:
tree = libxml2.parseDoc(xml_data)
path = tree.xpathNewContext()
path.xpathRegisterNs('purl', 'http://purl.org/atom/ns#')
entries = path.xpathEval('//purl:entry')
if len(entries) > 0:
for entry in entries:
path.setContextNode(entry)
mail = {}
mail['title'] = path.xpathEval('purl:title')[0].content
mail['summary'] = path.xpathEval('purl:summary')[0].content
mail['link'] = path.xpathEval('purl:link')[0].prop('href')
mail['author'] = path.xpathEval('purl:author/purl:name')[0].content
inbox.append(mail)
except:
tree = etree.fromstring(xml_data)
namespaces = {'purl':'http://purl.org/atom/ns#'}
entries = tree.xpath('purl:entry', namespaces = namespaces)
if len(entries) > 0:
for entry in entries:
mail = {}
mail['title'] = entry.xpath('purl:title', namespaces = namespaces)[0].text
mail['summary'] = entry.xpath('purl:summary', namespaces = namespaces)[0].text
mail['link'] = entry.xpath('purl:link', namespaces = namespaces)[0].get('href')
mail['author'] = entry.xpath('purl:author/purl:name', namespaces = namespaces)[0].text
inbox.append(mail)
return inbox
except:
message = _("WARNING: there was an error reading XML content.")
self.error(message)
return None
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
def request_gmail(self):
"""
Authenticates and requests inbox content from Gmail.
"""
gmailfeed = 'https://mail.google.com/mail/feed/atom/'
request = _urllib.Request(gmailfeed)
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
error = None
try:
handle = _urllib.urlopen(request)
except IOError as err:
error = err
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
if not hasattr(error, 'code') or error.code != 401:
message = _("WARNING: Gmail applet failed to connect to Gmail atom feed.")
self.error(message)
return None
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
authline = error.headers['www-authenticate']
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
authobject = re.compile(
r'''(?:\s*www-authenticate\s*:)?\s*(\w*)\s+realm=['"]([^'"]+)['"]''',
re.IGNORECASE)
matchobject = authobject.match(authline)
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
if not matchobject:
message = _("WARNING: Gmail atom feed is badly formed: ")
m = message + authline
self.error(m)
return None
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
scheme = matchobject.group(1)
if scheme.lower() != 'basic':
message = _("WARNING: Gmail Applet is not equipped for authentication other than BASIC.")
return self.error(message)
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
account = ('%s:%s' % (self.account['username'], self.account['password'])).encode('ascii')
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
base64string = base64.encodestring(account)[:-1].decode()
authheader = "Basic %s" % base64string
request.add_header("Authorization", authheader)
try:
handle = _urllib.urlopen(request)
except IOError as error:
message = _("WARNING: Gmail username or password may be wrong.")
self.error(message)
return None
return handle
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
def update_display(self):
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
"""
Updates applet icon either with quickinfo or svg emblem.
Only if new mail count is superior to 0.
"""
print
if self.config['count'] == False:
self.icon.SetQuickInfo('')
self.icon.SetIcon(os.path.abspath('./icon'))
return
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
if self.config['info'] == 'quickinfo':
self.icon.SetIcon(os.path.abspath('./icon'))
if self.account['count'] == 0:
self.icon.SetQuickInfo('')
else:
self.icon.SetQuickInfo(str(self.account['count']))
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
else:
self.icon.SetQuickInfo('')
if self.account['count'] == 0:
self.icon.SetIcon(os.path.abspath("./icon"))
else:
size = self.config['info'].split()[0]
SVG = SVGmaker.add_counter(self.account['count'], size)
svg = open(self.svgpath, 'w')
svg.write(SVG)
svg.close()
self.icon.SetIcon(self.svgpath)
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
def error(self, message):
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
"""
Warns the user if an error occured.
"""
if self.flag == 'error':
return
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
if self.config['info'] != 'quickinfo':
self.icon.SetQuickInfo('')
size = self.config['info'].split()[0]
file = './img/gmail-error-'+size+'.svg'
self.icon.SetIcon(os.path.abspath(file))
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
else:
self.icon.SetIcon(os.path.abspath('./icon'))
self.icon.SetQuickInfo(_('Error!'))
if self.flag != None:
return
self.flag = 'error'
self.account['count'] = -99 self.icon.ShowDialog(message, 4)
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
def send_alert(self):
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
"""
Notifies user according to requirements.
"""
if self.config['notify'] == False:
return
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
if self.account['diff'] <= 0:
return
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
if self.config['anim'] == True:
self.icon.DemandsAttention(True, self.config['how'])
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
if self.config['dia'] == True:
if self.account['count'] > 1:
message = _("You have %s new emails") % (str(self.account['count']))
else:
message = _("You have 1 new email")
self.icon.ShowDialog(message, 3)
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
if self.config['sound'] == True:
try:
os.popen('aplay ' + self.wav)
except:
self.wav = os.path.abspath("./snd/pop.wav")
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
def repeat(self):
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
"""
Timer for postman to check messages.
Will continue as long as check_messages returns True
"""
if self.rep == True:
pass
self.rep = True
glib.timeout_add(self.config['update'], self.check_mail_loop)
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
def begin(self):
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
"""
First method ran by CairoDock when applet is launched.
"""
self.check_subscription()
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
def on_answer_dialog(self, key, content):
"""
Processes dialogue input for username and password.
"""
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
if key == 0 or key == CDApplet.DIALOG_KEY_ENTER:
if len(content) > 0:
if self.flag == 'username':
self.account['username'] = format(content)
self.add_subscription('password')
elif self.flag == 'password':
self.account['password'] = format(content)
self.add_subscription()
else:
pass
else:
message = _("Sorry, there was no input!")
self.error(message)
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
def on_build_menu(self):
"""
Appends items to right-click menu.
"""
message_add_label = _("Add or change subscription")
message_add_tooltip = _("Use this to add or change your Gmail account details.")
message_middle_click = _("middle-click")
message_check_label = _("Check inbox now")
message_check_tooltip = _("Check Gmail inbox now if you can't wait.")
message_new_mail = _("Write a mail")
self.icon.AddMenuItems([{"widget-type" : CDApplet.MENU_ENTRY,
"label": message_add_label,
"icon" : "gtk-add",
"menu" : CDApplet.MAIN_MENU_ID,
"id" : 1,
"tooltip" : message_add_tooltip},
{"widget-type" : CDApplet.MENU_ENTRY,
"label": message_check_label + " (" + message_middle_click + ")",
"icon" : "gtk-refresh",
"menu" : CDApplet.MAIN_MENU_ID,
"id" : 2,
"sensitive" : (len(self.account) > 1), "tooltip" : message_check_tooltip},
{"widget-type" : CDApplet.MENU_ENTRY,
"label": message_new_mail,
"icon" : "gtk-new",
"menu" : CDApplet.MAIN_MENU_ID,
"id" : 3}])
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
def on_menu_select(self, iNumEntry):
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
"""
Launches methods according to menu selection.
"""
if iNumEntry == 1:
self.add_subscription('username')
elif iNumEntry == 2:
self.check_mail(True)
elif iNumEntry == 3:
self.new_mail()
def on_click(self, iState):
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
"""
Launches Gmail in default browser or application.
"""
if len(self.account) <= 1: self.add_subscription('username')
else:
if self.account['count'] < 1: self.check_mail(True)
else: m = Menu(self.account['inbox'])
m.popup(parent_menu_shell=None, parent_menu_item=None, func=self.get_xy, data=(400, 400),
button=1, activate_time=0)
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
def on_middle_click(self):
"""
Check for new mails now.
"""
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
self.check_mail(True)
print ("==== GMail: " + str (inspect.getframeinfo(inspect.currentframe())[1]))
def get_xy(self, m, data):
icondata = self.icon.GetAll()
iconContainer = icondata['container']
iconOrientation = icondata['orientation']
iconWidth = icondata['width']
iconHeight = icondata['height']
iconPosX = icondata['x']
iconPosY = icondata['y']
try:
menuWidth, menuHeight = m.size_request()
screenHeight = gtk.gdk.screen_height()
except:
window = m.get_parent_window()
menuWidth = window.get_width()
menuHeight = window.get_height()
screen = gdk.Screen.get_default()
screenHeight = screen.get_height()
if iconContainer == 1: if iconPosY['y'] < (screenHeight / 2):
iconOrientation = 1
else:
iconOrientation = 0
if iconOrientation == 0:
x = iconPosX - (menuWidth / 2)
y = iconPosY - (iconHeight / 2) - menuHeight
else:
x = iconPosX - (menuWidth / 2)
y = iconPosY + (iconHeight / 2)
return (x, y, True)
if __name__ == "__main__":
gmail = Gmail()
gmail.run()
J'ai du y aller un peu fort sur les print
@matttbe : ta version aussi plante! |
|
matttbe, Thursday 19 September 2013 à 22:51
|
|
Subscription date : 24 January 2009
Messages : 12573
|
Bon j'ai tenté pas d'en mettre un maximum mais moi ça ne me parle pas... Peux-tu essayé uniquement en prenant tout le code de mon précédent commentaire?
Car d'après l'erreur dans le terminal, il y a une erreur de syntaxe à la ligne 395 or ça n'a rien à voir avec le code que je t'ai donné (attention, en Python, il faut respecter l'indentation!) |
|
lesebas, Thursday 19 September 2013 à 22:57
|
|
Subscription date : 24 November 2008
Messages : 298
|
Avec le tiens error line 202... je regarde! |
|
matttbe, Thursday 19 September 2013 à 23:06
|
|
|
lesebas, Thursday 19 September 2013 à 23:06
|
|
Subscription date : 24 November 2008
Messages : 298
|
Ok y'avait un espace en trop... Voila ce que ça donne, quand je rafraichi une fois le wifi connecté il appelle les lignes 228 - 426 - 231... idem toutes les minutes :
[sebastien@Vulpus Gmail]$ cairo-dock
warning : (/var/abs/local/yaourtbuild/cairo-dock-bzr/src/cairo-dock-core/src/implementations/cairo-dock-glx.c:_initialize_opengl_backend:179)
couldn't find an appropriate visual, trying to get one without Stencil buffer
(it may cause some little deterioration in the rendering) ...
============================================================================
Cairo-Dock version : 3.2.99.beta2
Compiled date : Sep 16 2013 22:58:09
Built with GTK : 3.8
Running with OpenGL: 0
============================================================================
libreoffice-writer -> pClassAppli->cStartupWMClass: libreoffice-writer
warning : (/var/abs/local/yaourtbuild/cairo-dock-bzr/src/cairo-dock-core/src/gldit/cairo-dock-packages.c:cairo_dock_list_net_packages:640)
couldn't retrieve packages on http://download.tuxfamily.org/glxdock/themes (check that your connection is alive, or retry later)
warning : (/var/abs/local/yaourtbuild/cairo-dock-bzr/src/cairo-dock-core/src/gldit/cairo-dock-packages.c:cairo_dock_list_packages:712)
while listing distant packages in 'http://download.tuxfamily.org/glxdock/themes/third-party/3.3.0' : Couldn't download file 'http://download.tuxfamily.org/glxdock/themes/third-party/3.3.0/list.conf' (Couldn't resolve host name)
shotwell -> pClassAppli->cStartupWMClass: (null)
wine -> pClassAppli->cStartupWMClass: (null)
gimp -> pClassAppli->cStartupWMClass: (null)
xfce4-terminal -> pClassAppli->cStartupWMClass: (null)
chromium -> pClassAppli->cStartupWMClass: (null)
thunderbird -> pClassAppli->cStartupWMClass: (null)
libreoffice-calc -> pClassAppli->cStartupWMClass: libreoffice-calc
cairo_dock_set_image_on_icon (/usr/share/cairo-dock/plug-ins/Dbus/third-party/Google/icon)
GldiShortkey '<Control>F12' failed!
warning : (/var/abs/local/yaourtbuild/cairo-dock-bzr/src/cairo-dock-core/src/gldit/cairo-dock-keybinder.c:init_object:455)
Couldn't bind '<Control>F12' (Se déconnecter: Afficher le menu de déconnexion)
This shortkey is probably already used by another applet or another application
cairo_dock_set_image_on_icon (/usr/share/cairo-dock/plug-ins/Dbus/third-party/Screensaver_inhibitor/icon)
cairo_dock_set_image_on_icon (/usr/share/cairo-dock/plug-ins/Dbus/third-party/Gmail/icon)
warning : (/var/abs/local/yaourtbuild/cairo-dock-plugins-bzr/src/cairo-dock-plug-ins/weather/src/applet-read-data.c:cd_weather_get_distant_data:308)
while downloading current conditions data:
http://xml.weather.com/weather/local/FRXX6146?cc=*&unit=m -> Couldn't download file 'http://xml.weather.com/weather/local/FRXX6146?cc=*&unit=m' (Couldn't resolve host name)
cairo_dock_set_image_on_icon (/home/sebastien/.config/cairo-dock/extras/dustbin/Silver/trashcan_empty.svg)
cairo_dock_set_image_on_icon (/usr/share/cairo-dock/plug-ins/showDesktop/icon.png)
GldiShortkey '<Control>F4' failed!
warning : (/var/abs/local/yaourtbuild/cairo-dock-bzr/src/cairo-dock-core/src/gldit/cairo-dock-keybinder.c:init_object:455)
Couldn't bind '<Control>F4' (Afficher le Bureau: Exposé de tous les bureaux)
This shortkey is probably already used by another applet or another application
cairo_dock_set_image_on_icon (/home/sebastien/.config/cairo-dock/extras/weather/7degrees/na.png)
cairo_dock_set_image_on_icon (/home/sebastien/.config/cairo-dock/extras/dustbin/Silver/trashcan_full.svg)
thunar -> pClassAppli->cStartupWMClass: (null)
pacmanxg -> pClassAppli->cStartupWMClass: (null)
wicd-client ---> (null)
cairo_dock_set_image_on_icon (/usr/share/cairo-dock/plug-ins/Dbus/third-party/Screensaver_inhibitor/icon.svg)
_cd_find_volume_name_from_drive_name: assertion `pDrive != NULL' failed
_cd_find_volume_name_from_drive_name: assertion `pDrive != NULL' failed
==== GMail: 228
==== GMail: 426
[+] Google: Applet started
cairo_dock_set_image_on_icon (/usr/share/cairo-dock/plug-ins/Dbus/third-party/Gmail/icon)
==== GMail: 231
cairo_dock_set_image_on_icon (/home/sebastien/.config/cairo-dock/extras/weather/7degrees/26.png)
==== GMail: 228
==== GMail: 426
==== GMail: 231
==== GMail: 228
==== GMail: 426
==== GMail: 231
==== GMail: 228
==== GMail: 426
==== GMail: 231
Par contre si j'ai le réseau dès le départ :
[sebastien@Vulpus Gmail]$ cairo-dock
warning : (/var/abs/local/yaourtbuild/cairo-dock-bzr/src/cairo-dock-core/src/implementations/cairo-dock-glx.c:_initialize_opengl_backend:179)
couldn't find an appropriate visual, trying to get one without Stencil buffer
(it may cause some little deterioration in the rendering) ...
============================================================================
Cairo-Dock version : 3.2.99.beta2
Compiled date : Sep 16 2013 22:58:09
Built with GTK : 3.8
Running with OpenGL: 0
============================================================================
sh : ligne 1 : 7515 Processus arrêté ./"Google" 1 "/org/cairodock/CairoDock/Google" "/home/sebastien/.config/cairo-dock/current_theme/plug-ins/Google/Google.conf" "/home/sebastien/.config/cairo-dock" cairo-dock 7508
libreoffice-writer -> pClassAppli->cStartupWMClass: libreoffice-writer
shotwell -> pClassAppli->cStartupWMClass: (null)
wine -> pClassAppli->cStartupWMClass: (null)
gimp -> pClassAppli->cStartupWMClass: (null)
xfce4-terminal -> pClassAppli->cStartupWMClass: (null)
chromium -> pClassAppli->cStartupWMClass: (null)
thunderbird -> pClassAppli->cStartupWMClass: (null)
libreoffice-calc -> pClassAppli->cStartupWMClass: libreoffice-calc
cairo_dock_set_image_on_icon (/usr/share/cairo-dock/plug-ins/Dbus/third-party/Google/icon)
GldiShortkey '<Control>F12' failed!
warning : (/var/abs/local/yaourtbuild/cairo-dock-bzr/src/cairo-dock-core/src/gldit/cairo-dock-keybinder.c:init_object:455)
Couldn't bind '<Control>F12' (Se déconnecter: Afficher le menu de déconnexion)
This shortkey is probably already used by another applet or another application
cairo_dock_set_image_on_icon (/usr/share/cairo-dock/plug-ins/Dbus/third-party/Screensaver_inhibitor/icon)
cairo_dock_set_image_on_icon (/usr/share/cairo-dock/plug-ins/Dbus/third-party/Gmail/icon)
cairo_dock_set_image_on_icon (/home/sebastien/.config/cairo-dock/extras/dustbin/Silver/trashcan_empty.svg)
cairo_dock_set_image_on_icon (/usr/share/cairo-dock/plug-ins/showDesktop/icon.png)
GldiShortkey '<Control>F4' failed!
warning : (/var/abs/local/yaourtbuild/cairo-dock-bzr/src/cairo-dock-core/src/gldit/cairo-dock-keybinder.c:init_object:455)
Couldn't bind '<Control>F4' (Afficher le Bureau: Exposé de tous les bureaux)
This shortkey is probably already used by another applet or another application
cairo_dock_set_image_on_icon (/home/sebastien/.config/cairo-dock/extras/dustbin/Silver/trashcan_full.svg)
thunar -> pClassAppli->cStartupWMClass: (null)
pacmanxg -> pClassAppli->cStartupWMClass: (null)
wicd-client ---> (null)
cairo_dock_set_image_on_icon (/usr/share/cairo-dock/plug-ins/Dbus/third-party/Screensaver_inhibitor/icon.svg)
_cd_find_volume_name_from_drive_name: assertion `pDrive != NULL' failed
_cd_find_volume_name_from_drive_name: assertion `pDrive != NULL' failed
[+] Google: Applet started
==== GMail: 228
==== GMail: 231
==== GMail: 238
==== GMail: 247
==== GMail: 253
==== GMail: 260 diff: 3
==== GMail: 380
==== GMail: 393
cairo_dock_set_image_on_icon (/usr/share/cairo-dock/plug-ins/Dbus/third-party/Gmail/icon)
==== GMail: 401
Lecture WAVE '/usr/share/cairo-dock/plug-ins/Dbus/third-party/Gmail/snd/pop.wav' : Float 32 bit Little Endian, Fréquence 44100 Hz, Stéréo
cairo_dock_set_image_on_icon (/home/sebastien/.config/cairo-dock/extras/weather/7degrees/26.png)
==== GMail: 228
==== GMail: 231
==== GMail: 238
==== GMail: 247
==== GMail: 253
==== GMail: 260 diff: 0 |
|
matttbe, Thursday 19 September 2013 à 23:19
|
|
Subscription date : 24 January 2009
Messages : 12573
|
Ça bloque dans request_gmail(): voilà une version avec plus de 'print' http://pastebin.com/qx5fa6Hi
(je pourrais ajouter plus de print mais il y aurait le contenu des mails dedans) |
|
lesebas, Friday 20 September 2013 à 07:33
|
|
Subscription date : 24 November 2008
Messages : 298
|
Voila ce que ça donne... pour le contenu des mails c'est pas grave, je le remplacerait par des étoiles avant de le coller ici :
==== GMail: 228
==== GMail: 322
==== GMail: 331
<urlopen error [Errno -2] Nom ou service inconnu>
==== GMail: 433
cairo_dock_set_image_on_icon (/usr/share/cairo-dock/plug-ins/Dbus/third-party/Gmail/icon)
==== GMail: 231
cairo_dock_set_image_on_icon (/home/sebastien/.config/cairo-dock/extras/weather/7degrees/26.png)
==== GMail: 228
==== GMail: 322
==== GMail: 331
<urlopen error [Errno -2] Nom ou service inconnu>
==== GMail: 433
==== GMail: 231 |
|
matttbe, Friday 20 September 2013 à 10:41
|
|
|
lesebas, Friday 20 September 2013 à 17:45
|
|
Subscription date : 24 November 2008
Messages : 298
|
la ligne 334 print (handle) plante l'applet...
==== GMail: 228
==== GMail: 322
==== GMail: 331
HTTP Error 401: Unauthorized
<urllib.request.Request object at 0x7fd178740ad0>
Traceback (most recent call last):
File "./Gmail", line 663, in <module>
gmail.run()
File "/usr/lib/python3.3/site-packages/CDApplet.py", line 165, in run
self.begin()
File "./Gmail", line 521, in begin
self.check_subscription()
File "./Gmail", line 173, in check_subscription
self.check_mail()
File "./Gmail", line 230, in check_mail
data = self.request_gmail()
File "./Gmail", line 334, in request_gmail
print (handle)
UnboundLocalError: local variable 'handle' referenced before assignment
cairo_dock_set_image_on_icon (/home/sebastien/.config/cairo-dock/extras/weather/7degrees/28.png)
En la supprimant j'ai ça :
[+] Google: Applet started
==== GMail: 228
==== GMail: 322
==== GMail: 331
<urlopen error [Errno -2] Nom ou service inconnu>
<urllib.request.Request object at 0x7ffadb323e50>
==== GMail: 435
cairo_dock_set_image_on_icon (/usr/share/cairo-dock/plug-ins/Dbus/third-party/Gmail/icon)
==== GMail: 231
==== GMail: 228
==== GMail: 322
==== GMail: 331
<urlopen error [Errno -2] Nom ou service inconnu>
<urllib.request.Request object at 0x7ffadaeda150>
==== GMail: 435
==== GMail: 231
cairo_dock_set_image_on_icon (/home/sebastien/.config/cairo-dock/extras/weather/7degrees/28.png)
==== GMail: 228
==== GMail: 322
==== GMail: 331
<urlopen error [Errno -2] Nom ou service inconnu>
<urllib.request.Request object at 0x7ffadaeda8d0>
==== GMail: 435
==== GMail: 231 |
|
matttbe, Friday 20 September 2013 à 19:16
|
|
Subscription date : 24 January 2009
Messages : 12573
|
HTTP Error 401: Unauthorized
<urlopen error [Errno -2] Nom ou service inconnu> Lorsque tu as eu le crash, tu étais connecté?
Car là, l'erreur est 401 mais après, elle est à -2.
Tu confirmes que tu as bien toujours la même erreur "-2" avant et après t'être connecté? (car dans le 2è log, je ne vois pas quand tu te connectes)
Il y a p-ê des caches sous ArchLinux? Bizarre... |
|
lesebas, Friday 20 September 2013 à 19:52
|
|
Subscription date : 24 November 2008
Messages : 298
|
A force je ne sais plus ...
Donc non erreur à -2 avant et après connexion (on voit bien weather qui se met à jour):
==== GMail: 228
==== GMail: 322
==== GMail: 331
<urlopen error [Errno -2] Nom ou service inconnu>
<urllib.request.Request object at 0x7f886f908e50>
==== GMail: 435
cairo_dock_set_image_on_icon (/usr/share/cairo-dock/plug-ins/Dbus/third-party/Gmail/icon)
==== GMail: 231
==== GMail: 228
==== GMail: 322
==== GMail: 331
<urlopen error [Errno -2] Nom ou service inconnu>
<urllib.request.Request object at 0x7f886f4bf150>
==== GMail: 435
==== GMail: 231
cairo_dock_set_image_on_icon (/home/sebastien/.config/cairo-dock/extras/weather/7degrees/28.png)
==== GMail: 228
==== GMail: 322
==== GMail: 331
<urlopen error [Errno -2] Nom ou service inconnu>
<urllib.request.Request object at 0x7f886f4bf8d0>
==== GMail: 435
==== GMail: 231 |
|
matttbe, Sunday 22 September 2013 à 18:44
|
|
Git Version | Version Git
|