Exemplo n.º 1
0
def main():
    if appex.is_running_extension():
        if appex.get_url():
            text = appex.get_url()
        else:
            text = appex.get_text()
    else:
        text = clipboard.get()
    if not text:
        text = console.input_alert('Jira ID')

    if text:
        ids = JIRA_PAT.findall(text)
        if len(ids) == 0:
            text = console.input_alert('Jira ID')
        ids = JIRA_PAT.findall(text)
        if len(ids) > 0:
            id = ids[0]
            base_url, username = get_conf_info()
            url = '%s/browse/%s' % (base_url, id)
            console.hud_alert('Jira ID: %s' % id)
            app=UIApplication.sharedApplication()
            url=nsurl(url)
            app.openURL_(url)
        else:
            console.hud_alert('No Jira ID found.')
    else:
        console.hud_alert('No input text found.')
    if appex.is_running_extension():
        appex.finish()
Exemplo n.º 2
0
def main():
    
    # get text from app share or clipboard
    if appex.is_running_extension():
        text = appex.get_url()
    else:
        text = clipboard.get().strip()

    # get url
    url = ''
    try:
        url = [ mgroups[0] for mgroups in GRUBER_URLINTEXT_PAT.findall(text) ][0]
    except:
        url = console.input_alert("URL", "", url)
    if url:
        if not 'http' in url:
            url = 'http://' + url
    else:
        console.hud_alert('No URL found.')
        sys.exit()

    sel = console.alert('Save: %s ?' % url, button1='File', button2='Clipboard')

    # get url info
    url_items = url.split("?")[0].split("/")
    # if url ends with /, last item is an empty string
    file_name = url_items[-1] if url_items[-1] else url_items[-2]
    try:
        content = urllib2.urlopen(url).read()
    except Exception as e:
        console.alert(e.message)
        sys.exit()

    if sel == 1:
        # get file save info
        save_dir_name = get_save_dir()
        save_dir = os.path.join(BASE_DIR, save_dir_name)
        file_path = os.path.join(save_dir, file_name)
        try:
            # check dirs and save
            if not os.path.exists(save_dir):
                os.makedirs(save_dir)
            with open(file_path, 'w') as f:
                f.write(content)
                f.close()
            # wrapup
            console.alert('Saved to: %s' % file_path, hide_cancel_button=True, button1='OK')
        except Exception as e:
            console.alert(str(e), button1='OK',hide_cancel_button=True)
    elif sel == 2:
        clipboard.set(content)


    if appex.is_running_extension():
        appex.finish()
Exemplo n.º 3
0
def main():
    if appex.is_running_extension():
        url = appex.get_url()
    else:
        url = clipboard.get().strip()
        if not RE_URL.match(url):
            try:
                url = console.input_alert("Enter gamefaqs URL", "", "https://www.gamefaqs.com/")
            except KeyboardInterrupt:
                sys.exit(0)
    
    newurl = "{0}?print=1".format(url)
    #baseurl = http://www.gamefaqs.com/ps3/959558-fallout-new-vegas/faqs/61226
    if RE_URL.match(url):
        h = html2text.HTML2Text()
        r = requests.get(
                         url=newurl, 
                         headers={"User-agent": "Mozilla/5.0{0:06}".format(random.randrange(999999))}
                         )
        html_content = r.text.decode('utf-8')
        rendered_content = html2text.html2text(html_content)
        filename = url.partition("gamefaqs.com/")[-1].partition("/")[-1].partition("/faqs")[0]+".txt"
        filepath = os.path.join(os.path.expanduser("~/Documents"), filename)
        
        with open(filepath, "w") as fo:
            fo.write(rendered_content)
        
        console.hud_alert('Success! Saved {0}'.format(filename), "success")
Exemplo n.º 4
0
	def expand_dir_action(self, sender):
		'''Invoked by 'expand' button'''
		row = self.row_for_view(sender)
		entry = self.flat_entries[row]
		if entry.expanded:
			if not appex.is_running_extension():										# added by cvp
				sender.image = ui.Image.named('ExpandFolder')
			else:																										# added by cvp		
				sender.image = ui.Image.named('iob:arrow_right_b_24')	# added by cvp
		else:
			if not appex.is_running_extension():										# added by cvp
				sender.image = ui.Image.named('CollapseFolder')
			else:																										# added by cvp		
				sender.image = ui.Image.named('iob:arrow_down_b_24')	# added by cvp
		self.toggle_dir(row)
		self.update_done_btn()
def main():
    if appex.is_running_extension():
        file_paths = appex.get_file_paths()
        assert len(file_paths) == 1, 'Invalid file paths: {}'.format(file_paths)
        srce_path = file_paths[0]
        if '/tmp/' in srce_path:
            dest_path = srce_path.split('/tmp/')[-1]
        else:
            dest_path = srce_path.split('/Repositories/')[-1]
        dest_path = os.path.join(from_wc, dest_path)
        file_path, file_name = os.path.split(dest_path)
        if not os.path.exists(file_path):
            os.makedirs(file_path)
        if os.path.isdir(srce_path):
            shutil.rmtree(dest_path, ignore_errors=True)
            print(shutil.copytree(srce_path, dest_path))
        else:
            print(shutil.copy2(srce_path, dest_path))
        print('{} was copied to {}'.format(file_name, file_path))
    else:
        print('''* In Working Copy app select a repo, file, or directory to be
copied into Pythonista.  Click the Share icon at the upperight.  Click Run
Pythonista Script.  Pick this script and click the run button.  When you return
to Pythonista the files should be in the 'from Working Copy'
directory.'''.replace('\n', ' ').replace('.  ', '.\n* '))
Exemplo n.º 6
0
def main():
    if appex.is_running_extension():
        for func in (appex.get_attachments, appex.get_file_path,
            appex.get_file_paths, appex.get_image, appex.get_images,
            appex.get_text, appex.get_url, appex.get_urls,
            appex.get_vcard, appex.get_vcards):
            print('{:<11} : {}'.format(func.func_name.partition('_')[2], func()))
def insert_daily_word_count_event(text):
    word_count_event = _create_calendar_event_from_text(text)

    if appex.is_running_extension():
        return _event_response(word_count_event)
    else:
        return _test_event_response(word_count_event)
Exemplo n.º 8
0
def main():
    text = None
    if len(sys.argv) > 1:
        text = sys.argv[1]
    else:
        try:
            import appex
            import clipboard
            if appex.is_running_extension():
                if appex.get_url():
                    text = appex.get_url()
                else:
                    text = appex.get_text()
            else:
                text = clipboard.get()
        except ImportError:
            pass

    if text:
        keys = JIRA_PAT.findall(text)
        if len(keys) > 0:
            key = keys[0]
            print('Found Jira ID: %s' % key)
        else:
            key = raw_input('Jira ID:')

        base_url, username, jsessionid = get_conf_info()

        if check_jsessionid(base_url, jsessionid):
            get_issue_info(base_url, jsessionid, key)
        else:
            jsessionid = get_new_cookie(base_url, username)
            get_issue_info(base_url, jsessionid, key)
    else:
        print('No input text found.')
Exemplo n.º 9
0
	def __init__(self):
		self.hide_title_bar=True
		self.elements_view = None
		self.element_management_view = None
		self.element_creation_view = None
		self.flow_creation_view = None
		self.navigation_view = None
		self.flow_view = None
		self.element_runtime_view = None
		self.element_manager = None
		self.flow_manager = None
		self.theme_manager = None
		self.elements = None
		self.selectedElements = []
		self.selectedFlowType = ''
		self.flows = []
		self.selectedFlow = None
		self.setup_thememanager()
		self.setup_elementsmanager()
		self.setup_flowsmanager()		
		self.get_valid_elements()
		self.get_flows(appex.is_running_extension())
		self.setup_elementsview()
		self.setup_elementmanagementview()
		self.setup_elementcreationview()
		self.setup_flowsview()
		self.setup_flowcreationview()
		self.setup_elementruntimeview()
		self.setup_navigationview(self.flow_view)
Exemplo n.º 10
0
def main():
	if not appex.is_running_extension():
		print 'This script is intended to be run from the sharing extension.'
		return
	images = appex.get_attachments('public.jpeg')
	if images:
		a = get_exif(images[0])
		if a.get('GPSInfo'):
			lat = [float(x)/float(y) for x, y in a['GPSInfo'][2]]
			latref = a['GPSInfo'][1]
			lon = [float(x)/float(y) for x, y in a['GPSInfo'][4]]
			lonref = a['GPSInfo'][3]
			lat = lat[0] + lat[1]/60 + lat[2]/3600
			lon = lon[0] + lon[1]/60 + lon[2]/3600
			if latref == 'S':
				lat = -lat
			if lonref == 'W':
				lon = -lon
			loc_str = '%f, %f' % (lat, lon)
			print 'Latitude/Longitude:'
			print loc_str
			clipboard.set(loc_str)
			print '(copied to the clipboard -- you can paste this in the search field of Maps to go to the location where the photo was taken)'
		else:
			print 'No location data found'
	else:
		print 'No input image found'
Exemplo n.º 11
0
 def __init__(self):
     self.hide_title_bar = True
     self.elements_view = None
     self.element_management_view = None
     self.element_creation_view = None
     self.flow_creation_view = None
     self.navigation_view = None
     self.flow_view = None
     self.element_runtime_view = None
     self.element_manager = None
     self.flow_manager = None
     self.theme_manager = None
     self.home_screen_manager = None
     self.elements = None
     self.selectedElements = []
     self.selectedFlowType = ""
     self.flows = []
     self.selectedFlow = None
     self.flow_passed_in = None
     self.settings_manager = None
     self.setup_settingsmanager()
     self.setup_thememanager()
     self.setup_homescreenmanager()
     self.setup_elementsmanager()
     self.setup_flowsmanager()
     self.get_valid_elements()
     self.get_flows(appex.is_running_extension())
     self.setup_elementsview()
     self.setup_elementmanagementview()
     self.setup_elementcreationview()
     self.setup_flowsview()
     self.setup_flowcreationview()
     self.setup_elementruntimeview()
     self.setup_navigationview(self.flow_view)
     self.check_params()
Exemplo n.º 12
0
def main():
	if not appex.is_running_extension():
		print 'ERROR: This script is meant to be run from the sharing extension.'
	else:
		input_files = appex.get_attachments()
		for input_file in input_files:
			head, tail = os.path.split(input_file)
			shutil.copy(input_file, tail)
Exemplo n.º 13
0
def main():
    text = None
    if appex.is_running_extension():
        text = appex.get_text()
    if not text:
        text = console.input_alert('Jira Query')
    if text:
        base_url, username = get_conf_info()
        url = '%s/issues/?jql=%s' % (base_url, urllib.quote_plus(text))
        console.hud_alert('Launching Jira')
        app=UIApplication.sharedApplication()
        url=nsurl(url)
        app.openURL_(url)
    else:
        console.hud_alert('No input text found.')
    if appex.is_running_extension():
        appex.finish()
Exemplo n.º 14
0
def save(folder):
    if appex.is_running_extension():
        sFp = appex.get_file_path()
        if sFp:
            console.hud_alert('Saving...')
            print 'Destination folder: ', os.path.join(folder, os.path.basename(sFp))
            shutil.copy(sFp, folder)
            console.hud_alert('Saved')
def main():
    if appex.is_running_extension():
        attachments = appex.get_attachments()
        assert attachments and attachments[0].rstrip(), "Ain't gots no text!!"
        file_name = 'from Goodreader_{:%Y_%m_%d_%H_%M_%S}.txt'.format(datetime.datetime.now())
        with open(file_name, 'w') as out_file:
            out_file.write(attachments[0])
        print('{} bytes written to {}.'.format(len(attachments[0]), file_name))
def main():
    if not appex.is_running_extension():
        print 'This script is intended to be run from the sharing extension.'
        return
    url = appex.get_url()
    if not url:
        print 'No input url'
        return
    open_in_safari_vc(url)
Exemplo n.º 17
0
def main():
	if appex.is_running_extension():
		text = appex.get_url()
		with codecs.open('LinkStack.txt', 'a', 'utf-8') as f:
			f.write('%s\n' % (text))
		count=0
		with codecs.open('LinkStack.txt', 'r', 'utf-8') as f:
			for line in f:
				count = count + 1
		console.alert('ClippedLink : %i' % count, '', 'OK', hide_cancel_button=True)
Exemplo n.º 18
0
	def saveflow(self,sender):
		if self.flow_creation_view.data_source.title == '':
			console.alert(title='Error',message='Please enter a title',button1='Ok',hide_cancel_button=True)
		else:
			self.selectedFlowType = self.flow_creation_view.data_source.flowType
			self.flow_manager.save_flow(self.flow_creation_view.data_source.title, self.selectedElements, self.selectedFlowType)
			console.alert(title='Success',message='Flow has been saved',button1='Ok',hide_cancel_button=True)
			self.get_flows(appex.is_running_extension())
			self.flow_view.data_source.flows = self.flows
			self.flow_view.reload_data()
Exemplo n.º 19
0
def main():
	if not appex.is_running_extension():
		print('This script is intended to be run from the sharing extension.')
		return
	url = appex.get_url()
	if not url:
		print('No input URL found.')
		return
	print(url)
	img = qrcode.make(url)
	img.show()
Exemplo n.º 20
0
 def get_photo(self):
     if appex.is_running_extension():
         p = appex.get_images_data()
         if p == None:
             print("No photo selected, exiting.")
             exit(0)
         else:
             self.p = p
     else:
         print("Please run as an extension in Photos, exiting.")
         exit(0)
Exemplo n.º 21
0
def main():
	if not appex.is_running_extension():
		print('This script is intended to be run from the sharing extension.')
		return

	name = appex.get_attachments()[0]
	if not name:
		console.hud_alert('Nothing to save?')
		return
	shutil.copy(name, os.path.expanduser('~/Documents/Downloads/'))
	console.hud_alert('done')
Exemplo n.º 22
0
def main():
    if not appex.is_running_extension():
        url = 'http://google.com/hmm'
    else:
        url = appex.get_url()
    if url:
        # TODO: Your own logic here...
        print 'Input URL: %s' % (url,)
        p = urlparse(url)
        print(p.path)
    else:
        print 'No input URL found.'
Exemplo n.º 23
0
def main():
    if not appex.is_running_extension():
        text = clipboard.get()
    else:
        text = appex.get_text()
    if text:
        ids = JIRA_PAT.findall(text)
        if len(ids) > 0:
            id = ids[0]
            base_url = get_base_url()
            url = '%s%s' % (base_url, id)
            console.hud_alert('Jira ID: %s' % id)
            app=UIApplication.sharedApplication()
            url=nsurl('http://'+url)
            app.openURL_(url)
        else:
            console.hud_alert('No Jira ID found.')
    else:
        console.hud_alert('No input text found.')
    if appex.is_running_extension():
        appex.finish()
Exemplo n.º 24
0
def main():
	if not appex.is_running_extension():
		print 'Running in Pythonista app, using test data...\n'
		url = 'http://example.com'
	else:
		url = appex.get_url()
	if url:
		out_file = open(url.split('/')[-1], 'wb')
		out_file.write(requests.get(url).content)
		out_file.close()
	else:
		print 'No input URL found.'
Exemplo n.º 25
0
def main():
    if appex.is_running_extension():
        content = None
        attachments = appex.get_attachments()
        filepaths = appex.get_file_path()
        
        if attachments and attachments[0].rstrip() and appex.get_file_path():
            with open(attachments[0], 'r') as f:
                content = f.read()
            attachment_name = filepaths.split(os.sep)[-1]
        else:
            print('No attachment found.')
            sys.exit(1)
        
        sel = console.alert('Save: %s' % attachment_name, button1='File', button2='Clipboard')

        if sel == 1:
            file_name = '{:%Y%m%d-%H%M%S}_{}'.format(datetime.datetime.now(), attachment_name)
            save_dir_name = get_save_dir()
            save_dir_path = os.path.join(BASE_DIR, save_dir_name)
            save_file_rel_path = os.path.join(save_dir_name, file_name)
            save_file_path = os.path.join(BASE_DIR, save_file_rel_path)
            
            try:
                # check dirs and save
                if not os.path.exists(save_dir_path):
                    os.makedirs(save_dir_path)
                with open(save_file_path, 'w') as f:
                    f.write(content)
                # wrapup
                msg = 'Saved: %s' % save_file_rel_path
            except Exception as e:
                msg = str(e)
            console.alert(msg, button1='OK', hide_cancel_button=True)
        elif sel == 2:
            clipboard.set(content)
    
        if appex.is_running_extension():
            appex.finish()
def main():
    if not appex.is_running_extension():
        return show_share_warning()
        # text = test_text()
    else:
        text = real_text()

    if text:
        result = insert_daily_word_count_event(text)
        hud_alert('Posted %s' % result['summary'], 
                    result['start']['date'])
    else:
        hud_alert('No input text found', 'error')
Exemplo n.º 27
0
def main():
	if not appex.is_running_extension():
		print('This script is intended to be run from the sharing extension.')
		return
	text = appex.get_text()
	if not text:
		print('No text input found.')
		return
	text = html2text(text)
	text = text.strip('* \n')
	words = text.split()
	sentences = [x for x in re.split(r'[\.?!]', text) if len(x) > 0]
	console.alert('Statistics', '%i words\n%i sentences\n%i characters' % (len(words), len(sentences), len(text)), 'OK', hide_cancel_button=True)
Exemplo n.º 28
0
def main():
    if not appex.is_running_extension():
        print 'Running in Pythonista app, using test data...\n'
        url = 'http://example.com'
    else:
        url = appex.get_url()
    if url:
        # TODO: Your own logic here...
        print 'Input URL: %s' % (url,)
        print 'Response headers:'
        print '\n'.join('%s: %s' % (k, v) for k, v in requests.head(url).headers.iteritems())
    else:
        print 'No input URL found.'
Exemplo n.º 29
0
def main():
    '''App extension logic, with unit tests if run within Pythonista'''

    if appex.is_running_extension():
        if appex.get_url():
            copy_url(appex.get_url())
            appex.finish()
        else:
            console.hud_alert('No input URL found', 'error')
    else:
        console.hud_alert('This script must be run from the sharing extension', 'error')
        import doctest
        doctest.testmod()
Exemplo n.º 30
0
	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)
Exemplo n.º 31
0
def main():
    if appex.is_running_extension():
        file_paths = appex.get_file_paths()
        assert len(file_paths) == 1, 'Invalid file paths: {}'.format(file_paths)
        srce_path = file_paths[0]
        dest_path = srce_path.split('/File Provider Storage/')[-1]
        dest_path = os.path.join(from_wc, dest_path)
        file_path, file_name = os.path.split(dest_path)
        if not os.path.exists(file_path):
            os.makedirs(file_path)
        if os.path.isdir(srce_path):
            shutil.rmtree(dest_path, ignore_errors=True)
            print(shutil.copytree(srce_path, dest_path))
        else:
            print(shutil.copy2(srce_path, dest_path))
        print('{} was copied to {}'.format(file_name, file_path))
    else:
        print('''* In Working Copy app select a repo, file, or directory to be
copied into Pythonista.  Click the Share icon at the upperight.  Click Run
Pythonista Script.  Pick this script and click the run button.  When you return
to Pythonista the files should be in the 'from Working Copy'
directory.'''.replace('\n', ' ').replace('.  ', '.\n* '))
Exemplo n.º 32
0
def main():
    if not appex.is_running_extension():
        print('Running in Pythonista app, using test data...\n')
        text = u"""
		- «project_name» @parallel(false) @due(«due»)
		- This task needs to be done at least 1 week before «project_name» is due @due(«due» -1w)
		- This task needs to be done at least 2 days before «project_name» is due @due(«due» -2d)
		"""
    else:
        text = appex.get_text()
    if text:
        print('Input text: %s' % text)
        out = fill_placeholders(text)
        if out == None:
            return
        print('\nPlaceholders filled:\n%s' % out)
        encoded_text = urllib.quote(out)
        omnifocus_url = "omnifocus:///paste?target=projects&content=%s" % encoded_text
        print('\nOmniFocus URL = %s\n' % omnifocus_url)
        webbrowser.open(omnifocus_url)
    else:
        print('No input text found.')
def main():
    console.clear()
    dest_path_short = '~/Documents/inbox'
    dest_path = os.path.expanduser(dest_path_short)
    if not os.path.isdir(dest_path):
        print(('Create ' + dest_path_short))
        os.mkdir(dest_path)
    if not appex.is_running_extension():
        print('Using clipboard content...')
        text = clipboard.get()
        assert text, 'No text on the clipboard!'
        resp = console.alert('Alert!',
                             'Choose File Extension',
                             '.py',
                             '.pyui',
                             hide_cancel_button=False)
        if resp == 1:
            ext = '.py'
        elif resp == 2:
            ext = '.pyui'
        filename = os.path.join(dest_path, 'clipboard')
        filename = getuniquename(filename, ext)
        while os.path.isfile(filename):
            filename = '{} {}{}'.format(root, filenum, extension)
            filenum += 1
        with open(filename, 'w') as f:
            f.write(text)
        print('Done!')
    else:
        file = appex.get_file_path()
        print(('Input path: %s' % file))
        filename = os.path.join(dest_path, os.path.basename(file))
        filename = getuniquename(filename, '')
        shutil.copy(file, filename)
    print(('Saved in %s' % dest_path_short))
    if not os.path.exists(filename):
        print((' > Error file %s not found !' % os.path.basename(filename)))
    else:
        print((' > as %s' % os.path.basename(filename)))
    def __init__(self):
        if appex.is_running_extension():
            # TODO: change 'primer_test_list.txt' to real primer list
            gene2num, num2gene, num2name = get_structured_primer_file(
                "primer_test_list.txt")

            self.text = appex.get_text()

            # Tree structure: {gene symbol: {primer number: primer name}
            self.res = pythontree()
            # We have all the Eurofins primer numbers in 'text', so search for them.
            for num in re.finditer(r'\d+', self.text):
                num = int(num.group())
                try:
                    self.res[num2gene[num]][str(num)] = num2name[num]
                except KeyError:
                    pass
                    #sys.exit(
                    #"Primer number '{}' in text could not be found in primer "
                    #"file.".format(num))

            pprint(self.res)
Exemplo n.º 35
0
def main():
    if appex.is_running_extension():
        images = appex.get_attachments('public.jpeg')
    else:
        print('Pick a photo to mask.')
        images = [pick_photo()]

    print(images)

    if not images:
        print('No input image found')
        return
    ci_img = load_ci_image(images[0])
    faces = find_faces(ci_img)
    if not faces:
        print('Error: No faces found in the photo.')
        return
    out_img = mask_faces(ci_img, faces)
    out_file = write_output(out_img)
    console.clear()
    console.show_image(out_file)
    console.alert('Tweet this image?')
Exemplo n.º 36
0
def main():
    if not appex.is_running_extension():
        print('This script is intended to be run from the sharing extension.')
        return
    img = appex.get_image()
    if not img:
        print('No input image')
        return
    if not img.mode.startswith('RGB'):
        img = img.convert('RGB')
    hist = img.histogram()
    max_h = float(max(hist))
    height = 240
    with ui.ImageContext(512, height) as ctx:
        a = 0.5
        rgb = [(1, 0, 0, a), (0, 1, 0, a), (0, 0, 1, a)]
        for i, color in enumerate(rgb):
            ui.set_color(color)
            for j, count in enumerate(hist[i * 256:i * 256 + 256]):
                bar_height = count / max_h * height
                ui.fill_rect(2 * j, height - bar_height, 2, bar_height)
        ctx.get_image().show()
Exemplo n.º 37
0
def main():
    input_dict = None
    if len(sys.argv) >= 2 and sys.argv[1] == 'quick':
        if appex.is_running_extension() and re.search('http*:\/\/[^\s]+', appex.get_attachments()[0]) is None:
            input_dict = appex.get_attachments()[0]
        else:
            clip = re.search('^(?!http)+', clipboard.get())
            if clip != None:
                input_dict = clipboard.get()
            
    input = input_dict or dialogs.text_dialog()
    if input:
        referenceViewController = UIReferenceLibraryViewController.alloc().initWithTerm_(input)

        rootVC = UIApplication.sharedApplication().keyWindow().rootViewController()
        tabVC = rootVC.detailViewController()

        referenceViewController.setTitle_("Definition: '{}'".format(input))
        referenceViewController.setPreferredContentSize_(CGSize(540, 540))
        referenceViewController.setModalPresentationStyle_(2)

        #tabVC.addTabWithViewController_(referenceViewController)
        tabVC.presentViewController_animated_completion_(referenceViewController, True, None)
Exemplo n.º 38
0
def main():
  if not appex.is_running_extension():
    print('Running in Pythonista app, using test data...\n')
    text = u"""
- «project_name» @parallel(false) @due(«due»)
- This task needs to be done at least 1 week before «project_name» is due @due(«due» -1w)
- This task needs to be done at least 2 days before «project_name» is due @due(«due» -2d)
"""
  else:
    text = '\n'.join(appex.get_text().split('\n')[1:])
  if text:
#    print 'Input text: %s' % text
    out = fill_placeholders(text)
    if out == None:
      return
#    print('\nPlaceholders filled:\n{}'.format(out))
    encoded_text = urllib.parse.quote(out)
    omnifocus_url = "omnifocus:///paste?target=projects&content=%s" % encoded_text
#    print '\nOmniFocus URL = %s\n' % omnifocus_url
    appex.finish()
    open_url(omnifocus_url)
  else:
    print('No input text found.')
Exemplo n.º 39
0
def main():
    if not appex.is_running_extension():
        print('Running standalone, grabbing last picture created')
        img = photos.get_recently_added_album().assets[-1].get_image()
    else:
        img = appex.get_image()
    if img:
        print("You passed in an image of size {}x{}".format(
            img.width, img.height))
        if img.width > max_image_size or img.height > max_image_size:
            print("Scaling down image since it's big")
            img.thumbnail((max_image_size, max_image_size), Image.ANTIALIAS)
            print("New size is {}x{}".format(img.width, img.height))

        img.show()
        print('Starting upload... wait for another line to be printed')

        # open file on server
        ssh = paramiko.SSHClient()
        ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
        ssh.connect('vvn.space', username='******')
        sftp = ssh.open_sftp()

        now = datetime.now()
        filename = "upload-{}-{}-{}_{}-{}-{}.jpg".format(
            now.year, now.month, now.day, now.hour, now.minute, now.second)
        file = sftp.file("public_html/" + filename, mode="w")

        img.save(file, "JPEG", quality=100)
        file.flush()
        sftp.close()
        ssh.close()

        clipboard.set("http://vvn.space/~vivlim/" + filename)
        print("done, url copied")
    else:
        print('No input image found')
Exemplo n.º 40
0
def main():
    get_path = None
    if appex.is_running_extension() and appex.get_file_path():
        get_path = appex.get_file_path()
        if not re.match(r'.+\.(ipa|zip)$', get_path):
            console.hud_alert('Not supported file types', 'error', 1)
            appex.finish()
            exit()
    else:
        console.hud_alert('No file input', 'error', 1)
        appex.finish()
        exit()

    plist = extract_plist_data(get_path)
    if plist is None:
        console.hud_alert('No Info.plist file', 'error', 1)
        appex.finish()
        exit()
    else:
        url_schemes = extract_scheme(plist)
        if url_schemes:
            result = dialogs.list_dialog('Select to Clips',
                                         url_schemes,
                                         multiple=True)
            if result:
                text = '\n'.join([elem + '://' for elem in result])
                clipboard.set(text)
                console.hud_alert('Copied Success!', '', 1)
                appex.finish()
                exit()
            else:
                appex.finish()
                exit()
        else:
            console.hud_alert('No Url Schemes', 'error', 1)
            appex.finish()
            exit()
Exemplo n.º 41
0
def main():
    if not appex.is_running_extension():
        print(
            'Running in Pythonista app. Use via sharing extension with a .zip file instead.'
        )
        exit(1)

    config = ConfigFile(config_path)
    if not config.key_exists('FIRST_RUN'):
        first_run(config)

    root = config.get('ROOT')
    dest = config.get('DEST')
    zip_src = appex.get_file_path()
    zip_name = zip_src.split(os.sep)[-1]

    cv = ConfirmView.load_view(dest, zip_name)
    cv.present()
    cv.wait_modal()

    if cv.proceed:
        new_dest = cv.path
        clear_first = cv.clearfirst
        if dest != new_dest:
            config.set('DEST', new_dest)
            dest = new_dest
            config.save()
        os.chdir(root)
        if clear_first and os.path.exists(dest):
            shutil.rmtree(dest)
        if not os.path.exists(dest):
            os.makedirs(dest)
        with ZipFile(zip_src, 'r') as zipo:
            zipo.extractall(dest)
        print('Done.')
    else:
        print('Cancelled by user.')
Exemplo n.º 42
0
def main():
    speech.stop()
    if not appex.is_running_extension():
        console.hud_alert('Reading clipboard')
        text = clipboard.get()
        url = None
    else:
        text = appex.get_text()
        url = appex.get_url()

    if url == None:
        try:
            url = [ mgroups[0] for mgroups in GRUBER_URLINTEXT_PAT.findall(text) ][0]
        except:
            pass

    if url != None:
        console.hud_alert('Reading: ' + url)
        h = html2text.HTML2Text()
        try:
            r = requests.get(
            url=url,
            headers={"User-agent": "Mozilla/5.0{0:06}".format(random.randrange(999999))})
        except Exception as e:
            console.alert(e.message)
            return True
        html_content = r.text.decode('utf-8')
        text = html2text.html2text(html_content)
    else:
        console.hud_alert('Reading text: ' + str(text))

    if text:
        speech.say(text)
        stop = console.alert('Done?', hide_cancel_button=True, button1='OK')
        speech.stop()
    else:
        console.hud_alert('No text found.')
Exemplo n.º 43
0
def main():
	if not appex.is_running_extension():
		print('This script is intended to be run from the sharing extension.')
		return
	par_url = appex.get_url()
	print(par_url)
	if not par_url:
		print('No input URL found.')
		return

	# url access
	res = urllib2.urlopen(par_url)
	# beautifulsoup, perse
	soup = BeautifulSoup(res.read())

	# img, search
	for link in soup.find_all('img'):
		# get image's URL
		img_url = link.get('src')
        	if img_url.startswith('//'):
            		img_url = 'http:' + img_url
		print(img_url)
		# 
		download(img_url)
Exemplo n.º 44
0
def main():
    if not appex.is_running_extension():
        print('This script is intended to be run from the sharing extension.')
        return
    text = appex.get_text().strip('* \n')
    if not text:
        print('No text input found.')
        return

    s = get_session()
    row_translates = get_row_translates(s, text)
    all_t = ""
    for t in row_translates:
        all_t += "- " + t["value"] + "\n"
    first_translate = row_translates[0]["value"]

    answer = console.alert(text,
                           '%s' % (all_t),
                           'Добавить в словарь',
                           'Отменить',
                           hide_cancel_button=True)
    if (answer == 1):
        add_word(s, text, first_translate)
        console.alert("Слово добавлено", "", 'OK', hide_cancel_button=True)
Exemplo n.º 45
0
 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)
Exemplo n.º 46
0
def main():
    if appex.is_running_extension():
        shared = appex.get_input()
        if shared: tasks = get_tasks(shared)
        for task in tasks:
            dialogs.share_text(task)
Exemplo n.º 47
0
def main():
    if not appex.is_running_extension():
        url = "www.example.com"
    else:
        url = appex.get_url()
Exemplo n.º 48
0
import re
import sys
import appex
import clipboard
import console
import webbrowser


# Find text to analyse

phases     = ''
draft_uuid = ''

if appex.is_running_extension():
  # 1. running as extension?
  phases = str(appex.get_text())
else:
  # 2. started with arguments?
  if len(sys.argv) > 1:
    draft = re.match('draft:(.*)', sys.argv[1])
    if draft:
      draft_uuid = draft.group(1)
      phases = ' '.join(sys.argv[2:])
    else:
      phases = ' '.join(sys.argv[1:])
  
# 3. text on clipboard?
if phases == '':
  phases = clipboard.get()

# 4. default sample text
Exemplo n.º 49
0
def main():
    if not appex.is_running_extension():
        print('running in pythonista--using test data\n')
        text = '''## Test Data
Generic test data!'''
    else:
        text = appex.get_text()

    if text:
        author         = cfg.post['post_author']
        gitlab_url     = cfg.post['gitlab_url']
        gitlab_user    = cfg.post['gitlab_user']
        gitlab_repo    = cfg.post['gitlab_repo']
        gitlab_token   = keychain.get_password('gitlab_token', gitlab_user) or ''
        dbx_token      = keychain.get_password('dbx_token', gitlab_user) or ''

        (title, text) = extract_title(text)
        filename = '%s-%s.md' % (date.today(), slug(title))

        dbx_fields = (
            'Dropbox Settings',
            [
                dict(title='Dropbox Token', key='dbx_token', type='text', value=dbx_token, autocorrection=False, autocapitalization=False)
            ]
        )

        gitlab_fields = (
            'Gitlab Settings',
            [
                dict(title='Gitlab URL', key='gitlab_url', type='text', value=gitlab_url, autocorrection=False, autocapitalization=False),
                dict(title='Gitlab User', key='gitlab_user', type='text', value=gitlab_user, autocorrection=False, autocapitalization=False),
                dict(title='Gitlab Token', key='gitlab_token', type='text', value=gitlab_token, autocorrection=False, autocapitalization=False),
                dict(title='Repo', key='gitlab_repo', type='text', value=gitlab_repo, autocorrection=False, autocapitalization=False)
            ]
        )

        posting_fields = (
            'Post Settings',
            [
                dict(title='Title', key='title', type='text', value=title),
                dict(title='Author', key='author', type='text', value=author),
                dict(title='Draft', key='draft', type='switch', value=True),
                dict(title='Layout', key='layout', type='text', value='post', autocorrection=False, autocapitalization=False),
                dict(title='Tags', key='tags', type='text', value=''),
                dict(title='Categories', key='categories', type='text', value=''),
                dict(title='Comments', key='comments', type='switch', value=True),
                dict(title='Excerpt', key='excerpt', type='text', value=''),
                dict(title='ImagePath', key='feature_img_path', type='text', value=''),
                dict(title='ImageWide', key='feature_img_wide', type='switch', value=False),
                dict(title='ImageCaption', key='feature_img_caption', type='text', value=''),
                dict(title='Filename', key='filename', type='text', value=filename, autocorrection=False, autocapitalization=False)
            ],
            'Separate tags/categories with spaces'
        )

        results = dialogs.form_dialog(title='publish new post', sections=[
            posting_fields,
            gitlab_fields,
            dbx_fields
        ])

        if results is None:
            console.hud_alert('posting was cancelled', 'error')
            return

        results['tags'] = process_string_array(results['tags'])
        results['categories'] = process_string_array(results['categories'])

        metas = {
            'layout': results['layout'],
            'author': results['author'],
            'draft': results['draft'],
            'tags': results['tags'],
            'categories': results['categories'],
            'comments': results['comments'],
            'excerpt': results['excerpt'],
            'feature_img_path': results['feature_img_path'],
            'feature_img_wide': results['feature_img_wide'],
            'feature_img_caption': results['feature_img_caption'],
            'branch': 'master',
            'filename': results['filename']
        }

        if gitlab_token != results['gitlab_token']:
            keychain.set_password('gitlab_token', results['gitlab_user'], results['gitlab_token'])

        if dbx_token != results['dbx_token']:
            keychain.set_password('dbx_token', results['gitlab_user'], results['dbx_token'])

        console.show_activity()
        mb = MobileBlogger(results['gitlab_url'], results['gitlab_repo'], results['gitlab_token'], results['dbx_token'])
        mb.create_new_post(results['title'], text, metas)
        mb.git_sync_dropbox()
        console.hud_alert('new post created!')
    else:
        print('no input text found')
Exemplo n.º 50
0
apiSecret = 'YOUR_API_SECRET'

params = {
    'auth': {
        'api_key': apiKey,
        'api_secret': apiSecret
    },
    'wait': True,
    "convert": {
        "format": "jpeg"
    }
}

data = json.dumps(params)

if appex.is_running_extension() is True:
    image = appex.get_image_data()
else:
    image = photos.pick_image(original=True, raw_data=True)

print('Uploading to Kraken...')
console.show_activity()

request = requests.post(url='http://api.kraken.io/v1/upload',
                        files={'name': (name, image)},
                        data={'data': data})

response = json.loads(str(request.content))

if (response['success']):
    console.hud_alert('Lossless image uploaded to Kraken.', 'success')
Exemplo n.º 51
0
# coding: utf-8

# https://forum.omz-software.com/topic/2022/a-copy-code-button-here-in-the-forum/4

from __future__ import print_function
import clipboard

use_appex = False
try:
    # appex is only available in 1.6 beta, fail gracefully when running in 1.5
    import appex
    use_appex = appex.is_running_extension()
except:
    pass


def main():
    if use_appex:
        url = appex.get_url()
    else:
        url = clipboard.get()
    if 'forum.omz-software' not in url:
        print('No forum URL')
        return
    import requests
    import bs4
    html = requests.get(url).text
    soup = bs4.BeautifulSoup(html)
    pre_tags = soup.find_all('pre')
    if pre_tags:
        text = ('\n#%s\n\n' % ('=' * 30)).join(
Exemplo n.º 52
0
    def __init__(self, close_event):
        if appex.is_running_extension():
            self.file_path = appex.get_file_path()
            self.v = ui.load_view("inner_ui")
            #self.have_to_close = self.v.have_to_close
            self.v.set_close(close_event)
            self.window = self.v['show']
            self.message_box = self.v['message_box']
            self.message_label = self.v["message_label"]
            self.send = self.v['send']

            self.device_source = DeviceSource()
            self.device_label = self.v["device_label"]
            self.device_table = self.v["device_table"]
            self.device_table.data_source = self.device_table.delegate = self.device_source

            self.device_source.set_tableview(self.device_table)

            self.process = self.v['bar']

            self.get_process = self.v["bar"]

            self.file_button = self.v['file_button']
            self.file_button.action = self.file_button_action

            self.start_page = [self.device_label, self.device_table]
            self.second_page = [
                self.window, self.message_box, self.message_label, self.send,
                self.file_button, self.process, self.get_process
            ]

            self.show(1)

        else:
            self.v = ui.load_view("File_transfer")
            #print(type(close_event))
            self.v.set_close(close_event)
            self.window = self.v['show']

            self.message_box = self.v['message_box']
            self.message_label = self.v["message_label"]
            self.send = self.v['send']

            self.device_source = DeviceSource()
            self.device_label = self.v["device_label"]
            self.device_table = self.v["device_table"]
            self.device_table.data_source = self.device_table.delegate = self.device_source

            self.device_source.set_tableview(self.device_table)

            self.file_label = self.v["file_label"]
            self.process = self.v['bar']

            self.get_process = self.v["bar"]

            lst, source = make_new_table("~")
            self.file_nav = ui.NavigationView(lst)
            self.file_source = source
            source.set_nav(self.file_nav)
            self.file_nav.x = 390
            self.file_nav.y = 265
            self.file_nav.width = 361
            self.file_nav.height = 331
            self.file_nav.border_color = '#f0f0f0'
            self.file_nav.border_width = 1
            self.v.add_subview(self.file_nav)

            self.start_page = [self.device_label, self.device_table]
            self.second_page = [
                self.window, self.message_box, self.message_label, self.send,
                self.file_label, self.file_nav, self.process, self.get_process
            ]

            self.show(1)
# coding: utf-8
import clipboard, base64, console, appex

etext = clipboard.get()
if 'base64,' in etext:
    etext = etext.split('base64,')[1]
text = base64.decodestring(etext)
try:
    clipboard.set(text)
    if not appex.is_running_extension():
        print text
    console.hud_alert('Clipboard base64 decoded.')
except:
    console.hud_alert('Error base64 decoding clipboard.')
Exemplo n.º 54
0
def main():
    if not appex.is_running_extension():
        print('Running in Pythonista app, using test data...\n')
        text = '''
		'''
    else:
        text = appex.get_text()
    if text:
        author = 'Taha Dhiaeddine Amdouni'

        github_repo = 'tdamdouni.github.io'
        github_user = '******'
        github_password = keychain.get_password('github', github_user) or ''

        (title, text) = extract_title(text)
        filename = '%s-%s.md' % (date.today(), slug(title))

        github_fields = ('Github Settings', [
            dict(title='Github Username',
                 key='github_user',
                 type='text',
                 value=github_user,
                 autocorrection=False,
                 autocapitalization=False),
            dict(title='Github Password',
                 key='github_password',
                 type='password',
                 value=github_password),
            dict(title='Repository',
                 key='github_repo',
                 type='text',
                 value=github_repo,
                 autocorrection=False,
                 autocapitalization=False)
        ])

        posting_fields = ('Post Settings', [
            dict(title='Title', key='title', type='text', value=title),
            dict(title='Author', key='author', type='text', value=author),
            dict(title='Layout',
                 key='layout',
                 type='text',
                 value='post',
                 autocorrection=False,
                 autocapitalization=False),
            dict(title='Tags', key='tags', type='text', value=''),
            dict(title='Filename',
                 key='filename',
                 type='text',
                 value=filename,
                 autocorrection=False,
                 autocapitalization=False)
        ], 'Please seperate tags by spaces.')

        results = dialogs.form_dialog(title='Publish new post',
                                      sections=[posting_fields, github_fields])

        if results is None:
            console.hud_alert('Posting was cancelled', 'error')
            return

        metas = {
            'tags': results['tags'],
            'branch': 'master',
            'author': results['author'],
            'layout': results['layout'],
            'filename': results['filename']
        }

        if github_password != results['github_password']:
            keychain.set_password('github', results['github_user'],
                                  results['github_password'])

        console.show_activity()
        mb = MobileBlogger(results['github_user'], results['github_password'],
                           results['github_repo'])
        mb.create_new_post(results['title'], text, metas)
        console.hud_alert('New post created!')
    else:
        print('No input text found.')
Exemplo n.º 55
0
test = os.path.isdir('Downloads')
print(test)

if test == False:
    print('Downloads created')
    os.makedirs('Downloads')
else:
    print('Downloads exists')

print('Change dir to Downloads')

os.chdir(os.path.join(os.getcwd(), 'Downloads'))

#Test if running as extenstion
test = appex.is_running_extension()

if test == True:
    filein = appex.get_url()
else:
    myrun = dialogs.alert('Manual entry?', '', 'Enter manual URL', "Dummy")

if myrun == 1:
    filein = eval(input("Enter the URL address of file to get:"))

else:
    filein = "https://raw.githubusercontent.com/grrrr/py/741ba0500bc49e8f6268f02d23e461649e8d457b/scripts/buffer.py"

fileparse = urllib.parse.urlparse(filein)
filepath, filename = os.path.split(fileparse.path)
Exemplo n.º 56
0
    def __init__(self, close_event):
        if appex.is_running_extension():
            self.file_path = appex.get_file_path()
            self.v = ui.load_view("inner_ui")
            self.v.set_close(close_event)
            self.window = self.v['show']
            self.message_box = self.v['message_box']
            self.message_label = self.v["message_label"]
            self.send = self.v['send']
            self.done = self.v['done']
            self.done.hidden = True
            de = TextViewDelegate()
            self.message_box.delegate = de
            de.set_button(self.done)
            self.device_source = DeviceSource()
            self.device_label = self.v["device_label"]
            self.device_table = self.v["device_table"]
            self.device_table.data_source = self.device_table.delegate = self.device_source

            self.device_source.set_tableview(self.device_table)

            self.process = self.v['bar']

            self.get_process = self.v["bar"]

            self.file_button = self.v['file_button']
            self.file_button.action = self.file_button_action

            self.start_page = [self.device_label, self.device_table]
            self.second_page = [
                self.window, self.message_box, self.message_label, self.send,
                self.file_button, self.process, self.get_process
            ]
            self.third_page = []
            self.show(1)

        else:
            self.v = ui.load_view("File_transfer")
            self.v.set_close(close_event)
            self.window = self.v['show']
            self.file_button = self.v['file_button']
            self.file_close = self.v['file_close']
            self.message_box = self.v['message_box']
            self.message_label = self.v["message_label"]
            self.send = self.v['send']
            self.done = self.v['done']
            self.done.hidden = True
            de = TextViewDelegate()
            self.message_box.delegate = de
            de.set_button(self.done)
            self.file_button.action = self.file_choose
            self.file_close.action = self.file_close_action

            self.device_source = DeviceSource()
            self.device_label = self.v["device_label"]
            self.device_table = self.v["device_table"]
            self.device_table.data_source = self.device_table.delegate = self.device_source

            self.device_source.set_tableview(self.device_table)

            #self.file_label = self.v["file_label"]
            self.process = self.v['bar']

            self.get_process = self.v["bar"]

            lst, source = make_new_table("~")
            self.file_nav = ui.NavigationView(lst)
            self.file_source = source
            source.set_nav(self.file_nav)
            source.set_show(self.show)
            self.file_nav.x = 6
            self.file_nav.y = 62
            self.file_nav.width = 308
            self.file_nav.height = 403
            self.file_nav.border_color = '#f0f0f0'
            self.file_nav.border_width = 1
            self.v.add_subview(self.file_nav)

            self.start_page = [self.device_label, self.device_table]
            self.second_page = [
                self.window, self.message_box, self.message_label, self.send,
                self.file_button, self.process, self.get_process
            ]
            self.third_page = [self.file_close, self.file_nav]

            self.show(1)
Exemplo n.º 57
0
def main():
    if not appex.is_running_extension():
        print 'Running in Pythonista app, using test data...\n'
        text = '''## Daring Fireball
		
		John thanking Makerbase.
		
		> My thanks to Makerbase for sponsoring last week’s DF RSS feed. Makerbase is like an IMDB for people who make apps, websites, and podcasts. New features include the ability to get notified — optionally! — when your friends make a new project, or when someone says you inspire them.
		
		
		(Source: [http://daringfireball.net/](http://daringfireball.net/))'''
    else:
        text = appex.get_text()
    if text:
        author = 'Pascal Cremer'

        github_repo = 'b00gizm.github.io'
        github_user = '******'
        github_password = keychain.get_password('github', github_user) or ''

        (title, text) = extract_title(text)
        filename = '%s-%s.md' % (date.today(), slug(title))

        github_fields = ('Github Settings', [
            dict(title='Github Username',
                 key='github_user',
                 type='text',
                 value=github_user,
                 autocorrection=False,
                 autocapitalization=False),
            dict(title='Github Password',
                 key='github_password',
                 type='password',
                 value=github_password),
            dict(title='Repository',
                 key='github_repo',
                 type='text',
                 value=github_repo,
                 autocorrection=False,
                 autocapitalization=False)
        ])

        posting_fields = ('Post Settings', [
            dict(title='Title', key='title', type='text', value=title),
            dict(title='Author', key='author', type='text', value=author),
            dict(title='Layout',
                 key='layout',
                 type='text',
                 value='post',
                 autocorrection=False,
                 autocapitalization=False),
            dict(title='Tags', key='tags', type='text', value=''),
            dict(title='Filename',
                 key='filename',
                 type='text',
                 value=filename,
                 autocorrection=False,
                 autocapitalization=False)
        ], 'Please seperate tags by spaces.')

        results = dialogs.form_dialog(title='Publish new post',
                                      sections=[posting_fields, github_fields])

        if results is None:
            console.hud_alert('Posting was cancelled', 'error')
            return

        metas = {
            'tags': results['tags'],
            'branch': 'master',
            'author': results['author'],
            'layout': results['layout'],
            'filename': results['filename']
        }

        if github_password != results['github_password']:
            keychain.set_password('github', results['github_user'],
                                  results['github_password'])

        console.show_activity()
        mb = MobileBlogger(results['github_user'], results['github_password'],
                           results['github_repo'])
        mb.create_new_post(results['title'], text, metas)
        console.hud_alert('New post created!')
    else:
        print 'No input text found.'
import appex
import melon編集

print(appex.is_running_extension())
print(appex.get_text())

file_path = appex.get_file_path()
print(file_path)
melon編集.main(file_path)
Exemplo n.º 59
0
def get_selected_text():
    if appex.is_running_extension():
        return False
    text = editor.get_text()
    s = editor.get_selection()
    return text[s[0]:s[1]] or False
Exemplo n.º 60
0
def main():
    if appex.is_running_extension():
        for name_func in inspect.getmembers(appex):
            name, func = name_func
            if name.startswith("get_"):  # find all appex.get_xxx() methods
                print("{:<11} : {}".format(name.partition("_")[2], func()))