On 2 April 2016 at 15:46, <tlinnet@xxxxxxxxxxxxx> wrote:
Author: tlinnet Date: Sat Apr 2 15:46:09 2016 New Revision: 28182 URL: http://svn.gna.org/viewcvs/relax?rev=28182&view=rev Log: Adding a relax gui menu for changing the current working directory. Modified: trunk/gui/relax_gui.py Modified: trunk/gui/relax_gui.py URL: http://svn.gna.org/viewcvs/relax/trunk/gui/relax_gui.py?rev=28182&r1=28181&r2=28182&view=diff ============================================================================== --- trunk/gui/relax_gui.py (original) +++ trunk/gui/relax_gui.py Sat Apr 2 15:46:09 2016 @@ -41,7 +41,7 @@ from gui.spin_viewer.frame import Spin_view_window from gui.controller import Controller from gui.export_bmrb import Export_bmrb_window -from gui.filedialog import RelaxFileDialog +from gui.filedialog import RelaxDirDialog, RelaxFileDialog from gui.fonts import font from gui.icons import relax_icons from gui.interpreter import Interpreter @@ -893,6 +893,37 @@ page.sync_ds(upload) + def system_cwd(self, event=None): + """Change the system current working directory. + + @keyword event: The wx event. + @type event: wx event + """ + + # The dialog. + dialog = RelaxDirDialog(parent=self, message="Select working directory", defaultPath=wx.EmptyString, style=wx.DD_CHANGE_DIR) + + # Show the dialog and catch if no directory has been selected. + if status.show_gui and dialog.ShowModal() != wx.ID_OK: + # Don't do anything. + return + + # Call the get_path function to get the directory name and change path. + path_name = dialog.get_path() + + # Change the directory + try: + wx.BeginBusyCursor() + + # Sleep a little so the user sees the busy cursor and knows that the directory changes has occurred. + sleep(1) + + # Turn off the user feedback. + finally: + if wx.IsBusy(): + wx.EndBusyCursor() +
Hi Troels, Although not very important, it might be more logical to put the dialog.get_path() (and the self.update_status_bar() function call you later added) after wx.BeginBusyCursor(). Cheers, Edward