Example #1
0
def get_output_directory():
    folder_dialog = FolderBrowserDialog()
    folder_dialog.ShowNewFolderButton = True
    folder_dialog.Description = 'Output directory for R scripts'
    if folder_dialog.ShowDialog() != DialogResult.OK:
        return None
    return folder_dialog.SelectedPath
Example #2
0
    def Dialog_dir_backup(self):
        """ Ask user to use same directory as Revit file or
            Open a DialogBox to select destination folder manually."""
        try:
            #>>>>>>>>>> Check if Revit file exists.
            file_exist = os.path.exists(doc.PathName)
            if file_exist:
                dialogResult = MessageBox.Show(
                    "Would you like to save CAD files in the same folder as current Revit file?\n\n"
                    + "Current file's path: " + str(doc.PathName), __title__,
                    MessageBoxButtons.YesNo)
                if (dialogResult == DialogResult.Yes):
                    #>>>>>>>>>> Saving folder is the same as Revit location
                    doc_path = doc.PathName
                    rvt_name = doc_path.split("\\")[-1]
                    temp = len(doc_path) - len(rvt_name)
                    doc_dir = doc_path[:temp]
                    return doc_dir

            #>>>>>>>>>> CHOOSE SAVING DIR
            fileDialog = FolderBrowserDialog()
            fileDialog.Description = "Select folder for saving dwg files."
            fileDialog.ShowDialog()

            #>>>>>>>>>> SELECTED PATH
            dir_backup = fileDialog.SelectedPath
            if not dir_backup:
                alert("Backup path was not selected!\n Please try again.",
                      title=__title__,
                      exitscript=True)
            return dir_backup

        except:
            return None
Example #3
0
 def select_path(self):
     "Выбираем путь куда сложим монтажный план и файл осей."
     dir_path = FolderBrowserDialog()
     res = dir_path.ShowDialog()
     if res == DialogResult.OK and dir_path.SelectedPath:
         dir_path = dir_path.SelectedPath
     return dir_path
Example #4
0
def DirectoryOpenDialog(initialDirectory=None):
    dlg = FolderBrowserDialog()
    dlg.ShowNewFolderButton = True
    if initialDirectory:
        dlg.SelectedPath = initialDirectory #Path.GetFileName(initialFile)
    if dlg.ShowDialog() != DialogResult.Cancel:
        return dlg.SelectedPath 
Example #5
0
    def MenuPath_Click(self, sender, e):
        dialog = FolderBrowserDialog()
        result = dialog.ShowDialog()

        if result == result.OK:
            self.path = dialog.SelectedPath

        pass
Example #6
0
 def Folder_Browser_dialog(self, suffix):
     dialog = FolderBrowserDialog()
     if dialog.ShowDialog() == DialogResult.OK:
         folder = str(dialog.SelectedPath) + "\\**\\"
         files = glob2.glob(folder + suffix)  #ex '*.log'
         for f in files:
             self.file_list.append(f)
         return True
     return False
Example #7
0
    def folder_tb_PreviewMouseDoubleClick(self, sender, e):
        dialog = FolderBrowserDialog()
        if self.folder_tb:
            dialog.SelectedPath = self.folder_tb.Text
        else:
            dialog.SelectedPath = 'c:\\'

        if dialog.ShowDialog() == DialogResult.OK:
            self.folder_tb.Text =  dialog.SelectedPath  
        else:
            pass
Example #8
0
def ExportBDFData(sender, args):
    # Create a File open dialog
    dialog = FolderBrowserDialog()
    dialog.Title = "Select directory to save the BDF files"

    # Display the dialog
    # If it returns anything
    #   get the file name
    global projectPath
    if dialog.ShowDialog():
        projectPath = dialog.SelectedPath
        file_path = os.path.dirname(os.path.realpath(__file__))
        dictionary["DirPath"] = projectPath
        script_path = os.path.join(file_path, 'ExportBDF.py')
        apex_sdk.runScriptFunction(file=script_path,
                                   function="ExportBDF",
                                   args=dictionary)
Example #9
0
def win_dialog_thread(arg):
    print(f"dialog_thread started")
    folder_dialog = FolderBrowserDialog()
    file_dialog = OpenFileDialog()

    title = arg.Dequeue()
    initial_folder = arg.Dequeue()
    print(f"title: {title}, initial_folder: {initial_folder}")
    folder_dialog.Description = title
    folder_dialog.SelectedPath = initial_folder
    folder_dialog_result = folder_dialog.ShowDialog()
    file_dialog_result = file_dialog.ShowDialog()

    selected_folder = folder_dialog.SelectedPath
    selected_file = file_dialog.FileName
    win_dialog_result = selected_folder, selected_file
    arg.Enqueue(win_dialog_result)
    print(f"win_dialog_thread completed, {win_dialog_result}")
Example #10
0
 def browse(self, sender, event):
     dialog = FolderBrowserDialog()
     dialog.SelectedPath = os.environ["USERPROFILE"] + "\\"
     if (dialog.ShowDialog(self) == DialogResult.OK):
         self.KeyPath.Text = dialog.SelectedPath
def windBrowser():
    # Create folder browser window
    dialog = FolderBrowserDialog()
    # Record for user action and store selected path
    if (dialog.ShowDialog() == DialogResult.OK):
        return dialog.SelectedPath
    'C:/Program Files/AnsysEM/AnsysEM19.4/Win64/common/IronPython/DLLs')
sys.path.append(
    'C:/Program Files/AnsysEM/AnsysEM19.5/Win64/common/IronPython/DLLs')
sys.path.append(
    'C:/Program Files/AnsysEM/AnsysEM20.1/Win64/common/IronPython/DLLs')
sys.path.append(
    'C:/Program Files/AnsysEM/AnsysEM20.2/Win64/common/IronPython/DLLs')
clr.AddReference('IronPython.Wpf')
from System.Windows.Forms import FolderBrowserDialog, DialogResult

import ScriptEnv

ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")
oDesktop.RestoreWindow()
oProject = oDesktop.GetActiveProject()
oDesign = oProject.GetActiveDesign()
oModule = oDesign.GetModule("ReportSetup")

dialog = FolderBrowserDialog()
project_folder = os.path.dirname(oProject.GetPath()).replace('/', '\\')
dialog.SelectedPath = project_folder

if dialog.ShowDialog() == DialogResult.OK:
    path = dialog.SelectedPath
    for report in oModule.GetAllReportNames():
        AddWarningMessage("Export {}.jpg".format(report))
        oModule.ExportImageToFile(report, "{}/{}.jpg".format(path, report),
                                  8000, 4000)
else:
    pass
Example #13
0
 def opendirectory(self, sender, event):
     fbd = FolderBrowserDialog()
     dr = fbd.ShowDialog()
     if dr == DialogResult.OK:
         sender.Text = fbd.SelectedPath
# Import libraries to create a Windows form
clr.AddReference("System.Windows.Forms")
clr.AddReference("System.Drawing")

from System.Windows.Forms import FolderBrowserDialog
from System.Windows.Forms import DialogResult

# Store user specified path
directory = ""

# Create folder browser window
dialog = FolderBrowserDialog()

# Record for user action and store selected path
if (dialog.ShowDialog() == DialogResult.OK):
    directory = dialog.SelectedPath


# Retrieve all pathfiles and names from directory and subdirectories
def retrieveFamilies(directory):
    familiesNames = list()
    for folderName, subFolders, files in os.walk(directory):
        # Check if there are Revit families
        families = re.compile(r"[^{ddd+}]\.rfa$")
        for file in files:
            # Assign matched files to a variable
            matched = families.search(file)
            if matched:
                # Get path of families
                filePath = os.path.join(folderName, file)
Example #15
0
def pick_folder():
    fb_dlg = FolderBrowserDialog()
    if fb_dlg.ShowDialog() == DialogResult.OK:
        return fb_dlg.SelectedPath
Example #16
0
	def onClick(self, sender, args):
		dirDialog = FolderBrowserDialog()
		if (dirDialog.ShowDialog() == 1):
			TextboxDir.Text = dirDialog.SelectedPath
			print "Selected directory to import data:"+dirDialog.SelectedPath
Example #17
0
def get_folder(prompt):
    dlg = FolderBrowserDialog()
    dlg.Description = prompt
    res = dlg.ShowDialog()
    if res == DialogResult.OK:
        return dlg.SelectedPath
Example #18
0
fileName = 'RoadMap_123'
fileType = '.xls'

fileDetails = fileName + fileType
defaultPath = Document.Properties['exportFileLocation']
savePath = defaultPath + "\\" + fileDetails
print
exportMessage = ''

dialogResult = MessageBox.Show(
    "The RoadMap files are ready to be exported\n\nDo you want to change the save location?\n\nPath: "
    + savePath, "OSC RoadMap Export Prompt", MessageBoxButtons.YesNoCancel)

if (dialogResult == DialogResult.Yes):
    SaveFile = FolderBrowserDialog()
    SaveFile.ShowDialog()
    savePath = SaveFile.SelectedPath + "\\" + fileDetails

elif (dialogResult == DialogResult.No):
    roadmapTable = Document.Data.Tables['roadmap']
    writer = Document.Data.CreateDataWriter(
        DataWriterTypeIdentifiers.ExcelXlsDataWriter)

    stream = File.OpenWrite(savePath)

    allColumnNames = []
    allRows = Document.Data.AllRows.GetSelection(roadmapTable).AsIndexSet()

    for column in roadmapTable.Columns:
        allColumnNames.Add(column.Name)