Changeset 1189 for SHX


Ignore:
Timestamp:
13.04.2016 07:32:14 (3 years ago)
Author:
klaus
Message:

drag and drop of data files into SHX window

File:
1 edited

Legend:

Unmodified
Added
Removed
  • SHX/trunk/SeismicHandler/modules/wx_.py

    r1188 r1189  
    666666        self.OnSize(None) 
    667667        self.SetFocus() 
     668         
     669        # prepare as drop target for file input 
     670        dt = MyFileDropTarget(self) 
     671        self.SetDropTarget(dt) 
    668672 
    669673    def __runtime_changer(self, name, value): 
     
    33453349        "QueryString: access to result." 
    33463350        return self.result 
     3351 
     3352 
     3353class MyFileDropTarget(wx.FileDropTarget): 
     3354    "React on drag and drop actions into the main drawing window." 
     3355    def __init__(self, window): 
     3356        wx.FileDropTarget.__init__(self) 
     3357        self.window = window 
     3358 
     3359    def OnDropFiles(self, x, y, filenames): 
     3360        #print "%d file(s) dropped at (%d,%d):\n" % (len(filenames), x, y) 
     3361        for fname in filenames: 
     3362            if fname.endswith('.SHC'): 
     3363                # doesn't work due to path isn't resolved 
     3364                shcmd = '@' + fname.replace('/','\\') 
     3365            else: 
     3366                shcmd = "@READO %s" % fname.replace('/','\\') 
     3367            print shcmd 
     3368            _sendShCommand( shcmd ) 
     3369 
    33473370         
    33483371 
Note: See TracChangeset for help on using the changeset viewer.