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, filename): QMainWindow.__init__(self) self.playButton = QPushButton('Play!') self.source = QUrl.fromLocalFile(filename) self.player = QMediaPlayer() self.player.setMedia(self.source) self.playButton.clicked.connect(self.play) self.setCentralWidget(self.playButton) self.playButton.show()