예제 #1
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
예제 #2
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 
예제 #3
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
예제 #4
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
예제 #5
0
    def __init__(self):
        self.Text = "Spreadsheet to HTML"
        self.Width = 220
        self.Height = 90
        self.FormBorderStyle = FormBorderStyle.Fixed3D

        self.openDialog = OpenFileDialog()
        self.openDialog.Title = "Choose a Python Spreadsheet File"
        self.openDialog.Filter = 'Python files (*.py)|*.py|All files (*.*)|*.*'

        self.folderDialog = FolderBrowserDialog()
        self.folderDialog.ShowNewFolderButton = True
        self.folderDialog.Description = "Choose a directory to save the HTML files in."

        l = Label()
        l.AutoSize = True
        l.Location = Point(50, 5)
        l.Text = "Choose a Spreadsheet"

        b = Button(Text="Choose")
        b.Click += self.convert
        b.Location = Point(70, 30)

        self.Controls.Add(l)
        self.Controls.Add(b)
예제 #6
0
    def MenuPath_Click(self, sender, e):
        dialog = FolderBrowserDialog()
        result = dialog.ShowDialog()

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

        pass
예제 #7
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
예제 #8
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
예제 #9
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)
예제 #10
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}")
예제 #11
0
def getCustomToolPropertyContent():
    # Create a Grid
    my_Grid = WPFControls.Grid()

    # Add 2 Rows and 1 Column
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.ColumnDefinitions.Add(WPFControls.ColumnDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.ColumnDefinitions.Add(WPFControls.ColumnDefinition())

    currRow = 0

    # -- Horizontal sheet definition
    IDLbl = WPFControls.TextBlock()
    IDLbl.Text = "Hatching definition"
    WPFControls.Grid.SetRow(IDLbl, currRow)
    IDLbl.FontSize = 11

    # Create label and input field
    currRow += 1
    layerLbl = WPFControls.TextBlock()
    layerLbl.Text = "   Trajec. spacing (mm): "
    WPFControls.Grid.SetRow(layerLbl, currRow)
    WPFControls.Grid.SetColumn(layerLbl, 0)

    global distanceLine
    distanceLine = WPFControls.TextBox()
    WPFControls.Grid.SetRow(distanceLine, currRow)
    WPFControls.Grid.SetColumn(distanceLine, 1)

    # Create label and input field
    currRow += 1
    pointSpacing = WPFControls.TextBlock()
    pointSpacing.Text = "   Point spacing (mm):"
    WPFControls.Grid.SetRow(pointSpacing, currRow)
    WPFControls.Grid.SetColumn(pointSpacing, 0)

    global pointSpacingValue
    pointSpacingValue = WPFControls.TextBox()
    WPFControls.Grid.SetRow(pointSpacingValue, currRow)
    WPFControls.Grid.SetColumn(pointSpacingValue, 1)

    # Type of angular cut
    currRow += 1
    angleCutType = WPFControls.TextBlock()
    angleCutType.Text = "   Angular cut:"
    WPFControls.Grid.SetRow(angleCutType, currRow)
    WPFControls.Grid.SetColumn(angleCutType, 0)

    # Create a Combo box
    global angleTypeSelection
    angleTypeSelection = WPFControls.ComboBox()

    item1 = WPFControls.ComboBoxItem()
    item1.Content = "Single angle"
    angleTypeSelection.Items.Add(item1)

    item2 = WPFControls.ComboBoxItem()
    item2.Content = "Incremental"
    angleTypeSelection.Items.Add(item2)

    item3 = WPFControls.ComboBoxItem()
    item3.Content = "Cycle through"
    angleTypeSelection.Items.Add(item3)

    angleTypeSelection.SelectedIndex = "0"
    WPFControls.Grid.SetRow(angleTypeSelection, currRow)
    WPFControls.Grid.SetColumn(angleTypeSelection, 1)
    #angleTypeSelection.SelectionChanged += HandleAngleSelection

    # Create label and input field
    currRow += 1
    global angleLbl
    angleLbl = WPFControls.TextBlock()
    angleLbl.Text = "   Angle (deg):"
    WPFControls.Grid.SetRow(angleLbl, currRow)
    WPFControls.Grid.SetColumn(angleLbl, 0)

    global angleValue
    angleValue = WPFControls.TextBox()
    WPFControls.Grid.SetRow(angleValue, currRow)
    WPFControls.Grid.SetColumn(angleValue, 1)

    # Create checkbox to ask for mesh
    currRow += 1
    global meshCheck
    meshCheck = WPFControls.CheckBox()
    meshCheck.Content = "Mesh the layers for me"
    meshCheck.Height = 25
    WPFControls.Grid.SetRow(meshCheck, currRow)
    WPFControls.Grid.SetColumn(meshCheck, 0)
    WPFControls.Grid.SetColumnSpan(meshCheck, 3)

    # Create a button
    currRow += 1
    getDirectory = WPFControls.Button()
    getDirectory.Content = "Select directory to save"
    WPFControls.Grid.SetRow(getDirectory, currRow)
    WPFControls.Grid.SetColumn(getDirectory, 0)
    getDirectory.Height = 30
    WPFControls.Grid.SetColumnSpan(getDirectory, 3)
    getDirectory.Click += HandleGetDir

    global dialog
    dialog = FolderBrowserDialog()
    dialog.Description = "Choose where to save trajectories"
    dialog.ShowNewFolderButton = True

    # Create a button
    currRow += 1
    goSlice = WPFControls.Button()
    goSlice.Content = "Create hatching"
    WPFControls.Grid.SetRow(goSlice, currRow)
    WPFControls.Grid.SetColumn(goSlice, 0)
    goSlice.Height = 30
    WPFControls.Grid.SetColumnSpan(goSlice, 3)

    # Link a function to the Button "Click" event
    # This function will be called every time the Button is clicked
    goSlice.Click += HandleApplyButton

    # Add the controls to the Grid
    my_Grid.Children.Add(IDLbl)
    my_Grid.Children.Add(layerLbl)
    my_Grid.Children.Add(distanceLine)
    my_Grid.Children.Add(pointSpacing)
    my_Grid.Children.Add(pointSpacingValue)

    my_Grid.Children.Add(angleCutType)
    my_Grid.Children.Add(angleTypeSelection)
    my_Grid.Children.Add(angleLbl)
    my_Grid.Children.Add(angleValue)

    my_Grid.Children.Add(getDirectory)

    my_Grid.Children.Add(meshCheck)
    my_Grid.Children.Add(goSlice)

    # Return the Grid
    return my_Grid
예제 #12
0
# Import Python modules
import os
import re

# 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)
예제 #13
0
def pick_folder():
    fb_dlg = FolderBrowserDialog()
    if fb_dlg.ShowDialog() == DialogResult.OK:
        return fb_dlg.SelectedPath
예제 #14
0
	def onClick(self, sender, args):
		dirDialog = FolderBrowserDialog()
		if (dirDialog.ShowDialog() == 1):
			TextboxDir.Text = dirDialog.SelectedPath
			print "Selected directory to import data:"+dirDialog.SelectedPath
예제 #15
0
 def browse(self, sender, event):
     dialog = FolderBrowserDialog()
     dialog.SelectedPath = os.environ["USERPROFILE"] + "\\"
     if (dialog.ShowDialog(self) == DialogResult.OK):
         self.KeyPath.Text = dialog.SelectedPath
예제 #16
0
def get_folder(prompt):
    dlg = FolderBrowserDialog()
    dlg.Description = prompt
    res = dlg.ShowDialog()
    if res == DialogResult.OK:
        return dlg.SelectedPath
예제 #17
0
#	TODO: get sud directory name (district sub-folder)
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)
예제 #18
0
 def opendirectory(self, sender, event):
     fbd = FolderBrowserDialog()
     dr = fbd.ShowDialog()
     if dr == DialogResult.OK:
         sender.Text = fbd.SelectedPath
예제 #19
0
파일: dialogs.py 프로젝트: baeyun/macron
def pickDirectory(config):
    dialog = FolderBrowserDialog()
    dialog.Title = config['title'] if 'title' in config else 'Pick folder'
    # dialog.InitialDirectory = config['initialDirectory'] if 'initialDirectory' in config else None # TODO FIXME
    pass
def windBrowser():
    # Create folder browser window
    dialog = FolderBrowserDialog()
    # Record for user action and store selected path
    if (dialog.ShowDialog() == DialogResult.OK):
        return dialog.SelectedPath
예제 #21
0
def getCustomToolPropertyContent():
    # Create a Grid
    my_Grid = WPFControls.Grid()

    # Add 2 Rows and 1 Column
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.ColumnDefinitions.Add(WPFControls.ColumnDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.ColumnDefinitions.Add(WPFControls.ColumnDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    #my_Grid.ColumnDefinitions.Add(WPFControls.ColumnDefinition())

    currRow = 0

    # Create input field
    currRow += 1
    lbl01 = WPFControls.TextBlock()
    lbl01.Text = "Region diam. (mm):"
    WPFControls.Grid.SetRow(lbl01, currRow)
    WPFControls.Grid.SetColumn(lbl01, 0)

    global input01
    input01 = WPFControls.TextBox()
    WPFControls.Grid.SetRow(input01, currRow)
    WPFControls.Grid.SetColumn(input01, 1)

    # Create checkbox to extend the weld bead
    currRow += 1
    global chkBox01
    chkBox01 = WPFControls.CheckBox()
    chkBox01.Content = "Calculate normal directions"
    chkBox01.Height = 20
    WPFControls.Grid.SetRow(chkBox01, currRow)
    WPFControls.Grid.SetColumn(chkBox01, 0)
    chkBox01.IsChecked = System.Nullable[System.Boolean](True)
    #WPFControls.Grid.SetColumnSpan(chkBox01, 2)

    # Create a button
    currRow += 2
    goButton = WPFControls.Button()
    goButton.Content = "Get trajectory from selected edge"
    WPFControls.Grid.SetRow(goButton, currRow)
    WPFControls.Grid.SetColumn(goButton, 0)
    goButton.Height = 30
    WPFControls.Grid.SetColumnSpan(goButton, 2)

    # Link a function to the Button "Click" event
    # This function will be called every time the Button is clicked
    goButton.Click += HandleApplyButton

    global dialog
    dialog = FolderBrowserDialog()
    dialog.Description = "Directory where to save trajectories"
    dialog.ShowNewFolderButton = True

    #my_Grid.Children.Add(lbl01)
    #my_Grid.Children.Add(input01)
    my_Grid.Children.Add(chkBox01)

    my_Grid.Children.Add(goButton)

    # Return the Grid
    return my_Grid