def __init__(self,audio=False,vibra=True): self.manager = MNotificationManager('wazappnotify','WazappNotify'); self.vibra = vibra self.newMessageSound = WAConstants.DEFAULT_SOUND_NOTIFICATION #fetch from settings self.devInfo = QSystemDeviceInfo(); self.devInfo.currentProfileChanged.connect(self.profileChanged); if audio: self.audio = QMediaPlayer(); self.audio.setVolume(100); else: self.audio = False self.enabled = True self.notifications = {} if self.vibra: self.vibra = QFeedbackHapticsEffect(); self.vibra.setIntensity(1.0); self.vibra.setDuration(200);
def __init__(self,audio=True,vibra=True): _d = NotifierDebug(); self._d = _d.d; self.manager = MNotificationManager('wazappnotify','WazappNotify'); self.vibra = vibra self.personalRingtone = WAConstants.DEFAULT_SOUND_NOTIFICATION; self.personalVibrate = True; self.groupRingtone = WAConstants.DEFAULT_SOUND_NOTIFICATION; self.groupVibrate = True; QCoreApplication.setApplicationName("Wazapp"); self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, None) self.mediaObject = Phonon.MediaObject(None) Phonon.createPath(self.mediaObject, self.audioOutput) self.profileChanged(0, 0, self.getCurrentProfile(), 0) bus = dbus.SessionBus() mybus = bus.get_object('com.nokia.profiled', '/com/nokia/profiled') self.nface = dbus.Interface(mybus, 'com.nokia.profiled') self.nface.connect_to_signal("profile_changed", self.profileChanged) #prof = self.getCurrentProfile() #reply = self.nface.get_value(prof,"ringing.alert.volume"); #self.currentProfile = prof #self.currentVolume = "1.0" if reply=="100" else "0." + reply #self._d("Checking current profile: " + prof + " - Volume: " + self.currentVolume) #self.audioOutput.setVolume(float(self.currentVolume)) #self.newMessageSound = WAConstants.DEFAULT_SOUND_NOTIFICATION #fetch from settings self.devInfo = QSystemDeviceInfo(); #self.devInfo.currentProfileChanged.connect(self.profileChanged); self.audio = True '''if audio: self.audio = QMediaPlayer(None,QMediaPlayer.LowLatency); self.audio.setVolume(100); else: self.audio = False''' self.enabled = True self.notifications = {} # vibration comes too early here, now handled by ui.py when the message is already added in QML # well, the truth is that sound comes too late... :D #>> Any notification should be handler by the notifier, not UI :P I don't feel it's too early though, # but if necessary connect to a signal and vibrate from here. if self.vibra: self.vibra = QFeedbackHapticsEffect(); self.vibra.setIntensity(1.0); self.vibra.setDuration(200);