Gladeui.Project

g GObject.GInterface GObject.GInterface Gtk.TreeDragSource Gtk.TreeDragSource GObject.GInterface->Gtk.TreeDragSource Gtk.TreeModel Gtk.TreeModel GObject.GInterface->Gtk.TreeModel GObject.Object GObject.Object Gladeui.Project Gladeui.Project GObject.Object->Gladeui.Project Gtk.TreeDragSource->Gladeui.Project Gtk.TreeModel->Gladeui.Project

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Gtk.TreeDragSource (3), Gtk.TreeModel (28)

Structs:

GObject.ObjectClass (5)

class

load (path)

class

new ()

class

verify_property (property)

class

verify_signal (widget, signal)

add_object (object)

autosave ()

available_widget_name (widget, name)

backup (path)

cancel_load ()

check_reordered (parent, old_order)

command_cut ()

command_delete ()

command_paste (placeholder)

copy_selection ()

display_dependencies ()

get_add_item ()

get_css_provider_path ()

get_file_mtime ()

get_has_selection ()

get_license ()

get_modified ()

get_name ()

get_objects ()

get_path ()

get_pointer_mode ()

get_readonly ()

get_resource_path ()

get_target_version (catalog, major, minor)

get_template ()

get_translation_domain ()

get_widget_by_name (name)

has_object (object)

is_loading ()

is_selected (object)

load_cancelled ()

load_from_file (path)

new_widget_name (widget, base_name)

next_redo_item ()

next_undo_item ()

preview (gwidget)

properties ()

push_progress ()

push_undo (cmd)

queue_selection_changed ()

redo ()

redo_items ()

remove_object (object)

required_libs ()

reset_path ()

resource_fullpath (resource)

save (path)

save_verify (path, flags)

selection_add (object, emit_signal)

selection_changed ()

selection_clear (emit_signal)

selection_get ()

selection_remove (object, emit_signal)

selection_set (object, emit_signal)

set_add_item (adaptor)

set_css_provider_path (path)

set_license (license)

set_pointer_mode (mode)

set_resource_path (path)

set_target_version (catalog, major, minor)

set_template (widget)

set_translation_domain (domain)

set_widget_name (widget, name)

toplevels ()

undo ()

undo_items ()

verify (saving, flags)

verify_widget_adaptor (adaptor, mask)

widget_changed (gwidget)

widget_visibility_changed (widget, visible)

writing_preview ()

Virtual Methods

Inherited:

GObject.Object (7), Gtk.TreeDragSource (3), Gtk.TreeModel (19)

do_add_object (object)

do_changed (command, forward)

do_close ()

do_next_redo_item ()

do_next_undo_item ()

do_parse_finished ()

do_push_undo (cmd)

do_redo ()

do_remove_object (object)

do_selection_changed ()

do_undo ()

do_widget_name_changed (widget)

Properties

Name

Type

Flags

Short Description

add-item

Gladeui.WidgetAdaptor

r

The current item to add to the project

css-provider-path

str

r/w

Path to use as the custom CSS provider for this project.

has-selection

bool

r

Whether project has a selection

license

str

r/w

License for this project, it will be added as a document level comment.

modified

bool

r

Whether project has been modified since it was last saved

path

str

r

The filesystem path of the project

pointer-mode

Gladeui.PointerMode

r

The currently effective Gladeui.PointerMode

read-only

bool

r

Whether project is read-only

resource-path

str

r/w

Path to load images and resources in Glade’s runtime

template

Gladeui.Widget

r/w

The project’s template widget, if any

translation-domain

str

r/w

The project translation domain

Signals

Inherited:

GObject.Object (1), Gtk.TreeModel (5)

Name

Short Description

activate-signal-handler

add-signal-handler

add-widget

Emitted when a widget is added to a project.

change-signal-handler

changed

Emitted when a gladeproject's state changes via a Gladeui.Command.

close

Emitted when a project is closing (a good time to clean up any associated resources).

load-progress

Emitted while project is loading.

parse-began

Emitted when gladeproject parsing starts.

parse-finished

Emitted when gladeproject parsing has finished.

remove-signal-handler

remove-widget

Emitted when a widget is removed from a project.

selection-changed

Emitted when gladeproject selection list changes.

targets-changed

Emitted when gladeproject target versions change.

widget-name-changed

Emitted when gwidget's name changes.

widget-visibility-changed

Emitted when the visibility of a widget changed

Fields

Inherited:

GObject.Object (1), Gtk.TreeModel (5)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class Gladeui.Project(**kwargs)
Bases:

GObject.Object, Gtk.TreeDragSource, Gtk.TreeModel

Abstract:

No

Structure:

Gladeui.ProjectClass

classmethod load(path)
Parameters:

path (str) – the path of the project to load

Returns:

a new Gladeui.Project for the opened project on success, None on failure

Return type:

Gladeui.Project or None

Opens a project at the given path.

classmethod new()
Returns:

a new Gladeui.Project

Return type:

Gladeui.Project

Creates a new Gladeui.Project.

classmethod verify_property(property)
Parameters:

property (Gladeui.Property) –

classmethod verify_signal(widget, signal)
Parameters:
add_object(object)
Parameters:

object (GObject.Object) – the GObject.Object to add

Adds an object to the project.

autosave()
Raises:

GLib.Error

Returns:

True on success, False on failure

Return type:

bool

Saves an autosave snapshot of self to it’s currently set path

If the project was never saved, nothing is done and True is returned.

available_widget_name(widget, name)
Parameters:
Returns:

whether the name is available or not.

Return type:

bool

Checks whether name is an appropriate name for widget.

backup(path)
Parameters:

path (str) – location to save glade file

Raises:

GLib.Error

Returns:

True on success, False on failure

Return type:

bool

Backup the last file which self has saved to or was loaded from.

If path is not the same as the current project path, then the current project path will be backed up under the new location.

If this the first save, and no persisted file exists, then True is returned and no backup is made.

cancel_load()
check_reordered(parent, old_order)
Parameters:
command_cut()
command_delete()
command_paste(placeholder)
Parameters:

placeholder (Gladeui.Placeholder) –

copy_selection()
display_dependencies()
Return type:

str

get_add_item()
Returns:

a Gladeui.WidgetAdaptor

Return type:

Gladeui.WidgetAdaptor

get_css_provider_path()
Returns:

the CSS path of the custom provider used for self

Return type:

str

get_file_mtime()
Return type:

int

get_has_selection()
Returns:

whether self currently has a selection

Return type:

bool

get_license()
Return type:

str

get_modified()
Returns:

True if the project has been modified since it was last saved

Return type:

bool

Get’s whether the project has been modified since it was last saved.

get_name()
Return type:

str

get_objects()
Returns:

List of all objects in this project

Return type:

[GObject.Object]

get_path()
Return type:

str

get_pointer_mode()
Return type:

Gladeui.PointerMode

get_readonly()
Returns:

True if project is read only

Return type:

bool

Gets whether the project is read only or not

get_resource_path()
Return type:

str

get_target_version(catalog, major, minor)
Parameters:
  • catalog (str) – the name of the catalog self includes

  • major (int) – the return location for the target major version

  • minor (int) – the return location for the target minor version

Fetches the target version of the self for catalog.

get_template()
Returns:

a Gladeui.Widget

Return type:

Gladeui.Widget

get_translation_domain()
Returns:

the translation domain

Return type:

str

get_widget_by_name(name)
Parameters:

name (str) – The user visible name of the widget we are looking for

Returns:

a pointer to the widget, None if the widget does not exist

Return type:

Gladeui.Widget or None

Searches under ancestor in self looking for a Gladeui.Widget named name.

has_object(object)
Parameters:

object (GObject.Object) – the GObject.Object to search

Returns:

whether this object is in this project.

Return type:

bool

is_loading()
Returns:

Whether the project is being loaded or not

Return type:

bool

is_selected(object)
Parameters:

object (GObject.Object) – a GObject.Object

Returns:

whether object is in self selection

Return type:

bool

load_cancelled()
Return type:

bool

load_from_file(path)
Parameters:

path (str) –

Return type:

bool

new_widget_name(widget, base_name)
Parameters:
Returns:

a string containing the new name, None if there is not enough memory for this string

Return type:

str

Creates a new name for a widget that doesn’t collide with any of the names already in self. This name will start with base_name.

Note the widget parameter is ignored and preserved only for historical reasons.

next_redo_item()
Returns:

the Gladeui.Command

Return type:

Gladeui.Command

Gets the next redo item on self's command stack.

next_undo_item()
Returns:

the Gladeui.Command

Return type:

Gladeui.Command

Gets the next undo item on self's command stack.

preview(gwidget)
Parameters:

gwidget (Gladeui.Widget) – a Gladeui.Widget

Creates and displays a preview window holding a snapshot of gwidget's toplevel window in self. Note that the preview window is only a snapshot of the current state of the project, there is no limit on how many preview snapshots can be taken.

properties()

Runs a document properties dialog for self.

push_progress()
push_undo(cmd)
Parameters:

cmd (Gladeui.Command) – the Gladeui.Command

Pushes a newly created Gladeui.Command onto projects stack.

queue_selection_changed()
redo()

Redoes a Gladeui.Command in this project.

redo_items()
Returns:

A newly created menu

Return type:

Gtk.Widget

Creates a menu of the undo items in the project stack

remove_object(object)
Parameters:

object (GObject.Object) – the GObject.Object to remove

Removes object from self.

Note that when removing the GObject.Object from the project we don’t change ->project in the associated Gladeui.Widget; this way UNDO can work.

required_libs()
Returns:

a GLib.List of allocated strings which are the names of the required catalogs for this project

Return type:

[str]

reset_path()
resource_fullpath(resource)
Parameters:

resource (str) – The resource basename

Returns:

A newly allocated string holding the full path to the resource.

Return type:

str

Project resource strings are always relative, this function transforms a path relative to project to a full path.

save(path)
Parameters:

path (str) – location to save glade file

Raises:

GLib.Error

Returns:

True on success, False on failure

Return type:

bool

Saves self to the given path.

save_verify(path, flags)
Parameters:
Raises:

GLib.Error

Returns:

True on success, False on failure

Return type:

bool

Saves self to the given path.

selection_add(object, emit_signal)
Parameters:

Adds object to the selection chain of self

If emit_signal is True, calls Gladeui.Project.selection_changed().

selection_changed()

Causes self to emit a “selection_changed” signal.

selection_clear(emit_signal)
Parameters:

emit_signal (bool) – whether or not to emit a signal indication a selection change

Clears self's selection chain

If emit_signal is True, calls Gladeui.Project.selection_changed().

selection_get()
Returns:

a GLib.List containing the Gtk.Widget items currently selected in self

Return type:

[Gtk.Widget]

selection_remove(object, emit_signal)
Parameters:

Removes object from the selection chain of self

If emit_signal is True, calls Gladeui.Project.selection_changed().

selection_set(object, emit_signal)
Parameters:

Set the selection in self to object

If emit_signal is True, calls Gladeui.Project.selection_changed().

set_add_item(adaptor)
Parameters:

adaptor (Gladeui.WidgetAdaptor) – a Gladeui.WidgetAdaptor

set_css_provider_path(path)
Parameters:

path (str) – a CSS file path

Set the custom CSS provider path to use in self

set_license(license)
Parameters:

license (str) –

set_pointer_mode(mode)
Parameters:

mode (Gladeui.PointerMode) –

set_resource_path(path)
Parameters:

path (str) –

set_target_version(catalog, major, minor)
Parameters:
  • catalog (str) –

  • major (int) –

  • minor (int) –

set_template(widget)
Parameters:

widget (Gladeui.Widget) –

set_translation_domain(domain)
Parameters:

domain (str) – the translation domain

Set the project translation domain.

set_widget_name(widget, name)
Parameters:

Sets name on widget in self, if name is not available then a new name will be used.

toplevels()
Returns:

a GLib.List containing the Gtk.Widget toplevel items in self

Return type:

[Gtk.Widget]

undo()

Undoes a Gladeui.Command in this project.

undo_items()
Returns:

A newly created menu

Return type:

Gtk.Widget

Creates a menu of the undo items in the project stack

verify(saving, flags)
Parameters:
Return type:

bool

verify_widget_adaptor(adaptor, mask)
Parameters:
Returns:

A newly allocated string

Return type:

str

Checks the supported state of this widget adaptor and generates a string to show in the UI describing why.

widget_changed(gwidget)
Parameters:

gwidget (Gladeui.Widget) –

widget_visibility_changed(widget, visible)
Parameters:
  • widget (Gladeui.Widget) – The widget which visibility changed

  • visible (bool) – widget visibility value

Emits Gladeui.Project ::widget-visibility-changed signal

writing_preview()
Return type:

bool

do_add_object(object) virtual
Parameters:

object (Gladeui.Widget) – the GObject.Object to add

Adds an object to the project.

do_changed(command, forward) virtual
Parameters:
do_close() virtual
do_next_redo_item() virtual
Returns:

the Gladeui.Command

Return type:

Gladeui.Command

Gets the next redo item on project's command stack.

do_next_undo_item() virtual
Returns:

the Gladeui.Command

Return type:

Gladeui.Command

Gets the next undo item on project's command stack.

do_parse_finished() virtual
do_push_undo(cmd) virtual
Parameters:

cmd (Gladeui.Command) – the Gladeui.Command

Pushes a newly created Gladeui.Command onto projects stack.

do_redo() virtual

Redoes a Gladeui.Command in this project.

do_remove_object(object) virtual
Parameters:

object (Gladeui.Widget) – the GObject.Object to remove

Removes object from project.

Note that when removing the GObject.Object from the project we don’t change ->project in the associated Gladeui.Widget; this way UNDO can work.

do_selection_changed() virtual

Causes project to emit a “selection_changed” signal.

do_undo() virtual

Undoes a Gladeui.Command in this project.

do_widget_name_changed(widget) virtual
Parameters:

widget (Gladeui.Widget) –

Signal Details

Gladeui.Project.signals.activate_signal_handler(project, gladewidget, signal)
Signal Name:

activate-signal-handler

Flags:

RUN_LAST

Parameters:
Gladeui.Project.signals.add_signal_handler(project, gladewidget, signal)
Signal Name:

add-signal-handler

Flags:

RUN_LAST

Parameters:
Gladeui.Project.signals.add_widget(project, arg1)
Signal Name:

add-widget

Flags:

RUN_LAST

Parameters:

Emitted when a widget is added to a project.

Gladeui.Project.signals.change_signal_handler(project, gladewidget, old_signal, new_signal)
Signal Name:

change-signal-handler

Flags:

RUN_LAST

Parameters:
Gladeui.Project.signals.changed(project, arg1, arg2)
Signal Name:

changed

Flags:

RUN_FIRST

Parameters:

Emitted when a gladeproject's state changes via a Gladeui.Command.

Gladeui.Project.signals.close(project)
Signal Name:

close

Flags:

RUN_LAST

Parameters:

project (Gladeui.Project) – The object which received the signal

Emitted when a project is closing (a good time to clean up any associated resources).

Gladeui.Project.signals.load_progress(project, objects_total, objects_loaded)
Signal Name:

load-progress

Flags:

RUN_FIRST

Parameters:
  • project (Gladeui.Project) – The object which received the signal

  • objects_total (int) – the total amount of objects to load

  • objects_loaded (int) – the current amount of loaded objects

Emitted while project is loading.

Gladeui.Project.signals.parse_began(project)
Signal Name:

parse-began

Flags:

RUN_FIRST

Parameters:

project (Gladeui.Project) – The object which received the signal

Emitted when gladeproject parsing starts.

Gladeui.Project.signals.parse_finished(project)
Signal Name:

parse-finished

Flags:

RUN_FIRST

Parameters:

project (Gladeui.Project) – The object which received the signal

Emitted when gladeproject parsing has finished.

Gladeui.Project.signals.remove_signal_handler(project, gladewidget, signal)
Signal Name:

remove-signal-handler

Flags:

RUN_LAST

Parameters:
Gladeui.Project.signals.remove_widget(project, arg1)
Signal Name:

remove-widget

Flags:

RUN_LAST

Parameters:

Emitted when a widget is removed from a project.

Gladeui.Project.signals.selection_changed(project)
Signal Name:

selection-changed

Flags:

RUN_LAST

Parameters:

project (Gladeui.Project) – The object which received the signal

Emitted when gladeproject selection list changes.

Gladeui.Project.signals.targets_changed(project)
Signal Name:

targets-changed

Flags:

RUN_FIRST

Parameters:

project (Gladeui.Project) – The object which received the signal

Emitted when gladeproject target versions change.

Gladeui.Project.signals.widget_name_changed(project, arg1)
Signal Name:

widget-name-changed

Flags:

RUN_LAST

Parameters:

Emitted when gwidget's name changes.

Gladeui.Project.signals.widget_visibility_changed(project, widget, visible)
Signal Name:

widget-visibility-changed

Flags:

RUN_FIRST

Parameters:
  • project (Gladeui.Project) – The object which received the signal

  • widget (Gladeui.Widget) – the widget that its visibility changed

  • visible (bool) – the current visibility of the widget

Emitted when the visibility of a widget changed

Property Details

Gladeui.Project.props.add_item
Name:

add-item

Type:

Gladeui.WidgetAdaptor

Default Value:

None

Flags:

READABLE

The current item to add to the project

Gladeui.Project.props.css_provider_path
Name:

css-provider-path

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

Path to use as the custom CSS provider for this project.

Gladeui.Project.props.has_selection
Name:

has-selection

Type:

bool

Default Value:

False

Flags:

READABLE

Whether project has a selection

Gladeui.Project.props.license
Name:

license

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

License for this project, it will be added as a document level comment.

Gladeui.Project.props.modified
Name:

modified

Type:

bool

Default Value:

False

Flags:

READABLE

Whether project has been modified since it was last saved

Gladeui.Project.props.path
Name:

path

Type:

str

Default Value:

None

Flags:

READABLE

The filesystem path of the project

Gladeui.Project.props.pointer_mode
Name:

pointer-mode

Type:

Gladeui.PointerMode

Default Value:

Gladeui.PointerMode.SELECT

Flags:

READABLE

The currently effective Gladeui.PointerMode

Gladeui.Project.props.read_only
Name:

read-only

Type:

bool

Default Value:

False

Flags:

READABLE

Whether project is read-only

Gladeui.Project.props.resource_path
Name:

resource-path

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

Path to load images and resources in Glade’s runtime

Gladeui.Project.props.template
Name:

template

Type:

Gladeui.Widget

Default Value:

None

Flags:

READABLE, WRITABLE

The project’s template widget, if any

Gladeui.Project.props.translation_domain
Name:

translation-domain

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

The project translation domain