def show_confirmation(self, message, title=None): if gpodder.ui.desktop: dlg = gtk.MessageDialog(self.main_window, gtk.DIALOG_MODAL, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO) if title: dlg.set_title(str(title)) dlg.set_markup( '<span weight="bold" size="larger">%s</span>\n\n%s' % (title, message)) else: dlg.set_markup('<span weight="bold" size="larger">%s</span>' % (message)) response = dlg.run() dlg.destroy() return response == gtk.RESPONSE_YES elif gpodder.ui.diablo: import hildon try: dlg = hildon.Note('confirmation', (self.main_window, message)) except TypeError: # Kludgy workaround: We're running the Diablo UI on Maemo 5 :) dlg = hildon.hildon_note_new_confirmation(self.main_window, \ message) response = dlg.run() dlg.destroy() return response == gtk.RESPONSE_OK elif gpodder.ui.fremantle: import hildon dlg = hildon.hildon_note_new_confirmation(self.get_dialog_parent(), \ message) response = dlg.run() dlg.destroy() return response == gtk.RESPONSE_OK else: raise Exception('Unknown interface type')
def show_confirmation(self, message, title=None): if gpodder.ui.desktop: dlg = gtk.MessageDialog(self.main_window, gtk.DIALOG_MODAL, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO) if title: dlg.set_title(str(title)) dlg.set_markup('<span weight="bold" size="larger">%s</span>\n\n%s' % (title, message)) else: dlg.set_markup('<span weight="bold" size="larger">%s</span>' % (message)) response = dlg.run() dlg.destroy() return response == gtk.RESPONSE_YES elif gpodder.ui.diablo: import hildon try: dlg = hildon.Note('confirmation', (self.main_window, message)) except TypeError: # Kludgy workaround: We're running the Diablo UI on Maemo 5 :) dlg = hildon.hildon_note_new_confirmation(self.main_window, \ message) response = dlg.run() dlg.destroy() return response == gtk.RESPONSE_OK elif gpodder.ui.fremantle: import hildon dlg = hildon.hildon_note_new_confirmation(self.main_window, \ message) response = dlg.run() dlg.destroy() return response == gtk.RESPONSE_OK else: raise Exception('Unknown interface type')
def close_win(self, widget, *data): if widget.saved == False: noteconf = hildon.hildon_note_new_confirmation(hildon.Window(),'Did you want to save this unsaved file ?') if noteconf.run() == gtk.RESPONSE_OK: widget.save() noteconf.destroy() return
def on_delete_pl(self, btn): note = hildon.hildon_note_new_confirmation(self, "Do you want to delete '%s' ?" % (self.playlist_name)) response = note.run() note.destroy() print response if response == gtk.RESPONSE_OK: settings.delete_playlist(self.playlist_name) settings.save() self.destroy()
def place_call(self, person): ''' Initiate a phone call to the given ShortProfile. ''' # this launch a call so we must have aggreement of the user message = "Do you want to call " + person.firstname + " " + person.lastname + " at " + person.phone parent = hildon.WindowStack.get_default().peek() note = hildon.hildon_note_new_confirmation(parent, message) response = gtk.Dialog.run(note) note.destroy() if response == gtk.RESPONSE_OK: bus = dbus.SystemBus() csd_call = dbus.Interface(bus.get_object('com.nokia.csd', '/com/nokia/csd/call'), 'com.nokia.csd.Call') csd_call.CreateWith(person.phone, dbus.UInt32(0)) self.show_banner_information("call in progress") else: self.show_banner_information("call cancelled")
def execute(self): #ask for save if unsaved if self.saved == False: noteconf = hildon.hildon_note_new_confirmation(self,'Did you want to save this file before launching it ?') if noteconf.run() == gtk.RESPONSE_OK: self.save() noteconf.destroy() if self.filepath != None: note = osso.SystemNote(self._parent.context) result = note.system_note_infoprint("Launching "+ self.filepath +" ...") fileHandle = open('/tmp/pygtkeditor.tmp', 'w') fileHandle.write('#!/bin/sh\n') fileHandle.write('cd '+os.path.dirname(self.filepath)+' \n') fileHandle.write(self._detect_launch_language()+" \'"+self.filepath + "\'\n") fileHandle.write('read -p "Press ENTER to continue ..." foo') fileHandle.write('\nexit') fileHandle.close() commands.getoutput("chmod 777 /tmp/pygtkeditor.tmp") Popen('/usr/bin/osso-xterm /tmp/pygtkeditor.tmp',shell=True,stdout=None) else: note = osso.SystemNote(self._parent.context) result = note.system_note_infoprint("Unsaved file cannot be launched.")