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


Python objc.YES属性代码示例

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


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

示例1: getURL

# 需要导入模块: import objc [as 别名]
# 或者: from objc import YES [as 别名]
def getURL(self, webview):
            req = REQ.get()
            WebkitLoad.httpout = req[0]
            WebkitLoad.req_url = req[1]
            WebkitLoad.req_img = req[2]
            WebkitLoad.req_map = req[3]

            if WebkitLoad.req_url == "http://wrp.stop/" or WebkitLoad.req_url == "http://www.wrp.stop/":
                print ">>> Terminate Request Received"
                AppKit.NSApplication.sharedApplication().terminate_(None)

            nsurl = Foundation.NSURL.URLWithString_(WebkitLoad.req_url)
            if not (nsurl and nsurl.scheme()):
                nsurl = Foundation.NSURL.alloc().initFileURLWithPath_(WebkitLoad.req_url)
            nsurl = nsurl.absoluteURL()

            Foundation.NSURLRequest.setAllowsAnyHTTPSCertificate_forHost_(objc.YES, nsurl.host())

            self.resetWebview(webview)
            webview.mainFrame().loadRequest_(Foundation.NSURLRequest.requestWithURL_(nsurl))
            if not webview.mainFrame().provisionalDataSource():
                print " ... not a proper url?"
                RESP.put('')
                self.getURL(webview) 
开发者ID:tenox7,项目名称:wrp,代码行数:26,代码来源:wrp.py

示例2: getURL

# 需要导入模块: import objc [as 别名]
# 或者: from objc import YES [as 别名]
def getURL(self, webview):
        if self.urls:
            if self.urls[0] == '-':
                url = sys.stdin.readline().rstrip()
                if not url:
                    AppKit.NSApplication.sharedApplication().terminate_(None)
            else:
                url = self.urls.pop(0)
        else:
            AppKit.NSApplication.sharedApplication().terminate_(None)

        nsurl = Foundation.NSURL.URLWithString_(url)
        if not (nsurl and nsurl.scheme()):
                nsurl = Foundation.NSURL.alloc().initFileURLWithPath_(url)
        nsurl = nsurl.absoluteURL()

        if self.options.ignore_ssl_check:
            Foundation.NSURLRequest.setAllowsAnyHTTPSCertificate_forHost_(objc.YES, nsurl.host())

        print "Fetching", nsurl, "..."
        self.resetWebview(webview)
        scriptobject = webview.windowScriptObject()
        scriptobject.setValue_forKey_(Webkit2PngScriptBridge.alloc().init(),
                                      'webkit2png')

        webview.mainFrame().loadRequest_(Foundation.NSURLRequest.requestWithURL_(nsurl))
        if not webview.mainFrame().provisionalDataSource():
            print " ... not a proper url?"
            self.getURL(webview) 
开发者ID:tenox7,项目名称:wrp,代码行数:31,代码来源:webkit2png.py

示例3: saveImages

# 需要导入模块: import objc [as 别名]
# 或者: from objc import YES [as 别名]
def saveImages(self,bitmapdata,filename,options):
        # save the fullsize png
        if options.fullsize:
            bitmapdata.representationUsingType_properties_(AppKit.NSPNGFileType,None).writeToFile_atomically_(filename + ".png",objc.YES)

        if options.thumb or options.clipped:
            # work out how big the thumbnail is
            width = bitmapdata.pixelsWide()
            height = bitmapdata.pixelsHigh()
            thumbWidth = (width * options.scale)
            thumbHeight = (height * options.scale)

            # make the thumbnails in a scratch image
            scratch = AppKit.NSImage.alloc().initWithSize_(
                    Foundation.NSMakeSize(thumbWidth,thumbHeight))
            scratch.lockFocus()
            AppKit.NSGraphicsContext.currentContext().setImageInterpolation_(
                    AppKit.NSImageInterpolationHigh)
            thumbRect = Foundation.NSMakeRect(0.0, 0.0, thumbWidth, thumbHeight)
            clipRect = Foundation.NSMakeRect(0.0,
                    thumbHeight-options.clipheight,
                    options.clipwidth, options.clipheight)
            bitmapdata.drawInRect_(thumbRect)
            thumbOutput = AppKit.NSBitmapImageRep.alloc().initWithFocusedViewRect_(thumbRect)
            clipOutput = AppKit.NSBitmapImageRep.alloc().initWithFocusedViewRect_(clipRect)
            scratch.unlockFocus()
           
            # save the thumbnails as pngs
            if options.thumb:
                thumbOutput.representationUsingType_properties_(
                        AppKit.NSPNGFileType,None
                    ).writeToFile_atomically_(filename + "-thumb.png",objc.YES)
            if options.clipped:
                clipOutput.representationUsingType_properties_(
                        AppKit.NSPNGFileType,None
                    ).writeToFile_atomically_(filename + "-clipped.png",objc.YES) 
开发者ID:tenox7,项目名称:wrp,代码行数:38,代码来源:picidae.py

示例4: saveImages

# 需要导入模块: import objc [as 别名]
# 或者: from objc import YES [as 别名]
def saveImages(self, bitmapdata, filename, options):
        # save the fullsize png
        if options.fullsize:
            bitmapdata.representationUsingType_properties_(
                AppKit.NSPNGFileType,
                None
            ).writeToFile_atomically_(filename + "-full.png", objc.YES)

        if options.thumb or options.clipped:
            # work out how big the thumbnail is
            width = bitmapdata.pixelsWide()
            height = bitmapdata.pixelsHigh()
            thumbWidth = (width * options.scale)
            thumbHeight = (height * options.scale)

            # make the thumbnails in a scratch image
            scratch = AppKit.NSImage.alloc().initWithSize_(
                Foundation.NSMakeSize(thumbWidth, thumbHeight))
            scratch.lockFocus()
            AppKit.NSGraphicsContext.currentContext().setImageInterpolation_(
                AppKit.NSImageInterpolationHigh)
            thumbRect = Foundation.NSMakeRect(0.0, 0.0, thumbWidth,
                                              thumbHeight)
            clipRect = Foundation.NSMakeRect(
                0.0,
                thumbHeight-options.clipheight,
                options.clipwidth,
                options.clipheight)
            bitmapdata.drawInRect_(thumbRect)
            thumbOutput = AppKit.NSBitmapImageRep.alloc()\
                .initWithFocusedViewRect_(thumbRect)
            clipOutput = AppKit.NSBitmapImageRep.alloc()\
                .initWithFocusedViewRect_(clipRect)
            scratch.unlockFocus()

            # save the thumbnails as pngs
            if options.thumb:
                thumbOutput.representationUsingType_properties_(
                    AppKit.NSPNGFileType, None).writeToFile_atomically_(
                        filename + "-thumb.png", objc.YES)
            if options.clipped:
                clipOutput.representationUsingType_properties_(
                    AppKit.NSPNGFileType, None).writeToFile_atomically_(
                        filename + "-clipped.png", objc.YES) 
开发者ID:tenox7,项目名称:wrp,代码行数:46,代码来源:webkit2png.py

示例5: webView_didFinishLoadForFrame_

# 需要导入模块: import objc [as 别名]
# 或者: from objc import YES [as 别名]
def webView_didFinishLoadForFrame_(self,webview,frame):
        # don't care about subframes
        if (frame == webview.mainFrame()):
            view = frame.frameView().documentView()

            self.resizeWebview(view)

            URL = frame.dataSource().initialRequest().URL().absoluteString()

            for fl in glob.glob("webrender-*.gif"):
                os.remove(fl)

            GIF = "webrender-%s.gif" % (random.randrange(0,1000))

            bitmapdata = self.captureView(view)  
            bitmapdata.representationUsingType_properties_(AppKit.NSGIFFileType,None).writeToFile_atomically_(GIF,objc.YES)

            myurl = "http://%s:%s%s" % (socket.gethostbyname(socket.gethostname()), os.getenv("SERVER_PORT"), os.getenv("SCRIPT_NAME"))

            print "Content-type: text/html\r\n\r\n"
            print "<!-- webrender.py by Antoni Sawicki -->"
            print "<html><head><title>Webrender - %s</title></head><body><table border=\"0\"><tr>" % (URL)
            print "<td><form action=\"%s\">" % (myurl)
            print "<input type=\"text\" name=\"url\" value=\"%s\" size=\"80\">" % (URL)
            print "<input type=\"submit\" value=\"go\">"
            print "</form></td><td>"
            print "<form action=\"%s\">" % (myurl)
            print "<input type=\"text\" name=\"search\" value=\"\" size=\"20\">"
            print "<input type=\"submit\" value=\"search\">"
            print "</form></td></tr></table>"
            print "<img src=\"../%s\" alt=\"webrender\" usemap=\"#map\" border=\"0\">" % (GIF)


            # Analyse HTML and get links
            print "<map name=\"map\">";
            
            domdocument = frame.DOMDocument()
            domnodelist = domdocument.getElementsByTagName_('A')
            i = 0
            while  i < domnodelist.length():
            	# linkvalue
            	value = domnodelist.item_(i).valueForKey_('href')
            	
            	# position-rect
            	myrect = domnodelist.item_(i).boundingBox()
            	
            	xmin = Foundation.NSMinX(myrect)
            	ymin = Foundation.NSMinY(myrect)
            	xmax = Foundation.NSMaxX(myrect)
            	ymax = Foundation.NSMaxY(myrect)
            	
            	# print Link
            	escval = string.replace( string.replace(value, "?", "TNXQUE"), "&", "TNXAMP" )
            	print "<area shape=\"rect\" coords=\"%i,%i,%i,%i\" alt=\"\" href=\"%s?url=%s\"></area>" % (xmin, ymin, xmax, ymax, myurl, escval)
            	i += 1
            
            print "</map>"
            print "</body></html>"
            self.getURL(webview) 
开发者ID:tenox7,项目名称:wrp,代码行数:61,代码来源:webrender.py


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