diff options
Diffstat (limited to 'src/fringlib/fringui.py')
-rw-r--r-- | src/fringlib/fringui.py | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/src/fringlib/fringui.py b/src/fringlib/fringui.py index 75750e7..6cbbc9b 100644 --- a/src/fringlib/fringui.py +++ b/src/fringlib/fringui.py @@ -7,22 +7,9 @@ from fringwalker import * from fringrenderer import FringRenderer from fringutil import * -GPL = """ -fring is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -fring is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with fring; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -USA. -""" +CURSOR_NONE = 0 +CURSOR_BUSY = 1 +CURSOR_LINK = 2 ui = """ <ui> @@ -64,6 +51,7 @@ class UI( gtk.Window ): self.renderer = FringRenderer() self.walker = FringWalker(); self.scan_active = False + self.cursor = None self.folder_memory = {} # remember some folders @@ -164,11 +152,10 @@ class UI( gtk.Window ): self.eventbox.connect("size-allocate",self.__event_resized) self.connect("delete_event", self.close) - def dialog_about(self,widget): d = gtk.AboutDialog() d.set_name("fring"); - d.set_license(GPL); + d.set_license(LICENSE); d.set_copyright("copyright 2006 Lennart Poettering, Frederic Back") d.run() d.destroy() @@ -271,14 +258,21 @@ class UI( gtk.Window ): self.ctx.set_source_rgb(*self.backgroundColour) self.ctx.fill() - def __show_busy_cursor(self, value): - if self.busy_cursor <= 0 and self.busy_cursor+value >= 0: - if self.window: self.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) - elif self.busy_cursor > 0 and self.busy_cursor+value <= 0: - if self.window: self.window.set_cursor(None) - + def __show_busy_cursor(self, value=0): self.busy_cursor += value - #print "busy state:",self.busy_cursor + if self.busy_cursor > 0: self.__set_cursor(CURSOR_BUSY) + else: self.__set_cursor(CURSOR_NONE) + + def __set_cursor(self, cursor): + if self.window is None: return + if self.cursor == cursor: return + + if cursor == CURSOR_NONE: + self.window.set_cursor(None) + elif cursor == CURSOR_BUSY: + self.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) + elif cursor == CURSOR_LINK: + self.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.HAND1)) #--------------------------------------------------- gobject event callbacks @@ -296,10 +290,10 @@ class UI( gtk.Window ): self.label.set_text(markup) if f.sumlist.children is not None: - self.eventbox.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.HAND1)) + self.__set_cursor(CURSOR_LINK) return - self.eventbox.window.set_cursor(None) + self.__show_busy_cursor() # reset busy cursor def __event_click(self, widget, event): f = self.renderer.get_hotspot_at(event.x, event.y) |