def pick_file(file_ext='', multi_file=False): of_dlg = OpenFileDialog() of_dlg.Filter = '|*.{}'.format(file_ext) of_dlg.RestoreDirectory = True of_dlg.Multiselect = multi_file if of_dlg.ShowDialog() == DialogResult.OK: return of_dlg.FileName
def pick_file(file_ext='', files_filter='', init_dir='', restore_dir=True, multi_file=False, unc_paths=False): of_dlg = OpenFileDialog() if files_filter: of_dlg.Filter = files_filter else: of_dlg.Filter = '|*.{}'.format(file_ext) of_dlg.RestoreDirectory = restore_dir of_dlg.Multiselect = multi_file if init_dir: of_dlg.InitialDirectory = init_dir if of_dlg.ShowDialog() == DialogResult.OK: if unc_paths: return dletter_to_unc(of_dlg.FileName) return of_dlg.FileName
def getcsvname(): themodel = wfl.GetModelByPartialName('wflow') dialog = OpenFileDialog() if themodel: dialog.InitialDirectory = os.path.join(themodel.DirectoryPath,themodel.DefaultOutputDirectoryName) else: dialog.InitialDirectory ="C:\\" dialog.Filter = "csv files (*.csv) | *.csv" dialog.FilterIndex = 1 dialog.RestoreDirectory = False dialog.Title = "Select a WFlow result csv file: " if (dialog.ShowDialog() == DialogResult.OK): thefile = dialog.FileName return thefile
def GetFileList(): dlgFile = OpenFileDialog() dlgFile.Title = "Select files to change" dlgFile.Filter = "Wave files (*.wav)|*.wav" dlgFile.InitialDirectory = Settings.Instance().DataDir dlgFile.CheckFileExists = True dlgFile.CheckPathExists = True dlgFile.AddExtension = True dlgFile.AutoUpgradeEnabled = True dlgFile.DefaultExt = "wav" dlgFile.Multiselect = True dlgFile.RestoreDirectory = True dlgFile.SupportMultiDottedExtensions = True dlgFile.FileName = "" result = dlgFile.ShowDialog() if (result == DialogResult.OK): Settings.Instance().DataDir = Path.GetDirectoryName(dlgFile.FileName) return dlgFile.FileNames else: return
def getcsvname(): themodel = wfl.GetModelByPartialName("wflow") dialog = OpenFileDialog() if themodel: dialog.InitialDirectory = os.path.join( themodel.DirectoryPath, themodel.DefaultOutputDirectoryName) else: dialog.InitialDirectory = "C:\\" dialog.Filter = "csv files (*.csv) | *.csv" dialog.FilterIndex = 1 dialog.RestoreDirectory = False dialog.Title = "Select a WFlow result csv file: " if dialog.ShowDialog() == DialogResult.OK: thefile = dialog.FileName return thefile
one = "c:\\repos\wflow-git\\examples\\wflow_rhine_sbm\\pmult\\store.csv" two = "c:\\repos\wflow-git\\examples\\wflow_rhine_sbm\\run_default\\store.csv" themodel = wfl.GetModelByPartialName("wflow") dialog = OpenFileDialog() if themodel: dialog.InitialDirectory = os.path.join(themodel.DirectoryPath, themodel.DefaultOutputDirectoryName) else: dialog.InitialDirectory = "C:\\" dialog.Filter = "csv files (*.csv) | *.csv" dialog.FilterIndex = 1 dialog.RestoreDirectory = False dialog.Title = "Select a WFlow result csv file: " if dialog.ShowDialog() == DialogResult.OK: thefile = dialog.FileName casename = os.path.dirname(os.path.dirname(thefile)) csvfile = os.path.basename(thefile) print casename runs = getrunids(casename) print runs complot(runs, csvfile, [2])
two = 'c:\\repos\wflow-git\\examples\\wflow_rhine_sbm\\run_default\\store.csv' themodel = wfl.GetModelByPartialName('wflow') dialog = OpenFileDialog() if themodel: dialog.InitialDirectory = os.path.join(themodel.DirectoryPath,themodel.DefaultOutputDirectoryName) else: dialog.InitialDirectory ="C:\\" dialog.Filter = "csv files (*.csv) | *.csv" dialog.FilterIndex = 1 dialog.RestoreDirectory = False dialog.Title = "Select a WFlow result csv file: " if (dialog.ShowDialog() == DialogResult.OK): thefile = dialog.FileName casename = os.path.dirname(os.path.dirname(thefile)) csvfile = os.path.basename(thefile) print casename runs = getrunids(casename) print runs complot(runs,csvfile,[2])