当前位置: 首页>>代码示例>>Python>>正文


Python History.update方法代码示例

本文整理汇总了Python中history.History.update方法的典型用法代码示例。如果您正苦于以下问题:Python History.update方法的具体用法?Python History.update怎么用?Python History.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在history.History的用法示例。


在下文中一共展示了History.update方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: revert_actions

# 需要导入模块: from history import History [as 别名]
# 或者: from history.History import update [as 别名]
    def revert_actions(self, arg):
        """
        Calculate the actions necessary to revert to a given state, the
        argument may be one of:
          * complete set of eggs, i.e. a set of egg file names
          * revision number (negative numbers allowed)
          * datetime in ISO format, i.e. YYYY-mm-dd HH:MM:SS
          * simple strings like '1 day ago', see parse_dt module
        """
        if self.hook:
            raise NotImplementedError
        h = History(self.prefixes[0])
        h.update()
        if isinstance(arg, set):
            state = arg
        else:
            state = self._get_state(h, arg)

        curr = h.get_state()
        if state == curr:
            return []

        res = []
        for egg in curr - state:
            res.append(("remove", egg))

        for egg in state - curr:
            if not isfile(join(self.local_dir, egg)):
                self._connect()
                if self.remote.exists(egg):
                    res.append(("fetch_0", egg))
                else:
                    raise EnpkgError("cannot revert -- missing %r" % egg)
            res.append(("install", egg))
        return res
开发者ID:jasonmccampbell,项目名称:enstaller,代码行数:37,代码来源:enpkg.py

示例2: revert

# 需要导入模块: from history import History [as 别名]
# 或者: from history.History import update [as 别名]
def revert(enst, rev_in, quiet=False):
    history = History(enst.prefixes[0])
    try:
        rev = int(rev_in)
    except ValueError:
        # we have a "date string"
        from parse_dt import parse
        rev = parse(rev_in)
        if rev is None:
            sys.exit("Error: could not parse: %r" % rev_in)

    print "reverting to: %r" % rev
    try:
        state = history.get_state(rev)
    except IndexError:
        sys.exit("Error: no such revision: %r" % rev)

    curr = set(egginst.get_installed())
    if state == curr:
        print "Nothing to revert"
        return

    # remove packages
    for fn in curr - state:
        enst.remove_egg(fn)

    # install packages (fetch from server if necessary)
    to_install = []
    need_fetch = []
    for fn in state - curr:
        to_install.append(fn)
        if not isfile(join(enst.egg_dir, fn)):
            need_fetch.append(fn)
    if need_fetch:
        for fn in need_fetch:
            dist = enst.chain.get_dist(filename_as_req(fn))
            if dist:
                enst.chain.fetch_dist(dist, enst.egg_dir,
                                      dry_run=enst.dry_run)
    for fn in to_install:
        egg_path = join(enst.egg_dir, fn)
        if isfile(egg_path):
            ei = egginst.EggInst(egg_path)
            ei.install()

    history.update()
开发者ID:ilanschnell,项目名称:enstaller,代码行数:48,代码来源:main.py

示例3: revert_actions

# 需要导入模块: from history import History [as 别名]
# 或者: from history.History import update [as 别名]
    def revert_actions(self, arg):
        """
        Calculate the actions necessary to revert to a given state, the
        argument may be one of:
          * complete set of eggs, i.e. a set of egg file names
          * revision number (negative numbers allowed)
        """
        if self.hook:
            raise NotImplementedError
        h = History(self.prefixes[0])
        h.update()
        if isinstance(arg, set):
            state = arg
        else:
            try:
                rev = int(arg)
            except ValueError:
                raise EnpkgError("Error: integer expected, got: %r" % arg)
            try:
                state = h.get_state(rev)
            except IndexError:
                raise EnpkgError("Error: no such revision: %r" % arg)

        curr = h.get_state()
        if state == curr:
            return []

        res = []
        for egg in curr - state:
            if egg.startswith('enstaller'):
                continue
            res.append(('remove', egg))

        for egg in state - curr:
            if egg.startswith('enstaller'):
                continue
            if not isfile(join(self.local_dir, egg)):
                self._connect()
                if self.remote.exists(egg):
                    res.append(('fetch_0', egg))
                else:
                    raise EnpkgError("cannot revert -- missing %r" % egg)
            res.append(('install', egg))
        return res
开发者ID:shaheershantk,项目名称:Blog-Engine-Using-Flask,代码行数:46,代码来源:enpkg.py

示例4: main

# 需要导入模块: from history import History [as 别名]
# 或者: from history.History import update [as 别名]
def main():
    try:
        user_base = site.USER_BASE
    except AttributeError:
        user_base = abs_expanduser('~/.local')

    p = ArgumentParser(description=__doc__)
    p.add_argument('cnames', metavar='NAME', nargs='*',
                   help='package(s) to work on')
    p.add_argument("--add-url", metavar='URL',
                   help="add a repository URL to the configuration file")
    p.add_argument("--config", action="store_true",
                   help="display the configuration and exit")
    p.add_argument('-f', "--force", action="store_true",
                   help="force install the main package "
                        "(not its dependencies, see --forceall)")
    p.add_argument("--forceall", action="store_true",
                   help="force install of all packages "
                        "(i.e. including dependencies)")
    p.add_argument("--hook", action="store_true",
                   help="don't install into site-packages (experimental)")
    p.add_argument("--imports", action="store_true",
                   help="show which packages can be imported")
    p.add_argument('-i', "--info", action="store_true",
                   help="show information about a package")
    p.add_argument("--log", action="store_true", help="print revision log")
    p.add_argument('-l', "--list", action="store_true",
                   help="list the packages currently installed on the system")
    p.add_argument('-n', "--dry-run", action="store_true",
               help="show what would have been downloaded/removed/installed")
    p.add_argument('-N', "--no-deps", action="store_true",
                   help="neither download nor install dependencies")
    p.add_argument("--env", action="store_true",
                   help="based on the configuration, display how to set "
                        "environment variables")
    p.add_argument("--prefix", metavar='PATH',
                   help="install prefix (disregarding any settings in "
                        "the config file)")
    p.add_argument("--proxy", metavar='PROXYSTR',
                   help="use a proxy for downloads."
                        " <proxy protocol>://[<proxy username>"
                        "[:<proxy password>@]]<proxy server>:<proxy port>")
    p.add_argument("--remove", action="store_true", help="remove a package")
    p.add_argument("--remove-enstaller", action="store_true",
                   help="remove enstaller (will break enpkg)")
    p.add_argument("--revert", metavar="REV#",
                   help="revert to a previous set of packages (does not revert "
                   "enstaller itself)")
    p.add_argument('-s', "--search", action="store_true",
                   help="search the online repo index "
                        "and display versions available")
    p.add_argument("--sys-config", action="store_true",
                   help="use <sys.prefix>/.enstaller4rc (even when "
                        "~/.enstaller4rc exists)")
    p.add_argument("--sys-prefix", action="store_true",
                   help="use sys.prefix as the install prefix")
    p.add_argument("--update-all", action="store_true",
                   help="update all installed packages")
    p.add_argument("--user", action="store_true",
               help="install into user prefix, i.e. --prefix=%r" % user_base)
    p.add_argument("--userpass", action="store_true",
                   help="prompt for Enthought authentication, and save in "
                   "configuration file .enstaller4rc")
    p.add_argument('-v', "--verbose", action="store_true")
    p.add_argument('--version', action="version",
                   version='enstaller version: ' + __version__)
    p.add_argument("--whats-new", action="store_true",
                   help="display available updates for installed packages")

    args = p.parse_args()

    # Check for incompatible actions and options
    # Action options which take no package name pattern:
    simple_standalone_actions = (args.config, args.env, args.userpass,
                                args.revert, args.log, args.whats_new,
                                args.update_all, args.remove_enstaller,
                                args.add_url)
    # Action options which can take a package name pattern:
    complex_standalone_actions = (args.list, args.imports,
                                 args.search, args.info, args.remove)

    count_simple_actions = sum(bool(opt) for opt in simple_standalone_actions)
    count_complex_actions = sum(bool(opt) for opt in complex_standalone_actions)

    if count_simple_actions + count_complex_actions > 1:
        p.error('Multiple action options specified')
    if count_simple_actions > 0 and len(args.cnames) > 0:
        p.error("Option takes no arguments")

    if args.user:
        args.prefix = user_base

    if args.prefix and args.sys_prefix:
        p.error("Options --prefix and --sys-prefix exclude each other")

    if args.force and args.forceall:
        p.error("Options --force and --forceall exclude each other")

    pat = None
    if (args.list or args.search) and args.cnames:
#.........这里部分代码省略.........
开发者ID:agrawalprash,项目名称:enstaller,代码行数:103,代码来源:main.py

示例5: main

# 需要导入模块: from history import History [as 别名]
# 或者: from history.History import update [as 别名]
def main():
    try:
        user_base = site.USER_BASE
    except AttributeError:
        user_base = abs_expanduser('~/.local')

    p = ArgumentParser(description=__doc__)
    p.add_argument('cnames', metavar='NAME', nargs='*',
                   help='package(s) to work on')
    p.add_argument("--add-url", metavar='URL',
                   help="add a repository URL to the configuration file")
    p.add_argument("--config", action="store_true",
                   help="display the configuration and exit")
    p.add_argument('-f', "--force", action="store_true",
                   help="force install the main package "
                        "(not it's dependencies, see --forceall)")
    p.add_argument("--forceall", action="store_true",
                   help="force install of all packages "
                        "(i.e. including dependencies)")
    p.add_argument("--hook", action="store_true",
                   help="don't install into site-packages (experimental)")
    p.add_argument("--imports", action="store_true",
                   help="show which packages can be imported")
    p.add_argument('-i', "--info", action="store_true",
                   help="show information about a package")
    p.add_argument("--log", action="store_true", help="print revision log")
    p.add_argument('-l', "--list", action="store_true",
                   help="list the packages currently installed on the system")
    p.add_argument('-n', "--dry-run", action="store_true",
               help="show what would have been downloaded/removed/installed")
    p.add_argument('-N', "--no-deps", action="store_true",
                   help="neither download nor install dependencies")
    p.add_argument("--env", action="store_true",
                   help="based on the configuration, display how to set the "
                        "some environment variables")
    p.add_argument("--prefix", metavar='PATH',
                   help="install prefix (disregarding of any settings in "
                        "the config file)")
    p.add_argument("--proxy", metavar='URL', help="use a proxy for downloads")
    p.add_argument("--remove", action="store_true", help="remove a package")
    p.add_argument("--revert", metavar="REV",
                   help="revert to a previous set of packages")
    p.add_argument('-s', "--search", action="store_true",
                   help="search the index in the repo of packages "
                        "and display versions available.")
    p.add_argument("--sys-config", action="store_true",
                   help="use <sys.prefix>/.enstaller4rc (even when "
                        "~/.enstaller4rc exists)")
    p.add_argument("--sys-prefix", action="store_true",
                   help="use sys.prefix as the install prefix")
    p.add_argument("--user", action="store_true",
               help="install into user prefix, i.e. --prefix=%r" % user_base)
    p.add_argument("--userpass", action="store_true",
                   help="change EPD authentication in configuration file")
    p.add_argument('-v', "--verbose", action="store_true")
    p.add_argument('--version', action="version",
                   version='enstaller version: ' + __version__)
    p.add_argument("--whats-new", action="store_true",
                   help="display to which installed packages updates are "
                        "available")
    args = p.parse_args()

    if len(args.cnames) > 0 and (args.config or args.env or args.userpass or
                                 args.revert or args.log or args.whats_new):
        p.error("Option takes no arguments")

    if args.user:
        args.prefix = user_base

    if args.prefix and args.sys_prefix:
        p.error("Options --prefix and --sys-prefix exclude each ohter")

    if args.force and args.forceall:
        p.error("Options --force and --forceall exclude each ohter")

    pat = None
    if (args.list or args.search) and args.cnames:
        pat = re.compile(args.cnames[0], re.I)

    # make prefix
    if args.sys_prefix:
        prefix = sys.prefix
    elif args.prefix:
        prefix = args.prefix
    else:
        prefix = config.get('prefix', sys.prefix)

    # now make prefixes
    if prefix == sys.prefix:
        prefixes = [sys.prefix]
    else:
        prefixes = [prefix, sys.prefix]

    if args.verbose:
        print "Prefixes:"
        for p in prefixes:
            print '    %s%s' % (p, ['', ' (sys)'][p == sys.prefix])
        print

    if args.env:                                  # --env
#.........这里部分代码省略.........
开发者ID:bgrant,项目名称:enstaller,代码行数:103,代码来源:main.py

示例6: __init__

# 需要导入模块: from history import History [as 别名]
# 或者: from history.History import update [as 别名]
class Environment:
    environments = 0
    def __init__(self):
        
        #-----location part
        if parameters.location_mode:
            self.mesh_size = 1./parameters.LD0range/2
            f = lambda size: [[{} for x in xrange(int(size)+1)] for y in xrange(int(size)+1)]
            self.mesh = f(self.mesh_size)
            map_path = parameters.map_phenotype_image(parameters.maps)
            self.load_terrain(map_path+".info.tmp", map_path+".tmp")
        #------------------

        from plant import Plant
        from phenotype import Phenotype

        self.plants = {}
        self.allplantslist = []
        self.generation = 0
        self.__class__.default = self
        self.__class__.environments += 1
        debug.g("niche %d" % parameters.niche_size)
        for i in xrange(parameters.niche_size):
            if parameters.location_mode:
                Plant.new(parameters.get_start_point(parameters.maps))
            else:
                Plant.new((0,0))
        debug.g("*** %d" % len(self.plants))
        self.optimal_global_phenotype = Phenotype()
        self.base_phenotype = Phenotype()
        self.survivors = parameters.niche_size
        self.randomkiller = selectors.KillerRandom()
        (self.killer, self.reproducer) = selectors.getSelectors()
        self.phenotype_link = Phenotype
        self.history = History(self)
        self.history.update()

    def load_terrain(self, info_filename, data_filename):
        size = (0,0)
        with open(info_filename) as f:
            arrinfo = array.array('L')
            arrinfo.fromfile(f, 2)
            size = (arrinfo[0], arrinfo[1])
        self.map_size = size
        self.phenotype_map = [[(1,1,1) for y in xrange(size[1])] for x in xrange(size[0])]

        with open(data_filename) as f:
            scale = lambda x: (float(x-127)/128)*parameters.map_phenotype_amplitude/2

            arr = array.array('B')
            arr.fromfile(f, size[0]*size[1]*3)
            for y in xrange(size[1]):
                for x in xrange(size[0]):
                    self.phenotype_map[x][y] = map(scale, (lambda nr: arr[nr:nr+3])(3*x+3*size[0]*y))
                    #debug.g(size)
                    #for x in xrange(63):
                    #	debug.g(self.phenotype_map[x*10][0])

    def register_new_plant(self, number, plant):
        self.plants[number] = plant
        ##TODO
        if parameters.location_mode:
            try:
                self.mesh[plant.scalex()][plant.scaley()][number] = plant
            except:
                debug.g(plant.scalex())
                debug.g(plant.scaley())
                debug.g(number)
                0/0

    def unregister_plant(self, number):
        ##TODO
        if parameters.location_mode:
            plant = self.plants[number]
            del self.mesh[plant.scalex()][plant.scaley()][number]
        del self.plants[number]

    def advance_generation(self):
        from phenotype import Phenotype
        from plant import Plant
        from math import log, sqrt
        #self.avg_transpositions_in_this_generation = 0

    #if self.generation%10==0:
    #	debug.g("====") 
    #	debug.g(self.optimal_global_phenotype.properties)
    #	debug.g(self.base_phenotype.properties)

        if parameters.random_pressure > 0.0:
        #    for plant in self.plants.values():
        #if happened(random_pressure):
        #    plant.die()
            self.randomkiller.eliminate(self.plants.values())
        self.killer.eliminate(self.plants.values())

        #=========LOCATION
        if parameters.location_mode:
            r = parameters.LD0range
            r2 = r*r

#.........这里部分代码省略.........
开发者ID:storaged,项目名称:simulation,代码行数:103,代码来源:environment.py

示例7: main

# 需要导入模块: from history import History [as 别名]
# 或者: from history.History import update [as 别名]
def main(argv=None):
    if argv is None:
        argv = sys.argv[1:]

    try:
        user_base = site.USER_BASE
    except AttributeError:
        user_base = abs_expanduser('~/.local')

    p = ArgumentParser(description=__doc__)
    p.add_argument('cnames', metavar='NAME', nargs='*',
                   help='package(s) to work on')
    p.add_argument("--add-url", metavar='URL',
                   help="add a repository URL to the configuration file")
    p.add_argument("--config", action="store_true",
                   help="display the configuration and exit")
    p.add_argument('-f', "--force", action="store_true",
                   help="force install the main package "
                        "(not its dependencies, see --forceall)")
    p.add_argument("--forceall", action="store_true",
                   help="force install of all packages "
                        "(i.e. including dependencies)")
    p.add_argument("--freeze", help=argparse.SUPPRESS, action="store_true")
    p.add_argument("--hook", action="store_true",
                   help="don't install into site-packages (experimental)")
    p.add_argument("--imports", action="store_true",
                   help="show which packages can be imported")
    p.add_argument('-i', "--info", action="store_true",
                   help="show information about a package")
    p.add_argument("--log", action="store_true", help="print revision log")
    p.add_argument('-l', "--list", action="store_true",
                   help="list the packages currently installed on the system")
    p.add_argument('-n', "--dry-run", action="store_true",
               help="show what would have been downloaded/removed/installed")
    p.add_argument('-N', "--no-deps", action="store_true",
                   help="neither download nor install dependencies")
    p.add_argument("--env", action="store_true",
                   help="based on the configuration, display how to set "
                        "environment variables")
    p.add_argument("--prefix", metavar='PATH',
                   help="install prefix (disregarding any settings in "
                        "the config file)")
    p.add_argument("--proxy", metavar='PROXYSTR',
                   help="use a proxy for downloads."
                        " <proxy protocol>://[<proxy username>"
                        "[:<proxy password>@]]<proxy server>:<proxy port>")
    p.add_argument("--remove", action="store_true", help="remove a package")
    p.add_argument("--remove-enstaller", action="store_true",
                   help="remove enstaller (will break enpkg)")
    p.add_argument("--requirements", help=argparse.SUPPRESS)
    p.add_argument("--revert", metavar="REV#",
                   help="revert to a previous set of packages (does not revert "
                   "enstaller itself)")
    p.add_argument('-s', "--search", action="store_true",
                   help="search the online repo index "
                        "and display versions available")
    p.add_argument("--sys-config", action="store_true",
                   help="use <sys.prefix>/.enstaller4rc (even when "
                        "~/.enstaller4rc exists)")
    p.add_argument("--sys-prefix", action="store_true",
                   help="use sys.prefix as the install prefix")
    p.add_argument("--update-all", action="store_true",
                   help="update all installed packages")
    p.add_argument("--user", action="store_true",
               help="install into user prefix, i.e. --prefix=%r" % user_base)
    p.add_argument("--userpass", action="store_true",
                   help="prompt for Enthought authentication, and save in "
                   "configuration file .enstaller4rc")
    p.add_argument('-v', "--verbose", action="store_true")
    p.add_argument('--version', action="version",
                   version='enstaller version: ' + __version__)
    p.add_argument("--whats-new", action="store_true",
                   help="display available updates for installed packages")

    args = p.parse_args(argv)

    config_filename = get_config_filename(args.sys_config)
    if not os.path.isfile(config_filename):
        write_default_config(config_filename)

    config = Configuration.from_file(config_filename)

    # Check for incompatible actions and options
    # Action options which take no package name pattern:
    simple_standalone_actions = (args.config, args.env, args.userpass,
                                args.revert, args.log, args.whats_new,
                                args.update_all, args.remove_enstaller,
                                args.add_url, args.freeze, args.requirements)
    # Action options which can take a package name pattern:
    complex_standalone_actions = (args.list, args.imports,
                                 args.search, args.info, args.remove)

    count_simple_actions = sum(bool(opt) for opt in simple_standalone_actions)
    count_complex_actions = sum(bool(opt) for opt in complex_standalone_actions)

    if count_simple_actions + count_complex_actions > 1:
        p.error('Multiple action options specified')
    if count_simple_actions > 0 and len(args.cnames) > 0:
        p.error("Option takes no arguments")

#.........这里部分代码省略.........
开发者ID:dmsurti,项目名称:enstaller,代码行数:103,代码来源:main.py

示例8: Entry

# 需要导入模块: from history import History [as 别名]
# 或者: from history.History import update [as 别名]

#.........这里部分代码省略.........
				self._suspended.resume()

			if self._info_window:
				self._info_window.destroy()

			self._entry.set_sensitive(True)
			return True

		if evnt.keyval == gtk.keysyms.Escape:
			if text:
				self._entry.set_text('')
			elif self._command_state:
				self._command_state.clear()
				self.prompt()
			else:
				self._view.grab_focus()
				self.destroy()

			return True

		for handler in self._handlers:
			if (handler[0] == None or handler[0] == state) and evnt.keyval == handler[1] and handler[2](handler[3], state):
				return True

		if self._info_window and self._info_window.empty():
			self._info_window.destroy()
		
		self._history_prefix = None
		return False
	
	def on_history_move(self, direction, modifier):
		pos = self._entry.get_position()
		
		self._history.update(self._entry.get_text())
		
		if self._history_prefix == None:
			if len(self._entry.get_text()) == pos:
				self._history_prefix = self._entry.get_chars(0, pos)
			else:
				self._history_prefix = ''
		
		if self._history_prefix == None:
			hist = ''
		else:
			hist = self._history_prefix
			
		next = self._history.move(direction, hist)
		
		if next != None:
			self._entry.set_text(next)
			self._entry.set_position(-1)
		
		return True
	
	def prompt(self, pr=''):
		self._prompt = pr

		if not pr:
			pr = ''
		else:
			pr = ' ' + pr
		
		self._prompt_label.set_markup('<b>&gt;&gt;&gt;</b>%s' % pr)
	
	def make_info(self):
		if self._info_window == None:
开发者ID:alexkv,项目名称:gedit-commander,代码行数:70,代码来源:entry.py

示例9: Entry

# 需要导入模块: from history import History [as 别名]
# 或者: from history.History import update [as 别名]
class Entry(Gtk.EventBox):
    __gtype_name__ = "CommanderEntry"

    def __init__(self, view):
        Gtk.EventBox.__init__(self)
        self._view = view

        self.set_visible_window(False)

        hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 3)
        hbox.show()
        hbox.set_border_width(3)

        # context for the view
        self._entry = Gtk.Entry()
        self._entry.set_has_frame(False)
        self._entry.set_name("gedit-commander-entry")
        self._entry.show()

        css = Gtk.CssProvider()
        css.load_from_data(
            bytes(
                """
@binding-set terminal-like-bindings {
    unbind "<Control>A";

    bind "<Control>W" { "delete-from-cursor" (word-ends, -1) };
    bind "<Control>A" { "move-cursor" (buffer-ends, -1, 0) };
    bind "<Control>U" { "delete-from-cursor" (display-line-ends, -1) };
    bind "<Control>K" { "delete-from-cursor" (display-line-ends, 1) };
    bind "<Control>E" { "move-cursor" (buffer-ends, 1, 0) };
    bind "Escape" { "delete-from-cursor" (display-lines, 1) };
}

GtkEntry#gedit-commander-entry {
    gtk-key-bindings: terminal-like-bindings;

    /* Override background to anything. This is weird, but doing this we can
       then in code use widget.override_background to set the color dynamically
       to the same color as the gedit view */
    background: transparent;
    border-width: 0;
    box-shadow: 0 0 transparent;
    transition: none;
}
""",
                "utf-8",
            )
        )

        # FIXME: remove hardcopy of 600 (GTK_STYLE_PROVIDER_PRIORITY_APPLICATION)
        # https://bugzilla.gnome.org/show_bug.cgi?id=646860
        self._entry.get_style_context().add_provider(css, 600)

        self._prompt_label = Gtk.Label(label="<b>&gt;&gt;&gt;</b>", use_markup=True)
        self._prompt_label.show()

        self._entry.connect("focus-out-event", self.on_entry_focus_out)
        self._entry.connect("key-press-event", self.on_entry_key_press)

        self._history = History(os.path.join(GLib.get_user_config_dir(), "gedit/commander/history"))
        self._prompt = None

        self._accel_group = None

        hbox.pack_start(self._prompt_label, False, False, 0)
        hbox.pack_start(self._entry, True, True, 0)

        self.copy_style_from_view()
        self.view_style_updated_id = self._view.connect("style-updated", self.on_view_style_updated)

        self.add(hbox)
        self.attach()
        self._entry.grab_focus()

        self._wait_timeout = 0
        self._info_window = None

        self.connect("destroy", self.on_destroy)
        self.connect_after("size-allocate", self.on_size_allocate)
        self.view_draw_id = self._view.connect_after("draw", self.on_draw)

        self._history_prefix = None
        self._suspended = None
        self._handlers = [
            [0, Gdk.KEY_Up, self.on_history_move, -1],
            [0, Gdk.KEY_Down, self.on_history_move, 1],
            [None, Gdk.KEY_Return, self.on_execute, None],
            [None, Gdk.KEY_KP_Enter, self.on_execute, None],
            [0, Gdk.KEY_Tab, self.on_complete, None],
            [0, Gdk.KEY_ISO_Left_Tab, self.on_complete, None],
        ]

        self._re_complete = re.compile("(\"((?:\\\\\"|[^\"])*)\"?|'((?:\\\\'|[^'])*)'?|[^\s]+)")
        self._command_state = commands.Commands.State()

    def on_view_style_updated(self, widget):
        self.copy_style_from_view()

    def get_border_color(self):
#.........这里部分代码省略.........
开发者ID:purpleidea,项目名称:gedit-plugins,代码行数:103,代码来源:entry.py


注:本文中的history.History.update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。