Example #1
0
 def _open_file(self):
     preferences = UIPreferences()
     filename = tkfd.askopenfilename(
         parent=self,
         title='Open Chemistry File',
         initialdir=preferences.get_openfile_initialdir())
     if filename and self._controller.open_file(filename):
         preferences.add_recent_file(filename)
         preferences.set_openfile_initialdir(os.path.dirname(filename))
         preferences.save()
Example #2
0
    def _save_file_as(self):
        if self._controller.is_empty():
            self._controller._outputView.write_line("No data to save.")
            return

        preferences = UIPreferences()
        filename = tkfd.asksaveasfilename(
            parent=self,
            title='Save Chemistry File',
            initialdir=preferences.get_savefile_initialdir())
        if filename and self._controller.save_file_as(filename):
            preferences.add_recent_file(filename)
            preferences.set_savefile_initialdir(os.path.dirname(filename))
            preferences.save()