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


Python vanilla.EditText方法代码示例

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


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

示例1: __init__

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import EditText [as 别名]
def __init__(self, parameter, posSize, title=None, callback=None):
        super(ParameterSliderTextInput, self).__init__(posSize)
        self.parameter = parameter
        self.callback = callback
        editTextPosSize = (-45, 0, 45, 22)
        if title is None:
            sliderPosSize = (5, 3, -80, 15)
        elif title is not None:
            if len(title) > 15:
                title = '{0}.'.format(title[:16])
            title = title.capitalize()
            sliderPosSize = (120, 3, -55, 15)
            self.title = TextBox((0, 3, 115, 30), title, sizeStyle='small')
        if parameter.dissociable:
            editTextPosSize = (-65, 0, 40, 22)
            self.checkBox = CheckBox((-22, 5, 22, 25), u'∞', callback=self.setFree, value=True, sizeStyle='mini')
        self.slider = Slider(sliderPosSize, minValue=parameter.limits[0], maxValue=parameter.limits[1], value=parameter.value, callback=self.valueInput, sizeStyle='small')
        self.textInput = EditText(editTextPosSize, str(parameter.value), callback=self.valueInput, continuous=False, sizeStyle='small')
        self.parameter.bind(self) 
开发者ID:loicsander,项目名称:Robofont-scripts,代码行数:21,代码来源:vanillaParameterObjects.py

示例2: __init__

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import EditText [as 别名]
def __init__(self, parameter, posSize, title=None, callback=None):
        super(ParameterSliderTextInput, self).__init__(posSize)
        self.parameter = parameter
        self.callback = callback
        editTextPosSize = (-65, 0, 40, 22)
        if title is None:
            sliderPosSize = (5, 3, -80, 15)
        elif title is not None:
            title = title.capitalize()
            sliderPosSize = (70, 3, -80, 15)
            self.title = TextBox((0, 3, 65, 30), title, sizeStyle='small')
        if parameter.dissociable:
            editTextPosSize = (-65, 0, 40, 22)
            self.checkBox = CheckBox((-22, 5, 22, 25), u'∞', callback=self.setFree, value=True, sizeStyle='mini')
        self.slider = Slider(sliderPosSize, minValue=parameter.limits[0], maxValue=parameter.limits[1], value=parameter.value, callback=self.valueInput, sizeStyle='small')
        self.textInput = EditText(editTextPosSize, str(parameter.value), callback=self.valueInput, continuous=False, sizeStyle='small')
        self.parameter.bind(self) 
开发者ID:loicsander,项目名称:Robofont-scripts,代码行数:19,代码来源:vanillaParameterObjects.py

示例3: __init__

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import EditText [as 别名]
def __init__(self, parameter, posSize, title=None, callback=None):
        super(ParameterSliderTextInput, self).__init__(posSize)
        self.parameter = parameter
        self.callback = callback
        editTextPosSize = (-65, 0, 40, 22)
        if title is None:
            sliderPosSize = (5, 3, -80, 15)
        elif title is not None:
            if 'point' in title:
                title = title.lstrip('point')
                title = 'p. ' + title
            title = title.capitalize()
            sliderPosSize = (70, 3, -80, 15)
            self.title = TextBox((0, 3, 65, 30), title, sizeStyle='small')
        if parameter.dissociable:
            editTextPosSize = (-65, 0, 40, 22)
            self.checkBox = CheckBox((-22, 5, 22, 25), u'∞', callback=self.setFree, value=True, sizeStyle='mini')
            self.parameter.bind(self.checkBox)
        self.slider = Slider(sliderPosSize, minValue=parameter.limits[0], maxValue=parameter.limits[1], value=parameter.value, callback=self.valueInput, sizeStyle='small')
        self.textInput = EditText(editTextPosSize, str(parameter.value), callback=self.valueInput, continuous=False, sizeStyle='small')
        self.parameter.bind(self)
        self.parameter.bind(self.slider)
        self.parameter.bind(self.textInput) 
开发者ID:loicsander,项目名称:Robofont-scripts,代码行数:25,代码来源:vanillaParameterObjects.py

示例4: __init__

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

示例5: __init__

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

示例6: __init__

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

示例7: __init__

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

示例8: __init__

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

示例9: setControls

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import EditText [as 别名]
def setControls(self, value):
        for control in self.controls:
            if isinstance(control, EditText):
                if not isinstance(value, str):
                    value = str(value)
                control.set(value)
            elif isinstance(control, Slider) and (value != '*') and (control != self.sender):
                control.set(value)
            elif isinstance(control, CheckBox):
                free = self.master is None
                control.set(not free) 
开发者ID:loicsander,项目名称:Robofont-scripts,代码行数:13,代码来源:vanillaParameterObjects.py

示例10: __init__

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import EditText [as 别名]
def __init__(self, posSize, label, minValue, value, maxValue, continuous=True, callback=None):
        super().__init__(posSize)
        self._callback = callback
        self.label = TextBox((0, 0, 0, 20), label)
        self.slider = Slider((0, 18, -60, 20), value=minValue, minValue=minValue, maxValue=maxValue,
                             continuous=continuous, callback=self._sliderCallback)
        self.editField = EditText((-50, 16, 0, 24), "", continuous=False, callback=self._editFieldCallback)
        self.editField._nsObject.setAlignment_(AppKit.NSRightTextAlignment)
        self._setSliderFromValue(value)
        self._setEditFieldFromValue(value) 
开发者ID:justvanrossum,项目名称:fontgoggles,代码行数:12,代码来源:sliderGroup.py

示例11: __init__

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

示例12: enterAlternateNumber_

# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import EditText [as 别名]
def enterAlternateNumber_(self, sender):
        self.popover = Popover((140, 80))
        self.popover.open(parentView=self, preferredEdge='right')
        self.popover.label = TextBox((20, 10, -20, 20), "Enter an Alt nr.:")
        if self.state:
            value = str(int(self.state))
        else:
            value = ""
        self.popover.altNumber = EditText((20, 35, -20, 25), value, continuous=False,
                                          callback=self.textEnteredCallback_)
        self.window().makeFirstResponder_(self.popover.altNumber._nsObject) 
开发者ID:justvanrossum,项目名称:fontgoggles,代码行数:13,代码来源:tagView.py

示例13: __init__

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

示例14: __init__

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

示例15: __init__

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


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