def getOptions():

    pixels = zeros('f', 4)  # 4 elements

    # First Dialog Box
    item = [
        "coralline", "tunicate", "red", "macro", "background", "more than one"
    ]
    gd = GenericDialog("Options")
    gd.addRadioButtonGroup("options", item, 3, 2, "coralline")
    gd.showDialog()
    button = gd.getNextRadioButton()

    # Second Dialog Box
    gd2 = GenericDialog("Multiple Options")
    items = ["coralline", "tunicate", "red", "macro", "garbage"]
    defaultVal = [False] * 5
    gd2.addCheckboxGroup(2, 3, items, defaultVal)
    gd2.addNumericField("coralline %", 0, 0)
    gd2.addNumericField("tunicate %", 0, 0)
    gd2.addNumericField("red %", 0, 0)
    gd2.addNumericField("macro %", 0, 0)
    gd2.addNumericField("background %", 0, 0)

    if gd.wasCanceled():
        return 0

    if button == "coralline":
        pixels[0] = 1
    elif button == "tunicate":
        pixels[1] = 1
    elif button == "red":
        pixels[2] = 1
    elif button == "macro":
        pixels[3] = 1
    elif button == "more than one":
        gd2.showDialog()
        checklist = gd2.getCheckboxes()
        pixels[0] = int(
            checklist[0].state) * (float(gd2.getNextNumber()) / 100)
        pixels[1] = int(
            checklist[1].state) * (float(gd2.getNextNumber()) / 100)
        pixels[2] = int(
            checklist[2].state) * (float(gd2.getNextNumber()) / 100)
        pixels[3] = int(
            checklist[3].state) * (float(gd2.getNextNumber()) / 100)

    return pixels
Пример #2
0
    def openNext(self):
        """
        Opens the next image.

        Arguments:
        - thumbNails : bool, if True a thumbnail for th
          image is written when the image is opened
        """
        self.openImage.close()
        # Set the current number being examined
        self.n = self.n + 1
        try:
            self.currentCoordinate = self.gridCoords[ self.n ]
        except IndexError:
            gd = GenericDialog("")
            gd.addMessage("No more images")
            gd.showDialog()
            return None
        plateID, row, col, x, y = self.currentCoordinate
        # open the file
        grid = self.grids[ plateID ]
        self.openImage = grid.openSubImage(x,y)
        self.setMinAndMax()
        self.openImage.show()
        # Write the thumbnail
        self.writeThumbnail()
        # Try to return the information about the current score
        # if it doesn't exist, return an empty string. This
        # is used to display the score associated with the image
        try:
            return self.scores[ self.currentCoordinate ][7]
        except KeyError:
            return ""
def getOptions(imp):
  gd = GenericDialog("Correct 3D Drift Options")
  channels = []
  for ch in range(1, imp.getNChannels()+1 ):
    channels.append(str(ch))
  methods = ["phase_correlation","center_of_mass"]
  gd.addChoice("Channel for registration:", channels, channels[0])
  gd.addChoice("Method for registration:", methods, methods[1])
  gd.addNumericField("Background value:", 0, 0)
  gd.addCheckbox("Multi_time_scale computation for enhanced detection of slow drifts?", False)
  gd.addCheckbox("Sub_pixel drift correction (possibly needed for slow drifts)?", False)
  gd.addCheckbox("Edge_enhance images for possibly improved drift detection?", False)
  gd.addCheckbox("Use virtualstack for saving the results to disk to save RAM?", False)
  gd.addCheckbox("Drift correct only data inside ROI?", False)
  gd.addCheckbox("Only compute drift vectors?", False)
  gd.addMessage("If you put a ROI, drift will only be computed in this region;\n the ROI will be moved along with the drift to follow your structure of interest.")
  gd.addSlider("z_min of ROI", 1, imp.getNSlices(), 1)
  gd.addSlider("z_max of ROI", 1, imp.getNSlices(), imp.getNSlices())
  gd.showDialog()
  if gd.wasCanceled():
    return
  channel = gd.getNextChoiceIndex() + 1  # zero-based
  method = gd.getNextChoiceIndex() + 1  # zero-based
  bg_value = gd.getNextNumber()
  multi_time_scale = gd.getNextBoolean()
  subpixel = gd.getNextBoolean()
  process = gd.getNextBoolean()
  virtual = gd.getNextBoolean()
  only_roi = gd.getNextBoolean()
  only_compute = gd.getNextBoolean()
  roi_z_min = int(gd.getNextNumber())
  roi_z_max = int(gd.getNextNumber())
  return channel, method, bg_value, virtual, multi_time_scale, subpixel, process, only_roi, only_compute, roi_z_min, roi_z_max
Пример #4
0
    def setupDialog(imp):

        gd = GenericDialog("Toolbox options")
        gd.addMessage("Imagej toolbox, you are analyzing: " + imp.getTitle())
        calibration = imp.getCalibration()

        if (calibration.frameInterval > 0):
            default_interval = calibration.frameInterval
            default_timeunit = calibration.getTimeUnit()

        else:
            default_interval = 10
            default_timeunit = "sec"

        gd.addNumericField("Frame interval:", default_interval,
                           2)  # show 2 decimals
        #    gd.addCheckbox("Do you want to use a gliding window?", True)
        #    gd.addCheckbox("Project hyperStack? (defaluts to projecting current channel only)", False)
        #    gd.addStringField("time unit",default_timeunit, 3)
        #    gd.addSlider("Start compacting at frame:", 1, imp.getNFrames(), 1)
        #    gd.addSlider("Stop compacting at frame:", 1, imp.getNFrames(), imp.getNFrames())
        #    gd.addNumericField("Number of frames to project in to one:", 3, 0)  # show 0 decimals

        gd.addChoice('Method to use for stack background filtering:',
                     methods_as_strings, methods_as_strings[5])

        gd.showDialog()

        if gd.wasCanceled():
            IJ.log("User canceled dialog!")
            return

        return gd
Пример #5
0
def getChannels(subFolder):
    gd = GenericDialog("Channel Options")

    gd.addMessage("Name the markers associated with these subfolder:")
    gd.addMessage(subFolder)
    gd.addMessage("(Leave empty to ignore)")
    gd.addMessage("")
    gd.addStringField("Channel d0:", "Dapi")
    gd.addStringField("Channel d1:", "Tuj1")
    gd.addStringField("Channel d2:", "GFAP")
    gd.addStringField("Channel d3:", "syn")
    gd.addMessage("")

    gd.showDialog()

    channelNames = []

    channelNames.append([gd.getNextString(), 0])
    channelNames.append([gd.getNextString(), 1])
    channelNames.append([gd.getNextString(), 2])
    channelNames.append([gd.getNextString(), 3])

    channels = []
    for i, v in enumerate(channelNames):
        if v[0] != "":
            channels.append(v)

    if gd.wasCanceled():
        print "User canceled dialog!"
        return

    return channels
Пример #6
0
def getSettings(img):
    """This function assesses (by returning a boolean value) if the filter can
    be applied to the image passed as argument. Will ask the user for new values
    if current parameters are undefined."""
    global xradius, yradius, zradius
    canProceed = True

    if not img:
        IJ.error("No images open.")
        print ">>>> No image to work with!"
        canProceed = False

    # Get new values if at least one of the parameters is 'null'
    if canProceed and None in (xradius, yradius, zradius):
        gd = GenericDialog("Median Filter")
        gd.addNumericField("X radius:", 2.0, 1)
        gd.addNumericField("Y radius:", 2.0, 1)
        gd.addNumericField("Z radius:", 2.0, 1)
        gd.showDialog()
        if gd.wasCanceled():
            print ">>>> User canceled dialog!"
            canProceed = False
        else:
            xradius = gd.getNextNumber()
            yradius = gd.getNextNumber()
            zradius = gd.getNextNumber()

    return canProceed
Пример #7
0
def getChannels(subFolder):
    gd = GenericDialog("Channel Options")

    gd.addMessage("Name the markers associated with this directory:")
    gd.addMessage(inputDirectory + subFolder)
    gd.addMessage("(Leave empty to ignore)")
    gd.addMessage("")
    gd.addStringField("Channel ch00:", "Dapi")
    gd.addStringField("Channel ch01:", "pSYN")
    gd.addStringField("Channel ch02:", "MAP2")
    gd.addStringField("Channel ch03:", "SYN")
    gd.addMessage("")
    gd.addStringField("What would you like the output file to be named:",
                      "output")

    gd.showDialog()

    channelNames = []

    channelNames.append([gd.getNextString(), 0])
    channelNames.append([gd.getNextString(), 1])
    channelNames.append([gd.getNextString(), 2])
    channelNames.append([gd.getNextString(), 3])
    outputName = gd.getNextString()

    channels = []
    for i, v in enumerate(channelNames):
        if v[0] != "":
            channels.append(v)

    if gd.wasCanceled():
        print "User canceled dialog!"
        return

    return channels, outputName
def canceled():
    gd = GenericDialog("Caution")
    gd.addMessage('Tiff file(s) already exists in {}.\n \
    The file may be replaced by this macro run. Do you wish to continue?'.
                  format(save_dir))
    gd.showDialog()
    return gd.wasCanceled()
Пример #9
0
def start_masking_menu():

    wlist = WindowManager.getImageTitles()
    gd = GenericDialog('Masking - Setup')
    gd.setCancelLabel('Exit')

    gd.addChoice('Create mask from', wlist, wlist[0])
    gd.addNumericField("Gaussian blur:", 0, 1)
    gd.addNumericField("Fixed threshold:", 0, 0)
    gd.addCheckbox('Use automatic thresholding', False)
    gd.addChoice('Method', ['Default', 'Huang', 'Otsu', 'Yen'], 'Default')

    gd.showDialog()

    if gd.wasCanceled():
        return False

    pdic = {}

    pdic['sel_win'] = gd.getNextChoice()
    pdic['sigma'] = gd.getNextNumber()
    pdic['threshold'] = gd.getNextNumber()
    pdic['use_auto'] = gd.getNextBoolean()
    pdic['thresh_method'] = gd.getNextChoice()

    return pdic
def showDialogR(R, val):
    """ Create dialog for input and save R values in settings
	"""
    gui = GenericDialog("Heterogeneous Z Correction")
    msg = "Heterogeneous Z Correction calculates an optical model\n"\
       "based on rational fluorescence intensity attenuation\n"\
       "over depth, in the form of (ax+b)/(x+c). Please specify\n"\
       "(a,b,c) for each region. You should provide a z-stack with\n"\
       "unique pixel values for each region.\n"
    gui.addMessage(msg)
    for ii in range(len(val)):
        gui.addNumericField(
            "Region " + str(ii) + " (" + str(val[ii]) + "):   a", R[ii][0], 2)
        gui.addToSameRow()
        gui.addNumericField("b", R[ii][1], 2)
        gui.addToSameRow()
        gui.addNumericField("c", R[ii][2], 2)
    gui.addHelp(
        r"https://github.com/alexandrebastien/heterogeneous-z-correction")
    gui.showDialog()
    if gui.wasOKed():
        R = []
        for ii in range(len(val)):
            R = R + [
                (gui.getNextNumber(), gui.getNextNumber(), gui.getNextNumber())
            ]
        Prefs.set("HetZCorr.R", str(R))
        return R
    else:
        return
	def showOptionsDialog(self):
		gd = GenericDialog("my cool tool options")
		gd.addNumericField("min. size: ", self.minSize)
		gd.showDialog()
		if gd.wasCanceled():
			return None
		self.minSize = gd.getNextNumber()
Пример #12
0
def split_and_save(imp):
	base_title = imp.getShortTitle()
	base_dir = imp.getOriginalFileInfo().directory
	
	d = GenericDialog("Split Stacks")
	d.addMessage("Indicate the channels in your image stack, separated by commas")
	d.addMessage("Add the channels *in the order that you took the images*")
	d.addMessage("For example, \"TL, 410, 470, 410, 470\"")
	d.addStringField("Channels", "TL, 470, 410", 40)
	d.showDialog()
	# exit if cancelled
	if d.wasCanceled():
		return None
	
	channels = number_duplicate_channels([x.strip() for x in d.getNextString().split(',')])
	
	# Check that the number of images in stack is divisible by the number of channels
	# If not, quit. Else keep going
	if (imp.getNSlices() % len(channels) != 0):
		IJ.error("Invalid Channel Specification", "The number of slices (%d) is not divisible by the number of channels (%d). Exiting." % (imp.getNSlices(), len(channels)))
		return None
	imp.show()
	IJ.run("Deinterleave", "how=%d" % len(channels))

	for i, img_id in enumerate(WindowManager.getIDList()):
		channel_i = WindowManager.getImage(img_id)
		channel_i.setTitle(base_title + "_" + channels[i])
		IJ.saveAs(channel_i, "tif", base_dir + channel_i.getTitle())
	IJ.showMessage("Saved image stacks as separate channels in %s" % base_dir)
Пример #13
0
def getOptions():
    global listener, xlist, ylist, zlist, manager
    gd = GenericDialog("Target Selection")
    gd.addChoice('type', ['point', 'circle', 'spiral'], 'point')
    gd.addNumericField("                power (%)", 85, 0)
    gd.addNumericField("                duration (ms)", 1, 0)
    gd.addNumericField("                radius(circle/spiral)", 5, 0)
    gd.addNumericField("                # revolutions (circle/spiral)", 3, 0)
    gd.addNumericField(
        "                add CAMERA_TRIGGER after every (entries)", 1, 0)
    gd.addNumericField("                Prewait between entries (ms)", 5000, 0)
    gd.addNumericField("                Z-start of stack (um)", 0, 0)
    gd.addNumericField("                Z-step of stack (um)", 5, 0)
    gd.addMessage('Press ENTER to save\n')
    gd.addMessage('Press ESC to restart\n')
    gd.showDialog()
    profileType = gd.getNextChoice()
    power = gd.getNextNumber()
    duration = gd.getNextNumber()
    r = gd.getNextNumber()
    Nturns = gd.getNextNumber()
    camTriggerEvery = gd.getNextNumber()
    prewait = gd.getNextNumber()
    zStart = gd.getNextNumber()
    zStep = gd.getNextNumber()
    if gd.wasCanceled():
        IJ.setTool(Toolbar.RECTANGLE)
        return
    else:
        return r, power, profileType, duration, Nturns, camTriggerEvery, zStart, zStep, prewait
def scaleImageUI():  
	gd = GenericDialog("Scale")  
	gd.addSlider("Scale", 1, 200, 100)  
	gd.addCheckbox("Preview", True)  
	# The UI elements for the above two inputs  
	slider = gd.getSliders().get(0) # the only one  
	checkbox = gd.getCheckboxes().get(0) # the only one  
	
	imp = WM.getCurrentImage()  
	if not imp:  
		print "Open an image first!"  
		return  
	
	previewer = ScalingPreviewer(imp, slider, checkbox)  
	slider.addAdjustmentListener(previewer)  
	checkbox.addItemListener(previewer)  
		
	gd.showDialog()  
	
	if gd.wasCanceled():  
		previewer.reset()  
		print "User canceled dialog!"  
	else:  
		previewer.scale()  
	
	previewer.destroy()  
Пример #15
0
def user_input():
	""" Takes user input on experiment parameters and stimulation applications... """
	
	User_Input_List = []
	Stim_List = []
	
	# Creates dialog boxes proportionally to number of stimulations, type and duration. 
  	if Stim_num >= 1:
  		gd = GenericDialog("Stimulation applications")
  		for stim in range(0, Stim_num, 1):
  			gd.addStringField("Stimulation type "+str(stim+1)+":", "cLTP")
  			gd.addNumericField("Stimulation start:", stim*2, 2)
  			gd.addNumericField("Stimulation end:", (stim+1)*2, 2)
  		
  		gd.showDialog()

  	# Lists the different stimulations.
	for stim in range(0, Stim_num, 1):
		Type_Stim = gd.getNextString()
  		Start_Stim = gd.getNextNumber()
  		End_Stim = gd.getNextNumber()
  		Stim_List.append([Type_Stim, float(Start_Stim), float(End_Stim)])

	User_Input_List.extend(Stim_List)
	
	# Creates a dictionary of all user inputs.
	User_Input_Dict = {'Parameters': User_Input_List[0]}
	for stim in range(1, Stim_num, 1):
		User_Input_Dict['Stimulation '+str(stim)] = User_Input_List[stim]

	# Dumps dict to JSON.	
	User_Input_Dict_JSON = (json.dumps(User_Input_Dict))	
	return User_Input_Dict, User_Input_Dict_JSON, Stim_List
Пример #16
0
def getOptions(imp):
  gd = GenericDialog("Correct 2D/3D Drift Options")
  channels = []
  for ch in range(1, imp.getNChannels()+1 ):
    channels.append(str(ch))
  gd.addChoice("Channel for registration:", channels, channels[0])
  gd.addCheckbox("Correct only x & y (for 3D data):", False)
  gd.addCheckbox("Multi_time_scale computation for enhanced detection of slow drifts?", False)
  gd.addCheckbox("Sub_pixel drift correction (possibly needed for slow drifts)?", False)
  gd.addCheckbox("Edge_enhance images for possibly improved drift detection?", False)
  gd.addNumericField("Only consider pixels with values larger than:", 0, 0)
  gd.addNumericField("Lowest z plane to take into account:", 1, 0)
  gd.addNumericField("Highest z plane to take into account:", imp.getNSlices(), 0)
  gd.addCheckbox("Use virtualstack for saving the results to disk to save RAM?", False)
  gd.addCheckbox("Only compute drift vectors?", False)
  gd.addMessage("If you put a ROI, drift will only be computed in this region;\n the ROI will be moved along with the drift to follow your structure of interest.")
  gd.showDialog()
  if gd.wasCanceled():
    return
  channel = gd.getNextChoiceIndex() + 1  # zero-based
  correct_only_xy = gd.getNextBoolean()
  multi_time_scale = gd.getNextBoolean()
  subpixel = gd.getNextBoolean()
  process = gd.getNextBoolean()
  background = gd.getNextNumber()
  z_min = gd.getNextNumber()
  z_max = gd.getNextNumber()
  virtual = gd.getNextBoolean()
  only_compute = gd.getNextBoolean()
  return channel, virtual, multi_time_scale, subpixel, process, background, z_min, z_max, only_compute, correct_only_xy
Пример #17
0
def getOK(text):
	gd = GenericDialog('User prompt')
	gd.addMessage(text)
	gd.hideCancelButton()
	gd.enableYesNoCancel()
	gd.showDialog()
	return gd.wasOKed()
def get_info():
    srcDir = IJ.getDirectory("Input_Directory")
    if not srcDir:
        print("No input directory selected")
        return
    dstDir = IJ.getDirectory("Output_Directory")
    if not dstDir:
        print("No output directory selected")
        return
    gd = GenericDialog("Process Folder")
    gd.addStringField("File_extension", ".lif")
    gd.addStringField("File_name_contains", "")
    gd.addCheckbox("Keep directory structure when saving", True)
    gd.showDialog()
    if gd.wasCanceled():
        return
    ext = gd.getNextString()
    containString = gd.getNextString()
    keepDirectories = gd.getNextBoolean()
    for root, directories, filenames in os.walk(srcDir):
        for filename in filenames:
            # Check for file extension
            if not filename.endswith(ext):
                continue

# Check for file name pattern
            if containString not in filename:
                continue
            print(srcDir)
            print(filename)
            process(srcDir, dstDir, root, filename, keepDirectories)
Пример #19
0
def getOptions():
    gd = GenericDialog("Options")
    gd.addCheckbox("Process_Right_Camera?", True)
    gd.addCheckbox("Process_Left_Camera?", True)
    gd.addNumericField("CamRScale: ", 214, 0)
    gd.addNumericField("CamLScale: ", 202, 0)
    gd.addNumericField("BackgroundWindowStart: ", 0, 0)
    gd.addNumericField("BackgroundWindowEnd: ", 600, 0)
    gd.addNumericField("GridSize: ", 10000, 0)
    gd.addNumericField("TranslateR: ", 0, 0)
    gd.addNumericField("TranslateL: ", 0, 0)
    gd.showDialog()
    #
    if gd.wasCanceled():
        print "User canceled dialog!"
        return
    # Read out the options
    runCamR = gd.getNextBoolean()
    runCamL = gd.getNextBoolean()
    CamRScale = gd.getNextNumber()
    CamLScale = gd.getNextNumber()
    BackgroundWindowStart = gd.getNextNumber()
    BackgroundWindowEnd = gd.getNextNumber()
    GridSize = gd.getNextNumber()
    TranslateR = gd.getNextNumber()
    TranslateL = gd.getNextNumber()
    return runCamR, runCamL, CamRScale, CamLScale, BackgroundWindowStart, BackgroundWindowEnd, GridSize, TranslateR, TranslateL  # a tuple with the parameters
Пример #20
0
def getName(text, defaultName = ''):
	gd = GenericDialog(text)
	gd.addStringField(text, defaultName)
	gd.showDialog()
	if gd.wasCanceled():
		print 'User canceled dialog!'
		return
	return gd.getNextString()
Пример #21
0
def getRefChannel(channels, text = 'Reference Channel'): #dialog prompt to choose the reference channel
	gd = GenericDialog(text)
	gd.addChoice("output as", channels, channels[0])
	gd.showDialog()
	if gd.wasCanceled():
		print "User canceled dialog!"
		return
	return gd.getNextChoice()
Пример #22
0
def run():
    ''' If someone tries to run this file by itself, warn them of their error.  Unfortunately, since I was too lazy to make Microscope_Calibrations a full plugin (rather than a script), this accompanying settings file will show up in the Scripts menu.'''
    from ij.gui import GenericDialog
    
    gd = GenericDialog("Microscope_Calibrations_user_settings.py")
    gd.addMessage("This file is only for adding functionality to the plugin 'Microscope Measurement Tools'.\nNothing is done when this settings file is run by itself."  )
    
    gd.showDialog()
Пример #23
0
def getNumber(text, default = 0, decimals = 3):
	gd = GenericDialog(text)
	gd.addNumericField(text, default, decimals)  # show 6 decimals
	gd.showDialog()
	if gd.wasCanceled():
		IJ.log('User canceled dialog!')
		return
	return gd.getNextNumber()
def getPixel(
):  # Get pixel size from user with dialog box. could return python dict or make custom class? Note user can return a NaN if doesnt enter numeric
    gd = GenericDialog("Pixel")
    gd.addNumericField("Pixel size desired (mm)", 6.4,
                       1)  # default is 1 decimal
    gd.showDialog()
    Pixel_size = gd.getNextNumber(
    )  #6.4 # ENTER mm, remember tolerance is +/-30%
    return Pixel_size
Пример #25
0
def run():
    srcDir = IJ.getDirectory("Input_directory")
    if not srcDir:
        return
    gd = GenericDialog("Do you want to run the image correction now?")
    gd.showDialog()
    if gd.wasCanceled():
        return
    find_folders(srcDir)
Пример #26
0
def choose_analysis_mode(params):
    """present UI for choosing how cells should be identified"""
    dialog = GenericDialog("Analysis methods")
    dialog.addMessage("Please choose how cell shape anlaysis should proceed:")
    dialog.addChoice("Analysis mode", params.list_analysis_modes(),
                     params.last_analysis_mode)
    dialog.showDialog()
    if dialog.wasCanceled():
        raise KeyboardInterrupt("Run canceled")
    return dialog.getNextChoice()
Пример #27
0
 def showTable(self):
     """
     Create the GUI and show it.  For thread safety,
     self method should be invoked from the
     event-dispatching thread.
     """
     gd = GenericDialog("Roi-group table")
     gd.addPanel(
         self
     )  # Add current table instance (a subclass of Panel to gd panel)
     gd.showDialog()
Пример #28
0
def run():
    ''' If someone tries to run this file by itself, warn them of their error.  Unfortunately, since I was too lazy to make Microscope_Calibrations a full plugin (rather than a script), this accompanying settings file will show up in the Scripts menu.'''
    from ij.gui import GenericDialog

    gd = GenericDialog("Microscope_Calibrations_user_settings.py")
    gd.addMessage("This file is only for setting the microscope calibrations and settings for the plugins 'Microscope Measurement Tools'.\nNothing is done when this settings file is run by itself.\nPlease open this file in a text editor instead, to edit the calibrations.\n  \n"  +  \
    "The file should reside in a path like the following\n"  +  \
    "Fiji.app/plugins/Scripts/Analyze/Microscope Measurement Tools/Microscope_Calibrations_user_settings.py\n  "  +  "\n" +  \
    "Changes to the settings file are not automatically picked up by Fiji.  The workaround is to\n  1) Quit Fiji.\n  2) Delete the '$py.class' file 'Microscope_Calibrations_user_settings$py.class'\n  3) Open Fiji.  Make sure the new settings show up in 'Choose Microscope Calibration'."  )

    gd.showDialog()
def get_metadata_table_filepath():
    """Get a the metadata template filename"""
    d = GenericDialog("Metadata Template")
    d.addMessage("Please choose a metadata template")
    d.enableYesNoCancel("OK", "Cancel")
    d.hideCancelButton()
    d.showDialog()
    if d.wasOKed():
        od = OpenDialog("Metadata File")
        return os.path.join(od.getDirectory(), od.getFileName())
    else:
        return
Пример #30
0
def check_dependencies():
    installed_plugins = os.listdir(Menus.getPlugInsPath())
    for dependency, site in _dependencies.iteritems():
        if not any(dependency in x for x in installed_plugins):
            msg = GenericDialog("Missing dependency")
            msg.addMessage(
                "Missing dependency {}, \n go to {} for installation instructions. "
                .format(dependency, site))
            msg.showDialog()
            raise RuntimeError(
                "Missing dependency {}, \n go to {} for installation instructions. "
                .format(dependency, site))