def get_about_dialog(): """Returns an AboutDialog with all the necessary info""" _MAX_WIDTH = 20 wrapped_name = fill(consts.APP_LONG_NAME, _MAX_WIDTH) abt = gtk.AboutDialog() # attach an icon icon = abt.render_icon(gtk.STOCK_ABOUT, gtk.ICON_SIZE_MENU) abt.set_icon(icon) filepath = os.path.join(consts.IMAGES_DIR, 'VF_logo.png') logo = gtk.gdk.pixbuf_new_from_file(filepath) abt.set_logo(logo) gtk.about_dialog_set_url_hook(lambda abt, url: url_show(url)) gtk.about_dialog_set_email_hook(lambda d, e: url_show("mailto:%s" % e)) if gtk.pygtk_version >= (2, 11, 0): abt.set_program_name(wrapped_name) else: abt.set_name(wrapped_name) abt.set_version(consts.APP_VERSION) abt.set_copyright(_('Vodafone Spain S.A.')) abt.set_authors(consts.APP_AUTHORS) abt.set_documenters(consts.APP_DOCUMENTERS) abt.set_artists(consts.APP_ARTISTS) abt.set_website(consts.APP_URL) # XXX: pango here? I tried w/o success abt.set_website_label('http://forge.vodafonebetavine.net/..') trans_credits = _('translated to $LANG by $translater') # only enable them when necessary if trans_credits != 'translated to $LANG by $translater': abt.set_translator_credits(trans_credits) _license = """ Vodafone Mobile Connect Card driver for Linux Copyright (C) 2006-2007 Vodafone España S.A. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA""" abt.set_license(_license) return abt
def action(self, text=None): print "Opening Pinot hit: ", self.url # Prefer deskbar's url_show is available try: deskbar.Utils.url_show (self.url) except AttributeError: gnome.url_show (self.url)
def run(self): debug.dprint("LOADERS: web_page.run()") if self.name == '' or self.name == None: return if config.Prefs.globals.use_custom_browser: command = config.Prefs.globals.custom_browser_command try: browser = webbrowser.get(command) except: # probably python-2.4 and failed to get a registered browser or if '%s' not in command: # '%s' probably wasn't in, so add it to get a generic browser command += ' %s' browser = webbrowser.get(command) try: browser.open(self.name) except: debug.dprint("LOADERS: failed to open '%s' with browser command '%s'" % (self.name, command)) else: try: gnome.url_show(self.name) except: debug.dprint("LOADERS: Gnome failed trying to open: %s" %self.name) try: webbrowser.open(self.name) except: debug.dprint("LOADERS: webbrowser failed trying to open: %s -- giving up" %self.name) pass debug.dprint("LOADERS: Browser call_completed for: %s" %self.name)
def _onResponse(self, dialog, response_id): if response_id == gtk.RESPONSE_DELETE_EVENT: self.destroy() elif response_id == self.GET_NEW_EXTENSIONS_EVENT: import gnome gnome.url_show("http://panelextensions.gnome.org") self.destroy()
def show_downloads(self): if self._style == BYDATE: url = "file://" + self._media_dir + "/" + utils.get_dated_dir() else: url = "file://" + self._media_dir if HAS_GNOME: gnome.url_show(url) else: import webbrowser webbrowser.open_new_tab(url)
def show_downloads(self): if self._style==BYDATE: url = "file://"+self._media_dir+"/"+utils.get_dated_dir() else: url = "file://"+self._media_dir if HAS_GNOME: gnome.url_show(url) else: import webbrowser webbrowser.open_new_tab(url)
def open_uri(uri, timestamp=0): # TODO: should be 2.14 when released if gtk.pygtk_version >= (2, 13, 0): gtk.show_uri(gtk.gdk.screen_get_default(), uri, timestamp) else: try: import gnome gnome.url_show(uri) except ImportError: pass
def _open_file(self, item): """ opens the file of the dragitem argument """ from gnome import url_show file_uri = item.get_uri() try: url_show(file_uri) except: print_error("Could not open %s" % file_uri)
def on_send_mail_button_clicked(self,widget,data=None): contacts = self.__selected_contacts() if contacts is not None: string = "" for contact in contacts: if len(contact.email) > 0: if string == "": string = contact.email else: string = string + ", " + contact.email gnome.url_show("mailto:%s" % string)
def __sl_send_mail_cb(self, widget, event, data=None): selection = self._sc_treeview.get_selection() if selection.count_selected_rows()!= 1: return None model, itera = selection.get_selected() contact_id = model.get_value(itera,0) contact = MSDAddressBook.MDContact.get(contact_id) if contact is not None: gnome.url_show("mailto:%s" % contact.email) self._select_contact_window.hide()
def open_uri(uri, timestamp=0): """Convenience function for opening a given URI with the default application. """ # The function 'show_uri()' is available in PyGTK 2.14 and above. if gtk.pygtk_version >= (2, 14, 0): gtk.show_uri(gtk.gdk.screen_get_default(), uri, timestamp) else: try: import gnome gnome.url_show(uri) except ImportError: pass
def url_open (w, url): try: gnome.url_show (url) except gobject.GError, msg: d = MessageDialog (None, DIALOG_MODAL | DIALOG_DESTROY_WITH_PARENT, MESSAGE_ERROR, BUTTONS_CLOSE, _('Cannot open URL:\n%s') % msg) d.run () d.destroy ()
def about(*args): license = """ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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 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. """ gtk.about_dialog_set_url_hook(lambda dialog, url: url_show(url)) aboutdlg = gtk.AboutDialog() aboutdlg.set_logo(getPixbuf("smart")) aboutdlg.set_version(VERSION) aboutdlg.set_name(NAME) aboutdlg.set_copyright("2008 Canonical, Inc.") aboutdlg.set_authors(AUTHORS) aboutdlg.set_license(license) aboutdlg.run() aboutdlg.destroy() return
def show_uri(uri): if not hasattr(gtk, "show_uri"): from gnome import url_show return url_show(uri) return gtk.show_uri(gtk.gdk.Screen(), uri, 0L)
def action(self, text=None): if TYPES[self.result["type"]].has_key("action"): cmd = TYPES[self.result["type"]]["action"] cmd = map(lambda arg : arg % self.result, cmd.split()) # we need this to handle spaces correctly print "Opening Tracker hit with command:", cmd try: # deskbar >= 2.17 deskbar.Utils.spawn_async(cmd) except AttributeError: # deskbar <= 2.16 gobject.spawn_async(args, flags=gobject.SPAWN_SEARCH_PATH) else: try: # deskbar >= 2.17 deskbar.Utils.url_show ("file://"+cgi.escape(self.result['uri'])) except AttributeError: gnome.url_show("file://"+cgi.escape(self.result['uri'])) print "Opening Tracker hit:", self.result['uri']
def __showAbout(self, widget): dialog = gtk.AboutDialog() gtk.about_dialog_set_url_hook(lambda a, b: url_show(b)) dialog.set_name(name) dialog.set_authors(__author__) dialog.set_comments(__doc__) dialog.set_license(__license__) dialog.set_version(__version__) dialog.set_website(__website__) dialog.run() dialog.destroy()
def __showAbout(self, widget): dialog = gtk.AboutDialog() gtk.about_dialog_set_url_hook(lambda a,b: url_show(b)) dialog.set_name(name) dialog.set_authors(__author__) dialog.set_comments(__doc__) dialog.set_license(__license__) dialog.set_version(__version__) dialog.set_website(__website__) dialog.run() dialog.destroy()
def browse_url(url): global gnome_initted if sys.platform == 'win32': try: import webbrowser webbrowser.open_new(url) except: raise error.Error('Opening a browser failed.') elif settings.gtk_loaded(): try: import gnome except: gnome = None if gnome and not gnome_initted: gnome.program_init('circle',__init__.__version__) gnome_initted = 1 if gnome: gnome.url_show(url) else: if not os.fork(): try: os.execlp('gnome-moz-remote','gnome-moz-remote','--newwin',url) except: try: os.execlp('mozilla','mozilla',url) except: raise error.Error('Opening a browser failed.') else: try: #if not os.fork(): #os.execlp('lynx','lynx',url) os.system("lynx "+quote_for_shell(url)) except: raise error.Error('Opening a browser failed.')
# -*- coding: utf-8 -*- from os.path import join from gettext import gettext as _ from invest.defs import VERSION import invest import gtk, gtk.gdk from gnome import url_show gtk.about_dialog_set_email_hook(lambda dialog, email: url_show("mailto:%s" % email)) invest_logo = None try: invest_logo = gtk.gdk.pixbuf_new_from_file_at_size(join(invest.ART_DATA_DIR, "invest_neutral.svg"), 96, 96) except Exception, msg: pass def show_about(): about = gtk.AboutDialog() infos = { "program-name" : _("Invest"), "logo" : invest_logo, "version" : VERSION, "comments" : _("Track your invested money."), "copyright" : "Copyright © 2004-2005 Raphael Slinckx." } about.set_authors(["Raphael Slinckx <*****@*****.**>"]) # about.set_artists([]) # about.set_documenters([]) #translators: These appear in the About dialog, usual format applies.
def show_uri(uri): if not hasattr(gtk, 'show_uri'): from gnome import url_show return url_show(uri) return gtk.show_uri(gtk.gdk.Screen(), uri, 0L)
def load_url(url): gnome.url_show(url) except:
def on_contents_activate(self, w): """Show the man page.""" gnome.url_show("man:%s.1" % Const.NAME)
# to avoid blocking. Attempt to cycle until EOF or # newline is encountered. output = [] data = "" while 1: data += os.read(proc.stdout.fileno(), 8192) if data == "" or data.endswith("\n"): output = data.splitlines() del data break opened = 0 for line in output: l = line if l.startswith(PM_OPEN_CMD): uri = l.replace(PM_OPEN_CMD, "") try: gnome.url_show(uri) opened += 1 except Exception, e: fail_msg = "OPEN: FAILURE: " \ "%s: %s" % (uri, e) # For xsession-errors. print >> sys.stderr, fail_msg else: # Passthrough any other data. print line # Nothing more to do. sys.exit()
def show_url(url): gnome.url_show(url)
def click_website(self, dialog, link, data=None): url_show(link)
def about(self, widget=None): from gnome import url_show gtk.about_dialog_set_url_hook(lambda x, y, z: url_show(y), "") about_dialog = widgetPresenter.CustomAboutDialog() if about_dialog.run(): about_dialog.destroy()
def show_url(url): gnome.url_show(url) except:
def openUrl(widget, url, data): url_show(url)
# All rights reserved. # This file may be distributed and/or modified under the terms of # the GNU General Public License version 2 as published by # the Free Software Foundation. # This file is distributed without any warranty; without even the implied # warranty of merchantability or fitness for a particular purpose. # See "COPYING" in the source distribution for more information. # Headers in this file shall remain intact. import gtk from gnome import program_get, url_show _ = lambda x: x gtk.about_dialog_set_url_hook(lambda dialog, url, data: url_show(url), None) class MacaroonAboutDialog(gtk.AboutDialog): ''' Creates a dialog with info about the program. @cvar AUTHORS: List of authors. @type AUTHORS: list of string @cvar ARTISTS: List of artists. @type ARTISTS:list of string @cvar DOCUMENTERS: List of documenters. @type DOCUMENTERS: list of string @cvar TRANSLATORS: Translator. @type TRANSLATORS: string @cvar COMMENTS: Comments about program.
def on_website_activate(self, obj): gnome.url_show("http://notemeister.sourceforge.net")
def on_send_mail_button_clicked(self,widget,data=None): contact = self.__selected_contact() if contact is not None: gnome.url_show("mailto:%s" % contact.email)
def url(target): try: import gnome gnome.url_show(target) except: run_browser(target)
def on_link_clicked(self, document, link): import gnome full = urlparse.urljoin(document.base, link) gnome.url_show(full)
def open_url(self,dialog, url, widget): url_show(url)
# Use os.read() here (as opposed to proc.stdout.read()) # to avoid blocking. Attempt to cycle until EOF or # newline is encountered. output = [] data = "" while 1: data += os.read(proc.stdout.fileno(), 8192) if data == "" or data.endswith("\n"): output = data.splitlines() del data break opened = 0 for line in output: l = line if l.startswith(PM_OPEN_CMD): uri = l.replace(PM_OPEN_CMD, "") try: gnome.url_show(uri) opened += 1 except Exception, e: fail_msg = "OPEN: FAILURE: " \ "%s: %s" % (uri, e) # For xsession-errors. print >> sys.stderr, fail_msg else: # Passthrough any other data. print line # Nothing more to do. sys.exit()
def click_website(self, dialog, link, data = None): url_show(link)
def about(self, widget = None): from gnome import url_show gtk.about_dialog_set_url_hook(lambda x,y,z: url_show(y), "") about_dialog = widgetPresenter.CustomAboutDialog() if about_dialog.run(): about_dialog.destroy()
def on_grimoireHomepage_activate(self, *arg, **kw): gnome.url_show('http://home.gna.org/grimoire')