Beispiel #1
0
#!/usr/bin/env python
"""
Displays sytem info.  Works with bash or Tk.
"""
__author__ = 'Chris Horn <*****@*****.**>'

from cjh import cli
from cjh.config import Config

cli.Cli()
CONFIG = Config()
if __name__ == '__main__':
    SHELL = CONFIG.start_user_profile() #move mainloop statement into main(
else: SHELL = cli.Cli()

if SHELL.interface in ['wx', 'Tk']:
    SHELL.center_window(width_=475, height_=230)

if SHELL.interface == 'Tk':
#if type(SHELL) == 'cjh/tk_template.TkTemplate':
    SHELL.msg.config(bg='black', fg='chartreuse', font=('mono', 9), width=500)
    SHELL.main_window.config(bg='black')
    SHELL.main_window.title(cli.Cli.hostname)

def main():
    """
    Output system info; if using bash, use animated text.
    """
    if SHELL.interface == 'Tk':
        SHELL.view_info()
        SHELL.main_window.mainloop()
    """
    tmp_list = []
    cow_list = os.listdir('/usr/share/cowsay/cows')
    for cow in cow_list:
        cow = cow.split('.')[:-1]
        cow = '.'.join(cow)
        tmp_list.append(cow)
    cow_list = tmp_list
    cow_list.sort()
    return PlainList(cow_list)


############
##  DATA  ##
############
CONFIG = Config()
SHELL = CONFIG.start_user_profile()
LIST_OBJ = make_list_obj()
MENU_FUNC = lambda: SHELL.list_menu(LIST_OBJ)


############
##  MAIN  ##
############
def main():
    """
    Feed fortunes to the selected ASCII character.
    """
    parse_help_flag()
    Cli()
    cow = ''
Beispiel #3
0
    if SHELL.interface == 'bash':
        listobj = AbstractList(shell_list_)
        shell_menu = lambda: SHELL.list_menu(listobj)
        number = Cli.make_page(func=shell_menu)
        shell_name_ = shell_list_[number - 1]
    elif SHELL.interface == 'Tk':
        shell_name_ = shellvar.get().strip()
    return shell_name_


###############
#  CONSTANTS  #
###############

ARGS = _parse_args()
CONFIG = Config()

if ARGS is not None and ARGS.shell is not None:
    SHELL = CONFIG.launch_selected_shell(ARGS.shell)
else:
    SHELL = CONFIG.start_user_profile()

SCRIPT_LIST = [
    s for s in os.listdir(os.getcwd())
    if (s.endswith('py') and not (s.startswith('.') or s.startswith('_')))
]
SCRIPT_LIST.sort(key=str.lower)
SHELL_LIST = ['bash', 'dialog', 'zenity', 'Tk', 'wx', '-None-']

if SHELL.interface != 'Tk':
    MENU_OPTS = AbstractList([
Beispiel #4
0
        description=
        'Prompts user for a string, and then echos it back--in a bold font.')
    parser.add_argument(
        '--nox', action='store_true', help='text-based interface')
    if __name__ == '__main__':
        return parser.parse_args()
    else:
        return None


##########
#  DATA  #
##########

ARGS = _parse_args()
CONFIG = Config()
if ARGS is not None and ARGS.nox is True:
    SHELL = Cli()
else:
    SHELL = CONFIG.start_user_profile()

LANG = CONFIG.get_lang_key()
AVG_CHAR_WIDTH = 31


##########
#  MAIN  #
##########

def main():
    """
Beispiel #5
0
            SHELL.msg.config(fg='#FF00FF')#, bg='black')
        else: SHELL.msg.config(fg='chartreuse')#, bg='black')
        SHELL.msgtxt.set(die.draw_face(verbose=True, get_str=True))
        SHELL.main_window.title(die)
    else:
        die.draw_face(verbose=True)


##########
#  DATA  #
##########
if __name__ == '__main__':
    ARGS = _parse_args()
else: ARGS = None

CONFIG = Config()
if ARGS and ARGS.shell:
    SHELL = CONFIG.launch_selected_shell(ARGS.shell)
else: SHELL = CONFIG.start_user_profile()
SHELL_NAME = SHELL.interface


lang_key = CONFIG.get_lang_key()

def change_lang(lang_code):
    global lang_key, main_menu
    lang_key = lang_code
    button.config(text={'EN':'Roll', 'EO':'Ruligi'}[lang_key])
    main_menu.destroy()
    main_menu = tk.Menu(SHELL.main_window, tearoff=0)
    lang_menu = tk.Menu(main_menu, tearoff=0)
Beispiel #6
0
#!/usr/bin/env python
"""
Reads an int from the command line or input prompt and draws the die.
Works with bash or Tk.

(* This does not work.)
"""
__author__ = 'Chris Horn <*****@*****.**>'

from cjh.config import Config
from cjh.die import Die

SHELL = Config().start_user_profile()
if SHELL.interface in ['Tk', 'wx']:
    SHELL.center_window(height_=100, width_=150)


def main():
    """
    Get an int from the pipeline or from user input, and draw the die.
    """
    die = Die()
    if __name__ == '__main__':
        die.value = int(SHELL.arg())
        die.draw_face(shellib=SHELL)

main()
        cmd = cmd_list
    proc = subprocess.Popen(cmd, shell=True)
    proc.wait()


###############
#  CONSTANTS  #
###############

# Parse command-line arguments
if __name__ == '__main__':
    ARGS = _parse_args()
else:
    ARGS = None

CONFIG = Config()

if ARGS and ARGS.shell:
    SHELL = CONFIG.launch_selected_shell(ARGS.shell)
else:
    SHELL = CONFIG.start_user_profile()

LANG = CONFIG.get_lang_key()

# Set the appropriate filepath
if SHELL.platform is 'android':
    BASEDIR = ('/storage/sdcard0/com.hipipal.qpyplus/lib/python2.7/' +
        'site-packages/cjh')
else:
    BASEDIR = 'cjh'