IBus.ObservedPath

g GObject.InitiallyUnowned GObject.InitiallyUnowned IBus.Object IBus.Object GObject.InitiallyUnowned->IBus.Object GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned IBus.Serializable IBus.Serializable IBus.Object->IBus.Serializable IBus.ObservedPath IBus.ObservedPath IBus.Serializable->IBus.ObservedPath

Subclasses:

None

Methods

Inherited:

IBus.Serializable (7), IBus.Object (2), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (path, fill_stat)

class

new_from_xml_node (node, fill_stat)

check_modification ()

output (output, indent)

traverse (dir_only)

Virtual Methods

Inherited:

IBus.Serializable (3), IBus.Object (1), GObject.Object (7)

Properties

None

Signals

Inherited:

IBus.Object (1), GObject.Object (1)

Fields

Inherited:

IBus.Object (1), GObject.Object (1)

Name

Type

Access

Description

is_dir

bool

r

Whether the file is the path directory.

is_exist

bool

r

Whether the file exists.

mtime

int

r

Modified time.

parent

IBus.Serializable

r

path

str

r

Path to be handled.

Class Details

class IBus.ObservedPath(**kwargs)
Bases:

IBus.Serializable

Abstract:

No

Structure:

IBus.ObservedPathClass

IBus.ObservedPath provides methods for file path manipulation, such as monitor modification, directory tree traversal.

classmethod new(path, fill_stat)
Parameters:
  • path (str) – The path string.

  • fill_stat (bool) – Auto-fill the path status.

Returns:

A newly allocated IBus.ObservedPath.

Return type:

IBus.ObservedPath

Creates a new IBus.ObservedPath from an XML node.

classmethod new_from_xml_node(node, fill_stat)
Parameters:
  • node (IBus.XML) – An XML node that contain path.

  • fill_stat (bool) – Auto-fill the path status.

Returns:

A newly allocated IBus.ObservedPath.

Return type:

IBus.ObservedPath

Creates an new IBus.ObservedPath from an XML node.

check_modification()
Returns:

True if imtime is changed, otherwise False.

Return type:

bool

Checks whether the path is modified by comparing the mtime in object and mtime in file system.

output(output, indent)
Parameters:
  • output (GLib.String) – Path is appended to.

  • indent (int) – number of indent.

Append the observed path to a string with following format: <path mtime=”<i>modified time</i>” ><i>path</i></path>

traverse(dir_only)
Parameters:

dir_only (bool) – Only looks for subdirs, not files

Returns:

A newly allocate GLib.List which holds content in path; None if self is not directory.

Return type:

[IBus.ObservedPath]

Recursively traverse the path and put the files and subdirectory in to a newly allocated GLists, if the self is a directory. Otherwise returns None.