本文整理汇总了Python中vanilla.Window方法的典型用法代码示例。如果您正苦于以下问题:Python vanilla.Window方法的具体用法?Python vanilla.Window怎么用?Python vanilla.Window使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vanilla
的用法示例。
在下文中一共展示了vanilla.Window方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import Window [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()
示例2: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import Window [as 别名]
def __init__(self):
self.w = Window((300, 100))
self.w.inner = Group((10, 10, -10, -10))
p1 = VanillaSingleValueParameter('main', 10, (0, 100), 'int')
p2 = VanillaSingleValueParameter('ratio', 10, (0, 100), 'int', master=p1, mode='ratio', dissociable=True)
p3 = VanillaSingleValueParameter('offset', 10, (0, 100), 'int', master=p1, mode='offset', dissociable=True)
self.w.inner.p1 = ParameterSliderTextInput(p1, (0, 0, -0, 22), 'master')
self.w.inner.p2 = ParameterSliderTextInput(p2, (0, 25, -0, 22), 'ratio')
self.w.inner.p3 = ParameterSliderTextInput(p3, (0, 50, -0, 22), 'offset')
self.w.open()
示例3: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import Window [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()
示例4: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import Window [as 别名]
def __init__(self):
self.w = Window((300, 500), minSize=(200, 100))
y = 10
self.w.g = Group((0, 0, 0, 0))
for i, tag in enumerate(["liga", "calt", "dlig", "smcp", "kern", "locl"]):
setattr(self.w.g, f"tag{i}", TagView((10, y, 60, 20), tag, None, self.callback))
y += 26
self.w.open()
示例5: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import Window [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()
示例6: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import Window [as 别名]
def __init__( self, titles ):
self.button = ''
margin = 10
size = 40
self.w = Window( ( len( titles ) * ( margin + size ) + margin, 2 * margin + size ), "Symmetrify" )
top = margin
left = margin
for title in titles:
button = SquareButton( ( left, top, size, size ), title, callback = self.buttonCallback )
setattr( self.w, title, button )
left += size + margin
示例7: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import Window [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()
示例8: drawReport
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import Window [as 别名]
def drawReport(self, info):
# skip if the user doesn't want to see the report
display = defaults.getValue(defaultKeyObserverVisibility)
if not display:
return
# make sure there is something to be tested
glyph = info["glyph"]
if glyph is None:
return
# get the report
font = glyph.getParent()
testStates = defaults.getValue(defaultKeyTestStates)
if roboFontVersion > "1.5.1":
testStates = dictToTuple(testStates)
report = glyph.getRepresentation("com.typesupply.GlyphNanny.Report", testStates=testStates)
else:
report = getGlyphReport(font, glyph, testStates)
# draw the report
scale = info["scale"]
for key in drawingOrder:
data = report.get(key)
if data:
drawingFunction = testRegistry[key]["drawingFunction"]
if drawingFunction is not None:
drawingFunction(data, scale, glyph)
drawTextReport(report, scale, glyph)
# ------------
# Prefs Window
# ------------
示例9: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import Window [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()
示例10: toggleObserverVisibility
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import Window [as 别名]
def toggleObserverVisibility():
state = not defaults.getValue(defaultKeyObserverVisibility)
setExtensionDefault(defaultKeyObserverVisibility, state)
defaults.reload()
UpdateCurrentGlyphView()
# ----------------
# Test Font Window
# ----------------
示例11: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import Window [as 别名]
def __init__(self):
self.w = Window((400, 400), minSize=(300, 300))
self.w.e = CodeEditor((0, 0, -0, -0), t, lexer=GlyphConstructionLexer())
self.w.open()
示例12: __init__
# 需要导入模块: import vanilla [as 别名]
# 或者: from vanilla import Window [as 别名]
def __init__( self ):
# Window 'self.w':
edY = 22
txX = 116
txY = 17
spX = 14
spY = 12
btnX = 60
btnY = 20
windowWidth = 260
windowHeight = 360
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
"Make Bubble Layers", # window title
autosaveName = "com.Tosche.MakeBubbleLayers.mainwindow" # stores last window position and size
)
# Offset values:
self.w.textH = vanilla.TextBox( (spX, spY, txX, txY), "Horizontal Offset:" )
self.w.textV = vanilla.TextBox( (spX, spY*2+txY, txX, txY), "Vertical Offset:" )
self.w.editH = vanilla.EditText( (-spX-80, spY, -spX, edY), "60")
self.w.editV = vanilla.EditText( (-spX-80, spY*2+txY, -spX, edY), "60")
self.w.line1 = vanilla.HorizontalLine((0, spY*3+txY*2+5, -0, 1))
# Sidebearing modification:
self.w.adhereToSB = vanilla.CheckBox((spX, spY*4+txY*2, -spX, edY), "Adhere to Sidebearigs", callback=self.checkBoxCallback, value=True)
self.w.excess = vanilla.TextBox( (spX+16, spY*5+txY*3-7, -spX, txY), "Exceeding outlines are:" )
self.w.excessRadio = vanilla.RadioGroup((spX+16, spY*6+txY*4-14, 160, edY), ["Nudged", "Trimmed"], isVertical = False,)
self.w.line2 = vanilla.HorizontalLine((0, spY*6+txY*5-4, -0, 1))
# Rounding:
self.w.textRound = vanilla.TextBox( (spX, spY*7+txY*5, txX, txY), "Round Corners:" )
self.w.editRound = vanilla.EditText( (-spX-80, spY*7+txY*5, -spX, edY), "0")
self.w.line3 = vanilla.HorizontalLine((0, spY*8+txY*6+5, -0, 1))
# Overwrite Behaviour:
self.w.textOverwrite = vanilla.TextBox( (spX, spY*9+txY*7-11, -spX, txY), "Overwrite existing?" )
self.w.overwriteRadio = vanilla.RadioGroup((spX, spY*10+txY*8-14, -spX, edY), ["Never", "If Empty", "Always"], isVertical = False,)
self.w.line4 = vanilla.HorizontalLine((0, spY*11+txY*9-8, -0, 1))
# Master preference
self.w.masterRadio = vanilla.RadioGroup((spX, spY*11+txY*9, 0, edY), ["Current Master", "All Masters"], isVertical = False,)
# Run Button:
self.w.runButton = vanilla.Button((-80-15, -20-15, -15, -15), "Go!", sizeStyle='regular', callback=self.MakeBubbleLayersMain )
self.w.setDefaultButton( self.w.runButton )
self.progress = vanilla.Window((200, 65), closable=False, miniaturizable=False)
self.progress.text = vanilla.TextBox( (spX, spY, -spX, txY), "Please wait..." )
# Load Settings:
if not self.LoadPreferences():
self.w.excessRadio.set(0)
self.w.overwriteRadio.set(1)
self.w.masterRadio.set(1)
print "Note: 'Make Bubble Layers' could not load preferences. Will resort to defaults"
# Open window and focus on it:
self.w.open()
self.w.makeKey()
self.progress.open()
self.progress.center()
self.progress.hide()