import os
import time
import datetime
+import ConfigParser
import dbus
import osso.alarmd as alarmd
bus = dbus.SystemBus()
self._alarmdDBus = bus.get_object("com.nokia.alarmd", "/com/nokia/alarmd");
self._alarmCookie = self._INVALID_COOKIE
+ self._launcher = self._LAUNCHER
def load_settings(self, config, sectionName):
self._recurrence = config.getint(sectionName, "recurrence")
self._alarmCookie = config.getint(sectionName, "alarmCookie")
+ try:
+ launcher = config.get(sectionName, "notifier")
+ if launcher:
+ self._launcher = launcher
+ except ConfigParser.NoOptionError:
+ pass
def save_settings(self, config, sectionName):
config.set(sectionName, "recurrence", str(self._recurrence))
config.set(sectionName, "alarmCookie", str(self._alarmCookie))
+ launcher = self._launcher if self._launcher != self._LAUNCHER else ""
+ config.set(sectionName, "notifier", launcher)
def apply_settings(self, enabled, recurrence):
if recurrence != self._recurrence or enabled != self.isEnabled:
action = []
action.extend(['flags', self._DEFAULT_FLAGS])
action.extend(['title', self._TITLE])
- action.extend(['path', self._LAUNCHER])
+ action.extend(['path', self._launcher])
action.extend([
'arguments',
dbus.Array(
from __future__ import with_statement
-import threading
import warnings
import gobject
self._onMissedToggled = 0
self._onVoicemailToggled = 0
self._onSmsToggled = 0
+ self._applyAlarmTimeoutId = None
self._defaultCallback = ""
self.save_everything()
def _on_notify_toggled(self, *args):
- self._update_alarm_settings()
+ if self._applyAlarmTimeoutId is not None:
+ gobject.source_remove(self._applyAlarmTimeoutId)
+ self._applyAlarmTimeoutId = None
+ self._applyAlarmTimeoutId = gobject.timeout_add(500, self._on_apply_timeout)
def _on_minutes_changed(self, *args):
+ if self._applyAlarmTimeoutId is not None:
+ gobject.source_remove(self._applyAlarmTimeoutId)
+ self._applyAlarmTimeoutId = None
+ self._applyAlarmTimeoutId = gobject.timeout_add(500, self._on_apply_timeout)
+
+ def _on_apply_timeout(self, *args):
+ self._applyAlarmTimeoutId = None
+
self._update_alarm_settings()
+ return False
def _on_missed_toggled(self, *args):
self._notifyOnMissed = self._missedCheckbox.get_active()