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)
示例#2
0
def GetGDXPath(sender,event):
	dialog = OpenFileDialog()
	dialog.Filter = "GDX files (*.gdx)|*.gdx"
	dialog.InitialDirectory = SolverStudio.WorkingDirectory()
	myDialog = dialog.ShowDialog()
	if (myDialog == DialogResult.OK):
		return dialog.FileName
	elif (myDialog == DialogResult.Cancel):
		return "CANCELLED"
示例#3
0
文件: plotcsv.py 项目: Imme1992/wflow
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
示例#4
0
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 EditValue(self, context, provider, value) :

        dialog = OpenFileDialog()
        dialog.Filter = "MP3 files (*.mp3)|*.mp3|All files (*.*)|*.*"
        dialog.InitialDirectory = Environment.SpecialFolder.Recent.ToString();
        
        if dialog.ShowDialog() == DialogResult.OK :
            value = dialog.FileName
        
        dialog.Dispose()
        
        return value
示例#6
0
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
示例#7
0
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
示例#8
0
# Needed if this .net thing is not loaded yet
import clr

clr.AddReference("System.Windows.Forms")
from System.Windows.Forms import OpenFileDialog, DialogResult

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
示例#9
0
文件: tst.py 项目: Imme1992/wflow
# Needed if this .net thing is not loaded yet
import clr
clr.AddReference("System.Windows.Forms")
from System.Windows.Forms import OpenFileDialog, DialogResult

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