Beispiel #1
0
 def on_import_ascii(self):
     qfd = QFileDialog(self)
     qfd.setMode(QFileDialog.ExistingFiles)
     if qfd.exec_loop() == 1:
         for f in qfd.selectedFiles():
             w = self.project.new(grafity.Worksheet, os.path.splitext(os.path.split(str(f))[1])[0])
             w.array, w._header = import_ascii(str(f))
 def on_import_ascii(self):
     dlg = wx.FileDialog(self._widget, message="Choose a file", defaultDir=os.getcwd(), 
                         defaultFile="", wildcard="All Files|*.*|Projects|*.gt", style=wx.OPEN | wx.CHANGE_DIR)
     if dlg.ShowModal() == wx.ID_OK:
         ws = self.project.new(Worksheet, None, self.project.here)
         path = dlg.GetPaths()[0]
         ws.array, ws._header = import_ascii(path)
     dlg.Destroy()
 def on_dropped(self, item, data):
     if 'grafity-object' in data.formats:
         parent = self.list.model[item]
         for d in data.get('grafity-object').split('\n'):
             self.project.items[d].parent = parent
         return True
     elif 'filename' in data.formats and item == -1:
         # import ascii
         for path in data.get('filename'):
             ws = self.project.new(Worksheet, str(os.path.basename(path).split('.')[0]), self.project.here)
             ws.array, ws._header = import_ascii(path)
         return False
     else:
         return False