Xfce.org | Xfce Goodies | Xfce Foundation Classes | Xfce Bug Tracker | Xfce Wiki | Xfce Forum | Xfce-look | Xfce DevBlog    
Logo Python Bindings

... and everything goes faster !

   
Home | Overview | Screenshots | News | Documentation | Download | Development | Credits | Links

Online documentation

For the 4.4 branch of pyxfce and Xfce.

What is it?

pyxfce can be used to interface with the Xfce desktop via Python.

The following modules exist:

xfce4.util

Strings

LICENSE_BSD - (translated) BSD license.

LICENSE_GPL - (translated) GPL license hint - a short text saying that the program is released under GNU General Public License.

LICENSE_LGPL - (translated) LGPL license hint - a short text saying that the program is released under LGPL.

Enumerated Types

ResourceType - represents what kind of resource you want to look up. Possible values:
  • RESOURCE_CACHE
  • RESOURCE_CONFIG
  • RESOURCE_DATA
  • RESOURCE_ICONS
  • RESOURCE_THEMES

Functions

desktop_entry_new(file_name, keys :: list of str) => DesktopEntry

Loads the specified Desktop Entry file. Raises OSError on error.

get_dir_localized(file_name)

Checks if there is a directory named similar to file_name, just with a suffix like ".de". Returns the name of the localized file or, if that's not possible, the original name.

get_dir_localized_r(file_name)

Checks if there is a directory named similar to file_name, just with a suffix like ".de". Returns the name of the localized file or, if that's not possible, the original name.

get_file_localized(file_name)

Checks if there is a file named similar to file_name, just with a suffix like ".de". Returns the name of the localized file or, if that's not possible, the original name.

get_file_localized_r(file_name)

Checks if there is a file named similar to file_name, just with a suffix like ".de". Returns the name of the localized file or, if that's not possible, the original name.

get_homedir()

Returns the path to the user's Home Directory.

get_userdir()

Returns the path to the user's ".xfce" directory.

locale_match(locale_name_1, locale_name_2)

Returns whether two locale names match somewhat.

mkdirhier(name)

Recursively creates all the directories mentioned in name (if necessary), finally does mkdir(name).

resource_lookup(resource_type, file_name) => file_name

resource_pop_path(resource_type)

resource_push_path(resource_type, path)

resource_save_location(resource_type, relative_path, create_flag)

textdomain(package_name, locale_name, encoding_name_or_None)

utf8_remove_controls(text) => text

version_string()

Returns the current libxfce4util version as a string.

Classes

DesktopEntry

Represents a Freedesktop Desktop Entry. (see Howto_desktop_files and Desktop Entry Specification).

Usage
import xfce4.util
name = "/usr/share/applications/xchat.desktop"
entry = xfce4.util.desktop_entry_new(name, ["Name"])
Functions
get_file() => name

Returns the file name.

get_int(key)

Fetches the entry with the specified key and returns its value or, if that's impossible, None.

get_string(key)

Fetches the entry with the specified key and returns its value or, if that's impossible, None.

has_translated_entry(key)

Returns whether the specified key has a translated entry.


xfce4.gui - widgets that should have been in GTK

Enumerated Types

ClockMode

Possible values:

  • CLOCK_ANALOG
  • CLOCK_DIGITAL
  • CLOCK_LEDS

SessionClientState

Possible values:

  • ON_CLIENT_DISCONNECTED
  • ON_CLIENT_DONE_WITH_INTERACT
  • ON_CLIENT_FROZEN
  • ON_CLIENT_IDLE
  • ON_CLIENT_REGISTERING
  • ON_CLIENT_SAVING_PHASE_1
  • ON_CLIENT_SAVING_PHASE_2
  • ON_CLIENT_WAITING_FOR_INTERACT
  • ON_CLIENT_WAITING_FOR_PHASE_2

SessionInteractStyle

Possible values:

  • ON_INTERACT_ANY
  • ON_INTERACT_ERRORS
  • ON_INTERACT_NONE

RestartStyle

Possible values:

  • ON_RESTART_ANYWAY
  • ON_RESTART_IF_RUNNING
  • ON_RESTART_IMMEDIATELY
  • ON_RESTART_NEVER

FileChooserAction

Possible values:

  • FILE_CHOOSER_ACTION_CREATE_FOLDER
  • FILE_CHOOSER_ACTION_OPEN
  • FILE_CHOOSER_ACTION_SAVE
  • FILE_CHOOSER_ACTION_SELECT_FOLDER

FilterStatus

Possible values:

  • ILTER_CONTINUE
  • ILTER_STOP

'ClientState', 'ClockLedSize', 'DECORBUTTON_CLOSE', 'DECORBUTTON_HIDE', 'DecorbuttonType', 'InteractStyle', 'STARTUP_NOTIFICATION_ID_KEY',

Functions

app_menu_item_new_from_desktop_entry(desktop_entry, show_icon_flag)

Creates an AppMenuItem from a DesktopEntry.

app_menu_item_new_full(label, command, icon_name, needs_terminal_flag, startup_notification_flag) => AppMenuItem

app_menu_item_new_with_command(label, command) => AppMenuItem

app_menu_item_new_with_label(label) => AppMenuItem

app_menu_item_new_with_mnemonic(mnemonic) => AppMenuItem

app_menu_item_set_icon_size - Deprecated, do not use.

app_menu_item_set_icon_theme_name(theme_name)

'color_button_new_with_color', 'create_header', 'create_header_with_image', 'create_mixed_button', 'create_small_label', 'exec_command', 'gdk_display_get_fullname', 'gdk_screen_get_fullname', 'gdk_spawn_command_line_on_screen', 'get_executable_by_command_line', 'get_style', 'get_style_gc', 'gtk_window_center_on_monitor', 'gtk_window_center_on_monitor_with_pointer', 'icon_theme_get_for_screen', 'iconbutton_new_from_pixbuf', 'load_themed_icon',

menubutton_new_with_pixbuf(text, pixbuf) => gtk.Button

menubutton_new_with_stock_icon(text, stock_ID) =>gtk.Button

pixbuf_new_from_file_at_size - Deprecated, do not use.

scaled_image_new_from_pixbuf(pixbuf) => ScaledImage

confirm(text, stock_ID, action)

show_error(text)

show_info(text)

show_warning(text)

'small_label', 'spawn_args', 'spawn_command_line', 'spawn_command_line_cb', 'spawn_xyz', 'startup_notification_cancel', 'startup_notification_start', 'system_tray_check_running',

themed_icon_add_search_path - Deprecated.

themed_icon_load(name, size)

Loads the specified icon at the specified size and returns it as a gtk.gdk.Pixbuf.

themed_icon_load_category(category :: IconThemeCategory, size)

Loads an icon to represent the category and returns it as a gtk.gdk.Pixbuf.

themed_icon_lookup(name, size)

Returns the file name of the specified icon.

themed_icon_lookup_category(category :: IconThemeCategory, size)

Returns the file name of an icon to represent the category.

themed_icon_set_icon_theme - Deprecated, do not call.

titled_dialog_new_with_buttons(title, parent, flags :: gtk.DialogFlags, *args) => TitledDialog

Classes

AboutDialog - a Version Info dialog.

AppMenuItem

Clock - a nice clock that can display analog, digital or LED human time.

ScaledImage - like gtk.Image, but scales the image to the widget size.

SystemTray - a system tray (notification area). NOT a single icon in it, but the entire tray. If you want a single item, see netk.TrayIcon

TitledDialog - a dialog with a header box.

Togglebutton

a button that stays in depressed or raised state until you click it, then it will toggle to the other state.

Decorbutton

Decortoggle

Framebox

IconTheme

Iconbutton

Menubutton

Movehandler


xfce4.mcs - Configuration System

Classes

Channel

Usage
import xfce4.mcs
client = xfce4.mcs.Client()
WLAN_channel = xfce4.mcs.Channel("WLAN")
WLAN_channel.connect("setting_changed", reconfigure)
client.register_channel(WLAN_channel)

# remainder of the program...
props
channel_name

The MCS channel name (string).

Signals
  • setting_changed(name) - Emitted when a setting was changed.
  • setting_deleted(name) - Emitted when a setting was deleted.
  • setting_added(name) - Emitted when a setting was added.
Functions
get_setting(name)

Queries the specified setting and returns its current value.

get_setting_string(name)

Queries the specified setting and returns its current value if it is a string, otherwise None.

get_setting_color(name)

Queries the specified setting and returns its current value if it is a MCS color, otherwise None.

get_setting_int(name)

Queries the specified setting and returns its current value if it is an integer, otherwise None.

set_setting(name, value)

Sets the value of the specified setting. Value must be a string and will be converted to the proper type. Only works when we are the MCS manager.

set_setting_string(name, value)

Sets the value of the specified setting. Only works when we are the MCS manager.

set_setting_int(name, value)

Sets the value of the specified setting. Only works when we are the MCS manager.

set_setting_color(name, value)

Sets the value of the specified setting. Only works when we are the MCS manager.

delete_setting(name)

Deletes the specified setting. Only works when we are the MCS manager.

delete(name)

Remove ourselves from the MCS manager.

add_channel_from_file(file_name)

adds a channel by loading data from a previously stored file.

save_channel_to_file(file_name)

saves the channel contents to the specified file.

Client

Usage
import xfce4.mcs
client = xfce4.mcs.Client()
WLAN_channel = xfce4.mcs.Channel("WLAN")
WLAN_channel.connect("setting_changed", reconfigure)
client.register_channel(WLAN_channel)

# remainder of the program...
props
screen

The gtk.gdk.Screen to use. read-write.

Signals
  • manager_reconnected() - the MCS manager reconnected.
Functions
check_manager()

Checks whether connected to the MCS Manager and returns True if we are.

delete_channel(name)

Deletes the channel with the specified name.

get_screen()

Returns the GDK screen on which the manager is.

register_channel(channel)

Registers the specified MCS channel.

unregister_channel(channel)

Unregisters the specified MCS channel.

set_screen

sets the gtk.gdk.Screen to use.

show_dialog(name)

Shows the specified MCS settings (like xfce-setting-show).

Manager

Abstract class.

Functions
register_channel(channel)

Registers the specified MCS channel with the Manager.

unregister_channel(channel)

Unregisters the specified MCS channel from the Manager.


xfce4.netk - Communicating with the Window Manager

Enumerated Types

PagerDisplayMode

Possible values:

  • PAGER_DISPLAY_CONTENT
  • PAGER_DISPLAY_NAME

TasklistGroupingType

Possible values:

  • TASKLIST_ALWAYS_GROUP
  • TASKLIST_AUTO_GROUP
  • TASKLIST_NEVER_GROUP

WindowActions

Possible values: set of

  • WINDOW_ACTION_CHANGE_WORKSPACE
  • WINDOW_ACTION_CLOSE
  • WINDOW_ACTION_MAXIMIZE
  • WINDOW_ACTION_MAXIMIZE_HORIZONTALLY
  • WINDOW_ACTION_MAXIMIZE_VERTICALLY
  • WINDOW_ACTION_MINIMIZE
  • WINDOW_ACTION_MOVE
  • WINDOW_ACTION_RESIZE
  • WINDOW_ACTION_SHADE
  • WINDOW_ACTION_STICK
  • WINDOW_ACTION_UNMAXIMIZE
  • WINDOW_ACTION_UNMAXIMIZE_HORIZONTALLY
  • WINDOW_ACTION_UNMAXIMIZE_VERTICALLY
  • WINDOW_ACTION_UNMINIMIZE
  • WINDOW_ACTION_UNSHADE
  • WINDOW_ACTION_UNSTICK

WindowType

Possible values:

  • WINDOW_TOOLBAR
  • WINDOW_UTILITY
  • WINDOW_DESKTOP
  • WINDOW_DIALOG
  • WINDOW_DOCK
  • WINDOW_MENU
  • WINDOW_MODAL_DIALOG
  • WINDOW_NORMAL
  • WINDOW_SPLASHSCREEN

WindowState

Possible values:

  • WINDOW_STATE_DEMANDS_ATTENTION
  • WINDOW_STATE_FULLSCREEN
  • WINDOW_STATE_HIDDEN
  • WINDOW_STATE_MAXIMIZED_HORIZONTALLY
  • WINDOW_STATE_MAXIMIZED_VERTICALLY
  • WINDOW_STATE_MINIMIZED
  • WINDOW_STATE_SHADED
  • WINDOW_STATE_SKIP_PAGER
  • WINDOW_STATE_SKIP_TASKLIST
  • WINDOW_STATE_STICKY
  • WINDOW_STATE_URGENT

Classes

Application

Functions
get_icon_is_fallback()
get_mini_icon()
get_n_windows()
get_pid()
get_windows()
get_xid()

ClassGroup

Functions
get_mini_icon()
get_res_class()
get_windows()

Pager

Parent class

gtk.Widget

Usage
import xfce4.netk
pager = xfce4.netk.Pager(xfce4.netk.screen_get_default())
# or xfce4.netk.screen_get or whatever.
pager.show()
window.add(pager)
Functions
set_display_mode(PagerDisplayMode)
set_n_rows(count)
set_orientation(gtk.Orientation)
set_shadow_type(gtk.ShadowType)
set_show_all(flag)

Screen

Usage
import xfce4.netk
screen = xfce4.netk.screen_get_default()
# or screen_get, or screen_get_for_root

print screen.get_windows()
Signals
  • active_window_changed(screen)
  • active_workspace_changed(screen)
  • window_stacking_changed(screen)
  • window_opened(screen, window)
  • window_closed(screen, window)
  • workspace_created(screen, workspace)
  • workspace_destroyed(screen, workspace)
  • application_opened(screen, application)
  • application_closed(screen, application)
  • class_group_opened(screen, class_group)
  • class_group_closed(screen, class_group)
  • background_changed(screen)
  • showing_desktop_changed(screen)
  • viewports_changed(screen)
Functions
change_workspace_count(count)
force_update()
get_active_window() => Window
get_active_workspace() => Workspace
get_background_pixmap() => gtk.gdk.Pixmap
get_height()
get_number()
get_showing_desktop()
get_width()
get_windows()
get_windows_stacked()
get_workspace() => Workspace
get_workspace_count()
get_workspaces()
move_viewport(x, y)
net_wm_supports(atom)
release_workspace_layout(token)
toggle_showing_desktop(flag)
try_set_workspace_layout(token, row_count, column_count)

TrayIcon

Usage
import xfce4.netk
import gtk

tray_icon = xfce4.netk.TrayIcon(gtk.gdk.screen_get_default())
tray_icon.show()
props
embedded
Functions
get_id()
-->
message_cancel(ID :: int)
message_new(ID :: int, text)

Window

Functions

activate_transient()
close()
get_actions() => WindowActions
get_application() => Application
get_class_group() => ClassGroup
get_client_machine() => str
get_geometry()
get_group_leader()
get_icon_is_fallback
get_mini_icon()
get_pid()
get_resource_class()
get_resource_name()
get_session_id()
get_session_id_utf8()
get_state() => WindowState
get_window_type() => WindowType
get_workspace() => Workspace
get_xid()
is_in_viewport
is_maximized()
is_maximized_horizontally()
is_maximized_vertically()
is_minimized()
is_on_workspace
is_pinned()
is_shaded()
is_skip_pager()
is_skip_tasklist()
is_sticky()
is_visible_on_workspace
keyboard_move
keyboard_size
maximize_horizontally()
maximize_vertically()
minimize()
move_to_workspace
pin()
set_icon_geometry
set_skip_pager
set_skip_tasklist
shade()
unmaximize_horizontally()
unmaximize_vertically()
unminimize()
unpin()
unshade()

Workspace

Functions
change_name(new_name)
get_height()
get_number()
get_viewport_x()
get_viewport_y()
get_width()
is_virtual()

Functions

application_get

class_group_get

create_window_action_menu(window) => gtk.Menu

Given a netk.Window, will return an action menu for it.

screen_get(index)

Returns the xfce4.netk.Screen with the specified index (index is the same as for X screens).

screen_get_default()

Returns the default xfce4.netk.Screen.

screen_get_for_root(XID)

Returns the xfce4.netk.Screen for the given root window XID, if available. Will not go out of its way to find out. If it knows one, it is returned. Otherwise, None is returned.

window_get(XID)

Returns the xfce4.netk.Window for the given XID, if available. Will not go out of its way to find one. If it knows one, it is returned. Otherwise, None is returned.


xfce4.panel - Write your own Panel Plugins

Enumerated Types

ScreenPosition

Possible values:

  • SCREEN_POSITION_E
  • SCREEN_POSITION_FLOATING_H
  • SCREEN_POSITION_FLOATING_V
  • SCREEN_POSITION_N
  • SCREEN_POSITION_NE_H
  • SCREEN_POSITION_NE_V
  • SCREEN_POSITION_NONE
  • SCREEN_POSITION_NW_H
  • SCREEN_POSITION_NW_V
  • SCREEN_POSITION_S
  • SCREEN_POSITION_SE_H
  • SCREEN_POSITION_SE_V
  • SCREEN_POSITION_SW_H
  • SCREEN_POSITION_SW_V
  • SCREEN_POSITION_W

Classes

ArrowButton

props
active
arrow_type
draw_indicator
inconsistent
Functions
do_toggled
draw_indicator
get_active
get_arrow_type
get_inconsistent
get_mode
set_active
set_arrow_type
set_inconsistent
set_mode
toggled

Itembar

props
orientation - read-write
Signals
  • orientation-changed
  • contents-changed
Functions
['append', 'event_window_is_raised', 'get_child_expand', 'get_drop_index', 'get_item_at_point', 'get_item_index', 'get_n_items', 'get_nth_item', 'insert', 'lower_event_window', 'prepend', 'raise_event_window', 'set_child_expand']

PanelWindow

props
orientation
Functions
['get_movable', 'set_movable', 'set_show_border']

Plugin

props
display_name - read-only
embedded - read-only
expand - read-write
id - read-only
screen_position - read-only
size - read-only
Attributes
  • horizontal - whether the plugin is in a horizontal panel.
  • vertical - whether the plugin is in a vertical panel.
Functions
add_action_widget(widget)
get_orientation() => gtk.Orientation
menu_insert_item(menu_item)

Inserts a gtk.MenuItem into the menu.

menu_show_about()

Shows the About Dialog.

menu_show_configure()

Shows the Configure Dialog.

register_menu(menu)

Registers a gtk.Menu.

lookup_rc_file()

Returns the path to the config file for this item.

save_location(create_flag)

Returns the path to the config file one is supposed to used for saving.

block_menu()
unblock_menu()

  

Banana Republic Europe

SourceForge.net Logo    lunar powered     os-cillation     web_adept.nl

© Olivier FOURDAN 1996 - 2005