Exemplo n.º 1
0
    def set_url(self, value):
        if value:
            if self.interface.url.startswith('file://'):
                url = NSURL.fileURLWithPath(self.interface.url[7:])
            else:
                url = NSURL.URLWithString(self.interface.url)

            request = NSURLRequest.requestWithURL_(url)
            self.native.loadRequest_(request)
Exemplo n.º 2
0
 def load_image(self, path):
     # If a remote URL is provided, use the download from NSData (similar to toga-cocoa)
     if path.startswith('http://') or path.startswith('https://'):
         self.native = UIImage.imageWithData_(
             NSData.dataWithContentsOfURL_(NSURL.URLWithString_(path)))
     else:
         self.native = UIImage.alloc().initWithContentsOfFile_(
             self.__get_full_path(path))
Exemplo n.º 3
0
    def set_url(self, value):
        if value:
            if self.interface.url.startswith('file://'):
                url = NSURL.fileURLWithPath(self.interface.url[7:])
            else:
                url = NSURL.URLWithString(self.interface.url)

            request = NSURLRequest.requestWithURL_(url)
            self.native.loadRequest_(request)
Exemplo n.º 4
0
    def __init__(self, interface, path=None, url=None):
        self.interface = interface
        self.path = path
        self.url = url

        if path:
            self.native = UIImage.alloc().initWithContentsOfFile_(str(path))
        elif url:
            # If a remote URL is provided, use the download from NSData
            self.native = UIImage.imageWithData_(
                NSData.dataWithContentsOfURL_(NSURL.URLWithString_(path)))
Exemplo n.º 5
0
 def set_content(self, root_url, content):
     self.native.loadHTMLString_baseURL_(content,
                                         NSURL.URLWithString_(root_url))
Exemplo n.º 6
0
 def set_url(self, value):
     if value:
         request = NSURLRequest.requestWithURL_(NSURL.URLWithString_(self.interface.url))
         self.native.loadRequest_(request)