当前位置: 首页>>代码示例>>Python>>正文


Python GenericDialog.getNextRadioButton方法代码示例

本文整理汇总了Python中ij.gui.GenericDialog.getNextRadioButton方法的典型用法代码示例。如果您正苦于以下问题:Python GenericDialog.getNextRadioButton方法的具体用法?Python GenericDialog.getNextRadioButton怎么用?Python GenericDialog.getNextRadioButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ij.gui.GenericDialog的用法示例。


在下文中一共展示了GenericDialog.getNextRadioButton方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: uScopeCalDialog

# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import getNextRadioButton [as 别名]
def uScopeCalDialog(cal):
    ''' Pop up a dialog asking user to choose from the calibration names etc.
    
    CalIdx, SetGlobalScale, AddScaleBar = uScopeCalDialog(cal)
    
    `cal` should be the object containing `names`, `cals`, `units` attributes
    as set in the "user_settings.py" file.
    
    `CalIdx` is the list index to the chosen calibration.  
        Eg., if the options were 
            ['5x', '10x', '20x']
        and the user chose '10x', then 
            CalIdx = 1
        Returns `None` if the user cancelled the dialog.
    
    `SetGlobalScale` is a boolean (True/False) from a checkbox option, if the user wants this calibration set 'globally' to all open images.
    
    `AddScaleBar` is also a boolean (True/False), for a checkbox option, if user would like to run "Scale Bar..." afterwards.
    '''
    
    # The following inspired heavily by Correct_3D_drift.py:
    
    #print "uScopeCalDialog():"
    #print cal.names, [str(x) for x in cal.cals]
    
    gd = GenericDialog("Microscope Calibrations")
    gd.addMessage("Choose the calibration to load:")
    
    
    # generate text to display in list:
    # Radio Buttons:
    CalStr = []
    CalType_IsFunc = []
    
    
    for ii, name in enumerate(cal.names):
        if mc_DEBUG: print( "item #%i: name=" % (ii), name, "\n\t type=", type(name)  )
        if isinstance(name, basestring):
            '''It's just a regular calibration setting'''
            CalStr.append(  name + "      (%s"%cal.cals[ii] + " pixels/%s)"%cal.units[ii]  )
        else:
            ''' Assume we'll be loading a custom function/class '''
            CalStr.append(  name.name  )    # get the name from the Class' .name attribute
        #end if(str)
    #end for(cal.names)

    
    '''if > 20 cals, use dropdown list, otherwise use radio buttons'''
    if len(cal.names) > 20:
        Radio=False
        # Drop-Down list:
        gd.addChoice("     Calibration:", CalStr, CalStr[0]   )   # default = 1st (#0)
    
    else:
        Radio=True
        gd.addRadioButtonGroup("     Calibration:", CalStr, len(CalStr), 1, CalStr[0])
        #addRadioButtonGroup(label, [String items],  rows,  columns,  String:defaultItem)
    #end if(cal>20)
    
    gd.addCheckbox("Apply Scale to all open images?", False)
    gd.addCheckbox("Add Scale Bar to this image?", False)
    gd.addMessage("These calibrations can be altered by editing the file: \nFiji.app/plugins/Scripts/Plugins/Analyze/...\n\tMicroscope Measurement Tools/...\n\tMicroscope_Calibrations_user_settings.py")
    
    gd.showDialog()
    
    
    if gd.wasCanceled():
        return  None, None, None  # return None's if user cancels
    
    if Radio:
        ChosenCal = gd.getNextRadioButton()
        # Find the index to the chosen radio button w/ [list].index():
        CalIdx = CalStr.index(  ChosenCal )
    else:
        ChosenCal = gd.getNextChoiceIndex()
        CalIdx = ChosenCal  # the index to the choice
    
    SetGlobalScale = gd.getNextBoolean()
    AddScaleBar = gd.getNextBoolean()
    
    
    
    #if mc_DEBUG: print( ChosenCal,CalIdx, SetGlobalScale )
    #if mc_DEBUG: print( "end uScopeCalDialog()." )
    return CalIdx, SetGlobalScale, AddScaleBar
开发者ID:demisjohn,项目名称:Microscope-Measurement-Tools,代码行数:87,代码来源:Choose_Microscope_Calibration.py


注:本文中的ij.gui.GenericDialog.getNextRadioButton方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。