emesene forum
September 09, 2010, 08:52:24 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: CACHE KEY ERRORS? NICK NOT SAVED? UPGRADE TO 1.6.2 FIRST!

REPORT ANY ISSUE HERE - PLEASE CHECK IF THE PROBLEM HAS ALREADY BEEN REPORTED FIRST -- THANKS
 
  Home   Forum   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [NEW] Fast reply plugin  (Read 777 times)
Ivan!
Sr. Member
****

l33tness: 2
Offline Offline

Posts: 59



View Profile WWW
« on: March 26, 2010, 03:39:15 PM »

Hello Smiley

I've written this little plugin...
With this plugin the user can reply with a buddy without opening his conversation window, the plugin adds an entry in the tray icon menu that opens a little window to chat...



please report any bug, or feature you want =)

Updated version (29/03/2010 - 2)
Changelog:
- Fixed "2 or more windows" bug
- Added some comments in the code
- Changed description
« Last Edit: March 29, 2010, 08:59:20 AM by Ivan! » Logged
jcags
Full Member
***

l33tness: 0
Offline Offline

Posts: 47


El Olvidado...

betrayerjuan@hotmail.com
View Profile WWW Email
« Reply #1 on: March 26, 2010, 09:12:54 PM »

Awesome!
Logged

DarKprince
Hero Member
*****

l33tness: 14
Offline Offline

Posts: 252


Italians Do It better XD XD


View Profile Email
« Reply #2 on: March 27, 2010, 01:16:47 AM »

Hello Smiley
for other developers:
I tried to add an optional feature, use the middle click on the tray icon to call the window...
I tried to use an eventbox, but i got an error on tray.add(eventbox)...

the error:
Code:
  File "/home/ivan/.config/emesene1.0/pluginsEmesene/Fast-replyDEV.py", line 48, in start
    self.tray.add(self.eventBox)

AttributeError: 'gtk.StatusIcon' object has no attribute 'add'

But also emesene in TrayIcon.py does this: (line 122)
Code:
        self.eventBox = gtk.EventBox()
        self.eventBox.set_events(gtk.gdk.BUTTON_PRESS_MASK)
        self.eventBox.connect_object('button_press_event', self.iconClickPosix, self.eventBox)
[...]
        self.eventBox.add(self.image)
        self.tray.add(self.eventBox)
(self.tray[mine] and self.tray[emesene] are both gtk.StatusIcon, but I imported mine from emesene...)
post the code which generates error
Logged
Ivan!
Sr. Member
****

l33tness: 2
Offline Offline

Posts: 59



View Profile WWW
« Reply #3 on: March 27, 2010, 05:28:23 AM »

@DarKprince:
This is the code (the line is highlighted by >)
Code:
    def start(self):
        '''start the plugin'''
        self.enabled = True
        self.add_menu_item(self.controller) #aggiungo la voce nel menu della tray
        self.handlerId = self.connect('switchboard::message', self.receiveMessage)

        self.eventBox = gtk.EventBox()
        self.eventBox.set_events(gtk.gdk.BUTTON_PRESS_MASK)
        self.eventBox.connect_object('button_press_event', self.on_tray_click, self.eventBox)

        self.tray = self.controller.trayIcon.tray
>       self.tray.add(self.eventBox)
        self.eventBox.show_all()
        self.tray.show_all()

        self.mail = 'no one'

This code is take from emesene/TrayIcon.py
Code:
    def buildTrayIconPosix(self):
        '''Build the trayIcon for linux'''

        self.eventBox = gtk.EventBox()
        pixbuf = self.theme.getImage('trayicon')
        self.image = gtk.Image()
        self.image.set_from_pixbuf( pixbuf )

        self.eventBox.set_events(gtk.gdk.BUTTON_PRESS_MASK)
        self.eventBox.connect_object('button_press_event', self.iconClickPosix, self.eventBox)

        self.tooltips = gtk.Tooltips()
        self.tooltips.set_tip(self.eventBox, 'emesene')
       
        self.eventBox.add(self.image)
        self.tray.add(self.eventBox)
        self.eventBox.show_all()
        self.tray.show_all()


Awesome!
I'm glad that you liked it ^^
Logged
DarKprince
Hero Member
*****

l33tness: 14
Offline Offline

Posts: 252


Italians Do It better XD XD


View Profile Email
« Reply #4 on: March 27, 2010, 07:26:25 AM »

you're tryin' to use a method which doesn't exist for the gtk.StatusIcon type. the line that contains that method is using a "egg.trayicon.TrayIcon('emesene')" object , that's why you get that error
Logged
Ivan!
Sr. Member
****

l33tness: 2
Offline Offline

Posts: 59



View Profile WWW
« Reply #5 on: March 29, 2010, 08:14:30 AM »

Thanks, I didn't noticed that...

However I've added this feature (the middle click on the tray now opens the window, faster)...
Smiley

There is still a little bug, if from the plugins page, the plugin is disabled-enabled, after a middle click in the tray, 2 (or more) windows are opened >.<
i'm working on this...
Logged
DarKprince
Hero Member
*****

l33tness: 14
Offline Offline

Posts: 252


Italians Do It better XD XD


View Profile Email
« Reply #6 on: March 29, 2010, 08:28:37 AM »

try to add these two lines in the stop(self) method :

self.disconnect('switchboard::message', self.receiveMessage)
self.tray.disconnect('button-press-event', self.on_tray_click)

let me know if it solves your problem Wink
Logged
Ivan!
Sr. Member
****

l33tness: 2
Offline Offline

Posts: 59



View Profile WWW
« Reply #7 on: March 29, 2010, 08:54:47 AM »

Thanks!

I changed a bit stop() Smiley

Now this is fully working ^^

Changelog:
- Fixed "2 or more windows" bug
- Added some comments in the code
- Updated description
Logged
DarKprince
Hero Member
*****

l33tness: 14
Offline Offline

Posts: 252


Italians Do It better XD XD


View Profile Email
« Reply #8 on: March 29, 2010, 10:20:28 AM »

nice Wink
Logged
Pages: [1]
  Print  
 
Jump to:  

TinyPortal v.1.0.6 beta 2 © Bloc
Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!