#!/usr/bin/python import sys import gtk import pygtk pygtk.require('2.0') import mateapplet from ${name}Applet import applet_factory if __name__ == '__main__': # testing for execution print('Starting factory') if len(sys.argv) > 1 and sys.argv[1] == '-d': # debugging mainWindow = gtk.Window() mainWindow.set_title('Applet window') mainWindow.connect('destroy', gtk.main_quit) applet = mateapplet.Applet() applet_factory(applet, None) applet.reparent(mainWindow) mainWindow.show_all() gtk.main() sys.exit() else: mateapplet.matecomponent_factory('OAFIID:MATE_${name}_Factory', mateapplet.Applet.__gtype__, 'MATE_${name}', '0.1', applet_factory)
#!/usr/bin/env python import pygtk pygtk.require("2.0") import gtk import mateapplet import gobject def background_show(applet): print "background: ", applet.get_background() def sample_factory(applet, iid): print "Creating new applet instance" label = gtk.Label("Success!") applet.add(label) applet.show_all() gobject.timeout_add(1000, background_show, applet) return True print "Starting factory" mateapplet.matecomponent_factory( "OAFIID:MATE_PythonAppletSample_Factory", mateapplet.Applet.__gtype__, "hello", "0", sample_factory ) print "Factory ended"
if options.version: print deskbar.defs.VERSION sys.exit() if options.debug: logging.getLogger().setLevel(logging.DEBUG) if options.tray: from deskbar.ui.DeskbarStatusIcon import DeskbarStatusIcon deskbar_status_icon = DeskbarStatusIcon () gtk.gdk.threads_enter() gtk.main() gtk.gdk.threads_leave() elif options.window: from deskbar.ui.DeskbarApplet import DeskbarApplet build_window() gtk.gdk.threads_enter() gtk.main() gtk.gdk.threads_leave() else: from deskbar.ui.DeskbarApplet import DeskbarApplet mateapplet.matecomponent_factory( "OAFIID:Deskbar_Applet_Factory", DeskbarApplet.__gtype__, deskbar.defs.PACKAGE, deskbar.defs.VERSION, applet_factory)
opts, args = getopt.getopt(sys.argv[1:], "hdw", ["help", "debug", "window"]) except getopt.GetoptError: # Unknown args were passed, we fallback to bahave as if # no options were passed opts = [] args = sys.argv[1:] for o, a in opts: if o in ("-h", "--help"): usage() elif o in ("-d", "--debug"): mate_invest.DEBUGGING = True mate_invest.debug("Debugging enabled") # these messages cannot be turned by mate_invest.DEBUGGING at their originating location, # because that variable was set here to be True mate_invest.debug("Data Dir: %s" % mate_invest.SHARED_DATA_DIR) mate_invest.debug("Detected PROXY: %s" % mate_invest.PROXY) elif o in ("-w", "--window"): standalone = True if standalone: build_window() gtk.main() else: mateapplet.matecomponent_factory( "OAFIID:Invest_Applet_Factory", mateapplet.Applet.__gtype__, mate_invest.defs.PACKAGE, mate_invest.defs.VERSION, applet_factory)
#!/usr/bin/env python import pygtk pygtk.require('2.0') import gtk import mateapplet import gobject def background_show(applet): print "background: ", applet.get_background() def sample_factory(applet, iid): print "Creating new applet instance" label = gtk.Label("Success!") applet.add(label) applet.show_all() gobject.timeout_add(1000, background_show, applet) return True print "Starting factory" mateapplet.matecomponent_factory("OAFIID:MATE_PythonAppletSample_Factory", mateapplet.Applet.__gtype__, "hello", "0", sample_factory) print "Factory ended"
# this callback is to create a context menu def create_menu(self): self.applet.setup_menu(self.propxml, self.verbs, None) def menu_factory( applet, iid ): MenuWin( applet, iid ) applet.show() return True def quit_all(widget): gtk.main_quit() sys.exit(0) if len(sys.argv) == 2 and sys.argv[1] == "run-in-window": gtk.gdk.threads_init() main_window = gtk.Window( gtk.WINDOW_TOPLEVEL ) main_window.set_title( NAME ) main_window.connect( "destroy", quit_all ) app = mateapplet.Applet() menu_factory( app, None ) app.reparent( main_window ) main_window.show() gtk.gdk.threads_enter() gtk.main() gtk.gdk.threads_leave() else: mateapplet.matecomponent_factory("OAFIID:MATE_mintMenu_Factory", mateapplet.Applet.__gtype__, "mintMenu", "0", menu_factory)
import sys import gtk import pygtk pygtk.require("2.0") import mateapplet from nm_dispatcher_olsrd_applet import applet_factory if __name__ == "__main__": # testing for execution print("Starting factory") if len(sys.argv) > 1 and sys.argv[1] == "-d": # debugging mainWindow = gtk.Window() mainWindow.set_title("Applet window") mainWindow.connect("destroy", gtk.main_quit) applet = mateapplet.Applet() applet_factory(applet, None) applet.reparent(mainWindow) mainWindow.show_all() gtk.main() sys.exit() else: mateapplet.matecomponent_factory( "OAFIID:MATE_nm-dispatcher-olsrd-applet_Factory", mateapplet.Applet.__gtype__, "MATE_nm-dispatcher-olsrd-applet", "0.0", applet_factory, )
button = gtk.Button("Hello World") button.connect("clicked", on_button_clicked) window.add(button) window.show_all() gtk.main() def on_button_clicked(button): subprocess.call("mate-calculator") def showAboutDialog(*arguments, **keywords): subprocess.call("mate-about") # If applet is run directly from the command line with the -d debug option we create a window to host it if len(sys.argv) == 2: if sys.argv[1] == "-d": mainWindow = gtk.Window(gtk.WINDOW_TOPLEVEL) mainWindow.set_title("System Panel") mainWindow.connect("destroy", gtk.main_quit) applet = mateapplet.Applet() factory(applet, None) applet.reparent(mainWindow) mainWindow.show_all() gtk.main() sys.exit() if __name__ == '__main__': print "Starting factory" mateapplet.matecomponent_factory("OAFIID:Mate_Panel_Example_Factory", mateapplet.Applet.__gtype__, "Simple mate applet example", "1.0", factory)
opts, args = getopt.getopt(sys.argv[1:], "hdw", ["help", "debug", "window"]) except getopt.GetoptError: # Unknown args were passed, we fallback to bahave as if # no options were passed opts = [] args = sys.argv[1:] for o, a in opts: if o in ("-h", "--help"): usage() elif o in ("-d", "--debug"): mate_invest.DEBUGGING = True mate_invest.debug("Debugging enabled") # these messages cannot be turned by mate_invest.DEBUGGING at their originating location, # because that variable was set here to be True mate_invest.debug("Data Dir: %s" % mate_invest.SHARED_DATA_DIR) mate_invest.debug("Detected PROXY: %s" % mate_invest.PROXY) elif o in ("-w", "--window"): standalone = True if standalone: build_window() gtk.main() else: mateapplet.matecomponent_factory("OAFIID:Invest_Applet_Factory", mateapplet.Applet.__gtype__, mate_invest.defs.PACKAGE, mate_invest.defs.VERSION, applet_factory)
gtk.main() def on_button_clicked(button): subprocess.call("mate-calculator") def showAboutDialog(*arguments, **keywords): subprocess.call("mate-about") # If applet is run directly from the command line with the -d debug option we create a window to host it if len(sys.argv) == 2: if sys.argv[1] == "-d": mainWindow = gtk.Window(gtk.WINDOW_TOPLEVEL) mainWindow.set_title("System Panel") mainWindow.connect("destroy", gtk.main_quit) applet = mateapplet.Applet() factory(applet, None) applet.reparent(mainWindow) mainWindow.show_all() gtk.main() sys.exit() if __name__ == '__main__': print "Starting factory" mateapplet.matecomponent_factory("OAFIID:Mate_Panel_Example_Factory", mateapplet.Applet.__gtype__, "Simple mate applet example", "1.0", factory)
#!/usr/bin/python import sys import gtk import pygtk pygtk.require('2.0') import mateapplet from commotion_applet_support import applet_factory if __name__ == '__main__': # testing for execution print('Starting factory') if len(sys.argv) > 1 and sys.argv[1] == '-d': # debugging mainWindow = gtk.Window() mainWindow.set_title('Applet window') mainWindow.connect('destroy', gtk.main_quit) applet = mateapplet.Applet() applet_factory(applet, None) applet.reparent(mainWindow) mainWindow.show_all() gtk.main() sys.exit() else: mateapplet.matecomponent_factory( 'OAFIID:MATE_commotion-mesh-applet_Factory', mateapplet.Applet.__gtype__, 'MATE_commotion-mesh-applet', '0.0', applet_factory)
g.ToggleMenu() if len(sys.argv) == 2: if sys.argv[1] == "run-in-window" or sys.argv[1] == "run-in-console": # Start the applet in windowed mode main_window = gtk.Window(gtk.WINDOW_TOPLEVEL) main_window.set_decorated(1) main_window.set_title("Tilo Testing Sandpit") main_window.connect("destroy", gtk.main_quit) app = mateapplet.Applet() Tilo(app,"") app.reparent(main_window) main_window.show_all() gtk.main() sys.exit() if __name__ == '__main__': mateapplet.matecomponent_factory( "OAFIID:MATE_Tilo_Factory", mateapplet.Applet.__gtype__, "Tilo", "2", Tilo_factory)
box.add(ok) self.window.show_all() gtk.main() def set_image(self): self.image.set_from_file(os.path.dirname(__file__) + '/' + self.state + '.png') def start(applet, iid): sw = switchButton(applet) sw.applet.show_all() # sw.editPreferences(None, None) return # If applet is run directly from the command line with the -d debug option we create a window to host it if len(sys.argv) == 2: if sys.argv[1] == "-d": mainWindow = gtk.Window(gtk.WINDOW_TOPLEVEL) mainWindow.set_title("System Panel") mainWindow.connect("destroy", gtk.main_quit) applet = mateapplet.Applet() start(applet, None) applet.reparent(mainWindow) mainWindow.show_all() gtk.main() sys.exit() if __name__ == '__main__': print "Starting factory" mateapplet.matecomponent_factory("OAFIID:Mount_Applet_Factory", mateapplet.Applet.__gtype__, "Simple mount applet", "1.0", start)