Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 29588 | Differences between
and this patch

Collapse All | Expand All

(-)/var/tmp/portage/desklet-rssgrab-0.4/image/usr/share/gdesklets/Sensors/rssgrab/__init__.py (-14 / +36 lines)
Lines 33-38 Link Here
33
33
34
        # initial default values
34
        # initial default values
35
        self.__maintitle = "Connecting\n(updated @ 00:00)"
35
        self.__maintitle = "Connecting\n(updated @ 00:00)"
36
        self.__mainlink = ""
36
        self.__lutime = "00:00"
37
        self.__lutime = "00:00"
37
38
38
        # create vars
39
        # create vars
Lines 45-59 Link Here
45
            self.__wrapper.initial_indent = "[$] "
46
            self.__wrapper.initial_indent = "[$] "
46
47
47
        # Default values for config
48
        # Default values for config
48
        self._set_config_type("url", TYPE_STRING, "http://www.slashdot.org/index.rss")
49
        self._set_config_type("url", TYPE_STRING, "http://packages.gentoo.org/gentoo_simple.rss")
49
        self._set_config_type("browser", TYPE_STRING, "mozilla")
50
        self._set_config_type("image", TYPE_STRING, "http://www.gentoo.org/images/powered-by-gentoo2.jpg")
50
        self._set_config_type("update", TYPE_INT, 30)
51
        self._set_config_type("browser", TYPE_STRING, "epiphany")
52
        self._set_config_type("update", TYPE_INT, 60)
51
        self._set_config_type("wrapwidth", TYPE_INT, 34)
53
        self._set_config_type("wrapwidth", TYPE_INT, 34)
52
        self._set_config_type("font", TYPE_STRING, "Arial 12")
54
        self._set_config_type("font", TYPE_STRING, "Sans 8")
53
        self._set_config_type("fontcolor", TYPE_STRING, "#00FF00")
55
        self._set_config_type("fontcolor", TYPE_STRING, "#3D2D6D")
54
        self._set_config_type("titlefont", TYPE_STRING, "Arial 14")
56
        self._set_config_type("titlefont", TYPE_STRING, "Sans Bold 10")
55
        self._set_config_type("titlefontcolor", TYPE_STRING, "#FFFF00")
57
        self._set_config_type("titlefontcolor", TYPE_STRING, "#F0EDFF")
56
        self._set_config_type("highlightfont", TYPE_STRING, "Arial 14")
58
        self._set_config_type("highlightfont", TYPE_STRING, "Sans 8")
57
        self._set_config_type("highlightfontcolor", TYPE_STRING, "#FFFFFF")
59
        self._set_config_type("highlightfontcolor", TYPE_STRING, "#FFFFFF")
58
60
59
        # go grab the feed
61
        # go grab the feed
Lines 76-84 Link Here
76
78
77
            # Get the channel name
79
            # Get the channel name
78
            if rssdata['channel'].has_key('title'):
80
            if rssdata['channel'].has_key('title'):
79
                self.__maintitle="%s\n(updated @ %s)" % (rssdata['channel']['title'], time.strftime("%H:%M"))
81
                self.__maintitle="%s @ %s" % (rssdata['channel']['title'], time.strftime("%H:%M"))
80
            else:
82
            else:
81
                self.__maintitle="Title not found\n(updated @ %s)" % time.strftime("%H:%M")
83
                self.__maintitle="Title not found\n(updated @ %s)" % time.strftime("%H:%M")
84
            if rssdata['channel'].has_key('link'):
85
                self.__mainlink=rssdata['channel']['link']
86
            else:
87
                self.__mainlink=""
82
88
83
            # Clear the arrays
89
            # Clear the arrays
84
            self.__titles [0:] = []
90
            self.__titles [0:] = []
Lines 116-121 Link Here
116
        output = self._new_output()
122
        output = self._new_output()
117
        output.set("name", self.__maintitle)
123
        output.set("name", self.__maintitle)
124
        output.set("image", self._get_config("image"))
118
        output.set("namefont", self._get_config("titlefont"))
125
        output.set("namefont", self._get_config("titlefont"))
119
        output.set("namecolor", self._get_config("titlefontcolor"))
126
        output.set("namecolor", self._get_config("titlefontcolor"))
120
127
Lines 135-142 Link Here
135
    # override this ethod to enable user interaction
142
    # override this ethod to enable user interaction
136
    def call_action(self, action, path, args = []):
143
    def call_action(self, action, path, args = []):
137
144
138
        index = int(path[-1])
145
        if (action == "mainlaunch"):
139
        if (action == "launch"):
146
            try:
147
                # open the link in specified browser
148
                browser = self._get_config("browser");
149
                url = self.__mainlink
150
151
                if (url != ""):
152
                    os.system("%s %s" % (browser,url))
153
154
            except:
155
                  print "could not open", url
156
157
        elif (action == "launch"):
158
            index = int(path[-1])
140
            try:
159
            try:
141
                # open the link in specified browser
160
                # open the link in specified browser
142
                browser = self._get_config("browser");
161
                browser = self._get_config("browser");
Lines 148-156 Link Here
148
                threading.Thread(target=os.system, args=("%s %s" % (browser,nurl),)).start()
167
                threading.Thread(target=os.system, args=("%s %s" % (browser,nurl),)).start()
149
168
150
            except:
169
            except:
151
                  print "could not open", uri
170
                  print "could not open", url
152
171
153
        elif (action == "leave"):
172
        elif (action == "leave"):
173
            index = int(path[-1])
154
            output = self._new_output()
174
            output = self._new_output()
155
            output.set("item_value[%(index)d]" % vars(), self.__titles[index])
175
            output.set("item_value[%(index)d]" % vars(), self.__titles[index])
156
            output.set("font[%(index)d]" % vars(), self._get_config("font"))
176
            output.set("font[%(index)d]" % vars(), self._get_config("font"))
Lines 158-163 Link Here
158
            self._send_output(output)
178
            self._send_output(output)
159
179
160
        elif (action == "enter"):
180
        elif (action == "enter"):
181
            index = int(path[-1])
161
            output = self._new_output()
182
            output = self._new_output()
162
            output.set("item_value[%(index)d]" % vars(), self.__titles[index])
183
            output.set("item_value[%(index)d]" % vars(), self.__titles[index])
163
            output.set("font[%(index)d]" % vars(), self._get_config("highlightfont"))
184
            output.set("font[%(index)d]" % vars(), self._get_config("highlightfont"))
Lines 171-180 Link Here
171
        conf1.set_name(_("Rss Settings"))
192
        conf1.set_name(_("Rss Settings"))
172
        conf1.add_title(_("Rss Source URL"))
193
        conf1.add_title(_("Rss Source URL"))
173
        conf1.add_entry(_("URL",), "url", _("The url of the rss feed"))
194
        conf1.add_entry(_("URL",), "url", _("The url of the rss feed"))
195
        conf1.add_entry(_("Image",), "image", _("The logo for the rss feed"))
174
        conf1.add_title(_("Interval between Rss updates (minutes)"))
196
        conf1.add_title(_("Interval between Rss updates (minutes)"))
175
        conf1.add_spin(_("Interval",), "update", _("The interval between updates (minutes)"),1,60)
197
        conf1.add_spin(_("Interval",), "update", _("The interval between updates (minutes)"),20,120)
176
        conf1.add_title(_("Max Headline Width (Python 2.3+ only)"))
198
        conf1.add_title(_("Max Headline Width (Python 2.3+ only)"))
177
        conf1.add_spin(_("Width",), "wrapwidth", _("The max number of columns before wrapping"),1,500)
199
        conf1.add_spin(_("Width",), "wrapwidth", _("The max number of columns before wrapping"),1,200)
178
        conf1.add_title(_("Preferred Browser"))
200
        conf1.add_title(_("Preferred Browser"))
179
        conf1.add_entry(_("Browser",), "browser", _("The browser to use to view headlines clicked on"))
201
        conf1.add_entry(_("Browser",), "browser", _("The browser to use to view headlines clicked on"))
180
        conf1.add_title(_("Fonts"))
202
        conf1.add_title(_("Fonts"))

Return to bug 29588