diff --git a/texter/texter/448_texter.db b/texter/texter/448_texter.db
new file mode 100644
index 0000000..2604dd1
Binary files /dev/null and b/texter/texter/448_texter.db differ
diff --git a/texter/texter/build.sh b/texter/texter/build.sh
index 8bd8f91..6e82d76 100644
--- a/texter/texter/build.sh
+++ b/texter/texter/build.sh
@@ -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
diff --git a/texter/texter/main.py b/texter/texter/main.py
index 0699560..5011cd6 100644
--- a/texter/texter/main.py
+++ b/texter/texter/main.py
@@ -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,188 +42,406 @@ 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)
self.accepted.connect(self.slot_saveToDb)
-
+
def fill_list(self):
for preview, text in self.parent().text_db:
self.text_list.insertItem(preview)
-
+
def slot_text_up(self):
pass
-
+
def slot_text_down(self):
pass
-
+
def slot_show_text(self, model_index):
self.text_preview.setTextOrHtml(self.parent().text_db[model_index.row()][1])
-
+
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])
-
- 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_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
+ 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
+
self.text_db.append((preview, text))
-
- def slot_save_preview(self):
- print "slot save live 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.preview_text.toPlainText()[:10]
- print "represent", preview
+ 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():
diff --git a/texter/texter/text_sorter.ui b/texter/texter/text_sorter.ui
index fd34eea..02e6b16 100644
--- a/texter/texter/text_sorter.ui
+++ b/texter/texter/text_sorter.ui
@@ -17,7 +17,11 @@
-
-
-
+
+
+ KEditListWidget::Remove|KEditListWidget::UpDown
+
+
-
diff --git a/texter/texter/text_sorter_ui.py b/texter/texter/text_sorter_ui.py
index ff3790d..12029ec 100644
--- a/texter/texter/text_sorter_ui.py
+++ b/texter/texter/text_sorter_ui.py
@@ -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
diff --git a/texter/texter/texter.desktop b/texter/texter/texter.desktop
index 65c05a9..774cffc 100755
--- a/texter/texter/texter.desktop
+++ b/texter/texter/texter.desktop
@@ -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;
diff --git a/texter/texter/texter.ui b/texter/texter/texter.ui
new file mode 100644
index 0000000..335ee8d
--- /dev/null
+++ b/texter/texter/texter.ui
@@ -0,0 +1,920 @@
+
+
+ MainWindow
+
+
+
+ 0
+ 0
+ 1207
+ 634
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 0
+ 0
+ 255
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 0
+ 0
+ 255
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 255
+ 255
+ 220
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 0
+ 0
+ 255
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 0
+ 0
+ 255
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 255
+ 255
+ 220
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 0
+ 255
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 255
+ 255
+ 220
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+
+ 4.48 Texter
+
+
+
+
-
+
+
-
+
+
+ &Title
+
+
+ item_title
+
+
+
+ -
+
+
+
+ 100
+ 0
+
+
+
+
+ -
+
+
+ P&osition
+
+
+ item_position_input
+
+
+
+ -
+
+
+
+ 50
+ 16777215
+
+
+
+
+ -
+
+
+ S&election
+
+
+ edit_item_selection
+
+
+
+ -
+
+
+
+ 100
+ 0
+
+
+
+
+ -
+
+
+ &Add / Change
+
+
+
+ -
+
+
+ &Remove
+
+
+
+ -
+
+
+ Sa&ve
+
+
+
+ -
+
+
+ &Publish
+
+
+ false
+
+
+
+ -
+
+
+ Clear Live
+
+
+
+ -
+
+
+ Clear Preview
+
+
+
+ -
+
+
+ Previous
+
+
+
+ -
+
+
+ Next
+
+
+
+
+
+
+ -
+
+
+ A&uto Publish
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 768
+ 576
+
+
+
+
+ 768
+ 576
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 0
+ 0
+ 255
+
+
+
+
+
+
+ 0
+ 0
+ 255
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 0
+ 0
+ 255
+
+
+
+
+
+
+ 0
+ 0
+ 255
+
+
+
+
+
+
+
+
+ 128
+ 125
+ 123
+
+
+
+
+
+
+ 128
+ 125
+ 123
+
+
+
+
+
+
+ 0
+ 0
+ 255
+
+
+
+
+
+
+ 0
+ 0
+ 255
+
+
+
+
+
+
+
+
+ Monospace
+ 22
+
+
+
+ true
+
+
+ true
+
+
+ Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextEditable|Qt::TextEditorInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse
+
+
+
+ -
+
+
+
+ 400
+ 576
+
+
+
+
+ 768
+ 576
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 0
+ 0
+ 255
+
+
+
+
+
+
+ 0
+ 0
+ 255
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 0
+ 0
+ 255
+
+
+
+
+
+
+ 0
+ 0
+ 255
+
+
+
+
+
+
+
+
+ 128
+ 125
+ 123
+
+
+
+
+
+
+ 128
+ 125
+ 123
+
+
+
+
+
+
+ 0
+ 0
+ 255
+
+
+
+
+
+
+ 0
+ 0
+ 255
+
+
+
+
+
+
+
+
+ Monospace
+ 22
+
+
+
+ Qt::ActionsContextMenu
+
+
+ true
+
+
+ QFrame::StyledPanel
+
+
+ true
+
+
+ Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextEditable|Qt::TextEditorInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse
+
+
+
+
+
+
+
+
+
+
+
+ KRichTextEdit
+ KTextEdit
+
+
+
+ KTextEdit
+ QTextEdit
+
+
+
+ KRichTextWidget
+ KRichTextEdit
+
+
+
+ KIntNumInput
+ QWidget
+
+
+
+
+ item_title
+ item_position_input
+ remove_item_button
+
+
+
+
diff --git a/texter/texter/texter2.ui b/texter/texter/texter2.ui
index b177683..c4e8da1 100644
--- a/texter/texter/texter2.ui
+++ b/texter/texter/texter2.ui
@@ -7,7 +7,7 @@
0
0
1554
- 658
+ 617
@@ -105,14 +105,17 @@
22
+
+ BlankCursor
+
- live text
+
-
+
-
+
false
@@ -130,7 +133,7 @@
-
- clear live text
+ clear live text [F1]
@@ -144,15 +147,13 @@
-
-
-
+
+ save live text [F2]
-
-
- -
-
-
- background
+
+
+
+
@@ -169,6 +170,19 @@
+ -
+
+
+ starts/stops live textfield streaming [F9]
+
+
+
+
+
+ true
+
+
+
@@ -220,13 +234,13 @@
-
- clear preview text
+ clear preview text [F4]
- status tip2
+
- whatsthis2
+
@@ -238,10 +252,22 @@
+ -
+
+
+
+
+
+
+
+
-
+
+ ArrowCursor
+
- go live with text
+ go live with text [F5]
@@ -253,20 +279,6 @@
- -
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
@@ -275,23 +287,51 @@
-
-
-
- background
+
+
+ load previous text [F6]
+
+
+
+
+
-
-
+
+
+ load next text [F7]
+
-
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ true
-
+
+ edit sorting of saved texts [F10]
+
-
+
+
+
@@ -314,7 +354,6 @@
-
@@ -323,9 +362,9 @@
- KColorButton
- QPushButton
-
+ KComboBox
+ QComboBox
+
KPushButton
@@ -346,7 +385,6 @@
live_text
preview_text
- publish_button
clear_preview_button
clear_live_button
diff --git a/texter/texter/texter3.ui b/texter/texter/texter3.ui
new file mode 100644
index 0000000..a85a248
--- /dev/null
+++ b/texter/texter/texter3.ui
@@ -0,0 +1,203 @@
+
+
+ MainWindow
+
+
+
+ 0
+ 0
+ 1554
+ 584
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+
+
+ 169
+ 167
+ 167
+
+
+
+
+
+
+ 244
+ 244
+ 244
+
+
+
+
+
+
+
+ 4.48 Texter
+
+
+
+ :/texter/icon.png:/texter/icon.png
+
+
+
+ -
+
+
+
+ 768
+ 576
+
+
+
+
+ 768
+ 576
+
+
+
+
+ Monospace
+ 22
+
+
+
+ BlankCursor
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+ true
+
+
+ Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextEditable|Qt::TextEditorInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse
+
+
+ KRichTextWidget::SupportAlignment|KRichTextWidget::SupportChangeListStyle|KRichTextWidget::SupportFontFamily|KRichTextWidget::SupportFontSize|KRichTextWidget::SupportIndentLists|KRichTextWidget::SupportTextForegroundColor
+
+
+
+ -
+
+
+
+ 400
+ 576
+
+
+
+
+ 768
+ 576
+
+
+
+
+ Monospace
+ 22
+
+
+
+ Qt::ActionsContextMenu
+
+
+ preview text
+
+
+ false
+
+
+ QFrame::StyledPanel
+
+
+ true
+
+
+ Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextEditable|Qt::TextEditorInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse
+
+
+ KRichTextWidget::SupportAlignment|KRichTextWidget::SupportChangeListStyle|KRichTextWidget::SupportFontFamily|KRichTextWidget::SupportFontSize|KRichTextWidget::SupportTextForegroundColor
+
+
+
+
+
+
+
+
+ KRichTextEdit
+ KTextEdit
+
+
+
+ KTextEdit
+ QTextEdit
+
+
+
+ KRichTextWidget
+ KRichTextEdit
+
+
+
+
+ live_text
+ preview_text
+
+
+
+
+
+
diff --git a/texter/texter/texter_ui.py b/texter/texter/texter_ui.py
index ec9116f..b4d1db0 100644
--- a/texter/texter/texter_ui.py
+++ b/texter/texter/texter_ui.py
@@ -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