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


Python vanilla.Button方法代码示例

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


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

示例1: permListDoubleClick

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import Button [as 别名]
def permListDoubleClick(self, sender): # Make a new sheet appear
		try:
			groupText1 = sender[sender.getSelection()[0]]["Left"]
			groupText2 = sender[sender.getSelection()[0]]["Right"]
			sWidth = 600
			self.s = vanilla.Sheet((sWidth, 300), self.w)
			edWidth = int((sWidth-spX*3)/2)
			self.s.text1 = vanilla.TextBox((spX, 5, edWidth, txY), "Left", sizeStyle="small")
			self.s.text2 = vanilla.TextBox((spX*2+edWidth, 5, edWidth, txY), "Right", sizeStyle="small")
			self.s.group1 = vanilla.TextEditor((spX, 10+txY, edWidth, -spY*2-btnY), groupText1)
			self.s.group1._textView.setFont_( Menlo12 )
			self.s.group2 = vanilla.TextEditor((spX*2+edWidth, 10+txY, edWidth, -spY*2-btnY), groupText2)
			self.s.group2._textView.setFont_( Menlo12 )
			self.s.cancel = vanilla.Button((-spX*2-200, -spY-btnY, 100, -spY), "Cancel", callback=self.cancelChange)
			self.s.ok = vanilla.Button((-spX-100, -spY-btnY, -spX, -spY), "OK", callback=self.confirmChange)
			self.s.setDefaultButton( self.s.ok )
			self.s.open()
		except IndexError:
				pass
		except Exception, e:
			Glyphs.showMacroWindow()
			print "BubbleKern Error (permListDoubleClick): %s" % e 
开发者ID:Tosche,项目名称:BubbleKern,代码行数:24,代码来源:BubbleKern.py

示例2: __init__

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import Button [as 别名]
def __init__( self ):
		x = 10
		y = 10
		height = 20
		button_width = 30
		glyphname_width = 180
		gap = 6
		self.w = Window( ( x + button_width + gap + glyphname_width + gap + button_width + x, y + height + y ), "insert glyph" )
		self.w.center()
		self.w.glyphname = EditText( ( x, y, glyphname_width, height ), '')
		x += glyphname_width + gap
		self.w.alignleft = Button( ( x, y, button_width, height ), LEFT, callback = self.buttonCallback )
		x += button_width + gap
		self.w.alignright = Button( ( x, y, button_width, height ), RIGHT, callback = self.buttonCallback )
		self.w.setDefaultButton( self.w.alignleft )
		self.w.alignright.bind( "\x1b", [] )
		self.w.open() 
开发者ID:justanotherfoundry,项目名称:freemix-glyphsapp,代码行数:19,代码来源:Insert Glyph.py

示例3: __init__

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import Button [as 别名]
def __init__(self):
		self.w = vanilla.FloatingWindow(
			( 280, 40 ), # default window size
			"Name This Point", # window title
			autosaveName = "com.wwhh.namethispoint.mainwindow" # stores last window position and size
			)

		self.w.textSearch = vanilla.TextBox((15, 12+2, 67, 14), "Set Name:", sizeStyle='small')
		self.w.pointName = vanilla.EditText((15+67, 12, 110, 19), "", sizeStyle='small', callback=self.SavePreferences)

		self.w.findButton = vanilla.Button((-80, 12+1, -15, 17), "Set Name", sizeStyle='small', callback=self.buttonCallback)
		self.w.setDefaultButton( self.w.findButton )

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

		self.w.open()
		self.w.makeKey()

		# Set defaults for class variables
		self.pointName = self.w.pointName.get() 
开发者ID:weiweihuanghuang,项目名称:wei-glyphs-scripts,代码行数:24,代码来源:Name This.py

示例4: __init__

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import Button [as 别名]
def __init__(self):
		self.w = vanilla.FloatingWindow(
			( 280, 40 ), # default window size
			"Find and Delete Anchor Containing", # window title
			autosaveName = "com.wwhh.FindAnchors.mainwindow" # stores last window position and size
			)

		self.w.textSearch = vanilla.TextBox((15, 12+2, 67, 14), "Search for:", sizeStyle='small')
		self.w.searchFor = vanilla.EditText((15+67, 12, 110, 19), "bottom", sizeStyle='small', callback=self.SavePreferences)

		self.w.findButton = vanilla.Button((-80, 12+1, -15, 17), "Delete", sizeStyle='small', callback=self.buttonCallback)
		self.w.setDefaultButton( self.w.findButton )

		# Load Settings:
		if not self.LoadPreferences():
			print "Note: 'Adjust Kerning in Master' could not load preferences. Will resort to defaults"

		self.w.open()
		self.w.makeKey()

		# Set defaults for class variables
		self.searchFor = self.w.searchFor.get() 
开发者ID:weiweihuanghuang,项目名称:wei-glyphs-scripts,代码行数:24,代码来源:Find and Delete Anchors.py

示例5: __init__

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import Button [as 别名]
def __init__(self):
		self.w = vanilla.FloatingWindow(
			( 360, 40 ), # default window size
			"Add this /s/t/r/i/n/g between selected glyphs", # window title
			autosaveName = "com.wwhh.insertString.mainwindow" # stores last window position and size
			)

		self.w.textAdd = vanilla.TextBox((10, 12+2, 32, 14), "Add:", sizeStyle='small')
		self.w.addThisString = vanilla.EditText((10+32, 12, 220, 19), "", sizeStyle='small', callback=self.SavePreferences)

		self.w.findButton = vanilla.Button((-80, 12+1, -15, 17), "Add", sizeStyle='small', callback=self.buttonCallback)
		self.w.setDefaultButton( self.w.findButton )

		# Load Settings:
		if not self.LoadPreferences():
			print "Note: 'Add String Between Each Selected Glyph' could not load preferences. Will resort to defaults"

		self.w.open()
		self.w.makeKey()

		# Set defaults for class variables
		self.addThisString = self.w.addThisString.get() 
开发者ID:weiweihuanghuang,项目名称:wei-glyphs-scripts,代码行数:24,代码来源:AddStringBetweenEachGlyph.py

示例6: __init__

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import Button [as 别名]
def __init__( self ):
		self.w = vanilla.FloatingWindow( (200, 110), "Delete Kerning", minSize=(180, 110), maxSize=(600, 110), autosaveName="com.wwhh.DeleteKerning.mainwindow" )

		self.w.text_1 = vanilla.TextBox( (15-1, 12+2, -15, 14), "All kerning pairs in this Master smaller than:", sizeStyle='small' )
		self.w.value_1 = vanilla.EditText((15, 36, 50, 19), "10", sizeStyle='small', callback=self.SavePreferences)

		self.w.runButton = vanilla.Button((-100, 36, -10, 17), "Adjust", sizeStyle='small', callback=self.DeleteKerningMain )
		self.w.setDefaultButton( self.w.runButton )

		self.w.keepWindow = vanilla.CheckBox( (15, 60, -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,代码行数:19,代码来源:Delete Kerning Pairs Smaller Than Popup.py

示例7: setSliderInfo

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import Button [as 别名]
def setSliderInfo(self, sliderInfo):
        savedState = self.get()
        # clear all subviews
        for attr, value in list(self.__dict__.items()):
            if isinstance(value, VanillaBaseObject):
                delattr(self, attr)
        margin = 10
        y = margin
        self._tags = []
        self._defaultValues = {}
        for tag, (label, minValue, defaultValue, maxValue) in sliderInfo.items():
            self._tags.append(tag)
            self._defaultValues[tag] = defaultValue
            attrName = f"slider_{tag}"
            slider = SliderPlus((margin, y, -margin, 40), label, minValue, defaultValue, maxValue,
                                continuous=self._continuous, callback=self._sliderChanged)
            setattr(self, attrName, slider)
            y += 50

        self.resetAllButton = Button((10, y, 120, 25), "Reset all axes", self._resetAllButtonCallback)
        self.resetAllButton.enable(False)
        y += 35

        posSize = (0, 0, self.getPosSize()[2], y)
        self.setPosSize(posSize)
        self._updateState(savedState) 
开发者ID:justvanrossum,项目名称:fontgoggles,代码行数:28,代码来源:sliderGroup.py

示例8: __init__

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import Button [as 别名]
def __init__(self):
            self.w = Window((300, 400), "SliderTest", autosaveName="SliderTestttt")
            # self.w.slider1 = SliderPlus((10, 10, -10, 50), "Slider 1", 0, 50, 100)
            # self.w.slider2 = SliderPlus((10, 60, -10, 50), "Slider 2", 0, 50, 100)
            info = [("abcd", "The alphabet"),
                    ("xyz ", "The alphabet part 2"),
                    ("wdth", "Width"),
                    ("wght", "Weight")]
            self.sliderInfo = {}
            for tag, label in info:
                self.sliderInfo[tag] = (label, 0, 50, 100)
            self.w.sliderGroup = SliderGroup(300, self.sliderInfo, continuous=True, callback=self.sliderGroupCallback)
            self.w.mutateButton = Button((10, -40, 80, 20), "Mutate", callback=self.mutateCallback)
            self.w.open() 
开发者ID:justvanrossum,项目名称:fontgoggles,代码行数:16,代码来源:sliderGroup.py

示例9: __init__

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import Button [as 别名]
def __init__(self):
        self.searchResults = []
        self.selectedChars = ""

        self.w = FloatingWindow((300, 400), "Unicode Picker", minSize=(250, 300),
                                autosaveName="UnicodePicker")
        y = 8
        self.w.searchField = EditText((10, y, -10, 25),
                                      placeholder="Search Unicode name or value",
                                      callback=self.searchTextChanged_)

        y = 40
        columnDescriptions = [
            dict(title="char", width=40,
                 cell=makeTextCell(align="center", font=AppKit.NSFont.systemFontOfSize_(14))),
            dict(title="unicode", width=60, cell=makeTextCell(align="right")),
            dict(title="name"),
        ]
        self.w.unicodeList = List((0, y, 0, -100), [], columnDescriptions=columnDescriptions,
                                  rowHeight=18,
                                  selectionCallback=self.listSelectionChanged_,
                                  doubleClickCallback=self.listDoubleClickCallback_)
        self.w.unicodeList._nsObject.setBorderType_(AppKit.NSNoBorder)

        y = -100
        self.w.divider = HorizontalLine((0, y, 0, 1))
        y += 5
        self.w.unicodeText = TextBox((20, y, -10, 55), "")
        self.w.unicodeText._nsObject.cell().setFont_(AppKit.NSFont.systemFontOfSize_(36))
        self.w.unicodeText._nsObject.cell().setLineBreakMode_(AppKit.NSLineBreakByTruncatingMiddle)
        y += 55
        self.w.copyButton = Button((20, y, 120, 25), "Copy", callback=self.copy_)
        self.w.copyButton.enable(False)

        self.w.open()
        self.w._window.setWindowController_(self)
        self.w._window.setBecomesKeyOnlyIfNeeded_(False)
        self.w._window.makeKeyWindow() 
开发者ID:justvanrossum,项目名称:fontgoggles,代码行数:40,代码来源:unicodePicker.py

示例10: __init__

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import Button [as 别名]
def __init__(self):
            tagGroups = {"GSUB": {"aalt", "salt", "ss02", "ccmb", "ccmp", "liga", "dlig", "rvrn", "cpsp"},
                         "GPOS": {"kern", "mark", "mkmk", "cpsp", "ZZZZ"}}
            self.w = Window((300, 500), "TagTest", minSize=(200, 200), autosaveName="TempTagTesttt")
            self.tags = FeatureTagGroup(300, tagGroups, callback=self.tagsChanged)

            self.w.tagsScrollView = AligningScrollView((0, 0, 0, -50), self.tags, drawBackground=False,
                                                       borderType=AppKit.NSNoBorder)
            self.w.mutateButton = Button((10, -30, 100, 20), "Mutate", callback=self.mutate)
            self.w.repopulateButton = Button((120, -30, 100, 20), "Repopulate", callback=self.repopulate)
            self.w.open() 
开发者ID:justvanrossum,项目名称:fontgoggles,代码行数:13,代码来源:featureTagGroup.py

示例11: __init__

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import Button [as 别名]
def __init__( self ):
		# Window 'self.w':
		edY = 22
		txY = 17
		sp = 10
		btnX = 100
		btnY = 22
		windowWidth  = 300
		windowHeight = sp*5+edY*2+edY+btnY+sp
		# 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
			"Search Glyph In Class Features", # window title
			# minSize = ( windowWidth, windowHeight ), # minimum size (for resizing)
			# maxSize = ( windowWidth, windowHeight ), # maximum size (for resizing)
			autosaveName = "com.Tosche.SearchGlyphInClassFeatures.mainwindow" # stores last window position and size
		)
		
		listOfOptions = [ "Check which alternates are unused", "Check if/where the selected glyph is used", "Any keyword" ]
		self.w.radioButtons = vanilla.RadioGroup( (sp, sp, -sp, edY*len(listOfOptions) ), listOfOptions, sizeStyle = 'regular', callback=self.radio )
		self.w.edit_1 = vanilla.EditText( (sp+20, sp*1.5+edY*len(listOfOptions), -sp, edY), "", sizeStyle = 'regular')
		
		# Run Button:
		self.w.runButton = vanilla.Button((-sp-btnX, sp*5+edY*2+edY, -sp, btnY), "Check", sizeStyle='regular', callback=self.Search )
		self.w.setDefaultButton( self.w.runButton )
				
		# Open window and focus on it:
		self.w.radioButtons.set( 0 )
		self.w.edit_1.enable(False)
		self.w.open()
		self.w.makeKey() 
开发者ID:Tosche,项目名称:Glyphs-Scripts,代码行数:34,代码来源:Search Glyph in Classes & Features.py

示例12: __init__

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import Button [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

示例13: __init__

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import Button [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

示例14: __init__

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import Button [as 别名]
def __init__( self ):
		spaceX = 10
		buttonSizeX = 60
		Y = 16
		spaceY = 10
		windowWidth  = 360
		windowHeight = spaceY*2+(Y+spaceY)*6
		self.w = vanilla.FloatingWindow(
			( windowWidth, windowHeight ), # default window size
			"Copy kerning to Greek & Cyrillic", # window title
			autosaveName = "com.Tosche.CopyKerningToGreekCyrillic.mainwindow" # stores last window position and size
		)
		
		# UI :
		self.w.instruction = vanilla.TextBox((spaceX, spaceY, 340, 87), "This script copies your Latin kerning to the common shapes of Greek and Cyrillic, including small caps.\nExceptions and absent glyphs are skipped.\nIt's best used after finishing Latin kerning and before starting Cyrillic and Greek.")
		self.w.AllCapBox = vanilla.CheckBox( (spaceX, spaceY+87+spaceY, 270, Y), "ALL CAP (skip lowercase)", callback=self.triggerCursive, value=False)
		self.w.CursiveBox = vanilla.CheckBox( (spaceX, spaceY+87+spaceY+Y+spaceY, 270, Y), 'Cyrillic lowercase is "cursive"', value=False)
		self.w.runButton = vanilla.Button((-80-15, spaceY+(Y+spaceY)*5, -15, Y), "Copy", sizeStyle='regular', callback=self.CopyKerningToGreekCyrillicMain )
		self.w.setDefaultButton( self.w.runButton )

		# Load Settings:
		if not self.LoadPreferences():
			print("Note: 'Copy kerning to Greek & Cyrillic (GUI)' could not load preferences. Will resort to defaults")
		
		# Open window and focus on it:
		self.w.open()
		self.w.makeKey() 
开发者ID:Tosche,项目名称:Glyphs-Scripts,代码行数:29,代码来源:Copy Kerning to Greek & Cyrillic.py

示例15: __init__

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import Button [as 别名]
def __init__( self ):
		# Window 'self.w':
		left = 14
		top = 14
		leading = 36
		textW = 220
		textH = 20
		xSpace = 10
		buttonW = 100
		buttonTop = top-5
		buttonH = 30
		windowWidth  = left+textW+xSpace+buttonW+left
		windowHeight = top+leading+leading+leading
		self.w = vanilla.FloatingWindow(
			( windowWidth, windowHeight ), # default window size
			"Report Metric Keys", # window title
		)
		
		# UI elements:
		self.w.textInvalid = vanilla.TextBox( (left, top, textW, textH), "Invalid glyphs in sidebearing keys", sizeStyle='regular' )
		self.w.textDifferent = vanilla.TextBox( (left, top+leading, textW, textH), "Different keys in each master", sizeStyle='regular' )
		self.w.textNesting = vanilla.TextBox( (left, top+leading+leading, textW, textH), "Nested sidebearing keys", sizeStyle='regular' )
		
		# Run Button:
		self.w.reportInvalid = vanilla.Button((left+textW+xSpace, buttonTop, buttonW, buttonH), "Report", sizeStyle='regular', callback=self.reportInvalid )
		self.w.reportDifference = vanilla.Button((left+textW+xSpace, buttonTop+leading, buttonW, buttonH), "Report", sizeStyle='regular', callback=self.reportDifference )
		self.w.reportNest = vanilla.Button((left+textW+xSpace, buttonTop+leading+leading, buttonW, buttonH), "Report", sizeStyle='regular', callback=self.reportNest )
		
		# Open window and focus on it:
		self.w.open()
		self.w.makeKey() 
开发者ID:Tosche,项目名称:Glyphs-Scripts,代码行数:33,代码来源:Report Metric Keys.py


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