diff options
author | Sebastian Koslowski <koslowski@kit.edu> | 2014-04-09 18:16:43 +0200 |
---|---|---|
committer | Tom Rondeau <tom@trondeau.com> | 2014-04-10 13:11:46 -0400 |
commit | 07ffd6eb2f4a47d8bd5088588465f5d54423e4ec (patch) | |
tree | 178ef1461c046f3fd44cef6e1aa640abdeff949b /grc/python/Param.py | |
parent | cc418e9a071479a020f42bdd4c48247b688910c2 (diff) |
grc: move FileParam to gui module
Diffstat (limited to 'grc/python/Param.py')
-rw-r--r-- | grc/python/Param.py | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/grc/python/Param.py b/grc/python/Param.py index 3daa37f637..3d9e52e25f 100644 --- a/grc/python/Param.py +++ b/grc/python/Param.py @@ -19,13 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA from .. base.Param import Param as _Param from .. gui.Param import Param as _GUIParam -from .. gui.Param import EntryParam import Constants import numpy -import os -import pygtk -pygtk.require('2.0') -import gtk from gnuradio import eng_notation import re from gnuradio import gr @@ -33,41 +28,6 @@ from gnuradio import gr _check_id_matcher = re.compile('^[a-z|A-Z]\w*$') _show_id_matcher = re.compile('^(variable\w*|parameter|options|notebook)$') -class FileParam(EntryParam): - """Provide an entry box for filename and a button to browse for a file.""" - - def __init__(self, *args, **kwargs): - EntryParam.__init__(self, *args, **kwargs) - input = gtk.Button('...') - input.connect('clicked', self._handle_clicked) - self.pack_start(input, False) - - def _handle_clicked(self, widget=None): - """ - If the button was clicked, open a file dialog in open/save format. - Replace the text in the entry with the new filename from the file dialog. - """ - #get the paths - file_path = self.param.is_valid() and self.param.get_evaluated() or '' - (dirname, basename) = os.path.isfile(file_path) and os.path.split(file_path) or (file_path, '') - if not os.path.exists(dirname): dirname = os.getcwd() #fix bad paths - #build the dialog - if self.param.get_type() == 'file_open': - file_dialog = gtk.FileChooserDialog('Open a Data File...', None, - gtk.FILE_CHOOSER_ACTION_OPEN, ('gtk-cancel',gtk.RESPONSE_CANCEL,'gtk-open',gtk.RESPONSE_OK)) - elif self.param.get_type() == 'file_save': - file_dialog = gtk.FileChooserDialog('Save a Data File...', None, - gtk.FILE_CHOOSER_ACTION_SAVE, ('gtk-cancel',gtk.RESPONSE_CANCEL, 'gtk-save',gtk.RESPONSE_OK)) - file_dialog.set_do_overwrite_confirmation(True) - file_dialog.set_current_name(basename) #show the current filename - file_dialog.set_current_folder(dirname) #current directory - file_dialog.set_select_multiple(False) - file_dialog.set_local_only(True) - if gtk.RESPONSE_OK == file_dialog.run(): #run the dialog - file_path = file_dialog.get_filename() #get the file path - self._input.set_text(file_path) - self._handle_changed() - file_dialog.destroy() #destroy the dialog #blacklist certain ids, its not complete, but should help import __builtin__ @@ -162,10 +122,6 @@ class Param(_Param, _GUIParam): ################################################## return _truncate(dt_str, truncate) - def get_input(self, *args, **kwargs): - if self.get_type() in ('file_open', 'file_save'): return FileParam(self, *args, **kwargs) - return _GUIParam.get_input(self, *args, **kwargs) - def get_color(self): """ Get the color that represents this param's type. |