summaryrefslogtreecommitdiffstats
path: root/lib/kformula
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kformula')
-rw-r--r--lib/kformula/prototype/engine.py263
-rwxr-xr-xlib/kformula/prototype/main.py4
-rwxr-xr-xlib/kformula/prototype/unicode.py84
-rwxr-xr-xlib/kformula/scripts/bycodes.py14
4 files changed, 182 insertions, 183 deletions
diff --git a/lib/kformula/prototype/engine.py b/lib/kformula/prototype/engine.py
index f1391069c..4ad207f9a 100644
--- a/lib/kformula/prototype/engine.py
+++ b/lib/kformula/prototype/engine.py
@@ -1,33 +1,33 @@
"""This file is part of the KDE project
Copyright (C) 2001 Andrea Rizzi <rizzi@kde.org>
- Ulrich Kuettler <ulrich.kuettler@mailbox.tu-dresden.de>
+ Ulrich Kuettler <ulrich.kuettler@mailbox.tu-dresden.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
-
+
This library 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
Library General Public License for more details.
-
+
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
"""
-from qt import *
+from PyTQt.qt import *
class BasicElement:
"""The interface for every element."""
-
+
def __init__(self, parent):
self.parent = parent
- self.size = QSize()
- self.pos = QPoint()
+ self.size = TQSize()
+ self.pos = TQPoint()
def x(self): return self.pos.x()
@@ -48,7 +48,7 @@ class BasicElement:
x += element.x()
y += element.y()
element = element.parent
- return QPoint(x, y)
+ return TQPoint(x, y)
def elementAt(self, point, startPoint):
"""Returns the element that is at position point.
@@ -58,13 +58,13 @@ class BasicElement:
y = point.y() - startPoint.y()
if y >= 0 and y < self.height():
return self
-
+
def moveLeft(self, cursor, fromElement):
"""Enters this element while moving to the left from
the element `fromElement'. Searched for cursor position inside
this element of left of it."""
pass
-
+
def moveRight(self, cursor, fromElement):
"""Enters this element while moving to the right from
the element `fromElement'. Searched for cursor position inside
@@ -76,7 +76,7 @@ class BasicElement:
def moveDown(self, cursor, fromElement):
pass
-
+
def formula(self):
"""Returns the FormulaElement we are a child of."""
return self.parent.formula()
@@ -118,7 +118,7 @@ class BasicElement:
class SequenceElement (BasicElement):
"""The element that contains a number of children.
The children are aligned in one line."""
-
+
def __init__(self, parent):
BasicElement.__init__(self, parent)
self.children = []
@@ -127,18 +127,18 @@ class SequenceElement (BasicElement):
"""Returns the element before the cursor."""
if cursor.pos() > 0:
return self.children[cursor.pos()-1]
-
+
def elementAt(self, point, startPoint):
r = BasicElement.elementAt(self, point, startPoint)
if r != None:
for child in self.children:
- r = child.elementAt(point, QPoint(startPoint.x()+child.x(),
- startPoint.y()+child.y()))
+ r = child.elementAt(point, TQPoint(startPoint.x()+child.x(),
+ startPoint.y()+child.y()))
if r != None:
return r
return self
-
+
def moveLeft(self, cursor, fromElement):
# Our parent asks us for a cursor position. Found.
@@ -166,7 +166,7 @@ class SequenceElement (BasicElement):
if not cursor.mouseMark():
cursor.setMarkPos(fromPos+1)
-
+
def moveRight(self, cursor, fromElement):
# Our parent asks us for a cursor position. Found.
@@ -193,7 +193,7 @@ class SequenceElement (BasicElement):
if cursor.isSelection():
if not cursor.mouseMark():
cursor.setMarkPos(fromPos)
-
+
def moveUp(self, cursor, fromElement):
if fromElement == self.parent:
@@ -209,7 +209,7 @@ class SequenceElement (BasicElement):
else:
if self.parent != None:
self.parent.moveDown(cursor, self)
-
+
def moveHome(self, cursor):
if cursor.isSelection():
@@ -229,20 +229,20 @@ class SequenceElement (BasicElement):
cursor.setMarkPos(self.children.index(element))
cursor.set(self, len(self.children))
-
+
def draw(self, painter, styleContext, startPoint):
x, y = startPoint.x(), startPoint.y()
if len(self.children) > 0:
for child in self.children:
cX = child.x()
cY = child.y()
- child.draw(painter, styleContext, QPoint(x+cX, y+cY))
+ child.draw(painter, styleContext, TQPoint(x+cX, y+cY))
# Debug
- #painter.setPen(Qt.green)
+ #painter.setPen(TQt.green)
#painter.drawRect(x, y, self.width(), self.height())
else:
- painter.setPen(Qt.blue)
+ painter.setPen(TQt.blue)
painter.drawRect(x, y, self.width(), self.height())
def calcSizes(self, styleContext):
@@ -295,7 +295,7 @@ class SequenceElement (BasicElement):
# it is essential to set up the parent pointer for
# the notification to work.
element.parent = self
-
+
seq = element.makeSequence()
if cursor.isSelection():
f = min(cursor.pos(), cursor.markPos())
@@ -312,7 +312,7 @@ class SequenceElement (BasicElement):
self.replaceChild(cursor, element)
else:
self.insertChild(cursor, element)
-
+
element.setMainChild(seq)
@@ -321,7 +321,7 @@ class SequenceElement (BasicElement):
(The main child is always a SequenceElement.)"""
assert element.parent == self
self.formula().elementRemoved(element)
-
+
seq = element.mainChild()
pos = self.children.index(element)
self.children.remove(element)
@@ -346,7 +346,7 @@ class SequenceElement (BasicElement):
element.parent = self
cursor.set(self, pos+1)
self.formula().changed()
-
+
def replaceChild(self, cursor, element):
"""Replaces the element before the cursor with the new one.
No range checking. Be careful."""
@@ -363,7 +363,7 @@ class SequenceElement (BasicElement):
self.parent.removeChild(cursor, self)
return
self.formula().changed()
-
+
def removeChildAt(self, cursor):
pos = cursor.pos()
if cursor.isSelection():
@@ -382,7 +382,7 @@ class SequenceElement (BasicElement):
if len(self.children) == 0:
if self.parent != None:
self.parent.removeChild(cursor, self)
-
+
def removeChildBefore(self, cursor):
pos = cursor.pos()-1
if cursor.isSelection():
@@ -402,8 +402,8 @@ class SequenceElement (BasicElement):
if len(self.children) == 0:
if self.parent != None:
self.parent.removeChild(cursor, self)
-
-
+
+
def globalCursorPos(self, pos):
"""Returns the position after the child at the position
in global Coords."""
@@ -415,13 +415,13 @@ class SequenceElement (BasicElement):
d = self.width()
else:
d = 2
-
+
point.setX(point.x()+d)
return point
def countChildren(self):
return len(self.children)
-
+
class FormulaElement (SequenceElement):
"""The main element.
@@ -447,18 +447,18 @@ class FormulaElement (SequenceElement):
Caution! The object tree must still contain the element by the time
you call this methode."""
self.document.elementRemoved(element)
-
+
class TextElement (BasicElement):
"""One char."""
-
+
def __init__(self, parent, char):
BasicElement.__init__(self, parent)
self.char = char
def moveLeft(self, cursor, fromElement):
self.parent.moveLeft(cursor, self)
-
+
def moveRight(self, cursor, fromElement):
self.parent.moveRight(cursor, self)
@@ -484,7 +484,7 @@ class IndexElement (BasicElement):
contentElement.parent = self
else:
BasicElement.__init__(self, None)
-
+
self.content = contentElement
self.upperLeft = self.upperRight = None
self.lowerLeft = self.lowerRight = None
@@ -494,39 +494,39 @@ class IndexElement (BasicElement):
r = BasicElement.elementAt(self, point, startPoint)
if r != None:
x, y = startPoint.x(), startPoint.y()
- r = self.content.elementAt(point, QPoint(x+self.content.x(),
- y+self.content.y()))
+ r = self.content.elementAt(point, TQPoint(x+self.content.x(),
+ y+self.content.y()))
if r != None: return r
if self.upperRight != None:
- r = self.upperRight.elementAt(point, QPoint(x+self.upperRight.x(),
- y+self.upperRight.y()))
+ r = self.upperRight.elementAt(point, TQPoint(x+self.upperRight.x(),
+ y+self.upperRight.y()))
if r != None: return r
if self.upperLeft != None:
- r = self.upperLeft.elementAt(point, QPoint(x+self.upperLeft.x(),
- y+self.upperLeft.y()))
+ r = self.upperLeft.elementAt(point, TQPoint(x+self.upperLeft.x(),
+ y+self.upperLeft.y()))
if r != None: return r
if self.lowerRight != None:
- r = self.lowerRight.elementAt(point, QPoint(x+self.lowerRight.x(),
- y+self.lowerRight.y()))
+ r = self.lowerRight.elementAt(point, TQPoint(x+self.lowerRight.x(),
+ y+self.lowerRight.y()))
if r != None: return r
if self.lowerLeft != None:
- r = self.lowerLeft.elementAt(point, QPoint(x+self.lowerLeft.x(),
- y+self.lowerLeft.y()))
+ r = self.lowerLeft.elementAt(point, TQPoint(x+self.lowerLeft.x(),
+ y+self.lowerLeft.y()))
if r != None: return r
return self
-
-
+
+
def moveLeft(self, cursor, fromElement):
assert fromElement != None
if cursor.isSelection():
self.parent.moveLeft(cursor, self)
-
+
elif fromElement == self.parent:
if self.lowerRight != None:
self.lowerRight.moveLeft(cursor, self)
@@ -557,11 +557,11 @@ class IndexElement (BasicElement):
self.upperLeft.moveLeft(cursor, self)
else:
self.parent.moveLeft(cursor, self)
-
+
else:
self.parent.moveLeft(cursor, self)
-
-
+
+
def moveRight(self, cursor, fromElement):
assert fromElement != None
@@ -598,7 +598,7 @@ class IndexElement (BasicElement):
self.lowerRight.moveRight(cursor, self)
else:
self.parent.moveRight(cursor, self)
-
+
else:
self.parent.moveRight(cursor, self)
@@ -629,7 +629,7 @@ class IndexElement (BasicElement):
else: # should never happen.
self.parent.moveUp(cursor, self)
-
+
def moveDown(self, cursor, fromElement):
assert fromElement != None
@@ -654,35 +654,35 @@ class IndexElement (BasicElement):
elif fromElement == self.upperRight:
self.content.moveLeft(cursor, self)
-
+
else: # should never happen.
self.parent.moveDown(cursor, self)
-
+
def draw(self, painter, styleContext, startPoint):
x, y = startPoint.x(), startPoint.y()
self.content.draw(painter, styleContext,
- QPoint(x+self.content.x(),
- y+self.content.y()))
+ TQPoint(x+self.content.x(),
+ y+self.content.y()))
if self.upperLeft != None:
self.upperLeft.draw(painter, styleContext,
- QPoint(x+self.upperLeft.x(),
- y+self.upperLeft.y()))
+ TQPoint(x+self.upperLeft.x(),
+ y+self.upperLeft.y()))
if self.upperRight != None:
self.upperRight.draw(painter, styleContext,
- QPoint(x+self.upperRight.x(),
- y+self.upperRight.y()))
+ TQPoint(x+self.upperRight.x(),
+ y+self.upperRight.y()))
if self.lowerLeft != None:
self.lowerLeft.draw(painter, styleContext,
- QPoint(x+self.lowerLeft.x(),
- y+self.lowerLeft.y()))
+ TQPoint(x+self.lowerLeft.x(),
+ y+self.lowerLeft.y()))
if self.lowerRight != None:
self.lowerRight.draw(painter, styleContext,
- QPoint(x+self.lowerRight.x(),
- y+self.lowerRight.y()))
+ TQPoint(x+self.lowerRight.x(),
+ y+self.lowerRight.y()))
# Debug
- painter.setPen(Qt.red)
+ painter.setPen(TQt.red)
painter.drawRect(x, y, self.width(), self.height())
@@ -748,7 +748,7 @@ class IndexElement (BasicElement):
self.lowerRight.setX(width)
width += max(urWidth, lrWidth)
-
+
# calculate the y offsets
if ulHeight > urHeight:
self.upperLeft.setY(0)
@@ -812,7 +812,7 @@ class IndexElement (BasicElement):
self.parent.replaceElementByMainChild(cursor, self)
else:
self.formula().changed()
-
+
def requireUpperLeft(self):
if self.upperLeft == None:
@@ -837,15 +837,15 @@ class IndexElement (BasicElement):
self.lowerRight = SequenceElement(self)
self.formula().changed()
return self.lowerRight
-
-
+
+
class Cursor:
"""The selection. This might be a one position selection or
an area. Handles user input and object creation.
-
+
Note that it is up to the elements to actually move the cursor.
(The cursor has no chance to know how.)"""
-
+
def __init__(self, formulaElement):
self.sequenceElement = formulaElement
self.currentPos = 0
@@ -868,25 +868,25 @@ class Cursor:
self.selectionFlag = 0
else:
self.currentMarkPos = -1
-
+
self.sequenceElement = sequenceElement
self.currentPos = pos
def markPos(self):
return self.currentMarkPos
-
+
def setMarkPos(self, markPos):
"""Gets called by elements if the cursor moves up to the parent."""
self.selectionFlag = (markPos != -1)
self.currentMarkPos = markPos
-
+
def pos(self):
return self.currentPos
def element(self):
return self.sequenceElement
-
+
def draw(self, painter):
point = self.sequenceElement.globalCursorPos(self.pos())
height = self.sequenceElement.height()
@@ -896,18 +896,18 @@ class Cursor:
x = min(point.x(), markPoint.x())
width = abs(point.x() - markPoint.x())
- painter.setRasterOp(Qt.XorROP)
- #painter.setRasterOp(Qt.OrROP)
- painter.fillRect(x, point.y(), width, height, QBrush(Qt.white))
+ painter.setRasterOp(TQt.XorROP)
+ #painter.setRasterOp(TQt.OrROP)
+ painter.fillRect(x, point.y(), width, height, TQBrush(TQt.white))
#painter.drawLine(point.x(), point.y()-2,
# point.x(), point.y()+height+2)
- painter.setRasterOp(Qt.CopyROP)
+ painter.setRasterOp(TQt.CopyROP)
else:
- painter.setPen(Qt.blue)
+ painter.setPen(TQt.blue)
painter.drawLine(point.x(), point.y()-2,
point.x(), point.y()+height+2)
-
+
def findIndexElement(self):
"""Looks if we are just behind an IndexElement or at the last
@@ -921,7 +921,7 @@ class Cursor:
if self.sequenceElement == parent.mainChild():
return parent
-
+
def addUpperRightIndex(self):
indexElement = self.findIndexElement()
if indexElement == None:
@@ -931,7 +931,7 @@ class Cursor:
index.moveRight(self, index.parent)
-
+
def addLowerRightIndex(self):
indexElement = self.findIndexElement()
if indexElement == None:
@@ -940,20 +940,20 @@ class Cursor:
index = indexElement.requireLowerRight()
index.moveRight(self, index.parent)
-
+
def addTextElement(self, char):
- textElement = TextElement(self.sequenceElement, QString(char))
+ textElement = TextElement(self.sequenceElement, TQString(char))
self.sequenceElement.insertChild(self, textElement)
-
+
def handleKey(self, keyEvent):
action = keyEvent.key()
state = keyEvent.state()
char = keyEvent.text().at(0)
-
+
self.mouseMarkFlag = 0
-
+
if char.isPrint():
#self.sequenceElement.handleKey(self, char)
latin1 = char.latin1()
@@ -981,42 +981,42 @@ class Cursor:
pass
else:
self.addTextElement(char)
-
+
else:
- if Qt.Key_BackSpace == action:
+ if TQt.Key_BackSpace == action:
self.sequenceElement.removeChildBefore(self)
return
- elif Qt.Key_Delete == action:
+ elif TQt.Key_Delete == action:
self.sequenceElement.removeChildAt(self)
return
- self.selectionFlag = state & Qt.ShiftButton
- if Qt.Key_Left == action:
- if state & Qt.ControlButton:
+ self.selectionFlag = state & TQt.ShiftButton
+ if TQt.Key_Left == action:
+ if state & TQt.ControlButton:
self.sequenceElement.moveHome(self)
else:
self.sequenceElement.moveLeft(self, self.sequenceElement)
- elif Qt.Key_Right == action:
- if state & Qt.ControlButton:
+ elif TQt.Key_Right == action:
+ if state & TQt.ControlButton:
self.sequenceElement.moveEnd(self)
else:
self.sequenceElement.moveRight(self, self.sequenceElement)
- elif Qt.Key_Up == action:
+ elif TQt.Key_Up == action:
self.sequenceElement.moveUp(self, self.sequenceElement)
- elif Qt.Key_Down == action:
+ elif TQt.Key_Down == action:
self.sequenceElement.moveDown(self, self.sequenceElement)
- elif Qt.Key_Home == action:
+ elif TQt.Key_Home == action:
self.sequenceElement.formula().moveHome(self)
- elif Qt.Key_End == action:
+ elif TQt.Key_End == action:
self.sequenceElement.formula().moveEnd(self)
- # Qt.Key_PageUp, Qt.Key_PageDown,
-
+ # TQt.Key_PageUp, TQt.Key_PageDown,
+
def handleMousePress(self, mouseEvent):
formula = self.sequenceElement.formula()
- element = formula.elementAt(mouseEvent.pos(), QPoint(0, 0))
+ element = formula.elementAt(mouseEvent.pos(), TQPoint(0, 0))
if element != None:
if element.parent != None:
element.moveLeft(self, element.parent)
@@ -1028,15 +1028,15 @@ class Cursor:
def handleMouseRelease(self, mouseEvent):
self.mouseMarkFlag = 0
-
+
def handleMouseMove(self, mouseEvent):
self.selectionFlag = 1
formula = self.sequenceElement.formula()
- element = formula.elementAt(mouseEvent.pos(), QPoint(0, 0))
+ element = formula.elementAt(mouseEvent.pos(), TQPoint(0, 0))
if element != None:
if element.parent != None:
element.parent.moveLeft(self, element)
-
+
def elementRemoved(self, element):
"""The cursor must not be inside a leaf which gets cut off.
@@ -1050,28 +1050,28 @@ class Cursor:
self.sequenceElement.moveHome(self)
return
e = e.parent
-
+
class StyleContext:
"""Contains all variable information that are needed to
draw a formula."""
def __init__(self):
- self.font = QFont("helvetica", 18)
+ self.font = TQFont("helvetica", 18)
def setupPainter(self, painter):
painter.setFont(self.font)
- painter.setPen(Qt.black)
+ painter.setPen(TQt.black)
def fontMetrics(self):
- return QFontMetrics(self.font)
-
-
-class Widget(QWidget):
+ return TQFontMetrics(self.font)
+
+
+class Widget(TQWidget):
"""The widget that contains a formula."""
-
+
def __init__(self):
- QWidget.__init__(self)
+ TQWidget.__init__(self)
f = self.formula = FormulaElement(self)
self.cursor = Cursor(self.formula)
self.styleContext = StyleContext()
@@ -1105,13 +1105,13 @@ class Widget(QWidget):
s3.addChild(TextElement(s3, "f"))
s3.addChild(TextElement(s3, "u"))
s3.addChild(TextElement(s3, "n"))
-
+
i2 = IndexElement(s3)
i2.requireUpperLeft()
i2.requireUpperRight()
i2.requireLowerLeft()
i2.requireLowerRight()
-
+
f.addChild(i2)
f.addChild(TextElement(f, ":"))
@@ -1132,28 +1132,28 @@ class Widget(QWidget):
self.changedFlag = 1
-
+
def changed(self):
"""Gets called each time the formula changes."""
self.changedFlag = 1
-
-
+
+
def elementRemoved(self, element):
"""The element is going to go real soon."""
self.cursor.elementRemoved(element)
-
-
+
+
def paintEvent (self, e):
if self.changedFlag:
# You need to use the same StyleContext you use for drawing.
self.formula.calcSizes(self.styleContext)
self.changedFlag = 0
-
- painter = QPainter()
+
+ painter = TQPainter()
painter.begin(self)
try:
- self.formula.draw(painter, self.styleContext, QPoint(0, 0))
+ self.formula.draw(painter, self.styleContext, TQPoint(0, 0))
self.cursor.draw(painter)
finally:
painter.end()
@@ -1162,19 +1162,18 @@ class Widget(QWidget):
def keyPressEvent(self, e):
self.cursor.handleKey(e)
self.update()
-
+
def mousePressEvent(self, e):
self.cursor.handleMousePress(e)
self.update()
-
+
def mouseReleaseEvent(self, e):
self.cursor.handleMouseRelease(e)
self.update()
-
+
def mouseDoubleClickEvent(self, e):
pass
def mouseMoveEvent(self, e):
self.cursor.handleMouseMove(e)
self.update()
-
diff --git a/lib/kformula/prototype/main.py b/lib/kformula/prototype/main.py
index 49425b928..953bc060b 100755
--- a/lib/kformula/prototype/main.py
+++ b/lib/kformula/prototype/main.py
@@ -1,11 +1,11 @@
#!/usr/bin/env python
import sys
-from qt import *
+from TQt.qt import *
from engine import Widget
-a = QApplication(sys.argv)
+a = TQApplication(sys.argv)
mw = Widget()
mw.setCaption('Prototype of the formula engine')
mw.show()
diff --git a/lib/kformula/prototype/unicode.py b/lib/kformula/prototype/unicode.py
index 3559711d0..cee5ea6c1 100755
--- a/lib/kformula/prototype/unicode.py
+++ b/lib/kformula/prototype/unicode.py
@@ -1,18 +1,18 @@
#!/usr/bin/env python
import sys
-from qt import *
+from TQt.qt import *
from xml.sax import saxutils, handler, make_parser
-class Form1(QWidget):
+class Form1(TQWidget):
def __init__(self,parent = None,name = None,fl = 0):
- QWidget.__init__(self,parent,name,fl)
+ TQWidget.__init__(self,parent,name,fl)
if name == None:
self.setName('Form1')
self.setCaption(self.tr('Form1'))
- grid = QGridLayout(self)
+ grid = TQGridLayout(self)
grid.setSpacing(6)
grid.setMargin(11)
@@ -23,20 +23,20 @@ class Form1(QWidget):
end = 256
for i in range(begin, end):
- charLabel = QLabel(self,'charLabel' + chr(i))
- charLabel.setFont(QFont("symbol", 16))
+ charLabel = TQLabel(self,'charLabel' + chr(i))
+ charLabel.setFont(TQFont("symbol", 16))
charLabel.setText(self.tr(chr(i)))
grid.addWidget(charLabel, i-begin, 0)
-
- number = QLineEdit(self,'Number' + chr(i))
+
+ number = TQLineEdit(self,'Number' + chr(i))
grid.addWidget(number, i-begin, 1)
- latexName = QLineEdit(self,'latexName' + chr(i))
+ latexName = TQLineEdit(self,'latexName' + chr(i))
grid.addWidget(latexName, i-begin, 2)
- charClass = QLineEdit(self,'charClass' + chr(i))
+ charClass = TQLineEdit(self,'charClass' + chr(i))
grid.addWidget(charClass, i-begin, 3)
-
+
self.chars[i] = (charLabel, number, latexName, charClass)
def fontList(self):
@@ -46,13 +46,13 @@ class Form1(QWidget):
if str(number.text()) != "" or str(latexName.text()) != "" or str(charClass.text()) != "":
list.append((i, str(number.text()), str(latexName.text()), str(charClass.text())))
return list
-
+
def setFont(self, fontName, font):
fontName = fontName.replace("%20", " ")
self.fontName = fontName
for i in self.chars:
charLabel, number, latexName, charClass = self.chars[i]
- charLabel.setFont(QFont(fontName, 16))
+ charLabel.setFont(TQFont(fontName, 16))
number.setText("")
latexName.setText("")
charClass.setText("")
@@ -63,54 +63,54 @@ class Form1(QWidget):
numberWidget.setText(number)
latexNameWidget.setText(latexName)
charClassWidget.setText(charClass)
-
-class Widget(QWidget):
+
+class Widget(TQWidget):
def __init__(self):
- QWidget.__init__(self)
+ TQWidget.__init__(self)
- vbox = QVBoxLayout(self)
+ vbox = TQVBoxLayout(self)
vbox.setSpacing(6)
vbox.setMargin(0)
- hbox = QHBoxLayout()
+ hbox = TQHBoxLayout()
hbox.setSpacing(6)
hbox.setMargin(0)
- loadButton = QPushButton("load", self)
- saveButton = QPushButton("save", self)
+ loadButton = TQPushButton("load", self)
+ saveButton = TQPushButton("save", self)
+
+ TQObject.connect(loadButton, SIGNAL("pressed()"), self.load)
+ TQObject.connect(saveButton, SIGNAL("pressed()"), self.save)
- QObject.connect(loadButton, SIGNAL("pressed()"), self.load)
- QObject.connect(saveButton, SIGNAL("pressed()"), self.save)
-
hbox.addWidget(loadButton)
hbox.addWidget(saveButton)
-
+
vbox.addLayout(hbox)
-
- splitter = QSplitter(self)
- splitter.setOrientation(Qt.Vertical)
-
- self.listbox = QListBox(splitter)
-
- sv = QScrollView(splitter)
- big_box = QVBox(sv.viewport())
+
+ splitter = TQSplitter(self)
+ splitter.setOrientation(TQt.Vertical)
+
+ self.listbox = TQListBox(splitter)
+
+ sv = TQScrollView(splitter)
+ big_box = TQVBox(sv.viewport())
sv.addChild(big_box, 0, 0)
self.child = Form1(big_box)
vbox.addWidget(splitter)
- self.connect(self.listbox, SIGNAL('highlighted( const QString& )'),
+ self.connect(self.listbox, SIGNAL('highlighted( const TQString& )'),
self.fontHighlighted)
def fontHighlighted(self, fontStr):
if self.child.fontName:
self.fonts[self.child.fontName] = self.child.fontList()
-
+
font = str(fontStr)
self.child.setFont(font, self.fonts[font])
-
+
def load(self):
self.fonts = {}
parser = make_parser()
@@ -121,11 +121,11 @@ class Widget(QWidget):
for font in self.fonts:
self.listbox.insertItem(font)
self.listbox.sort()
-
+
def save(self):
if self.child.fontName:
self.fonts[self.child.fontName] = self.child.fontList()
-
+
f = open("symbol.xml", "w")
print >> f, '<?xml version="1.0" encoding="iso-8859-1"?>'
print >> f, '<table>'
@@ -139,13 +139,13 @@ class Widget(QWidget):
'" name="' + str(latexName) + \
'" class="' + str(charClass) + \
'"/>'
-
+
print >> f, ' </unicodetable>'
print >> f, '</table>'
f.close()
-class ContentGenerator(handler.ContentHandler):
+class ContentGenerator(handler.ContentHandler):
def __init__(self, fonts):
handler.ContentHandler.__init__(self)
self.fonts = fonts
@@ -175,10 +175,10 @@ class ContentGenerator(handler.ContentHandler):
#numberWidget.setText(number)
#latexNameWidget.setText(latexName)
#charClassWidget.setText(charClass)
-
-
+
+
def main():
- a = QApplication(sys.argv)
+ a = TQApplication(sys.argv)
mw = Widget()
mw.setCaption('Unicode mapping util')
diff --git a/lib/kformula/scripts/bycodes.py b/lib/kformula/scripts/bycodes.py
index 16d719599..45b787a0f 100755
--- a/lib/kformula/scripts/bycodes.py
+++ b/lib/kformula/scripts/bycodes.py
@@ -7,12 +7,12 @@
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
-
+
This library 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
Library General Public License for more details.
-
+
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
@@ -20,7 +20,7 @@
"""
import sys
import string
-import qt
+from TQt import qt
def decode( fd, font, line ):
begin = string.find( line, '"' )
@@ -39,10 +39,10 @@ def decode( fd, font, line ):
char_list.append( string.atoi( second, 16 ) )
else:
char_list.append( string.atoi ( unicode, 16 ) )
- fm = qt.QFontMetrics( qt.QFont( font ) )
+ fm = qt.TQFontMetrics( qt.TQFont( font ) )
in_font = True
for c in char_list:
- if not fm.inFont( qt.QChar( c ) ):
+ if not fm.inFont( qt.TQChar( c ) ):
in_font = False
fd.write( unicode + ' ' + str( in_font ) + '\n')
@@ -54,9 +54,9 @@ def parse( file, font ):
if string.find( line, 'name' ) != -1:
decode( fd2, font, line )
line = fd.readline()
-
+
if __name__ == '__main__':
- a = qt.QApplication( sys.argv )
+ a = qt.TQApplication( sys.argv )
if len( sys.argv ) == 2:
sys.argv.append( 'Arev Sans' )
parse ( sys.argv[1], sys.argv[2] )