コード例 #1
0
ファイル: applet.py プロジェクト: GNOME/ontv
    def __init(self, *args):
        self.applet     = args[0]
        configure       = args[1]
        debug           = args[2]

        self.ontv_core = OnTVCore(configure, debug, self.cb_status)

        self.applet.set_applet_flags(gnomeapplet.EXPAND_MINOR)

        ui_file = os.path.join(UI_DIR, "GNOME_OnTVApplet.xml")
        verb_list = [("Update TV listings", self.__update_listings),
                     ("Preferences", self.__show_pd),
                     ("Search Program", self.__show_sd),
                     ("About", self.__run_ad)]
        self.applet.setup_menu_from_file(None, ui_file, NAME, verb_list)

        self.applet.connect("button-press-event", self.__button_press)

        self.image = gtk.Image()
        size = self.applet.get_size()
        pixbuf = gui.load_icon("ontv", size, size)
        if pixbuf.get_width() != size or pixbuf.get_height() != size:
            pixbuf = pixbuf.scale_simple(size-4, size-4,
                                         gtk.gdk.INTERP_BILINEAR)
        self.image.set_from_pixbuf(pixbuf)

        self.applet.add(self.image)

        self.applet.connect("change-size", self.__change_size)
        self.applet.connect("change-background", self.__change_background)

        self.applet.show_all()
コード例 #2
0
ファイル: notify.py プロジェクト: bneijt/metalinks
    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."
コード例 #3
0
ファイル: notify.py プロジェクト: metalink-dev/metalinks
    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."
コード例 #4
0
ファイル: assistant.py プロジェクト: GNOME/ontv
 def __add_page(self, page, title, type):
     self.append_page(page)
     self.set_page_header_image(page, gui.load_icon("ontv"))
     self.set_page_title(page, title)
     self.set_page_type(page, type)
コード例 #5
0
ファイル: applet.py プロジェクト: GNOME/ontv
 def __change_size(self, widget, size):
     pixbuf = gui.load_icon("ontv", size, size)
     if pixbuf.get_width() != size or pixbuf.get_height() != size:
         pixbuf = pixbuf.scale_simple(size-4, size-4,
                                      gtk.gdk.INTERP_BILINEAR)
     self.image.set_from_pixbuf(pixbuf)