本文整理汇总了Python中vanilla.TextBox方法的典型用法代码示例。如果您正苦于以下问题:Python vanilla.TextBox方法的具体用法?Python vanilla.TextBox怎么用?Python vanilla.TextBox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vanilla
的用法示例。
在下文中一共展示了vanilla.TextBox方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: permListDoubleClick
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import TextBox [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
示例2: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import TextBox [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)
示例3: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import TextBox [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)
示例4: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import TextBox [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)
示例5: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import TextBox [as 别名]
def __init__( self ):
# Window 'self.w':
textY = 19
spaceX = 10
spaceY = 10
buttonX = 90
buttonY = 20
windowWidth = spaceX*4+buttonX*3
windowHeight = spaceY*6+textY*2+buttonY
self.w = vanilla.FloatingWindow(
( windowWidth, windowHeight ), # default window size
"Set Kerning Groups", # window title
)
self.w.textLower = vanilla.TextBox((spaceX, spaceY, 200, textY), "Lowercase style?", sizeStyle='regular')
self.w.normalButton = vanilla.Button((spaceX, spaceY*2+textY, buttonX, buttonY), "Normal", sizeStyle='regular', callback=self.SetKernPairsMain )
self.w.cursiveButton = vanilla.Button((spaceX*2+buttonX, spaceY*2+textY, buttonX, buttonY), "Cursive", sizeStyle='regular', callback=self.SetKernPairsMain )
self.w.allcapButton = vanilla.Button((spaceX*3+buttonX*2, spaceY*2+textY, buttonX, buttonY), "All Cap", sizeStyle='regular', callback=self.SetKernPairsMain )
self.w.line = vanilla.HorizontalLine((spaceX, spaceX*4+textY*2, -spaceX, 1))
self.w.radioButton = vanilla.RadioGroup((spaceX, spaceY*5+textY*2, 300, textY), ["All Glyphs", "Selected Glyphs"], sizeStyle='regular', isVertical=False)
# Open window and focus on it:
self.w.open()
self.w.radioButton.set(0)
self.w.makeKey()
示例6: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import TextBox [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()
示例7: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import TextBox [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()
示例8: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import TextBox [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()
示例9: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import TextBox [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
示例10: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import TextBox [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)
示例11: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import TextBox [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()
示例12: enterAlternateNumber_
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import TextBox [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)
示例13: setTags
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import TextBox [as 别名]
def setTags(self, tagGroups, stylisticSetNames):
# clear all subviews
for attr, value in list(self.__dict__.items()):
if isinstance(value, VanillaBaseObject):
delattr(self, attr)
self._titles = list(tagGroups)
self._tagIdentifiers = defaultdict(list)
margin = 10
tagWidth = 60
y = margin
tagCounter = 0
for title, tags in tagGroups.items():
titleLabel = TextBox((margin, y, -margin, 20), title)
setattr(self, f"label_{title}", titleLabel)
y += 24
for tag in sorted(tags):
tagView = TagView((margin, y, tagWidth, 20), tag, None,
callback=self._tagStateChanged,
allowsAlternateSelection=(title == "GSUB"))
names = stylisticSetNames.get(tag)
if names:
if len(names) == 1:
description = next(iter(names))
else:
description = "<multiple names>"
else:
description = features.get(tag, ["<unknown>"])[0]
friendlyName = TextBox((margin + tagWidth + 6, y + 1, -margin, 20), description)
friendlyName._nsObject.cell().setLineBreakMode_(AppKit.NSLineBreakByTruncatingTail)
friendlyName._nsObject.setAllowsExpansionToolTips_(True)
tagIdentifier = f"tag_{title}_{tag}"
self._tagIdentifiers[tag].append(tagIdentifier)
setattr(self, tagIdentifier, tagView)
setattr(self, f"friendlyName_{title}_{tag}", friendlyName)
tagCounter += 1
y += 26
y += 6
posSize = (0, 0, self.getPosSize()[2], y)
self.setPosSize(posSize)
self._updateState()
示例14: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import TextBox [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()
示例15: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import TextBox [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()