def open_keymap(self, event): # wxGlade: MeerK40t.<event_handler> project.close_old_window("keymap") from Keymap import Keymap window = Keymap(None, wx.ID_ANY, "") window.set_project(project) window.Show() project.windows["keymap"] = window
panel = tcod.console_new(SCREEN_WIDTH, PANEL_HEIGHT) # Runtime global variables abilities = [] an_x = 0 boner_dome = Object(0, 0, 'D', 'boner_dome', tcod.yellow) dungeon_level = 1 dungeon_map = [] fov_map = tcod.map_new(MAP_WIDTH, MAP_HEIGHT) fov_recompute = True game_state = '' game_messages = [] highlight_state = '' inventory = [] key = tcod.Key() keymap = Keymap() look_mode = 'mouse' mouse = tcod.Mouse() new_x = None new_y = None objects = [] old_x = None old_y = None player = Object(0, 0, '@', 'player', tcod.white) player_action = '' running_direction = (0, 0) selection_coordinates = (0, 0) stairs_down = Object(0, 0, '>', 'stairs down', tcod.white) stairs_up = Object(0, 0, '<', 'stairs up', tcod.white) keycode_to_direction_tuple_map = {
def __init__(self, styles=None, keymap=None): if styles is None: styles = Styles() basic = styles.add('normal', tabsize=3, fontSize=12, fontFamily="Courier") styles.add('error', parent=basic, foreground=colors.red) styles.add('output', parent=basic, foreground=colors.blue) styles.add('input', parent=basic, foreground=colors.black) styles.add('prompt', parent=basic, foreground=colors.purple) self.styles = styles # This is a hack to get at an inner class # This will not be required in JPython-1.1 ForegroundAction = getattr( swing.text, 'StyledEditorKit$ForegroundAction') self.inputAction = ForegroundAction("start input", colors.black) if keymap is None: keymap = Keymap() keymap.bind('enter', self.enter) keymap.bind('tab', self.tab) keymap.bind('escape', self.escape) keymap.bind('up', self.uphistory) keymap.bind('down', self.downhistory) self.keymap = keymap self.document = swing.text.DefaultStyledDocument(self.styles) self.document.setLogicalStyle(0, self.styles.get('normal')) self.textpane = swing.JTextPane(self.document) self.textpane.keymap = self.keymap self.history = [] self.oldHistoryLength = 0 self.historyPosition = 0 self.command = [] self.locals = {}
def __init__(self, styles=None, keymap=None): if styles is None: styles = Styles() basic = styles.add('normal', tabsize=3, fontSize=12, fontFamily="Courier") styles.add('error', parent=basic, foreground=colors.red) styles.add('output', parent=basic, foreground=colors.blue) styles.add('input', parent=basic, foreground=colors.black) styles.add('prompt', parent=basic, foreground=colors.purple) self.styles = styles # This is a hack to get at an inner class # This will not be required in JPython-1.1 ForegroundAction = getattr(swing.text, 'StyledEditorKit$ForegroundAction') self.inputAction = ForegroundAction("start input", colors.black) if keymap is None: keymap = Keymap() keymap.bind('enter', self.enter) keymap.bind('tab', self.tab) keymap.bind('escape', self.escape) keymap.bind('up', self.uphistory) keymap.bind('down', self.downhistory) self.keymap = keymap self.document = swing.text.DefaultStyledDocument(self.styles) self.document.setLogicalStyle(0, self.styles.get('normal')) self.textpane = swing.JTextPane(self.document) self.textpane.keymap = self.keymap self.history = [] self.oldHistoryLength = 0 self.historyPosition = 0 self.command = [] self.locals = {}
def main(argv = None): if argv is None: argv = sys.argv try: try: options, arguments = getopt.getopt(argv[1:], "i:z:l:S:r:R:cm:d:v:e:") caselist = Caselist() manifest = Manifest() keymap = Keymap() # logging log = logging.getLogger('process') log.setLevel(logging.INFO) log.addHandler(logging.StreamHandler()) # process options for option, argument in options: if option in ("-h", "--help"): print __doc__ sys.exit(0) if option in ("-i", "--input"): if os.path.isfile(argument): caselist.loadCasesFromPaths(manifest.read(argument)) elif os.path.isdir(argument): caselist.loadCasesFromDir(argument) else: print "Error: case files not loaded." sys.exit(0) if option in ("-z", "--config"): if os.path.isfile(argument): Config.load(argument) else: print "Error: config file not loaded." sys.exit(0) #### load #### if option in ("-l", "--load-keymap"): keymap.load(argument) #### search/replace #### if option in ("-S", "--search-by-key-value"): keyValuePair = argument.split(':') key = keyValuePair[0] value = keyValuePair[1] caselist.searchKeys(key, value) if option in ("-r", "--substitute-key"): substituteKeys = argument.split(':') caselist.substituteKey(substituteKeys[0], substituteKeys[1]) if option in ("-R", "--subsitute-keys-from-file"): caselist.substituteKeysFromFile(argument) #### dump #### if option in ("-c", "--dump-cases"): caselist.dumpCases() if option in ("-m", "--dump-keys-by-keymap"): caselist.dumpGroupedKeys(keymap, argument) if option in ("-d", "--dump-stata"): caselist.dumpStataFiles(argument) if option in ("-v", "--dump-stata-commands"): keymap.dumpStataCommands(argument, caselist) if option in ("-e", "--dump-excel-data"): keymap.dumpExcelData(argument, caselist) #### etc #### # caselist.explore() except getopt.error, message: raise Usage(message) except Usage, error: print >>sys.stderr, error.message print >>sys.stderr, "for help use --help" return 2