Exemple #1
0
    def __init__(self):
        logger.info("Starting application.")
        upgrade_manager = UpgradeManager()
        upgrade_manager.check()

        # TODO: Disabled and switched from use of AsyncNotifier on
        # 2007-02-05. Possible problem with pynotify and threading, threading
        # was our decision to disable to get users up and running with a 0.0.6
        # bugfix release. Re-enable once the issue is resolved.
        #gtk.gdk.threads_init()

        # Maintain a map of events that have alert windows open to ensure
        # we don't popup multiple windows for the same event that hasn't
        # been confirmed by the user:
        self.__open_alerts = {}

        self.config = WujaConfiguration(GCONF_PATH)
        self.notifier = None
        self.prefs_dialog = None
        self.calendar_window = None
        self.updating = False
        self.feed_update_event_source = None

        actions = (
            ("calendar", gtk.STOCK_INDEX, "View Calendar", None, None,
                self.__open_calendar),
            ("preferences", gtk.STOCK_PREFERENCES, None, None, None,
                self.__open_preferences_dialog),
            ("update_feeds", gtk.STOCK_REFRESH, "Update Feeds", None, None,
                self.__update_feeds),
            ("debug_feeds", gtk.STOCK_EXECUTE, "Debug Feeds", None, None,
                self.__debug_feeds),
            ("about", gtk.STOCK_ABOUT, None, None, None,
                self.__open_about_dialog),
            ("quit", gtk.STOCK_QUIT, None, None, None, self.destroy))
        action_group = gtk.ActionGroup("wuja_menu")
        action_group.add_actions(actions)

        ui_mgr = gtk.UIManager()
        ui_mgr.add_ui_from_file(find_file_on_path("wuja/data/wuja-menu.xml"))
        ui_mgr.insert_action_group(action_group, 0)

        self.menu = ui_mgr.get_widget("/wuja_menu")
        self.menu.show_all()

        self.tray_icon = trayicon.TrayIcon("wuja")
        self.tray_icon.connect('button_press_event', self.__clicked)

        tray_image = gtk.Image()
        tray_image.set_from_file(
            find_file_on_path("wuja/data/wuja-icon-24x24.png"))

        event_box = gtk.EventBox()
        event_box.add(tray_image)
        self.tray_icon.add(event_box)
        self.tray_icon.show_all()

        self.build_notifier()
Exemple #2
0
    def __open_about_dialog(self, widget):
        """ Open the about dialog. """
        glade_file = 'wuja/data/wuja-about.glade'
        glade_xml = gtk.glade.XML(find_file_on_path(glade_file))
        about_dialog = glade_xml.get_widget('WujaAbout')

        signals = {
            'on_WujaAbout_close': self.__close_about_dialog,
        }
        glade_xml.signal_autoconnect(signals)

        about_dialog.show_all()
Exemple #3
0
    def __init__(self, config, notifier):
        """ Open the preferences dialog. """
        logger.debug("Opening preferences dialog.")
        self.config = config
        self.notifier = notifier

        glade_file = 'wuja/data/wuja-prefs.glade'
        window_name = 'dialog1'
        self.glade_prefs = gtk.glade.XML(find_file_on_path(glade_file))
        signals = {
            'on_add_clicked' : self.__add_url,
            'on_remove_clicked' : self.__remove_url,
            'on_remove_all_clicked' : self.__remove_all_urls,
            'on_help_clicked' : self.__display_help,
            'on_close_clicked' : self.close,
            'on_time_format_changed': self.__update_time_format,
            'on_reminder_changed': self.__update_reminder,
            'on_snooze_changed': self.__update_snooze,
        }
        self.glade_prefs.signal_autoconnect(signals)
        self.prefs_dialog_widget = self.glade_prefs.get_widget(window_name)

        # Populate the list of existing URLs:
        self.prefs_url_list = self.glade_prefs.get_widget(URLS_WIDGET)
        urls_list = gtk.ListStore(gobject.TYPE_STRING)
        self.__title_index = {}
        for url in self.config.get_feed_urls():
            url_iter = urls_list.append()
            cal = self.notifier.cache.load(url)
            urls_list.set_value(url_iter, 0, cal.title)
            self.__title_index[cal.title] = cal
        self.prefs_url_list.set_model(urls_list)
        renderer = gtk.CellRendererText()
        column = gtk.TreeViewColumn("Feed URLs", renderer, text=0)
        self.prefs_url_list.append_column(column)

        # Populate the existing timestamp format:
        timestamp_format_widget = self.glade_prefs.get_widget(
            TIMESTAMP_FORMAT_WIDGET)
        timestamp_format_widget.set_text(self.config.get_timestamp_format())

        reminder_widget = self.glade_prefs.get_widget(
            REMINDER_WIDGET)
        reminder_widget.set_value(self.config.get_reminder())

        snooze_widget = self.glade_prefs.get_widget(
            SNOOZE_WIDGET)
        snooze_widget.set_value(self.config.get_snooze())

        self.prefs_dialog_widget.show_all()
Exemple #4
0
    def __init__(self, cache, config):
        gobject.GObject.__init__(self)
        self.cache = cache
        self.config = config

        glade_file = 'wuja/data/calendar.glade'
        window_name = 'calendar'
        glade_calendar = gtk.glade.XML(find_file_on_path(glade_file))
        self.calendar_window = glade_calendar.get_widget('calendar')
        self.textview = glade_calendar.get_widget('textview')

        signals = {
            'on_calendar_day_selected': self.display_entries,
            'on_calendar_month_change': self.mark_month
        }
        glade_calendar.signal_autoconnect(signals)

        self.calendar_window.show_all()
        self.update_text_for_date(datetime.now(tzlocal()))
        self.mark_month(self.calendar_window)
Exemple #5
0
    def __init__(self, event, config):
        AlertDisplay.__init__(self, event, config)

        glade_file = 'wuja/data/alert-window.glade'
        window_name = 'window1'
        glade_alert = gtk.glade.XML(find_file_on_path(glade_file))
        alert_dialog = glade_alert.get_widget(window_name)

        signals = {
            'on_accept_button_clicked': self.accept_event,
        }
        glade_alert.signal_autoconnect(signals)

        title = glade_alert.get_widget('title')
        when = glade_alert.get_widget('when')
        duration = glade_alert.get_widget('duration')
        calendar = glade_alert.get_widget('calendar')
        where = glade_alert.get_widget('where')
        description = glade_alert.get_widget('description')

        title.set_text(event.entry.title)
        when.set_text(event.time.strftime("%a %b %d %Y - " + 
            self.config.get_timestamp_format()))

        calendar.set_text(event.entry.calendar.title)

        if event.entry.location is None:
            where.set_text("")
        else:
            where.set_text(str(event.entry.location))
        if event.entry.description is None:
            description.set_text("")
        else:
            description.set_text(event.entry.description)

        duration_delta = timedelta(seconds=event.entry.duration)
        duration.set_text(str(duration_delta))

        alert_dialog.show_all()