Beispiel #1
0
def get_appex_attachments(self, type):
    """AppEx: Get attachments"""
    if type == 'imagePIL':
        items = appex.get_images()
    elif type == 'image':
        items = appex.get_attachments('public.jpeg')
    return items
Beispiel #2
0
def getSelectImages():
    _sizs = []
    _scales = []
    images = appex.get_images()
    if len(images) > 1:
        for _im in images:
            #if i < max_imags:
            image_list.append(_im)
            _sizs.append(_im.size)
            (w, h) = _im.size
            _scales.append(round(w / h, 2))

    print('select images:{}{}'.format(_sizs, _scales))
    return image_list
	def run(self, input=''):
		console.alert(title='Not complete', message='Does not work',button1='Ok',hide_cancel_button=True)
		if not appex.is_running_extension():
			console.alert(title='Error', message='Not running from app extension',button1='Ok',hide_cancel_button=True)
		else:
			try:
				allowMultiple = self.get_param_by_name('allowMultiple').value
				if allowMultiple:
					images = appex.get_images()
				else:
					images = appex.get_image()
				ev = ElementValue(type='image',value=images)
				return ev
			except error:
				console.alert(title='Error', message='error: {}'.format(error),button1='Ok',hide_cancel_button=True)
import appex, console

data = []
data.append(appex.get_attachments())
data.append(appex.get_file_paths())
data.append(appex.get_images())
data.append(appex.get_text())
data.append(appex.get_urls())
data.append(appex.get_web_page_info())

keys = ['attachments', 'file paths', 'images', 'text', 'urls', 'web page']

data_dict = dict(zip(keys, data))
for key in data_dict.keys():
    #print(key, type(data_dict[key]))
    if type(data_dict[key]) == type(dict()):
        for item in data_dict[key].keys():
            print(item, type(data_dict[key][item]))
    elif type(data_dict[key]) == type(list()):
        for part in data_dict[key]:
            print(type(part))
    else:
        print('fart')

#for datum in data:
#print(type(datum))
#console.alert("fart", str(type(datum)), "okay")
#console.alert("fart", str(len(datum), "okay"))
Beispiel #5
0
    actions = [ "addalbum", "addday", "addphoto" ]
    url = "http://mybizcloud.ru/album/upload"
    files = {'file': iFile}
    data = {
        "cmd":actions[sender.superview['action'].selected_index],
        "title":sender.superview['descr'].text,
        "parent":sender.superview['parentid'].text,
        "ord":"2"
    }
    r = requests.post(url, files=files, data=data)
    sender.superview['comments'].text = r.text
    #sender.title = r.text

    #resTxt = sender.superview['action'].segments[sender.superview['action'].selected_index] + "\n"
    #resTxt += sender.superview['parentid'].text + "\n"
    #resTxt += sender.superview['descr'].text + "\n"
    #sender.superview['comments'].text = resTxt
    
imgList = appex.get_images_data()
iFiles = appex.get_images()
iFile = imgList[0]

#fList = []
#for i in range(len(imgList)):
#    fnn = iFiles[i].filename
#    sz = len(imgList[i])
#    fList.append('fn:'+fnn+', sz:'+str(sz))
#fileInfo = "*".join(fList)

ui.load_view('test-brn').present('sheet')