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


Python vanilla.PopUpButton方法代码示例

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


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

示例1: __init__

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import PopUpButton [as 别名]
def __init__( self ):
		windowWidth  = 400
		windowHeight = 280
		self.w = vanilla.FloatingWindow(
			( windowWidth, windowHeight ), # default window size
			"ALL YOUR @BASE BELONG TO US.", # window title
			autosaveName = "com.Tosche.BatchMetricKey.mainwindow" # stores last window position and size
		)

		# UI elements:
		self.w.presetText = vanilla.TextBox( ( 12, 13, 55, 17), "Presets:", sizeStyle='regular' )
		self.w.presetPopup = vanilla.PopUpButton( (14+58, 13, -15, 17), [str(x) for x in presets], callback=self.setField, sizeStyle='regular' )
		self.w.keyTextField = vanilla.EditText( (14, 45, -15, 22), re.sub(" .*", "", presets[0]), sizeStyle = 'regular')
		self.w.setToText = vanilla.TextBox( ( 12, 78, 50, 17), "Set to:", sizeStyle='regular' )
		self.w.applyL = vanilla.CheckBox( ( 12+50, 78, 50, 22), "Left", value=True, sizeStyle='regular')
		self.w.applyR = vanilla.CheckBox( ( 12+50+50, 78, 56, 22), "Right", value=True, sizeStyle='regular')
		self.w.avoidNest = vanilla.CheckBox( ( 275, 78, 115, 22), "Adoid Nesting", value=True, sizeStyle='regular')
		self.w.radioQText = vanilla.TextBox( ( 12, 115, 100, 17), "If there is Q:", sizeStyle='regular' )
		self.w.radioQ = vanilla.RadioGroup( (100, 115, 350, 19), ["Use width of O (no key)", "Use RSB of Q"], sizeStyle='regular', isVertical=False)
		self.w.radioQ.set(0)
		self.w.line = vanilla.HorizontalLine((12, 190, -10, 1))
		self.w.explain = vanilla.TextBox( ( 12, 200, 350, 80), "@base is a glyph without suffix of the selected glyph.\n@base of hsuperior is h\n@Base of a.smcp is A\n@base.smcp of one.numr is one.smcp", sizeStyle='regular' )
		# Run Button:
		self.w.setButton = vanilla.Button((290, 145, 90, 34), "Set", sizeStyle='regular', callback=self.BatchMetricKeyMain )
		self.w.setDefaultButton( self.w.setButton )
		
		# Open window and focus on it:
		self.w.open()
		self.w.makeKey() 
开发者ID:Tosche,项目名称:Glyphs-Scripts,代码行数:31,代码来源:Batch Metric Keys.py

示例2: __init__

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import PopUpButton [as 别名]
def __init__( self ):
		# Window 'self.w':
		editX = 180
		editY = 22
		textY  = 17
		spaceX = 10
		spaceY = 10
		windowWidth  = spaceX*3+editX*2+85
		windowHeight = 150

		self.w = vanilla.FloatingWindow(
			( windowWidth, windowHeight ), # default window size
			"Rename Kerning Groups", # window title
			minSize = ( windowWidth, windowHeight ), # minimum size (for resizing)
			maxSize = ( windowWidth + 100, windowHeight ), # maximum size (for resizing)
			autosaveName = "com.Tosche.RenameKerningGroups.mainwindow" # stores last window position and size
		)
		
		# UI elements:
		self.w.radio = vanilla.RadioGroup( (spaceX+130, spaceY, 120, textY), ["Left", "Right"], isVertical = False, sizeStyle='regular', callback=self.switchList)
		self.w.radio.set(0)
		self.w.text1 = vanilla.TextBox( (spaceX, spaceY*2+textY, 120, textY), "Rename this Group", sizeStyle='regular' )
		self.w.text2 = vanilla.TextBox( (spaceX, spaceY*3+editY+textY, 120, textY), "to this", sizeStyle='regular' )
		self.w.popup = vanilla.PopUpButton( (spaceX+130, spaceY*2+textY, -15, editY), [str(x) for x in sorted(groupsL)], sizeStyle='regular' )
		self.w.newName = vanilla.EditText( (spaceX+130, spaceY*3+editY+textY, -15, editY), "", sizeStyle = 'regular' )
		# Run Button:
		self.w.runButton = vanilla.Button((-80-15, spaceY*4+editY*3, -15, -15), "Run", sizeStyle='regular', callback=self.RenameKerningGroupsMain )
		self.w.setDefaultButton( self.w.runButton )
		# Open window and focus on it:
		self.w.open()
		self.w.makeKey() 
开发者ID:Tosche,项目名称:Glyphs-Scripts,代码行数:33,代码来源:Rename Kerning Groups.py

示例3: _buildGlyphTestTabs

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import PopUpButton [as 别名]
def _buildGlyphTestTabs(controller, viewTop):
    groupTitles = ["Glyph Tests", "Metrics Tests", "Contour Tests", "Segment Tests", "Point Tests", "Component Tests"]
    controller.w.testStateBox = vanilla.Box((15, viewTop + 10, -15, 210))
    tabs = controller.w.testStateBox.testStateTabs = vanilla.Tabs((0, 5, 0, 0), groupTitles, showTabs=False)
    groups = [
        ("glyph", tabs[0]),
        ("metrics", tabs[1]),
        ("contour", tabs[2]),
        ("segment", tabs[3]),
        ("point", tabs[4]),
        ("components", tabs[5]),
    ]
    for group, tab in groups:
        top = 15
        for identifier in reportOrder:
           for testIdentifier, testData in testRegistry.items():
               if testIdentifier != identifier:
                   continue
               if testData["level"] != group:
                   continue
               state = defaults.getValue(defaultKeyTestStates)[identifier]
               control = vanilla.CheckBox((15, top, -15, 22), testData["title"], value=state, callback=controller.testStateCheckBoxCallback)
               top += 25
               controller.testStateControlToIdentifier[control] = identifier
               setattr(tab, "testStateCheckBox_" + identifier, control)
    controller.w.testStateTabSelector = vanilla.PopUpButton((72, viewTop, 120, 20), groupTitles, callback=controller.testStateTabSelectorCallback)


# --------------
# Prefs Shortcut
# -------------- 
开发者ID:typesupply,项目名称:glyph-nanny,代码行数:33,代码来源:glyphNanny.py

示例4: _combobox

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import PopUpButton [as 别名]
def _combobox(self, attr, vals):
        setattr(self.w, attr, vanilla.PopUpButton((14, self.leading, 300, 20), vals))
        self.leading += 20 
开发者ID:m4rc1e,项目名称:mf-glyphs-scripts,代码行数:5,代码来源:wrappers.py

示例5: __init__

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import PopUpButton [as 别名]
def __init__( self ):
		# Window 'self.w':
		windowWidth  = 280
		windowHeight = 155
		windowWidthResize  = 120 # user can resize width by this value
		windowHeightResize = 0   # user can resize height by this value
		self.w = vanilla.FloatingWindow(
			( windowWidth, windowHeight ), # default window size
			"Copy layer to layer", # window title
			minSize = ( windowWidth, windowHeight ), # minimum size (for resizing)
			maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing)
			autosaveName = "com.mekkablue.MasterFiller.mainwindow" # stores last window position and size
		)

		self.w.text_1 = vanilla.TextBox((15, 12+2, 120, 14), "Copy paths from", sizeStyle='small')
		self.w.master_from = vanilla.PopUpButton((120, 12, -15, 17), self.GetMasterNames(1), sizeStyle='small', callback=self.MasterChangeCallback)

		# self.w.text_2 = vanilla.TextBox((15, 32+2, 120, 14), "into selection of", sizeStyle='small')
		# self.w.master_into = vanilla.PopUpButton((120, 32, -15, 17), self.GetMasterNames(), sizeStyle='small', callback=self.MasterChangeCallback)

		self.w.include_components = vanilla.CheckBox((15, 52+2, -100, 20), "Include components", sizeStyle='small', callback=self.SavePreferences, value=True)
		self.w.include_anchors = vanilla.CheckBox((15, 52+20, -100, 20), "Include anchors", sizeStyle='small', callback=self.SavePreferences, value=True)
		self.w.include_metrics = vanilla.CheckBox((15, 52+38, -100, 20), "Include metrics", sizeStyle='small', callback=self.SavePreferences, value=True)
		self.w.keep_window_open = vanilla.CheckBox((15, 52+56, -100, 20), "Keep window open", sizeStyle='small', callback=self.SavePreferences, value=True)

		self.w.copybutton = vanilla.Button((-80, -30, -15, -10), "Copy", sizeStyle='small', callback=self.buttonCallback)
		self.w.setDefaultButton( self.w.copybutton )

		# Load Settings:
		if not self.LoadPreferences():
			print "Note: 'Copy Layer to Layer' could not load preferences. Will resort to defaults."

		self.w.open()
		self.w.makeKey()
		# self.w.master_into.set(1) 
开发者ID:weiweihuanghuang,项目名称:wei-glyphs-scripts,代码行数:37,代码来源:Copy Layer to All Layers.py

示例6: __init__

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import PopUpButton [as 别名]
def __init__( self ):
		self.w = vanilla.FloatingWindow( (350, 140), "Adjust Kerning", minSize=(350, 140), maxSize=(600, 140), autosaveName="com.wwhh.AdjustKerningTwo.mainwindow" )

		self.w.text_1 = vanilla.TextBox( (15-1, 12+2, -15, 14), "All kerning pairs in the current Master:", sizeStyle='small' )
		self.w.popup_1 = vanilla.PopUpButton( (15, 36, 100, 17), optionList, callback=self.SavePreferences, sizeStyle='small' )

		self.w.text_2 = vanilla.TextBox( (15+100+6, 38, 40, 19), "L:", sizeStyle='small' )
		self.w.value_1 = vanilla.EditText((15+100+24, 36, 40, 19), "10", sizeStyle='small', callback=self.SavePreferences)

		self.w.text_3 = vanilla.TextBox( (15+100+20+40+8, 38, 40, 19), "R:", sizeStyle='small' )
		self.w.value_2 = vanilla.EditText((15+100+20+40+24, 36, 40, 19), "10", sizeStyle='small', callback=self.SavePreferences)
		
		self.w.runButton = vanilla.Button((-80-15, 36, -15, 17), "Adjust", sizeStyle='small', callback=self.AdjustKerningMain )
		self.w.setDefaultButton( self.w.runButton )
		
		self.w.text_4 = vanilla.TextBox( (15-1, 66, -15, 14), "For name/class:", sizeStyle='small' )

		self.w.value_3 = vanilla.EditText((15+100+10, 64, -80-15-16, 19), "A", sizeStyle='small', callback=self.SavePreferences)

		
		self.w.keepWindow = vanilla.CheckBox( (15, 92, -15, 20), "Keep window open", value=False, callback=self.SavePreferences, sizeStyle='small' )
		
		
		try:
			self.LoadPreferences( )
		except:
			pass

		self.w.open() 
开发者ID:weiweihuanghuang,项目名称:wei-glyphs-scripts,代码行数:31,代码来源:Adjust Kerning in Glyph.py

示例7: __init__

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import PopUpButton [as 别名]
def __init__( self ):
		# Window 'self.w':
		edY = 200
		txY  = 14
		spX = 10
		spY = 5
		btnX = 250
		btnY = 20
		windowWidth  = 350
		windowHeight = edY*2+spY*6+txY*2+btnY+14
		self.w = vanilla.FloatingWindow(
			( windowWidth, windowHeight ), # default window size
			"Analyse Manuscript", # window title
			autosaveName = "com.Tosche.AnalyseManuscript.mainwindow" # stores last window position and size
		)
		
		# UI elements:
		self.w.text1 = vanilla.TextBox((spX, spY, -spX, txY), 'Paste your text below...', sizeStyle='small')
		self.w.dump = vanilla.TextEditor( (spX, spY*2+txY, -spX, edY), "", callback=self.updateChar)
		self.w.text2 = vanilla.TextBox((spX, spY*3+txY+edY, -spX, txY), "0 Unicode characters", sizeStyle='small')
		self.w.chars = vanilla.TextEditor( (spX, spY*4+txY*2+edY, -spX, edY), "", readOnly=True)
		self.w.chars._textView.setFont_( NSFont.fontWithName_size_("Menlo", 12) )
		self.w.dump._textView.setAutomaticSpellingCorrectionEnabled_(False)
		self.w.dump._textView.setAutomaticTextReplacementEnabled_(False)
		self.w.dump._textView.setContinuousSpellCheckingEnabled_(False)
		self.w.dump._textView.setGrammarCheckingEnabled_(False)
		self.w.dump._textView.setAutomaticQuoteSubstitutionEnabled_(False)

		# Run Button:
		self.w.markPopup = vanilla.PopUpButton((spX, -btnY-spY-7, 70, -spY-7),
			["Mark", "Red", "Orange", "Brown", "Yellow", "Light Green", "Dark Green", "Cyan", "Blue", "Purple", "Pink", "Light Grey", "Dark Grey"],
			callback=self.markGlyphs)
		self.w.runButton = vanilla.Button((-btnX-spX, -btnY-spY-7, -spX, -spY-7), "Add missing characters", sizeStyle='regular', callback=self.AnalyseManuscriptMain )
		self.w.setDefaultButton( self.w.runButton )
		
		# Open window and focus on it:
		self.w.open()
		menu = self.w.markPopup._nsObject.menu()
		menu.setAutoenablesItems_(False)
		menu.itemAtIndex_(0).setEnabled_(False)
		divider = NSMenuItem.separatorItem()
		menu.insertItem_atIndex_(divider, 1)
		self.w.makeKey() 
开发者ID:Tosche,项目名称:Glyphs-Scripts,代码行数:45,代码来源:Analyse Manuscript.py

示例8: __init__

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import PopUpButton [as 别名]
def __init__( self ):
		# Window 'self.w':
		editX = 180
		editY = 22
		textY  = 17
		spaceX = 10
		spaceY = 10
		buttonSizeX = 60
		windowWidth  = spaceX*3+editX*2+85
		windowHeight = 260
		self.w = vanilla.FloatingWindow(
			( windowWidth, windowHeight ), # default window size
			"Copy Kerning Pairs", # window title
			autosaveName = "com.Tosche.CopyKerningPairs.mainwindow" # stores last window position and size
		)
		
		# UI elements:
		self.w.tabs = vanilla.Tabs((10, 10, -10, -20-30), ["Pair", "Preset"])
		tab1 = self.w.tabs[0]
		tab1.text0 = vanilla.TextBox( (spaceX, 0, 260, textY), "Copy the kerning pair between...", sizeStyle='regular' )
		tab1.editL0 = vanilla.EditText( (spaceX, spaceY+textY, editX, editY), "", sizeStyle = 'regular', callback=self.checkField)
		tab1.editR0 = vanilla.EditText( (spaceX*3+editX+20, spaceY+textY, editX, editY), "", sizeStyle = 'regular', callback=self.checkField)
		tab1.checkL0 = vanilla.TextBox( (spaceX+editX+5, spaceY+textY+2, 40, textY), "Any", sizeStyle='regular' )
		tab1.checkR0 = vanilla.TextBox( (spaceX*3+editX*2+25, spaceY+textY+2, 40, textY), "Any", sizeStyle='regular' )
		tab1.text1 = vanilla.TextBox( (spaceX, spaceY*2+textY+editY, 200, textY), "...to this pair", sizeStyle='regular' )
		tab1.editL1 = vanilla.EditText( (spaceX, spaceY*3+textY*2+editY, editX, editY), "", sizeStyle = 'regular', callback=self.checkField)
		tab1.editR1 = vanilla.EditText( (spaceX*3+editX+20, spaceY*3+textY*2+editY, editX, editY), "", sizeStyle = 'regular', callback=self.checkField)
		tab1.checkL1 = vanilla.TextBox( (spaceX+editX+5, spaceY*3+textY*2+editY+2, 40, textY), "Any", sizeStyle='regular')
		tab1.checkR1 = vanilla.TextBox( (spaceX*3+editX*2+25, spaceY*3+textY*2+editY+2, 40, textY), "Any", sizeStyle='regular' )
		tab1.text2 = vanilla.TextBox( (spaceX, spaceY*5+textY*3+editY, 400, textY*2), "Groups will be automatically detected.\nYou can also type group name with @ prefix (e.g. @A)", sizeStyle='regular' )

		tab2 = self.w.tabs[1]
		tab2.radio = vanilla.RadioGroup((spaceX, 2, 80, 78), ["Letter", "Numeral"], isVertical = True, sizeStyle='regular', callback=self.checkRadio)
		tab2.popLetter = vanilla.PopUpButton( (spaceX+100, spaceY, 320, 20), ["Caps to Small Caps", "Caps & Lowercase to Superscript", "Caps & Lowercase to Subscript", "Cap to Lowercase"], sizeStyle='regular' )
		tab2.popNum1 = vanilla.PopUpButton( (spaceX+100, spaceY+40, 140, 20), ["Lining Proportional", "Small Cap", "Numerator", "Denominator", "Superscript", "Subscript" ], sizeStyle='regular' )
		tab2.popNum2 = vanilla.PopUpButton( (spaceX+100+180, spaceY+40, 140, 20), ["Lining Proportional", "Small Cap", "Numerator", "Denominator", "Superscript", "Subscript" ], sizeStyle='regular' )
		tab2.textTo = vanilla.TextBox( (spaceX+100+151, spaceY+40, 20, textY), "to", sizeStyle='regular' )
		tab2.textScale = vanilla.TextBox( (spaceX, spaceY+80, 100, textY), "Scale to", sizeStyle='regular' )
		tab2.textScalePercent = vanilla.TextBox( (spaceX*3+70, spaceY+80, 20, textY), "%", sizeStyle='regular' )
		tab2.editScale = vanilla.EditText( (spaceX+54, spaceY+77, 35, editY), '100', sizeStyle = 'regular')
		tab2.textSkip = vanilla.TextBox( (spaceX+120, spaceY+80, 300, textY), "Ignore pair values smaller than", sizeStyle='regular' )
		tab2.textSkipUnits = vanilla.TextBox( (spaceX+344, spaceY+80, 40, textY), "units", sizeStyle='regular' )
		tab2.editSkip = vanilla.EditText( (spaceX+312, spaceY+77, 30, editY), '10', sizeStyle = 'regular')
		tab2.textNote = vanilla.TextBox( (spaceX, spaceY*3+textY+76, 360, textY*2), "It only copies pairs between the groups.\nBut regular punctuations and symbols are taken care of.", sizeStyle='regular' )

		# Common:
		self.w.allMaster = vanilla.CheckBox((spaceX, -20-15, 100, -15), "All masters", sizeStyle='regular')
		self.w.runButton = vanilla.Button((-80-15, -20-15, -15, -15), "Run", sizeStyle='regular', callback=self.CopyKerningPairsMain )

		# Load Settings:
		if not self.LoadPreferences():
			print("Note: 'Copy Kerning Pairs' could not load preferences. Will resort to defaults")
		
		# Open window and focus on it:
		self.w.open()
		tab2.radio.set(0)
		tab2.popNum1.enable(False)
		tab2.popNum2.enable(False)
		self.w.makeKey() 
开发者ID:Tosche,项目名称:Glyphs-Scripts,代码行数:61,代码来源:Copy Kerning Pairs.py

示例9: __init__

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import PopUpButton [as 别名]
def __init__( self ):
		# Window 'self.w':
		edY = 22
		sp = 10
		btnX = 80
		btnY = 22
		windowWidth  = 300
		windowHeight = 340
		windowWidthResize  = 100 # user can resize width by this value
		windowHeightResize = 0   # user can resize height by this value
		self.w = vanilla.FloatingWindow(
			( windowWidth, windowHeight ), # default window size
			"Export InDesign Tagged Text", # window title
			autosaveName = "com.Tosche.ExportInDesignTaggedText.mainwindow" # stores last window position and size
		)
		f = Glyphs.font
		try:
			os.path.dirname(f.filepath)
			location = "the same folder as the Glyphs source file"
		except:
			location = "Documents folder"

		instruction = '''Instruction:

1. Export button will save the text file(s) in %s (overwites existing ones).

2. You also need to generate the font and make it available in InDesign.

3. In InDesign, have a document open. Go to "File > Place", choose the exported text file, and place it somewhere in the document. Et voilà!''' % location

		instancePopupItems = []
		for ins in f.instances:
			familyName = ins.customParameters["familyName"] if ins.customParameters["familyName"] else f.familyName
			instancePopupItems.append( "%s %s" % (familyName, ins.name) )
		instancePopupItems += ["All instances"]

		# UI elements:
		self.w.instancesText = vanilla.TextBox( (sp, sp+5, 75, edY), "Export for", sizeStyle='small' )
		self.w.instancesList = vanilla.PopUpButton( (sp*2+55, sp, -sp, edY), instancePopupItems, sizeStyle='small' )
		self.w.tabCheck = vanilla.CheckBox( (sp, sp*2+edY*1, -sp, edY), "Tab-separated", sizeStyle = 'small', callback = self.checkBoxes)
		self.w.unicodeCheck = vanilla.CheckBox( (sp, sp*2+edY*2, -sp, edY), "Unicode characters first, un-encoded later", sizeStyle = 'small', callback = self.checkBoxes)
		self.w.breakCheck = vanilla.CheckBox( (sp, sp*2+edY*3, -sp, edY), "Break up the unicode part by category", sizeStyle = 'small')
		self.w.runButton = vanilla.Button((sp, sp*3+edY*4, -sp, btnY), "Export", sizeStyle='regular', callback=self.ExportInDesignTaggedTextMain )
		self.w.setDefaultButton( self.w.runButton )
		self.w.border = vanilla.HorizontalLine((0, sp*4+edY*5, -0, 1))
		self.w.instructionText = vanilla.TextBox( (sp, sp*5+edY*5, -sp, 200), instruction, sizeStyle='small' )
		
		# Load Settings:
		if not self.LoadPreferences():
			print("Note: 'Export InDesign Tagged Text.py' could not load preferences. Will resort to defaults")
		
		self.checkBoxes(self.w.unicodeCheck)

		# Open window and focus on it:
		self.w.open()
		self.w.makeKey() 
开发者ID:Tosche,项目名称:Glyphs-Scripts,代码行数:58,代码来源:Export InDesign Tagged Text.py


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