Ticket #160 (closed enhancement: fixed)
Patch for zoom in/out the userinfo image
| Reported by: | gallows | Owned by: | daelstorm |
|---|---|---|---|
| Priority: | minor | Milestone: | |
| Component: | nicotine | Version: | SVN (checked out today) |
| Keywords: | patch | Cc: |
Description
Hi,
I wrote this little patch, hope you find it useful.
I basically added an EventBox? on the UserInfoTab? so to handle the mouse scroll signals in order to increase and decrease image size.
List of modifications:
userinfo.py:
Added three functions (on class UserInfo?).
- OnScrollEvent() - it manages to handle the signal of the EventBox? I added, by calling one of the following two functions:
- MakeZoomIn()
- MakeZoomOut()
Furthermore I added the following variables (always in the same class):
- self.image_pixbuf - for the zoom (otherwise the image quality is compromised when zooming), but also for the image saving (little change already realized).
- self.zoom_factor - the zoom factor. This is not necessary, but anyway preferable than a "magic number".
- self.actual_zoom - records the current value of the zoom.
I had to call the garbage collector on every zoom because a strange GC behaviour [1]
glade2py.py:
Added the support for a GtkEventBox?.
nicotine.glade:
I just added an EventBox? (between viewport2 and image) to which i connected (on scroll signal) the function OnScrollEvent()
(I used glade-2)
[1] http ://live.gnome.org/PyGTK/FAQ/Images#head-52bfc2c7be6e35b266b80032891978f04cb8a3e8
Thanks for the developing of nicotine+,
Sergio Perticone aka gallows
