diff options
author | Sebastian Koslowski <koslowski@kit.edu> | 2015-07-23 16:36:22 +0200 |
---|---|---|
committer | Sebastian Koslowski <koslowski@kit.edu> | 2015-11-11 21:39:35 +0100 |
commit | 2fee267dfee11bd687b4d780cb6b82924d59af3c (patch) | |
tree | 3768cd0fde949c1b99e919d0cdff958764064e79 /grc/gui/Dialogs.py | |
parent | c9a5fabe17efe8af1c9435f746ed55c5f5790917 (diff) |
grc: open and update params from external editor
Diffstat (limited to 'grc/gui/Dialogs.py')
-rw-r--r-- | grc/gui/Dialogs.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/grc/gui/Dialogs.py b/grc/gui/Dialogs.py index 6c01219dee..631dc0fd98 100644 --- a/grc/gui/Dialogs.py +++ b/grc/gui/Dialogs.py @@ -20,8 +20,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA import pygtk pygtk.require('2.0') import gtk -import Utils -import Actions + +from . import Utils, Actions, Constants class SimpleTextDisplay(gtk.TextView): @@ -234,3 +234,22 @@ def MissingXTermDialog(xterm): "\n" "(This message is shown only once)").format(xterm) ) + + +def ChooseEditorDialog(): + file_dialog = gtk.FileChooserDialog( + 'Open a Data File...', None, + gtk.FILE_CHOOSER_ACTION_OPEN, + ('gtk-cancel', gtk.RESPONSE_CANCEL, 'gtk-open', gtk.RESPONSE_OK) + ) + file_dialog.set_select_multiple(False) + file_dialog.set_local_only(True) + file_dialog.set_current_folder('/usr/bin') + response = file_dialog.run() + + if response == gtk.RESPONSE_OK: + file_path = file_dialog.get_filename() + Constants.prefs.set_string('grc', 'editor', file_path) + Constants.prefs.save() + Constants.EDITOR = file_path + file_dialog.destroy() |