new version

This commit is contained in:
Stefan Kögl 2014-04-14 12:50:53 +02:00
parent d4d4154f92
commit 012c90744e
10 changed files with 1651 additions and 339 deletions

BIN
texter/texter/448_texter.db Normal file

Binary file not shown.

View File

@ -1,2 +1,2 @@
pyuic4 -o texter_ui.py texter2.ui
pyuic4 -o text_sorter_ui.py text_sorter.ui
pykdeuic4-python2.7 -o texter_ui.py texter3.ui
pykdeuic4-python2.7 -o text_sorter_ui.py text_sorter.ui

View File

@ -1,20 +1,40 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
import cPickle
import os.path
import PyQt4.uic
from PyQt4 import QtCore, QtGui
from PyKDE4.kdeui import KActionCollection, KRichTextWidget
from texter_ui import Ui_MainWindow
from text_sorter_ui import Ui_text_sorter_dialog
import re
import subprocess
import sys
from operator import itemgetter
import cPickle
app = QtGui.QApplication([])
from PyQt4 import QtCore, QtGui
from PyKDE4.kdecore import ki18n, KCmdLineArgs, KAboutData
from PyKDE4.kdeui import KActionCollection, KRichTextWidget, KComboBox, KPushButton, KRichTextWidget, KMainWindow, KToolBar, KApplication, KAction, KToolBarSpacerAction, KSelectAction, KToggleAction, KShortcut
from texter_ui import Ui_MainWindow, _fromUtf8
from text_sorter_ui import Ui_text_sorter_dialog
appName = "texter"
catalog = "448texter"
programName = ki18n("4.48 Psychose Texter")
version = "0.1"
aboutData = KAboutData(appName, catalog, programName, version)
KCmdLineArgs.init (sys.argv, aboutData)
app = KApplication()
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
# in your local icon directory:
# ln -s /your/icon/theme/directory $HOME/.icons/hicolor
class TextSorterDialog(QtGui.QDialog, Ui_text_sorter_dialog):
def __init__(self, parent = None):
@ -22,6 +42,7 @@ class TextSorterDialog(QtGui.QDialog, Ui_text_sorter_dialog):
# setup the ui
self.setupUi(self)
self.setModal(False)
self.fill_list()
self.text_list.listView().clicked.connect(self.slot_show_text)
@ -42,168 +63,385 @@ class TextSorterDialog(QtGui.QDialog, Ui_text_sorter_dialog):
def slot_saveToDb(self):
data = list()
def findInDb(title):
for preview, text in self.parent().text_db:
if title == preview:
return text
return None
for i in self.text_list.items():
text = findInDb(i)
data.append((i, text))
self.parent().text_db = data
print self.parent().text_db
self.parent().text_combo.clear()
parent = self.parent()
for preview in self.text_list.items():
pre, text = parent.text_by_preview(preview)
print "pre, text", pre, preview
data.append((preview, text))
parent.text_combo.addAction(preview)
parent.text_combo.setCurrentItem(0)
parent.text_db = data
parent.slot_load_preview_text(0)
parent.slot_set_live_defaults()
parent.slot_set_preview_defaults()
class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
def __init__(self, parent = None):
class MainWindow(KMainWindow, Ui_MainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.setWindowFlags(self.windowFlags() | QtCore.Qt.FramelessWindowHint)
self.is_streaming = False
self.ffserver = None
self.ffmpeg = None
self.live_center_action = None
self.preview_center_action = None
self.live_size_action = None
self.preview_font_action = None
self.live_font_action = None
self.preview_size_action = None
self.default_size = 28
self.default_font = None
self.default_align_text = "format_align_center"
self.preview_actions = list()
self.live_actions = list()
self.is_published = False
self.current = 0
self.text_db = list()
self.is_auto_publish = False
# setup the ui
self.setupUi(self)
self.font = QtGui.QFont("monospace", 22)
self.font.setStyleHint(QtGui.QFont.TypeWriter)
self.preview_text.document().setDefaultFont(self.font)
self.toolbar = KToolBar(self, True, True)
self.toolbar.setAllowedAreas(QtCore.Qt.BottomToolBarArea)
self.toolbar.setMovable(False)
self.toolbar.setFloatable(False)
self.addToolBar(QtCore.Qt.BottomToolBarArea, self.toolbar)
self.createLiveActions()
self.createPreviewActions()
self.preview_text.document().setDefaultFont(self.font)
self.preview_text.setRichTextSupport(KRichTextWidget.RichTextSupport(0xffffffff))
self.preview_action_collection = KActionCollection(self)
self.preview_text.createActions(self.preview_action_collection)
self.preview_toolbar = QtGui.QToolBar("preview editor toolbar", self)
self.preview_toolbar.setAllowedAreas(QtCore.Qt.BottomToolBarArea)
self.preview_toolbar.setMovable(False)
self.preview_toolbar.setFloatable(False)
#self.addToolBar(QtCore.Qt.BottomToolBarArea, self.preview_toolbar)
for action in self.preview_action_collection.actions():
self.preview_toolbar.addAction(action)
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_action_collection = KActionCollection(self)
self.live_text.createActions(self.live_action_collection)
self.live_toolbar = QtGui.QToolBar("live editor toolbar", self)
self.live_toolbar.setAllowedAreas(QtCore.Qt.BottomToolBarArea)
self.live_toolbar.setMovable(False)
self.live_toolbar.setFloatable(False)
#self.addToolBar(QtCore.Qt.RightToolBarArea, self.live_toolbar)
for action in self.live_action_collection.actions():
self.live_toolbar.addAction(action)
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.show()
self.is_published = False
self.current = 0
#self.add_button.clicked.connect(self.slot_addText)
#self.save_button.clicked.connect(self.slot_save)
self.publish_button.clicked.connect(self.slot_publish)
self.clear_live_button.clicked.connect(self.slot_clear_live)
self.clear_preview_button.clicked.connect(self.slot_clear_preview)
#self.remove_item_button.clicked.connect(self.slot_removeItem)
#self.edit_item_selection.activated.connect(self.slot_editLoadItem)
#self.auto_publish_checkbox.clicked.connect(self.slot_publish)
self.save_action.triggered.connect(self.slot_save)
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)
#self.remove_item_button.triggered.connect(self.slot_removeItem)
self.text_combo.triggered[int].connect(self.slot_load_preview_text)
app.focusChanged.connect(self.focusChanged)
self.text_open_button.clicked.connect(self.slot_open_dialog)
self.live_save_button.clicked.connect(self.slot_save_live)
self.preview_save_button.clicked.connect(self.slot_save_preview)
self.text_editor_action.triggered.connect(self.slot_open_dialog)
self.save_live_action.triggered.connect(self.slot_save_live_text)
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.slot_load()
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()
self.text_db = list()
#self.slot_load()
self.next_button.setShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Space))
self.next_button.clicked.connect(self.slot_next_item)
self.previous_button.setShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Backspace))
self.previous_button.clicked.connect(self.slot_previous_item)
def getLiveCoords(self):
public_rect = self.live_text.geometry()
global_rect = QtCore.QRect(self.mapToGlobal(public_rect.topLeft()), self.mapToGlobal(public_rect.bottomRight()))
self.statusBar().showMessage("geometry to cast: %d, %d, %d, %d" % (global_rect.x(), global_rect.y(), global_rect.width(), global_rect.height()))
x = global_rect.x()
y = global_rect.y()
self.statusBar().showMessage("live text editor dimensions: x=%r, y=%r, width=%r, height=%r" % (x, y, global_rect.width(), global_rect.height()))
def filter_editor_actions(self):
disabled_action_names = [
"action_to_plain_text",
"format_painter",
"direction_ltr",
"direction_rtl",
"format_font_family",
"format_font_size",
"format_text_background_color",
"format_list_indent_more",
"format_list_indent_less",
"format_text_bold",
"format_text_underline",
"format_text_strikeout",
"format_text_italic",
"format_align_right",
"format_align_justify",
"manage_link",
"format_text_subscript",
"format_text_superscript",
"insert_horizontal_rule"
]
for action in self.live_editor_collection.actions():
text = str(action.objectName())
if text in disabled_action_names:
action.setVisible(False)
if text == self.default_align_text:
self.live_center_action = action
elif text == "format_font_size":
self.live_size_action = action
elif text == "format_font_family":
self.live_font_action = action
for action in self.preview_editor_collection.actions():
text = str(action.objectName())
if text in disabled_action_names:
action.setVisible(False)
if text == self.default_align_text:
self.preview_center_action = action
elif text == "format_font_size":
self.preview_size_action = action
elif text == "format_font_family":
self.preview_font_action = action
print "live_center_action", self.live_center_action
print "live_size_action", self.live_size_action
print "preview_center_action", self.preview_center_action
print "preview_size_action", self.preview_size_action
#print "widgets", self.preview_font_action.associatedGraphicsWidgets()
self.slot_set_preview_defaults()
self.slot_set_live_defaults()
def createLiveActions(self):
self.toolbar.show()
self.live_text_collection = KActionCollection(self)
self.live_text_collection.addAssociatedWidget(self.toolbar)
self.clear_live_action = self.live_text_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")
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")
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")
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.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.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.text_combo = KSelectAction(self.preview_text_collection)
self.text_combo.setEditable(False)
self.text_combo.setComboWidth(100)
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.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)
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.save_action = self.preview_text_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.live_text_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.live_text_collection.addAction("stream", self.streaming_action)
def slot_auto_publish(self, state):
print "auto_publish", state
self.is_auto_publish = bool(state)
def slot_toggle_streaming(self):
if self.ffserver is None:
self.start_streaming()
else:
self.kill_streaming()
def kill_streaming(self):
self.is_streaming = False
if self.ffmpeg is not None:
self.ffmpeg.kill()
self.ffmpeg = None
if self.ffserver is not None:
self.ffserver.kill()
self.ffserver = None
def start_streaming(self):
public_rect = self.live_text.geometry()
global_rect = QtCore.QRect(self.mapToGlobal(public_rect.topLeft()), self.mapToGlobal(public_rect.bottomRight()))
self.ffserver = subprocess.Popen("/usr/bin/ffserver -f /etc/ffserver.conf", shell=True, close_fds=True)
self.ffmpeg = subprocess.Popen("/usr/bin/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(), global_rect.y()), shell=True, close_fds=True)
self.is_streaming = True
def focusChanged(self, old, new):
print "focusChanged", old, new
if new == self.preview_text:
try:
self.removeToolBar(self.live_toolbar)
except Exception, e:
print e
try:
self.removeToolBar(self.preview_toolbar)
except Exception, e:
print e
try:
self.addToolBar(QtCore.Qt.BottomToolBarArea, self.preview_toolbar)
self.preview_toolbar.show()
except Exception, e:
print e
self.live_editor_collection.clearAssociatedWidgets()
self.preview_editor_collection.addAssociatedWidget(self.toolbar)
elif new == self.live_text:
try:
self.removeToolBar(self.live_toolbar)
except Exception, e:
print e
try:
self.removeToolBar(self.preview_toolbar)
except Exception, e:
print e
try:
self.addToolBar(QtCore.Qt.BottomToolBarArea, self.live_toolbar)
self.live_toolbar.show()
except Exception, e:
print e
self.preview_editor_collection.clearAssociatedWidgets()
self.live_editor_collection.addAssociatedWidget(self.toolbar)
def custom_clear(self, cursor):
cursor.beginEditBlock()
cursor.movePosition(QtGui.QTextCursor.Start);
cursor.movePosition(QtGui.QTextCursor.End, QtGui.QTextCursor.KeepAnchor);
cursor.removeSelectedText()
cursor.endEditBlock()
def get_preview_text(self, text):
return re.sub(" +", " ", text.replace("\n", " "))[:20]
def text_by_preview(self, preview):
for title, text in self.text_db:
if title == preview:
return title, text
return None
def title_by_index(self, ix):
for title, (text, index) in self.items.iteritems():
if index == ix:
return title
return None
def slot_next_item(self):
print "slot_next_item"
#print "current_title", self.current_title, self.current_text
self.current = (self.current + 1) % len(self.text_db)
self.preview_text.setTextOrHtml(self.text_db[self.current][1])
print "current", self.current
self.current = (self.text_combo.currentItem() + 1) % len(self.text_db)
self.text_combo.setCurrentItem(self.current)
self.slot_load_preview_text(self.current)
def slot_previous_item(self):
print "slot_previous_item"
#print "current_title", self.current_title, self.current_text
self.current = (self.current - 1) % len(self.text_db)
self.preview_text.setTextOrHtml(self.text_db[self.current][1])
self.current = (self.text_combo.currentItem() - 1) % len(self.text_db)
self.text_combo.setCurrentItem(self.current)
self.slot_load_preview_text(self.current)
print "current", self.current
def slot_toggleToolbox(self, index):
print "slot_toggleToolbox"
#print "current_title", self.current_title, self.current_text
if index == 0:
self.toolBar.setEnabled(True)
else:
self.toolBar.setEnabled(False)
def slot_publish(self):
print "slot_publish"
public_rect = self.live_text.geometry()
global_rect = QtCore.QRect(self.mapToGlobal(public_rect.topLeft()), self.mapToGlobal(public_rect.bottomRight()))
self.statusBar().showMessage("geometry to cast: %d, %d, %d, %d" % (global_rect.x(), global_rect.y(), global_rect.width(), global_rect.height()))
def slot_publish(self):
self.live_text.setTextOrHtml(self.preview_text.textOrHtml())
self.is_published = True
def slot_toggle_publish(self, state=None):
#QPropertyAnimation animation(self.public_text.palette(), "geometry");
#animation.setDuration(10000);
#animation.setStartValue(QRect(0, 0, 100, 30));
#animation.setEndValue(QRect(250, 250, 100, 30));
#animation.start();
print "slot_toggle_publish", state
#print "current_title", self.current_title, self.current_text
if state:
self.slot_publish()
else:
self.slot_clear()
self.slot_clear_live()
def slot_set_preview_defaults(self):
self.preview_center_action.setChecked(True)
self.preview_text.alignCenter()
self.preview_size_action.setFontSize(self.default_size)
#self.preview_size_action.fontSizeChanged.emit(self.default_size)
self.preview_text.setFontSize(self.default_size)
def slot_set_live_defaults(self):
self.live_center_action.setChecked(True)
self.live_text.alignCenter()
self.live_size_action.setFontSize(self.default_size)
self.live_text.setFontSize(self.default_size)
def slot_clear_live(self):
self.live_text.clear()
self.default_size = self.live_size_action.fontSize()
self.is_published = False
cursor = self.live_text.textCursor()
self.custom_clear(cursor)
self.slot_set_live_defaults()
def slot_clear_preview(self):
self.preview_text.clear()
#self.preview_text.document().clear()
self.default_size = self.preview_size_action.fontSize()
cursor = self.preview_text.textCursor()
self.custom_clear(cursor)
self.slot_set_preview_defaults()
def slot_removeItem(self):
@ -219,86 +457,76 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.item_title.clear()
self.item_position_input.setValue(0)
def slot_editLoadItem(self, index):
print "slot_editLoadItem", index
itemText = self.edit_item_selection.itemText(index)
position, title = itemText.split(": ", 1)
text, position = self.items[title]
def slot_load_preview_text(self, index):
preview, text = self.text_db[index]
self.preview_text.setTextOrHtml(text)
self.item_title.setText(title)
self.item_position_input.setValue(position)
if self.is_auto_publish:
self.live_text.setTextOrHtml(text)
def slot_showLoadItem(self, index):
public_rect = self.show_public_text.geometry()
global_rect = QtCore.QRect(self.mapToGlobal(public_rect.topLeft()), self.mapToGlobal(public_rect.bottomRight()))
self.statusBar().showMessage("geometry to cast: %d, %d, %d, %d" % (global_rect.x(), global_rect.y(), global_rect.width(), global_rect.height()))
item = self.item_list.item(index)
if item is None:
return
title = item.text()
text, index = self.items[title]
if self.auto_publish_checkbox.isChecked():
self.live_text.setTextOrHtml(self.preview_text.textOrHtml())
def title_by_index(self, ix):
for title, (text, index) in self.items.iteritems():
if index == ix:
return title
return None
def slot_changeItem(self, old_title):
print "slot_changeItem"
text, index = self.items.pop(old_title)
new_text = self.preview_text.textOrHtml()
new_title = self.item_title.text()
self.items[new_title] = (new_text, index)
self.show_public_text.setTextOrHtml(new_text)
self.item_title.setText(new_title)
self.edit_item_selection.setItemText(index, "%d: %s" % (index, new_title))
def slot_save_live(self):
print "slot save live text"
def slot_save_live_text(self):
text = self.live_text.toHtml()
preview = self.live_text.toPlainText()[:10]
print "represent", preview
self.text_db.append((preview, text))
preview = self.get_preview_text(unicode(self.live_text.toPlainText()))
if not preview:
return
old_item = self.text_by_preview(preview)
if old_item is not None:
suffix = 1
while 1:
tmp_preview = "%s_%d" % (preview, suffix)
tmp = self.text_by_preview(tmp_preview)
if tmp is None:
preview = tmp_preview
break
else:
suffix += 1
def slot_save_preview(self):
print "slot save live text"
text = self.preview_text.toHtml()
preview = self.preview_text.toPlainText()[:10]
print "represent", preview
self.text_db.append((preview, text))
action = self.text_combo.addAction(preview)
self.text_combo.setCurrentAction(action)
def slot_save_preview_text(self):
text = self.preview_text.toHtml()
preview = self.get_preview_text(unicode(self.preview_text.toPlainText()))
if not preview:
return
old_item = self.text_by_preview(preview)
if old_item is not None:
suffix = 1
while 1:
tmp_preview = "%s_%d" % (preview, suffix)
tmp = self.text_by_preview(tmp_preview)
if tmp is None:
preview = tmp_preview
break
else:
suffix += 1
self.text_db.append((preview, text))
action = self.text_combo.addAction(preview)
self.text_combo.setCurrentAction(action)
def slot_save(self):
cPickle.dump(self.items, open("448_texter.db", "w"), cPickle.HIGHEST_PROTOCOL)
cPickle.dump(self.text_db, open("448_texter.db", "w"), cPickle.HIGHEST_PROTOCOL)
def slot_open_dialog(self):
self.dialog = TextSorterDialog(self)
print "modal", self.dialog.isModal()
self.dialog.open()
def slot_load(self):
try:
self.items = cPickle.load(open("448_texter.db"))
self.text_db = cPickle.load(open("448_texter.db"))
except Exception, e:
print e
data = list()
for title, (text, index) in self.items.iteritems():
data.append((title, text, index))
for title, text in self.text_db:
data.append((title, text))
self.text_combo.addAction(title)
data = sorted(data, key=itemgetter(2))
for title, text, index in data:
self.edit_item_selection.addItem("%d: %s" % (index, title))
self.edit_item_selection.setCurrentIndex(0)
title, text, index = data[0]
self.preview_text.setTextOrHtml(text)
self.item_position_input.setValue(index)
self.item_title.setText(title)
self.text_combo.setCurrentItem(0)
self.slot_load_preview_text(0)
def main():

View File

@ -17,7 +17,11 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="KEditListWidget" name="text_list"/>
<widget class="KEditListWidget" name="text_list">
<property name="buttons">
<set>KEditListWidget::Remove|KEditListWidget::UpDown</set>
</property>
</widget>
</item>
<item>
<widget class="KRichTextWidget" name="text_preview"/>

View File

@ -1,12 +1,11 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'text_sorter.ui'
#!/usr/bin/env python
# coding=UTF-8
#
# Created: Sat Apr 12 14:47:10 2014
# by: PyQt4 UI code generator 4.10.3
# Generated by pykdeuic4 from text_sorter.ui on Mon Apr 14 08:37:13 2014
#
# WARNING! All changes made in this file will be lost!
# WARNING! All changes to this file will be lost.
from PyKDE4 import kdecore
from PyKDE4 import kdeui
from PyQt4 import QtCore, QtGui
try:
@ -32,6 +31,7 @@ class Ui_text_sorter_dialog(object):
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.text_list = KEditListWidget(text_sorter_dialog)
self.text_list.setButtons(KEditListWidget.Buttons(KEditListWidget.Remove|KEditListWidget.UpDown))
self.text_list.setObjectName(_fromUtf8("text_list"))
self.horizontalLayout.addWidget(self.text_list)
self.text_preview = KRichTextWidget(text_sorter_dialog)
@ -50,6 +50,6 @@ class Ui_text_sorter_dialog(object):
QtCore.QMetaObject.connectSlotsByName(text_sorter_dialog)
def retranslateUi(self, text_sorter_dialog):
text_sorter_dialog.setWindowTitle(_translate("text_sorter_dialog", "Dialog", None))
text_sorter_dialog.setWindowTitle(kdecore.i18n(_fromUtf8("Dialog")))
from PyKDE4.kdeui import KEditListWidget, KRichTextWidget

View File

@ -8,12 +8,12 @@ Icon=texter_icon
MimeType=
Name[de]=texter
Name=texter
Path=
Path=/usr/bin/texter
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
Categories=AudioVideo;Recorder;
X-DBUS-ServiceName=
X-DBUS-StartupType=none
X-KDE-SubstituteUID=false
X-KDE-Username=
Keywords=Capture;Broadcast;

920
texter/texter/texter.ui Normal file
View File

@ -0,0 +1,920 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1207</width>
<height>634</height>
</rect>
</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>255</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>255</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>255</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>255</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>255</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="windowTitle">
<string>4.48 Texter</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&amp;Title</string>
</property>
<property name="buddy">
<cstring>item_title</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="item_title">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>P&amp;osition</string>
</property>
<property name="buddy">
<cstring>item_position_input</cstring>
</property>
</widget>
</item>
<item>
<widget class="KIntNumInput" name="item_position_input">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>S&amp;election</string>
</property>
<property name="buddy">
<cstring>edit_item_selection</cstring>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="edit_item_selection">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="add_button">
<property name="text">
<string>&amp;Add / Change</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="remove_item_button">
<property name="text">
<string>&amp;Remove</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="save_button">
<property name="text">
<string>Sa&amp;ve</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="publish_button">
<property name="text">
<string>&amp;Publish</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="clear_live_button">
<property name="text">
<string>Clear Live</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="clear_preview_button">
<property name="text">
<string>Clear Preview</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="previous_button">
<property name="text">
<string>Previous</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="next_button">
<property name="text">
<string>Next</string>
</property>
<property name="shortcut">
<string comment=" "/>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="auto_publish_checkbox">
<property name="text">
<string>A&amp;uto Publish</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="KRichTextWidget" name="live_text">
<property name="minimumSize">
<size>
<width>768</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="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>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</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>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</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>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<family>Monospace</family>
<pointsize>22</pointsize>
</font>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="acceptRichText">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextEditable|Qt::TextEditorInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
<widget class="KRichTextWidget" name="preview_text">
<property name="minimumSize">
<size>
<width>400</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="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>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</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>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</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>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<family>Monospace</family>
<pointsize>22</pointsize>
</font>
</property>
<property name="contextMenuPolicy">
<enum>Qt::ActionsContextMenu</enum>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="acceptRichText">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextEditable|Qt::TextEditorInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<customwidgets>
<customwidget>
<class>KRichTextEdit</class>
<extends>KTextEdit</extends>
<header>krichtextedit.h</header>
</customwidget>
<customwidget>
<class>KTextEdit</class>
<extends>QTextEdit</extends>
<header>ktextedit.h</header>
</customwidget>
<customwidget>
<class>KRichTextWidget</class>
<extends>KRichTextEdit</extends>
<header>krichtextwidget.h</header>
</customwidget>
<customwidget>
<class>KIntNumInput</class>
<extends>QWidget</extends>
<header>knuminput.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>item_title</tabstop>
<tabstop>item_position_input</tabstop>
<tabstop>remove_item_button</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>1554</width>
<height>658</height>
<height>617</height>
</rect>
</property>
<property name="palette">
@ -105,14 +105,17 @@
<pointsize>22</pointsize>
</font>
</property>
<property name="cursor" stdset="0">
<cursorShape>BlankCursor</cursorShape>
</property>
<property name="toolTip">
<string comment="tooltip1" extracomment="tooltip comment">live text</string>
<string/>
</property>
<property name="statusTip">
<string comment="statustip1" extracomment="status tip comment"/>
<string/>
</property>
<property name="whatsThis">
<string comment="whatsthis1" extracomment="whats this comment"/>
<string/>
</property>
<property name="autoFillBackground">
<bool>false</bool>
@ -130,7 +133,7 @@
<item>
<widget class="KPushButton" name="clear_live_button">
<property name="toolTip">
<string>clear live text</string>
<string>clear live text [F1]</string>
</property>
<property name="icon">
<iconset theme="edit-clear">
@ -144,15 +147,13 @@
</item>
<item>
<widget class="KPushButton" name="live_save_button">
<property name="icon">
<iconset theme="document-save"/>
<property name="toolTip">
<string>save live text [F2]</string>
</property>
</widget>
</item>
<item>
<widget class="KColorButton" name="live_color">
<property name="text">
<string>background</string>
<property name="icon">
<iconset theme="document-save">
<normaloff/>
</iconset>
</property>
</widget>
</item>
@ -169,6 +170,19 @@
</property>
</spacer>
</item>
<item>
<widget class="KPushButton" name="streaming_button">
<property name="toolTip">
<string>starts/stops live textfield streaming [F9]</string>
</property>
<property name="icon">
<iconset theme="media-record"/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
@ -220,13 +234,13 @@
<item>
<widget class="KPushButton" name="clear_preview_button">
<property name="toolTip">
<string>clear preview text</string>
<string>clear preview text [F4]</string>
</property>
<property name="statusTip">
<string>status tip2</string>
<string/>
</property>
<property name="whatsThis">
<string>whatsthis2</string>
<string/>
</property>
<property name="icon">
<iconset theme="edit-clear">
@ -238,10 +252,22 @@
</property>
</widget>
</item>
<item>
<widget class="KPushButton" name="preview_save_button">
<property name="icon">
<iconset theme="document-save">
<normaloff/>
</iconset>
</property>
</widget>
</item>
<item>
<widget class="KPushButton" name="publish_button">
<property name="cursor">
<cursorShape>ArrowCursor</cursorShape>
</property>
<property name="toolTip">
<string>go live with text</string>
<string>go live with text [F5]</string>
</property>
<property name="icon">
<iconset theme="media-playback-start">
@ -253,20 +279,6 @@
</property>
</widget>
</item>
<item>
<widget class="KPushButton" name="previous_button">
<property name="icon">
<iconset theme="media-skip-backward"/>
</property>
</widget>
</item>
<item>
<widget class="KPushButton" name="next_button">
<property name="icon">
<iconset theme="media-skip-forward"/>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
@ -275,23 +287,51 @@
</widget>
</item>
<item>
<widget class="KColorButton" name="preview_color">
<property name="text">
<string>background</string>
<widget class="KPushButton" name="previous_button">
<property name="toolTip">
<string>load previous text [F6]</string>
</property>
<property name="icon">
<iconset theme="media-skip-backward">
<normaloff/>
</iconset>
</property>
</widget>
</item>
<item>
<widget class="KPushButton" name="preview_save_button">
<widget class="KPushButton" name="next_button">
<property name="toolTip">
<string>load next text [F7]</string>
</property>
<property name="icon">
<iconset theme="document-save"/>
<iconset theme="media-skip-forward">
<normaloff/>
</iconset>
</property>
</widget>
</item>
<item>
<widget class="KComboBox" name="text_combo">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="KPushButton" name="text_open_button">
<property name="toolTip">
<string>edit sorting of saved texts [F10]</string>
</property>
<property name="icon">
<iconset theme="document-open"/>
<iconset theme="document-open">
<normaloff/>
</iconset>
</property>
</widget>
</item>
@ -314,7 +354,6 @@
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<customwidgets>
<customwidget>
@ -323,9 +362,9 @@
<header>krichtextedit.h</header>
</customwidget>
<customwidget>
<class>KColorButton</class>
<extends>QPushButton</extends>
<header>kcolorbutton.h</header>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
<customwidget>
<class>KPushButton</class>
@ -346,7 +385,6 @@
<tabstops>
<tabstop>live_text</tabstop>
<tabstop>preview_text</tabstop>
<tabstop>publish_button</tabstop>
<tabstop>clear_preview_button</tabstop>
<tabstop>clear_live_button</tabstop>
</tabstops>

203
texter/texter/texter3.ui Normal file
View File

@ -0,0 +1,203 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1554</width>
<height>584</height>
</rect>
</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>169</red>
<green>167</green>
<blue>167</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>244</red>
<green>244</green>
<blue>244</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="windowTitle">
<string>4.48 Texter</string>
</property>
<property name="windowIcon">
<iconset resource="texter.qrc">
<normaloff>:/texter/icon.png</normaloff>:/texter/icon.png</iconset>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="KRichTextWidget" name="live_text">
<property name="minimumSize">
<size>
<width>768</width>
<height>576</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>768</width>
<height>576</height>
</size>
</property>
<property name="font">
<font>
<family>Monospace</family>
<pointsize>22</pointsize>
</font>
</property>
<property name="cursor" stdset="0">
<cursorShape>BlankCursor</cursorShape>
</property>
<property name="toolTip">
<string/>
</property>
<property name="statusTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="acceptRichText">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextEditable|Qt::TextEditorInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
<property name="richTextSupport">
<set>KRichTextWidget::SupportAlignment|KRichTextWidget::SupportChangeListStyle|KRichTextWidget::SupportFontFamily|KRichTextWidget::SupportFontSize|KRichTextWidget::SupportIndentLists|KRichTextWidget::SupportTextForegroundColor</set>
</property>
</widget>
</item>
<item>
<widget class="KRichTextWidget" name="preview_text">
<property name="minimumSize">
<size>
<width>400</width>
<height>576</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>768</width>
<height>576</height>
</size>
</property>
<property name="font">
<font>
<family>Monospace</family>
<pointsize>22</pointsize>
</font>
</property>
<property name="contextMenuPolicy">
<enum>Qt::ActionsContextMenu</enum>
</property>
<property name="toolTip">
<string>preview text</string>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="acceptRichText">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextEditable|Qt::TextEditorInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
<property name="richTextSupport">
<set>KRichTextWidget::SupportAlignment|KRichTextWidget::SupportChangeListStyle|KRichTextWidget::SupportFontFamily|KRichTextWidget::SupportFontSize|KRichTextWidget::SupportTextForegroundColor</set>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>KRichTextEdit</class>
<extends>KTextEdit</extends>
<header>krichtextedit.h</header>
</customwidget>
<customwidget>
<class>KTextEdit</class>
<extends>QTextEdit</extends>
<header>ktextedit.h</header>
</customwidget>
<customwidget>
<class>KRichTextWidget</class>
<extends>KRichTextEdit</extends>
<header>krichtextwidget.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>live_text</tabstop>
<tabstop>preview_text</tabstop>
</tabstops>
<resources>
<include location="texter.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1,12 +1,11 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'texter2.ui'
#!/usr/bin/env python
# coding=UTF-8
#
# Created: Sat Apr 12 14:47:10 2014
# by: PyQt4 UI code generator 4.10.3
# Generated by pykdeuic4 from texter3.ui on Mon Apr 14 08:37:12 2014
#
# WARNING! All changes made in this file will be lost!
# WARNING! All changes to this file will be lost.
from PyKDE4 import kdecore
from PyKDE4 import kdeui
from PyQt4 import QtCore, QtGui
try:
@ -26,7 +25,7 @@ except AttributeError:
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(1554, 658)
MainWindow.resize(1554, 584)
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
@ -52,10 +51,8 @@ class Ui_MainWindow(object):
MainWindow.setWindowIcon(icon)
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.horizontalLayout_3 = QtGui.QHBoxLayout(self.centralwidget)
self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
self.verticalLayout = QtGui.QVBoxLayout()
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.horizontalLayout = QtGui.QHBoxLayout(self.centralwidget)
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.live_text = KRichTextWidget(self.centralwidget)
self.live_text.setMinimumSize(QtCore.QSize(768, 576))
self.live_text.setMaximumSize(QtCore.QSize(768, 576))
@ -63,34 +60,16 @@ class Ui_MainWindow(object):
font.setFamily(_fromUtf8("Monospace"))
font.setPointSize(22)
self.live_text.setFont(font)
self.live_text.viewport().setProperty("cursor", QtGui.QCursor(QtCore.Qt.BlankCursor))
self.live_text.setToolTip(_fromUtf8(""))
self.live_text.setStatusTip(_fromUtf8(""))
self.live_text.setWhatsThis(_fromUtf8(""))
self.live_text.setAutoFillBackground(False)
self.live_text.setAcceptRichText(True)
self.live_text.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByKeyboard|QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextBrowserInteraction|QtCore.Qt.TextEditable|QtCore.Qt.TextEditorInteraction|QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse)
self.live_text.setRichTextSupport(KRichTextWidget.RichTextSupportValues(KRichTextWidget.SupportAlignment|KRichTextWidget.SupportChangeListStyle|KRichTextWidget.SupportFontFamily|KRichTextWidget.SupportFontSize|KRichTextWidget.SupportIndentLists|KRichTextWidget.SupportTextForegroundColor))
self.live_text.setObjectName(_fromUtf8("live_text"))
self.verticalLayout.addWidget(self.live_text)
self.horizontalLayout_2 = QtGui.QHBoxLayout()
self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
self.clear_live_button = KPushButton(self.centralwidget)
icon = QtGui.QIcon.fromTheme(_fromUtf8("edit-clear"))
self.clear_live_button.setIcon(icon)
self.clear_live_button.setObjectName(_fromUtf8("clear_live_button"))
self.horizontalLayout_2.addWidget(self.clear_live_button)
self.live_save_button = KPushButton(self.centralwidget)
icon = QtGui.QIcon.fromTheme(_fromUtf8("document-save"))
self.live_save_button.setIcon(icon)
self.live_save_button.setObjectName(_fromUtf8("live_save_button"))
self.horizontalLayout_2.addWidget(self.live_save_button)
self.live_color = KColorButton(self.centralwidget)
self.live_color.setObjectName(_fromUtf8("live_color"))
self.horizontalLayout_2.addWidget(self.live_color)
spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem)
self.verticalLayout.addLayout(self.horizontalLayout_2)
self.horizontalLayout_3.addLayout(self.verticalLayout)
self.verticalLayout_2 = QtGui.QVBoxLayout()
self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
self.horizontalLayout.addWidget(self.live_text)
self.preview_text = KRichTextWidget(self.centralwidget)
self.preview_text.setMinimumSize(QtCore.QSize(400, 576))
self.preview_text.setMaximumSize(QtCore.QSize(768, 576))
@ -103,78 +82,18 @@ class Ui_MainWindow(object):
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)
self.preview_text.setRichTextSupport(KRichTextWidget.RichTextSupportValues(KRichTextWidget.SupportAlignment|KRichTextWidget.SupportChangeListStyle|KRichTextWidget.SupportFontFamily|KRichTextWidget.SupportFontSize|KRichTextWidget.SupportTextForegroundColor))
self.preview_text.setObjectName(_fromUtf8("preview_text"))
self.verticalLayout_2.addWidget(self.preview_text)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.clear_preview_button = KPushButton(self.centralwidget)
icon = QtGui.QIcon.fromTheme(_fromUtf8("edit-clear"))
self.clear_preview_button.setIcon(icon)
self.clear_preview_button.setObjectName(_fromUtf8("clear_preview_button"))
self.horizontalLayout.addWidget(self.clear_preview_button)
self.publish_button = KPushButton(self.centralwidget)
icon = QtGui.QIcon.fromTheme(_fromUtf8("media-playback-start"))
self.publish_button.setIcon(icon)
self.publish_button.setObjectName(_fromUtf8("publish_button"))
self.horizontalLayout.addWidget(self.publish_button)
self.previous_button = KPushButton(self.centralwidget)
icon = QtGui.QIcon.fromTheme(_fromUtf8("media-skip-backward"))
self.previous_button.setIcon(icon)
self.previous_button.setObjectName(_fromUtf8("previous_button"))
self.horizontalLayout.addWidget(self.previous_button)
self.next_button = KPushButton(self.centralwidget)
icon = QtGui.QIcon.fromTheme(_fromUtf8("media-skip-forward"))
self.next_button.setIcon(icon)
self.next_button.setObjectName(_fromUtf8("next_button"))
self.horizontalLayout.addWidget(self.next_button)
self.line = QtGui.QFrame(self.centralwidget)
self.line.setFrameShape(QtGui.QFrame.VLine)
self.line.setFrameShadow(QtGui.QFrame.Sunken)
self.line.setObjectName(_fromUtf8("line"))
self.horizontalLayout.addWidget(self.line)
self.preview_color = KColorButton(self.centralwidget)
self.preview_color.setObjectName(_fromUtf8("preview_color"))
self.horizontalLayout.addWidget(self.preview_color)
self.preview_save_button = KPushButton(self.centralwidget)
icon = QtGui.QIcon.fromTheme(_fromUtf8("document-save"))
self.preview_save_button.setIcon(icon)
self.preview_save_button.setObjectName(_fromUtf8("preview_save_button"))
self.horizontalLayout.addWidget(self.preview_save_button)
self.text_open_button = KPushButton(self.centralwidget)
icon = QtGui.QIcon.fromTheme(_fromUtf8("document-open"))
self.text_open_button.setIcon(icon)
self.text_open_button.setObjectName(_fromUtf8("text_open_button"))
self.horizontalLayout.addWidget(self.text_open_button)
spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem1)
self.verticalLayout_2.addLayout(self.horizontalLayout)
self.horizontalLayout_3.addLayout(self.verticalLayout_2)
self.horizontalLayout.addWidget(self.preview_text)
MainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QtGui.QStatusBar(MainWindow)
self.statusbar.setObjectName(_fromUtf8("statusbar"))
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
MainWindow.setTabOrder(self.live_text, self.preview_text)
MainWindow.setTabOrder(self.preview_text, self.publish_button)
MainWindow.setTabOrder(self.publish_button, self.clear_preview_button)
MainWindow.setTabOrder(self.clear_preview_button, self.clear_live_button)
def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(_translate("MainWindow", "4.48 Texter", None))
self.live_text.setToolTip(_translate("MainWindow", "live text", "tooltip1"))
self.clear_live_button.setToolTip(_translate("MainWindow", "clear live text", None))
self.clear_live_button.setShortcut(_translate("MainWindow", "F1", None))
self.live_color.setText(_translate("MainWindow", "background", None))
self.preview_text.setToolTip(_translate("MainWindow", "preview text", None))
self.clear_preview_button.setToolTip(_translate("MainWindow", "clear preview text", None))
self.clear_preview_button.setStatusTip(_translate("MainWindow", "status tip2", None))
self.clear_preview_button.setWhatsThis(_translate("MainWindow", "whatsthis2", None))
self.clear_preview_button.setShortcut(_translate("MainWindow", "F2", None))
self.publish_button.setToolTip(_translate("MainWindow", "go live with text", None))
self.publish_button.setShortcut(_translate("MainWindow", "F4", None))
self.preview_color.setText(_translate("MainWindow", "background", None))
MainWindow.setWindowTitle(kdecore.i18n(_fromUtf8("4.48 Texter")))
self.preview_text.setToolTip(kdecore.i18n(_fromUtf8("preview text")))
from PyKDE4.kdeui import KColorButton, KPushButton, KRichTextWidget
import texter_rc
from PyKDE4.kdeui import KRichTextWidget
import texter