Reply
Thread Tools
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#1
Hi,

Built the python-vte bindings that come part of vte but are removed in diablo's vte. Took the package, added back in the python-vte bindings and modified the package to only give me the python-vte bindings without the vte library.

In Diablo extras-devel. If you need it for an application in Extras, feel free to promote.

Oh, I also did an one line fix to the vte reaper python support patch so this has support for the vte.Reaper object.

Here's a quick & dirty sample program I wrote:

Code:
#! /usr/bin/env python

"""
            DO WHAT THE **** YOU WANT TO PUBLIC LICENSE
                    Version 2, December 2004

 Copyright (C) 2004 Sam Hocevar
  14 rue de Plaisance, 75014 Paris, France
 Everyone is permitted to copy and distribute verbatim or modified
 copies of this license document, and changing it is allowed as long
 as the name is changed.

            DO WHAT THE **** YOU WANT TO PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. You just DO WHAT THE **** YOU WANT TO.
"""

import hildon
import gtk
import vte

def on_window_state_change(widget, event, *args):
 global window_in_fullscreen
 if event.new_window_state & gtk.gdk.WINDOW_STATE_FULLSCREEN:
        window_in_fullscreen = True
 else:
        window_in_fullscreen = False

def on_key_press(widget, event, *args):
 global window_in_fullscreen
 if event.keyval == gtk.keysyms.F6:
  if window_in_fullscreen:
        gtk.Window.unfullscreen (widget)
  else:
        gtk.Window.fullscreen (widget)


def main():
    def xterm_clicked(widget, terminal):
        terminal.show()
	terminal.fork_command()

    def lock_tablet(widget, terminal):
	terminal.show()
        #terminal.fork_command()
        #terminal.feed_child("run-standalone.sh /usr/bin/dbus-send --print-reply --system --type=method_call --dest=com.nokia.system_ui /com/nokia/system_ui/request com.nokia.system_ui.request.devlock_open string:'com.nokia.mce' string:'/com/nokia/mce/request' string:'com.nokia.mce.request' string:'devlock_callback' uint32:'3'\n")
        terminal.fork_command("run-standalone.sh /usr/bin/dbus-send --print-reply --system --type=method_call --dest=com.nokia.system_ui /com/nokia/system_ui/request com.nokia.system_ui.request.devlock_open string:'com.nokia.mce' string:'/com/nokia/mce/request' string:'com.nokia.mce.request' string:'devlock_callback' uint32:'3'")
    
    window = hildon.Window()
    gtk.set_application_name("VTE Terminal Example")
    window.connect("destroy", gtk.main_quit)
    window.connect("key-press-event", on_key_press)
    window.connect("window-state-event", on_window_state_change)
    window.fullscreen()
    window_in_fullscreen = True

    mainbox = gtk.VBox(False, 0)

    hb1 = gtk.HBox(False, 0)
    xterm_dlg_button = gtk.Button("Show terminal")
    lock_dlg_button = gtk.Button("Lock tablet")
    hb1.pack_start(xterm_dlg_button, True, True, 0)
    hb1.pack_start(lock_dlg_button, True, True, 0)
    terminal = vte.Terminal ()
    #terminal.connect ("child-exited", lambda term: gtk.main_quit())
    hb2 = gtk.HBox(False, 0)
    hb2.pack_start(terminal, True, True, 0)
    mainbox.pack_start(hb1, False, False, 0)
    mainbox.pack_start(hb2, True, True, 0)

    window.add(mainbox)
    
    xterm_dlg_button.connect("clicked", xterm_clicked, terminal)
    lock_dlg_button.connect("clicked", lock_tablet, terminal)

    window.show_all()
    terminal.hide()
    gtk.main()

main()
Attached Images
 

Last edited by qwerty12; 2009-05-06 at 15:10.
 

The Following 3 Users Say Thank You to qwerty12 For This Useful Post:
fpp's Avatar
Posts: 2,853 | Thanked: 968 times | Joined on Nov 2005
#2
I'm not sure I understand what this does so I wanted to try it out :-)

First I can't install the .deb with App Manager ( "incompatible application" ), had to dig out dpkg, is that normal ?

Second, when I try to launch your test script, I get this :

AttributeError: 'module' object has no attribute 'Terminal'

Maybe the two issues are related ?
 
allnameswereout's Avatar
Posts: 3,397 | Thanked: 1,212 times | Joined on Jul 2008 @ Netherlands
#3
I'd appreciate a port of this to Fremantle. I've been able to compile VTE, but used version 0.22.2.
__________________
Goosfraba! All text written by allnameswereout is public domain unless stated otherwise. Thank you for sharing your output!
 
Reply


 
Forum Jump


All times are GMT. The time now is 20:40.