コード例 #1
0
    def on_menuFileRunBatch_select(self, event):
        wildcard = "Options Files (*.ini)|*.ini" 
        result = dialog.fileDialog(self, 'Select any number of Circuitscape Options Files within one directory', '', '', wildcard ) 
        if result.accepted==True:
            wx.BeginBusyCursor()  # @UndefinedVariable
            GUI.logger.debug('Running Circuitscape in batch mode')
            startTime = time.time()
            startTimeHMS = time.strftime('%H:%M:%S')
            self.statusBar.SetStatusText('Batch start ' + str(startTimeHMS), 0)
            job = 0
            numjobs = len(result.paths)
            for selection in result.paths:
                job += 1
                _configDir, configFile = os.path.split(selection)
                GUI.logger.debug('Processing ' + configFile)
                self.statusBar.SetStatusText('Batch start ' + str(startTimeHMS) + '. Running job ' + str(job) +'/' + str(numjobs), 0)
                
                try:
                    cs = Compute(selection, GUI.log_handler)
                except RuntimeError as error:
                    wx.EndBusyCursor()  # @UndefinedVariable
                    message = str(error)
                    dial = wx.MessageDialog(None, message, 'Error', wx.OK | wx.ICON_ERROR)  # @UndefinedVariable
                    dial.ShowModal()
                    return
                except MemoryError:
                    wx.EndBusyCursor()  # @UndefinedVariable
                    self.memory_error_feedback()
                    return
                except:
                    wx.EndBusyCursor()  # @UndefinedVariable
                    self.unknown_exception()
                    return

                try:
                    self.statusBar.SetStatusText('',1)
                    self.statusBar.SetStatusText('',2)
                    result, _solver_failed = cs.compute()
                    GUI.logger.debug('Finished processing ' + configFile)
                except RuntimeError as error:
                    message = str(error)
                    dial = wx.MessageDialog(None, message, 'Error', wx.OK | wx.ICON_ERROR)  # @UndefinedVariable
                    dial.ShowModal()
                except MemoryError:
                    self.memory_error_feedback()
                    return
                except:
                    self.unknown_exception()
                    
            GUI.logger.debug('Done with batch operations.')
            wx.EndBusyCursor()  # @UndefinedVariable
            
            self.components.calcButton.SetFocus()
            self.reset_status_bar()

            (hours,mins,secs) = ComputeBase.elapsed_time(startTime)
            if hours > 0:
                self.statusBar.SetStatusText('Batch job took ' + str(hours) +' hours ' + str(mins) + ' minutes to complete.',2)
            else:
                self.statusBar.SetStatusText('Batch job took ' + str(mins) +' minutes ' + str(secs) + ' seconds to complete.',2)
コード例 #2
0
ファイル: wxXrf.py プロジェクト: jackey-qiu/tdl
    def on_menuFileReadXrf_select(self, event):

        result = dialog.fileDialog(self, 'Open...', self.dir, '', "*")
        if result.accepted:
            path = result.paths[0]
            self.dir = os.path.dirname(path)
        else:
            self.post_message("File selection cancelled.")
            return

        #print path, self.dir
        grp = self.components.Grp.text
        if len(grp) > 0:
            var_name = "%s.xrf_data" % grp
        else:
            var_name = "xrf_data"

        line = "%s = []" % var_name
        self.exec_line(line)
        for path in result.paths:
            path = path.replace("\\", "\\\\")
            line = '__temp__ = ana.xrf_data.read("%s")' % (path)
            self.exec_line(line)
            line = "%s.append(__temp__)" % (var_name)
            self.exec_line(line)
        self.exec_line("del __temp__")

        # set select list to default grp etc..
        # self.components.Grp.text  = 'xrf.data'
        self.components.Node.text = var_name
        self.init_shell_list_items()

        return
コード例 #3
0
ファイル: wxScanSelect.py プロジェクト: jackey-qiu/tdl
 def on_SpecFileSel_mouseClick(self,event):
     sdir = self.components.SpecPath.text
     cdir = self.eval_line("pwd()")
     if len(sdir.strip()) == 0:
         dir = cdir
     else:
         dir = sdir
     #
     result = dialog.fileDialog(self, 'Open', dir, '',"*")
     if result.accepted == False:
         self.post_message("File selection cancelled.")
         return
     #
     files = []
     #print result.paths
     for j in range(len(result.paths)):
         path        = result.paths[j]
         dir,fname   = os.path.split(path)
         if j == 0:
             if os.path.abspath(dir) != os.path.abspath(sdir):
                 self.components.SpecPath.text = dir
                 #self.init_SpecFile()
                 self.components.SpecFile.items = []
             fname0 = fname
         if fname not in files:
             files.append(fname)
     items = self.components.SpecFile.items
     for f in files:
         if f not in items: items.append(f)
     items.sort()
     self.components.SpecFile.items = items
     #
     self.components.SpecFile.stringSelection = fname0
     self.SpecFileSelect()
コード例 #4
0
ファイル: wxSpecData.py プロジェクト: FHe/tdl
 def on_SpecFileSel_mouseClick(self,event):
     sdir = self.components.SpecPath.text
     cdir = self.eval_line("pwd()")
     if len(sdir.strip()) == 0:
         dir = cdir
     else:
         dir = sdir
     #
     result = dialog.fileDialog(self, 'Open', dir, '',"*")
     if result.accepted == False:
         self.post_message("File selection cancelled.")
         return
     #
     files = []
     #print result.paths
     for j in range(len(result.paths)):
         path        = result.paths[j]
         dir,fname   = os.path.split(path)
         if j == 0:
             if os.path.abspath(dir) != os.path.abspath(sdir):
                 self.components.SpecPath.text = dir
                 #self.init_SpecFile()
                 self.components.SpecFile.items = []
             fname0 = fname
         if fname not in files:
             files.append(fname)
     items = self.components.SpecFile.items
     for f in files:
         if f not in items: items.append(f)
     items.sort()
     self.components.SpecFile.items = items
     #
     self.components.SpecFile.stringSelection = fname0
     self.SpecFileSelect()
コード例 #5
0
ファイル: gui.py プロジェクト: tanmaykm/Circuitscape
 def on_gndBrowse_mouseClick(self, event):
     wildcard = "Tab-delimited text list or ASCII Raster (*.txt or *.asc)|*.txt;*.asc|All Files (*.*)|*.*" 
     result = dialog.fileDialog(self, 'Select Ground File', '', '', wildcard ) 
     if result.accepted == True:        
         file_name = result.paths[0]
         self.components.gndFile.text = file_name
         self.options.ground_file = file_name
コード例 #6
0
ファイル: wxXrf.py プロジェクト: FHe/tdl
    def on_menuFileReadXrf_select(self,event):
        
        result = dialog.fileDialog(self, 'Open...', self.dir, '',"*")
        if result.accepted:
            path      = result.paths[0]
            self.dir  = os.path.dirname(path)
        else:
            self.post_message("File selection cancelled.")
            return
        
        #print path, self.dir
        grp = self.components.Grp.text
        if len(grp)>0:
            var_name = "%s.xrf_data" % grp
        else:
            var_name = "xrf_data"

        line = "%s = []" % var_name  
        self.exec_line(line)
        for path in result.paths:
            path = path.replace("\\","\\\\")
            line = '__temp__ = ana.xrf_data.read("%s")' % (path)
            self.exec_line(line)
            line = "%s.append(__temp__)" % (var_name)
            self.exec_line(line)
        self.exec_line("del __temp__")

        # set select list to default grp etc..
        # self.components.Grp.text  = 'xrf.data'
        self.components.Node.text = var_name
        self.init_shell_list_items()

        return
コード例 #7
0
 def on_srcTargetBrowse_mouseClick(self, event):
     wildcard = "Tab-delimited text list or ASCII Raster (*.txt or *.asc)|*.txt;*.asc;*.txt.gz;*.asc.gz|All Files (*.*)|*.*" 
     result = dialog.fileDialog(self, 'Select Source/Target File', '', '', wildcard) 
     if result.accepted == True:        
         file_name = result.paths[0]
         self.components.srcTargetFile.text = file_name                    
         self.options.point_file = file_name
コード例 #8
0
 def on_polygonBrowse_mouseClick(self, event):
     wildcard = "ASCII Raster (*.asc)|*.asc|All Files (*.*)|*.*" 
     result = dialog.fileDialog(self, 'Select Short-Circuit Region Raster', '', '', wildcard) 
     if result.accepted == True:        
         file_name = str(result.paths[0])
         self.components.polygonFile.text = file_name
         self.childOptions.polygon_file = file_name
     else:
         self.components.polygonFile.text = ''
コード例 #9
0
 def on_maskBrowse_mouseClick(self, event):
     wildcard = "ASCII Raster (*.asc)|*.asc|All Files (*.*)|*.*"
     result = dialog.fileDialog(self, 'Select Raster Mask.  All cells with NODATA or non-positive-integer values will be dropped from resistance map. ', '', '', wildcard) 
     if result.accepted == True: 
         file_name = str(result.paths[0])
         self.components.maskFile.text = file_name
         self.childOptions.mask_file = file_name
     else:
         self.components.maskFile.text = ''
コード例 #10
0
 def on_varSrcBrowse_mouseClick(self, event):
     wildcard = "Tab-delimited text list (*.txt)|*.txt|All Files (*.*)|*.*" 
     result = dialog.fileDialog(self, 'Select List of Source Strengths', '', '', wildcard ) 
     if result.accepted == True: 
         file_name = str(result.paths[0])
         self.components.varSrcFile.text = file_name
         self.childOptions.variable_source_file = file_name
     else:
         self.components.varSrcFile.text = ''
コード例 #11
0
 def on_includePairsBrowse_mouseClick(self, event):
     wildcard = "Tab-delimited text list (*.txt)|*.txt|All Files (*.*)|*.*" 
     result = dialog.fileDialog(self, 'Select Matrix of Focal Node Pairs to Include/Exclude ', '', '', wildcard ) 
     if result.accepted == True: 
         file_name = str(result.paths[0])
         self.components.includePairsFile.text = file_name
         self.childOptions.included_pairs_file = file_name
     else:
         self.components.includePairsFile.text = ''
コード例 #12
0
 def on_habitatBrowse_mouseClick(self, event):
     if self.options.data_type == 'network':
         wildcard = "Tab-delimited text list (*.txt)|*.txt;*.txt.gz|All Files (*.*)|*.*" 
     else:
         wildcard = "ASCII Raster (*.asc or *.txt)|*.asc;*.txt;*.txt.gz;*.asc.gz|All Files (*.*)|*.*" 
     result = dialog.fileDialog(self, 'Select Raster Resistance Map or Network/Graph File', '', '', wildcard) 
     if result.accepted == True: 
         file_name = result.paths[0]
         self.components.habitatFile.text = file_name
         self.options.habitat_file = file_name
コード例 #13
0
 def on_BadPixelMapSel_mouseClick(self,event):        
     cdir = self.eval_line("pwd()")
     result = dialog.fileDialog(self, 'Open', cdir,'',"*")
     if result.accepted:
         file = result.paths[0]
         if len(file) > 0:
             file = file.replace("\\","\\\\")
             self.components.BadPixelMap.text = file
         else:
             self.components.BadPixelMap.text = ''
コード例 #14
0
ファイル: gui.py プロジェクト: Circuitscape/Circuitscape
 def on_currentSrcBrowse_mouseClick(self, event):
     if self.options.data_type == 'network':
         wildcard = "Tab-delimited text list (*.txt)|*.txt;*.txt.gz|All Files (*.*)|*.*" 
     else:
         wildcard = "Tab-delimited text list or ASCII Raster (*.txt or *.asc)|*.txt;*.asc;*.txt.gz;*.asc.gz|All Files (*.*)|*.*" 
     result = dialog.fileDialog(self, 'Select Source/Target File', '', '', wildcard) 
     if result.accepted == True:        
         file_name = result.paths[0]
         self.components.currentSrcFile.text = file_name                    
         self.options.source_file = file_name
コード例 #15
0
ファイル: wxSpecData.py プロジェクト: FHe/tdl
 def on_BadPixelMapSel_mouseClick(self,event):        
     cdir = self.eval_line("pwd()")
     result = dialog.fileDialog(self, 'Open', cdir,'',"*")
     if result.accepted:
         file = result.paths[0]
         if len(file) > 0:
             file = file.replace("\\","\\\\")
             self.components.BadPixelMap.text = file
         else:
             self.components.BadPixelMap.text = ''
コード例 #16
0
 def on_gndBrowse_mouseClick(self, event):
     if self.options.data_type == 'network':
         wildcard = "Tab-delimited text list (*.txt)|*.txt;*.txt.gz|All Files (*.*)|*.*" 
     else:
         wildcard = "Tab-delimited text list or ASCII Raster (*.txt or *.asc)|*.txt;*.asc;*.txt.gz;*.asc.gz|All Files (*.*)|*.*" 
     result = dialog.fileDialog(self, 'Select Ground File', '', '', wildcard ) 
     if result.accepted == True:        
         file_name = result.paths[0]
         self.components.gndFile.text = file_name
         self.options.ground_file = file_name
コード例 #17
0
 def on_appendButton_mouseClick(self, event):
     self._save_current_list()
     wildcard = "CSV files (*.csv)|*.csv|Text files (*.txt;*.log)|*.txt;*.log|All Files (*.*)|*.*"
     result = dialog.fileDialog(self, 'Open', '', '', wildcard )
     if not result.accepted:
         pprint.pprint(result)
         return
     for fn in result.paths:
         lines = open(fn, 'r').read().strip().split('\n')
         items = [x.split(',') for x in lines]
         self.components.theList.Append(items)
コード例 #18
0
 def on_appendButton_mouseClick(self, event):
     self._save_current_list()
     wildcard = "CSV files (*.csv)|*.csv|Text files (*.txt;*.log)|*.txt;*.log|All Files (*.*)|*.*"
     result = dialog.fileDialog(self, 'Open', '', '', wildcard)
     if not result.accepted:
         pprint.pprint(result)
         return
     for fn in result.paths:
         lines = open(fn, 'r').read().strip().split('\n')
         items = [x.split(',') for x in lines]
         self.components.theList.Append(items)
コード例 #19
0
 def on_menuFileLoadPrev_select(self, event):
     wildcard = "Options Files (*.ini)|*.ini|All Files (*.*)|*.*" 
     result = dialog.fileDialog(self, 'Select Circuitscape Options File', '', '', wildcard ) 
     if result.accepted==True:        
         configFile = result.paths[0]
         self.options = self.LoadOptions(configFile)
         self.options.version = self.state['version']
         self.reset_status_bar()
         #Set all gui objects to reflect options    
         self.setWidgets()
         
         self.components.calcButton.SetFocus()
コード例 #20
0
ファイル: DanListHandler.py プロジェクト: Dzeiberg/lax
 def homeCSV(self):#loading home roster by loading CSV.
     #Called in on_loadButton_mouseClicked function
     wildcard = "CSV files (*.csv)|*.csv|Text files (*.txt;*.log)|*.txt;*.log|All Files (*.*)|*.*"
     result = dialog.fileDialog(self, 'Open', '', '', wildcard )
     if not result.accepted:
         return
     items = []
     for fn in result.paths:
         lines = open(fn, 'r').read().strip().split('\n')
         items.extend([x.split(',') for x in lines])
     if len(items) < 2:
         return
     self.components.theList.columnHeadings = items[0]
     tempVar = items[1:]
     self.components.theList.items = tempVar
     for i in range(0,self.components.theList.GetCount()):
         self.homeTimes.append(0)
コード例 #21
0
ファイル: wxCtrData.py プロジェクト: pombredanne/tdl
 def on_menuFileWriteHKL_select(self,event):
     cdir = self.eval_line("pwd()")
     result = dialog.fileDialog(self, 'Save', cdir, '',"*")
     if result.accepted:
         path        = result.paths[0]
         dir,fname   = os.path.split(path)
         if os.path.abspath(dir) != os.path.abspath(cdir):
             dir = dir.replace("\\","\\\\")
             line = "cd('%s')" % dir
             self.eval_line(line)
     else:
         self.post_message("File selection cancelled.")
         return
     #print dir, fname
     ctr = self.get_ctr()
     if ctr != None:
         ctr.write_HKL(path)  
コード例 #22
0
ファイル: wxCtrData.py プロジェクト: ttrainor/_tdl
 def on_menuFileWriteHKL_select(self, event):
     cdir = self.eval_line("pwd()")
     result = dialog.fileDialog(self, 'Save', cdir, '', "*")
     if result.accepted:
         path = result.paths[0]
         dir, fname = os.path.split(path)
         if os.path.abspath(dir) != os.path.abspath(cdir):
             dir = dir.replace("\\", "\\\\")
             line = "cd('%s')" % dir
             self.eval_line(line)
     else:
         self.post_message("File selection cancelled.")
         return
     #print dir, fname
     ctr = self.get_ctr()
     if ctr != None:
         ctr.write_HKL(path)
コード例 #23
0
ファイル: wxCtrData.py プロジェクト: cbiwer/tdl
 def on_menuFileSaveCtr_select(self, event):
     cdir = self.eval_line("pwd()")
     result = dialog.fileDialog(self, "Save", cdir, "", "*")
     if result.accepted:
         path = result.paths[0]
         dir, fname = os.path.split(path)
         if os.path.abspath(dir) != os.path.abspath(cdir):
             dir = dir.replace("\\", "\\\\")
             line = "cd('%s')" % dir
             self.eval_line(line)
     else:
         self.post_message("File selection cancelled.")
         return
     # print dir, fname
     ctr = self.get_ctr_name()
     line = "save %s %s" % (ctr, fname)
     print line
     self.exec_line(line)
コード例 #24
0
ファイル: wxShell.py プロジェクト: pombredanne/tdl
    def on_menuFile_SaveAs_select(self,event):
        cdir = self.eval_line("pwd()")
        result = dialog.fileDialog(self, 'Save', cdir, '',"*")
        if result.accepted:
            path        = result.paths[0]
            dir,fname   = os.path.split(path)
            if os.path.abspath(dir) != os.path.abspath(cdir):
                dir = dir.replace("\\","\\\\")
                line = "cd('%s')" % dir
                self.eval_line(line)
        else:
            self.post_message("File selection cancelled.")
            return

        #print dir, fname
        self.save_file = path
        line = "save %s" % path
        self.exec_line(line)
コード例 #25
0
ファイル: wxShell.py プロジェクト: ttrainor/_tdl
    def on_menuFile_Restore_select(self, event):
        cdir = self.eval_line("pwd()")
        result = dialog.fileDialog(self, 'Open', cdir, '', "*")
        if result.accepted:
            path = result.paths[0]
            dir, fname = os.path.split(path)
            if os.path.abspath(dir) != os.path.abspath(cdir):
                dir = dir.replace("\\", "\\\\")
                line = "cd('%s')" % dir
                self.eval_line(line)
        else:
            self.post_message("File selection cancelled.")
            return

        #print dir, fname
        self.save_file = path
        line = "restore %s" % path
        self.exec_line(line)
コード例 #26
0
ファイル: wxCtrData.py プロジェクト: ttrainor/_tdl
 def on_menuFileSaveCtr_select(self, event):
     cdir = self.eval_line("pwd()")
     result = dialog.fileDialog(self, 'Save', cdir, '', "*")
     if result.accepted:
         path = result.paths[0]
         dir, fname = os.path.split(path)
         if os.path.abspath(dir) != os.path.abspath(cdir):
             dir = dir.replace("\\", "\\\\")
             line = "cd('%s')" % dir
             self.eval_line(line)
     else:
         self.post_message("File selection cancelled.")
         return
     #print dir, fname
     ctr = self.get_ctr_name()
     line = "save %s %s" % (ctr, fname)
     print line
     self.exec_line(line)
コード例 #27
0
 def on_loadButton_mouseClick(self, event):
     """Load the list with the contents of a CSV file.
     The first row is assumed to be column headings.
     Suggestion: replace this simple CSV hack with one of the packages
     designed for this purpose."""
     self._save_current_list()
     wildcard = "CSV files (*.csv)|*.csv|Text files (*.txt;*.log)|*.txt;*.log|All Files (*.*)|*.*"
     result = dialog.fileDialog(self, 'Open', '', '', wildcard)
     if not result.accepted:
         pprint.pprint(result)
         return
     items = []
     for fn in result.paths:
         lines = open(fn, 'r').read().strip().split('\n')
         items.extend([x.split(',') for x in lines])
     if len(items) < 2:
         return
     self.components.theList.columnHeadings = items[0]
     self.components.theList.items = items[1:]
コード例 #28
0
 def on_loadButton_mouseClick(self, event):
     """Load the list with the contents of a CSV file.
     The first row is assumed to be column headings.
     Suggestion: replace this simple CSV hack with one of the packages
     designed for this purpose."""
     self._save_current_list()
     wildcard = "CSV files (*.csv)|*.csv|Text files (*.txt;*.log)|*.txt;*.log|All Files (*.*)|*.*"
     result = dialog.fileDialog(self, 'Open', '', '', wildcard )
     if not result.accepted:
         pprint.pprint(result)
         return
     items = []
     for fn in result.paths:
         lines = open(fn, 'r').read().strip().split('\n')
         items.extend([x.split(',') for x in lines])
     if len(items) < 2:
         return
     self.components.theList.columnHeadings = items[0]
     self.components.theList.items = items[1:]
コード例 #29
0
ファイル: wxCtrData.py プロジェクト: pombredanne/tdl
 def on_menuFileReadCtr_select(self,event):        
     cdir = self.eval_line("pwd()")
     result = dialog.fileDialog(self, 'Open', cdir, '',"*")
     if result.accepted:
         path        = result.paths[0]
         dir,fname   = os.path.split(path)
         if os.path.abspath(dir) != os.path.abspath(cdir):
             dir = dir.replace("\\","\\\\")
             line = "cd('%s')" % dir
             self.eval_line(line)
     else:
         self.post_message("File selection cancelled.")
         return
     #print dir, fname
     self.save_file = path
     line = "restore %s" % path
     print line
     self.exec_line(line)
     print "Select ctr data variable"
     self.init_shell_items()
コード例 #30
0
    def on_menuFileSave_select(self, event):
        """Save content in urlTextField using UTF-8 encoding"""
        # default save directory in home dir
        save_dir = os.path.expanduser('~')
        if os.name == 'nt':
            # windows default in Desktop
            save_dir = os.path.join(save_dir, u'Desktop')

        result = dialog.fileDialog(self, 
            'Save', 
            save_dir,
            'lyric.txt',
            'Text Files (*.txt)|*.txt|All Files (*.*)|*.*',
            wx.SAVE | wx.OVERWRITE_PROMPT,
        )

        if result.accepted:
            f = open(result.paths[0], 'wb')
            string = self.components.lyricTextArea.text
            f.write(string.encode('utf8'))
            f.close()
コード例 #31
0
ファイル: BidderDataInput.py プロジェクト: HowardLu/bidding
	def on_ButtonImport_mouseClick( self, event ):
		filter = "Office Excel Files|*.xls"
		result = dialog.fileDialog( self, 'Open', '', '', filter )
		
		if result == False:
			return
		
		book = xlrd.open_workbook( result.paths[0] )
		sheet = book.sheet_by_index( 0 )
		
		for index_row in xrange( 1, sheet.nrows ):
			bidder_data = {}
			for index_col, attr in enumerate( ALL_BIDDER_ATTRS ):
				val = "%s" % sheet.cell( index_row, index_col ).value
				# self.__add_msg( "%s, %s" % ( val, type( val ) ) )
				bidder_data[ attr ] = val
				
			bidder_data = self.__gen_bidder_data_by_dict( bidder_data )
			if not bidder_data:
				continue

			self.__add_bidder_by_data( bidder_data )
コード例 #32
0
 def on_compilerPathBtn_mouseClick(self, event):
     result = dialog.fileDialog(self, self.components.StaticText7.text,
                                self.components.compilerPath.text)
     if result.accepted:
         self.components.compilerPath.text = result.paths[0]
コード例 #33
0
 def on_buttonFile_mouseClick(self, event):
     wildcard = "JPG files (*.jpg;*.jpeg)|*.jpeg;*.JPG;*.JPEG;*.jpg|GIF files (*.gif)|*.GIF;*.gif|All Files (*.*)|*.*"
     # wildcard = '*.py'
     result = dialog.fileDialog(self, 'Open', '', '', wildcard)
     self.components.fldResults.text = "fileDialog result:\naccepted: %s\npaths: %s" % (
         result.accepted, result.paths)
コード例 #34
0
ファイル: DanListHandler.py プロジェクト: Dzeiberg/lax
    def on_compileStatsButton_mouseClick(self, event):
        #exports compiled stats as a CSV
        playerDict = dict()
        printed = ""
        wildcard = "csv Files (*.csv)|*.csv"
        result = dialog.fileDialog(self,
                                   'Open',
                                   "",
                                   '',
                                   wildcard )
        games = result.paths
        if not(result.accepted):
            return
        for i in range(0,len(games)):
            f = open(os.path.abspath(games[i]),'r')
            try:
                lines = f.readlines()
                lines = lines[2:]
                for j in range(0,len(lines)):
                    line = lines[j].strip('\n').split(",")
                    if (line[0] in playerDict.keys()):
                        for s in range(2,10):
                            playerDict[line[0]][s] = str(int(playerDict[line[0]][s])+int(line[s]))
                    else:
                        playerDict[line[0]] = line
            finally:
                f.close()
        for key in playerDict.keys():
            playerDict[key].insert(3,str(float(playerDict[key][2])/len(games)))#goals per game
            playerDict[key].insert(5,str(float(playerDict[key][4])/len(games)))#assists per game
            playerDict[key].insert(7,str(float(playerDict[key][6])/len(games)))#shots per game
            playerDict[key].insert(9,str(float(playerDict[key][8])/len(games)))#groundballs per game
        playerNames = sorted(playerDict.keys())#sorts the keys (names of the players) so the stats can be printed in order
        printed = 'Player, Number, Total Goals, Goals per Game, Total Assists, Assists per Game, Total Shots, Shots per Game, Total Groundballs, Groundballs per Game, Total Faceoffs Won, Total Faceoffs Lost, Total Saves, Total Minutes\n'
        for k in range(0,len(playerNames)):
            printed += ','.join(playerDict[playerNames[k]])+"\n"
        result = dialog.alertDialog(self,
                                              'Statistics were saved to the compiled statistics folder.',
                                              "Compiled Statistics")

        #WRITING COMPILED STATS FILE
        v = 1 #Initialize VERSION Constant
        #Checks if file already exists
        saveDirectory = self.gameStats+"/Compiled_Stats"
        if not(os.path.exists(saveDirectory)):
               os.makedirs(saveDirectory)
        if(os.path.isfile(os.path.abspath(saveDirectory+'/Compiled Stats.csv'))):
            while(os.path.isfile(os.path.abspath(saveDirectory+'/Compiled Stats'+str(v)+'.csv'))):
                v=v+1
            filename = saveDirectory+'/Compiled Stats'+str(v)+'.csv'
            
            #creates v1,v2,etc file
            f = open(os.path.abspath(filename),'w')
            try:
                f.write(printed)
            finally:
                f.close()
        #else creates file
        else:
            f = open(os.path.abspath(saveDirectory+'/Compiled Stats.csv'),'w')
            try:
                f.write(printed)

            finally:
                f.close()