Exemple #1
0
    def __init__(self):
        super(Guake, self).__init__(common.gladefile('guake.glade'))
        self.client = gconf.client_get_default()

        # default option in case of gconf fails:
        self.use_bgimage = False

        # setting global hotkey!
        globalhotkeys.init()
        key = self.client.get_string(GHOTKEYS[0][0])
        globalhotkeys.bind(key, self.show_hide)

        # trayicon!
        tray_icon = GuakeStatusIcon()
        tray_icon.connect('popup-menu', self.show_menu)
        tray_icon.connect('activate', self.show_hide)
        tray_icon.show_all()

        # adding images from a different path.
        ipath = common.pixmapfile('new_guakelogo.png')
        self.get_widget('image1').set_from_file(ipath)
        ipath = common.pixmapfile('add_tab.png')
        self.get_widget('image2').set_from_file(ipath)

        self.window = self.get_widget('window-root')
        self.notebook = self.get_widget('notebook-teminals')
        self.toolbar = self.get_widget('toolbar')
        self.mainframe = self.get_widget('mainframe')

        self.accel_group = gtk.AccelGroup()
        self.last_pos = -1
        self.term_list = []
        self.animation_speed = 30
        self.visible = False

        self.window.add_accel_group(self.accel_group)
        self.window.set_keep_above(True)
        self.window.set_geometry_hints(min_width=1, min_height=1)
        self.window.connect('focus-out-event', self.on_window_lostfocus)

        self.load_config()
        self.load_accelerators()
        self.refresh()
        self.add_tab()
Exemple #2
0
~~~~~~~~~~~~~~~~~~~~~~~
This script is a simple test that initializes globalhotkeys machinery and
bindings a key to a simple function. So after running this program, you shoud
se a message 'great =D' or 'bad =('. If every thing goes right, when you press
the F12 key, you should see ('F12',) on your terminal otherwise, you will see a
warning saying that binding has failed.

A really important thing is that globalhotkeys.bind returns boolean values, so
if you want to know if binding works properly, only test this with a simple if.

A cool test
~~~~~~~~~~~
if you want to test your program when it shoud say to the user that the binding
failed, you can simply use this program to bind the key that you're running.
Because you can bind a key once.
"""
import gtk
import globalhotkeys

def hammer(*args):
    print args

globalhotkeys.init()
binded = globalhotkeys.bind('F12', hammer)
if binded:
    print 'great =D'
else:
    print 'bad =('

gtk.main()
Exemple #3
0
bindings a key to a simple function. So after running this program, you shoud
se a message 'great =D' or 'bad =('. If every thing goes right, when you press
the F12 key, you should see ('F12',) on your terminal otherwise, you will see a
warning saying that binding has failed.

A really important thing is that globalhotkeys.bind returns boolean values, so
if you want to know if binding works properly, only test this with a simple if.

A cool test
~~~~~~~~~~~
if you want to test your program when it shoud say to the user that the binding
failed, you can simply use this program to bind the key that you're running.
Because you can bind a key once.
"""
import globalhotkeys
import gtk


def hammer(*args):
    print args


globalhotkeys.init()
binded = globalhotkeys.bind('F12', hammer)
if binded:
    print 'great =D'
else:
    print 'bad =('

gtk.main()