def __addFileToTask(self, caller, eventArgs): oDialog = OpenFileDialog() oDialog.Title = 'Select File to Erase' oDialog.Filter = 'All files (*.*)|*.*' if oDialog.ShowDialog() == DialogResult.OK: self.conDict['dGrid'].Items.Add(oDialog.FileName)
def _pick_sound_file(title, local_path): dialog = OpenFileDialog() dialog.Title = title dialog.InitialDirectory = Environment.GetEnvironmentVariable("USERPROFILE") dialog.Filter = "mp3 files (*.mp3)|*.mp3" if dialog.ShowDialog() == DialogResult.OK: os.system('copy "{0}" "{1}"'.format(dialog.FileName, local_path)) Parent.PlaySound(local_path, 1)
def do_open_dialog(): dlg = OpenFileDialog() dlg.Title = "Import Column Settings" dlg.FileName = "Column Import" dlg.Filter = 'MahTweets Settings (*.mahtweets) | *.mahtweets' if dlg.ShowDialog() == DialogResult.OK: return dlg.FileName else: return None
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
def abreFichero(self, sender, event): color = OpenFileDialog() color.Filter = "Ficheros txt (*.txt)|*.txt" color.Title = "Selecciona un fichero de texto" nombre = "" if (color.ShowDialog() == DialogResult.OK ): nombre = color.FileName self.label2.Text = "Fichero seleccionado: " + nombre # cargamos el texto fichero = File.OpenText(nombre) texto = "" s = fichero.ReadLine() while s : texto += s s = fichero.ReadLine() self.areaTexto.Text = texto
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])
import sys import clr clr.AddReference("System.Windows.Forms") from System.Windows.Forms import DialogResult, OpenFileDialog dialog = OpenFileDialog() dialog.Title = 'Select CAD(.sat) File' dialog.Filter = "sat files (*.sat)|*.sat" if dialog.ShowDialog() == DialogResult.OK: sat_path = dialog.FileName else: pass import ScriptEnv ScriptEnv.Initialize("Ansoft.ElectronicsDesktop") oDesktop.RestoreWindow() oDesktop.ClearMessages("","",2) oProject = oDesktop.GetActiveProject() oProject.Save() oDesign = oProject.GetActiveDesign() design_name = oDesign.GetName() oEditor = oDesign.SetActiveEditor("3D Modeler") def getMaterial(): result = {} for i in range(oEditor.GetNumObjects()): name = oEditor.GetObjectName(i) material = oEditor.GetPropertyValue('Geometry3DAttributeTab', name, 'Material').replace('"', '') color = oEditor.GetPropertyValue('Geometry3DAttributeTab', name, 'Color') result[name] = (material, color)
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])