Beispiel #1
0
def main():
	global wk
	UIScreen = objc_util.ObjCClass('UIScreen')
	
	if len(UIScreen.screens()) > 1:
		second_screen = UIScreen.screens()[1]
		second_screen.overscanCompensation = 0
		bounds = second_screen.bounds()
		
		UIWindow = objc_util.ObjCClass('UIWindow')
		second_window = UIWindow.alloc().initWithFrame_(bounds)
		second_window.setScreen(second_screen)
		second_window.makeKeyAndVisible()
		
		wk = objc_util.ObjCClass('WKWebView').alloc().initWithFrame_(objc_util.CGRect((0, 0), (second_screen.bounds().size.width, second_screen.bounds().size.height - 1))).autorelease()
		second_window.addSubview(wk)
		
		request = objc_util.ObjCClass('NSURLRequest').alloc().init()
		nsurl = objc_util.nsurl('http://localhost:8080')
		x = request.initWithURL_(nsurl)
		wk.loadRequest_(x)
	else:
		print('No secondary screen detected. Connect your Looking Glass.')
		v.close()
		s.stop_server()
		quit()
Beispiel #2
0
    def __init__(self, *args, **kwargs):
        super().__init__(self, *args, **kwargs)

        self._view = objc_util.ObjCClass("MKMapView").new()
        self._view.setFrame_(
            objc_util.CGRect(objc_util.CGPoint(0, 0),
                             objc_util.CGSize(self.width, self.height)))
        self._view.setAutoresizingMask_(18)  # W+H
        objc_util.ObjCInstance(self).addSubview_(self._view)

        self.animated = True
Beispiel #3
0
	def __init__(self, chosen_pic):
		self.MLModel = objc_util.ObjCClass('MLModel')
		self.VNCoreMLModel = objc_util.ObjCClass('VNCoreMLModel')
		self.VNCoreMLRequest = objc_util.ObjCClass('VNCoreMLRequest')
		self.VNImageRequestHandler = objc_util.ObjCClass('VNImageRequestHandler')
		
		result = self.classify_asset(chosen_pic)
		if result:
			resultString = str(result)
			resultWidth = int(resultString[resultString.find('width=') + 6:resultString.find(' ', resultString.find('width=') + 6)])
			resultHeight = int(resultString[resultString.find('height=') + 7:resultString.find(' ', resultString.find('height=') + 7)])
			CIImage = objc_util.ObjCClass('CIImage')
			pixelBuffer = result.pixelBuffer
			ci_img = CIImage.imageWithCVPixelBuffer_(pixelBuffer())		
			ctx = objc_util.ObjCClass('CIContext').context()
			cg_img = ctx.createCGImage_fromRect_(ci_img, objc_util.CGRect(objc_util.CGPoint(0, 0), objc_util.CGSize(resultWidth, resultHeight)))
			ui_img = objc_util.UIImage.imageWithCGImage_(cg_img)
			self.png_data = objc_util.uiimage_to_png(objc_util.ObjCInstance(ui_img))
Beispiel #4
0
# coding: utf-8

# https://github.com/jsbain/objc_hacks/blob/master/objcstuff.py

import objc_util, ui

v = ui.View()

vv = objc_util.ObjCInstance(v._objc_ptr)

wnd = objc_util.ObjCClass('UIWindow').alloc()
r = objc_util.CGRect(objc_util.CGPoint(0, 0), objc_util.CGSize(100, 100))

wnd.initWithFrame_(r)