def __init__(self): gnome.init('gnommander', Config.VERSION) self.widgetTree = gtk.glade.XML(Config.DATADIR + '/yaccfg.glade') self.leftTree = None self.rightTree = None callbacks = {} class_methods = self.__class__.__dict__ for method_name in class_methods.keys(): method = class_methods[method_name] if type(method) == types.FunctionType: callbacks[method_name] = new.instancemethod( method, self, self.__class__) self.widgetTree.signal_autoconnect(callbacks) self.window = self.widgetTree.get_widget('yaccfg') self.notebook = self.widgetTree.get_widget('main_notebook') self.leftScroll = self.widgetTree.get_widget('left_scroll') self.rightScroll = self.widgetTree.get_widget('right_scroll') self.leftLabel = self.widgetTree.get_widget('left_label') self.rightLabel = self.widgetTree.get_widget('right_label') self.hPaned = self.widgetTree.get_widget('main_hpaned') self.commandEntry = self.widgetTree.get_widget('command_entry') self.initPanels() gtk.main()
def __init__(self,applet,iid): self.timeout_interval = 60000 # 60 secs self.sign = "" self.fetch_info(prev=False) self.__gobject_init__() gnome.init("Netbenefits applet", "0.2") self.applet=applet self.evbox = gtk.EventBox() self.orientation = self.applet.get_orient() self.box = None if self.orientation == gnomeapplet.ORIENT_UP or \ self.orientation == gnomeapplet.ORIENT_DOWN: self.box = gtk.HBox() else: self.box = gtkVBox() self.evbox.add(self.box) self.box.pack_start(gtk.EventBox()) self.box.get_children()[0].add(gtk.HBox()) lbl=gtk.Label(str(self.stock_volume*self.current_price) + "CZK") self.box.get_children()[0].get_children()[0].pack_start(lbl) self.box.show() self.applet.add(self.evbox) self.applet.show_all() gobject.timeout_add(self.timeout_interval, self.timeout_callback, self)
def gui_main(input_files): gnome.init(NAME, VERSION) glade = gtk.glade.XML(GLADE) win = SoundConverterWindow(glade) global error error = ErrorDialog(glade) for input_file in input_files: win.filelist.add_file(input_file) win.set_sensitive() gtk.main()
def __init__(self, applet, iid): # we define some useful variables for ghellanzb_applet self.hella_status = '' self.status = '' self.info_label_data = '' self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.created_window = 0 self.access = 0 # we initiate the gnome application and set up internal variables gnome.init(name, version) # we define the applet self.applet = applet self.applet.connect('destroy', self.cleanup, None) # We add the item in the right click menu ui_file = os.path.join(ui_dir, "GNOME_ghellanzb_applet.xml") verb_list = [("About", self.__display_about_dialog), ("Statistics", stats.display_dialog)] self.applet.setup_menu_from_file(None, ui_file, name, verb_list) # We declare the tooltip self.tooltips = gtk.Tooltips() self.tooltips.set_tip(self.applet, '%s - %s' % (name, version)) # we create the frame to display the status label toolbar_frame = gtk.Frame() toolbar_event_box = gtk.EventBox() toolbar_event_box.add(toolbar_frame) toolbar_event_box.connect('button-press-event', self.applet_clicked) # we create the toolbar hbox that will receive icon self.toolbar_hbox = gtk.HBox(False, 0) toolbar_frame.add(self.toolbar_hbox) self.update_status() """ # we create the toolbar applet label toolbar_label = gtk.Label('hellanzb : ') # we create the toolbar applet status label self.toolbar_status = gtk.Label(self.status) # we add both labels to the toolbar box toolbar_hbox.add(toolbar_label) toolbar_hbox.add(self.toolbar_status)""" # we add the toolbar box to the applet self.applet.add(toolbar_event_box) self.applet.show_all() # we check the status of hellanzb every 5 seconds i = gobject.timeout_add(5000, self.update_status, self.applet)
def __init__(self, applet, _iid): BaseApplet.__init__(self) gnome.init('WebilderApplet', __version__) self.applet = applet self.tooltips = gtk.Tooltips() self.tooltips.enable() self.evtbox = gtk.EventBox() self.icon = gtk.gdk.pixbuf_new_from_file( pkg_resources.resource_filename(__name__, 'ui/camera48.png')) self.icon_green = gtk.gdk.pixbuf_new_from_file( pkg_resources.resource_filename(__name__, 'ui/camera48_g.png')) self.applet_icon = gtk.Image() self.scaled_icon = self.icon.scale_simple(16, 16, gtk.gdk.INTERP_BILINEAR) self.scaled_icon_green = self.icon_green.scale_simple(16, 16, gtk.gdk.INTERP_BILINEAR) self.applet_icon.set_from_pixbuf(self.scaled_icon) self.evtbox.add(self.applet_icon) self.applet.add(self.evtbox) # ### Item 7 new in following list self.propxml = _(""" <popup name="button3"> <menuitem name="Item 1" verb="Browse" label="_Browse Collection" pixtype="stock" pixname="gtk-directory"/> <menuitem name="Item 2" verb="NextPhoto" label="_Next Photo" pixtype="stock" pixname="gtk-go-forward"/> <menuitem name="Item 3" verb="Leech" label="_Download Photos" pixtype="filename" pixname="%s"/> <menuitem name="Item 7" verb="InfoCurrent" label="_Info on Current" pixtype="stock" pixname="gtk-dialog-info"/> <menuitem name="Item 6" verb="DeleteCurrent" label="_Delete Current" pixtype="stock" pixname="gtk-delete"/> <menuitem name="Item 4" verb="Pref" label="_Preferences" pixtype="stock" pixname="gtk-preferences"/> <menuitem name="Item 5" verb="About" label="_About" pixtype="stock" pixname="gnome-stock-about"/> </popup> """) % pkg_resources.resource_filename(__name__, 'ui/camera16.png') self.applet.connect("change-size", self.on_resize_panel) self.applet.connect("button-press-event", self.on_button_press) self.verbs = [ ( "Pref", self.preferences ), ( "About", self.about), ( "Browse", self.browse), ( "NextPhoto", self.next_photo), ( "Leech", self.leech), ( "DeleteCurrent", self.delete_current), ( "InfoCurrent", self.info_current)] # ### "InfoCurrent" is new self.applet.setup_menu(self.propxml, self.verbs, None) self.applet.show_all() gobject.timeout_add(60*1000, self.timer_event) self.photo_browser = None self.download_dlg = None
def main(arguments): gnome.init(NAME, VERSION) glade = gtk.glade.XML(GLADE) if len(arguments) > 0: win = LibraryWindow(glade, arguments[0]) else: win = LibraryWindow(glade) gtk.main()
def __init__(self, applet, iid): gnome.init("trampometro", "1.0") self.applet = applet self.hbox = gtk.HBox() self.label = gtk.Label("---") applet.add(self.hbox) self.hbox.add(self.label) self.monitor = RepositorySet("%s/devel" % os.environ['HOME']) self.check() applet.show_all()
def logoutUser(): """Automatically log the user out of the GNOME desktop.""" import gnome import gnome.ui gnome.init(platform.package, platform.version) client = gnome.ui.master_client() client.request_save(gnome.ui.SAVE_GLOBAL, # Save style True, # Shutdown gnome.ui.INTERACT_ANY, # Allow user interaction False, # Fast True) # All apps save state
def __init__(self, install, visible): gnome.init('language-installer', '1.0') self.install = install self.visible = visible self.glade_file = "/usr/share/language-installer/ui/language-installer.glade" self.wTree = gtk.glade.XML(self.glade_file) self.window = self.wTree.get_widget('window') self.window.connect('delete-event', self.ignore) self.window.connect('response', self.response) self.label_please_wait = self.wTree.get_widget("label_please_wait") self.button_OK = self.wTree.get_widget("button_OK")
def logoutUser(): """Automatically log the user out of the GNOME desktop.""" import gnome import gnome.ui gnome.init(platform.package, platform.version) client = gnome.ui.master_client() client.request_save( gnome.ui.SAVE_GLOBAL, # Save style True, # Shutdown gnome.ui.INTERACT_ANY, # Allow user interaction False, # Fast True) # All apps save state
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)
def __init__(self, args): self.daemon_bps = (0, 0, 0) # Setup signals try: import gnome.ui import gnome #Suppress: Warning: Attempt to add property GnomeProgram::*** after class was initialised original_filters = warnings.filters[:] warnings.simplefilter("ignore") try: self.gnome_prog = gnome.init("Deluge", deluge.common.get_version()) finally: warnings.filters = original_filters self.gnome_client = gnome.ui.master_client() def on_die(*args): reactor.stop() self.gnome_client.connect("die", on_die) log.debug("GNOME session 'die' handler registered!") except Exception, e: log.warning( "Unable to register a 'die' handler with the GNOME session manager: %s", e)
def init(app_id): try: import gnome, gnome.ui except ImportError: return gnome.init(app_id, const.VERSION) client = gnome.ui.master_client() client.set_restart_style(gnome.ui.RESTART_IF_RUNNING) command = os.path.normpath(os.path.join(os.getcwd(), sys.argv[0])) try: client.set_restart_command([command] + sys.argv[1:]) except TypeError: # Fedora systems have a broken gnome-python wrapper for this function. # http://www.sacredchao.net/quodlibet/ticket/591 # http://trac.gajim.org/ticket/929 client.set_restart_command(len(sys.argv), [command] + sys.argv[1:]) client.connect('die', lambda *x: app.quit())
def __init__(self): gnome.init(config.PROGRAM, config.VERSION) self.ui = gtk.glade.XML(RUN_FROM_DIR + 'desigle.glade') self.main_window = self.ui.get_widget('desigle') self.notebook = self.ui.get_widget('notebook_editor') self.main_window.connect("delete-event", lambda x,y: self.exit() ) self.init_menu() self.init_editor() self.init_editor_errors() self.init_pdf_preview_pane() self.init_toolbar_find() thread.start_new_thread( self.watch_editor, () ) self.main_window.show()
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)
def run(self): self.__init_i18n() [args, headers] = self.__get_options() gnome.init(NAME, VERSION) gtk.gdk.threads_init() gtk.window_set_default_icon_list(*gui.get_icon_list([16, 22, 24, 32])) self.download_list = DownloadList() self.download_manager = DownloadManager() self.dbus_service = dbus_service.DBusService() # If the DBus service is already running, add downloads using it if not self.dbus_service.register(): for uri in args: self.dbus_service.download_manager.AddDownload( uri, os.getcwd(), headers) return 0 self.dbus_service.register_object(dbus_service.DOWNLOAD_MGR_OBJ_PATH, self.download_list) self.main_window = MainWindow(self.config, self.download_list) self.dbus_service.register_object(dbus_service.MAIN_WINDOW_OBJ_PATH, self.main_window) if self.config.show_main_window: self.main_window.window.show() self.status_icon = TrayIcon(self.main_window) if not self.config.show_status_icon: self.status_icon.icon.hide_all() sys.excepthook = self.main_window.on_unhandled_exception self.download_list.load_from_xml() for uri in args: if self.config.ask_for_location: add = AddDownloadDialog(uri, headers) add.dialog.run() else: self.download_list.add_download(uri, self.config.default_folder, headers) gtk.main()
def run(self): self.__init_i18n() [args, headers] = self.__get_options() gnome.init(NAME, VERSION) gtk.gdk.threads_init() gtk.window_set_default_icon_list(*gui.get_icon_list([16, 22, 24, 32])) self.download_list = DownloadList() self.download_manager = DownloadManager() self.dbus_service = dbus_service.DBusService() # If the DBus service is already running, add downloads using it if not self.dbus_service.register(): for uri in args: self.dbus_service.download_manager.AddDownload(uri, os.getcwd(), headers) return 0 self.dbus_service.register_object(dbus_service.DOWNLOAD_MGR_OBJ_PATH, self.download_list) self.main_window = MainWindow(self.config, self.download_list) self.dbus_service.register_object(dbus_service.MAIN_WINDOW_OBJ_PATH, self.main_window) if self.config.show_main_window: self.main_window.window.show() self.status_icon = TrayIcon(self.main_window) if not self.config.show_status_icon: self.status_icon.icon.hide_all() sys.excepthook = self.main_window.on_unhandled_exception self.download_list.load_from_xml() for uri in args: if self.config.ask_for_location: add = AddDownloadDialog(uri, headers) add.dialog.run() else: self.download_list.add_download(uri, self.config.default_folder, headers) gtk.main()
def init(self): """I start the application""" # avoid gnome warnings gnome.init(APP_LONG_NAME, __version__) self.splash = SplashContainer() self.splash.pulse() profile_name = config.get('profile', 'name') if not profile_name: # user never never ran the app self.splash.set_text(_('Initial setup...')) self.splash.pulse() # populate databases and configure hardware afterwards populate_dbs() self.splash.pulse() self.detect_hardware()
def __init__(self, applet, iid): gnome.init('sample', '1.0') self.applet = applet applet.connect("destroy", self.cleanup) self.config = Config(self.applet) self.build_applet(applet) self.build_menu(applet) self.tg = TextGetter(self.force_update, self.applet.get_preferences_key()) self.applet.connect("button-press-event", self.on_click) self.timeout = None self.update() applet.show_all()
def __init__(self, version, share_path): #FIXME: self.settings_dlg=gtk.glade.XML(share_path+"/glade/settings.glade").get_widget("dlgSettings") gnome.init("pyterm", version) self.settings_dlg = SettingsWindow() self.profiles = conf().profiles self.conf = conf() self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.connect("delete_event", self.delete_event) self.window.connect("destroy", lambda w: gtk.main_quit()) self.window.connect("key-press-event", self.key_press) self.nb = gui.TerminalNotebook(self) self.window.add(self.nb) self.nb.create_tabs(conf().sessions) self.nb.set_scrollable(True) # TODO: make settings self.window.show_all() self.window.set_focus(self.nb.terminals[0]['term']) conf().main = self self.update_ui()
def init_once(self): print "Starting " + ENV_VARS.package + " v" + ENV_VARS.version JabberConnection.__init__(self) gnome.init(ENV_VARS.package, ENV_VARS.version) self.pman = PluginManager() self.resources = ResourceManager() self.__load_resources() ld = LoginDlg(1) ld.evtDoConnect = self.startup ld.evtCancel = self.quit ld.show() ## Show us more info if we are debugging if __debug__: self.session.evtTransmitXML.connect(self.__on_transmit_xml) self.session.evtRecvXML.connect(self.__on_recv_xml) self.session.evtPresenceRequest.connect(self.__on_presence_request)
def __init__(self, version, share_path): #FIXME: self.settings_dlg=gtk.glade.XML(share_path+"/glade/settings.glade").get_widget("dlgSettings") gnome.init("pyterm", version) self.settings_dlg=SettingsWindow() self.profiles = conf().profiles self.conf = conf() self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.connect("delete_event", self.delete_event) self.window.connect("destroy", lambda w: gtk.main_quit()) self.window.connect("key-press-event", self.key_press) self.nb = gui.TerminalNotebook(self) self.window.add(self.nb) self.nb.create_tabs(conf().sessions) self.nb.set_scrollable(True) # TODO: make settings self.window.show_all() self.window.set_focus(self.nb.terminals[0]['term']) conf().main = self self.update_ui()
def __init__(self, applet, iid): #Init app self.app = BCTimer.App() self.app.logger.debug('__init__') # initializate the gnome internals gnome.init("sample", "1.0") # save the applet object self.applet = applet # set up the applet tooltip self.applet.set_tooltip_text(self.title) gtk.rc_parse_string(""" style "event_box_style" { GtkWidget::focus-line-width=0 GtkWidget::focus-padding=0 } style "menu_bar_style" { ythickness = 0 GtkMenuBar::shadow-type = none GtkMenuBar::internal-padding = 0 } class "GtkEventBox" style "event_box_style" class "GtkMenuBar" style:highest "menu_bar_style" """); self.menu_item = gtk.MenuItem('00:13') self.menu_bar = gtk.MenuBar() self.menu_bar.append(self.menu_item) self.menu_item.set_submenu(self.app.menu) self.menu_bar.connect('button-press-event', self.button_press) self.applet.add(self.menu_bar) self.setup_rightclick_menu()
def __init__(self, args): self.daemon_bps = (0,0,0) # Setup signals try: import gnome.ui import gnome self.gnome_prog = gnome.init("Deluge", deluge.common.get_version()) self.gnome_client = gnome.ui.master_client() def on_die(*args): reactor.stop() self.gnome_client.connect("die", on_die) log.debug("GNOME session 'die' handler registered!") except Exception, e: log.warning("Unable to register a 'die' handler with the GNOME session manager: %s", e)
def __init__(self, applet, iid): gnome.init(APPNAME, VERSION) self.applet = applet self.applet.set_name('pyipmsgapplet') self.applet.set_applet_flags(gnomeapplet.EXPAND_MINOR) self.applet.connect('change-orient', self.on_change_orient) self.incoming = [] self.logviewer = LogViewer() self.pref = Preferences() self.share_monitor = ShareMonitor(ipmsg.get_share_status, ipmsg.remove_share) #self.clean_webshare() nics = ipmsg.get_all_network_interface() ipmsg.init(nics=nics, settings_file=config_file) gobject.timeout_add(100, self.mainloop) if nics: self.turn_on() self._build_ui() self._key_bind()
def attempt_gnome_client(self): """Attempt to find a GNOME Session to register with""" try: import gnome import gnome.ui self.gnome_program = gnome.init(APP_NAME, APP_VERSION) self.gnome_client = gnome.ui.master_client() self.gnome_client.connect_to_session_manager() self.gnome_client.connect('save-yourself', self.save_yourself) self.gnome_client.connect('die', self.die) dbg('GNOME session support enabled and registered') except (ImportError, AttributeError): self.gnome_client = False dbg('GNOME session support not available')
def main(argv): url = get_url() if not url or not check_url(url): run_set_url_dialog() url = get_url() if not url: return 1 elif "-s" in argv or "--set-url" in argv: run_set_url_dialog() return 0 w = gtk.Window(gtk.WINDOW_TOPLEVEL) w.set_title(APP_NAME) w.set_role("mainWindow") set_icon(w) w.set_size_request(1, 1) w.resize(800, 500) w.connect("delete-event", close_callback) s = gtk.ScrolledWindow() wv = webkit.WebView() wv.open(url) s.add(wv) w.add(s) if platform.system() == "Linux": sys.argv[0] = APP_ID try: import gnome import gnome.ui gnome.init(APP_ID, APP_VERSION) client = gnome.ui.master_client() client.connect("die", gtk.main_quit) except ImportError: pass while gtk.events_pending(): gtk.main_iteration() w.show_all() gtk.main() return 0
def __init__(self): gnome.init(PROG_NAME, VERSION) glade_f = find_glade() self.gladeHandler = gtk.glade.XML(glade_f) #self.gladeHandler.signal_autoconnect(self.__class__.__dict__) #TODO: try to make this dynamic dic = {} for callback in CALLBACKS: dic[callback] = getattr(self, callback) self.gladeHandler.signal_autoconnect (dic) self.mySettings = Settings.Settings() self.joy = None if os.access(SETTINGSFILE,os.R_OK): #TODO: remove in a futur version mySettings.oldVersion(SETTINGSFILE) os.unlink(SETTINGSFILE) self.gameList = GameList.GameList(self.gladeHandler) self.gameList.captureDir = self.mySettings.settings['captureDir'] self.gameList.populate( self.mySettings.settings['romsDir']) self.mainFrame = self.gladeHandler.get_widget('main') self.appBar = self.gladeHandler.get_widget('appbar1') self.preferences_dialog = self.gladeHandler.get_widget('preferences_dialog') self.binding_dialog = self.gladeHandler.get_widget('binding_dialog') if os.path.isfile(ICONFILE): #old version of python-gtk have not set_icon_from_file try: self.mainFrame.set_icon_from_file(ICONFILE) self.preferences_dialog.set_icon_from_file(ICONFILE) self.binding_dilaog.set_icon_from_file(ICONFILE) except AttributeError: pass
def main(application): import gnome global gnomeProgram gnomeProgram = gnome.init("Shtoom", "Whatever Version") from twisted.internet import gtk2reactor gtk2reactor.install() from shtoom.ui.gnomeui.main import ShtoomWindow UI = ShtoomWindow() UI.connectApplication(application) from shtoom import log if application.getPref('stdout'): import sys log.startLogging(sys.stdout, setStdout=False) else: log.startLogging(UI.getLogger(), setStdout=False) return UI
def __init__(self, args): self.daemon_bps = (0,0,0) # Setup signals try: import gnome.ui import gnome #Suppress: Warning: Attempt to add property GnomeProgram::*** after class was initialised original_filters = warnings.filters[:] warnings.simplefilter("ignore") try: self.gnome_prog = gnome.init("Deluge", deluge.common.get_version()) finally: warnings.filters = original_filters self.gnome_client = gnome.ui.master_client() def on_die(*args): reactor.stop() self.gnome_client.connect("die", on_die) log.debug("GNOME session 'die' handler registered!") except Exception, e: log.warning("Unable to register a 'die' handler with the GNOME session manager: %s", e)
standalone = True elif opt in ("-s", "--start"): start_window = args elif opt in ("-t", "--trace-sql"): runtime.trace_sql = True except getopt.GetoptError: usage() print "Starting nevertheless, because applet dies otherwise (TODO)" gtk.window_set_default_icon_name("hamster-applet") if standalone: gnome.init(defs.PACKAGE, defs.VERSION) app = gtk.Window(gtk.WINDOW_TOPLEVEL) app.set_title(_(u"Time Tracker")) applet = gnomeapplet.Applet() applet_factory(applet, None) applet.reparent(app) app.show_all() gtk.main() elif start_window: if start_window == "stats": from stats import StatsViewer stats_viewer = StatsViewer().show()
self.update_form() self.xml.signal_autoconnect(self) #self.lock_signals = False def update_form(self): self.entry.set_text(self.profile.get_name()) self.height.set_value(self.profile.get_height()) self.gender.set_active(self.profile.get_gender()) def on_button_close_pressed(self, widget): self.window.destroy() def on_entry_name_changed(self, widget): name = self.entry.get_text() if len(name) <= 0: return self.profile.set_name(name) def on_spinbutton_height_value_changed(self, widget): self.profile.set_height(self.height.get_value()) def on_combobox_gender_changed(self, widget): self.profile.set_gender(self.gender.get_active()) if __name__ == '__main__': profile = Profile("test") dialog = ProfileDialog(profile) gnome.init(cfg["APP_NAME"], cfg["APP_VERSION"]) gtk.main()
# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ## import sys, os, gettext, locale import gnome import gtk.glade from config import c as cfg from mainwindow import MainWindow if __name__ == '__main__': # Locale and I18N stuff os.environ['LC_NUMERIC'] = 'C' locale.setlocale (locale.LC_NUMERIC, 'C') gettext.bindtextdomain (cfg["GETTEXT_PACKAGE"], cfg["INSTALL_LOCALE"]) gettext.textdomain (cfg["GETTEXT_PACKAGE"]) gtk.glade.bindtextdomain(cfg["GETTEXT_PACKAGE"], cfg["INSTALL_LOCALE"]) try: gtk.glade.textdomain(cfg["GETTEXT_PACKAGE"]) except AttributeError: print "gtk.glade.textdomain not found; i18n will not work" gnome.init(cfg["APP_NAME"], cfg["APP_VERSION"]) window = MainWindow() gtk.main()
dialog.set_markup(message) dialog.run() dialog.hide() sys.exit(1) if __name__ == "__main__": sys.excepthook = excepthook name = "parano" gettext.install(name, unicode=1) gtk.glade.bindtextdomain(name) gtk.glade.textdomain(name) # (longName, shortName, type , default, flags, descrip , argDescrip) table=[ ("quiet" , 'q' , None , None , 0 , 'Do not print any message on stdout' , ""), ] gnome.init(NAME, VERSION, gnome.libgnome_module_info_get()) leftover, argdict = gnome.popt_parse(sys.argv, table) if argdict["quiet"]: option_quiet = True log( NAME +" "+ VERSION) log(DATADIR) parano = Parano(leftover) parano.main()
import sys import ORBit import bonobo, gnome ORBit.load_typelib('Accessibility') import Accessibility gnome.init('dump-tree', '0.0') REGISTRY_IID = 'OAFIID:Accessibility_Registry:1.0' registry = bonobo.activation.activate("iid == '%s'" % REGISTRY_IID) def find_app(registry, name): '''Iterates over each app on each desktop til it finds one with a matching name, which is then returned.''' for desknum in range(registry.getDesktopCount()): desktop = registry.getDesktop(desknum) for i in range(desktop.childCount): child = desktop.getChildAtIndex(i) if child.name == name: desktop.unref() return child child.unref() desktop.unref() raise ValueError('could not find application %s' % name) def find_icon(accessible): icon = None for i in range(accessible.childCount):
import gobject import gtk.glade from twisted.python.util import sibpath from twisted.python import reflect from twisted.manhole.ui import gtk2manhole from twisted.python.components import Adapter, registerAdapter from twisted.python import log from twisted.protocols import policies from zope.interface import implements, Interface # the glade file uses stock icons, which requires gnome to be installed import gnome version = "$Revision: 1.1 $"[11:-2] gnome.init("gladereactor Inspector", version) class ConsoleOutput(gtk2manhole.ConsoleOutput): def _captureLocalLog(self): self.fobs = log.FileLogObserver(gtk2manhole._Notafile(self, "log")) self.fobs.start() def stop(self): self.fobs.stop() del self.fobs class ConsoleInput(gtk2manhole.ConsoleInput): def sendMessage(self): buffer = self.textView.get_buffer()
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2006 Gautier Portet <kassoulet gmail com> import unittest import parano parano.option_quiet = True import os import glob import gnome import gnomevfs import gtk from random import randint gnome.init("Parano Test", "wip", gnome.libgnome_module_info_get()) parano.DATADIR = "src" base_folder = "test/" test_folder = base_folder + "files/" class ParanoTestCases(unittest.TestCase): def _setUp(self): self.p = parano.Parano() self.p.window_main.hide() def _tearDown(self): self.p = None def _save(self, format): for f in glob.glob(test_folder + "*"):
import ORBit import bonobo, gnome ORBit.load_typelib('Accessibility') gnome.init('list-apps', '0.0') REGISTRY_IID = 'OAFIID:Accessibility_Registry:1.0' registry = bonobo.activation.activate("iid == '%s'" % REGISTRY_IID) # get first desktop desktop = registry.getDesktop(0) for i in range(desktop.childCount): child = desktop.getChildAtIndex(i) print child.name child.unref() desktop.unref() registry.unref()
args = sys.argv[1:] for o, a in opts: if o in ("-h", "--help"): usage() elif o in ("-w", "--window"): standalone = True print 'Running with options:', { 'standalone': standalone, } gnome.program_init('glipper', '1.0', properties={gnome.PARAM_APP_DATADIR: glipper.DATA_DIR}) set_process_name() if standalone: import gnome gnome.init(glipper.defs.PACKAGE, glipper.defs.VERSION) set_process_name() build_window() gtk.main() else: gnomeapplet.bonobo_factory("OAFIID:Glipper_Factory", gnomeapplet.Applet.__gtype__, glipper.defs.PACKAGE, glipper.defs.VERSION, applet_factory)
def __init__(self): """Loads the glade XML and creates the ui object""" gnome.init("Piedit", "0.1") gladeui = gtk.glade.XML(os.path.join('glade', 'piedit.glade')) ui = piedit.ui.UI(gladeui)
dialog.hide() sys.exit(1) if __name__ == "__main__": sys.excepthook = excepthook name = "parano" gettext.install(name, unicode=1) gtk.glade.bindtextdomain(name) gtk.glade.textdomain(name) # (longName, shortName, type , default, flags, descrip , argDescrip) table = [ ("quiet", 'q', None, None, 0, 'Do not print any message on stdout', ""), ] gnome.init(NAME, VERSION, gnome.libgnome_module_info_get()) leftover, argdict = gnome.popt_parse(sys.argv, table) if argdict["quiet"]: option_quiet = True log(NAME + " " + VERSION) debug("datadir: " + DATADIR) parano = Parano(leftover) parano.main()
self.check_chain_username.set_tooltip_text(_('When the password is copied to clipboard, put the username before the password as a clipboard "chain"')) self.section_misc.append_widget(None, self.check_chain_username) def run(self): "Runs the dialog" self.show_all() def factory(applet, iid): "Applet factory function" RevelationApplet(applet, iid) return True if __name__ == "__main__": gnome.init(config.APPNAME, config.VERSION) gnomeapplet.bonobo_factory( "OAFIID:GNOME_RevelationApplet_Factory", gnomeapplet.Applet.__gtype__, config.APPNAME, config.VERSION, factory )
have_gnome = False logging.info('GNOME enabled: %s', have_gnome and 'yes' or 'no') from cf.app import CFApplication # Check for running applications or create one if ipc_client is None or not ipc.is_alive(ipc_client): logging.info('Creating new application') if have_gnome: props = {} setup_py = os.path.abspath( os.path.join(os.path.dirname(__file__), '../setup.py')) if os.path.isfile(setup_py): props['app-datadir'] = cf.DATA_DIR props['human-readable-name'] = release.name gnome.init(release.name.lower(), release.version, properties=props) gtk.gdk.threads_init() gtk.gdk.threads_enter() app = CFApplication(opts) app.init() instance = app.new_instance(args) logging.info('Entering GTK main loop') gtk.main() logging.info('Leaving GTK main loop') gtk.gdk.threads_leave() # We have a running application, re-use it... else: logging.info('Running application found') if args: # TODO(andi): Move instance selector to app.
import ORBit, CORBA import bonobo, gnome ORBit.load_typelib('Accessibility') import Accessibility import Accessibility__POA gnome.init('follow-focus', '0.0') orb = CORBA.ORB_init() REGISTRY_IID = 'OAFIID:Accessibility_Registry:1.0' registry = bonobo.activation.activate("iid == '%s'" % REGISTRY_IID) ev_count = 50 class MyListener(Accessibility__POA.EventListener): def ref(self): pass def unref(self): pass def queryInterface(self, repo_id): if repo_id == 'IDL:Accessibility/EventListener:1.0': return self._this() else: return None def notifyEvent(self, event): global ev_count
# You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA import os import sys import traceback import webbrowser import ka_debug try: from sugar import env # HACK: Needed by http://dev.sugarlabs.org/ticket/456 import gnome gnome.init('Hulahop', '1.0') import hulahop hulahop.set_app_version(os.environ['SUGAR_BUNDLE_VERSION']) hulahop.startup(os.path.join(env.get_profile_path(), 'gecko')) from hulahop.webview import WebView except: ka_debug.err('failed importing hulahop [%s] [%s]' % \ (sys.exc_info()[0], sys.exc_info()[1])) traceback.print_exc(file=sys.__stderr__) class HtmlPage(object): """ inv: self._widget_list is not None inv: self._widget_list is not None """
import aspell import ORBit, CORBA import bonobo, gnome ORBit.load_typelib('Accessibility') import Accessibility import Accessibility__POA gnome.init('spell-check', '0.0') orb = CORBA.ORB_init() REGISTRY_IID = 'OAFIID:Accessibility_Registry:1.0' registry = bonobo.activation.activate("iid == '%s'" % REGISTRY_IID) spell = aspell.ASpell('--master=british') ev_count = 10 class MyListener(Accessibility__POA.EventListener): def ref(self): pass def unref(self): pass def queryInterface(self, repo_id): if repo_id == 'IDL:Accessibility/EventListener:1.0': return self._this() else: return None
The help output of your program will be much nicer :-) And it will enable us to slowly get rid of popt (even if libgnome will still have to depend on it for compatibility reasons). """ import sys import glib import gnome def callback(name, value, group): if name == "--example": print "example got %s" % value elif name in ("-o", "--option"): print "option" else: print "remaining:", value group = glib.OptionGroup(None, None, None, callback) group.add_entries([("example", "\0", 0, "An example option", "option"), ("option", "o", glib.OPTION_FLAG_NO_ARG, "An option", None), (glib.OPTION_REMAINING, "\0", 0, "", None), ]) context = glib.OptionContext("argument") context.set_main_group(group) prog = gnome.init("myprog", "1.0", argv=sys.argv, option_context=context)
if __name__ == '__main__': import sys args = sys.argv[1:] if len(args): print print "------------------------------------------" print " FlyBack - Apple's Time Machine for Linux" print "------------------------------------------" print if args[0] in ('-b', '--backup-all'): run_all_backups() elif len(args) == 2: run_backup(args[0], args[1]) else: print ' to launch the graphical interface:' print ' $ python flyback.py' print ' to backup all detected repositories:' print ' $ python flyback.py [-b|--backup-all]' print ' to backup a specific repository:' print ' $ python flyback.py <drive_uuid> <path>' print else: import gobject, gnome, gtk gnome.init(settings.PROGRAM_NAME, settings.PROGRAM_VERSION) gobject.threads_init() gtk.gdk.threads_init() launch_select_backup_gui() gtk.main()
def __init__(self): """Loads the glade XML and creates the ui object""" gnome.init("Piedit", "0.1") gladeui = gtk.glade.XML(os.path.dirname(sys.argv[0])+"/glade/piedit.glade") ui = piedit.ui.UI(gladeui)
def main(): prog = gnome.init("chrome_clean_shutdown", "1.0", gnome.libgnome_module_info_get(), sys.argv, []) client = gnome.ui.master_client() client.connect("save-yourself", chrome_clean_shutdown)
def setSlider(self, slider): self.slider = slider demo = SliderDemo(GtkDemoWindow) demo.demo() if __name__ == "__main__": import pygtk pygtk.require("2.0") from twisted.internet import gtk2reactor gtk2reactor.install() import gobject import gtk import gtk.gdk pygtk.require("2.0") import gobject import gtk import gtk.gdk import gnome global gnomeProgram gnomeProgram = gnome.init("popups", "Whatever Version") from twisted.internet import reactor reactor.callLater(0, demo) reactor.run()