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


Python NSFont.systemFontSizeForControlSize_方法代码示例

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


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

示例1: init

# 需要导入模块: from AppKit import NSFont [as 别名]
# 或者: from AppKit.NSFont import systemFontSizeForControlSize_ [as 别名]
 def init(self, wizard):
     self = super(SetupWizardWindow, self).initWithContentRect_styleMask_backing_defer_(NSRect((0, 0), (580, 500)), NSTitledWindowMask | NSClosableWindowMask, NSBackingStoreBuffered, NO)
     if self is not None:
         self._wizard = wizard
         self._dropbox_app = wizard.dropbox_app
         self.setReleasedWhenClosed_(NO)
         self.center()
         self.setLevel_(NSFloatingWindowLevel)
         self._system_font = NSFont.systemFontOfSize_(NSFont.systemFontSizeForControlSize_(NSRegularControlSize))
         self._small_system_font = NSFont.systemFontOfSize_(NSFont.systemFontSizeForControlSize_(NSSmallControlSize))
         self.setTitle_(SetupWizardStrings.window_title)
         self._renderers = {Button: self._create_button,
          CenteredMultiControlLine: self._create_centered_multi_control_line,
          Checkbox: self._create_checkbox,
          Choice: self._create_choice,
          CreditCardType: self._create_credit_card_type,
          Date: self._create_date,
          ExampleText: self._create_example_text,
          FancyRadioGroup: self._create_fancy_radio_group,
          FlagChoice: self._create_flag_choice,
          HelpButton: self._create_help_button,
          Image: self._create_image,
          LocationChanger: self._create_location_changer,
          MultiControlLine: self._create_multi_control_line,
          MultiControlLineSimple: self._create_multi_control_line,
          TextBlock: self._create_text_block,
          TextInput: self._create_text_input,
          PlanChoices: self._create_plan_choices,
          RadioGroup: self._create_radio_group,
          SelectiveSync: self._create_selective_sync,
          Spacer: self._create_spacer}
         self._buttons = {}
     return self
开发者ID:,项目名称:,代码行数:35,代码来源:

示例2: __init__

# 需要导入模块: from AppKit import NSFont [as 别名]
# 或者: from AppKit.NSFont import systemFontSizeForControlSize_ [as 别名]
 def __init__(self, posSize, titles, isVertical=True, callback=None, sizeStyle="regular"):
     self._setupView(self.nsMatrixClass, posSize, callback=callback)
     self._isVertical = isVertical
     matrix = self._nsObject
     matrix.setMode_(NSRadioModeMatrix)
     matrix.setCellClass_(self.nsCellClass)
     # XXX! this does not work for vertical radio groups!
     matrix.setAutosizesCells_(True)
     # we handle the control size setting here
     # since the actual NS object is a NSMatrix
     cellSizeStyle = _sizeStyleMap[sizeStyle]
     font = NSFont.systemFontOfSize_(NSFont.systemFontSizeForControlSize_(cellSizeStyle))
     # intercell spacing and cell spacing are based on the sizeStyle
     if sizeStyle == "regular":
         matrix.setIntercellSpacing_((4.0, 2.0))
         matrix.setCellSize_((posSize[2], 18))
     elif sizeStyle == "small":
         matrix.setIntercellSpacing_((3.5, 2.0))
         matrix.setCellSize_((posSize[2], 15))
     elif sizeStyle == "mini":
         matrix.setIntercellSpacing_((3.0, 2.0))
         matrix.setCellSize_((posSize[2], 12))
     else:
         raise ValueError("sizeStyle must be 'regular', 'small' or 'mini'")
     for _ in range(len(titles)):
         if isVertical:
             matrix.addRow()
         else:
             matrix.addColumn()
     for title, cell in zip(titles, matrix.cells()):
         cell.setButtonType_(NSRadioButton)
         cell.setTitle_(title)
         cell.setControlSize_(cellSizeStyle)
         cell.setFont_(font)
开发者ID:LettError,项目名称:vanilla,代码行数:36,代码来源:vanillaRadioGroup.py

示例3: SmallTextListCell

# 需要导入模块: from AppKit import NSFont [as 别名]
# 或者: from AppKit.NSFont import systemFontSizeForControlSize_ [as 别名]
def SmallTextListCell(editable=False):
    cell = NSTextFieldCell.alloc().init()
    size = NSSmallControlSize
    cell.setControlSize_(size)
    font = NSFont.systemFontOfSize_(NSFont.systemFontSizeForControlSize_(size))
    cell.setFont_(font)
    cell.setEditable_(editable)
    return cell
开发者ID:FontBureau,项目名称:fbOpenTools,代码行数:10,代码来源:OverlayUFOs2.py

示例4: init

# 需要导入模块: from AppKit import NSFont [as 别名]
# 或者: from AppKit.NSFont import systemFontSizeForControlSize_ [as 别名]
    def init(self):
        self = super(LineNumberNSRulerView, self).init()
        self._font = NSFont.labelFontOfSize_(NSFont.systemFontSizeForControlSize_(NSMiniControlSize))
        self._textColor = NSColor.colorWithCalibratedWhite_alpha_(.42, 1)
        self._rulerBackgroundColor = None

        self._lineIndices = None
        return self
开发者ID:typemytype,项目名称:drawbot,代码行数:10,代码来源:lineNumberRulerView.py

示例5: __init__

# 需要导入模块: from AppKit import NSFont [as 别名]
# 或者: from AppKit.NSFont import systemFontSizeForControlSize_ [as 别名]
 def __init__(self, posSize, title=None):
     self._setupView(self.nsBoxClass, posSize)
     if title:
         self._nsObject.setTitle_(title)
         if osVersionCurrent < osVersion10_10:
             self._nsObject.titleCell().setTextColor_(NSColor.blackColor())
         font = NSFont.systemFontOfSize_(NSFont.systemFontSizeForControlSize_(NSSmallControlSize))
         self._nsObject.setTitleFont_(font)
     else:
         self._nsObject.setTitlePosition_(NSNoTitle)
开发者ID:LettError,项目名称:vanilla,代码行数:12,代码来源:vanillaBox.py

示例6: initWithFrame_imageDir_

# 需要导入模块: from AppKit import NSFont [as 别名]
# 或者: from AppKit.NSFont import systemFontSizeForControlSize_ [as 别名]
    def initWithFrame_imageDir_(self, frame, imageDir):
        self = super(IntroView, self).initWithFrame_(frame)
        if not self:
            return None
        dropboxImage = NSImage.alloc().initWithContentsOfFile_(os.path.join(imageDir, u'box_stroked_150.png'))
        iW, iH = dropboxImage.size()
        newHeight = iH * 300.0 / iW
        self.dropboxViewFinalPosition = NSRect((25, frame.size[1] - 43 - newHeight), (300, newHeight))
        self.dropboxView = ShadowedImage.alloc().initWithFrame_(self.dropboxViewFinalPosition)
        self.dropboxView.setImageScaling_(NSScaleToFit)
        self.dropboxView.setImage_(dropboxImage)
        self.dropboxView.setShadowColor_(NSColor.colorWithCalibratedRed_green_blue_alpha_(0, 0, 0, 0.5))
        self.dropboxView.setShadowOffset_((0.0, -2.0))
        self.dropboxView.setShadowBlurRadius_(5.0)
        logoImage = NSImage.alloc().initWithContentsOfFile_(os.path.join(imageDir, u'dropboxlogo.png'))
        iW, iH = logoImage.size()
        newHeight = iH * 300.0 / iW
        self.logoViewFinalPosition = NSRect((25, frame.size[1] - 334 - newHeight), (300, newHeight))
        self.logoView = NSImageView.alloc().initWithFrame_(self.logoViewFinalPosition)
        self.logoView.setImage_(logoImage)
        self.versionView = NSTextView.alloc().initWithFrame_(NSRect((0, 0), frame.size))
        self.versionView.setDrawsBackground_(NO)
        self.versionView.setEditable_(NO)
        self.versionView.setSelectable_(NO)
        self.versionView.textStorage().mutableString().setString_(u'Version %s' % build_number.VERSION)
        self.versionView.textStorage().setFont_(NSFont.labelFontOfSize_(14))
        self.versionView.layoutManager().glyphRangeForTextContainer_(self.versionView.textContainer())
        textSize1 = self.versionView.layoutManager().usedRectForTextContainer_(self.versionView.textContainer()).size
        textAnchor1 = 5
        self.versionView2 = NSTextView.alloc().initWithFrame_(NSRect((0, 0), frame.size))
        self.versionView2.setDrawsBackground_(NO)
        self.versionView2.setEditable_(NO)
        self.versionView2.setSelectable_(NO)
        self.versionView2.textStorage().mutableString().setString_(u'Copyright \xa9 2007-2010 Dropbox Inc.')
        self.versionView2.setFont_(NSFont.systemFontOfSize_(NSFont.systemFontSizeForControlSize_(NSSmallControlSize)))
        self.versionView2.layoutManager().glyphRangeForTextContainer_(self.versionView2.textContainer())
        textSize2 = self.versionView2.layoutManager().usedRectForTextContainer_(self.versionView2.textContainer()).size
        textAnchor2 = 4
        bottomToLogoViewBaseline = self.logoView.frame().origin[1] + 17
        textSeparation = 10
        combinedHeight = textSize1[1] + textSize2[1] + textSeparation
        self.versionView2FinalPosition = NSRect(((frame.size[0] - textSize2[0]) / 2.0, (bottomToLogoViewBaseline - combinedHeight) / 2.0), (textSize2[0], textSize2[1] + textAnchor2))
        self.versionView2.setFrame_(self.versionView2FinalPosition)
        self.versionViewFinalPosition = NSRect(((frame.size[0] - textSize1[0]) / 2.0, self.versionView2.frame().origin[1] + textSeparation + self.versionView2.frame().size[1]), (textSize1[0], textSize1[1] + textAnchor1))
        self.versionView.setFrame_(self.versionViewFinalPosition)
        for _view in (self.dropboxView,
         self.logoView,
         self.versionView,
         self.versionView2):
            self.addSubview_(_view)

        return self
开发者ID:,项目名称:,代码行数:54,代码来源:

示例7: _setSizeStyle

# 需要导入模块: from AppKit import NSFont [as 别名]
# 或者: from AppKit.NSFont import systemFontSizeForControlSize_ [as 别名]
 def _setSizeStyle(self, value):
     value = _sizeStyleMap[value]
     self._nsObject.cell().setControlSize_(value)
     font = NSFont.systemFontOfSize_(NSFont.systemFontSizeForControlSize_(value))
     self._nsObject.setFont_(font)
开发者ID:LettError,项目名称:vanilla,代码行数:7,代码来源:vanillaBase.py

示例8: okCallback

# 需要导入模块: from AppKit import NSFont [as 别名]
# 或者: from AppKit.NSFont import systemFontSizeForControlSize_ [as 别名]
        self._callback = None
        self.w.close()

    def okCallback(self, sender):
        self.w.close()
        value = self.w.lineInput.get()
        if value is not None:
            self._callback(value)
        self._callback = None


# -----------------
# Line Number Ruler
# -----------------

rulerFont = NSFont.labelFontOfSize_(NSFont.systemFontSizeForControlSize_(NSMiniControlSize))


class DefconAppKitLineNumberView(NSRulerView):

    def init(self):
        self = super(DefconAppKitLineNumberView, self).init()
        self._existingText = None
        self._existingClientViewWidth = None
        self._lineRects = []
        return self

    def dealloc(self):
        notificationCenter = NSNotificationCenter.defaultCenter()
        notificationCenter.removeObserver_(self)
        super(DefconAppKitLineNumberView, self).dealloc()
开发者ID:typemytype,项目名称:defconAppKit,代码行数:33,代码来源:featureTextEditor.py

示例9: DefconAppKitTopAnchoredNSView

# 需要导入模块: from AppKit import NSFont [as 别名]
# 或者: from AppKit.NSFont import systemFontSizeForControlSize_ [as 别名]
class DefconAppKitTopAnchoredNSView(NSView):

    def isFlipped(self):
        return True


# title attributes
shadow = NSShadow.alloc().init()
shadow.setShadowColor_(NSColor.colorWithCalibratedWhite_alpha_(1, 1))
shadow.setShadowBlurRadius_(1.0)
shadow.setShadowOffset_((1.0, -1.0))
titleControlAttributes = {
    NSForegroundColorAttributeName: NSColor.colorWithCalibratedWhite_alpha_(.4, 1),
    NSShadowAttributeName: shadow,
    NSFontAttributeName: NSFont.boldSystemFontOfSize_(NSFont.systemFontSizeForControlSize_(NSSmallControlSize))
}


# all script and language tags
_scriptTags = """arab
armn
beng
bopo
brai
byzm
cans
cher
hani
cyrl
DFLT
开发者ID:andyclymer,项目名称:defconAppKit,代码行数:32,代码来源:openTypeControlsView.py


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