當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。