def __init__(self):
     super(MainMenu, self).__init__()
     # holds all active windows
     self.graphWindows = []
     self.depWindows = []
     self.miscWindows = []
     # holds all profiles associated with current file
     self.profiles = {}
     # data processor is not initialized until FILE_INFO is complete
     self.processor = None
     # save name of file from which application will read
     self.file = self.initReader()
     # if there are no .csv files in working folder, have user
     #   choose file to load
     if not self.file:
         self.loadDataFile(1)
     # check if filename is in valid format
     filenameError = filename_handler.parseFilename(self.file)
     # if not, ask user for experiment parameters
     if filenameError:
         self.requestFileInfo(1)
     # otherwise, finish setting up program
     else:
         self.initData()
     self.initUI()
 def __init__(self):
     super(MainMenu, self).__init__()
     # holds all active windows
     self.graphWindows = []
     self.depWindows = []
     self.miscWindows = []
     # holds all profiles associated with current file
     self.profiles = {}
     # data processor is not initialized until FILE_INFO is complete
     self.processor = None
     # save name of file from which application will read
     self.file = self.initReader()
     # if there are no .csv files in working folder, have user
     #   choose file to load
     if not self.file:
         self.loadDataFile(1)
     # check if filename is in valid format
     filenameError = filename_handler.parseFilename(self.file)
     # if not, ask user for experiment parameters
     if filenameError:
         self.requestFileInfo(1)
     # otherwise, finish setting up program
     else:
         self.initData()
     self.initUI()
 def loadDataFile(self, mode=0):
     global DATA_FILE_DIR
     global FILE_INFO
     dirname = QtGui.QFileDialog.getOpenFileName(self, 'Open data file',
                                                   DATA_FILE_DIR,
                                                   'CSV files (*.csv)')
     # if cancel is clicked, dirname will be empty string
     if dirname != '':
         filename_handler.FILE_INFO = {'Element':'', 'Source':'', 'Supply':'', 'TiltDeg':[],
          'Z_mm':[]}
         # converts Qstring to string
         dirString = str(dirname)
         # gets filename from current directory (will be changed eventually)
         dirList = dirString.split('/')
         DATA_FILE_DIR = '/'.join(dirList[:len(dirList)-1])
         self.file = dirList[len(dirList)-1]
         # hides all windows so they can be removed later
         for window in (self.graphWindows + self.depWindows + self.miscWindows):
             window.hide()
         # check filename for correct format
         filenameError = filename_handler.parseFilename(self.file)
         if filenameError:
             self.requestFileInfo(mode)
         # set everything up for the new file being read
         else:
             self.initData()
     # if user declines to use default file and declines to open a
     #   new file, quit the application
     else:
         if mode == 1:
             self.close()
 def loadDataFile(self, mode=0):
     global DATA_FILE_DIR
     global FILE_INFO
     dirname = QtGui.QFileDialog.getOpenFileName(self, 'Open data file',
                                                 DATA_FILE_DIR,
                                                 'CSV files (*.csv)')
     # if cancel is clicked, dirname will be empty string
     if dirname != '':
         filename_handler.FILE_INFO = {
             'Element': '',
             'Source': '',
             'Supply': '',
             'TiltDeg': [],
             'Z_mm': []
         }
         # converts Qstring to string
         dirString = str(dirname)
         # gets filename from current directory (will be changed eventually)
         dirList = dirString.split('/')
         DATA_FILE_DIR = '/'.join(dirList[:len(dirList) - 1])
         self.file = dirList[len(dirList) - 1]
         # hides all windows so they can be removed later
         for window in (self.graphWindows + self.depWindows +
                        self.miscWindows):
             window.hide()
         # check filename for correct format
         filenameError = filename_handler.parseFilename(self.file)
         if filenameError:
             self.requestFileInfo(mode)
         # set everything up for the new file being read
         else:
             self.initData()
     # if user declines to use default file and declines to open a
     #   new file, quit the application
     else:
         if mode == 1:
             self.close()