import gtk import gobject import pango from moo import _ from moo import D_ try: import vte except ImportError: moo._cancel_plugin_loading() TERMINAL_PLUGIN_ID = "Terminal" COLOR_SCHEME_KEY = 'Plugins/Terminal/color_scheme' SHELL_KEY = 'Plugins/Terminal/shell' FONT_KEY = 'Plugins/Terminal/font' moo.prefs_new_key_string(COLOR_SCHEME_KEY, 'Default') moo.prefs_new_key_string(SHELL_KEY, None) moo.prefs_new_key_string(FONT_KEY, None) def shell_supports_pushd(shell): # There is no counterpart function to test whether or not a shell supports # the “cd” command: they all support it, even MS‑DOS's “command.com” did. name = os.path.split(shell)[1] # If you happen know another shell which supports “pushd”, add its name to # the list return name in ["bash"] class Terminal(vte.Terminal): def __init__(self):
"%d %B %Y", "%B %d, %Y", "%A %b %d", "%H:%M:%S", "%H:%M", "%I:%M:%S %p", "%I:%M %p", "%H.%M.%S", "%H.%M", "%I.%M.%S %p", "%I.%M %p", "%d/%m/%Y %H:%M:%S", "%d/%m/%y %H:%M:%S", ] moo.prefs_new_key_string('Tools/InsertDateAndTime', '%c') def populate_tree_view(treeview): model = gtk.ListStore(str, str) curtime = time.localtime() default_iter = None default_fmt = moo.prefs_get_string('Tools/InsertDateAndTime') for fmt in formats: iter = model.append([time.strftime(fmt, curtime), fmt]) if default_fmt == fmt: default_iter = iter cell = gtk.CellRendererText() column = gtk.TreeViewColumn(None, cell, text=0) treeview.append_column(column)