summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Back <fredericback@gmail.com>2006-10-02 13:44:02 +0000
committerFrederic Back <fredericback@gmail.com>2006-10-02 13:44:02 +0000
commitaa50b25c00669c3794cb4f296fcf2131467321ba (patch)
treecfddd2950fb2472443a31d124d96825581f01b1d
parent7c92e717d68c217c51f7422793894ceaf03bd048 (diff)
* Corrected cursor issues
git-svn-id: file:///home/lennart/svn/public/fring/trunk@55 d0d2c35f-0a1e-0410-abeb-dabff30a67ee
-rw-r--r--src/fringlib/fringui.py48
-rw-r--r--src/fringlib/fringutil.py18
2 files changed, 38 insertions, 28 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)
diff --git a/src/fringlib/fringutil.py b/src/fringlib/fringutil.py
index f981a45..3199bf5 100644
--- a/src/fringlib/fringutil.py
+++ b/src/fringlib/fringutil.py
@@ -16,7 +16,6 @@ def pretty_size(size):
else:
return "%u B" % size
-
def format_disk_space(size):
""" Convert bytes to a human readable format.
Returns a tuple, for example (20,"MiB") """
@@ -29,3 +28,20 @@ def format_disk_space(size):
return ("%.1f"%round(size/1024.0),"KiB")
else:
return ("%u"%size,"B")
+
+LICENSE = """
+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.
+"""