當前位置: 首頁>>代碼示例>>Python>>正文


Python NSFont.smallSystemFontSize方法代碼示例

本文整理匯總了Python中AppKit.NSFont.smallSystemFontSize方法的典型用法代碼示例。如果您正苦於以下問題:Python NSFont.smallSystemFontSize方法的具體用法?Python NSFont.smallSystemFontSize怎麽用?Python NSFont.smallSystemFontSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在AppKit.NSFont的用法示例。


在下文中一共展示了NSFont.smallSystemFontSize方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: initWithDropboxApp_initialIgnoreList_takeAction_callback_remote_

# 需要導入模塊: from AppKit import NSFont [as 別名]
# 或者: from AppKit.NSFont import smallSystemFontSize [as 別名]
 def initWithDropboxApp_initialIgnoreList_takeAction_callback_remote_(self, dropbox_app, initial_ignore_list, take_action, callback, remote):
     self = super(SelectiveSyncView, self).initWithFrame_(NSZeroRect)
     if self is None:
         return
     self._initial_ignore_list = initial_ignore_list
     self._callback = callback
     self._take_action = take_action
     self._remote = remote
     self.setAutoresizingMask_(NSViewWidthSizable | NSViewHeightSizable)
     self._dropbox_app = dropbox_app
     self.initBrowser(self._remote)
     self.initButtons()
     f = NSFont.systemFontOfSize_(NSFont.smallSystemFontSize())
     self.infoLabel = NSTextField.createLabelWithText_font_(selsync_strings.info, f)
     self.addSubview_(self.infoLabel)
     self.reloadInvalidState()
     self.layoutForWidth_(DEFAULT_ADVANCED_WIDTH if self.forest.advanced_view else DEFAULT_SIMPLE_WIDTH)
     return self
開發者ID:,項目名稱:,代碼行數:20,代碼來源:

示例2: layout

# 需要導入模塊: from AppKit import NSFont [as 別名]
# 或者: from AppKit.NSFont import smallSystemFontSize [as 別名]
    def layout(self):
        self._thumbnail = ThumbnailBoxView.alloc().initWithFrame_(NSZeroRect)
        self._thumbnail.setImage_(Images.Box64)
        self._thumbnail.setImageAlignment_(NSImageAlignCenter)
        self._thumbnail.setImageScaling_(NSScaleToFit)
        self._thumbnail.setFrameSize_(self.THUMBNAIL_SIZE)
        self._thumbnail.setFrameOrigin_(self.THUMBNAIL_ORIGIN)
        self._thumbnail.setShadowOffset_(self.SHADOW_OFFSET)
        self._thumbnail.setShadowBlurRadius_(self.SHADOW_BLUR)
        self._thumbnail.setShadowColor_(NSColor.blackColor().colorWithAlphaComponent_(0.3))
        self._label = NSTextField.createLabelWithText_font_('', NSFont.boldSystemFontOfSize_(13))
        self._label.setFrameOrigin_(self.LABEL_ORIGIN)
        self._progress_bar = NSProgressIndicator.alloc().initWithFrame_(NSRect(self.PROGRESS_ORIGIN, self.PROGRESS_SIZE))
        self._progress_bar.setStyle_(NSProgressIndicatorBarStyle)
        self._progress_bar.setIndeterminate_(YES)
        self._progress_bar.setFrameOrigin_(self.PROGRESS_ORIGIN)
        self._estimate = NSTextField.createLabelWithText_font_('', NSFont.systemFontOfSize_(NSFont.smallSystemFontSize()))
        self._estimate.setFrameOrigin_(self.ESTIMATE_ORIGIN)
        self._hide_button = self.addNormalRoundButtonWithTitle_action_(MiscStrings.hide_button, self.handleHideButton_)
        self._hide_button.setKeyEquivalent_(ENTER_KEY)
        self._hide_button.alignRightInSuperview()
        self._hide_button.alignBottomInSuperview()
        self._cancel_button = self.addNormalRoundButtonWithTitle_action_(MiscStrings.cancel_button, self.handleCancelButton_)
        self._cancel_button.placeLeftOfButton_(self._hide_button)
        self.addSubview_(self._thumbnail)
        self.addSubview_(self._label)
        self.addSubview_(self._progress_bar)
        self.addSubview_(self._estimate)

        @message_sender(AppHelper.callAfter)
        def handleMessage(message):
            self._label.setStringValue_(message)
            self._label.sizeToFit()

        @message_sender(AppHelper.callAfter)
        def handleTotalBytes(total_bytes):
            self._progress_bar.setIndeterminate_(YES if total_bytes == 0 else NO)
            self._progress_bar.setMinValue_(0.0)
            self._progress_bar.setMaxValue_(total_bytes)
            self._progress_bar.setDoubleValue_(self.ui.cur_bytes.get())

        @message_sender(AppHelper.callAfter)
        def handleCurBytes(cur_bytes):
            self._progress_bar.setDoubleValue_(cur_bytes)
            self._estimate.setStringValue_(self.ui.get_remaining_message())
            self._estimate.sizeToFit()

        @message_sender(AppHelper.callAfter)
        def handleLastPhoto(path):
            if path:
                if time.time() - self.last_photo_time > self.THUMBNAIL_TIMEOUT:
                    image = NSImage.alloc().initByReferencingFile_(unicode(path))
                    if image.isValid():
                        self._thumbnail.setBorder_(True)
                        self._thumbnail.setImage_(image)
                        self.last_photo_time = time.time()
            else:
                self._thumbnail.setBorder_(False)
                self._thumbnail.setImage_(Images.Box64)

        handleMessage(self.ui.message.get())
        handleTotalBytes(self.ui.total_bytes.get())
        handleCurBytes(self.ui.cur_bytes.get())
        handleLastPhoto(self.ui.last_photo.get())
        self.ui.message.register(handleMessage)
        self.ui.total_bytes.register(handleTotalBytes)
        self.ui.cur_bytes.register(handleCurBytes)
        self.ui.last_photo.register(handleLastPhoto)
開發者ID:,項目名稱:,代碼行數:70,代碼來源:


注:本文中的AppKit.NSFont.smallSystemFontSize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。