From 2fb5177a6c459e6d53b1c6a87eb17098d3735868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20K=C3=B6gl?= Date: Sat, 12 Apr 2014 09:42:03 +0200 Subject: [PATCH] new version of texter with icon and optimized ui for live texting --- texter/main.py | 224 ------ texter/texter.ui | 1556 ------------------------------------ texter/texter/__init__.py | 1 + texter/texter/icon.png | Bin 0 -> 556 bytes texter/texter/main.py | 266 ++++++ texter/texter/texter.qrc | 5 + texter/texter/texter2.ui | 641 +++++++++++++++ texter/texter/texter_rc.py | 75 ++ texter/texter/texter_ui.py | 259 ++++++ 9 files changed, 1247 insertions(+), 1780 deletions(-) delete mode 100644 texter/main.py delete mode 100644 texter/texter.ui create mode 100644 texter/texter/__init__.py create mode 100644 texter/texter/icon.png create mode 100644 texter/texter/main.py create mode 100644 texter/texter/texter.qrc create mode 100644 texter/texter/texter2.ui create mode 100644 texter/texter/texter_rc.py create mode 100644 texter/texter/texter_ui.py diff --git a/texter/main.py b/texter/main.py deleted file mode 100644 index 6c0ce10..0000000 --- a/texter/main.py +++ /dev/null @@ -1,224 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -import PyQt4.uic -from PyQt4 import QtCore, QtGui -from PyKDE4.kdeui import KActionCollection, KRichTextWidget - -MainWindowForm, MainWindowBase = PyQt4.uic.loadUiType('texter.ui') - -from operator import itemgetter -import cPickle - -class MainWindow(MainWindowBase, MainWindowForm): - def __init__(self, parent = None): - super(MainWindow, self).__init__(parent) - - - # setup the ui - self.setupUi(self) - #self.show_public_text.setRichTextSupport(KRichTextWidget.RichTextSupport(0xffffffff)) - self.edit_private_text.setRichTextSupport(KRichTextWidget.RichTextSupport(0xffffffff)) - self.edit_action_collection = KActionCollection(self) - self.edit_private_text.createActions(self.edit_action_collection) - for action in self.edit_action_collection.actions(): - self.toolBar.addAction(action) - - self.current_text = None - self.current_title = None - self.current_index = None - self.is_published = False - - self.tabWidget.currentChanged.connect(self.slot_toggleToolbox) - self.add_button.clicked.connect(self.slot_addText) - self.save_button.clicked.connect(self.slot_save) - self.publish_button.toggled.connect(self.slot_toggle_publish) - self.remove_item_button.clicked.connect(self.slot_removeItem) - self.edit_item_selection.activated.connect(self.slot_editLoadItem) - self.item_list.currentRowChanged.connect(self.slot_showLoadItem) - self.auto_publish_checkbox.toggled.connect(self.slot_toggle_publish) - - self.items = dict() - 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 slot_next_item(self): - print "slot_next_item" - print "current_title", self.current_title, self.current_text - index = (self.item_list.currentRow() + 1) % self.item_list.count() - self.item_list.setCurrentRow(index) - self.edit_item_selection.setCurrentIndex(index) - self.slot_editLoadItem(index) - self.slot_showLoadItem(index) - - def slot_previous_item(self): - print "slot_previous_item" - print "current_title", self.current_title, self.current_text - index = (self.item_list.currentRow() - 1) % self.item_list.count() - self.item_list.setCurrentRow(index) - self.edit_item_selection.setCurrentIndex(index) - self.slot_editLoadItem(index) - self.slot_showLoadItem(index) - - 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): - #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_publish" - print "current_title", self.current_title, self.current_text - self.show_public_text.setTextOrHtml(self.current_text) - 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() - - def slot_clear(self): - print "slot_clear" - print "current_title", self.current_title, self.current_text - - self.show_public_text.clear() - self.is_published = False - - def slot_removeItem(self): - text = self.edit_item_selection.currentText() - index = self.edit_item_selection.currentIndex() - title = text.split(": ")[1] - del self.items[title] - self.edit_item_selection.removeItem(index) - self.item_list.removeItemWidget(self.item_list.item(index)) - new_index = self.edit_item_selection.currentIndex() - if new_index != -1: - self.slot_editLoadItem() - else: - 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] - self.edit_private_text.setTextOrHtml(text) - self.item_title.setText(title) - self.item_position_input.setValue(position) - - 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())) - print "slot_showLoadItem", global_rect, index - print "current_title", self.current_title, self.current_text - item = self.item_list.item(index) - print "item", item - if item is None: - return - self.current_title = item.text() - self.current_text, self.current_index = self.items[self.current_title] - print "current_title", self.current_title, self.current_text - if self.auto_publish_checkbox.isChecked(): - self.show_public_text.setHtml(self.current_text) - - 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.edit_private_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)) - self.item_list.item(index).setText(new_title) - - def slot_addText(self): - print "slot add" - index = self.item_position_input.value() - if index - self.item_list.count() > 1: - old_title = self.edit_item_selection.currentText().split(": ")[1] - self.item_title.setText(old_title) - text, index = self.items[old_title] - self.edit_private_text.setTextOrHtml(text) - self.item_position_input.setValue(index) - return - old_title = self.title_by_index(index) - if old_title is not None: - self.slot_changeItem(old_title) - return - - title = self.item_title.text() - text = self.edit_private_text.textOrHtml() - self.items[title] = (text, index) - self.edit_item_selection.insertItem(index, "%d: %s" % (index, title)) - self.item_list.insertItem(index, title) - self.edit_item_selection.setCurrentIndex(index) - self.item_list.setCurrentRow(index) - - def slot_save(self): - cPickle.dump(self.items, open("448_texter.db", "w"), cPickle.HIGHEST_PROTOCOL) - - def slot_load(self): - try: - self.items = 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)) - - data = sorted(data, key=itemgetter(2)) - for title, text, index in data: - self.edit_item_selection.addItem("%d: %s" % (index, title)) - self.item_list.addItem(title) - - self.edit_item_selection.setCurrentIndex(0) - self.item_list.setCurrentRow(0) - self.current_title, self.current_text, self.current_index = data[0] - - self.edit_private_text.setTextOrHtml(self.current_text) - self.item_position_input.setValue(self.current_index) - self.item_title.setText(self.current_title) - - - -if ( __name__ == '__main__' ): - app = None - if ( not app ): - app = QtGui.QApplication([]) - - window = MainWindow() - window.show() - - if ( app ): - app.exec_() diff --git a/texter/texter.ui b/texter/texter.ui deleted file mode 100644 index ecaeaf1..0000000 --- a/texter/texter.ui +++ /dev/null @@ -1,1556 +0,0 @@ - - - MainWindow - - - 448 Texter - - - - - - - 0 - - - - &Edit - - - - - - - - &Title - - - item_title - - - - - - - - - - P&osition - - - item_position_input - - - - - - - - - - S&election - - - edit_item_selection - - - - - - - - 0 - 0 - - - - - - - - &Add / Change - - - - - - - &Remove - - - - - - - Sa&ve - - - - - - - - - - 768 - 576 - - - - - 768 - 576 - - - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 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 - - - - - - - - - Monospace - 14 - - - - true - - - true - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextEditable|Qt::TextEditorInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - Sho&w - - - - - - - - Next - - - - - - - - - - Previous - - - - - - - &Publish - - - true - - - - - - - A&uto Publish - - - - - - - - - - - - 768 - 576 - - - - - 768 - 576 - - - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 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 - - - - - - - - - Monospace - 14 - - - - true - - - - - - true - - - true - - - - - - - - 0 - 576 - - - - - 16777215 - 576 - - - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 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 - - - - - - - - true - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - - toolBar - - - false - - - false - - - TopToolBarArea - - - false - - - - - - KRichTextEdit - KTextEdit -
krichtextedit.h
-
- - KTextEdit - QTextEdit -
ktextedit.h
-
- - KListWidget - QListWidget -
klistwidget.h
-
- - KRichTextWidget - KRichTextEdit -
krichtextwidget.h
-
- - KIntNumInput - QWidget -
knuminput.h
-
-
- - edit_private_text - item_title - item_position_input - edit_item_selection - remove_item_button - - - -
diff --git a/texter/texter/__init__.py b/texter/texter/__init__.py new file mode 100644 index 0000000..fa924e5 --- /dev/null +++ b/texter/texter/__init__.py @@ -0,0 +1 @@ +import texter_rc diff --git a/texter/texter/icon.png b/texter/texter/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..fd05fbcf68ec00f16d7e5057c4bb47b4d846480b GIT binary patch literal 556 zcmV+{0@MA8P)`F_AyV;{D!p$GpkREWBC#PMv<8bMHC# zd(J(#Uu33k%CfGWUIWwsH9!rpBmp9#5fLL1v2QU6BVwS6Utah&L_~i?JdcQ55pkp) zkeO{o51!#Oj+blmQ8e%#iJrngh{xE8LzqG%GiL#uMSqoKK>%2RQS@~H7{}4VzKx;G z{Bs2nu@#4LaWSpOX^h}ahqY1cs?J%3?ReV00t6o6KxHqe1K5JsSdG0MIB{ literal 0 HcmV?d00001 diff --git a/texter/texter/main.py b/texter/texter/main.py new file mode 100644 index 0000000..109f3a6 --- /dev/null +++ b/texter/texter/main.py @@ -0,0 +1,266 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +import os.path + +import PyQt4.uic +from PyQt4 import QtCore, QtGui +from PyKDE4.kdeui import KActionCollection, KRichTextWidget + +from texter_ui import Ui_MainWindow + + +from operator import itemgetter +import cPickle + +app = QtGui.QApplication([]) + +class MainWindow(QtGui.QMainWindow, Ui_MainWindow): + def __init__(self, parent = None): + super(MainWindow, self).__init__(parent) + + self.setWindowFlags(self.windowFlags() | QtCore.Qt.FramelessWindowHint) + + # 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.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.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.show() + + self.is_published = False + + #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) + app.focusChanged.connect(self.focusChanged) + + + self.items = dict() + #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) + 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 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 + 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 + + + def slot_next_item(self): + print "slot_next_item" + #print "current_title", self.current_title, self.current_text + #index = (self.item_list.currentRow() + 1) % self.item_list.count() + #self.item_list.setCurrentRow(index) + #self.edit_item_selection.setCurrentIndex(index) + #self.slot_editLoadItem(index) + #self.slot_showLoadItem(index) + + def slot_previous_item(self): + print "slot_previous_item" + ##print "current_title", self.current_title, self.current_text + #index = (self.item_list.currentRow() - 1) % self.item_list.count() + #self.item_list.setCurrentRow(index) + #self.edit_item_selection.setCurrentIndex(index) + #self.slot_editLoadItem(index) + #self.slot_showLoadItem(index) + + 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())) + + 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() + + def slot_clear_live(self): + self.live_text.clear() + self.is_published = False + + def slot_clear_preview(self): + self.preview_text.clear() + + + def slot_removeItem(self): + text = self.edit_item_selection.currentText() + index = self.edit_item_selection.currentIndex() + title = text.split(": ")[1] + del self.items[title] + self.edit_item_selection.removeItem(index) + new_index = self.edit_item_selection.currentIndex() + if new_index != -1: + self.slot_editLoadItem() + else: + 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] + self.preview_text.setTextOrHtml(text) + self.item_title.setText(title) + self.item_position_input.setValue(position) + + 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_addText(self): + print "slot add" + index = self.item_position_input.value() + + old_title = self.title_by_index(index) + if old_title is not None: + self.slot_changeItem(old_title) + return + + title = self.item_title.text() + text = self.preview_text.toHtml() + self.items[title] = (text, index) + self.edit_item_selection.insertItem(index, "%d: %s" % (index, title)) + self.edit_item_selection.setCurrentIndex(index) + + def slot_save(self): + cPickle.dump(self.items, open("448_texter.db", "w"), cPickle.HIGHEST_PROTOCOL) + + def slot_load(self): + try: + self.items = 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)) + + 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) + + +def main(): + window = MainWindow() + app.exec_() + + +if ( __name__ == '__main__' ): + main() diff --git a/texter/texter/texter.qrc b/texter/texter/texter.qrc new file mode 100644 index 0000000..b4b4a29 --- /dev/null +++ b/texter/texter/texter.qrc @@ -0,0 +1,5 @@ + + + icon.png + + diff --git a/texter/texter/texter2.ui b/texter/texter/texter2.ui new file mode 100644 index 0000000..cd81024 --- /dev/null +++ b/texter/texter/texter2.ui @@ -0,0 +1,641 @@ + + + MainWindow + + + + 0 + 0 + 1554 + 636 + + + + + + + + + 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 + + + + :/texter/icon.png:/texter/icon.png + + + + + + + + + + 768 + 576 + + + + + 768 + 576 + + + + + Monospace + 22 + + + + live text + + + + + + + + + false + + + true + + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextEditable|Qt::TextEditorInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + + clear live text + + + + + + F1 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + 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 + + + + + + + + + clear preview text + + + status tip2 + + + whatsthis2 + + + + + + F2 + + + + + + + go live with text + + + + + + F4 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + KRichTextEdit + KTextEdit +
krichtextedit.h
+
+ + KPushButton + QPushButton +
kpushbutton.h
+
+ + KTextEdit + QTextEdit +
ktextedit.h
+
+ + KRichTextWidget + KRichTextEdit +
krichtextwidget.h
+
+
+ + live_text + preview_text + publish_button + clear_preview_button + clear_live_button + + + + + +
diff --git a/texter/texter/texter_rc.py b/texter/texter/texter_rc.py new file mode 100644 index 0000000..6f17bd2 --- /dev/null +++ b/texter/texter/texter_rc.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- + +# Resource object code +# +# Created: Sa. Apr 12 08:49:54 2014 +# by: The Resource Compiler for PyQt (Qt v4.8.5) +# +# WARNING! All changes made in this file will be lost! + +from PyQt4 import QtCore + +qt_resource_data = "\ +\x00\x00\x02\x2c\ +\x89\ +\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\ +\x00\x00\x20\x00\x00\x00\x20\x08\x06\x00\x00\x00\x73\x7a\x7a\xf4\ +\x00\x00\x00\x04\x73\x42\x49\x54\x08\x08\x08\x08\x7c\x08\x64\x88\ +\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0d\xd7\x00\x00\x0d\xd7\ +\x01\x42\x28\x9b\x78\x00\x00\x00\x19\x74\x45\x58\x74\x53\x6f\x66\ +\x74\x77\x61\x72\x65\x00\x77\x77\x77\x2e\x69\x6e\x6b\x73\x63\x61\ +\x70\x65\x2e\x6f\x72\x67\x9b\xee\x3c\x1a\x00\x00\x01\xa9\x49\x44\ +\x41\x54\x58\x85\xed\xd5\x4f\x88\xcd\x51\x14\xc0\xf1\xcf\x11\x13\ +\x8a\x86\xb2\x65\x61\xc1\x42\xc9\x8a\x27\x1b\x1b\xb1\xb0\x92\x62\ +\x27\x35\x3b\x59\xd8\x68\x1a\x29\x4b\x89\xa4\x69\xca\x5a\x59\x21\ +\x93\x85\x89\x85\x48\x42\xcd\x42\x16\x4a\x9a\xa2\xc8\x66\x9a\x86\ +\x31\x91\x3f\xc7\xe2\xfd\xde\x73\xc7\xbc\xc9\xcc\x2c\xbc\x59\xfc\ +\x4e\x9d\x7e\x9d\x73\xef\x39\xf7\x7b\xce\x3d\xb7\x5f\x64\xa6\x6e\ +\xca\xb2\xae\x9e\x5e\x03\xd4\x00\x35\x40\x0d\xb0\x24\x01\x22\xa2\ +\x11\x11\x23\x11\xb1\x6f\x31\x09\x23\x62\xa0\x8a\x5f\x5e\xf8\x36\ +\x44\x44\x7f\x44\x3c\x8f\x88\x5b\x11\x71\xa4\x1d\x90\x99\x6d\x45\ +\x0f\x9e\xe1\x33\x8e\x97\x6b\xf3\x51\x34\xf0\x1e\x89\x9e\xc2\x3f\ +\x88\xc7\xd8\x89\x43\x98\x42\x23\x33\x67\x01\x9c\x45\x7f\x95\x64\ +\x41\x00\x58\x81\x51\xf4\x75\x00\x18\xc7\xd1\xc2\xbe\x8d\xa1\xcc\ +\xfc\x73\x05\x11\xb1\x15\x87\x71\x71\x31\xad\xc7\x69\x8c\xe0\x4d\ +\x87\xb5\x51\xec\xaa\xce\x59\x85\xed\x78\xda\xbe\x02\x04\x1e\xe1\ +\x40\x65\x2f\xa8\x03\xd8\x82\xd7\x58\x8d\xbd\x1d\x3a\xb0\x1e\xf7\ +\x30\x86\x4f\x38\x89\xc8\x4c\xad\x41\xe9\xc3\x44\x66\xde\x5d\x68\ +\xd9\x11\x11\xb8\x8a\x81\xcc\x9c\x6e\x9a\xb3\xe4\x14\x7a\x71\x0e\ +\x9b\x70\x02\x2f\xf1\xa0\x45\x38\x86\x9b\xb8\x5c\xe9\x14\xee\xe3\ +\xd8\x3c\xaa\xdf\x8d\x2f\x45\xec\x8d\xaa\x03\x57\xb0\x0d\x6b\xf0\ +\x0d\x7b\x8a\x98\x21\x0c\x97\x1d\x18\xc4\xda\x82\xf8\x17\xa6\xab\ +\xc4\x65\xb5\x1b\xb1\x2e\x33\x5f\x14\xee\x0f\xb8\x50\xd8\xbd\xd5\ +\x77\x12\xdf\xb1\x59\xf3\x75\x4d\x16\x7b\xc6\x35\xaf\xca\x5c\x55\ +\x75\x9c\x01\x5c\xc3\x8f\x7f\x74\x64\xc6\x0c\x60\x25\xde\xe2\x0e\ +\x76\xe0\x20\xde\xe1\xd2\x8c\x57\xf0\x97\x3c\xc1\xc7\x0e\xfe\x57\ +\x78\x38\x47\x4c\x4b\x26\xaa\x3d\x59\x15\xf8\x15\xfb\xf1\x13\xc3\ +\x38\x8f\xeb\x38\x43\x35\x89\xdd\x94\xa5\xf7\x2f\xa8\x01\x6a\x80\ +\x1a\xa0\x06\xf8\xdf\xf2\x1b\xf1\xb2\x57\x16\x4f\x60\xf0\x28\x00\ +\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82\ +" + +qt_resource_name = "\ +\x00\x06\ +\x07\xac\xfa\xc2\ +\x00\x74\ +\x00\x65\x00\x78\x00\x74\x00\x65\x00\x72\ +\x00\x08\ +\x0a\x61\x5a\xa7\ +\x00\x69\ +\x00\x63\x00\x6f\x00\x6e\x00\x2e\x00\x70\x00\x6e\x00\x67\ +" + +qt_resource_struct = "\ +\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\ +\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\ +\x00\x00\x00\x12\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ +" + +def qInitResources(): + QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data) + +def qCleanupResources(): + QtCore.qUnregisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data) + +qInitResources() diff --git a/texter/texter/texter_ui.py b/texter/texter/texter_ui.py new file mode 100644 index 0000000..1d83afe --- /dev/null +++ b/texter/texter/texter_ui.py @@ -0,0 +1,259 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'texter2.ui' +# +# Created: Sat Apr 12 09:29:22 2014 +# by: PyQt4 UI code generator 4.10.3 +# +# WARNING! All changes made in this file will be lost! + +from PyQt4 import QtCore, QtGui + +try: + _fromUtf8 = QtCore.QString.fromUtf8 +except AttributeError: + def _fromUtf8(s): + return s + +try: + _encoding = QtGui.QApplication.UnicodeUTF8 + def _translate(context, text, disambig): + return QtGui.QApplication.translate(context, text, disambig, _encoding) +except AttributeError: + def _translate(context, text, disambig): + return QtGui.QApplication.translate(context, text, disambig) + +class Ui_MainWindow(object): + def setupUi(self, MainWindow): + MainWindow.setObjectName(_fromUtf8("MainWindow")) + MainWindow.resize(1554, 636) + palette = QtGui.QPalette() + brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 255)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.BrightText, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 255)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.AlternateBase, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 220)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipBase, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 255)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.BrightText, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 255)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Shadow, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.AlternateBase, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 220)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipBase, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 255)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.BrightText, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Shadow, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.AlternateBase, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 220)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipBase, brush) + brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) + brush.setStyle(QtCore.Qt.SolidPattern) + palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText, brush) + MainWindow.setPalette(palette) + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/texter/icon.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + 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.live_text = KRichTextWidget(self.centralwidget) + self.live_text.setMinimumSize(QtCore.QSize(768, 576)) + self.live_text.setMaximumSize(QtCore.QSize(768, 576)) + font = QtGui.QFont() + font.setFamily(_fromUtf8("Monospace")) + font.setPointSize(22) + self.live_text.setFont(font) + 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.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) + 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.preview_text = KRichTextWidget(self.centralwidget) + self.preview_text.setMinimumSize(QtCore.QSize(400, 576)) + self.preview_text.setMaximumSize(QtCore.QSize(768, 576)) + font = QtGui.QFont() + font.setFamily(_fromUtf8("Monospace")) + font.setPointSize(22) + self.preview_text.setFont(font) + self.preview_text.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) + self.preview_text.setAutoFillBackground(False) + self.preview_text.setFrameShape(QtGui.QFrame.StyledPanel) + self.preview_text.setAcceptRichText(True) + self.preview_text.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByKeyboard|QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextBrowserInteraction|QtCore.Qt.TextEditable|QtCore.Qt.TextEditorInteraction|QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse) + 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) + 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) + 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.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)) + +from PyKDE4.kdeui import KPushButton, KRichTextWidget +import texter_rc