Module gtkgui_helpers
[hide private]
[frames] | no frames]

Module gtkgui_helpers

source code

Classes [hide private]
  HashDigest
  ServersXMLHandler
Functions [hide private]
 
get_icon_pixmap(icon_name, size=16) source code
 
get_icon_path(icon_name, size=16) source code
 
add_image_to_menuitem(menuitem, icon_name) source code
 
add_image_to_button(button, icon_name) source code
 
get_gtk_builder(file_name, widget=None) source code
 
get_completion_liststore(entry)
Create a completion model for entry widget completion list consists of (Pixbuf, Text) rows
source code
 
popup_emoticons_under_button(menu, button, parent_win)
Popup the emoticons menu under button, which is in parent_win
source code
 
get_theme_font_for_option(theme, option)
Return string description of the font, stored in theme preferences
source code
 
get_default_font()
Get the desktop setting for application font first check for GNOME, then Xfce and last KDE it returns None on failure or else a string 'Font Size'
source code
 
autodetect_browser_mailer() source code
 
user_runs_gnome() source code
 
user_runs_kde() source code
 
user_runs_xfce() source code
 
get_running_processes()
Return running processes or None (if /proc does not exist)
source code
 
move_window(window, x, y)
Move the window, but also check if out of screen
source code
 
resize_window(window, w, h)
Resize window, but also checks if huge window or negative values
source code
 
parse_server_xml(path_to_file) source code
 
set_unset_urgency_hint(window, unread_messages_no)
Sets/unset urgency hint in window argument depending if we have unread messages or not
source code
 
get_abspath_for_script(scriptname, want_type=False)
Check if we are svn or normal user and return abspath to asked script if want_type is True we return 'svn' or 'install'
source code
 
get_pixbuf_from_data(file_data, want_type=False)
Get image data and returns gtk.gdk.Pixbuf if want_type is True it also returns 'jpeg', 'png' etc
source code
 
get_invisible_cursor() source code
 
get_current_desktop(window)
Return the current virtual desktop for given window
source code
 
possibly_move_window_in_current_desktop(window)
Moves GTK window to current virtual desktop if it is not in the current virtual desktop
source code
 
file_is_locked(path_to_file)
Return True if file is locked
source code
 
get_fade_color(treeview, selected, focused)
Get a gdk color that is between foreground and background in 0.3 0.7 respectively colors of the cell for the given treeview
source code
 
get_scaled_pixbuf(pixbuf, kind)
Return scaled pixbuf, keeping ratio etc or None kind is either "chat", "roster", "notification", "tooltip", "vcard"
source code
 
get_avatar_pixbuf_from_cache(fjid, use_local=True)
Check if jid has cached avatar and if that avatar is valid image (can be shown)
source code
 
make_gtk_month_python_month(month)
GTK starts counting months from 0, so January is 0 but Python's time start from 1, so align to Python
source code
 
make_python_month_gtk_month(month) source code
 
make_color_string(color)
Create #aabbcc color string from gtk color
source code
 
make_pixbuf_grayscale(pixbuf) source code
 
get_path_to_generic_or_avatar(generic, jid=None, suffix=None)
Choose between avatar image and default image
source code
 
decode_filechooser_file_paths(file_paths)
Decode as UTF-8 under Windows and ask sys.getfilesystemencoding() in POSIX file_paths MUST be LIST
source code
 
possibly_set_gajim_as_xmpp_handler()
Register (by default only the first time) 'xmmp:' to Gajim
source code
 
escape_underscore(s)
Escape underlines to prevent them from being interpreted as keyboard accelerators
source code
 
get_state_image_from_file_path_show(file_path, show) source code
 
get_possible_button_event(event)
Mouse or keyboard caused the event?
source code
 
destroy_widget(widget) source code
 
on_avatar_save_as_menuitem_activate(widget, jid, default_name='') source code
 
on_bm_header_changed_state(widget, event) source code
 
create_combobox(value_list, selected_value=None)
Value_list is [(label1, value1)]
source code
 
create_list_multi(value_list, selected_values=None)
Value_list is [(label1, value1)]
source code
 
load_iconset(path, pixbuf2=None, transport=False)
Load full iconset from the given path, and add pixbuf2 on top left of each static images
source code
 
load_icon(icon_name)
Load an icon from the iconset in 16x16
source code
 
load_mood_icon(icon_name)
Load an icon from the mood iconset in 16x16
source code
 
load_activity_icon(category, activity=None)
Load an icon from the activity iconset in 16x16
source code
 
load_icons_meta()
Load and return - AND + small icons to put on top left of an icon for meta contacts
source code
 
_load_icon_list(icons_list, path, pixbuf2=None)
Load icons in icons_list from the given path, and add pixbuf2 on top left of each static images
source code
 
make_jabber_state_images()
Initialize jabber_state_images dictionary
source code
 
reload_jabber_state_images() source code
 
label_set_autowrap(widget)
Make labels automatically re-wrap if their containers are resized.
source code
 
__label_size_allocate(widget, allocation)
Callback which re-allocates the size of a label
source code
Variables [hide private]
  log = logging.getLogger('gajim.gtkgui_helpers')
  gtk_icon_theme = gtk.icon_theme_get_default()
  HAS_PYWIN32 = False
  screen_w = gtk.gdk.screen_width()
  screen_h = gtk.gdk.screen_height()
  GUI_DIR = os.path.join(gajim.DATA_DIR, 'gui')

Imports: xml, gtk, glib, gobject, pango, os, sys, logging, i18n, gajim, vcard, dialogs, win32file, win32con, pywintypes, helpers


Function Details [hide private]

get_icon_pixmap(icon_name, size=16)

source code 

get_icon_path(icon_name, size=16)

source code 

add_image_to_menuitem(menuitem, icon_name)

source code 

add_image_to_button(button, icon_name)

source code 

get_gtk_builder(file_name, widget=None)

source code 

get_completion_liststore(entry)

source code 
Create a completion model for entry widget completion list consists of (Pixbuf, Text) rows

popup_emoticons_under_button(menu, button, parent_win)

source code 
Popup the emoticons menu under button, which is in parent_win

get_theme_font_for_option(theme, option)

source code 
Return string description of the font, stored in theme preferences

get_default_font()

source code 
Get the desktop setting for application font first check for GNOME, then Xfce and last KDE it returns None on failure or else a string 'Font Size'

autodetect_browser_mailer()

source code 

user_runs_gnome()

source code 

user_runs_kde()

source code 

user_runs_xfce()

source code 

get_running_processes()

source code 
Return running processes or None (if /proc does not exist)

move_window(window, x, y)

source code 
Move the window, but also check if out of screen

resize_window(window, w, h)

source code 
Resize window, but also checks if huge window or negative values

parse_server_xml(path_to_file)

source code 

set_unset_urgency_hint(window, unread_messages_no)

source code 
Sets/unset urgency hint in window argument depending if we have unread messages or not

get_abspath_for_script(scriptname, want_type=False)

source code 
Check if we are svn or normal user and return abspath to asked script if want_type is True we return 'svn' or 'install'

get_pixbuf_from_data(file_data, want_type=False)

source code 
Get image data and returns gtk.gdk.Pixbuf if want_type is True it also returns 'jpeg', 'png' etc

get_invisible_cursor()

source code 

get_current_desktop(window)

source code 

Return the current virtual desktop for given window

NOTE: Window is a GDK window.

possibly_move_window_in_current_desktop(window)

source code 

Moves GTK window to current virtual desktop if it is not in the current virtual desktop

NOTE: Window is a GDK window.

file_is_locked(path_to_file)

source code 

Return True if file is locked

NOTE: Windows only.

get_fade_color(treeview, selected, focused)

source code 
Get a gdk color that is between foreground and background in 0.3 0.7 respectively colors of the cell for the given treeview

get_scaled_pixbuf(pixbuf, kind)

source code 
Return scaled pixbuf, keeping ratio etc or None kind is either "chat", "roster", "notification", "tooltip", "vcard"

get_avatar_pixbuf_from_cache(fjid, use_local=True)

source code 

Check if jid has cached avatar and if that avatar is valid image (can be shown)

Returns None if there is no image in vcard/ Returns 'ask' if cached vcard should not be used (user changed his vcard, so we have new sha) or if we don't have the vcard

make_gtk_month_python_month(month)

source code 

GTK starts counting months from 0, so January is 0 but Python's time start from 1, so align to Python

NOTE: Month MUST be an integer.

make_python_month_gtk_month(month)

source code 

make_color_string(color)

source code 
Create #aabbcc color string from gtk color

make_pixbuf_grayscale(pixbuf)

source code 

get_path_to_generic_or_avatar(generic, jid=None, suffix=None)

source code 

Choose between avatar image and default image

Returns full path to the avatar image if it exists, otherwise returns full path to the image. generic must be with extension and suffix without

decode_filechooser_file_paths(file_paths)

source code 
Decode as UTF-8 under Windows and ask sys.getfilesystemencoding() in POSIX file_paths MUST be LIST

possibly_set_gajim_as_xmpp_handler()

source code 
Register (by default only the first time) 'xmmp:' to Gajim

escape_underscore(s)

source code 
Escape underlines to prevent them from being interpreted as keyboard accelerators

get_state_image_from_file_path_show(file_path, show)

source code 

get_possible_button_event(event)

source code 
Mouse or keyboard caused the event?

destroy_widget(widget)

source code 

on_avatar_save_as_menuitem_activate(widget, jid, default_name='')

source code 

on_bm_header_changed_state(widget, event)

source code 

create_combobox(value_list, selected_value=None)

source code 
Value_list is [(label1, value1)]

create_list_multi(value_list, selected_values=None)

source code 
Value_list is [(label1, value1)]

load_iconset(path, pixbuf2=None, transport=False)

source code 
Load full iconset from the given path, and add pixbuf2 on top left of each static images

load_icon(icon_name)

source code 
Load an icon from the iconset in 16x16

load_mood_icon(icon_name)

source code 
Load an icon from the mood iconset in 16x16

load_activity_icon(category, activity=None)

source code 
Load an icon from the activity iconset in 16x16

load_icons_meta()

source code 
Load and return - AND + small icons to put on top left of an icon for meta contacts

_load_icon_list(icons_list, path, pixbuf2=None)

source code 
Load icons in icons_list from the given path, and add pixbuf2 on top left of each static images

make_jabber_state_images()

source code 
Initialize jabber_state_images dictionary

reload_jabber_state_images()

source code 

label_set_autowrap(widget)

source code 
Make labels automatically re-wrap if their containers are resized. Accepts label or container widgets

__label_size_allocate(widget, allocation)

source code 
Callback which re-allocates the size of a label

Variables Details [hide private]

log

Value:
logging.getLogger('gajim.gtkgui_helpers')

gtk_icon_theme

Value:
gtk.icon_theme_get_default()

HAS_PYWIN32

Value:
False

screen_w

Value:
gtk.gdk.screen_width()

screen_h

Value:
gtk.gdk.screen_height()

GUI_DIR

Value:
os.path.join(gajim.DATA_DIR, 'gui')