Skip to content
Snippets Groups Projects
Commit 9619520a authored by Thiago H. S. Picharski's avatar Thiago H. S. Picharski
Browse files

Merge remote branch 'le-edubar/master'

parents 13d18062 3f361411
No related branches found
No related tags found
No related merge requests found
Showing
with 1140 additions and 0 deletions
*.pyc
*.deb
1.1.15
#!/bin/bash
# gerar.sh
# Copyright (c) 2006 by Bruno Ribas <ribas@ufpr.br>
DIRTMP=$(mktemp -d)
VERSAO=$(cat VERSAO)
#arrumar versao
#$1 tipo de incremento
MAJOR=$(echo $VERSAO| cut -d'.' -f1)
MINOR=$(echo $VERSAO| cut -d'.' -f2)
REVISION=$(echo $VERSAO| cut -d'.' -f3)
case $1 in
Minor)
((MINOR++))
REVISION=0
;;
Major)
((MAJOR++))
MINOR=0
REVISION=0
;;
help)
echo "Uso: $0 Major|Minor|Revision"
echo ' Major - Altera versao Major'
echo ' Minor - Altera versao Minor'
exit
;;
*)
((REVISION++))
;;
esac
VERSAO="${MAJOR}.${MINOR}.${REVISION}"
echo "$VERSAO" > VERSAO
#Compila a documentacao do pacote no diretorio doc/
#cd doc/
#hevea -text *.tex
#hevea -text *.tex
#cd ../
cp -a pacote $DIRTMP
#Copia a documentacao compilada para dentro do pacote.
#cp doc/*.txt $DIRTMP/pacote/usr/share/doc/prd-*
cd $DIRTMP
find . -name ".git" -exec rm -rf {} \; &>/dev/null
sed -i -e "s/Version:/Version: $VERSAO/" pacote/DEBIAN/control
fakeroot dpkg -b pacote .
cd -
cp $DIRTMP/*deb .
rm -rf $DIRTMP
# vim:tabstop=4:shiftwidth=4:encoding=iso-8859-1
Package: le-edubar
Priority: important
Section: main
Version:
Architecture: i386
Pre-Depends: plasma-desktop
Depends: python, le-search, kdesudo, le-autoupgrade, le-installpkgs
Maintainer: LE Maintainer <le-maintainer@c3sl.ufpr.br>
Description: Desktop panel to allow access to educational contents
#!/bin/bash
# Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of le-edubar
#
# le-autoupgrade 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.
# Add edubar to widgets list
kbuildsycoca4 || true
#!/bin/bash
# Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of le-edubar
#
# le-autoupgrade 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.
# Remove edubar from widgets list
kbuildsycoca4 || true
#!/bin/bash
# Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of le-edubar
#
# le-autoupgrade 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.
# Add MEC repository to apt sources
SRCFILE=/etc/apt/sources.list.d/le-repos.list
if ! test -f $SRCFILE; then
cat <<EOF> $SRCFILE
# MEC repository, contains educational contents
deb http://repositorio.mec.gov.br mec 3.0
EOF
apt-get update
fi
exit 0
#!/bin/bash
# Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of le-edubar
#
# le-autoupgrade 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.
PACKAGESFILE="/etc/le-edubar/mecpackages.list"
if ! test -e "/etc/le-light"; then
apt-cache search '^mec-' | awk '{print $1}' > $PACKAGESFILE
fi
filter "Pacotes do MEC" {
section {
inclusive false;
sections {
};
};
status {
flags 0x1ffff;
};
pattern {
andMode 1;
patterns {
Maintainer; "MEC"; false;
Name; "mec-"; false;
};
};
priority {
};
reducedview {
enabled false;
};
};
C3SL - Centro de Computacao Cientifica e Software Livre
Adriano da Luz
Bruno Cesar Ribas
Carlos Carvalho
Cleide Luzia Bonfim Possamai
Danilo Kiyoshi Simizu Yorinori
Diego Giovane Pasqualin
Eduardo Todt
Erik Alexandre Pucci
Felipe Cys Laskoski
Guilherme Zasyeki Machado
Josiney de Souza
Juliana Bueno
Klismann Smoger Mottin
Laura Sanchez Garcia
Luis Carlos Erpen de Bona
Marcela Saragioto
Marcos Castilho
Pedro Eugenio Rocha
Renan Franca De Miranda
Ricardo Tavares De Oliveira
Rubens Massayuki Suguimoto
Thiago Henrique Dos Santos Picharski
Tiago Rodrigo Kepe
Victor Tarabola Cortiano
Vinicius Kwiecien Ruoso
This diff is collapsed.
DIR=edubar
METADATANAME=plasma-widget-edubar.desktop
all: install
install:
sudo cp -r ../$(DIR) /usr/share/kde4/apps/plasma/plasmoids/
sudo cp -r metadata.desktop /usr/share/kde4/services/$(METADATANAME)
kbuildsycoca4
distclean:
sudo rm -fr /usr/share/kde4/apps/plasma/plasmoids/$(DIR)
sudo rm -f /usr/share/kde4/services/$(METADATANAME)
kbuildsycoca4
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from PyQt4.QtCore import Qt, QString, QSizeF, SIGNAL
from PyKDE4.kdecore import KToolInvocation
from PyQt4.QtGui import QGraphicsLinearLayout
from PyKDE4.plasma import Plasma
from PyKDE4 import plasmascript
import sys, subprocess, os, pwd, grp
class Edubar(plasmascript.Applet):
def __init__(self,parent,args=None):
plasmascript.Applet.__init__(self,parent)
# FIXME: These variables below was created to change the behavior
# of hoverEnter and hoverLeave events. There would be a better way
# to do that, and this code should be reviewed in future.
self.__installIcon = None
self.__defaultHoverEnterEvent = None
self.__defaultHoverLeaveEvent = None
def createIcon(self, imagefile, size, widget=None):
obj = Plasma.IconWidget()
obj.setIcon(QString(imagefile))
obj.setMinimumSize(QSizeF(size,size))
return obj
def launchBrowser(self, link):
""" Open browser using 'link' as parameter. """
KToolInvocation.invokeBrowser(link)
def hDomain(self):
self.launchBrowser("http://www.dominiopublico.gov.br/")
def hSearch(self):
cmd = "/usr/bin/le-search"
subprocess.Popen(cmd,shell=True)
def hSchool(self):
self.launchBrowser("http://tvescola.mec.gov.br/")
def hObjects(self):
self.launchBrowser("http://objetoseducacionais2.mec.gov.br/")
def hTeacher(self):
self.launchBrowser("http://portaldoprofessor.mec.gov.br/")
def hDownload(self):
cmd = "kdesudo -d -c \"/usr/local/bin/le-installpkgs\""
subprocess.Popen(cmd,shell=True)
def imgPathFromFile(self,imgFile):
imagespath = self.applet.package().path() + "contents/imgs/"
return imagespath + imgFile
def _runCmd(self, cmd):
""" Run cmd and return a tuple (retcode, output) """
s = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, shell=True)
# FIXME: Find out why s.wait() freezes sometimes
#retcode = s.wait()
output = s.communicate()
#if retcode == 0:
# output = output[0].split("\n")
#else:
# output = output[1]
try:
output = output[0].split("\n")
except:
output = []
retcode = 0
return (retcode,output)
def getMECPackagesList(self):
""" Return all mec- packages installed on the system, or False if
some error occurred """
mecpkgsfile = "/etc/le-edubar/mecpackages.list"
if os.path.isfile(mecpkgsfile):
pkgs = open(mecpkgsfile,"r").read().split()
else:
cmd = "apt-cache search '^mec-'"
retcode, pkgs = self._runCmd(cmd)
if (retcode==0):
# Remove package description, getting only package name
pkgs = [ i.split()[0] for i in pkgs if i.startswith("mec-") ]
else:
self.logMsg("Error getting packages list using: %s" % cmd)
pkgs = False
return pkgs
def getMECPackagesInstalled(self):
""" Return the list of installed mec- packages, or False if some
error occurred """
cmd = "dpkg --get-selections"
retcode, pkgs = self._runCmd(cmd)
if (retcode==0):
# Get only installed packages
pkgs = [ i.split()[0] for i in pkgs if i.startswith("mec-") ]
else:
self.logMsg("Error while getting list of installed packages")
pkgs = False
return pkgs
def getMECPackagesDiff(self):
""" Returns the difference between existing mec- packages and those
that are installed on the system """
existing = set(self.getMECPackagesList())
installed = set(self.getMECPackagesInstalled())
return list(existing - installed)
def logMsg(self, msg):
sys.stderr.write("LOG: %s\n" % msg)
def installHoverEnterEvent(self, widget):
""" Reimplementation of icon.hoverEnterEvent """
self.__installIcon.setIcon(self.imgPathFromFile("5b.png"))
self.__defaultHoverEnterEvent(None)
def installHoverLeaveEvent(self, widget):
""" Reimplementation of icon.hoverLeaveEvent """
self.__defaultHoverLeaveEvent(None)
self.__installIcon.setIcon(self.imgPathFromFile("5.png"))
def getScreenGeometry(self):
""" Return screen geometry in QSize format"""
return self.applet.scene().screenGeometry(0)
def imAdmin(self):
""" Check if the current user is member of admin group.
return True is he is, and False otherwise """
login = pwd.getpwuid(os.geteuid()).pw_name
if login in grp.getgrnam("admin").gr_mem:
return True
else:
return False
def init(self):
self.setHasConfigurationInterface(False)
self.setAspectRatioMode(Plasma.IgnoreAspectRatio)
self.setBackgroundHints(Plasma.Applet.NoBackground)
mlayout = QGraphicsLinearLayout(Qt.Horizontal, self.applet)
mlayout.setSpacing(0)
iDict = {"domain": {"handler":self.hDomain, "img":"1.png"},
"search": {"handler":self.hSearch, "img":"0.png"},
"school": {"handler":self.hSchool, "img":"2.png"},
"teacher": {"handler":self.hTeacher, "img":"3.png"},
"objects": {"handler":self.hObjects, "img":"4.png"},
"download":{"handler":self.hDownload, "img":"5.png"},
"searchC": {"handler":self.hSearch, "img":"0c.png"}
}
pkgsInstalled = self.getMECPackagesInstalled()
pkgsAvailable = self.getMECPackagesList()
if self.imAdmin():
if False in [pkgsInstalled,pkgsAvailable]:
# Some error occurred or no package is installed
# TODO: use exception to catch this kind of error
icons = [iDict["download"]]
else:
pkgsDiff = set(pkgsAvailable) - set(pkgsInstalled)
if len(pkgsDiff) == 0:
# If all packages are already installed
icons = [iDict["search"]]
elif len(pkgsDiff) > 0:
# There are some packages not installed yet
icons = [iDict["download"],iDict["searchC"]]
else:
# TODO: if there aren't installed packages, this button shouldn't
# be shown. To do this a new version of "domain" icon, with soft
# corners, is required.
icons = [iDict["search"]]
icons += [iDict["domain"], iDict["school"], iDict["teacher"],
iDict["objects"]]
# Get the screen size and calculate the icon size
width = self.getScreenGeometry().width()
if width < 1024:
wsize = 96
else:
wsize = 128
for iDesc in icons:
icon = self.createIcon(self.imgPathFromFile(iDesc["img"]),wsize)
icon.connect(icon,SIGNAL("clicked()"),iDesc["handler"])
if iDesc["img"] == "5.png":
# FIXME: There should be a better way to do this...
self.__installIcon = icon
self.__defaultHoverEnterEvent = icon.hoverEnterEvent
self.__defaultHoverLeaveEvent = icon.hoverLeaveEvent
icon.hoverEnterEvent = self.installHoverEnterEvent
icon.hoverLeaveEvent = self.installHoverLeaveEvent
mlayout.addItem(icon)
self.applet.setLayout(mlayout)
self.resize(len(icons)*wsize,wsize)
def CreateApplet(parent):
return Edubar(parent)
le-edubar/pacote/usr/share/kde4/apps/plasma/plasmoids/edubar/contents/imgs/0.png

10.9 KiB

le-edubar/pacote/usr/share/kde4/apps/plasma/plasmoids/edubar/contents/imgs/0c.png

10.6 KiB

le-edubar/pacote/usr/share/kde4/apps/plasma/plasmoids/edubar/contents/imgs/1.png

9.81 KiB

le-edubar/pacote/usr/share/kde4/apps/plasma/plasmoids/edubar/contents/imgs/2.png

11.1 KiB

le-edubar/pacote/usr/share/kde4/apps/plasma/plasmoids/edubar/contents/imgs/3.png

9.82 KiB

le-edubar/pacote/usr/share/kde4/apps/plasma/plasmoids/edubar/contents/imgs/4.png

11.6 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment