Пример #1
0
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
Пример #2
0
	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)
Пример #3
0
 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)
Пример #4
0
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 _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()
Пример #6
0
 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)
Пример #7
0
	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)
Пример #8
0
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
Пример #9
0
    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)
Пример #10
0
    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()
Пример #12
0
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
Пример #13
0
            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 ()
Пример #14
0
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
Пример #15
0
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 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
Пример #17
0
	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']
Пример #18
0
    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()
Пример #19
0
	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()
Пример #20
0
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.')
Пример #21
0
# -*- 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.
Пример #22
0
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)
Пример #23
0
  def load_url(url): gnome.url_show(url)
except:
Пример #24
0
 def on_contents_activate(self, w):
     """Show the man page."""
     gnome.url_show("man:%s.1" % Const.NAME)
Пример #25
0
                        # 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()
Пример #26
0
def show_url(url):
    gnome.url_show(url)
Пример #27
0
 def click_website(self, dialog, link, data=None):
     url_show(link)
Пример #28
0
 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()
Пример #29
0
	def show_url(url): gnome.url_show(url)
except:
Пример #30
0
def openUrl(widget, url, data):
    url_show(url)
Пример #31
0
# 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.
Пример #32
0
 def on_website_activate(self, obj):
     gnome.url_show("http://notemeister.sourceforge.net")
Пример #33
0
def openUrl(widget, url, data):
    url_show(url)
Пример #34
0
 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)
Пример #35
0
def url(target):
    try:
        import gnome
        gnome.url_show(target)
    except:
        run_browser(target)
Пример #36
0
 def on_link_clicked(self, document, link):
     import gnome
     full = urlparse.urljoin(document.base, link)
     gnome.url_show(full)
Пример #37
0
# 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.
Пример #38
0
def url(target):
    try:
        import gnome
        gnome.url_show(target)
    except:
        run_browser(target)
Пример #39
0
	def open_url(self,dialog, url, widget):
		url_show(url)
Пример #40
0
            # 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()
Пример #41
0
 def click_website(self, dialog, link, data = None):
   url_show(link)
Пример #42
0
 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()
Пример #43
0
 def on_grimoireHomepage_activate(self, *arg, **kw):
     gnome.url_show('http://home.gna.org/grimoire')