def run_in_window():
	
	main_window = gtk.Window(gtk.WINDOW_TOPLEVEL)
	main_window.set_title("GNOME Applet Forismatic")
	main_window.connect("destroy", gtk.main_quit)
	app = gnomeapplet.Applet()
	applet_factory(app, None)
	app.reparent(main_window)
	main_window.show_all()
	gtk.main()
	sys.exit()
Пример #2
0
def build_window():
    app = gtk.Window(gtk.WINDOW_TOPLEVEL)
    app.set_title("Glipper")
    app.connect("destroy", gtk.main_quit)
    app.set_property('resizable', False)

    applet = gnomeapplet.Applet()
    applet.get_orient = lambda: gnomeapplet.ORIENT_DOWN
    applet_factory(applet, None)
    applet.reparent(app)

    app.show_all()

    return app
Пример #3
0
def main():
    """
    Module used to start the gnome applet
    """

    # We declare and check the possible options that can be add the command
    window_mode = False
    debug = False
    try:
        opts, args = getopt.getopt(sys.argv[1:], "cdhw",
                                   ["configure", "debug", "help", "window"])
    except getopt.GetoptError:
        opts = []
        args = sys.argv[1:]
    for o, a in opts:
        if o in ("-w", "--window"):
            window_mode = True
        if o in ("-d", "--debug"):
            window_mode = True
            debug = True

    # We check if all the necessary files and directories are here
    # Home directory (will contain all the sub-directories and files)
    if os.listdir(home_dir).count('.ghellanzb') == 0:
        os.mkdir(home_dir + '/.ghellanzb')

    # We initiate the gnome applet and the threads
    gnome.init(name, version)
    gtk.gdk.threads_init()

    if window_mode:
        # We build the window and launch it
        #log.logger.info("_launcher : Starting in Window Mode")
        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        window.set_title(name)
        window.props.allow_grow = False
        window.connect("destroy", gtk.main_quit)
        applet = gnomeapplet.Applet()
        if debug:
            applet_factory(applet, None, True, True)
        else:
            applet_factory(applet, None, True, False)
        applet.reparent(window)
        window.show_all()
        gtk.main()
    else:
        # We activate the bonobo factory
        activate_factory(window_mode=False)
Пример #4
0
def main():
    """Entrypoint for the panel applet."""
    gtk.gdk.threads_init()

    if len(sys.argv) == 2 and sys.argv[1] == "run-in-window":
        print "here"
        main_window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        main_window.set_title(_("Webilder Applet Window"))
        main_window.connect("destroy", gtk.main_quit)
        app = gnomeapplet.Applet()
        WebilderApplet(app, None)
        app.reparent(main_window)
        main_window.show_all()
        gtk.main()
        sys.exit()
    else:
        gnomeapplet.bonobo_factory("OAFIID:GNOME_WebilderApplet_Factory",
                                 gnomeapplet.Applet.__gtype__,
                                 "webilder-hello", "0", webilder_applet_factory)
Пример #5
0
    def start(self, option, logging):
        self.option = option
        self.logging = logging

        try:
            import gnomeapplet
        except:
            print "not installed Python bindings for GNOME Panel applets."
            print "ex)  sudo yum install gnome-python2-applet"
            self.logging.error(
                'not installed Python bindings for GNOME Panel applets.')
            self.logging.error('ex)  sudo yum install gnome-python2-applet')
            sys.exit(2)

        if option.getWindow():
            self.logging.debug('Running ... window mode.')
            import pygtk

            pygtk.require("2.0")
            main_window = gtk.Window(gtk.WINDOW_TOPLEVEL)
            main_window.set_title("Wallpaperoptimizer Applet Window")
            main_window.connect("destroy", gtk.main_quit)
            app = gnomeapplet.Applet()
            self._factory(app, None)
            app.reparent(main_window)
            main_window.show_all()
            wh = main_window.get_size()
            main_window.resize(wh[0] * 2, wh[1])
            gtk.main()
        elif (option.getIID() is None and option.getFD() is None):
            self._runConsoleSide(self.option, self.logging)

        else:
            self.logging.debug('Running ... applet mode.')
            import pygtk

            pygtk.require("2.0")
            gnomeapplet.bonobo_factory(
                "OAFIID:wallpaperoptimizerApplet_Factory",
                gnomeapplet.Applet.__gtype__, "wallpaper changer", "1.0",
                self._factory)
Пример #6
0
import gnomeapplet
import sys
import applet.ui as ui
import gtk


def Factory(applet, iid):
    myApplet = ui.myApplet(applet)
    myApplet.run()
    return gtk.TRUE


if len(sys.argv) == 2:
    if sys.argv[1] == "test":  #Debug mode
        main_window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        main_window.set_title("Python Applet")
        main_window.connect("destroy", gtk.main_quit)
        app = gnomeapplet.Applet()
        Factory(app, None)
        app.reparent(main_window)
        main_window.show_all()
        gtk.main()
        sys.exit()

#If called via gnome panel, run it in the proper way
if __name__ == '__main__':
    gnomeapplet.bonobo_factory("OAFIID:GNOME_SimpleRemoteControl_Factory",
                               gnomeapplet.Applet.__gtype__, "hello", "0",
                               Factory)