Get source filename. If not saved, offer to save (or create) file The debugger requires a source file. Make sure there is one, and that the current version of the source buffer has been saved. If the user declines to save or cancels the Save As dialog, return None.
(self)
| 167 | return 'break' |
| 168 | |
| 169 | def getfilename(self): |
| 170 | """Get source filename. If not saved, offer to save (or create) file |
| 171 | |
| 172 | The debugger requires a source file. Make sure there is one, and that |
| 173 | the current version of the source buffer has been saved. If the user |
| 174 | declines to save or cancels the Save As dialog, return None. |
| 175 | |
| 176 | If the user has configured IDLE for Autosave, the file will be |
| 177 | silently saved if it already exists and is dirty. |
| 178 | |
| 179 | """ |
| 180 | filename = self.editwin.io.filename |
| 181 | if not self.editwin.get_saved(): |
| 182 | autosave = idleConf.GetOption('main', 'General', |
| 183 | 'autosave', type='bool') |
| 184 | if autosave and filename: |
| 185 | self.editwin.io.save(None) |
| 186 | else: |
| 187 | confirm = self.ask_save_dialog() |
| 188 | self.editwin.text.focus_set() |
| 189 | if confirm: |
| 190 | self.editwin.io.save(None) |
| 191 | filename = self.editwin.io.filename |
| 192 | else: |
| 193 | filename = None |
| 194 | return filename |
| 195 | |
| 196 | def ask_save_dialog(self): |
| 197 | msg = "Source Must Be Saved\n" + 5*' ' + "OK to Save?" |
no test coverage detected