Back to index

system-config-printer  1.3.9+20120706
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
gtkspinner.Spinner Class Reference

List of all members.

Public Member Functions

def __init__
def start
def stop

Public Attributes

 image
 frames
 n_frames

Private Member Functions

def _set_frame
def _rest
def _next_frame

Private Attributes

 _current_frame
 _task

Detailed Description

Definition at line 26 of file gtkspinner.py.


Constructor & Destructor Documentation

def gtkspinner.Spinner.__init__ (   self,
  image 
)

Definition at line 27 of file gtkspinner.py.

00027 
00028     def __init__ (self, image):
00029         self.image = image
00030         frames = []
00031         theme = gtk.icon_theme_get_default ()
00032         icon_info = theme.lookup_icon ("process-working", 22, 0)
00033         if icon_info != None:
00034             size = icon_info.get_base_size ()
00035             icon = icon_info.get_filename ()
00036             try:
00037                 pixbuf = gtk.gdk.pixbuf_new_from_file (icon)
00038                 grid_width = pixbuf.get_width ()
00039                 grid_height = pixbuf.get_height ()
00040                 y = 0
00041                 while y < grid_height:
00042                     x = 0
00043                     while x < grid_width:
00044                         frame = pixbuf.subpixbuf (x, y, size, size)
00045                         frames.append (frame)
00046                         x += size
00047 
00048                     y += size
00049             except gobject.GError:
00050                 # Failed to load icon.
00051                 pass
00052 
00053         self.frames = frames
00054         self.n_frames = len (frames)
00055         self._rest ()


Member Function Documentation

def gtkspinner.Spinner._next_frame (   self) [private]

Definition at line 67 of file gtkspinner.py.

00067 
00068     def _next_frame (self):
00069         n = self._current_frame + 1
00070         if n >= self.n_frames:
00071             n = 1
00072 
00073         gtk.gdk.threads_enter ()
00074         self._set_frame (n)
00075         gtk.gdk.threads_leave ()
00076         return True

Here is the call graph for this function:

def gtkspinner.Spinner._rest (   self) [private]

Definition at line 64 of file gtkspinner.py.

00064 
00065     def _rest (self):
00066         self._set_frame (0)

Here is the call graph for this function:

Here is the caller graph for this function:

def gtkspinner.Spinner._set_frame (   self,
  n 
) [private]

Definition at line 56 of file gtkspinner.py.

00056 
00057     def _set_frame (self, n):
00058         self._current_frame = n
00059         if self.n_frames < 2:
00060             self.image.clear ()
00061             return
00062 
00063         self.image.set_from_pixbuf (self.frames[n])

Here is the caller graph for this function:

def gtkspinner.Spinner.start (   self,
  timeout = 125 
)

Definition at line 77 of file gtkspinner.py.

00077 
00078     def start (self, timeout=125):
00079         self._task = glib.timeout_add (timeout, self._next_frame)

def gtkspinner.Spinner.stop (   self)

Definition at line 80 of file gtkspinner.py.

00080 
00081     def stop (self):
00082         glib.source_remove (self._task)
00083         self._rest ()

Here is the call graph for this function:


Member Data Documentation

Definition at line 57 of file gtkspinner.py.

Definition at line 78 of file gtkspinner.py.

Definition at line 52 of file gtkspinner.py.

Definition at line 28 of file gtkspinner.py.

Definition at line 53 of file gtkspinner.py.


The documentation for this class was generated from the following file: