示例#1
0
    def __init__(self, download):
        self.download = download

        self.__get_widgets()
        self.__connect_widgets()

        if download.pixbuf:
            pixbuf = gui.load_icon_from_mime_type(download.mime_type, 48)
            self.image.set_from_pixbuf(pixbuf)
        else:
            self.image.set_from_icon_name(NAME.lower(), gtk.ICON_SIZE_DIALOG)

        self.uri_label.set_text(download.uri)
        self.name_label.set_text(download.file_name)
        self.folder_label.set_text(download.path)
        self.current_size_label.set_text("%s (%s bytes)" % \
                (utils.get_readable_size(download.current_size),
                    download.current_size))
        self.total_size_label.set_text("%s (%s bytes)" % \
            (utils.get_readable_size(download.total_size),
                download.total_size))
        self.mime_type_label.set_text(download.mime_type)
        self.date_started_label.set_text(download.get_date_str("started"))
        self.date_completed_label.set_text(download.get_date_str("completed"))

        download.connect("update", self.__download_update)
        download.connect("status-changed", self.__download_status_changed)

        self.dialog.show()
示例#2
0
    def __init(self, *args):
        self.main_window = args[0]

        self.icon = gtk.status_icon_new_from_icon_name(NAME.lower())

        self.__build_context_menu()

        self.__connect_widgets()
示例#3
0
    def __get_widgets(self):
        xml = gtk.glade.XML(gui.glade_file, domain=NAME.lower())

        self.dialog = xml.get_widget("quit_dialog")

        self.show_again_checkbutton = xml.get_widget("show_quit_dialog_checkbutton")

        self.no_button = xml.get_widget("quit_no_button")
        self.yes_button = xml.get_widget("quit_yes_button")
示例#4
0
    def __get_widgets(self):
        xml = gtk.glade.XML(gui.glade_file, domain=NAME.lower())

        self.dialog = xml.get_widget("add_dialog")

        self.uri_entry = xml.get_widget("uri_entry")
        self.download_filechooserbutton = xml.get_widget("download_filechooserbutton")

        self.add_button = xml.get_widget("add_add_button")
        self.cancel_button = xml.get_widget("add_cancel_button")
示例#5
0
    def __get_widgets(self):
        xml = gtk.glade.XML(gui.glade_file, domain=NAME.lower())

        self.dialog = xml.get_widget("details_dialog")

        self.image = xml.get_widget("details_image")

        self.uri_label = xml.get_widget("uri_label")
        self.name_label = xml.get_widget("name_label")
        self.folder_label = xml.get_widget("folder_label")
        self.current_size_label = xml.get_widget("current_size_label")
        self.total_size_label = xml.get_widget("total_size_label")
        self.mime_type_label = xml.get_widget("mime_type_label")
        self.date_started_label = xml.get_widget("date_started_label")
        self.date_completed_label = xml.get_widget("date_completed_label")

        self.close_button = xml.get_widget("details_close_button")
示例#6
0
    def __init__(self):
        gtk.AboutDialog.__init__(self)
        gtk.about_dialog_set_email_hook(self.__url_hook, "mailto:")
        gtk.about_dialog_set_url_hook(self.__url_hook, "")

        self.set_logo_icon_name(NAME.lower())
        self.set_name(NAME)
        self.set_version(VERSION)
        self.set_copyright("Copyright (C) 2008 Johan Svedberg, 2013-2014 Neil McNab")
        #self.set_website("http://live.gnome.org/GGet")
        self.set_website("http://sourceforge.net/projects/metalinks/")
        self.set_comments(_("GGet is a Download Manager for the GNOME desktop."))
        self.set_authors(["Johan Svedberg <*****@*****.**>", "Neil McNab <*****@*****.**>"])
        self.set_translator_credits(_("translator-credits"))
        self.set_license("GNU General Public License version 2")
        # self.set_artists([""])

        self.connect("response", lambda self, *args: self.destroy())
示例#7
0
    def __init(self, *args):
        self.main_window = args[0]
        self.config = config.Configuration()

        self.icon = egg.trayicon.TrayIcon(NAME)

        self.eb = gtk.EventBox()
        self.eb.set_visible_window(False)
        self.eb.set_events(gtk.gdk.POINTER_MOTION_MASK)

        self.image = gtk.Image()
        self.image.set_from_icon_name(NAME.lower(), gtk.ICON_SIZE_BUTTON)
        self.eb.add(self.image)
        self.icon.add(self.eb)

        self.__build_context_menu()

        self.__connect_widgets()

        self.icon.show_all()
示例#8
0
    def __get_widgets(self):
        """Get widgets from the glade file."""
        xml = gtk.glade.XML(gui.glade_file, domain=NAME.lower())

        self.window = xml.get_widget("main_window")

        # File menu
        self.add_menu_item = xml.get_widget("add_menu_item")
        self.quit_menu_item = xml.get_widget("quit_menu_item")

        # Edit menu
        self.select_all_menu_item = xml.get_widget("select_all_menu_item")
        self.unselect_all_menu_item = xml.get_widget("unselect_all_menu_item")
        self.preferences_menu_item = xml.get_widget("preferences_menu_item")

        # Show menu
        self.show_toolbar_menu_item = xml.get_widget("show_toolbar_menu_item")
        # self.show_statusbar_menu_item = xml.get_widget("show_statusbar_menu_item")
        self.show_status_menu_item = xml.get_widget("show_status_menu_item")
        self.show_current_size_menu_item = xml.get_widget("show_current_size_menu_item")
        self.show_total_size_menu_item = xml.get_widget("show_total_size_menu_item")
        self.show_progress_menu_item = xml.get_widget("show_progress_menu_item")
        self.show_speed_menu_item = xml.get_widget("show_speed_menu_item")
        self.show_eta_menu_item = xml.get_widget("show_eta_menu_item")

        # Help menu
        self.about_menu_item = xml.get_widget("about_menu_item")

        # Toolbar
        self.toolbar = xml.get_widget("toolbar")

        self.add_tool_button = xml.get_widget("add_tool_button")
        self.pause_tool_button = xml.get_widget("pause_tool_button")
        self.resume_tool_button = xml.get_widget("resume_tool_button")
        self.cancel_tool_button = xml.get_widget("cancel_tool_button")
        self.remove_tool_button = xml.get_widget("remove_tool_button")
        self.clear_tool_button = xml.get_widget("clear_tool_button")
        self.details_tool_button = xml.get_widget("details_tool_button")

        self.downloads_treeview = xml.get_widget("downloads_treeview")
示例#9
0
    def __get_widgets(self):
        """Get widgets from the glade file."""
        xml = gtk.glade.XML(gui.glade_file, domain=NAME.lower())

        self.dialog = xml.get_widget("preferences_dialog")

        # General tab
        self.status_icon_checkbutton = xml.get_widget("status_icon_checkbutton")
        self.main_window_checkbutton = xml.get_widget("main_window_checkbutton")
        self.notifications_checkbutton = xml.get_widget("notifications_checkbutton")
        self.quit_dialog_checkbutton = xml.get_widget("quit_dialog_checkbutton")

        self.autostart_checkbutton = xml.get_widget("autostart_checkbutton")

        # Folders tab
        self.ask_folder_radiobutton = xml.get_widget("ask_folder_radiobutton")
        self.specify_folder_radiobutton = xml.get_widget("specify_folder_radiobutton")
        self.default_folder_filechooserbutton = xml.get_widget("default_folder_filechooserbutton")
        self.extensions_checkbutton = xml.get_widget("extensions_checkbutton")
        self.extensions_alignment = xml.get_widget("extensions_alignment")
        self.extensions_treeview = xml.get_widget("extensions_treeview")
        self.add_extension_button = xml.get_widget("add_extension_button")
        self.remove_extension_button = xml.get_widget("remove_extension_button")

        # Network tab
        self.direct_radiobutton = xml.get_widget("direct_radiobutton")
        self.gnome_radiobutton = xml.get_widget("gnome_radiobutton")
        self.manual_radiobutton = xml.get_widget("manual_radiobutton")
        self.manual_proxy_vbox = xml.get_widget("manual_proxy_vbox")
        self.proxy_entry = xml.get_widget("proxy_entry")
        self.proxy_port_spinbutton = xml.get_widget("proxy_port_spinbutton")
        self.proxy_auth_checkbutton = xml.get_widget("proxy_auth_checkbutton")
        self.proxy_auth_hbox = xml.get_widget("proxy_auth_hbox")
        self.proxy_user_entry = xml.get_widget("proxy_user_entry")
        self.proxy_password_entry = xml.get_widget("proxy_password_entry")

        # Buttons
        self.close_button = xml.get_widget("close_button")
示例#10
0
    def __init__(self, download):
        self.download = download

        self.config = config.Configuration()
        self.status_icon = TrayIcon()

        pynotify.init(NAME)

        self.notification = pynotify.Notification(_("Download Completed"),
                _("%s has been downloaded successfully.") %
                self.download.file_name)

        if self.download.pixbuf:
            self.notification.set_icon_from_pixbuf(self.download.pixbuf)
        else:
            pixbuf = gui.load_icon(NAME.lower(), 32, 32)
            self.notification.set_icon_from_pixbuf(pixbuf)

        # Position notification at status icon if its shown
        if self.config.show_status_icon:
            # self.notification.attach_to_status_icon(self.status_icon.icon)
            (x, y) = self.__get_position()
            self.notification.set_hint_int32("x", x)
            self.notification.set_hint_int32("y", y)


        self.notification.set_timeout(TIMEOUT) # One minute

        if not download.is_metalink:
            self.notification.add_action("file", _("Open"),
                                         self.__action_invoked)
        self.notification.add_action("folder", _("Open folder"),
                                     self.__action_invoked)
        self.notification.connect("closed", self.__closed)

        if not self.notification.show():
            print "Failed to show notification."
示例#11
0
    def __init__(self, download):
        self.download = download

        self.config = config.Configuration()
        self.status_icon = TrayIcon()

        pynotify.init(NAME)

        self.notification = pynotify.Notification(
            _("Download Completed"),
            _("%s has been downloaded successfully.") %
            self.download.file_name)

        if self.download.pixbuf:
            self.notification.set_icon_from_pixbuf(self.download.pixbuf)
        else:
            pixbuf = gui.load_icon(NAME.lower(), 32, 32)
            self.notification.set_icon_from_pixbuf(pixbuf)

        # Position notification at status icon if its shown
        if self.config.show_status_icon:
            # self.notification.attach_to_status_icon(self.status_icon.icon)
            (x, y) = self.__get_position()
            self.notification.set_hint_int32("x", x)
            self.notification.set_hint_int32("y", y)

        self.notification.set_timeout(TIMEOUT)  # One minute

        if not download.is_metalink:
            self.notification.add_action("file", _("Open"),
                                         self.__action_invoked)
        self.notification.add_action("folder", _("Open folder"),
                                     self.__action_invoked)
        self.notification.connect("closed", self.__closed)

        if not self.notification.show():
            print "Failed to show notification."
示例#12
0
 def __init_i18n(self):
     gettext.bindtextdomain(NAME.lower(), LOCALE_DIR)
     gettext.textdomain(NAME.lower())
示例#13
0
 def __init_i18n(self):
     gettext.bindtextdomain(NAME.lower(), LOCALE_DIR)
     gettext.textdomain(NAME.lower())
示例#14
0
def get_icon_list(sizes):
    icon_list = []
    for size in sizes:
        icon_list.append(load_icon(NAME.lower(), size, size))
    return icon_list
示例#15
0
# along with GGet; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA

import os.path
from gettext import gettext as _

import gtk
import gtk.gdk
import gtk.glade
import gnomevfs
import gnome.ui

import utils
from gget import NAME, LOCALE_DIR

gtk.glade.bindtextdomain(NAME.lower(), LOCALE_DIR)

glade_file = os.path.join(utils.get_data_dir(), "gget.glade")

icon_theme = gtk.icon_theme_get_default()

def get_icon_list(sizes):
    icon_list = []
    for size in sizes:
        icon_list.append(load_icon(NAME.lower(), size, size))
    return icon_list

def load_icon(icon, width=48, height=48):
    pixbuf = None
    if icon != None and icon != "":
        try: