- def saveConfigurationFile(self):
- self.dbg('saveConfigurationFile started')
- f = open(self.configDir+self.configFile, "w")
- conf = ''
- if self.visual:
- conf += 'y;'
- else:
- conf += 'n;'
-
- if self.sound:
- conf += 'y;'
- else:
- conf +='n;'
-
- if self.vibration:
- conf += 'y;'
- else:
- conf += 'n;'
-
- conf += str(self.interval)
-
- f.write(conf)
- f.close()
-
- def openSettingsDialog(self, widget, data=None):
- self.dbg('openSettingsDialog started')
- self.dialog = gtk.Dialog(title="Call Notify Settings")
- self.dialog.set_size_request(800,300)
- #self.dialog.connect("response", self.dialogClosed)
- self.readConfigurationFile()
- # Visual
-
- b2 = gtk.CheckButton(label="Visual Notification On")
- b2.connect("clicked", self.notificationActivate)
- b2.set_active(self.visual)
- self.dialog.vbox.add(b2)
-
- # Sound
-
- b3 = gtk.CheckButton(label="Sound Notification On")
- b3.connect("clicked", self.soundActivate)
- b3.set_active(self.sound)
- self.dialog.vbox.add(b3)
-
- # Vibration
-
- b4 = gtk.CheckButton(label="Vibrate Notification On")
- b4.connect("clicked", self.vibrateActivate)
- b4.set_active(self.vibration)
- self.dialog.vbox.add(b4)
-
- # Slider
-
- Adj = gtk.Adjustment(self.interval, lower=0, upper=60, step_incr=5, page_incr=5)
- Adj.connect("value_changed", self.intervalChanged)
- Adj.set_value(self.interval)
-
- Slider = gtk.HScale(adjustment=Adj)
- self.dialog.vbox.add(Slider)
-
- # Manual reset
-
- b5 = gtk.Button(label="Manually reset notification")
- b5.connect("clicked", self.resetNotification)
- self.dialog.vbox.add(b5)
-
- # Save Button
-
- bSave = gtk.Button(label="Save")
- bSave.connect("clicked", self.saveSettings)
- self.dialog.action_area.add(bSave)
-
- # Cancel Button
-
- bCancel = gtk.Button(label="Cancel")
- bCancel.connect("clicked", self.cancelDialog)
- self.dialog.vbox.add(bCancel)
-
- self.dialog.show_all()
-
- def intervalChanged(self, adj):
- self.dbg('intervalChanged started')
- self.interval = adj.value
-
- def saveSettings(self, widget, data=None):
- self.dbg('saveSettings started')
- self.saveConfigurationFile()
-
- def dialogClosed(self, dialog, response_id):
- self.dbg('dialogClosed started')
-
- def cancelDialog(self, widget, data=None):
- self.dbg('cancelDialog started')
- self.dialog.destroy()
-
- def resetNotification(self, widget, data=None):
- self.dbg('resetNotification started')
- self.stop_notification(self)
-
- def soundActivate(self, widget, data=None):
- self.dbg('soundActivate started')
- self.sound = widget.get_active() #not(self.sound)
-
- def notificationActivate(self,widget, data=None):
- self.dbg('notificationActivate started')
- self.visual = widget.get_active() #not(self.visual)
-
- def vibrateActivate(self, widget, data=None):
- self.dbg('vibrateActivate started')
- self.vibration = widget.get_active() #not(self.vibrate)
-
-
- def playSound(self):