Merge branch 'master' of repos.ctdo.de:psychose
This commit is contained in:
commit
ac48b496fb
|
@ -0,0 +1,21 @@
|
|||
#!/sbin/runscript
|
||||
|
||||
depend() {
|
||||
need net
|
||||
use dns localmount
|
||||
after bootmisc
|
||||
provide chaosc
|
||||
}
|
||||
|
||||
|
||||
start() {
|
||||
ebegin "starting chaosc"
|
||||
start-stop-daemon --start --pidfile /var/run/chaosc.pid --make-pidfile --user sarah --group sarah --background --exec /usr/bin/chaosc
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "stopping chaosc"
|
||||
start-stop-daemon --stop --quiet --pidfile /var/run/chaosc.pid
|
||||
eend $?
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
#!/sbin/runscript
|
||||
|
||||
depend() {
|
||||
need net
|
||||
use dns localmount chaosc
|
||||
after bootmisc
|
||||
provide dump_grabber
|
||||
}
|
||||
|
||||
|
||||
start() {
|
||||
ebegin "starting dump_grabber"
|
||||
start-stop-daemon --start --pidfile /var/run/dump_grabber.pid --make-pidfile --user stefan --group stefan --background --exec env DISPLAY=:0 /usr/bin/dump_grabber
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "stopping dump_grabber"
|
||||
start-stop-daemon --stop --quiet --pidfile /var/run/dump_grabber.pid
|
||||
eend $?
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
#!/sbin/runscript
|
||||
|
||||
depend() {
|
||||
need net
|
||||
use dns localmount chaosc
|
||||
after bootmisc
|
||||
provide ekgplotter
|
||||
}
|
||||
|
||||
|
||||
start() {
|
||||
ebegin "starting ekgplotter"
|
||||
start-stop-daemon --start --pidfile /var/run/ekgplotter.pid --make-pidfile --user stefan --group stefan --background --exec env DISPLAY=:0 /usr/bin/ekgplotter
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "stopping ekgplotter"
|
||||
start-stop-daemon --stop --quiet --pidfile /var/run/ekgplotter.pid
|
||||
eend $?
|
||||
}
|
|
@ -2,15 +2,62 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
import sys, os, random
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
# This file is part of chaosc and psychosis
|
||||
#
|
||||
# chaosc 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# chaosc 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 chaosc. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Copyright (C) 2014 Stefan Kögl
|
||||
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from dump_grabber_ui import Ui_MainWindow
|
||||
import os
|
||||
|
||||
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
|
||||
from chaosc.argparser_groups import *
|
||||
from chaosc.lib import logger, resolve_host
|
||||
from collections import deque
|
||||
from datetime import datetime
|
||||
from dump_grabber.dump_grabber_ui import Ui_MainWindow
|
||||
from os import curdir, sep
|
||||
from PyKDE4.kdecore import ki18n, KCmdLineArgs, KAboutData
|
||||
from PyKDE4.kdeui import KMainWindow, KApplication
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from PyQt4.QtCore import QBuffer, QByteArray, QIODevice
|
||||
from SocketServer import ThreadingMixIn, ForkingMixIn
|
||||
|
||||
import logging
|
||||
import numpy as np
|
||||
|
||||
import os.path
|
||||
import Queue
|
||||
import random
|
||||
import re
|
||||
import select
|
||||
import socket
|
||||
import string
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
|
||||
try:
|
||||
from chaosc.c_osc_lib import OSCMessage, decode_osc
|
||||
except ImportError as e:
|
||||
from chaosc.osc_lib import OSCMessage, decode_osc
|
||||
|
||||
|
||||
|
||||
appName = "dump_grabber"
|
||||
catalog = "dump_grabber"
|
||||
|
@ -22,8 +69,13 @@ aboutData = KAboutData(appName, catalog, programName, version)
|
|||
KCmdLineArgs.init (sys.argv, aboutData)
|
||||
|
||||
app = KApplication()
|
||||
|
||||
fh = logging.FileHandler(os.path.expanduser("~/.chaosc/dump_grabber.log"))
|
||||
fh.setLevel(logging.DEBUG)
|
||||
logger.addHandler(fh)
|
||||
|
||||
class MainWindow(KMainWindow, Ui_MainWindow):
|
||||
def __init__(self, parent=None):
|
||||
def __init__(self, parent=None, columns=3):
|
||||
super(MainWindow, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
self.graphics_view.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||
|
@ -36,28 +88,247 @@ class MainWindow(KMainWindow, Ui_MainWindow):
|
|||
self.default_font = QtGui.QFont("Monospace", 14)
|
||||
self.default_font.setStyleHint(QtGui.QFont.Monospace)
|
||||
self.default_font.setBold(True)
|
||||
self.blue_color = QtGui.QColor(47,147,235)
|
||||
self.font_metrics = QtGui.QFontMetrics(self.default_font)
|
||||
self.line_height = self.font_metrics.height()
|
||||
self.num_lines = 775/self.line_height
|
||||
|
||||
self.graphics_scene.setFont(self.default_font)
|
||||
print "font", self.default_font.family(), self.default_font.pixelSize(), self.default_font.pointSize()
|
||||
self.brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
|
||||
self.brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
pos_y = 0
|
||||
for i in range(self.num_lines):
|
||||
text = self.graphics_scene.addSimpleText("osc address:/test/foo/bar arguments:[%d] types=[\"i\"]" % random.randint(0,255), self.default_font)
|
||||
text.setBrush(self.brush)
|
||||
text.setPos(0, i * self.line_height)
|
||||
pos_y += self.line_height
|
||||
self.column_width = 775 / columns
|
||||
|
||||
self.column_count = columns
|
||||
self.columns = list()
|
||||
for i in range(columns):
|
||||
column = list()
|
||||
for j in range(self.num_lines):
|
||||
text_item = self.graphics_scene.addSimpleText("", self.default_font)
|
||||
if column == 0:
|
||||
text_item.setBrush(QtCore.Qt.red)
|
||||
elif column == 1:
|
||||
text_item.setBrush(QtCore.Qt.green)
|
||||
elif column == 2:
|
||||
text_item.setBrush(self.blue_color)
|
||||
text_item.setPos(j * self.line_height, i * self.column_width)
|
||||
column.append(text_item)
|
||||
self.columns.append(column)
|
||||
self.graphics_view.show()
|
||||
|
||||
def main():
|
||||
window = MainWindow()
|
||||
window.show()
|
||||
app.exec_()
|
||||
def add_text(self, column, text):
|
||||
text_item = self.graphics_scene.addSimpleText(text, self.default_font)
|
||||
if column == 0:
|
||||
text_item.setBrush(QtCore.Qt.red)
|
||||
elif column == 1:
|
||||
text_item.setBrush(QtCore.Qt.green)
|
||||
elif column == 2:
|
||||
text_item.setBrush(self.blue_color)
|
||||
old_item = self.columns[column].pop(0)
|
||||
self.graphics_scene.removeItem(old_item)
|
||||
self.columns[column].append(text_item)
|
||||
for ix, text_item in enumerate(self.columns[column]):
|
||||
text_item.setPos(column * self.column_width, ix * self.line_height)
|
||||
|
||||
|
||||
def render(self):
|
||||
image = QtGui.QImage(768, 576, QtGui.QImage.Format_ARGB32)
|
||||
image.fill(QtCore.Qt.black)
|
||||
painter = QtGui.QPainter(image)
|
||||
#painter.setPen(QtCore.Qt.white)
|
||||
painter.setFont(self.default_font)
|
||||
self.graphics_view.render(painter, target=QtCore.QRectF(0,0,768,576),source=QtCore.QRect(0,0,768,576))
|
||||
return image
|
||||
|
||||
|
||||
class OSCThread(threading.Thread):
|
||||
def __init__(self, args):
|
||||
super(OSCThread, self).__init__()
|
||||
self.args = args
|
||||
self.running = True
|
||||
|
||||
self.client_address = resolve_host(args.client_host, args.client_port, args.address_family)
|
||||
|
||||
self.chaosc_address = chaosc_host, chaosc_port = resolve_host(args.chaosc_host, args.chaosc_port, args.address_family)
|
||||
|
||||
self.osc_sock = socket.socket(args.address_family, 2, 17)
|
||||
self.osc_sock.bind(self.client_address)
|
||||
self.osc_sock.setblocking(0)
|
||||
|
||||
logger.info("starting up osc receiver on '%s:%d'", self.client_address[0], self.client_address[1])
|
||||
|
||||
self.subscribe_me()
|
||||
|
||||
def subscribe_me(self):
|
||||
"""Use this procedure for a quick'n dirty subscription to your chaosc instance.
|
||||
|
||||
:param chaosc_address: (chaosc_host, chaosc_port)
|
||||
:type chaosc_address: tuple
|
||||
|
||||
:param receiver_address: (host, port)
|
||||
:type receiver_address: tuple
|
||||
|
||||
:param token: token to get authorized for subscription
|
||||
:type token: str
|
||||
"""
|
||||
logger.info("%s: subscribing to '%s:%d' with label %r", datetime.now().strftime("%x %X"), self.chaosc_address[0], self.chaosc_address[1], self.args.subscriber_label)
|
||||
msg = OSCMessage("/subscribe")
|
||||
msg.appendTypedArg(self.client_address[0], "s")
|
||||
msg.appendTypedArg(self.client_address[1], "i")
|
||||
msg.appendTypedArg(self.args.authenticate, "s")
|
||||
if self.args.subscriber_label is not None:
|
||||
msg.appendTypedArg(self.args.subscriber_label, "s")
|
||||
self.osc_sock.sendto(msg.encode_osc(), self.chaosc_address)
|
||||
|
||||
|
||||
def unsubscribe_me(self):
|
||||
if self.args.keep_subscribed:
|
||||
return
|
||||
|
||||
logger.info("unsubscribing from '%s:%d'", self.chaosc_address[0], self.chaosc_address[1])
|
||||
msg = OSCMessage("/unsubscribe")
|
||||
msg.appendTypedArg(self.client_address[0], "s")
|
||||
msg.appendTypedArg(self.client_address[1], "i")
|
||||
msg.appendTypedArg(self.args.authenticate, "s")
|
||||
self.osc_sock.sendto(msg.encode_osc(), self.chaosc_address)
|
||||
|
||||
def run(self):
|
||||
|
||||
while self.running:
|
||||
try:
|
||||
reads, writes, errs = select.select([self.osc_sock], [], [], 0.01)
|
||||
except Exception, e:
|
||||
pass
|
||||
else:
|
||||
if reads:
|
||||
try:
|
||||
osc_input, address = self.osc_sock.recvfrom(8192)
|
||||
osc_address, typetags, messages = decode_osc(osc_input, 0, len(osc_input))
|
||||
queue.put_nowait((osc_address, messages))
|
||||
except Exception, e:
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
|
||||
self.unsubscribe_me()
|
||||
logger.info("OSCThread is going down")
|
||||
|
||||
|
||||
queue = Queue.Queue()
|
||||
|
||||
class MyHandler(BaseHTTPRequestHandler):
|
||||
|
||||
def do_GET(self):
|
||||
|
||||
try:
|
||||
self.path=re.sub('[^.a-zA-Z0-9]', "",str(self.path))
|
||||
if self.path=="" or self.path==None or self.path[:1]==".":
|
||||
self.send_error(403,'Forbidden')
|
||||
|
||||
|
||||
if self.path.endswith(".html"):
|
||||
directory = os.path.dirname(os.path.abspath(__file__))
|
||||
data = open(os.path.join(directory, self.path), "rb").read()
|
||||
self.send_response(200)
|
||||
self.send_header('Content-type', 'text/html')
|
||||
self.end_headers()
|
||||
self.wfile.write(data)
|
||||
elif self.path.endswith(".mjpeg"):
|
||||
self.thread = thread = OSCThread(self.server.args)
|
||||
thread.daemon = True
|
||||
thread.start()
|
||||
window = MainWindow()
|
||||
window.hide()
|
||||
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "multipart/x-mixed-replace; boundary=--aaboundary")
|
||||
self.end_headers()
|
||||
|
||||
event_loop = QtCore.QEventLoop()
|
||||
while 1:
|
||||
event_loop.processEvents()
|
||||
app.sendPostedEvents(None, 0)
|
||||
while 1:
|
||||
try:
|
||||
osc_address, args = queue.get_nowait()
|
||||
except Queue.Empty:
|
||||
break
|
||||
else:
|
||||
if "merle" in osc_address:
|
||||
window.add_text(0, "%s = %s" % (osc_address[7:], ", ".join([str(i) for i in args])))
|
||||
elif "uwe" in osc_address:
|
||||
window.add_text(1, "%s = %s" % (osc_address[5:], ", ".join([str(i) for i in args])))
|
||||
elif "bjoern" in osc_address:
|
||||
window.add_text(2, "%s = %s" % (osc_address[8:], ", ".join([str(i) for i in args])))
|
||||
|
||||
img = window.render()
|
||||
buffer = QBuffer()
|
||||
buffer.open(QIODevice.WriteOnly)
|
||||
img.save(buffer, "JPG", 50)
|
||||
img.save("/tmp/test.jpg", "JPG", 50)
|
||||
|
||||
JpegData = buffer.data()
|
||||
self.wfile.write("--aaboundary\r\nContent-Type: image/jpeg\r\nContent-length: %d\r\n\r\n%s\r\n\r\n\r\n" % (len(JpegData), JpegData))
|
||||
|
||||
JpegData = None
|
||||
buffer = None
|
||||
img = None
|
||||
time.sleep(0.06)
|
||||
|
||||
elif self.path.endswith(".jpeg"):
|
||||
directory = os.path.dirname(os.path.abspath(__file__))
|
||||
data = open(os.path.join(directory, self.path), "rb").read()
|
||||
self.send_response(200)
|
||||
self.send_header('Content-type','image/jpeg')
|
||||
self.end_headers()
|
||||
self.wfile.write(data)
|
||||
return
|
||||
except (KeyboardInterrupt, SystemError):
|
||||
#print "queue size", queue.qsize()
|
||||
if hasattr(self, "thread") and self.thread is not None:
|
||||
self.thread.running = False
|
||||
self.thread.join()
|
||||
self.thread = None
|
||||
except IOError, e:
|
||||
#print "ioerror", e, e[0]
|
||||
#print dir(e)
|
||||
if e[0] in (32, 104):
|
||||
if hasattr(self, "thread") and self.thread is not None:
|
||||
self.thread.running = False
|
||||
self.thread.join()
|
||||
self.thread = None
|
||||
else:
|
||||
pass
|
||||
#print '-'*40
|
||||
#print 'Exception happened during processing of request from'
|
||||
#traceback.print_exc() # XXX But this goes to stderr!
|
||||
#print '-'*40
|
||||
#self.send_error(404,'File Not Found: %s' % self.path)
|
||||
|
||||
|
||||
class JustAHTTPServer(HTTPServer):
|
||||
pass
|
||||
|
||||
|
||||
def main():
|
||||
arg_parser = ArgParser("dump_grabber")
|
||||
arg_parser.add_global_group()
|
||||
client_group = arg_parser.add_client_group()
|
||||
arg_parser.add_argument(client_group, '-x', "--http_host", default="::",
|
||||
help='my host, defaults to "::"')
|
||||
arg_parser.add_argument(client_group, '-X', "--http_port", default=9001,
|
||||
type=int, help='my port, defaults to 9001')
|
||||
arg_parser.add_chaosc_group()
|
||||
arg_parser.add_subscriber_group()
|
||||
args = arg_parser.finalize()
|
||||
|
||||
http_host, http_port = resolve_host(args.http_host, args.http_port, args.address_family)
|
||||
|
||||
server = JustAHTTPServer((http_host, http_port), MyHandler)
|
||||
server.address_family = args.address_family
|
||||
server.args = args
|
||||
logger.info("starting up http server on '%s:%d'", http_host, http_port)
|
||||
|
||||
server.serve_forever()
|
||||
|
||||
if ( __name__ == '__main__' ):
|
||||
main()
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from distribute_setup import use_setuptools
|
||||
use_setuptools()
|
||||
|
||||
import sys
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
extras['use_2to3'] = True
|
||||
|
||||
setup(
|
||||
name='dump_grabber',
|
||||
version="0.1",
|
||||
packages=find_packages(exclude=["scripts",]),
|
||||
|
||||
include_package_data = True,
|
||||
|
||||
exclude_package_data = {'': ['.gitignore']},
|
||||
|
||||
# installing unzipped
|
||||
zip_safe = False,
|
||||
|
||||
# predefined extension points, e.g. for plugins
|
||||
entry_points = """
|
||||
[console_scripts]
|
||||
dump_grabber = dump_grabber.main:main
|
||||
""",
|
||||
# pypi metadata
|
||||
author = "Stefan Kögl",
|
||||
|
||||
# FIXME: add author email
|
||||
author_email = "",
|
||||
description = "osc messages logging terminal as mjpeg stream, uses 3 columns",
|
||||
|
||||
# FIXME: add long_description
|
||||
long_description = """
|
||||
""",
|
||||
|
||||
# FIXME: add license
|
||||
license = "LGPL",
|
||||
|
||||
# FIXME: add keywords
|
||||
keywords = "",
|
||||
|
||||
# FIXME: add download url
|
||||
url = "",
|
||||
test_suite='tests'
|
||||
)
|
|
@ -29,6 +29,7 @@ from datetime import datetime
|
|||
import threading
|
||||
import Queue
|
||||
import traceback
|
||||
import logging
|
||||
import numpy as np
|
||||
import string
|
||||
import time
|
||||
|
@ -52,20 +53,18 @@ import pyqtgraph as pg
|
|||
from pyqtgraph.widgets.PlotWidget import PlotWidget
|
||||
|
||||
from chaosc.argparser_groups import *
|
||||
from chaosc.lib import resolve_host
|
||||
from chaosc.lib import logger, resolve_host
|
||||
|
||||
|
||||
fh = logging.FileHandler(os.path.expanduser("~/.chaosc/ekgplotter.log"))
|
||||
fh.setLevel(logging.DEBUG)
|
||||
logger.addHandler(fh)
|
||||
|
||||
try:
|
||||
from chaosc.c_osc_lib import *
|
||||
except ImportError:
|
||||
from chaosc.osc_lib import *
|
||||
|
||||
|
||||
|
||||
try:
|
||||
from chaosc.c_osc_lib import decode_osc
|
||||
from chaosc.c_osc_lib import OSCMessage, decode_osc
|
||||
except ImportError as e:
|
||||
print(e)
|
||||
from chaosc.osc_lib import decode_osc
|
||||
from chaosc.osc_lib import OSCMessage, decode_osc
|
||||
|
||||
|
||||
|
||||
|
@ -137,7 +136,7 @@ class OSCThread(threading.Thread):
|
|||
|
||||
while self.running:
|
||||
try:
|
||||
reads, writes, errs = select.select([self.osc_sock], [], [], 0.05)
|
||||
reads, writes, errs = select.select([self.osc_sock], [], [], 0.01)
|
||||
except Exception, e:
|
||||
print "select error", e
|
||||
pass
|
||||
|
@ -146,8 +145,7 @@ class OSCThread(threading.Thread):
|
|||
try:
|
||||
osc_input, address = self.osc_sock.recvfrom(8192)
|
||||
osc_address, typetags, messages = decode_osc(osc_input, 0, len(osc_input))
|
||||
if osc_address.find("ekg") != -1 or osc_address.find("plot") != -1:
|
||||
queue.put_nowait((osc_address, messages))
|
||||
queue.put_nowait((osc_address, messages))
|
||||
except Exception, e:
|
||||
print "recvfrom error", e
|
||||
else:
|
||||
|
@ -247,17 +245,20 @@ class EkgPlot(object):
|
|||
def __init__(self, actor_names, num_data, colors):
|
||||
self.plot = pg.PlotWidget()
|
||||
self.plot.hide()
|
||||
#self.plot.show()
|
||||
#self.plot.setLabel('left', "<h2>Amplitude</h2>")
|
||||
#self.plot.setLabel('bottom', "<h2><sup>Time</sup></h2>")
|
||||
self.plot.showGrid(False, False)
|
||||
self.plot.setYRange(0, 255)
|
||||
self.plot.setXRange(0, num_data)
|
||||
self.plot.resize(1280, 720)
|
||||
self.plot.resize(768, 576)
|
||||
|
||||
ba = self.plot.getAxis("bottom")
|
||||
bl = self.plot.getAxis("left")
|
||||
ba.setTicks([])
|
||||
bl.setTicks([])
|
||||
ba.hide()
|
||||
bl.hide()
|
||||
self.active_actors = list()
|
||||
|
||||
self.actors = dict()
|
||||
|
@ -386,10 +387,12 @@ class MyHandler(BaseHTTPRequestHandler):
|
|||
plotter.update(osc_address, args[0])
|
||||
|
||||
exporter = pg.exporters.ImageExporter.ImageExporter(plotter.plot.plotItem)
|
||||
exporter.parameters()['width'] = 768
|
||||
img = exporter.export("tmpfile", True)
|
||||
buffer = QBuffer()
|
||||
buffer.open(QIODevice.WriteOnly)
|
||||
img.save(buffer, "JPG", 100)
|
||||
img.save(buffer, "JPG")
|
||||
img.save("/tmp/test2.jpg", "JPG")
|
||||
|
||||
JpegData = buffer.data()
|
||||
self.wfile.write("--aaboundary\r\nContent-Type: image/jpeg\r\nContent-length: %d\r\n\r\n%s\r\n\r\n\r\n" % (len(JpegData), JpegData))
|
||||
|
@ -407,6 +410,7 @@ class MyHandler(BaseHTTPRequestHandler):
|
|||
#s = np.clip(dt*3., 0, 1)
|
||||
#fps = fps * (1-s) + (1.0/dt) * s
|
||||
#print '%0.2f fps' % fps
|
||||
time.sleep(0.05)
|
||||
|
||||
elif self.path.endswith(".jpeg"):
|
||||
directory = os.path.dirname(os.path.abspath(__file__))
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
# pykdeuic4-python2.7 -o texter_ui.py texter3.ui
|
||||
pykdeuic4-python2.7 -o text_sorter_ui.py texter4.ui
|
||||
pyuic4 -o texter_ui.py texter3.ui
|
||||
# pykdeuic4-python2.7 -o text_sorter_ui.py texter4.ui
|
||||
|
|
|
@ -12,6 +12,7 @@ from operator import itemgetter
|
|||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
|
||||
from PyKDE4.kdecore import ki18n, KCmdLineArgs, KAboutData
|
||||
from PyKDE4.kdeui import KDialog, KActionCollection, KRichTextWidget, KComboBox, KPushButton, KRichTextWidget, KMainWindow, KToolBar, KApplication, KAction, KToolBarSpacerAction, KSelectAction, KToggleAction, KShortcut
|
||||
|
||||
|
@ -34,7 +35,8 @@ for path in QtGui.QIcon.themeSearchPaths():
|
|||
print "%s/%s" % (path, QtGui.QIcon.themeName())
|
||||
|
||||
|
||||
# NOTE: if the QIcon.fromTheme method does not find any icons, you can set a theme
|
||||
# NOTE: if the QIcon.fromTheme method does not find any icons, you can use
|
||||
# qtconfig and set a default theme or copy|symlink an existing theme dir to hicolor
|
||||
# in your local icon directory:
|
||||
# ln -s /your/icon/theme/directory $HOME/.icons/hicolor
|
||||
|
||||
|
@ -94,17 +96,173 @@ class TextSorterDialog(QtGui.QWidget, Ui_TextSorterDialog):
|
|||
return True
|
||||
|
||||
def slot_show_text(self, model_index):
|
||||
self.text_preview.setTextOrHtml(self.parent().parent().model.text_db[model_index.row()][1])
|
||||
try:
|
||||
self.text_preview.setTextOrHtml(self.parent().parent().model.text_db[model_index.row()][1])
|
||||
except IndexError:
|
||||
pass
|
||||
|
||||
|
||||
def slot_removeItem(self):
|
||||
index = self.text_list.currentIndex().row()
|
||||
print "remote index", index
|
||||
self.model.removeRows(index, 1)
|
||||
index = self.model.index(0, 0)
|
||||
self.text_list.setCurrentIndex(index)
|
||||
self.text_list.clicked.emit(index)
|
||||
|
||||
class FadeAnimation(QtCore.QObject):
|
||||
animation_started = QtCore.pyqtSignal()
|
||||
animation_finished = QtCore.pyqtSignal()
|
||||
animation_stopped = QtCore.pyqtSignal()
|
||||
|
||||
def __init__(self, live_text, fade_steps=6, parent=None):
|
||||
super(FadeAnimation, self).__init__(parent)
|
||||
self.live_text = live_text
|
||||
self.fade_steps = fade_steps
|
||||
self.current_alpha = 255
|
||||
self.timer = None
|
||||
|
||||
|
||||
def start_animation(self):
|
||||
print "start_animation"
|
||||
self.animation_started.emit()
|
||||
|
||||
if self.current_alpha == 255:
|
||||
self.fade_delta = 255 / self.fade_steps
|
||||
else:
|
||||
self.fade_delta = -255 / self.fade_steps
|
||||
self.timer = QtCore.QTimer(self)
|
||||
self.timer.timeout.connect(self.slot_animate)
|
||||
self.timer.start(100)
|
||||
|
||||
|
||||
def slot_animate(self):
|
||||
print "slot_animate"
|
||||
print "current_alpha", self.current_alpha
|
||||
if self.fade_delta > 0:
|
||||
if self.current_alpha > 0:
|
||||
self.live_text.setStyleSheet("color:%d, %d, %d;" % (self.current_alpha, self.current_alpha,self.current_alpha))
|
||||
self.current_alpha -= self.fade_delta
|
||||
else:
|
||||
self.live_text.setStyleSheet("color:black;")
|
||||
self.current_alpha = 0
|
||||
self.timer.stop()
|
||||
self.timer.timeout.disconnect(self.slot_animate)
|
||||
self.timer.deleteLater()
|
||||
self.timer = None
|
||||
self.animation_finished.emit()
|
||||
print "animation_finished"
|
||||
else:
|
||||
if self.current_alpha < 255:
|
||||
self.live_text.setStyleSheet("color:%d,%d, %d;" % (self.current_alpha, self.current_alpha,self.current_alpha))
|
||||
self.current_alpha -= self.fade_delta
|
||||
else:
|
||||
self.live_text.setStyleSheet("color:white")
|
||||
self.current_alpha = 255
|
||||
self.timer.stop()
|
||||
self.timer.timeout.disconnect(self.slot_animate)
|
||||
self.timer.deleteLater()
|
||||
self.timer = None
|
||||
self.animation_finished.emit()
|
||||
print "animation_finished"
|
||||
|
||||
|
||||
|
||||
class TextAnimation(QtCore.QObject):
|
||||
animation_started = QtCore.pyqtSignal()
|
||||
animation_finished = QtCore.pyqtSignal()
|
||||
animation_stopped = QtCore.pyqtSignal()
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super(TextAnimation, self).__init__(parent)
|
||||
self.src_text_edit = None
|
||||
self.cursor_position = 0
|
||||
self.src_cursor = None
|
||||
self.dst_text_edit = None
|
||||
self.dst_cursor = None
|
||||
self.src_block = None
|
||||
self.fragment_iter = None
|
||||
self.text = None
|
||||
self.it = None
|
||||
self.timer = None
|
||||
self.dst_current_block = None
|
||||
self.fonts = dict()
|
||||
self.count = 0
|
||||
|
||||
def start_animation(self, src_text_edit, dst_text_edit, cursor_position):
|
||||
if self.timer is not None:
|
||||
return False
|
||||
self.parent().slot_clear_live()
|
||||
self.src_document = QtGui.QTextDocument(self)
|
||||
self.src_document.setHtml(src_text_edit.document().toHtml())
|
||||
self.src_text_edit = src_text_edit
|
||||
self.dst_text_edit = dst_text_edit
|
||||
self.cursor_position = cursor_position
|
||||
|
||||
self.dst_cursor = self.dst_text_edit.textCursor()
|
||||
self.dst_cursor.setPosition(self.cursor_position)
|
||||
self.timer = QtCore.QTimer(self)
|
||||
self.timer.timeout.connect(self.slot_animate)
|
||||
self.parent().slot_clear_live()
|
||||
self.timer.start(55)
|
||||
return True
|
||||
|
||||
def slot_animate(self):
|
||||
self.animation_started.emit()
|
||||
parent = self.parent()
|
||||
|
||||
if self.it is None:
|
||||
src_root_frame = self.src_document.rootFrame()
|
||||
self.it = src_root_frame.begin()
|
||||
self.dst_text_edit.document().rootFrame().setFrameFormat(src_root_frame.frameFormat())
|
||||
|
||||
if not self.it.atEnd():
|
||||
if self.src_block is None:
|
||||
self.src_block = self.it.currentBlock()
|
||||
self.fragment_iter = self.src_block.begin()
|
||||
|
||||
src_block_format = self.src_block.blockFormat()
|
||||
src_char_format = self.src_block.charFormat()
|
||||
if self.dst_current_block is not None:
|
||||
self.dst_cursor.insertBlock(src_block_format)
|
||||
self.dst_current_block = self.dst_current_block.next()
|
||||
else:
|
||||
self.dst_current_block = self.dst_cursor.block()
|
||||
self.dst_cursor.setBlockFormat(src_block_format)
|
||||
self.dst_cursor.setBlockCharFormat(src_char_format)
|
||||
self.dst_cursor.setCharFormat(src_char_format)
|
||||
|
||||
self.dst_cursor.mergeBlockCharFormat(src_char_format)
|
||||
self.dst_cursor.mergeCharFormat(src_char_format)
|
||||
self.dst_cursor.mergeBlockFormat(src_block_format)
|
||||
|
||||
if not self.fragment_iter.atEnd():
|
||||
if self.text is None:
|
||||
fragment = self.fragment_iter.fragment()
|
||||
self.text = iter(unicode(fragment.text()))
|
||||
self.fragment_char_format = fragment.charFormat()
|
||||
self.dst_cursor.setCharFormat(self.fragment_char_format)
|
||||
|
||||
try:
|
||||
char = self.text.next()
|
||||
self.dst_cursor.insertText(char)
|
||||
except StopIteration:
|
||||
self.fragment_iter += 1
|
||||
self.text = None
|
||||
else:
|
||||
self.it += 1
|
||||
self.src_block = None
|
||||
else:
|
||||
self.timer.stop()
|
||||
self.timer.timeout.disconnect(self.slot_animate)
|
||||
self.timer.deleteLater()
|
||||
self.dst_current_block = None
|
||||
self.it = None
|
||||
self.text = None
|
||||
self.animation_finished.emit()
|
||||
self.timer = None
|
||||
|
||||
self.count += 1
|
||||
|
||||
|
||||
class MainWindow(KMainWindow, Ui_MainWindow):
|
||||
def __init__(self, parent=None):
|
||||
|
@ -125,44 +283,41 @@ class MainWindow(KMainWindow, Ui_MainWindow):
|
|||
self.live_actions = list()
|
||||
self.current = 0
|
||||
self.model = TextModel(self)
|
||||
self.animation = TextAnimation(self)
|
||||
self.db_dirty = False
|
||||
self.is_animate = False
|
||||
self.fade_animation = None
|
||||
|
||||
self.is_auto_publish = False
|
||||
|
||||
self.setupUi(self)
|
||||
|
||||
self.fade_animation = FadeAnimation(self.live_text, 6, self)
|
||||
|
||||
self.font = QtGui.QFont("monospace", self.default_size)
|
||||
self.font.setStyleHint(QtGui.QFont.TypeWriter)
|
||||
|
||||
self.toolbar = KToolBar(self, True, True)
|
||||
self.toolbar.setAllowedAreas(QtCore.Qt.BottomToolBarArea)
|
||||
self.toolbar.setMovable(False)
|
||||
self.toolbar.setFloatable(False)
|
||||
self.toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)
|
||||
self.addToolBar(QtCore.Qt.BottomToolBarArea, self.toolbar)
|
||||
|
||||
self.createLiveActions()
|
||||
self.createPreviewActions()
|
||||
self.slot_load()
|
||||
self.create_toolbar()
|
||||
|
||||
self.preview_text.document().setDefaultFont(self.font)
|
||||
#self.preview_text.document().setDefaultFont(self.font)
|
||||
self.preview_text.setFont(self.font)
|
||||
self.preview_text.setRichTextSupport(KRichTextWidget.RichTextSupport(0xffffffff))
|
||||
self.preview_editor_collection = KActionCollection(self)
|
||||
self.preview_text.createActions(self.preview_editor_collection)
|
||||
|
||||
self.live_text.setRichTextSupport(KRichTextWidget.RichTextSupport(0xffffffff))
|
||||
self.live_text.document().setDefaultFont(self.font)
|
||||
#self.live_text.document().setDefaultFont(self.font)
|
||||
self.live_text.setFont(self.font)
|
||||
self.live_editor_collection = KActionCollection(self)
|
||||
self.live_text.createActions(self.live_editor_collection)
|
||||
self.filter_editor_actions()
|
||||
self.toolbar.insertSeparator(self.publish_action)
|
||||
self.toolbar.addSeparator()
|
||||
self.slot_load()
|
||||
|
||||
self.show()
|
||||
|
||||
self.save_action.triggered.connect(self.slot_save)
|
||||
#self.valign_action.triggered.connect(self.slot_valign)
|
||||
|
||||
self.publish_action.triggered.connect(self.slot_publish)
|
||||
self.clear_live_action.triggered.connect(self.slot_clear_live)
|
||||
self.clear_preview_action.triggered.connect(self.slot_clear_preview)
|
||||
|
@ -175,13 +330,14 @@ class MainWindow(KMainWindow, Ui_MainWindow):
|
|||
self.save_preview_action.triggered.connect(self.slot_save_preview_text)
|
||||
self.streaming_action.triggered.connect(self.slot_toggle_streaming)
|
||||
self.auto_publish_action.toggled.connect(self.slot_auto_publish)
|
||||
self.typer_animation_action.toggled.connect(self.slot_toggle_animation)
|
||||
self.preview_size_action.triggered[QtGui.QAction].connect(self.slot_preview_font_size)
|
||||
self.live_size_action.triggered[QtGui.QAction].connect(self.slot_live_font_size)
|
||||
|
||||
self.fade_action.triggered.connect(self.slot_fade)
|
||||
self.next_action.triggered.connect(self.slot_next_item)
|
||||
self.previous_action.triggered.connect(self.slot_previous_item)
|
||||
|
||||
app.aboutToQuit.connect(self.kill_streaming)
|
||||
self.getLiveCoords()
|
||||
print "desktop", app.desktop().availableGeometry()
|
||||
|
||||
|
@ -251,122 +407,135 @@ class MainWindow(KMainWindow, Ui_MainWindow):
|
|||
self.slot_set_live_defaults()
|
||||
|
||||
|
||||
def createLiveActions(self):
|
||||
self.toolbar.show()
|
||||
self.live_text_collection = KActionCollection(self)
|
||||
self.live_text_collection.addAssociatedWidget(self.toolbar)
|
||||
def create_toolbar(self):
|
||||
|
||||
self.clear_live_action = self.live_text_collection.addAction("clear_live_action")
|
||||
self.toolbar = KToolBar(self, True, True)
|
||||
self.toolbar.setAllowedAreas(QtCore.Qt.BottomToolBarArea)
|
||||
self.toolbar.setMovable(False)
|
||||
self.toolbar.setFloatable(False)
|
||||
self.toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)
|
||||
self.addToolBar(QtCore.Qt.BottomToolBarArea, self.toolbar)
|
||||
|
||||
self.toolbar.show()
|
||||
self.action_collection = KActionCollection(self)
|
||||
self.action_collection.addAssociatedWidget(self.toolbar)
|
||||
|
||||
self.clear_live_action = self.action_collection.addAction("clear_live_action")
|
||||
icon = QtGui.QIcon.fromTheme(_fromUtf8("edit-clear"))
|
||||
self.clear_live_action.setIcon(icon)
|
||||
self.clear_live_action.setIconText("clear live")
|
||||
self.clear_live_action.setShortcut(KShortcut(QtGui.QKeySequence(QtCore.Qt.ALT + QtCore.Qt.Key_Q)), KAction.ShortcutTypes(KAction.ActiveShortcut | KAction.DefaultShortcut))
|
||||
|
||||
|
||||
self.save_live_action = self.live_text_collection.addAction("save_live_action")
|
||||
self.save_live_action = self.action_collection.addAction("save_live_action")
|
||||
icon = QtGui.QIcon.fromTheme(_fromUtf8("document-new"))
|
||||
self.save_live_action.setIcon(icon)
|
||||
self.save_live_action.setIconText("save live")
|
||||
self.save_live_action.setShortcut(KShortcut(QtGui.QKeySequence(QtCore.Qt.ALT + QtCore.Qt.Key_W)), KAction.ShortcutTypes(KAction.ActiveShortcut | KAction.DefaultShortcut))
|
||||
|
||||
def createPreviewActions(self):
|
||||
self.toolbar.show()
|
||||
self.preview_text_collection = KActionCollection(self)
|
||||
self.preview_text_collection.addAssociatedWidget(self.toolbar)
|
||||
|
||||
self.clear_preview_action = self.preview_text_collection.addAction("clear_preview_action")
|
||||
self.clear_preview_action = self.action_collection.addAction("clear_preview_action")
|
||||
icon = QtGui.QIcon.fromTheme(_fromUtf8("edit-clear"))
|
||||
self.clear_preview_action.setIcon(icon)
|
||||
self.clear_preview_action.setIconText("clear preview")
|
||||
#self.clear_preview_action.setObjectName("clear_preview")
|
||||
self.clear_preview_action.setShortcut(KShortcut(QtGui.QKeySequence(QtCore.Qt.ALT + QtCore.Qt.Key_A)), KAction.ShortcutTypes(KAction.ActiveShortcut | KAction.DefaultShortcut))
|
||||
|
||||
|
||||
self.save_preview_action = self.preview_text_collection.addAction("save_preview_action")
|
||||
self.save_preview_action = self.action_collection.addAction("save_preview_action")
|
||||
icon = QtGui.QIcon.fromTheme(_fromUtf8("document-new"))
|
||||
self.save_preview_action.setIcon(icon)
|
||||
self.save_preview_action.setIconText("save preview")
|
||||
self.save_preview_action.setShortcut(KShortcut(QtGui.QKeySequence(QtCore.Qt.ALT + QtCore.Qt.Key_S)), KAction.ShortcutTypes(KAction.ActiveShortcut | KAction.DefaultShortcut))
|
||||
|
||||
|
||||
self.publish_action = self.preview_text_collection.addAction("publish_action")
|
||||
icon = QtGui.QIcon.fromTheme(_fromUtf8("media-playback-start"))
|
||||
self.publish_action = self.action_collection.addAction("publish_action")
|
||||
icon = QtGui.QIcon.fromTheme(_fromUtf8("edit-copy"))
|
||||
self.publish_action.setIcon(icon)
|
||||
self.publish_action.setIconText("publish")
|
||||
self.publish_action.setShortcutConfigurable(True)
|
||||
self.publish_action.setShortcut(KShortcut(QtGui.QKeySequence(QtCore.Qt.ALT + QtCore.Qt.Key_Return)), KAction.ShortcutTypes(KAction.ActiveShortcut | KAction.DefaultShortcut))
|
||||
|
||||
self.toolbar.insertSeparator(self.publish_action)
|
||||
|
||||
self.previous_action = self.preview_text_collection.addAction("previous_action")
|
||||
icon = QtGui.QIcon.fromTheme(_fromUtf8("media-skip-backward"))
|
||||
self.previous_action.setIcon(icon)
|
||||
self.previous_action.setIconText("previous")
|
||||
self.previous_action.setShortcut(KShortcut(QtGui.QKeySequence(QtCore.Qt.ALT + QtCore.Qt.Key_Left)), KAction.ShortcutTypes(KAction.ActiveShortcut | KAction.DefaultShortcut))
|
||||
|
||||
self.next_action = self.preview_text_collection.addAction("next_action")
|
||||
icon = QtGui.QIcon.fromTheme(_fromUtf8("media-skip-forward"))
|
||||
self.next_action.setIcon(icon)
|
||||
self.next_action.setIconText("next")
|
||||
self.next_action.setShortcut(KShortcut(QtGui.QKeySequence(QtCore.Qt.ALT + QtCore.Qt.Key_Right)), KAction.ShortcutTypes(KAction.ActiveShortcut | KAction.DefaultShortcut))
|
||||
|
||||
self.text_editor_action = KToggleAction(self.preview_text_collection)
|
||||
icon = QtGui.QIcon.fromTheme(_fromUtf8("document-open"))
|
||||
self.text_editor_action.setIcon(icon)
|
||||
self.text_editor_action.setIconText("sort")
|
||||
self.preview_text_collection.addAction("text editor", self.text_editor_action)
|
||||
self.text_editor_action.setObjectName("text_editor_action")
|
||||
self.text_editor_action.setShortcut(KShortcut(QtGui.QKeySequence(QtCore.Qt.CTRL + QtCore.Qt.Key_O)), KAction.ShortcutTypes(KAction.ActiveShortcut | KAction.DefaultShortcut))
|
||||
|
||||
self.auto_publish_action = KToggleAction(self.preview_text_collection)
|
||||
self.preview_text_collection.addAction("auto publish", self.auto_publish_action)
|
||||
self.auto_publish_action = KToggleAction(self.action_collection)
|
||||
self.action_collection.addAction("auto publish", self.auto_publish_action)
|
||||
icon = QtGui.QIcon.fromTheme(_fromUtf8("view-refresh"))
|
||||
self.auto_publish_action.setIcon(icon)
|
||||
self.auto_publish_action.setObjectName("auto_publish_action")
|
||||
self.auto_publish_action.setIconText("auto publish")
|
||||
self.auto_publish_action.setShortcut(KShortcut(QtGui.QKeySequence(QtCore.Qt.ALT + QtCore.Qt.Key_P)), KAction.ShortcutTypes(KAction.ActiveShortcut | KAction.DefaultShortcut))
|
||||
|
||||
self.save_action = self.preview_text_collection.addAction("save_action")
|
||||
self.typer_animation_action = KToggleAction(self.action_collection)
|
||||
icon = QtGui.QIcon.fromTheme(_fromUtf8("media-playback-stop"))
|
||||
self.typer_animation_action.setIcon(icon)
|
||||
self.typer_animation_action.setIconText("animate")
|
||||
self.typer_animation_action.setObjectName("typer_animation_action")
|
||||
self.typer_animation_action.setShortcut(KShortcut(QtGui.QKeySequence(QtCore.Qt.ALT + QtCore.Qt.Key_M)), KAction.ShortcutTypes(KAction.ActiveShortcut | KAction.DefaultShortcut))
|
||||
self.action_collection.addAction("typer_animation_action", self.typer_animation_action)
|
||||
|
||||
self.text_editor_action = self.action_collection.addAction("text_editor_action")
|
||||
icon = QtGui.QIcon.fromTheme(_fromUtf8("document-open-data"))
|
||||
self.text_editor_action.setIcon(icon)
|
||||
self.text_editor_action.setIconText("edit")
|
||||
self.text_editor_action.setShortcut(KShortcut(QtGui.QKeySequence(QtCore.Qt.CTRL + QtCore.Qt.Key_O)), KAction.ShortcutTypes(KAction.ActiveShortcut | KAction.DefaultShortcut))
|
||||
|
||||
self.toolbar.insertSeparator(self.text_editor_action)
|
||||
|
||||
self.save_action = self.action_collection.addAction("save_action")
|
||||
icon = QtGui.QIcon.fromTheme(_fromUtf8("document-save"))
|
||||
self.save_action.setIcon(icon)
|
||||
self.save_action.setIconText("save")
|
||||
self.save_action.setShortcut(KShortcut(QtGui.QKeySequence(QtCore.Qt.CTRL + QtCore.Qt.Key_S)), KAction.ShortcutTypes(KAction.ActiveShortcut | KAction.DefaultShortcut))
|
||||
|
||||
self.streaming_action = KToggleAction(self.preview_text_collection)
|
||||
self.streaming_action = KToggleAction(self.action_collection)
|
||||
icon = QtGui.QIcon.fromTheme(_fromUtf8("media-record"))
|
||||
self.streaming_action.setIcon(icon)
|
||||
self.streaming_action.setIconText("stream")
|
||||
self.streaming_action.setObjectName("stream")
|
||||
self.streaming_action.setShortcut(KShortcut(QtGui.QKeySequence(QtCore.Qt.CTRL + QtCore.Qt.Key_1)), KAction.ShortcutTypes(KAction.ActiveShortcut | KAction.DefaultShortcut))
|
||||
self.preview_text_collection.addAction("stream", self.streaming_action)
|
||||
self.action_collection.addAction("stream", self.streaming_action)
|
||||
|
||||
#self.valign_action = self.preview_text_collection.addAction("valign_action")
|
||||
#icon = QtGui.QIcon.fromTheme(_fromUtf8("media-stop"))
|
||||
#self.valign_action.setIcon(icon)
|
||||
#self.valign_action.setIconText("valign")
|
||||
#self.valign_action.setShortcut(KShortcut(QtGui.QKeySequence(QtCore.Qt.CTRL + QtCore.Qt.Key_Plus)), KAction.ShortcutTypes(KAction.ActiveShortcut | KAction.DefaultShortcut))
|
||||
spacer = KToolBarSpacerAction(self.action_collection)
|
||||
self.action_collection.addAction("1_spacer", spacer)
|
||||
|
||||
self.spacer = KToolBarSpacerAction(self.preview_text_collection)
|
||||
self.preview_text_collection.addAction("spacer", self.spacer)
|
||||
self.fade_action = self.action_collection.addAction("fade_action")
|
||||
#icon = QtGui.QIcon.fromTheme(_fromUtf8("go-previous-view-page"))
|
||||
#self.fade_action.setIcon(icon)
|
||||
self.fade_action.setIconText("fade")
|
||||
self.fade_action.setShortcut(KShortcut(QtGui.QKeySequence(QtCore.Qt.ALT + QtCore.Qt.Key_F)), KAction.ShortcutTypes(KAction.ActiveShortcut | KAction.DefaultShortcut))
|
||||
|
||||
self.text_combo = KSelectAction(self.preview_text_collection)
|
||||
self.previous_action = self.action_collection.addAction("previous_action")
|
||||
icon = QtGui.QIcon.fromTheme(_fromUtf8("go-previous-view-page"))
|
||||
self.previous_action.setIcon(icon)
|
||||
self.previous_action.setIconText("previous")
|
||||
self.previous_action.setShortcut(KShortcut(QtGui.QKeySequence(QtCore.Qt.ALT + QtCore.Qt.Key_Left)), KAction.ShortcutTypes(KAction.ActiveShortcut | KAction.DefaultShortcut))
|
||||
|
||||
self.text_combo = KSelectAction(self.action_collection)
|
||||
self.text_combo.setEditable(False)
|
||||
icon = QtGui.QIcon.fromTheme(_fromUtf8("document-open-recent"))
|
||||
self.text_combo.setIcon(icon)
|
||||
self.text_combo.setIconText("saved texts")
|
||||
self.text_combo.setObjectName("text_combo")
|
||||
self.preview_text_collection.addAction("saved texts", self.text_combo)
|
||||
self.action_collection.addAction("saved texts", self.text_combo)
|
||||
|
||||
def slot_auto_publish(self, state):
|
||||
self.is_auto_publish = bool(state)
|
||||
self.next_action = self.action_collection.addAction("next_action")
|
||||
icon = QtGui.QIcon.fromTheme(_fromUtf8("go-next-view-page"))
|
||||
self.next_action.setIcon(icon)
|
||||
self.next_action.setIconText("next")
|
||||
self.next_action.setShortcut(KShortcut(QtGui.QKeySequence(QtCore.Qt.ALT + QtCore.Qt.Key_Right)), KAction.ShortcutTypes(KAction.ActiveShortcut | KAction.DefaultShortcut))
|
||||
|
||||
self.toolbar.addSeparator()
|
||||
|
||||
|
||||
def slot_toggle_streaming(self):
|
||||
if self.ffserver is None:
|
||||
self.start_streaming()
|
||||
else:
|
||||
self.kill_streaming()
|
||||
def closeEvent(self, event):
|
||||
self.stop_streaming()
|
||||
if self.db_dirty:
|
||||
self.dialog = KDialog(self)
|
||||
self.dialog.setCaption("4.48 texter - text db not saved")
|
||||
label = QtGui.QLabel("The Text database is not saved. Do you want to save before exit?", self.dialog)
|
||||
self.dialog.setMainWidget(label)
|
||||
self.dialog.setButtons(KDialog.ButtonCodes(KDialog.Ok | KDialog.Cancel))
|
||||
self.dialog.okClicked.connect(self.slot_save)
|
||||
self.dialog.exec_()
|
||||
|
||||
|
||||
def kill_streaming(self):
|
||||
def stop_streaming(self):
|
||||
self.is_streaming = False
|
||||
if self.ffmpeg is not None:
|
||||
self.ffmpeg.kill()
|
||||
|
@ -379,7 +548,7 @@ class MainWindow(KMainWindow, Ui_MainWindow):
|
|||
public_rect = self.live_text.geometry()
|
||||
global_rect = QtCore.QRect(self.mapToGlobal(public_rect.topLeft()), self.mapToGlobal(public_rect.bottomRight()))
|
||||
self.ffserver = subprocess.Popen("ffserver -f /etc/ffserver.conf", shell=True, close_fds=True)
|
||||
self.ffmpeg = subprocess.Popen("ffmpeg -f x11grab -s 768x576 -r 25 -i :0.0+%d,%d -vcodec mjpeg -pix_fmt yuvj422p -r 25 -aspect 4:3 http://localhost:8090/webcam.ffm" % (global_rect.x()+1, global_rect.y()+1), shell=True, close_fds=True)
|
||||
self.ffmpeg = subprocess.Popen("ffmpeg -f x11grab -s 768x576 -r 30 -i :0.0+%d,%d -vcodec mjpeg -pix_fmt yuvj444p -r 30 -aspect 4:3 http://localhost:8090/webcam.ffm" % (global_rect.x()+5, global_rect.y()+5), shell=True, close_fds=True)
|
||||
self.is_streaming = True
|
||||
|
||||
def focusChanged(self, old, new):
|
||||
|
@ -402,16 +571,35 @@ class MainWindow(KMainWindow, Ui_MainWindow):
|
|||
return re.sub(" +", " ", text.replace("\n", " ")).strip()[:20]
|
||||
|
||||
|
||||
def slot_auto_publish(self, state):
|
||||
self.is_auto_publish = bool(state)
|
||||
|
||||
def slot_toggle_animation(self, state):
|
||||
self.is_animate = bool(state)
|
||||
|
||||
def slot_toggle_streaming(self):
|
||||
if self.ffserver is None:
|
||||
self.start_streaming()
|
||||
else:
|
||||
self.stop_streaming()
|
||||
|
||||
|
||||
def slot_next_item(self):
|
||||
self.current = (self.text_combo.currentItem() + 1) % len(self.model.text_db)
|
||||
self.text_combo.setCurrentItem(self.current)
|
||||
self.slot_load_preview_text(self.current)
|
||||
try:
|
||||
self.current = (self.text_combo.currentItem() + 1) % len(self.model.text_db)
|
||||
self.text_combo.setCurrentItem(self.current)
|
||||
self.slot_load_preview_text(self.current)
|
||||
except ZeroDivisionError:
|
||||
pass
|
||||
|
||||
|
||||
def slot_previous_item(self):
|
||||
self.current = (self.text_combo.currentItem() - 1) % len(self.model.text_db)
|
||||
self.text_combo.setCurrentItem(self.current)
|
||||
self.slot_load_preview_text(self.current)
|
||||
try:
|
||||
self.current = (self.text_combo.currentItem() - 1) % len(self.model.text_db)
|
||||
self.text_combo.setCurrentItem(self.current)
|
||||
self.slot_load_preview_text(self.current)
|
||||
except ZeroDivisionError:
|
||||
pass
|
||||
|
||||
|
||||
def slot_toggleToolbox(self, index):
|
||||
|
@ -422,17 +610,19 @@ class MainWindow(KMainWindow, Ui_MainWindow):
|
|||
|
||||
|
||||
def slot_publish(self):
|
||||
self.live_text.setTextOrHtml(self.preview_text.textOrHtml())
|
||||
if self.is_animate:
|
||||
self.animation.start_animation(self.preview_text, self.live_text, 0)
|
||||
else:
|
||||
self.live_text.setTextOrHtml(self.preview_text.textOrHtml())
|
||||
|
||||
|
||||
def slot_live_font_size(self, action):
|
||||
print "font_size"
|
||||
self.default_size = self.live_size_action.fontSize()
|
||||
self.slot_set_preview_defaults()
|
||||
self.slot_set_live_defaults()
|
||||
|
||||
|
||||
def slot_preview_font_size(self, action):
|
||||
print "font_size"
|
||||
self.default_size = self.preview_size_action.fontSize()
|
||||
self.slot_set_live_defaults()
|
||||
self.slot_set_preview_defaults()
|
||||
|
@ -459,9 +649,7 @@ class MainWindow(KMainWindow, Ui_MainWindow):
|
|||
def slot_set_live_defaults(self):
|
||||
self.live_center_action.setChecked(True)
|
||||
self.live_text.alignCenter()
|
||||
self.font.setPointSize(self.default_size)
|
||||
self.live_text.setFontSize(self.default_size)
|
||||
self.live_text.setFont(self.font)
|
||||
self.live_size_action.setFontSize(self.default_size)
|
||||
self.live_text.document().setDefaultFont(self.font)
|
||||
|
||||
|
@ -475,8 +663,11 @@ class MainWindow(KMainWindow, Ui_MainWindow):
|
|||
self.preview_text.clear()
|
||||
self.slot_set_preview_defaults()
|
||||
|
||||
def slot_fade(self):
|
||||
if self.fade_animation.timer is None:
|
||||
self.fade_animation.start_animation()
|
||||
|
||||
def fill_combo_box(self):
|
||||
print "fill_combo_box"
|
||||
self.text_combo.clear()
|
||||
for preview, text in self.model.text_db:
|
||||
self.text_combo.addAction(preview)
|
||||
|
@ -506,7 +697,7 @@ class MainWindow(KMainWindow, Ui_MainWindow):
|
|||
return
|
||||
self.preview_text.setTextOrHtml(text)
|
||||
if self.is_auto_publish:
|
||||
self.live_text.setTextOrHtml(text)
|
||||
self.slot_publish()
|
||||
|
||||
|
||||
def slot_save_live_text(self):
|
||||
|
@ -530,6 +721,7 @@ class MainWindow(KMainWindow, Ui_MainWindow):
|
|||
self.model.modelReset.emit()
|
||||
action = self.text_combo.addAction(preview)
|
||||
self.text_combo.setCurrentAction(action)
|
||||
self.db_dirty = True
|
||||
|
||||
def slot_save_preview_text(self):
|
||||
text = self.preview_text.toHtml()
|
||||
|
@ -539,20 +731,14 @@ class MainWindow(KMainWindow, Ui_MainWindow):
|
|||
return
|
||||
old_item = self.model.text_by_preview(preview)
|
||||
if old_item is not None:
|
||||
suffix = 1
|
||||
while 1:
|
||||
tmp_preview = "%s_%d" % (preview, suffix)
|
||||
tmp = self.model.text_by_preview(tmp_preview)
|
||||
if tmp is None:
|
||||
preview = tmp_preview
|
||||
break
|
||||
else:
|
||||
suffix += 1
|
||||
|
||||
self.model.text_db.append([preview, text])
|
||||
self.model.modelReset.emit()
|
||||
action = self.text_combo.addAction(preview)
|
||||
self.text_combo.setCurrentAction(action)
|
||||
ix, old_preview, old_text = old_item
|
||||
self.model.text_db[ix][1] = text
|
||||
else:
|
||||
self.model.text_db.append([preview, text])
|
||||
action = self.text_combo.addAction(preview)
|
||||
self.model.modelReset.emit()
|
||||
self.text_combo.setCurrentAction(action)
|
||||
self.db_dirty = True
|
||||
|
||||
def slot_save(self):
|
||||
path = os.path.expanduser("~/.texter")
|
||||
|
@ -564,58 +750,8 @@ class MainWindow(KMainWindow, Ui_MainWindow):
|
|||
return
|
||||
else:
|
||||
cPickle.dump(self.model.text_db, f, cPickle.HIGHEST_PROTOCOL)
|
||||
self.db_dirty = False
|
||||
|
||||
#def slot_valign(self):
|
||||
#fm = QtGui.QFontMetrics(self.font)
|
||||
##h = fn.height()
|
||||
##max_lines = 576 / h
|
||||
##text = unicode(self.preview_text.toPlainText())
|
||||
##text = text.strip().strip("\n")
|
||||
##lines = text.count("\n") + 1
|
||||
##self.preview_text.setTextOrHtml("\n" * ((max_lines - lines) / 2) + text)
|
||||
##self.statusBar().showMessage("text lines = %d, line height = %d, max lines = %d" % (lines, h, max_lines))
|
||||
#text_layout = QtGui.QTextLayout(self.preview_text.textOrHtml(), self.font, self.preview_text)
|
||||
|
||||
##self.text_combo.setCurrentAction(action)
|
||||
|
||||
#margin = 10.
|
||||
#radius = min(self.preview_text.width()/2.0, self.preview_text.height()/2.0) - margin
|
||||
#print "radius", type(radius), radius
|
||||
|
||||
#lineHeight = float(fm.height())
|
||||
#print "lineHeight", type(lineHeight), lineHeight
|
||||
#y = 0.
|
||||
|
||||
#text_layout.beginLayout()
|
||||
|
||||
#while 1:
|
||||
#line = text_layout.createLine()
|
||||
#if not line.isValid():
|
||||
#break
|
||||
|
||||
#x1 = max(0.0, pow(pow(radius,2)-pow(radius-y,2), 0.5))
|
||||
#x2 = max(0.0, pow(pow(radius,2)-pow(radius-(y+lineHeight),2), 0.5))
|
||||
#x = max(x1, x2) + margin
|
||||
#lineWidth = (self.preview_text.width() - margin) - x
|
||||
|
||||
#line.setLineWidth(lineWidth)
|
||||
#line.setPosition(QtCore.QPointF(x, margin+y))
|
||||
#y += line.height()
|
||||
|
||||
#text_layout.endLayout()
|
||||
|
||||
#painter = QtGui.QPainter()
|
||||
#painter.begin(self.preview_text)
|
||||
#painter.setRenderHint(QtGui.QPainter.Antialiasing)
|
||||
#painter.fillRect(self.rect(), QtCore.Qt.black)
|
||||
#painter.setBrush(QtGui.QBrush(QtCore.Qt.white))
|
||||
#painter.setPen(QtGui.QPen(QtCore.Qt.white))
|
||||
#text_layout.draw(painter, QtCore.QPoint(0,0))
|
||||
|
||||
#painter.setBrush(QtGui.QBrush(QtGui.QColor("#a6ce39")))
|
||||
#painter.setPen(QtGui.QPen(QtCore.Qt.black))
|
||||
#painter.drawEllipse(QtCore.QRectF(-radius, margin, 2*radius, 2*radius))
|
||||
#painter.end()
|
||||
|
||||
def slot_open_dialog(self):
|
||||
self.dialog = KDialog(self)
|
||||
|
@ -627,9 +763,11 @@ class MainWindow(KMainWindow, Ui_MainWindow):
|
|||
global_width = rect.width()
|
||||
global_height = rect.height()
|
||||
x = global_width - pos_x - 10
|
||||
self.dialog.setFixedSize(x, global_height-40);
|
||||
#self.dialog.setFixedSize(x, global_height-40)
|
||||
self.dialog.okClicked.connect(self.fill_combo_box)
|
||||
self.dialog.exec_()
|
||||
self.fill_combo_box()
|
||||
self.dialog.deleteLater()
|
||||
self.dialog = None
|
||||
|
||||
def slot_load(self):
|
||||
path = os.path.expanduser("~/.texter")
|
||||
|
@ -648,7 +786,7 @@ class MainWindow(KMainWindow, Ui_MainWindow):
|
|||
self.fill_combo_box()
|
||||
self.text_combo.setCurrentItem(0)
|
||||
self.slot_load_preview_text(0)
|
||||
self.slot_load_preview_text(0)
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
|
|
|
@ -61,21 +61,16 @@ class TextModel(QtCore.QAbstractTableModel):
|
|||
return True
|
||||
|
||||
def removeRows(self, row, count, parent=QtCore.QModelIndex()):
|
||||
print "removeRows", row, count
|
||||
print map(itemgetter(0), self.text_db)
|
||||
self.beginRemoveRows(QtCore.QModelIndex(), row, row+count+1)
|
||||
for i in range(row, row+count):
|
||||
print "del", i, self.text_db[row]
|
||||
self.text_db.pop(row)
|
||||
print "after"
|
||||
print map(itemgetter(0), self.text_db)
|
||||
self.endRemoveRows()
|
||||
return True
|
||||
|
||||
|
||||
def text_by_preview(self, preview):
|
||||
for title, text in self.text_db:
|
||||
for ix, (title, text) in enumerate(self.text_db):
|
||||
if title == preview:
|
||||
return title, text
|
||||
return ix, title, text
|
||||
return None
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
# coding=UTF-8
|
||||
#
|
||||
# Generated by pykdeuic4 from texter4.ui on Wed Apr 16 00:27:54 2014
|
||||
# Generated by pykdeuic4 from texter4.ui on Mon Apr 21 01:34:50 2014
|
||||
#
|
||||
# WARNING! All changes to this file will be lost.
|
||||
from PyKDE4 import kdecore
|
||||
|
@ -25,54 +25,207 @@ except AttributeError:
|
|||
class Ui_TextSorterDialog(object):
|
||||
def setupUi(self, TextSorterDialog):
|
||||
TextSorterDialog.setObjectName(_fromUtf8("TextSorterDialog"))
|
||||
TextSorterDialog.resize(662, 716)
|
||||
TextSorterDialog.resize(1084, 633)
|
||||
self.verticalLayout = QtGui.QVBoxLayout(TextSorterDialog)
|
||||
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
|
||||
self.horizontalLayout_2 = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
|
||||
self.text_list = QtGui.QListView(TextSorterDialog)
|
||||
self.text_list.setMinimumSize(QtCore.QSize(0, 576))
|
||||
self.splitter = QtGui.QSplitter(TextSorterDialog)
|
||||
self.splitter.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.splitter.setObjectName(_fromUtf8("splitter"))
|
||||
self.text_list = QtGui.QListView(self.splitter)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
|
||||
sizePolicy.setHorizontalStretch(1)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.text_list.sizePolicy().hasHeightForWidth())
|
||||
self.text_list.setSizePolicy(sizePolicy)
|
||||
self.text_list.setMinimumSize(QtCore.QSize(200, 576))
|
||||
self.text_list.setMaximumSize(QtCore.QSize(16777215, 576))
|
||||
palette = QtGui.QPalette()
|
||||
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(128, 125, 123))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(128, 125, 123))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)
|
||||
self.text_list.setPalette(palette)
|
||||
self.text_list.setObjectName(_fromUtf8("text_list"))
|
||||
self.horizontalLayout_2.addWidget(self.text_list)
|
||||
self.text_preview = KRichTextWidget(TextSorterDialog)
|
||||
self.text_preview = KRichTextWidget(self.splitter)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
|
||||
sizePolicy.setHorizontalStretch(100)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.text_preview.sizePolicy().hasHeightForWidth())
|
||||
self.text_preview.setSizePolicy(sizePolicy)
|
||||
self.text_preview.setMinimumSize(QtCore.QSize(0, 576))
|
||||
self.text_preview.setMaximumSize(QtCore.QSize(16777215, 576))
|
||||
self.text_preview.setMaximumSize(QtCore.QSize(768, 576))
|
||||
palette = QtGui.QPalette()
|
||||
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.BrightText, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)
|
||||
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.AlternateBase, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipBase, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.BrightText, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Shadow, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.AlternateBase, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipBase, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.BrightText, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Shadow, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.AlternateBase, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipBase, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText, brush)
|
||||
self.text_preview.setPalette(palette)
|
||||
self.text_preview.setReadOnly(True)
|
||||
self.text_preview.setObjectName(_fromUtf8("text_preview"))
|
||||
self.horizontalLayout_2.addWidget(self.text_preview)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout_2)
|
||||
self.verticalLayout.addWidget(self.splitter)
|
||||
self.kbuttongroup = KButtonGroup(TextSorterDialog)
|
||||
self.kbuttongroup.setObjectName(_fromUtf8("kbuttongroup"))
|
||||
self.horizontalLayout = QtGui.QHBoxLayout(self.kbuttongroup)
|
||||
|
|
|
@ -217,11 +217,8 @@
|
|||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="cursor" stdset="0">
|
||||
<cursorShape>BlankCursor</cursorShape>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
|
@ -324,14 +321,11 @@
|
|||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>preview text</string>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>662</width>
|
||||
<height>716</height>
|
||||
<width>1084</width>
|
||||
<height>633</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -15,144 +15,587 @@
|
|||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QListView" name="text_list">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>576</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>576</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>128</red>
|
||||
<green>125</green>
|
||||
<blue>123</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="KRichTextWidget" name="text_preview">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>576</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>576</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="QListView" name="text_list">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>576</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>576</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>128</red>
|
||||
<green>125</green>
|
||||
<blue>123</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>128</red>
|
||||
<green>125</green>
|
||||
<blue>123</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="KRichTextWidget" name="text_preview">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>100</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>576</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>768</width>
|
||||
<height>576</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Button">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Light">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Midlight">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Dark">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Mid">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="BrightText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Shadow">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="AlternateBase">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ToolTipBase">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>220</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ToolTipText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Button">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Light">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Midlight">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Dark">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Mid">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="BrightText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Shadow">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="AlternateBase">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ToolTipBase">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>220</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ToolTipText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Button">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Light">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Midlight">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Dark">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Mid">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="BrightText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Shadow">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="AlternateBase">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ToolTipBase">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>220</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ToolTipText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="KButtonGroup" name="kbuttongroup">
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# Form implementation generated from reading ui file 'texter3.ui'
|
||||
#
|
||||
# Created: Wed Apr 16 20:48:51 2014
|
||||
# Created: Mon Apr 21 22:38:51 2014
|
||||
# by: PyQt4 UI code generator 4.10.3
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
@ -57,8 +57,8 @@ class Ui_MainWindow(object):
|
|||
self.horizontalLayout = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
|
||||
self.live_text = KRichTextWidget(self.centralwidget)
|
||||
self.live_text.setMinimumSize(QtCore.QSize(772,580))
|
||||
self.live_text.setMaximumSize(QtCore.QSize(772,580))
|
||||
self.live_text.setMinimumSize(QtCore.QSize(775, 578))
|
||||
self.live_text.setMaximumSize(QtCore.QSize(775, 578))
|
||||
palette = QtGui.QPalette()
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
|
@ -97,8 +97,7 @@ class Ui_MainWindow(object):
|
|||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Link, brush)
|
||||
self.live_text.setPalette(palette)
|
||||
self.live_text.viewport().setProperty("cursor", QtGui.QCursor(QtCore.Qt.BlankCursor))
|
||||
self.live_text.setAutoFillBackground(True)
|
||||
self.live_text.setAutoFillBackground(False)
|
||||
self.live_text.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||
self.live_text.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||
self.live_text.setAcceptRichText(True)
|
||||
|
@ -113,7 +112,7 @@ class Ui_MainWindow(object):
|
|||
sizePolicy.setHeightForWidth(self.preview_text.sizePolicy().hasHeightForWidth())
|
||||
self.preview_text.setSizePolicy(sizePolicy)
|
||||
self.preview_text.setMinimumSize(QtCore.QSize(300, 577))
|
||||
self.preview_text.setMaximumSize(QtCore.QSize(772,580))
|
||||
self.preview_text.setMaximumSize(QtCore.QSize(769, 577))
|
||||
palette = QtGui.QPalette()
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
|
@ -134,8 +133,7 @@ class Ui_MainWindow(object):
|
|||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)
|
||||
self.preview_text.setPalette(palette)
|
||||
self.preview_text.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
||||
self.preview_text.setAutoFillBackground(True)
|
||||
self.preview_text.setAutoFillBackground(False)
|
||||
self.preview_text.setFrameShape(QtGui.QFrame.StyledPanel)
|
||||
self.preview_text.setAcceptRichText(True)
|
||||
self.preview_text.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByKeyboard|QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextBrowserInteraction|QtCore.Qt.TextEditable|QtCore.Qt.TextEditorInteraction|QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse)
|
||||
|
|
Loading…
Reference in New Issue