Commit 7a4102ec authored by Remi Perenon's avatar Remi Perenon

Adding automatic option in data loading popup

parent 1875a571
Pipeline #3965 passed with stages
in 26 minutes and 27 seconds
version 1.1.2
--------------
* ADDED issue #15 An automatic mode for data loading is added to compel with the fact that data filter does not appear in data loading popup on macOS
version 1.1.1 version 1.1.1
-------------- --------------
* FIXED issue #14 Package name was not valid for debian package in 1.1.0 version * FIXED issue #14 Package name was not valid for debian package in 1.1.0 version
......
...@@ -35,6 +35,7 @@ import os ...@@ -35,6 +35,7 @@ import os
import sys import sys
import webbrowser import webbrowser
import wx import wx
import wx.aui as aui import wx.aui as aui
...@@ -225,8 +226,20 @@ class MainFrame(wx.Frame): ...@@ -225,8 +226,20 @@ class MainFrame(wx.Frame):
self.Bind(wx.EVT_MENU, self.on_bug_report, bugButton) self.Bind(wx.EVT_MENU, self.on_bug_report, bugButton)
def load_data(self,typ,filename): def load_data(self,typ,filename):
if typ == "automatic":
data = REGISTRY["input_data"][typ](filename) # if type is set on automatic, find data type
if filename[-4:] == ".mvi":
# File is mvi
typ = "molecular_viewer"
data = REGISTRY["input_data"]["molecular_viewer"](filename)
else:
# File is either netcdf or mmtk
try:
data = REGISTRY["input_data"]["mmtk_trajectory"](filename)
except KeyError:
data = REGISTRY["input_data"]["netcdf_data"](filename)
else:
data = REGISTRY["input_data"][typ](filename)
DATA_CONTROLLER[data.filename] = data DATA_CONTROLLER[data.filename] = data
...@@ -305,15 +318,18 @@ Authors: ...@@ -305,15 +318,18 @@ Authors:
def on_load_data(self, event=None): def on_load_data(self, event=None):
wildcards = collections.OrderedDict([kls._type, "%s (*.%s)|*.%s" % (kls._type,kls.extension,kls.extension)] for kls in REGISTRY["input_data"].values() if kls.extension is not None) wildcards = collections.OrderedDict([kls._type, "%s (*.%s)|*.%s" % (kls._type,kls.extension,kls.extension)] for kls in REGISTRY["input_data"].values() if kls.extension is not None)
dialog = wx.FileDialog ( None, message='Open data ...', wildcard="|".join(wildcards.values()), style=wx.OPEN) dialog = wx.FileDialog ( None, message='Open data ...', wildcard="automatic (*.mvi,*.nc)|*.mvi;*.nc|" + "|".join(wildcards.values()), style=wx.OPEN)
if dialog.ShowModal() == wx.ID_CANCEL: if dialog.ShowModal() == wx.ID_CANCEL:
return "" return ""
idx = dialog.GetFilterIndex() idx = dialog.GetFilterIndex()
# Check if automatic has been chosen
dataType = wildcards.keys()[idx] if idx <= 0:
dataType = "automatic"
else:
dataType = wildcards.keys()[idx-1]
filename = dialog.GetPath() filename = dialog.GetPath()
......
...@@ -25,9 +25,9 @@ __repo__ = "https://code.ill.fr/scientific-software/mdanse/" ...@@ -25,9 +25,9 @@ __repo__ = "https://code.ill.fr/scientific-software/mdanse/"
__license__ = "GPL 3" __license__ = "GPL 3"
__version__ = "1.1.1" __version__ = "1.1.2"
__date__ = "14-06-2018" __date__ = "20-06-2018"
__commit__ = "undefined" __commit__ = "undefined"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment