def on_imgmenuFileNew_activate(self, widget, confirm=True): "Clears the whole text" if TextBuffer_get_text(self.txvBuffer): if confirm: dialog = DialogYesNo( message=_('Do you want to delete the current text?'), default_button=gtk.RESPONSE_NO ) dialog.set_icon_from_file(handlepaths.get_app_logo()) dialog.show() # Clear if confirm was not requested or if the user gave response if not confirm or dialog.responseIsYes(): self.txvBuffer.set_text('') print 'text cleared'
def on_imgmenuEditResetSettings_activate(self, widget, confirm=True): "Restore default settings" if confirm: dialog = DialogYesNo( message=_('Do you want to reset the default settings?'), default_button=gtk.RESPONSE_NO ) dialog.set_icon_from_file(handlepaths.get_app_logo()) dialog.show() # Reset if confirm was not requested or if the user gave response if not confirm or dialog.responseIsYes(): if self.defaultLanguageIndex: self.cboLanguages.set_active(self.defaultLanguageIndex) print 'restored default settings' if os.path.exists(Settings.conffile): os.remove(Settings.conffile) print 'removed user settings file: %s' % Settings.conffile # Reload default settings Settings.load() self.loadSettings(True)