Python clint.textui.colored.cyan() Examples
The following are 12
code examples of clint.textui.colored.cyan().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
clint.textui.colored
, or try the search function
.
Example #1
Source File: sshmenu.py From sshmenu with MIT License | 6 votes |
def display_help(): # Clear screen and show the help text call(['clear']) puts(colored.cyan('Available commands (press any key to exit)')) puts(' enter - Connect to your selection') puts(' crtl+c | q - Quit sshmenu') puts(' k (up) - Move your selection up') puts(' j (down) - Move your selection down') puts(' h - Show help menu') puts(' c - Create new connection') puts(' d - Delete connection') puts(' e - Edit connection') puts(' + (plus) - Move connection up') puts(' - (minus) - Move connection down') # Hang until we get a keypress readchar.readkey()
Example #2
Source File: cl_utils.py From bcwallet with Apache License 2.0 | 6 votes |
def txn_preference_chooser(user_prompt=DEFAULT_PROMPT): puts('How quickly do you want this transaction to confirm? The higher the miner preference, the higher the transaction fee.') TXN_PREFERENCES = ( ('high', '1-2 blocks to confirm'), ('medium', '3-6 blocks to confirm'), ('low', '7+ blocks to confirm'), # ('zero', 'no fee, may not ever confirm (advanced users only)'), ) for cnt, pref_desc in enumerate(TXN_PREFERENCES): pref, desc = pref_desc with indent(2): puts(colored.cyan('%s (%s priority): %s' % (cnt+1, pref, desc))) choice_int = choice_prompt( user_prompt=user_prompt, acceptable_responses=range(1, len(TXN_PREFERENCES)+1), default_input='1', # high pref show_default=True, ) return TXN_PREFERENCES[int(choice_int)-1][0]
Example #3
Source File: bcwallet.py From bcwallet with Apache License 2.0 | 6 votes |
def offline_tx_chooser(wallet_obj): puts('What do you want to do?:') puts(colored.cyan('1: Generate transaction for offline signing')) puts(colored.cyan('2: Sign transaction offline')) puts(colored.cyan('3: Broadcast transaction previously signed offline')) puts(colored.cyan('\nb: Go Back\n')) choice = choice_prompt( user_prompt=DEFAULT_PROMPT, acceptable_responses=range(0, 3+1), quit_ok=True, default_input='1', show_default=True, ) verbose_print('Choice: %s' % choice) if choice is False: return elif choice == '1': return generate_offline_tx(wallet_obj=wallet_obj) elif choice == '2': return sign_tx_offline(wallet_obj=wallet_obj) elif choice == '3': return broadcast_signed_tx(wallet_obj=wallet_obj)
Example #4
Source File: spi_flash_programmer_client.py From spi-flash-programmer with Creative Commons Zero v1.0 Universal | 5 votes |
def logDebug(text, type): if type == DEBUG_NORMAL: puts(colored.cyan(text)) else: # DEBUG_VERBOSE puts(colored.magenta(text))
Example #5
Source File: version.py From orbital with MIT License | 5 votes |
def release(): """Bump version, tag, build, gen docs.""" if check_staged(): raise EnvironmentError('There are staged changes, abort.') if check_unstaged(): raise EnvironmentError('There are unstaged changes, abort.') bump() tag() build() doc_gen() puts(colored.yellow("Remember to upload documentation and package:")) with indent(2): puts(colored.cyan("shovel doc.upload")) puts(colored.cyan("shovel version.upload"))
Example #6
Source File: sshmenu.py From sshmenu with MIT License | 5 votes |
def connection_create(): global config_name call(['clear']) puts(colored.cyan('Create new connection entry')) puts('') host = input('Hostname (user@machine): ') if host is '': puts('') puts('Nothing done') time.sleep(TRANSITION_DELAY_TIME) return friendly = input('Description []: ') command = input('Command [ssh]: ') options = input('Command Options []: ') # Set the defaults if our input was empty command = 'ssh' if command == '' else command options = [] if options == '' else options.split() # Append the new target to the config config = json.loads(resources.user.read(config_name)) config['targets'].append({'command': command, 'host': host, 'friendly': friendly, 'options': options}) # Save the new config resources.user.write(config_name, json.dumps(config, indent=4)) update_targets() puts('') puts('New connection added') time.sleep(TRANSITION_DELAY_TIME)
Example #7
Source File: sshmenu.py From sshmenu with MIT License | 5 votes |
def connection_edit(selected_target): global targets, config_name call(['clear']) puts(colored.cyan('Editing connection %s' % targets[selected_target]['host'])) puts('') target = targets[selected_target] while True: host = input_prefill('Hostname: ', target['host']) if host is not '': break friendly = input_prefill('Description: ', target['friendly']) command = input_prefill('Command [ssh]: ', 'ssh' if not target.get('command') else target['command']) options = input_prefill('Options []: ', ' '.join(target['options'])) # Set the defaults if our input was empty command = 'ssh' if command == '' else command options = [] if options == '' else options.split() # Delete the old entry insert the edited one in its place config = json.loads(resources.user.read(config_name)) del config['targets'][selected_target] config['targets'].insert(selected_target, {'command': command, 'host': host, 'friendly': friendly, 'options': options}) resources.user.write(config_name, json.dumps(config, indent=4)) update_targets() puts('') puts('Changes saved') time.sleep(TRANSITION_DELAY_TIME)
Example #8
Source File: cl_utils.py From bcwallet with Apache License 2.0 | 5 votes |
def coin_symbol_chooser(user_prompt=DEFAULT_PROMPT, quit_ok=True): ACTIVE_COIN_SYMBOL_LIST = [x for x in COIN_SYMBOL_LIST if x != 'uro'] for cnt, coin_symbol_choice in enumerate(ACTIVE_COIN_SYMBOL_LIST): with indent(2): puts(colored.cyan('%s: %s' % ( cnt+1, COIN_SYMBOL_MAPPINGS[coin_symbol_choice]['display_name'], ))) if ACTIVE_COIN_SYMBOL_LIST[4] == 'bcy': default_input = 5 show_default = True else: default_input = None show_default = False coin_symbol_int = get_int( min_int=1, user_prompt=user_prompt, max_int=len(ACTIVE_COIN_SYMBOL_LIST), default_input=default_input, show_default=show_default, quit_ok=quit_ok, ) if not coin_symbol_int: return False else: return ACTIVE_COIN_SYMBOL_LIST[coin_symbol_int-1]
Example #9
Source File: bcwallet.py From bcwallet with Apache License 2.0 | 5 votes |
def dump_private_keys_or_addrs_chooser(wallet_obj): ''' Offline-enabled mechanism to dump everything ''' if wallet_obj.private_key: puts('Which private keys and addresses do you want?') else: puts('Which addresses do you want?') with indent(2): puts(colored.cyan('1: Active - have funds to spend')) puts(colored.cyan('2: Spent - no funds to spend (because they have been spent)')) puts(colored.cyan('3: Unused - no funds to spend (because the address has never been used)')) puts(colored.cyan('0: All (works offline) - regardless of whether they have funds to spend (super advanced users only)')) puts(colored.cyan('\nb: Go Back\n')) choice = choice_prompt( user_prompt=DEFAULT_PROMPT, acceptable_responses=[0, 1, 2, 3], default_input='1', show_default=True, quit_ok=True, ) if choice is False: return if choice == '1': return dump_selected_keys_or_addrs(wallet_obj=wallet_obj, zero_balance=False, used=True) elif choice == '2': return dump_selected_keys_or_addrs(wallet_obj=wallet_obj, zero_balance=True, used=True) elif choice == '3': return dump_selected_keys_or_addrs(wallet_obj=wallet_obj, zero_balance=None, used=False) elif choice == '0': return dump_all_keys_or_addrs(wallet_obj=wallet_obj)
Example #10
Source File: bcwallet.py From bcwallet with Apache License 2.0 | 5 votes |
def send_chooser(wallet_obj): puts('What do you want to do?:') if not USER_ONLINE: puts("(since you are NOT connected to BlockCypher, many choices are disabled)") with indent(2): puts(colored.cyan('1: Basic send (generate transaction, sign, & broadcast)')) puts(colored.cyan('2: Sweep funds into bcwallet from a private key you hold')) puts(colored.cyan('3: Offline transaction signing (more here)')) puts(colored.cyan('\nb: Go Back\n')) choice = choice_prompt( user_prompt=DEFAULT_PROMPT, acceptable_responses=range(0, 5+1), quit_ok=True, default_input='1', show_default=True, ) verbose_print('Choice: %s' % choice) if choice is False: return elif choice == '1': return send_funds(wallet_obj=wallet_obj) elif choice == '2': return sweep_funds_from_privkey(wallet_obj=wallet_obj) elif choice == '3': offline_tx_chooser(wallet_obj=wallet_obj)
Example #11
Source File: text.py From slack-machine with MIT License | 5 votes |
def announce(string): puts(colored.cyan(string))
Example #12
Source File: config.py From pgrepup with GNU General Public License v3.0 | 4 votes |
def config(**kwargs): puts(colored.cyan("Create a new pgrepup config")) try: while True: conf_filename = prompt.query("Configuration filename", default=kwargs['c']) if os.path.isfile(os.path.expanduser(conf_filename)): if not prompt.yn("File %s exists " % conf_filename + "and it'll be overwritten by the new configuration. Are you sure?", default="n"): # warning. prompt.yn return true if the user's answer is the same of default value break else: break except KeyboardInterrupt: puts("\n") sys.exit(0) conf = create_config() puts(colored.cyan("Security")) conf.add_section("Security") if prompt.yn("Do you want to encrypt database credentials using a password?", default="y"): conf.set("Security", "encrypted_credentials", "y") encrypt('') puts("You'll be prompted for password every time pgrepup needs to connect to database") else: conf.set("Security", "encrypted_credentials", "n") conf.set( "Security", "tmp_folder", prompt.query("Folder where pgrepup store temporary dumps and pgpass file", "/tmp") ) conf.set( "Security", "app_owner", prompt.query("Postgresql username as application owner", "app_owner") ) puts(colored.cyan("Source Database configuration")) conf.add_section("Source") conf.set("Source", "host", prompt.query("Ip address or Dns name: ")) conf.set("Source", "port", prompt.query("Port: ")) conf.set("Source", "connect_database", prompt.query("Connect Database: ", default="template1")) conf.set("Source", "user", prompt.query("Username: ")) pwd = getpass.getpass() conf.set("Source", "password", encrypt(pwd)) puts(colored.cyan("Destination Database configuration")) conf.add_section("Destination") conf.set("Destination", "host", prompt.query("Ip address or Dns name: ")) conf.set("Destination", "port", prompt.query("Port: ")) conf.set("Destination", "connect_database", prompt.query("Connect Database: ", default="template1")) conf.set("Destination", "user", prompt.query("Username: ")) pwd = getpass.getpass() conf.set("Destination", "password", encrypt(pwd)) save_config(os.path.expanduser(conf_filename))