Ejemplo n.º 1
0
                elif ioe.errno == 13:
                    error_msg = _("Access denied")
                else:
                    error_msg = _("Unknown error")
            except SyntaxError, se:
                title = _("Error while parsing %s") % self.path
                error_msg = _('The parser returned: "%s"') % se
                # error_msg = _("Not well formed at line %s, column %s") % \
                # (se.lineno, se.offset)
            except Exception, e:
                title = _("Unknown error while loading %s") % self.path
                error_msg = str(e)

            if title and error_msg:
                gtk.gdk.threads_enter()
                ed = ErrorDialog(title, error_msg)
                ed.run()
                ed.destroy()
                gtk.gdk.threads_leave()
                self.emit("loading-done", (None))
                return

            for channel in self.listings.get_channel("All").values():
                channel.programs.sort()

            self.listings.save()
        else:
            for channel in self.listings.get_channel("All").values():
                gtk.gdk.threads_enter()
                self.emit("loaded-channel", (channel))
                gtk.gdk.threads_leave()
Ejemplo n.º 2
0
Archivo: notify.py Proyecto: GNOME/ontv
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA

import sys
from gettext import gettext as _

import gobject

from dialogs import ProgramDialog

from ontv import NAME
from gui import ErrorDialog
try:
    import pynotify
except ImportError, ie:
    if str(ie) == "No module named pynotify":
        ed = ErrorDialog(_("Error while importing pynotify module"),
                         _("Could not find python-notify."))
        ed.run()
        sys.exit(1)

TIMEOUT = 60

class Notification:
    def __init__(self, program, get_readable_time):
        self.program = program
        self.get_readable_time = get_readable_time
        pynotify.init(NAME)

        #self.__update_id = gobject.timeout_add(TIMEOUT, self.__update)

        self.__show()