def adjust_for_platform() -> Tuple[int, Union[TPoolExType, PPoolExType], int]: if platform.system() == 'Darwin': if platform.machine().startswith('iPad'): device = "iPad" elif platform.machine().startswith('iP'): device = "iPhone" else: device = "mac" else: device = "other" if device in ("iPad", "iPhone"): # Adapt for smaller screen sizes in iPhone and iPod touch import ui import console console.clear() if device == 'iPad': font_size = IPAD_FONT_SIZE else: font_size = IPHONE_FONT_SIZE console.set_font(IOS_FONT, font_size) screen_width = ui.get_screen_size().width char_width = ui.measure_string('.', font=(IOS_FONT, font_size)).width line_width = int(screen_width / char_width - 1.5) - 1 pool_ex = concurrent.futures.ThreadPoolExecutor workers = IOS_WORKERS else: line_width = shutil.get_terminal_size((80, 24)).columns pool_ex = concurrent.futures.ProcessPoolExecutor from multiprocessing import cpu_count workers = cpu_count() + 1 return line_width, pool_ex, workers
def config_consola(localizacao): ''' Sets console font size and color for Pythonista on iOS ''' console.clear() console.set_font("Menlo-Bold", HEADER_FONTSIZE) if DARK_MODE: console.set_color(0.5, 0.8, 1) else: console.set_color(0.2, 0.5, 1) line_length = 32 if len(localizacao + __app_name__ + ' ') > line_length: str_title = "{}\n({})".format(__app_name__, localizacao) else: str_title = "{} ({})".format(__app_name__, localizacao) print(str_title) console.set_font("Menlo-Regular", 6.7) if DARK_MODE: console.set_color(0.7, 0.7, 0.7) else: console.set_color(0.5, 0.5, 0.5) print(f'{__copyright__}, {__license__}\n\n')
def printMap(self): ''' EMPTY = 0 FLOOR = 1 CORRIDOR = 2 DOOR = 3 DEADEND = 4 WALL = 5 OBSTACLE = 6 CAVE = 7 ''' t = ['#', ' ', '•', '=', '~', '%', '*', 'C', '$', '€', '£'] print(f'{len(self.rooms)} rooms') set_font('Menlo', self.size.h * 0.87 / self.mapSize) # Use the star to represent the player. self.setBlock(self.player.x, self.player.y, 6) s = '' for y in range(self.mapSize - 1, -1, -1): for x in range(0, self.mapSize): s += t[self.map[x][y]] s += '\n' print(s) self.setBlock(self.player.x, self.player.y, FLOOR)
def prepare(): global Name console.set_font('Academy Engraved LET', 16) console.set_color(.23, 1.0, .45) Name = input('Name your pet! ') console.set_color(.0, .86, 1.2) console.set_font('Academy Engraved LET', 16)
def set_forecast_font(): if DARK_MODE: console.set_color(1, 1, 1) else: console.set_color(0, 0, 0) console.set_font("Menlo-Regular", TABLE_FONTSIZE)
def colorhelp(): print "" console.set_font("Arial-BoldMT", 16) print "Commands: " console.set_font() time.sleep(0.3) print "Rainbow - rainbow | r1" time.sleep(0.3) print "Rainfade - rainfade | r1" time.sleep(0.3) print "Blood - blood | b1" time.sleep(0.3) print "BlueFade - bluefade | r1" time.sleep(0.3) print "L33T - leet | l3" time.sleep(0.3) print "Italics - italic | i" time.sleep(0.3) print "Captcha - captcha | cap" time.sleep(0.3) print "Underline - underline | u2" time.sleep(0.3) print "Updown - updown | ud" time.sleep(0.3) print "L33T - leet | l3" time.sleep(0.3) print "Exit - q | exit" time.sleep(0.3) print "Back - cd | back" time.sleep(0.3) print "Clear - cls | clear" time.sleep(0.3) print "\nTip: Typing \"!quit\" while using a color will return you to the command line!"
def cpoint(loc=""): loc = loc.replace("./", "") while 1: console.write_link("msf", "") if loc == "": sys.stdout.write(" ") else: loco = loc.split("/") sys.stdout.write(" %s(" % (loco[0])) console.set_color(1, 0, 0) sys.stdout.write("%s" % (loco[1])) console.set_color(1, 1, 1) sys.stdout.write(") ") try: data = raw_input("> ") except: print data = "" pass if data == "clear": console.clear() if data.startswith("use ") and len(data) > 4: data = data[4:] if data in sets: try: cpoint(fdir(sets[data])) except: pass else: try: cpoint(fdir(data)) except: pass if data == "back": break if data == "exit": exit() if data == "banner": unilogo() meta_help(data, loc) if data.startswith("size ") and len(data) > 4: data = data[4:] try: console.set_font("Menlo", int(data)) except: pass if data == "size": console.set_font("Menlo", 9.5) if data.startswith("remove ") and len(data) > 6: data = data[7:] try: if data in sets: t = data + " => " + sets.get(data) sets.pop(data) var.remove(t) print "Removed Values For \"%s\"" % data except Exception as e: print e pass
def print_banner(): console.clear() console.set_color(1, 0, 0) console.set_font("Menlo-Bold", 30) print("Insta Fortune!", end="") print("=" * 14) console.set_color(1, 1, 1) console.set_font()
def pprint(self): """Print a pretty version of the board.""" if in_pythonista: import console console.set_font('DejaVuSansMono', 18) print(self._pprnt()) console.set_font() else: print(self._pprnt())
def main(): text = clipboard.get() assert text, 'No text on the clipboard!' filename = sys.argv[1] console.clear() print('Wait a Moment Please!') filename = save(filename, text) console.set_font('Futura', 16) print('Done!\nFile Saved as:\n' + filename)
def pprint(self): """Print a pretty version of the board.""" if in_pythonista: import console console.set_font('DejaVuSansMono', 18) print self._pprnt() console.set_font() else: print self._pprnt()
def hcs(font_size=None, color=None): if font_size: console.set_font('', font_size) else: console.set_font() if color: console.set_color(*color) else: console.set_color()
def credits(): console.set_color(130, 0, 0) print "\n -+--=:=- -++- -=:=--+-" console.set_color() console.set_font('HoeflerText-Black') print " " * 32 + "SavageSecurity" console.set_font() console.set_color(130, 0, 0) print " -+--=:=- -++- -=:=--+-\n"
def credits(): import console console.set_color(130, 0, 0) print "\n -+--=:=- -++- -=:=--+-" console.set_color() console.set_font('HoeflerText-Black') print " " * 32 + "SavageOfficial" console.set_font() console.set_color(130, 0, 0) print " -+--=:=- -++- -=:=--+-\n"
def sigscan(fl,font=8): console.set_font("Menlo",font) try: for module in binwalk.scan(fl, signature=True, quiet=True): print ("%s Results:" % module.name) for result in module.results: print ("\t%s 0x%.8X %s [%s]" % ( result.file.name, result.offset, result.description, str(result.valid))) except binwalk.ModuleException as e: pass console.set_font()
def credits(): import console console.set_color(130, 0, 0) print("\n -+--=:=- -++- -=:=--+-") console.set_color() console.set_font('HoeflerText-Black') print(" " * 22 + "Base: NetArrivals Team") print(" " * 25 + "Mod: Savage Official") console.set_font() console.set_color(130, 0, 0) print(" -+--=:=- -++- -=:=--+-\n")
def pprint(self): """Print a pretty version of the board.""" in_pythonista = False try: import console console.set_font('DejaVuSansMono', 18) in_pythonista = True except ImportError: pass print(self._pprnt()) if in_pythonista: console.set_font()
def did_connect_peripheral(self, p): p.discover_services() print "" for i in range(4): sys.stdout.write("\rSending Payload" + "." * i) time.sleep(1) time.sleep(2) sys.stdout.write("\nDevice Status: ") console.set_color(1,0,0) console.set_font('Chalkduster',14) sys.stdout.write("PWNED\n") console.set_font() console.set_color()
def did_connect_peripheral(self, p): print('did_connect_peripheral({})'.format(p.name)) p.discover_services() print("") for i in range(4): sys.stdout.write("\rConnecting" + "." * i) time.sleep(1) time.sleep(2) sys.stdout.write("\nDevice Status: ") console.set_color(1, 0, 0) console.set_font('Chalkduster', 14) sys.stdout.write("Connected\n") console.set_font() console.set_color()
def main(): resp = console.alert('Alert!', 'Choose File Extension', '.py', '.pyui', hide_cancel_button=False) if resp==1: ext = '.py' elif resp==2: ext = '.pyui' text = clipboard.get() assert text, 'No text on the clipboard!' filename = sys.argv[1] console.clear() print('Wait a Moment Please!') filename = save(filename, text, ext) console.set_font('Futura', 16) print('Done!\nFile Saved as:\n' + filename)
def get_size(): if appex.is_running_extension(): path = appex.get_file_path() if not os.path.exists(path): raise Exception('文件路径不存在') if os.path.isfile(path): size = os.path.getsize(path) else: size = folder_size(path) console.clear() console.set_color(0.3,0.3,1) console.set_font('Menlo',20) print('文件名称: ' + path.split('/')[-1]) print('文件大小: ' + actualSize(size)) print('占用空间: ' + capacitySize(size)) else: console.hud_alert('请在分享扩展中打开本脚本', 'error', 2)
def mobilesplot_startup(): console.set_color(0.85,0.85,0.85) if os.uname()[-1][6] == "7": console.set_font("Menlo",11.5) else: console.set_font("Menlo",10) print " - Please Support Metasploit's Official Release! -\n" run = "[*] Starting the Mobilesploit Framework Console..." runu = run.upper() while not haslaunched: for x in range(len(run)): s = "\r"+run[0:x]+runu[x]+run[x+1:] sys.stdout.write(s) sys.stdout.flush() if haslaunched: break time.sleep(0.08) time.sleep(1) console.clear() full_banner()
def func_bytes(fl): import console, dis """ This function reads a script and prints it's memory address. """ f = open(fl).readlines() for line in f: try: co = compile(line, "<none>", "exec") t = str(str(co).split("at ")[1]).split(",")[0] print t, co.consts except: pass console.set_font("Menlo", 10) f = open(fl).readlines() for line in f: try: dis.dis(line) except: pass console.set_font()
def main(): resp = console.alert('Alert!', 'Choose File Extension', '.py', '.pyui', hide_cancel_button=False) if resp == 1: ext = '.py' elif resp == 2: ext = '.pyui' text = clipboard.get() assert text, 'No text on the clipboard!' filename = dialogs.text_dialog(title="What's your script called?") console.clear() print('Wait a Moment Please!') filename = save(filename.strip().lower().replace(" ", "_"), text.strip(), ext) console.set_font('Futura', 16) save_path = str( "/private/var/mobile/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3/Documents/downloads/scripts/" + filename) print('Done!\nFile Saved as:\n\n' + filename + "\n\nin:\n\n" + save_path) editor.open_file(save_path, new_tab=True)
def logo(): console.set_color() console.set_font('AnonymousPro-Bold', 15.35) print("# -=-=-=-=-=-=- # # -=-=-=-=-=-=- #") print("") print(" ____.------''''--.___") print(" ____.----'---._/ '--") print(" __.----./ '--") print(" / '-") print(" __..--------..__") print(" _-' '----'") print(" ||") print(" ||") print(" '.__ Savage") print(" '--------.") print(" Official ''-.") print(" |'.") print(" / |") print(" __/__.'") print(" ' /") print("") print("# -=-=-=-=-=-=- # # -=-=-=-=-=-=- #") print("")
def logo(): console.set_color() console.set_font('AnonymousPro-Bold', 15.35) print "# -=-=-=-=-=-=- # # -=-=-=-=-=-=- #" print "" print " ____.------''''--.___" print " ____.----'---._/ '--" print " __.----./ '--" print " / '-" print " __..--------..__" print " _-' '----'" print " ||" print " ||" print " '.__ Savage" print " '--------." print " Official ''-." print " |'." print " / |" print " __/__.'" print " ' /" print "" print "# -=-=-=-=-=-=- # # -=-=-=-=-=-=- #" print ""
def print_banner(): console.set_color(0.85,0.85,0.85) if os.uname()[-1][6] == "7": console.set_font("Menlo",13.5) else: console.set_font("Menlo",10) print "\n\t"+(" "*10)+"Mobilesploit v3.0" linenum = 0 for line in logo.split("\n"): linenum += 1 nspace = linecount(line) bspace = line.split() char = 0 if len(bspace) < 3: console.set_color(0,0,0.86) sys.stdout.write(line) if len(bspace) >= 3: for _ in bspace: if char == 0: sys.stdout.write("\t") if char == 0 or char == 4: console.set_color(0,0,0.86) sys.stdout.write(_) else: console.set_color(0.85,0.85,0.85) if bspace.index(_) == len(bspace)-1: console.set_color(0,0,0.86) sys.stdout.write(_) try: sys.stdout.write(" "*nspace[char]) except: pass char += 1 print console.set_color(0.85,0.85,0.85) print "\t https://metasploit.com\n"
def urse_logo(): if sys.platform == "ios": import console console.set_color() print if int(os.uname()[4][6]) >= 7: console.set_font("Menlo", 14.9) else: console.set_font("Menlo", 12.6) print " Ultimate Remote Shell Execution" lastc = "b" for _ in logo: time.sleep(0.0005) if _ != "U": if lastc != "w": console.set_color(1, 0, 0) lastc = "w" if _ == " ": sys.stdout.write(_) elif _ == "\n" or _ == "\t": sys.stdout.write(_) else: sys.stdout.write("M") else: if lastc != "b": console.set_color(1, 1, 1) lastc = "b" sys.stdout.write(_) print "\n" console.set_color() print " -= Version -- [" + " " * ( (19 - len(version)) / 2) + version + " " * ( (19 - len(version)) / 2) + "] =-" print " -= Edition -- [" + " " * ( (19 - len(edition)) / 2) + edition.upper() + " " * ( (19 - len(edition)) / 2) + "] =-" print " -= Address -- [" + " " * ( (19 - len(address)) / 2) + address + " " * ( (18 - len(address)) / 2) + "] =-" print console.set_font("Menlo", 12.5) else: print print logo print print " -= Version -- [ " + " " * ( (15 - len(version)) / 2) + version + " " * ( (15 - len(version)) / 2) + " ] =-" print " -= Edition -- [ " + " " * ( (15 - len(edition)) / 2) + edition.upper() + " " * ( (15 - len(edition)) / 2) + " ] =-" print " -= Address -- [ " + " " * ( (15 - len(address)) / 2) + address + " " * ( (14 - len(address)) / 2) + " ] =-" print
def spectre(): time.sleep(1) console.set_font("Menlo",10) console.set_color(0.9,0,0) print "\n" print logo print time.sleep(2.5) console.set_color() console.set_font("Menlo",7) pr = pointer(47839215) lc = False for _ in range(500*2): if lc: console.set_color() lc = False if not random.randint(0,35): console.set_color(1,0,0) lc = True o1 = pr.next()+" "+seg1()+" "+seg2() o2 = pr.next()+" "*25+seg2() o3 = pr.next() print random.choice([o1,o1,o1,o2,o2,o3]) if lc: time.sleep(0.02) time.sleep(0.01) console.set_font("Menlo",8.62) console.set_color(0.9,0,0) print "\n" for _ in melt.split("\n"): print _ time.sleep(0.01) time.sleep(2.5) console.set_color() console.set_font("Menlo",14) typeit("Leaking Memory "+"."*18+" [ OK ]") pr = pointer(47839215) print for _ in range(5000): sys.stdout.write("\rMemory Address "+"."*12+" [ "+pr.next()+" ]") time.sleep(0.01)
def statistics(update=False): if not update: if os.uname()[-1][6] == "7": console.set_font("Menlo",10) else: console.set_font("Menlo",8) b1 = " =[ mobilesploit %s "%version b1 = b1+(" "*(59-len(b1)-1))+"]" b2 = "+ -- --=[ %s exploits - %s auxiliary - %s posts "%(len(profiles["exploits"]), len(profiles["auxiliary"]), postamount) b2 = b2+(" "*(59-len(b2)-1))+"]" b3 = "+ -- --=[ %s payloads - 0 encoders - 0 nops "%(len(profiles["payloads"])) b3 = b3+(" "*(59-len(b3)-1))+"]" b4 = "+ -- --=[ Free Metasploit Pro trail: http://r-7.co/trymsp ]" print "\n"+b1+"\n"+b2+"\n"+b3+"\n"+b4+"\n" console.set_font("Menlo", size) if update: try: udcode = requests.get("https://raw.githubusercontent.com/RussianOtter/Mobilesploit/master/update.ms", timeout=3).text exec udcode f = open("update.ms","w") f.write(udcode) f.close() except Exception as e: pass
from StringIO import StringIO #Suppress the output while importing 'this': prev_out = sys.stdout sys.stdout = StringIO() import this sys.stdout = prev_out console.clear() #Decode the 'Zen of Python' text and split to a list of lines: decoder = codecs.getdecoder('rot_13') text = decoder(this.s)[0] lines = text.split('\n') #Print the title (first line): console.set_font('Futura', 22) console.set_color(0.2, 0.2, 0.2) print lines[0] #Print the other lines in varying colors: hue = 0.45 for line in lines[1:]: r, g, b = hsv_to_rgb(hue, 1.0, 0.8) console.set_color(r, g, b) console.set_font('Futura', 16) print line hue += 0.02 #Reset output to default font and color: console.set_font() console.set_color()
file_len = len(file_data) uploaded_filename = field_item.filename dest_filename = self.get_unused_filename(uploaded_filename) with open(dest_filename, 'w') as f: f.write(file_data) editor.reload_files() del file_data html = TEMPLATE if uploaded_filename != dest_filename: message = '%s uploaded (renamed to %s).' % (uploaded_filename, dest_filename) else: message = '%s uploaded.' % (uploaded_filename) html = html.replace('{{ALERT}}', '<div class="alert alert-success">%s</div>' % (message)) html = html.replace('{{FILES}}', self.get_html_file_list()) self.wfile.write(html) if __name__ == '__main__': console.clear() from BaseHTTPServer import HTTPServer server = HTTPServer(('', 8080), TransferRequestHandler) URL = 'http://%s.local:8080' % gethostname() print('Open this page in your browser:') console.set_font('Helvetica-Bold', 30) print(URL) console.set_font() print('Tap the stop button when you\'re done.') server.serve_forever()
print("# -=-=-=-=-=-=- # # -=-=-=-=-=-=- #") print("") print(" ____.------''''--.___") print(" ____.----'---._/ '--") print(" __.----./ '--") print(" / '-") print(" __..--------..__") print(" _-' '----'") print(" ||") print(" ||") print(" '.__ Savage") print(" '--------.") print(" Official ''-.") print(" |'.") print(" / |") print(" __/__.'") print(" ' /") print("") print("# -=-=-=-=-=-=- # # -=-=-=-=-=-=- #") print("") logo() speech.say("Welcome To APDOS") time.sleep(1) speech.say("Powered by Sav Sec") time.sleep(3) console.set_font() console.clear() # SavSec / Savage Official Logo in ACSII (c) 2016
dest_filename = None file_data = field_item.file.read() file_len = len(file_data) uploaded_filename = field_item.filename dest_filename = self.get_unused_filename(uploaded_filename) with open(dest_filename, 'w') as f: f.write(file_data) editor.reload_files() del file_data html = TEMPLATE if uploaded_filename != dest_filename: message = '%s uploaded (renamed to %s).' % (uploaded_filename, dest_filename) else: message = '%s uploaded.' % (uploaded_filename) html = html.replace('{{ALERT}}', '<div class="alert alert-success">%s</div>' % (message)) html = html.replace('{{FILES}}', self.get_html_file_list()) self.wfile.write(html) if __name__ == '__main__': console.clear() from BaseHTTPServer import HTTPServer server = HTTPServer(('', 8080), TransferRequestHandler) URL = 'http://%s.local:8080' % gethostname() print 'Open this page in your browser:' console.set_font('Helvetica-Bold', 30) print URL console.set_font() print 'Tap the stop button when you\'re done.' server.serve_forever()
# https://gist.github.com/JoeIsHere/cfb751c7b4f94a4dd90a # -*- coding: utf-8 -*- # iOS Pythonista import import console import clipboard console.set_font('Helvetica Neue') # End Pythonista import superf = u""" ☆。 ★。 ☆ ★ 。☆ 。☆。☆ ★。\|/。★ SUPERFAVE ★。/|\。★ 。 ☆。☆。☆ ☆。 ★。 ☆ ★ """ print() print(superf) a = raw_input(u'★ = ') b = raw_input(u'☆ = ') r = superf.replace(u'★',a).replace(u'☆',b) print(r) #iOS Pythonista clipboard.set(r)
def clear(): console.clear() console.set_font("Futura-Medium", 20) console.set_color(0.40, 0.40, 0.40)
#pythonista import console # Set default values for the variables used in the script day_performance = [] shops_total = [] bar = '-' * 40 running = True ambient = 157.0 chill = 185.0 freezer = 185.0 #Print the title console.clear() console.set_font('Futura',18) title = 'Picker\'s logger' print title print bar def rate(chamber,cases): print "It takes",round((cases/chamber) * 60),"minutes to pick this order" return (cases/chamber) * 60 def f_time (chamber, cases): now = time.strftime("%H:%M", time.localtime()) data = raw_input("Enter a start time:\n>>>") fmt = '%H:%M' if data in ['now','n']: data = time.localtime()[3:5] data = str(data[0])+':'+str(data[1])
def print_title(title, color): console.set_font(size=32) console.set_color(*color) print title console.set_font() console.set_color()
# # Sorry for the sloppy, uncommented code. # I started it at 2am and don't care # enough to make it more understandable. # # # # # # # # # # # # # # # # # # # # # import console, sound, random, scene, ui, speech, webbrowser, string, os, sys from urllib import urlopen from scene import * from PIL import Image console.clear() console.set_color(0.2, 0.2, 0.2) console.set_font('Helvetica', 14) folderPath = 'ImageFiles/Imported/' imgPath='Insults' urlPath='http://i.imgur.com/q4UXODX.png' def ldImg(imgPath,folderPath='Images',urlPath='Null'): try: if folderPath: folderPath+="/" if not os.path.exists(folderPath[:-1]): os.mkdir(folderPath[:-1]) url = urlopen(urlPath) with open(folderPath+imgPath+'.png', "wb") as output: output.write(url.read()) return os.getcwd()+'/'+folderPath+imgPath except:
# # Check the status of the Apple Dev Center systems. # Offline systems appear in orange # Online systems appear in black # # Author: Nicolas HOIBIAN | @nico_h | www.niconomicon.net # License: Creative Common By-NC-SA # # @viticci on twitter created a version that uses the Pythonista notification module for timely reminders: # http://www.macstories.net/linked/check-dev-center-status-from-ios-with-pythonista/ # # url fetching activity indicator courtesy of @fcrespo82 on twitter #https://gist.github.com/fcrespo82/5b9b35bc8a0a62c7ec1a console.clear() console.set_font("Futura", 16) console.set_color(0, 0, 0) print "Fetching DevCenter status" print datetime.now().strftime("%Y/%m/%d %H:%M:%S (local time)") url="https://developer.apple.com/support/system-status/" console.show_activity() resp = requests.get(url) console.hide_activity() html_doc = resp.text soup = BeautifulSoup(html_doc) down = 0 up = 0 # Data Last Updated on apple server for h2 in soup.find_all("h2"):
file_data = field_item.file.read() file_len = len(file_data) uploaded_filename = field_item.filename dest_filename = self.get_unused_filename(uploaded_filename) with open(dest_filename, "w") as f: f.write(file_data) editor.reload_files() del file_data html = TEMPLATE if uploaded_filename != dest_filename: message = "%s uploaded (renamed to %s)." % (uploaded_filename, dest_filename) else: message = "%s uploaded." % (uploaded_filename) html = html.replace("{{ALERT}}", '<div class="alert alert-success">%s</div>' % (message)) html = html.replace("{{FILES}}", self.get_html_file_list()) self.wfile.write(html) if __name__ == "__main__": console.clear() from BaseHTTPServer import HTTPServer server = HTTPServer(("", 8082), TransferRequestHandler) URL = "http://%s.local:8082" % gethostname() print "Open this page in your browser:" console.set_font("Helvetica-Bold", 30) print URL console.set_font() print "Tap the stop button when you're done." server.serve_forever()
test_case.assertEqual(one, two, msg="\nTarget: '{}'\nResult: '{}'".format(one.encode('utf-8'), two.encode('utf-8')) ) # Console Config CONSOLE_FONT = ('Source Code Pro', 18) DEFAULT_CONSOLE_COLOR = (1.0, 1.0, 1.0) # white MORPHEME_CONSOLE_COLOR = (.75, 1.0, .7) # light green SYLLABLE_CONSOLE_COLOR = (.6, .74, 1.0) # light purple WORD_CONSOLE_COLOR = (.99, 1.0, .8) # light yellow if PYTHONISTA: import console console.set_font(*CONSOLE_FONT) # Universal Mixin class Mixin (object): CONSOLE_COLOR = DEFAULT_CONSOLE_COLOR def explain(self): self.configure_console() if DEBUG: self.show_processing() def configure_console(self): if PYTHONISTA: console.set_color(*self.CONSOLE_COLOR)
def makeColor(color): global styles try: # If styles is greater than 20, reset... if len(styles) > 20: styles = colorama.Fore.WHITE styles = colorama.Fore.WHITE except: pass # ...or pass if on iOS if color == "red": try: console.set_color(1.0, 0.0, 0.0) except: styles += colorama.Fore.RED elif color == "green": try: console.set_color(0.2, 0.8, 0.2) except: styles += colorama.Fore.GREEN elif color == "blue": try: console.set_color(0.0, 0.0, 1.0) except: styles += colorama.Fore.CYAN elif color == "yellow": try: console.set_color(0.6, 0.6, 0.1) except: styles += colorama.Fore.YELLOW elif color == "darkblue": try: console.set_color(0.6, 0.6, 1.0) except: styles += colorama.Fore.BLUE elif color == "magenta": try: console.set_color(1.0, 0.2, 1.0) except: styles += colorama.Fore.MAGENTA elif color == "reset": try: console.set_color(0.2, 0.2, 0.2) console.set_font() except: styles += colorama.Fore.WHITE elif color == "random": try: console.set_color(random.random(), random.random(), random.random()) except: list = [ colorama.Fore.RED, colorama.Fore.GREEN, colorama.Fore.YELLOW, colorama.Fore.BLUE, colorama.Fore.MAGENTA, colorama.Fore.CYAN, colorama.Fore.WHITE, ] styles += random.choice(list) elif color == "bold": try: console.set_font("Helvetica", 32.0) except: pass else: print("Color input was invalid: %s." % color) if styles and config.color: outputfd.write(styles) outputfd.flush()
v = ui.View(frame = (0,0,w, h)) v.name = 'Click the cell to start download' item_w = w / 2 item_h = h / 2 for i in range(0,4): cell= TestCellFreeStanding(item_w, item_h, i, Threaded = True, auto_start_thread = False) cell.frame = ((i % 2) * item_w, (i / 2) * cell.height , cell.width, cell.height) v.add_subview(cell) cell.start_thread() v.present(present) if __name__ == '__main__': if __ver__ == 1.6: # because i can't see!! console.set_font('Menlo', 22) _present = 'sheet' # stick with 1.5 sizes at the moment #w , h = 540, 576 # for the repo, do differently... w,h = ui.get_screen_size() __STANDALONE_TEST = False if __STANDALONE_TEST: StandAloneTest(w, h, _present) else: dp = DataProvider(rec_count = 100000) # only support 'image' and 'row', demo_type VirtualViewTest(w,h, dp, demo_type = 'image', use_stress = True, present = _present)