本文整理汇总了Python中vanilla.CheckBox方法的典型用法代码示例。如果您正苦于以下问题:Python vanilla.CheckBox方法的具体用法?Python vanilla.CheckBox怎么用?Python vanilla.CheckBox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vanilla
的用法示例。
在下文中一共展示了vanilla.CheckBox方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import CheckBox [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)
示例2: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import CheckBox [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)
示例3: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import CheckBox [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)
示例4: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import CheckBox [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
示例5: spaceCenterOpenCallback
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import CheckBox [as 别名]
def spaceCenterOpenCallback(self, notification):
if (not self.popupOpen) and (len(self.metricsGroups) > 0):
self.w = FloatingWindow((160, 36), 'Group Spacing')
self.w.activateGroups = CheckBox((9, -27, 151, 18), "Activate Group spacing", value=self.enableGroupSpacing, callback=self.enableGroupSpacingCallback, sizeStyle="small")
self.w.bind('close', self.windowCloseCallback)
self.w.open()
self.popupOpen = True
示例6: setControls
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import CheckBox [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)
示例7: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import CheckBox [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()
示例8: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import CheckBox [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()
示例9: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import CheckBox [as 别名]
def __init__( self ):
editX = 55
editY = 22
textY = 17
spaceX = 10
spaceY = 10
buttonSizeX = 60
windowWidth = spaceX*2+editX*2+160
windowHeight = 150
self.w = vanilla.FloatingWindow( (windowWidth, windowHeight), "Transform Images with Proper Maths", autosaveName="com.Tosche.TransformImagesWithRealMaths.mainwindow" )
self.w.checkAbsolute = vanilla.CheckBox( (spaceX, spaceY, 75, textY), "Absolute", sizeStyle='regular', callback=self.changeAbsolute )
self.w.move_text1 = vanilla.TextBox( (spaceX, spaceY*2+editY+2, 100, textY), "Move x/y to:", sizeStyle='regular' )
self.w.move_X = vanilla.EditText( (spaceX+88, spaceY*2+editY, editX, editY), "0", sizeStyle = 'regular')
self.w.move_Y = vanilla.EditText( (spaceX+88+editX+5, spaceY*2+editY, editX, editY), "0", sizeStyle = 'regular')
self.w.move_text2 = vanilla.TextBox( (spaceX+88+editX*2+10, spaceY*2+editY+2, -15, textY), "units", sizeStyle='regular' )
self.w.scale_text1 = vanilla.TextBox( (spaceX, spaceY*3+editY*2+2, 100, textY), "Scale x/y to:", sizeStyle='regular' )
self.w.scale_X = vanilla.EditText( (spaceX+88, spaceY*3+editY*2, editX, editY), "100", sizeStyle = 'regular')
self.w.scale_Y = vanilla.EditText( (spaceX+88+editX+5, spaceY*3+editY*2, editX, editY), "100", sizeStyle = 'regular')
self.w.scale_text2 = vanilla.TextBox( (spaceX+88+editX*2+10, spaceY*3+editY*2+2, -15, textY), "%", sizeStyle='regular' )
self.w.runButton = vanilla.Button((-60-15, -20-15, -15, -15), "Go", sizeStyle='regular', callback=self.TransformImagesMain )
self.w.setDefaultButton( self.w.runButton )
try:
self.LoadPreferences( )
except:
pass
self.w.checkAbsolute.set(True)
self.w.open()
示例10: window
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import CheckBox [as 别名]
def window(self):
self.w = vanilla.FloatingWindow((250, 180), "HT Letterspacer", minSize=(225, 180), maxSize=(225, 180), autosaveName="com.ht.spacer")
self.w.text_3 = vanilla.TextBox((210, 25, -170, 14), "%", sizeStyle='small')
self.w.text_4 = vanilla.TextBox((15, 50, 100, 14), "Area", sizeStyle='small')
self.w.text_4b = vanilla.TextBox((120, 50, 50, 14), self.engine.paramArea, sizeStyle='small')
self.w.text_5 = vanilla.TextBox((15, 75, 100, 14), "Depth", sizeStyle='small')
self.w.text_5b = vanilla.TextBox((120, 75, 50, 14), self.engine.paramDepth, sizeStyle='small')
self.w.text_6 = vanilla.TextBox((15, 100, 100, 14), "Overshoot", sizeStyle='small')
self.w.text_6b = vanilla.TextBox((120, 100, 50, 14), self.engine.paramOver, sizeStyle='small')
self.w.LSB = vanilla.CheckBox((15, 15, 40, 18), "LSB", value=True, sizeStyle='small', callback=self.SavePreferences)
self.w.RSB = vanilla.CheckBox((15 + 45, 15, 40, 18), "RSB", value=True, sizeStyle='small', callback=self.SavePreferences)
self.w.tab = vanilla.CheckBox((15 + 45 + 45, 15, 60, 18), "Tabular", value=False, sizeStyle='small', callback=self.SavePreferences)
self.w.width = vanilla.EditText((170, 15, 40, 18), widthAvg(self.mySelection), sizeStyle='small')
self.w.area = vanilla.EditText((170, 50 - 3, 40, 18), "430", sizeStyle='small')
self.w.prof = vanilla.EditText((170, 75 - 3, 40, 18), "20", sizeStyle='small')
self.w.ex = vanilla.EditText((170, 100 - 3, 40, 18), "0", sizeStyle='small')
self.w.copyButton = vanilla.Button((15, 125, -90, 30), "Copy Parameters", sizeStyle='small', callback=self.copyParameters)
self.w.runButton = vanilla.Button((-80, 125, -15, 30), "Apply", sizeStyle='small', callback=self.dialogCallback)
self.w.setDefaultButton(self.w.runButton)
if not self.LoadPreferences():
GlyphsApp.Message("Error :(", "Could not load preferences. Will resort to defaults.", OKButton="OK")
self.w.open()
self.w.makeKey()
示例11: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import CheckBox [as 别名]
def __init__( self ):
hori_margin = 10
verti_margin = hori_margin
button_width = 30
glyphname_width = 180
line_height = 20
gap = 9
dialog_height = line_height + gap + line_height + gap + line_height
dialog_width = button_width + gap + glyphname_width + gap + button_width
self.w = Window( ( hori_margin + dialog_width + hori_margin, verti_margin + dialog_height + verti_margin ), "insert glyph" )
self.w.center()
x = hori_margin
y = verti_margin
# glyph name
self.w.glyphname = EditText( ( x, y, glyphname_width, line_height ), '')
self.w.glyphname.getNSTextField().setToolTip_( u'Enter the name of the glyph to be inserted. It is sufficient to enter the beginning of the glyph name, e.g. “deg” for “degree”.' )
# buttons
x += glyphname_width + gap
self.w.alignleft = Button( ( x, y, button_width, line_height ), LEFT, callback = self.buttonCallback )
self.w.alignleft.getNSButton().setToolTip_( 'Insert the other glyph left-aligned, i.e. at its original same position. Keyboard shortcut: Enter' )
x += button_width + gap
self.w.alignright = Button( ( x, y, button_width, line_height ), RIGHT, callback = self.buttonCallback )
self.w.alignright.getNSButton().setToolTip_( 'Insert the other glyph right-aligned with respect to the advance widths. Keyboard shortcut: Esc' )
self.w.setDefaultButton( self.w.alignleft )
self.w.alignright.bind( "\x1b", [] )
# insert as component
as_component_is_checked = True
if Glyphs.defaults["com.FMX.InsertGlyphToBackground.AsCompoment"] is not None:
as_component_is_checked = Glyphs.defaults["com.FMX.InsertGlyphToBackground.AsCompoment"]
y += line_height + gap
x = hori_margin
self.w.as_component = CheckBox( ( x, y, dialog_width, line_height ), 'Insert as component', callback=None, value=as_component_is_checked )
self.w.as_component.getNSButton().setToolTip_( 'If checked, the other glyph is inserted to the background as a component. Otherwise, it is inserted as paths (even if the other glyph is made of components).' )
# clear current contents
y += line_height + gap
clear_contents_is_checked = True
if Glyphs.defaults["com.FMX.InsertGlyphToBackground.ClearContents"] is not None:
clear_contents_is_checked = Glyphs.defaults["com.FMX.InsertGlyphToBackground.ClearContents"]
self.w.clear_contents = CheckBox( ( x, y, dialog_width, line_height ), 'Clear current contents', callback=None, value=clear_contents_is_checked )
self.w.clear_contents.getNSButton().setToolTip_( 'Check this to clear the background before inserting the other glyph. Uncheck to keep the current contents of the background.' )
self.w.open()
示例12: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import CheckBox [as 别名]
def __init__(self):
self.testStateControlToIdentifier = {}
self.colorControlToKey = {}
self.w = vanilla.Window((264, 457), "Glyph Nanny Preferences")
# global visibility
state = defaults.getValue(defaultKeyObserverVisibility)
self.w.displayLiveReportTitle = vanilla.TextBox((15, 15, 150, 17), "Live report display is:")
self.w.displayLiveReportRadioGroup = vanilla.RadioGroup((159, 15, -15, 17), ["On", "Off"], isVertical=False, callback=self.displayLiveReportRadioGroupCallback)
self.w.displayLiveReportRadioGroup.set(not state)
# test states
_buildGlyphTestTabs(self, 50)
# colors
colors = [
("Information", defaults.colorInform, defaultKeyColorInform),
("Review Something", defaults.colorReview, defaultKeyColorReview),
("Insert Something", defaults.colorInsert, defaultKeyColorInsert),
("Remove Something", defaults.colorRemove, defaultKeyColorRemove)
]
top = 290
for title, color, key in colors:
control = vanilla.ColorWell((15, top, 70, 25), color=color, callback=self.noteColorColorWellCallback)
self.colorControlToKey[control] = key
setattr(self.w, "colorWell_" + title, control)
control = vanilla.TextBox((90, top + 3, -15, 17), title)
setattr(self.w, "colorTitle_" + title, control)
top += 32
# titles
state = defaults.getValue(defaultKeyTitleVisibility)
self.w.displayReportTitlesCheckBox = vanilla.CheckBox((15, 425, -15, 22), "Show Report Titles", value=state, callback=self.displayReportTitlesCheckBoxCallback)
self.w.open()
示例13: _buildGlyphTestTabs
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import CheckBox [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
# --------------
示例14: _checkbox
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import CheckBox [as 别名]
def _checkbox(self, attr, title, value=True):
setattr(self.w, attr, vanilla.CheckBox((14, self.leading, 300, 20), title, value=value))
self.leading += 20
示例15: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import CheckBox [as 别名]
def __init__(self):
self.w = vanilla.FloatingWindow((330, 110), "Interpolate Master's Vert Metrics")
self.w.textBox = vanilla.TextBox((10, 10, -10, 17), "Enter value between 1.0 > 0.0")
self.w.interpolation_value = vanilla.TextEditor((10, 30, -10, 17))
self.w.ignore_win_metrics = vanilla.CheckBox((10, 50, 180, 20), 'Ignore Win Metrics',value=True)
# Check button
self.w.button = vanilla.Button((10, 80, -10, 17), "Interpolate", callback=self.buttonCallback)
self.w.open()