Example #1
0
    def returnurl(self):
        try:
            page=urllib2.urlopen('http://www.pandora.com/?cmd=mini')
            format = formatter.NullFormatter()
            paramvalues = GetPandoraUrl(format)
            paramvalues.feed(page.read())
            paramvalues.close()
            urlvalues=paramvalues.get_values()
            panurl=urlvalues[0]
            return panurl
        except urllib2.URLError:
            print 'Pandora Applet: No network connection'
            self.pandurl=self.applet.settings["url"]
            return self.pandurl

    def button_press_event_cb(self, widget, event):
        if event.button == 1:
            if self.moz.get_location() == 'about:blank':
                self.moz.go_back()

if __name__ == "__main__":
    awnlib.init_start(PandoraApplet, {"name": applet_name,
        "short": "pandora",
        "version": applet_version,
        "description": applet_description,
        "theme": applet_theme_logo,
        "author": "Sharkbaitbobby",
        "copyright-year": "2008, 2009",
        "authors": ["Sharkbaitbobby <*****@*****.**>"]})
Example #2
0
    def readable_size(self, size=0, unit=1):
        ''' readable_size(size) -> string
            size is in bytes
            returns a readable version of the size given '''
        units = ['B ', 'KB', 'MB', 'GB', 'TB'] if unit == 1 \
        else ['b ', 'Kb', 'Mb', 'Gb', 'Tb']
        step = 1.0
        for u in units:
            if step > 1:
                s = '%4.2f ' % (size / step)
                if len(s) <= 5:
                    return s + u
            if size / step < 1024:
                return '%4.1d ' % (size / step) + u
            step = step * 1024.0
        return '%4.1d ' % (size / (step / 1024)) + units[-1]


if __name__ == '__main__':
    awnlib.init_start(
        AppletBandwidthMonitor, {
            'name': APPLET_NAME,
            'short': 'bandwidth-monitor',
            'version': __version__,
            'description': APPLET_DESCRIPTION,
            'logo': APPLET_ICON,
            'author': 'Kyle L. Huff',
            'copyright-year': '2010',
            'authors': APPLET_AUTHORS
        })
Example #3
0
            for sensor, label in self.__value_labels.iteritems():
                sensor.read_sensor()
                label.set_text(str(sensor.value) + ' ' + sensor.unit_str)

        def change_interval(self, timeout):
            self.__timer.change_interval(timeout)

        def dialog_shown_cb(self, dialog):
            """Start updating sensor values in main applet dialog."""
            self.__timer.start()
            # Force update
            self.update_values()

        def dialog_hidden_cb(self, dialog):
            """Stop update timer for main applet dialog."""
            self.__timer.stop()


if __name__ == "__main__":
    awnlib.init_start(SensorsApplet, {
        "name": applet_name,
        "short": short_name,
        "version": __version__,
        "description": applet_description,
        "logo": applet_logo,
        "author": "Grega Podlesek",
        "copyright-year": "2008 - 2010",
        "authors": ["Grega Podlesek <*****@*****.**>"],
        "artists": ["Grega Podlesek <*****@*****.**>",
                    "Zdravko Podlesek"]})
Example #4
0
        self.__temp_overlay.props.text = overlay_text
        self.applet.icon.set(context)
        self.update_title(values)

        del gdk_cr
        return True

    def update_title(self, values=None):
        """ update title """
        if not self.applet.tooltip.is_visible(): return
        if (values is None): values = self.values(0)

        self.applet.tooltip.set("\n".join([
            (sensor_name + (" \t % 4d" % sensor_val) + sensor_unit) for name,
            sensor_name, sensor_val, sensor_ico, sensor_unit in values
        ]))


if __name__ == "__main__":
    awnlib.init_start(
        SensorsApplet, {
            "name": applet_name,
            "short": "sensors",
            "version": __version__,
            "description": applet_description,
            "logo": applet_logo,
            "author": "zhuj",
            "copyright-year": "2011",
            "authors": ["*****@*****.**"]
        })
Example #5
0
                            forecast['DAYS'].append(day)
                        return forecast
                    except IndexError, e:
                        raise NetworkException("Couldn't parse forecast: %s" %
                                               e)


if __name__ == "__main__":
    awnlib.init_start(
        WeatherApplet, {
            "name":
            applet_name,
            "short":
            "weather",
            "description":
            applet_description,
            "version":
            __version__,
            "author":
            "onox, Mike Desjardins, Mike Rooney",
            "copyright-year":
            "2007 - 2009",
            "theme":
            applet_logo,
            "authors": [
                "Mike Desjardins", "Mike Rooney", "Isaac J.",
                "onox <*****@*****.**>"
            ],
            "artists": ["Wojciech Grzanka", "Mike Desjardins"]
        })
Example #6
0
		global debug
		if debug:
			menu.insert(gtk.SeparatorMenuItem(), 5)

			chart_item = gtk.MenuItem("Die")
			chart_item.connect("activate",self.exit)
			menu.insert(chart_item,6)

	def exit(self,widget):
		if widget:
			log("User requested exit")
		sys.exit(666)

	def show_prefs(self, widget = None, data = None):
		"""
		Displays the Preferences dialog
		"""
		
		NodeDialog_Config(self.nodeutil)
		
if __name__ == "__main__":
	awnlib.init_start(InternodeAwnApp, {"name": applet_name,
		"short": "Internode Usage Meter",
		"version": applet_version,
		"description": applet_description,
		"logo": NodeIcons.logo_path,
		"author": "Dale Maggee",
		"copyright-year": 2011,
		"authors": ["Dale Maggee", "Sam Pohlenz"]})
Example #7
0
                return '%4.1d ' % (speed / step) + u
            step = step * 1024.0
        return '%4.1d ' % (speed / (step / 1024)) + units[-1]

    def readable_size(self, size=0, unit=1):
        ''' readable_size(size) -> string
            size is in bytes
            returns a readable version of the size given '''
        units = ['B ', 'KB', 'MB', 'GB', 'TB'] if unit == 1 \
        else ['b ', 'Kb', 'Mb', 'Gb', 'Tb']
        step = 1.0
        for u in units:
            if step > 1:
                s = '%4.2f ' % (size / step)
                if len(s) <= 5:
                    return s + u
            if size / step < 1024:
                return '%4.1d ' % (size / step) + u
            step = step * 1024.0
        return '%4.1d ' % (size / (step / 1024)) + units[-1]

if __name__ == '__main__':
    awnlib.init_start(AppletBandwidthMonitor, {'name': APPLET_NAME,
        'short': 'bandwidth-monitor',
        'version': __version__,
        'description': APPLET_DESCRIPTION,
        'logo': APPLET_ICON,
        'author': 'Kyle L. Huff',
        'copyright-year': '2010',
        'authors': APPLET_AUTHORS})
Example #8
0
        os.spawnvp(os.P_WAIT, "zorin-menu-editor", ["zorin-menu-editor"])
        #ConstructMainMenu()

applet_name = "Sundara Menu"
applet_description = "Consolidated menu for Sundara OS"
applet_theme_logo = INSTALL_PREFIX + "/lib/sundaramenu/graphics/" + "logo.svg"

if __name__ == "__main__":
    awnlib.init_start(
        SundaraMenu, {
            "name":
            applet_name,
            "short":
            "Sundara Menu",
            "version":
            "1.2",
            "description":
            applet_description,
            "theme":
            applet_theme_logo,
            "author":
            "Zorin Group and Helder Fraga aka Whise",
            "copyright-year":
            "2008 - 2014",
            "authors": [
                "Artyom Zorin <*****@*****.**>",
                "Kyrill Zorin <*****@*****.**>",
                "Helder Fraga <*****@*****.**"
            ]
        }, ["settings-per-instance"])
		button_apply.connect("clicked", self.trigger_apply)

	def trigger_apply(self, widget):
		self.settings["time_format"] = self.applet.settings["time_format"] = self.entry_format.get_property("text")

		self.settings["refresh_interval"] = self.sanitize_int(self.entry_interval.get_property("text"))
		sanitize_refresh_internal()
		self.applet.settings["refresh_interval"] = self.settings["refresh_interval"]

		self.timer.change_interval(self.settings["refresh_interval"] / 1000)
		# TODO timezone

	def trigger_cancel(self, widget):
		self.settings_dialog_window.hide()

	def trigger_ok(self, widget):
		self.trigger_apply()
		self.trigger_cancel()


if __name__ == "__main__":
	awnlib.init_start(SimpleDigitalClockApplet, {
		"name": _(applet_name),
		"short": applet_name_short,
		"version": __version__,
		"description": _(applet_description),
		"theme": applet_theme_logo,
		"author": "Elouan Martinet <*****@*****.**>",
		"copyright-year": "2016",
		"authors": ["Elouan Martinet <*****@*****.**>"] + applet_additional_authors
	})
Example #10
0
        dialog.add(gtk.Label(_("Version: %s") % self.__version))

        button1 = gtk.Button(_("Search"))
        button1.connect("clicked", self.display_search)
        dialog.add(button1)

        button2 = gtk.Button(_("New Note"))
        button2.connect("clicked", self.create_note)
        dialog.add(button2)

        button3 = gtk.Button(_("New Tagged Note"))
        button3.connect("clicked", self.create_from_tag_dialog)
        dialog.add(button3)

        button4 = gtk.Button(_("View Tagged Note"))
        button4.connect("clicked", self.view_from_tag_dialog)
        dialog.add(button4)


if __name__ == "__main__":
    awnlib.init_start(TomboyApplet, {"name": applet_name, "short": "tomboy",
        "version": __version__,
        "description": applet_description,
        "theme": applet_logo,
        "author": "Julien Lavergne",
        "copyright-year": "2008 - 2009",
        "authors": ["Julien Lavergne <*****@*****.**>",
                    "onox <*****@*****.**>",
                    "Hugues Casse <*****@*****.**>"]})
Example #11
0
        for line in open(filename, "r"):
            if not line.isspace() and not line.startswith("#") and not line.startswith("none"):
                fstab.append(line.split()[1])
        fstab.sort()
        return fstab

    def toggle_mount(self, widget, mountpoint):
        def run():
            if not self.__mountpoints[mountpoint][0]:
                fp = subprocess.Popen("mount " + mountpoint, shell=True)
                execute_command = self.applet.settings["execute-command"]
                if fp.wait() == 0 and len(execute_command) > 0:
                    command = execute_command.replace("%D", mountpoint)
                    print command
                    subprocess.Popen(command, shell=True)
            else:
                subprocess.Popen("umount " + mountpoint, shell=True).wait()
            glib.idle_add(self.refresh_dialog)
        threading.Thread(target=run).start()


if __name__ == "__main__":
    awnlib.init_start(MountApplet, {"name": applet_name,
        "short": "mount",
        "version": __version__,
        "description": applet_description,
        "logo": applet_logo,
        "author": "onox",
        "copyright-year": "2009 - 2010",
        "authors": ["Arvind Ganga", "onox <*****@*****.**>"]})
Example #12
0
                    widgets[4].set_active(True)
                widgets[5].set_text(data['folder'])


if __name__ == "__main__":
    awnlib.init_start(
        MailApplet, {
            "name":
            _("Mail Applet"),
            "short":
            "mail",
            "version":
            __version__,
            "description":
            _("An applet to check one's email"),
            "logo":
            os.path.join(icon_dir, "mail-read.svg"),
            "author":
            "Pavel Panchekha",
            "copyright-year":
            "2008",
            "email":
            "*****@*****.**",
            "authors": [
                "Gabor Karsay <*****@*****.**>",
                "onox <*****@*****.**>",
                "sharkbaitbobby <*****@*****.**>",
                "Pavel Panchekha"
            ]
        })
Example #13
0
        except OSError, e:
            if e.errno == 2:
                print "Couldn't execute command '%s'" % command
            else:
                raise


if __name__ == "__main__":
    awnlib.init_start(
        QuitLogOutApplet, {
            "name":
            applet_name,
            "short":
            "mate-quit",
            "version":
            __version__,
            "description":
            applet_description,
            "theme":
            applet_logo,
            "author":
            "tarakbumba",
            "copyright-year":
            "2014",
            "authors": [
                "Randal Barlow <im.tehk at gmail.com>",
                "onox <*****@*****.**>",
                "tarakbumba <tarakbumba at tarakbumba dot com>"
            ]
        })
Example #14
0
            format = formatter.NullFormatter()
            paramvalues = GetPandoraUrl(format)
            paramvalues.feed(page.read())
            paramvalues.close()
            urlvalues = paramvalues.get_values()
            panurl = urlvalues[0]
            return panurl
        except urllib2.URLError:
            print 'Pandora Applet: No network connection'
            self.pandurl = self.applet.settings["url"]
            return self.pandurl

    def button_press_event_cb(self, widget, event):
        if event.button == 1:
            if self.moz.get_location() == 'about:blank':
                self.moz.go_back()


if __name__ == "__main__":
    awnlib.init_start(
        PandoraApplet, {
            "name": applet_name,
            "short": "pandora",
            "version": applet_version,
            "description": applet_description,
            "theme": applet_theme_logo,
            "author": "Sharkbaitbobby",
            "copyright-year": "2008, 2009",
            "authors": ["Sharkbaitbobby <*****@*****.**>"]
        })
Example #15
0
            # showing windows = not showing desktop
            showing_windows = not screen.get_showing_desktop()
            screen.toggle_showing_desktop(showing_windows)
            """ If windows were shown, they are now hidden, and next switch
            will make them visible again """
            self.applet.title.set(titles[showing_windows])


if __name__ == "__main__":
    awnlib.init_start(
        ShowDesktopApplet, {
            "name":
            applet_name,
            "short":
            "show-desktop",
            "version":
            applet_version,
            "description":
            applet_description,
            "theme":
            applet_logo,
            "author":
            "Mehdi Abaakouk, onox",
            "copyright-year":
            2006,
            "authors": [
                "Mehdi Abaakouk <*****@*****.**>",
                "onox <*****@*****.**>"
            ]
        })
Example #16
0
            clear_button.connect("clicked", clear_and_hide)
            self.action_area.add(clear_button)

    class UnableToMountErrorDialog(awnlib.Dialogs.BaseDialog,
                                   gtk.MessageDialog):
        def __init__(self, parent, volume_name, error):
            gtk.MessageDialog.__init__(self,
                                       type=gtk.MESSAGE_ERROR,
                                       message_format=_("Unable to mount %s") %
                                       volume_name,
                                       buttons=gtk.BUTTONS_OK)
            awnlib.Dialogs.BaseDialog.__init__(self, parent)

            self.set_skip_taskbar_hint(True)

            self.format_secondary_markup(str(error))


if __name__ == "__main__":
    awnlib.init_start(
        YamaApplet, {
            "name": applet_name,
            "short": "yama",
            "version": __version__,
            "description": applet_description,
            "theme": applet_logo,
            "author": "onox",
            "copyright-year": "2009 - 2010",
            "authors": ["onox <*****@*****.**>"]
        }, ["no-tooltip"])
Example #17
0
        return sum(volume_channels) / len(volume_channels) - self.__current_track.min_volume

    def get_volume(self):
        return int(round(self.get_gst_volume() * self.__volume_multiplier))

    def set_gst_volume(self, volume):
        self.__mixer.set_volume(self.__current_track, (self.__current_track.min_volume + volume, ) * self.__current_track.num_channels)

    def set_volume(self, value):
        self.set_gst_volume(int(round(value / self.__volume_multiplier)))

        # Update applet's icon
        self.__parent.refresh_icon(True)

    def increase_volume(self):
        self.set_volume(min(100, self.get_volume() + volume_step))

    def decrease_volume(self):
        self.set_volume(max(0, self.get_volume() - volume_step))


if __name__ == "__main__":
    awnlib.init_start(VolumeControlApplet, {"name": applet_name, "short": "volume-control",
        "version": __version__,
        "description": applet_description,
        "logo": applet_logo,
        "author": "onox",
        "copyright-year": "2008 - 2010",
        "authors": ["onox <*****@*****.**>"],
        "artists": ["Jakub Steiner"]})
Example #18
0
            clear_button = gtk.Button(stock=gtk.STOCK_CLEAR)
            clear_button.set_image(gtk.image_new_from_stock(gtk.STOCK_CLEAR, gtk.ICON_SIZE_MENU))
            def clear_and_hide(widget):
                self.response(gtk.RESPONSE_CANCEL)
                clear_cb()
            clear_button.connect("clicked", clear_and_hide)
            self.action_area.add(clear_button)

    class UnableToMountErrorDialog(awnlib.Dialogs.BaseDialog, gtk.MessageDialog):

        def __init__(self, parent, volume_name, error):
            gtk.MessageDialog.__init__(self, type=gtk.MESSAGE_ERROR, message_format=_("Unable to mount %s") % volume_name, buttons=gtk.BUTTONS_OK)
            awnlib.Dialogs.BaseDialog.__init__(self, parent)

            self.set_skip_taskbar_hint(True)

            self.format_secondary_markup(str(error))


if __name__ == "__main__":
    awnlib.init_start(YamaApplet, {"name": applet_name,
        "short": "mate-yama",
        "version": __version__,
        "description": applet_description,
        "theme": applet_logo,
        "author": "2009-2010: onox - 2014: tarakbumba",
        "copyright-year": "",
        "authors": ["onox <*****@*****.**>","tarakbumba <tarakbumba at tarakbumba dot com>"]},
        ["no-tooltip"])
Example #19
0
            try:
                file.launch()
            except glib.GError, e:
                if file.is_native():
                    print "Error while launching: %s" % e
                else:
                    def mount_result(gio_file2, result):
                        try:
                            if gio_file2.mount_enclosing_volume_finish(result):
                                file.launch()
                        except glib.GError, e:
                            print "Error while launching remote location: %s" % e
                    gio_file = gio.File(file.props.uri)
                    gio_file.mount_enclosing_volume(gtk.MountOperation(), mount_result)

    def file_changed_cb(self, monitor, file, other_file, event):
        if event in (gio.FILE_MONITOR_EVENT_CREATED, gio.FILE_MONITOR_EVENT_DELETED):
            self.rebuild_icons()


if __name__ == "__main__":
    awnlib.init_start(CommonFolderApplet, {"name": applet_name,
        "short": "common-folder",
        "version": __version__,
        "description": applet_description,
        "theme": applet_logo,
        "author": "onox",
        "copyright-year": "2010 - 2011",
        "authors": ["onox <*****@*****.**>"]},
        ["multiple-icons"])
Example #20
0
        watch_manager = WatchManager()
        result = watch_manager.add_watch(self.__status_file, IN_MODIFY)[self.__status_file] > 0

        if result:
            global notifier
            def notify_cb(event):
                glib.idle_add(self.check_status_cb)
            notifier = ThreadedNotifier(watch_manager, notify_cb)
            notifier.start()
        return result

    def set_error_icon(self):
        self.icon_paused.props.active = False
        self.icon_running.props.active = False
        self.icon_error.props.active = True


if __name__ == "__main__":
    awnlib.init_start(ThinkHDAPSApplet, {"name": applet_name,
        "short": "thinkhdaps",
        "version": __version__,
        "description": applet_description,
        "logo": applet_logo,
        "author": "onox",
        "copyright-year": "2008 - 2009",
        "authors": ["onox <*****@*****.**>"],
        "artists": ["Jakub Steiner", "Lapo Calamandrei", "Rodney Dawes", "Garrett LeSage", "onox"]})

    if notifier is not None:
        notifier.stop()
Example #21
0
    def get_number_of_cpus():
        file = open(proc_cpuinfo_file).read()
        return len(ProcCPUInfoBackend.__cpuinfo_pattern.findall(file))

    def get_frequencies(self):
        return [self.get_current_frequency()]

    def get_current_frequency(self):
        file = open(proc_cpuinfo_file).read()
        # Multiply by 1000 because value is in MHz and should be in KHz
        return int(float(self.__cpuinfo_pattern.findall(file)[self.__cpu_nr])) * 1000


backends = [SysFSBackend, ProcCPUInfoBackend]


if __name__ == "__main__":
    awnlib.init_start(
        CpuFreqApplet,
        {
            "name": applet_name,
            "short": "cpufreq",
            "version": __version__,
            "description": applet_description,
            "logo": applet_logo,
            "author": "onox",
            "copyright-year": "2008 - 2010",
            "authors": ["onox <*****@*****.**>"],
        },
    )
Example #22
0
        self.applet = applet

        showing_desktop = wnck.screen_get_default().get_showing_desktop()
        applet.title.set(titles[showing_desktop])

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

    def button_press_event_cb(self, widget, event):
        if event.button == 1:
            screen = wnck.screen_get_default()

            # showing windows = not showing desktop
            showing_windows = not screen.get_showing_desktop()
            screen.toggle_showing_desktop(showing_windows)

            """ If windows were shown, they are now hidden, and next switch
            will make them visible again """
            self.applet.title.set(titles[showing_windows])


if __name__ == "__main__":
    awnlib.init_start(ShowDesktopApplet, {"name": applet_name,
        "short": "show-desktop",
        "version": applet_version,
        "description": applet_description,
        "theme": applet_logo,
        "author": "Mehdi Abaakouk, onox",
        "copyright-year": 2006,
        "authors": ["Mehdi Abaakouk <*****@*****.**>",
                    "onox <*****@*****.**>"]})
Example #23
0
                        'usessl': widgets[3].get_active(), \
                        'folder': folder}

            @staticmethod
            def __fillinLoginWindow(widgets, data):
                widgets[0].set_text(data['username'])
                widgets[1].set_text(data['password'])
                widgets[2].set_text(data['url'])
                widgets[3].set_active(data['usessl'])
                if data['folder'] == "":
                    widgets[4].set_active(False)
                else:
                    widgets[4].set_active(True)
                widgets[5].set_text(data['folder'])


if __name__ == "__main__":
    awnlib.init_start(MailApplet, {
        "name": _("Mail Applet"),
        "short": "mail",
        "version": __version__,
        "description": _("An applet to check one's email"),
        "logo": os.path.join(icon_dir, "mail-read.svg"),
        "author": "Pavel Panchekha",
        "copyright-year": "2008",
        "email": "*****@*****.**",
        "authors": ["Gabor Karsay <*****@*****.**>",
                    "onox <*****@*****.**>",
                    "sharkbaitbobby <*****@*****.**>",
                    "Pavel Panchekha"]})
Example #24
0
        new_state = (show_seconds_hand, height, self.__theme.get_name(), hours, minutes)
        if not show_seconds_hand and self.__previous_state == new_state:
            return

        if self.__previous_state is None or height != self.__previous_state[1]:
            self.__base_clock = AnalogClock(self.__theme, height)

        self.__previous_state = new_state

        surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, height, height)
        context = cairo.Context(surface)

        if not show_seconds_hand:
            seconds = None
        self.__base_clock.draw_clock(context, height, hours, minutes, seconds)

        self.applet.icon.set(context)


if __name__ == "__main__":
    awnlib.init_start(CairoClockApplet, {"name": applet_name,
        "short": "cairo-clock",
        "version": __version__,
        "description": applet_description,
        "logo": applet_logo,
        "author": "onox",
        "copyright-year": "2008 - 2010",
        "authors": ["onox <*****@*****.**>"],
        "artists": ["Lapo Calamandrei", "Rodney Dawes", "Jakub Steiner", "Artists of MacSlow's Cairo-Clock"]})
Example #25
0
        self.refresh_fortune()

    def set_icon(self):
        files = [i for i in os.listdir(images_dir) if i.endswith('.svg') and i != self.iconname and i != self.previous_iconname]

        self.previous_iconname = self.iconname
        self.iconname = files[random.randint(0, len(files) - 1)]

        self.refresh_icon()

    def refresh_icon(self):
        self.applet.icon.file(os.path.join(images_dir, self.iconname), size=awnlib.Icon.APPLET_SIZE)

    def refresh_fortune(self):
        try:
            text = subprocess.Popen(command, stdout=subprocess.PIPE).communicate()[0]
        except OSError:
            text = "Error executing \"" + command + "\"; make sure it is in your path and executable."
        self.label.set_text(text.rstrip())


if __name__ == "__main__":
    awnlib.init_start(AnimalFarmApplet, {"name": applet_name,
        "short": "animal-farm",
        "version": __version__,
        "description": applet_description,
        "logo": applet_logo,
        "author": "Arvind Ganga",
        "copyright-year": 2008,
        "authors": ["Arvind Ganga", "onox <*****@*****.**>"]})
Example #26
0
#  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, see <http://www.gnu.org/licenses/>.
#

from awn.extras import awnlib, __version__

from CardapioAwnApplet import CardapioAwnApplet
from Cardapio import Cardapio


class CardapioAwnWrapper:
    def __init__(self, applet):
        cardapio_awn_applet = CardapioAwnApplet(applet)
        cardapio = Cardapio(panel_applet=cardapio_awn_applet)


if __name__ == '__main__':
    awnlib.init_start(
        CardapioAwnWrapper, {
            'name': "Cardapio's applet",
            'short': 'cardapio',
            'version': __version__,
            'description': 'Replace your menu with Cardapio',
            'theme': CardapioAwnApplet.ICON,
            'author': 'Cardapio Team',
            'copyright-year': '2010',
            'authors': ['Pawel Bara, Thiago Teixeira'],
        }, ['no-tooltip'])
Example #27
0
    def get_charge_rate(self):
        return int(self.__hal_battery.GetProperty("battery.charge_level.rate"))

    def get_capacity_percentage(self):
        return int(self.__hal_battery.GetProperty("battery.charge_level.percentage"))

    def get_warning_capacity(self):
        try:
            return int(self.__hal_battery.GetProperty("battery.charge_level.warning"))
        except dbus.DBusException:
            return int(int(self.__hal_battery.GetProperty("battery.charge_level.design")) * (warning_percentage / 100.))

    def is_on_ac_power(self):
        # TODO Should check that _all_ batteries are not discharging
        return not self.is_discharging()


backends = [UPowerBackend, HalBackend]


if __name__ == "__main__":
    awnlib.init_start(BatteryStatusApplet, {"name": applet_name,
        "short": "battery",
        "version": __version__,
        "description": applet_description,
        "theme": applet_theme_logo,
        "author": "onox, Randal Barlow",
        "copyright-year": "2008 - 2009",
        "authors": ["onox <*****@*****.**>", "Randal Barlow <im.tehk at gmail.com>"]})
Example #28
0
    def set_state(self, state):
        self.state = state
        if state == gtk.STATE_SELECTED:
            self.autohide_cookie = self.applet.inhibit_autohide("showing main menu")
            self.applet.get_icon().set_is_active(True)
        if state == gtk.STATE_NORMAL:
            self.applet.uninhibit_autohide(self.autohide_cookie)
            self.applet.get_icon().set_is_active(False)

    def show_menu_editor_cb(self, widget):
        menu_editor_apps = ("alacarte", "gmenu-simple-editor")
        for command in menu_editor_apps:
            try:
                subprocess.Popen(command)
                return
            except OSError:
                pass
        raise RuntimeError("No menu editor found (%s)" % ", ".join(menu_editor_apps))


if __name__ == "__main__":
    awnlib.init_start(MintMenuApplet, {"name": "Mint Menu",
        "short": "mintmenu",
        "version": "1.0.0",
        "description": "Mint Menu for AWN",
        "theme": "distributor-logo",
        "author": "neelance",
        "copyright-year": "2010",
        "authors": ["neelance <*****@*****.**>", "Linux Mint Team <www.linuxmint.com>"]},
        [])
Example #29
0
            self.__timer.start()
            # Force update
            self.update_values()

        def dialog_hidden_cb(self, dialog):
            """Stop update timer for main applet dialog."""
            self.__timer.stop()


if __name__ == "__main__":
    awnlib.init_start(
        SensorsApplet, {
            "name":
            applet_name,
            "short":
            short_name,
            "version":
            __version__,
            "description":
            applet_description,
            "logo":
            applet_logo,
            "author":
            "Grega Podlesek",
            "copyright-year":
            "2008 - 2010",
            "authors": ["Grega Podlesek <*****@*****.**>"],
            "artists":
            ["Grega Podlesek <*****@*****.**>", "Zdravko Podlesek"]
        })
Example #30
0
        self.previous_iconname = self.iconname
        self.iconname = files[random.randint(0, len(files) - 1)]

        self.refresh_icon()

    def refresh_icon(self):
        self.applet.icon.file(os.path.join(images_dir, self.iconname),
                              size=awnlib.Icon.APPLET_SIZE)

    def refresh_fortune(self):
        try:
            text = subprocess.Popen(command,
                                    stdout=subprocess.PIPE).communicate()[0]
        except OSError:
            text = "Error executing \"" + command + "\"; make sure it is in your path and executable."
        self.label.set_text(text.rstrip())


if __name__ == "__main__":
    awnlib.init_start(
        AnimalFarmApplet, {
            "name": applet_name,
            "short": "animal-farm",
            "version": __version__,
            "description": applet_description,
            "logo": applet_logo,
            "author": "Arvind Ganga",
            "copyright-year": 2008,
            "authors": ["Arvind Ganga", "onox <*****@*****.**>"]
        })
Example #31
0
# 
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

from awn.extras import awnlib, __version__

from CardapioAwnApplet import CardapioAwnApplet
from Cardapio import Cardapio


class CardapioAwnWrapper:
    def __init__(self, applet):
        cardapio_awn_applet = CardapioAwnApplet(applet)
        cardapio = Cardapio(panel_applet=cardapio_awn_applet)


if __name__ == '__main__':
    awnlib.init_start(CardapioAwnWrapper, {
        'name': "Cardapio's applet",
        'short': 'cardapio',
        'version': __version__,
        'description': 'Replace your menu with Cardapio',
        'theme': CardapioAwnApplet.ICON,
        'author': 'Cardapio Team',
        'copyright-year': '2010',
        'authors': ['Pawel Bara, Thiago Teixeira'],
    },
                      ['no-tooltip'])

Example #32
0
    def get_number_of_cpus():
        file = open(proc_cpuinfo_file).read()
        return len(ProcCPUInfoBackend.__cpuinfo_pattern.findall(file))

    def get_frequencies(self):
        return [self.get_current_frequency()]

    def get_current_frequency(self):
        file = open(proc_cpuinfo_file).read()
        # Multiply by 1000 because value is in MHz and should be in KHz
        return int(float(self.__cpuinfo_pattern.findall(file)[self.__cpu_nr])) * 1000


backends = [SysFSBackend, ProcCPUInfoBackend]


if __name__ == "__main__":
    awnlib.init_start(
        CpuFreqApplet, 
        {
            "name": applet_name,
            "short": "cpufreq",
            "version": __version__,
            "description": applet_description,
            "logo": applet_logo,
            "author": "onox",
            "copyright-year": "2008 - 2010",
            "authors": ["onox <*****@*****.**>"]
        }
    )
Example #33
0
        self.icon_running.props.active = False
        self.icon_error.props.active = True


if __name__ == "__main__":
    awnlib.init_start(
        ThinkHDAPSApplet, {
            "name":
            applet_name,
            "short":
            "thinkhdaps",
            "version":
            __version__,
            "description":
            applet_description,
            "logo":
            applet_logo,
            "author":
            "onox",
            "copyright-year":
            "2008 - 2009",
            "authors": ["onox <*****@*****.**>"],
            "artists": [
                "Jakub Steiner", "Lapo Calamandrei", "Rodney Dawes",
                "Garrett LeSage", "onox"
            ]
        })

    if notifier is not None:
        notifier.stop()
Example #34
0
            url = "http://xml.weather.com/weather/local/" + location_code + "?dayf=5" + self.__ws_key
            with closing(urllib2.urlopen(url)) as usock:
                with unlink_xml(usock) as xmldoc:
                    try:
                        forecast = {'DAYS': []} #, 'CITY': cachedConditions['CITY']}
                        cityNode = xmldoc.getElementsByTagName('loc')[0].getElementsByTagName('dnam')[0]
                        forecast['CITY'] = ''.join([node.data for node in cityNode.childNodes if node.nodeType == node.TEXT_NODE])

                        dayNodes = xmldoc.getElementsByTagName('dayf')[0].getElementsByTagName('day')
                        for dayNode in dayNodes:
                            names = ['HIGH', 'LOW', 'CODE', 'DESCRIPTION', 'PRECIP', 'HUMIDITY', 'WSPEED', 'WDIR', 'WGUST']
                            paths = ['hi', 'low', 'part/icon', 'part/t', 'part/ppcp', 'part/hmid', 'part/wind/s', 'part/wind/t', 'part/wind/gust']
                            day = self.dict_from_xml(dayNode, names, paths)
                            day.update({'WEEKDAY': dayNode.getAttribute('t'), 'YEARDAY': dayNode.getAttribute('dt')})
                            forecast['DAYS'].append(day)
                        return forecast
                    except IndexError, e:
                        raise NetworkException("Couldn't parse forecast: %s" % e)


if __name__ == "__main__":
    awnlib.init_start(WeatherApplet, {
        "name": applet_name, "short": "weather",
        "description": applet_description,
        "version": __version__,
        "author": "onox, Mike Desjardins, Mike Rooney",
        "copyright-year": "2007 - 2009",
        "theme": applet_logo,
        "authors": ["Mike Desjardins", "Mike Rooney", "Isaac J.", "onox <*****@*****.**>"],
        "artists": ["Wojciech Grzanka", "Mike Desjardins"]})
Example #35
0
    def is_on_ac_power(self):
        # TODO Should check that _all_ batteries are not discharging
        return not self.is_discharging()


backends = [UPowerBackend, HalBackend]

if __name__ == "__main__":
    awnlib.init_start(
        BatteryStatusApplet, {
            "name":
            applet_name,
            "short":
            "battery",
            "version":
            __version__,
            "description":
            applet_description,
            "theme":
            applet_theme_logo,
            "author":
            "onox, Randal Barlow",
            "copyright-year":
            "2008 - 2009",
            "authors": [
                "onox <*****@*****.**>",
                "Randal Barlow <im.tehk at gmail.com>"
            ]
        })
Example #36
0
    def mate_log_out(self):
        self.sm_if.Logout(0)

    def mate_shut_down(self):
        self.sm_if.Shutdown()

    def other_lock_screen(self):
        self.execute_command(self.applet.settings["lock-screen-command"])

    def other_log_out(self):
        self.execute_command(self.applet.settings["log-out-command"])

    def execute_command(self, command):
        try:
            subprocess.Popen(command)
        except OSError, e:
            if e.errno == 2:
                print "Couldn't execute command '%s'" % command
            else:
                raise


if __name__ == "__main__":
    awnlib.init_start(QuitLogOutApplet, {"name": applet_name, "short": "mate-quit",
        "version": __version__,
        "description": applet_description,
        "theme": applet_logo,
        "author": "tarakbumba",
        "copyright-year": "2014",
        "authors": ["Randal Barlow <im.tehk at gmail.com>", "onox <*****@*****.**>", "tarakbumba <tarakbumba at tarakbumba dot com>"]})
Example #37
0
        button3.connect("clicked", self.create_from_tag_dialog)
        dialog.add(button3)

        button4 = gtk.Button(_("View Tagged Note"))
        button4.connect("clicked", self.view_from_tag_dialog)
        dialog.add(button4)


if __name__ == "__main__":
    awnlib.init_start(
        TomboyApplet, {
            "name":
            applet_name,
            "short":
            "tomboy",
            "version":
            __version__,
            "description":
            applet_description,
            "theme":
            applet_logo,
            "author":
            "Julien Lavergne",
            "copyright-year":
            "2008 - 2009",
            "authors": [
                "Julien Lavergne <*****@*****.**>",
                "onox <*****@*****.**>", "Hugues Casse <*****@*****.**>"
            ]
        })
Example #38
0
		

	def properties(self,event=0,data=None):
		#os.spawnvp(os.P_WAIT,Globals.ProgramDirectory+"Tilo-Settings.py",[Globals.ProgramDirectory+"Tilo-Settings.py"])
		os.system("/bin/sh -c '"+self.Globals.ProgramDirectory+"Tilo-Settings.py' &")
		# Fixme, reload stuff properly
		self.Globals.ReloadSettings()
		
	def about_info(self,event=0,data=None):
		os.system("/bin/sh -c " + INSTALL_PREFIX +"'/lib/"+self.Globals.appdirname+"/Tilo-Settings.py --about' &")

	def edit_menus(self,event=0, data=None):
		os.spawnvp(os.P_WAIT,"mozo",["mozo"])
		#ConstructMainMenu()

applet_name = "Tilo"
applet_description = "Consolidated menu for Mate"
applet_theme_logo = INSTALL_PREFIX + "/lib/tilo/graphics/" + "logo.png"

if __name__ == "__main__":
    awnlib.init_start(Tilo, {"name": applet_name,
        "short": "Tilo",
        "version": __version__,
        "description": applet_description,
        "theme": applet_theme_logo,
        "author": "Helder Fraga aka Whise",
        "copyright-year": "2008 - 2009",
        "authors": ["Helder Fraga <*****@*****.**"]},
        ["settings-per-instance"])

Example #39
0
            self.autohide_cookie = self.applet.inhibit_autohide("showing main menu")
            self.applet.get_icon().set_is_active(True)
        if state == gtk.STATE_NORMAL:
            self.applet.uninhibit_autohide(self.autohide_cookie)
            self.applet.get_icon().set_is_active(False)

    def show_menu_editor_cb(self, widget):
        menu_editor_apps = ("mozo")
        for command in menu_editor_apps:
            try:
                subprocess.Popen(command)
                return
            except OSError:
                pass
        raise RuntimeError("No menu editor found (%s)" % ", ".join(menu_editor_apps))


if __name__ == "__main__":
    awnlib.init_start(MintMenuApplet, {"name": "Mint Menu",
        "short": "mintmenu",
        "version": "1.0.0",
        "description": "Mint Menu for AWN",
        "theme": "distributor-logo",
        "author": "neelance",
        "copyright-year": "2010",
        "author": "tarakbumba",
        "copyright-year": "2014",
        "authors": ["neelance <*****@*****.**>", "Linux Mint Team <www.linuxmint.com>"],
        "authors": ["tarakbumba <tarakbumba at tarakbumba dot com>"]},
        [])
Example #40
0
            clear_button = gtk.Button(stock=gtk.STOCK_CLEAR)
            clear_button.set_image(gtk.image_new_from_stock(gtk.STOCK_CLEAR, gtk.ICON_SIZE_MENU))
            def clear_and_hide(widget):
                self.response(gtk.RESPONSE_CANCEL)
                clear_cb()
            clear_button.connect("clicked", clear_and_hide)
            self.action_area.add(clear_button)

    class UnableToMountErrorDialog(awnlib.Dialogs.BaseDialog, gtk.MessageDialog):

        def __init__(self, parent, volume_name, error):
            gtk.MessageDialog.__init__(self, type=gtk.MESSAGE_ERROR, message_format=_("Unable to mount %s") % volume_name, buttons=gtk.BUTTONS_OK)
            awnlib.Dialogs.BaseDialog.__init__(self, parent)

            self.set_skip_taskbar_hint(True)

            self.format_secondary_markup(str(error))


if __name__ == "__main__":
    awnlib.init_start(YamaApplet, {"name": applet_name,
        "short": "yama",
        "version": __version__,
        "description": applet_description,
        "theme": applet_logo,
        "author": "onox",
        "copyright-year": "2009 - 2010",
        "authors": ["onox <*****@*****.**>"]},
        ["no-tooltip"])
Example #41
0
        self.__mixer.set_volume(self.__current_track,
                                (self.__current_track.min_volume + volume, ) *
                                self.__current_track.num_channels)

    def set_volume(self, value):
        self.set_gst_volume(int(round(value / self.__volume_multiplier)))

        # Update applet's icon
        self.__parent.refresh_icon(True)

    def increase_volume(self):
        self.set_volume(min(100, self.get_volume() + volume_step))

    def decrease_volume(self):
        self.set_volume(max(0, self.get_volume() - volume_step))


if __name__ == "__main__":
    awnlib.init_start(
        VolumeControlApplet, {
            "name": applet_name,
            "short": "volume-control",
            "version": __version__,
            "description": applet_description,
            "logo": applet_logo,
            "author": "onox",
            "copyright-year": "2008 - 2010",
            "authors": ["onox <*****@*****.**>"],
            "artists": ["Jakub Steiner"]
        })