maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Alternatives (https://talk.maemo.org/forumdisplay.php?f=36)
-   -   Mer 0.11 released (https://talk.maemo.org/showthread.php?t=28105)

qole 2009-04-14 16:39

Re: Mer 0.11 released
 
I would also like the ability to move the marquee to the side (instead of the top).

daperl 2009-04-14 17:36

Re: Mer 0.11 released
 
@qwerty12

Something I might have forgotten. When placing the '3' button event in the main loop, I think it goes back into the on_button_press handler. So, I think it would be best to put the following line at the top of that function to help avoid strange behaviour:

if event.button == 3: return False

qwerty12 2009-04-14 17:42

Re: Mer 0.11 released
 
Thanks, I tried using your code but when I connect it to the GtkStatusIcon, I get messages about it not accepting that event. So I'm still (unfortunately) using my 1 button press hack :/

BTW: Yes, I am 16 :)

kaito 2009-04-14 17:55

Re: Mer 0.11 released
 
Hi, I tried Mer on my 770 this weekend. Thanks for your work, it's looking great. Some issues I had:
it freezes on every other boot for me
wireless connection was crazy but now it' seems stable with the new network manager
setting backlight doesn't actually change anything
load applet always shows max cpu consumption, and used swap isn't accurate, either (is it just for taking screenshots?)
can't use ctrl-c in xterm with onscreen keyboard

I would love to have a newer kernel with working wlan driver and iptables nat module (I also have a wsod-ed 770 and it would be so nice to use it as a wlan card/small server) .

daperl 2009-04-14 17:56

Re: Mer 0.11 released
 
Quote:

Originally Posted by qwerty12 (Post 279549)
Thanks, I tried using your code but when I connect it to the GtkStatusIcon, I get messages about it not accepting that event. So I'm still (unfortunately) using my 1 button press hack :/

BTW: Yes, I am 16 :)

Oh, that's funny. GtkStatusIcon isn't a GtkWidget so it can't accept that signal. Yeah, in Maemo there's no tap-and-hold use case for the status bar. Sorry, I didn't know you wanted to right-click on a GtkStatusIcon. Are you sure you want to do that?

qole 2009-04-14 19:20

Re: Mer 0.11 released
 
I continue to make progress with the Mer desktop in a chroot as a replacement for Maemo. See my progress in this post.

qwerty12 2009-04-14 19:34

Re: Mer 0.11 released
 
Quote:

Originally Posted by daperl (Post 279552)
Yeah, in Maemo there's no tap-and-hold use case for the status bar. Sorry, I didn't know you wanted to right-click on a GtkStatusIcon. Are you sure you want to do that?

Yeah, found that one out when I added gtk_widget_tap_and_hold_setup to two C Gtk apps. But, yes, I need to as the applet's drop down menu when right clicking offers more than just a left click (a lot more, considering a left click just opens the manager - the drop down menu can do this & more).

jhonnyvey 2009-04-14 19:53

Re: Mer 0.11 released
 
How to fix the problem with wifi?
I see just a few appliactions to install.
Need add repository of maemo applications?
And for last we cant use apt-get dist-upgrade ?
When i try use it n800 stuck and after reboot the wifi dont work and iccon of mer go into the middle of screen.

Tks! :)
Ps: Im n00b :D

daperl 2009-04-14 20:40

Re: Mer 0.11 released
 
Quote:

Originally Posted by qwerty12 (Post 279577)
Yeah, found that one out when I added gtk_widget_tap_and_hold_setup to two C Gtk apps. But, yes, I need to as the applet's drop down menu when right clicking offers more than just a left click (a lot more, considering a left click just opens the manager - the drop down menu can do this & more).

I thought so. As I mentioned to qole in another thread, I've solved your problem and I'm just finishing up a standalone demo program. I'll post it here when I'm done.

daperl 2009-04-15 02:09

Re: Mer 0.11 released
 
@qwerty12

Here's the demo. It works in Kubuntu 8.10 i386 and in Diablo, so I'm guessing it will work in Mer. I'm letting GTK position the menus at the moment because it's doing a decent job. If you would rather have more control of the menu placement that's easy to take care of. Also, I'm currently doing nothing about the icon's change-of-state; it always looks like it's inactive in the Diablo statusbar sense. Simple to remedy. Because this is a demo, these similar 3 lines from the previous tap_and_hold function are most likely what you want for a real application:

Code:

            self.press_event.button = 3
            self.press_event.time = gtk.get_current_event_time()
            self.on_any_event(self.press_event)

Code:

#! /usr/bin/env python

import gobject
import gtk

class qwerty12():
    tah_timeout = 1000

    def __init__(self):
        self.screen = None
        self.root_win = None
        self.rec = None
        self.mapped = False
        self.is_icon_on_top = True
        self.press_event = None
        self.last_tah_press_num = -1
        self.press_num = 0
        self.pressing = False
        gtk.gdk.event_handler_set(self.on_any_event)
        self.i = 5
        self.statusIcon = gtk.StatusIcon()
        self.statusIcon.set_from_stock(gtk.STOCK_CONNECT)
        self.clicked_menu = gtk.Menu()
        self.clicked_menu.__dict__['mapped'] = False
        self.clicked_menu.connect('map-event', self.on_map_menu, True)
        self.clicked_menu.connect('unmap-event', self.on_map_menu, False)
        self.clicked_menu.append(gtk.MenuItem('Clicked 1'))
        self.clicked_menu.append(gtk.MenuItem('Clicked 2'))
        self.clicked_menu.append(gtk.MenuItem('Clicked 3'))
        i = 1
        for c in self.clicked_menu.get_children():
            c.connect('activate', self.on_activate_mi, 'clicked '+str(i))
            c.connect('enter-notify-event', self.on_enter_mi, 'clicked '+str(i))
            i += 1
        self.clicked_menu.show_all()
        gtk.status_icon_position_menu(self.clicked_menu, self.statusIcon)
        self.tah_menu = gtk.Menu()
        self.tah_menu.__dict__['mapped'] = False
        self.tah_menu.connect('map-event', self.on_map_menu, True)
        self.tah_menu.connect('unmap-event', self.on_map_menu, False)
        self.tah_menu.append(gtk.MenuItem('TAH 1'))
        self.tah_menu.append(gtk.MenuItem('TAH 2'))
        self.tah_menu.append(gtk.MenuItem('TAH 3'))
        self.tah_menu.append(gtk.MenuItem('TAH 4'))
        self.tah_menu.append(gtk.MenuItem('TAH 5'))
        self.tah_menu.append(gtk.MenuItem('TAH 6'))
        self.tah_menu.append(gtk.MenuItem('TAH 7'))
        i = 1
        for c in self.tah_menu.get_children():
            c.connect('activate', self.on_activate_mi, 'tah '+str(i))
            c.connect('enter-notify-event', self.on_enter_mi, 'tah '+str(i))
            i += 1
        self.tah_menu.show_all()
        gtk.status_icon_position_menu(self.tah_menu, self.statusIcon)

    def on_activate_mi(self, mi, t):
        print 'activate mi',t,mi.get_name()
    def on_enter_mi(self, mi, event, t):
        #print 'enter mi',t
        p = mi.get_parent()
        p.deselect()
        p.select_item(mi)
    def on_map_menu(self, m, event, b):
        #print 'map menu before after',m.mapped,b
        m.mapped = b
    def tap_and_hold(self, event, tah_press_num):
        print 'num self.press_num',tah_press_num,self.press_num
        if self.pressing and tah_press_num == self.press_num:
            rec = self.rec
            x, y, m = self.root_win.get_pointer()
            print 'tah x y w h',x,y,rec.x,rec.y,rec.width,rec.height
            self.last_tah_press_num = tah_press_num
            self.clicked_menu.popdown()
            #self.tah_menu.popup(None,None,gtk.status_icon_position_menu,1,gtk.get_current_event_time(),self.statusIcon)
            self.tah_menu.popup(None,None,gtk.status_icon_position_menu,1,event.time+self.tah_timeout,self.statusIcon)
        return False

    def is_icon_event(self):
        #x, y, m = self.root_win.get_pointer()
        self.screen, self.rec, o = self.statusIcon.get_geometry()
        x, y, m = self.screen.get_root_window().get_pointer()
        dx = x - self.rec.x
        dy = y - self.rec.y
        return dx >=0 and dx <= self.rec.width and dy >= 0 and dy <= self.rec.height

    def set_menu_pos(self, menu):
        mw, mh = menu.get_toplevel().get_size()
        x = 0
        y = 0
        if self.is_icon_on_top:
            pass
        else:
            #x = self.rec.x + self.rec.width - mw
            x = self.rec.x - mw
            y = self.rec.y - mh - 10
        print 'clicked menu x y',x,y,mw,mh
        return (x, y, False)

    def on_any_event(self, event):
        if event.type == gtk.gdk.MOTION_NOTIFY: return
        #print 'event',event.type
        if event.type == gtk.gdk.BUTTON_PRESS:
            if self.mapped and event.button == 1 and self.is_icon_event():
                self.press_event = event.copy()
                self.pressing = True
                self.press_num += 1
                gobject.timeout_add(self.tah_timeout, self.tap_and_hold, event, self.press_num)
            #print 'press',event.x,event.y,event.button
        elif event.type == gtk.gdk.BUTTON_RELEASE:
            self.pressing = False
            #print 'button release num last_num',self.press_num,self.last_tah_press_num
            #print 'release tma visible',self.tah_menu.props.visible
            if event.button == 1 and self.is_icon_event() and\
            self.press_num != self.last_tah_press_num and not self.tah_menu.mapped:
                if self.clicked_menu.mapped:
                    self.clicked_menu.popdown()
                else:
                    #self.clicked_menu.popup(None,None,self.set_menu_pos,1,event.time)
                    self.clicked_menu.popup(None,None,gtk.status_icon_position_menu,1,event.time,self.statusIcon)
                #print 'time for clicked menu'
        elif event.type == gtk.gdk.LEAVE_NOTIFY:
            self.pressing = False
        elif event.type == gtk.gdk.MAP:
            if not self.mapped:
                self.screen, rec, o = self.statusIcon.get_geometry()
                self.root_win = self.screen.get_root_window()
                print 'rec',rec.x,rec.y,rec.width,rec.height
                self.rec = rec
                self.mapped = True
                self.is_icon_on_top = rec.y < rec.height
        gtk.main_do_event(event)

if __name__ == "__main__":
    q12 = qwerty12()
    gtk.main()



All times are GMT. The time now is 13:42.

vBulletin® Version 3.8.8