Commit c4877bb5 authored by Thiago H. S. Picharski's avatar Thiago H. S. Picharski

Merge remote branch 'ubiquity-frontend-kde-le/master'

Signed-off-by: 's avatarThiago H. S. Picharski <thsp08@c3sl.ufpr.br>
parents bd0d59d5 6f3f288e
#!/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 -r pacote $DIRTMP
#Copia a documentacao compilada para dentro do pacote.
#cp doc/*.txt $DIRTMP/pacote/usr/share/doc/prd-*
cd $DIRTMP
find . -name ".svn" -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: ubiquity-frontend-kde-le
Source: ubiquity-le
Version:
Architecture: all
Maintainer: LE Maintainer <le-maintainer@c3sl.ufpr.br>
Installed-Size: 632
Depends: python-central (>= 0.6.11), ubiquity-le, python-kde4, kde-window-manager, xauth
Conflicts: ubiquity-frontend-kde
Section: admin
Priority: optional
Description: KDE frontend for Ubiquity live installer.
This is a costumized version of ubiquity-frontend-kde from the Ubuntu,
designed to install the Linux Educacional (LE).
Bugs: http://bugzilla.c3sl.ufpr.br/
Python-Version: current, >= 2.6
#!/bin/sh
set -e
# Automatically added by dh_pycentral
rm -f /var/lib/pycentral/ubiquity-frontend-kde-le.pkgremove
if which pycentral >/dev/null 2>&1; then
pycentral pkginstall ubiquity-frontend-kde-le
if grep -qs '^ubiquity-frontend-kde-le$' /var/lib/pycentral/delayed-pkgs; then
sed -i '/^ubiquity-frontend-kde-le$/d' /var/lib/pycentral/delayed-pkgs
fi
fi
# End automatically added section
#!/bin/sh
set -e
# Automatically added by dh_pycentral
case "$1" in
install|upgrade)
mkdir -p /var/lib/pycentral
echo '# the presence of this file allows calling pkgremove on upgrade' \
> /var/lib/pycentral/ubiquity-frontend-kde-le.pkgremove
esac
# End automatically added section
#!/bin/sh
set -e
# Automatically added by dh_pycentral
case "$1" in remove|upgrade)
pkgremove=y
esac
if [ -f /var/lib/pycentral/ubiquity-frontend-kde-le.pkgremove ] || [ -f /var/lib/pycentral/pkgremove ]; then
pkgremove=y
fi
if [ "$pkgremove" = y ]; then
if which python >/dev/null 2>&1 && which pycentral >/dev/null 2>&1; then
pycentral pkgremove ubiquity-frontend-kde-le
else
flist=$(tempfile)
slist=$(tempfile)
dpkg -L ubiquity-frontend-kde-le | tee $flist | \
while read n; do
case "$n" in
/usr/share/pyshared/*)
n2=${n#/usr/share/pyshared/*}
case "$n" in
*.py) echo "p $n";;
*) [ -d "$n" ] && echo "d $n2" || echo "f $n2"
esac
;;
*) continue
esac
done > $slist
if [ -s $slist ]; then
for d in /usr/lib/python[0-9].[0-9]/????-packages; do
case "$d" in */python2.1/*|*/python2.2/*) continue; esac
while read t n; do
case "$t" in
p) rm -f $d/$n $d/${n}[co];;
d) rmdir $d/$n 2>/dev/null || true;;
*) rm -f $d/$n
esac
done < $slist
done
fi
awk '/\/usr\/share\/pyshared/ {next} /\.py$/ {print $0"c\n" $0"o"}' $flist \
| xargs -r rm -f >&2
rm -f $flist $slist
fi
rm -f /var/lib/pycentral/ubiquity-frontend-kde-le.pkgremove
fi
# End automatically added section
# -*- coding: utf-8 -*-
from PyQt4.QtCore import Qt, QRectF
from PyQt4.QtGui import QWidget, QFont, QPainter, QPen, QPainterPath, QColor
from PyQt4.QtSvg import QSvgRenderer
from PyQt4 import uic
import subprocess
import sys
import os
IMG_DIR = "/usr/share/ubiquity/qt/images"
#U+ , or +U+ ... to string
def fromUnicodeString(raw):
if raw[0:2] == "U+":
return unichr(int(raw[2:], 16))
elif raw[0:2] == "+U":
return unichr(int(raw[3:], 16))
return ""
class Keyboard(QWidget):
kb_104 = {
"extended_return": False,
"keys": [
(0x29, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd),
(0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x2b),
(0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28),
(0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35),
()]
}
kb_105 = {
"extended_return": True,
"keys": [
(0x29, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd),
(0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b),
(0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x2b),
(0x54, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35),
()]
}
kb_106 = {
"extended_return": True,
"keys": [
(0x29, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe),
(0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b),
(0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29),
(0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36),
()]
}
lowerFont = QFont("Helvetica", 10, QFont.DemiBold)
upperFont = QFont("Helvetica", 8)
def __init__(self, parent = None):
QWidget.__init__(self, parent)
self.codes = []
self.layout = "us"
self.variant = ""
self.kb = None
def setLayout(self, layout):
self.layout = layout
def setVariant(self, variant):
self.variant = variant
self.loadCodes()
self.loadInfo()
self.repaint()
def loadInfo(self):
kbl_104 = ["us", "th"]
kbl_106 = ["jp"]
# most keyboards are 105 key so default to that
if self.layout in kbl_104:
self.kb = self.kb_104
elif self.layout in kbl_106:
self.kb = self.kb_106
elif self.kb != self.kb_105:
self.kb = self.kb_105
def resizeEvent(self, re):
self.space = 6
self.usable_width = self.width()-2
self.key_w = (self.usable_width - 14 * self.space)/15
self.setMinimumHeight(self.key_w*4 + self.space*5)
def paintEvent(self, pe):
p = QPainter(self)
p.setRenderHint(QPainter.Antialiasing)
pen = QPen()
pen.setWidth(1)
pen.setColor(QColor(0x8c, 0xa3, 0xb0))
p.setPen(pen)
p.setBrush(QColor(0xe4, 0xec, 0xf4))
rx = 6
space = self.space
w = self.usable_width
kw = self.key_w
def drawRow(row, sx, sy, last_end=False):
x=sx
y=sy
keys = row
rw=w-sx
i=0
for k in keys:
rect = QRectF(x, y, kw, kw)
if i == len(keys)-1 and last_end:
rect.setWidth(rw)
p.drawRoundedRect(rect, rx, rx)
p.setPen(Qt.black)
rect.adjust(5,1, 0, 0)
p.setFont(self.lowerFont)
p.drawText(rect, Qt.AlignLeft | Qt.AlignBottom, self.regular_text(k))
p.setFont(self.upperFont)
p.drawText(rect, Qt.AlignLeft | Qt.AlignTop, self.shift_text(k))
rw = rw - space - kw
x = x + space + kw
i = i+1
p.setPen(pen)
return (x,rw)
x=.5
y=.5
keys = self.kb["keys"]
ext_return = self.kb["extended_return"]
first_key_w = 0
rows = 4
remaining_x = [0,0,0,0]
remaining_widths = [0,0,0,0]
for i in range(0, rows):
if first_key_w > 0:
first_key_w = first_key_w*1.375
if self.kb == self.kb_105 and i==3:
first_key_w = kw * 1.275
rect = QRectF(x, y, first_key_w, kw)
p.drawRoundedRect(rect, rx, rx)
x = x + first_key_w + space
else:
first_key_w = kw
x,rw = drawRow(keys[i], x, y, i==1 and not ext_return)
remaining_x[i] = x
remaining_widths[i] = rw
if i!=1 and i!=2:
rect = QRectF(x, y, rw, kw)
p.drawRoundedRect(rect, rx, rx)
x=.5
y = y + space + kw
if ext_return:
rx=rx*2
x1 = remaining_x[1]
y1 = .5 + kw*1 + space*1
w1 = remaining_widths[1]
x2 = remaining_x[2]
y2 = .5 + kw*2 + space*2
w2 = remaining_widths[2]
# this is some serious crap... but it has to be so
# maybe one day keyboards won't look like this...
# one can only hope
pp = QPainterPath()
pp.moveTo(x1, y1+rx)
pp.arcTo(x1, y1, rx, rx, 180, -90)
pp.lineTo(x1+w1-rx, y1)
pp.arcTo(x1+w1-rx, y1, rx, rx, 90, -90)
pp.lineTo(x1+w1, y2+kw-rx)
pp.arcTo(x1+w1-rx, y2+kw-rx, rx, rx, 0, -90)
pp.lineTo(x2+rx, y2+kw)
pp.arcTo(x2, y2+kw-rx, rx, rx, -90, -90)
pp.lineTo(x2, y1+kw)
pp.lineTo(x1+rx, y1+kw)
pp.arcTo(x1, y1+kw-rx, rx, rx, -90, -90)
pp.closeSubpath()
p.drawPath(pp)
else:
x= remaining_x[2]
y = .5 + kw*2 + space*2
rect = QRectF(x, y, remaining_widths[2], kw)
p.drawRoundedRect(rect, rx, rx)
QWidget.paintEvent(self, pe)
def regular_text(self, index):
return self.codes[index - 1][0]
def shift_text(self, index):
return self.codes[index - 1][1]
def ctrl_text(self, index):
return self.codes[index - 1][2]
def alt_text(self, index):
return self.codes[index - 1][3]
def loadCodes(self):
if self.layout is None:
return
variantParam = ""
if self.variant:
variantParam = "-variant %s" % self.variant
cmd="ckbcomp -model pc106 -layout %s %s -compact" % (self.layout, variantParam)
#print cmd
pipe = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=None)
cfile = pipe.communicate()[0]
#clear the current codes
del self.codes[:]
for l in cfile.split('\n'):
if l[:7] != "keycode":
continue
codes = l.split('=')[1].strip().split(' ')
plain = fromUnicodeString(codes[0])
shift = fromUnicodeString(codes[1])
ctrl = fromUnicodeString(codes[2])
alt = fromUnicodeString(codes[3])
if ctrl == plain:
ctrl = ""
if alt == plain:
alt = ""
self.codes.append((plain, shift, ctrl, alt))
## testing
if __name__ == "__main__":
from PyQt4.QtGui import QApplication, QVBoxLayout
IMG_DIR = "../../../gui/qt/images"
app = QApplication(sys.argv)
win = QWidget()
l = QVBoxLayout(win)
def addKb(layout, variant = ""):
kb1 = Keyboard()
kb1.setLayout(layout)
kb1.setVariant(variant)
l.addWidget(kb1)
addKb("us")
addKb("gb")
addKb("th")
addKb("gr")
addKb("jp")
win.show()
app.exec_()
# -*- coding: utf-8; Mode: Python; indent-tabs-mode: nil; tab-width: 4 -*-
import syslog
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from ubiquity.misc import *
from ubiquity import i18n
def get_string(name, lang=None, prefix=None):
"""Get the string name in the given lang or a default."""
if lang is None and 'LANG' in os.environ:
lang = os.environ['LANG']
return i18n.get_string(name, lang, prefix)
# describes the display for the manual partition view widget
class PartitionModel(QAbstractItemModel):
def __init__(self, ubiquity, parent=None):
QAbstractItemModel.__init__(self, parent)
self.rootItem = None
self.clear()
def clear(self):
rootData = []
rootData.append(QVariant(get_string('partition_column_device')))
rootData.append(QVariant(get_string('partition_column_type')))
rootData.append(QVariant(get_string('partition_column_mountpoint')))
rootData.append(QVariant(get_string('partition_column_format')))
rootData.append(QVariant(get_string('partition_column_size')))
rootData.append(QVariant(get_string('partition_column_used')))
self.rootItem = TreeItem(rootData)
def append(self, data, ubiquity):
self.rootItem.appendChild(TreeItem(data, ubiquity, self.rootItem))
def columnCount(self, parent):
if parent.isValid():
return parent.internalPointer().columnCount()
else:
return self.rootItem.columnCount()
def data(self, index, role):
if not index.isValid():
return QVariant()
item = index.internalPointer()
if role == Qt.CheckStateRole and index.column() == 3:
return QVariant(item.data(index.column()))
elif role == Qt.DisplayRole and index.column() != 3:
return QVariant(item.data(index.column()))
else:
return QVariant()
def setData(self, index, value, role):
item = index.internalPointer()
if role == Qt.CheckStateRole and index.column() == 3:
item.partman_column_format_toggled(value.toBool())
self.emit(SIGNAL("dataChanged(const QModelIndex&, const QModelIndex&)"), index, index)
return True
def flags(self, index):
if not index.isValid():
return Qt.ItemIsEnabled
#self.setData(index, QVariant(Qt.Checked), Qt.CheckStateRole)
#return Qt.ItemIsEnabled | Qt.ItemIsSelectable
if index.column() == 3:
item = index.internalPointer()
if item.formatEnabled():
return Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsUserCheckable
else:
return Qt.ItemIsSelectable | Qt.ItemIsUserCheckable
else:
return Qt.ItemIsEnabled | Qt.ItemIsSelectable
def headerData(self, section, orientation, role):
if orientation == Qt.Horizontal and role == Qt.DisplayRole:
return self.rootItem.data(section)
return QVariant()
def index(self, row, column, parent = QModelIndex()):
if not parent.isValid():
parentItem = self.rootItem
else:
parentItem = parent.internalPointer()
childItem = parentItem.child(row)
if childItem:
return self.createIndex(row, column, childItem)
else:
return QModelIndex()
def parent(self, index):
if not index.isValid():
return QModelIndex()
childItem = index.internalPointer()
parentItem = childItem.parent()
if parentItem == self.rootItem:
return QModelIndex()
return self.createIndex(parentItem.row(), 0, parentItem)
def rowCount(self, parent):
if not parent.isValid():
parentItem = self.rootItem
else:
parentItem = parent.internalPointer()
return parentItem.childCount()
def children(self):
return self.rootItem.children()
class TreeItem:
def __init__(self, data, controller=None, parent=None):
self.parentItem = parent
self.itemData = data
self.childItems = []
self.controller = controller
if controller:
self.dbfilter = controller.dbfilter
else:
self.dbfilter = None
def appendChild(self, item):
self.childItems.append(item)
def child(self, row):
return self.childItems[row]
def childCount(self):
return len(self.childItems)
def children(self):
return self.childItems
def columnCount(self):
if self.parentItem is None:
return len(self.itemData)
else:
return 5
def data(self, column):
if self.parentItem is None:
return QVariant(self.itemData[column])
elif column == 0:
return QVariant(self.partman_column_name())
elif column == 1:
return QVariant(self.partman_column_type())
elif column == 2:
return QVariant(self.partman_column_mountpoint())
elif column == 3:
return QVariant(self.partman_column_format())
elif column == 4:
return QVariant(self.partman_column_size())
elif column == 5:
return QVariant(self.partman_column_used())
else:
return QVariant("other")
def parent(self):
return self.parentItem
def row(self):
if self.parentItem:
return self.parentItem.childItems.index(self)
return 0
def partman_column_name(self):
partition = self.itemData[1]
if 'id' not in partition:
# whole disk
return partition['device']
elif partition['parted']['fs'] != 'free':
return ' %s' % partition['parted']['path']
elif partition['parted']['type'] == 'unusable':
return ' %s' % get_string('partman/text/unusable')
else:
# partman uses "FREE SPACE" which feels a bit too SHOUTY for
# this interface.
return ' %s' % get_string('partition_free_space')
def partman_column_type(self):
partition = self.itemData[1]
if 'id' not in partition or 'method' not in partition:
if ('parted' in partition and
partition['parted']['fs'] != 'free' and
'detected_filesystem' in partition):
return partition['detected_filesystem']
else:
return ''