new layout

This commit is contained in:
Stefan Kögl 2014-04-12 20:51:49 +02:00
parent 7bcf2b1a00
commit d4d4154f92
6 changed files with 350 additions and 516 deletions

2
texter/texter/build.sh Normal file
View File

@ -0,0 +1,2 @@
pyuic4 -o texter_ui.py texter2.ui
pyuic4 -o text_sorter_ui.py text_sorter.ui

View File

@ -8,13 +8,53 @@ from PyQt4 import QtCore, QtGui
from PyKDE4.kdeui import KActionCollection, KRichTextWidget from PyKDE4.kdeui import KActionCollection, KRichTextWidget
from texter_ui import Ui_MainWindow from texter_ui import Ui_MainWindow
from text_sorter_ui import Ui_text_sorter_dialog
from operator import itemgetter from operator import itemgetter
import cPickle import cPickle
app = QtGui.QApplication([]) app = QtGui.QApplication([])
class TextSorterDialog(QtGui.QDialog, Ui_text_sorter_dialog):
def __init__(self, parent = None):
super(TextSorterDialog, self).__init__(parent)
# setup the ui
self.setupUi(self)
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
class MainWindow(QtGui.QMainWindow, Ui_MainWindow): class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
def __init__(self, parent = None): def __init__(self, parent = None):
super(MainWindow, self).__init__(parent) super(MainWindow, self).__init__(parent)
@ -53,6 +93,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.show() self.show()
self.is_published = False self.is_published = False
self.current = 0
#self.add_button.clicked.connect(self.slot_addText) #self.add_button.clicked.connect(self.slot_addText)
#self.save_button.clicked.connect(self.slot_save) #self.save_button.clicked.connect(self.slot_save)
@ -63,15 +104,18 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
#self.edit_item_selection.activated.connect(self.slot_editLoadItem) #self.edit_item_selection.activated.connect(self.slot_editLoadItem)
#self.auto_publish_checkbox.clicked.connect(self.slot_publish) #self.auto_publish_checkbox.clicked.connect(self.slot_publish)
app.focusChanged.connect(self.focusChanged) 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.items = dict() self.text_db = list()
#self.slot_load() #self.slot_load()
#self.next_button.setShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Space)) self.next_button.setShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Space))
#self.next_button.clicked.connect(self.slot_next_item) self.next_button.clicked.connect(self.slot_next_item)
#self.previous_button.setShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Backspace)) self.previous_button.setShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Backspace))
#self.previous_button.clicked.connect(self.slot_previous_item) self.previous_button.clicked.connect(self.slot_previous_item)
public_rect = self.live_text.geometry() public_rect = self.live_text.geometry()
global_rect = QtCore.QRect(self.mapToGlobal(public_rect.topLeft()), self.mapToGlobal(public_rect.bottomRight())) 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.statusBar().showMessage("geometry to cast: %d, %d, %d, %d" % (global_rect.x(), global_rect.y(), global_rect.width(), global_rect.height()))
@ -111,20 +155,17 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
def slot_next_item(self): def slot_next_item(self):
print "slot_next_item" print "slot_next_item"
#print "current_title", self.current_title, self.current_text #print "current_title", self.current_title, self.current_text
#index = (self.item_list.currentRow() + 1) % self.item_list.count() self.current = (self.current + 1) % len(self.text_db)
#self.item_list.setCurrentRow(index) self.preview_text.setTextOrHtml(self.text_db[self.current][1])
#self.edit_item_selection.setCurrentIndex(index) print "current", self.current
#self.slot_editLoadItem(index)
#self.slot_showLoadItem(index)
def slot_previous_item(self): def slot_previous_item(self):
print "slot_previous_item" print "slot_previous_item"
##print "current_title", self.current_title, self.current_text #print "current_title", self.current_title, self.current_text
#index = (self.item_list.currentRow() - 1) % self.item_list.count() self.current = (self.current - 1) % len(self.text_db)
#self.item_list.setCurrentRow(index) self.preview_text.setTextOrHtml(self.text_db[self.current][1])
#self.edit_item_selection.setCurrentIndex(index)
#self.slot_editLoadItem(index) print "current", self.current
#self.slot_showLoadItem(index)
def slot_toggleToolbox(self, index): def slot_toggleToolbox(self, index):
print "slot_toggleToolbox" print "slot_toggleToolbox"
@ -216,24 +257,27 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.item_title.setText(new_title) self.item_title.setText(new_title)
self.edit_item_selection.setItemText(index, "%d: %s" % (index, new_title)) self.edit_item_selection.setItemText(index, "%d: %s" % (index, new_title))
def slot_save_live(self):
def slot_addText(self): print "slot save live text"
print "slot add" text = self.live_text.toHtml()
index = self.item_position_input.value() preview = self.live_text.toPlainText()[:10]
print "represent", preview
old_title = self.title_by_index(index) self.text_db.append((preview, text))
if old_title is not None:
self.slot_changeItem(old_title) def slot_save_preview(self):
return print "slot save live text"
title = self.item_title.text()
text = self.preview_text.toHtml() text = self.preview_text.toHtml()
self.items[title] = (text, index) preview = self.preview_text.toPlainText()[:10]
self.edit_item_selection.insertItem(index, "%d: %s" % (index, title)) print "represent", preview
self.edit_item_selection.setCurrentIndex(index) self.text_db.append((preview, text))
def slot_save(self): def slot_save(self):
cPickle.dump(self.items, open("448_texter.db", "w"), cPickle.HIGHEST_PROTOCOL) cPickle.dump(self.items, 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): def slot_load(self):
try: try:

View File

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>text_sorter_dialog</class>
<widget class="QDialog" name="text_sorter_dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>612</width>
<height>280</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="KEditListWidget" name="text_list"/>
</item>
<item>
<widget class="KRichTextWidget" name="text_preview"/>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KEditListWidget</class>
<extends>QWidget</extends>
<header>keditlistwidget.h</header>
</customwidget>
<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>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>text_sorter_dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>text_sorter_dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,55 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'text_sorter.ui'
#
# Created: Sat Apr 12 14:47:10 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_text_sorter_dialog(object):
def setupUi(self, text_sorter_dialog):
text_sorter_dialog.setObjectName(_fromUtf8("text_sorter_dialog"))
text_sorter_dialog.resize(612, 280)
self.verticalLayout = QtGui.QVBoxLayout(text_sorter_dialog)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.text_list = KEditListWidget(text_sorter_dialog)
self.text_list.setObjectName(_fromUtf8("text_list"))
self.horizontalLayout.addWidget(self.text_list)
self.text_preview = KRichTextWidget(text_sorter_dialog)
self.text_preview.setObjectName(_fromUtf8("text_preview"))
self.horizontalLayout.addWidget(self.text_preview)
self.verticalLayout.addLayout(self.horizontalLayout)
self.buttonBox = QtGui.QDialogButtonBox(text_sorter_dialog)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.verticalLayout.addWidget(self.buttonBox)
self.retranslateUi(text_sorter_dialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), text_sorter_dialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), text_sorter_dialog.reject)
QtCore.QMetaObject.connectSlotsByName(text_sorter_dialog)
def retranslateUi(self, text_sorter_dialog):
text_sorter_dialog.setWindowTitle(_translate("text_sorter_dialog", "Dialog", None))
from PyKDE4.kdeui import KEditListWidget, KRichTextWidget

View File

@ -7,66 +7,12 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1554</width> <width>1554</width>
<height>636</height> <height>658</height>
</rect> </rect>
</property> </property>
<property name="palette"> <property name="palette">
<palette> <palette>
<active> <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"> <colorrole role="Text">
<brush brushstyle="SolidPattern"> <brush brushstyle="SolidPattern">
<color alpha="255"> <color alpha="255">
@ -76,70 +22,7 @@
</color> </color>
</brush> </brush>
</colorrole> </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"> <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"> <brush brushstyle="SolidPattern">
<color alpha="255"> <color alpha="255">
<red>0</red> <red>0</red>
@ -150,60 +33,6 @@
</colorrole> </colorrole>
</active> </active>
<inactive> <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"> <colorrole role="Text">
<brush brushstyle="SolidPattern"> <brush brushstyle="SolidPattern">
<color alpha="255"> <color alpha="255">
@ -213,70 +42,7 @@
</color> </color>
</brush> </brush>
</colorrole> </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"> <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"> <brush brushstyle="SolidPattern">
<color alpha="255"> <color alpha="255">
<red>0</red> <red>0</red>
@ -287,138 +53,21 @@
</colorrole> </colorrole>
</inactive> </inactive>
<disabled> <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"> <colorrole role="Text">
<brush brushstyle="SolidPattern"> <brush brushstyle="SolidPattern">
<color alpha="255"> <color alpha="255">
<red>0</red> <red>169</red>
<green>0</green> <green>167</green>
<blue>0</blue> <blue>167</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> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Base"> <colorrole role="Base">
<brush brushstyle="SolidPattern"> <brush brushstyle="SolidPattern">
<color alpha="255"> <color alpha="255">
<red>0</red> <red>244</red>
<green>0</green> <green>244</green>
<blue>0</blue> <blue>244</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> </color>
</brush> </brush>
</colorrole> </colorrole>
@ -484,13 +133,29 @@
<string>clear live text</string> <string>clear live text</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset theme="edit-clear"/> <iconset theme="edit-clear">
<normaloff/>
</iconset>
</property> </property>
<property name="shortcut"> <property name="shortcut">
<string>F1</string> <string>F1</string>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="KPushButton" name="live_save_button">
<property name="icon">
<iconset theme="document-save"/>
</property>
</widget>
</item>
<item>
<widget class="KColorButton" name="live_color">
<property name="text">
<string>background</string>
</property>
</widget>
</item>
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
@ -564,7 +229,9 @@
<string>whatsthis2</string> <string>whatsthis2</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset theme="edit-clear"/> <iconset theme="edit-clear">
<normaloff/>
</iconset>
</property> </property>
<property name="shortcut"> <property name="shortcut">
<string>F2</string> <string>F2</string>
@ -577,13 +244,57 @@
<string>go live with text</string> <string>go live with text</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset theme="media-playback-start"/> <iconset theme="media-playback-start">
<normaloff/>
</iconset>
</property> </property>
<property name="shortcut"> <property name="shortcut">
<string>F4</string> <string>F4</string>
</property> </property>
</widget> </widget>
</item> </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">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="KColorButton" name="preview_color">
<property name="text">
<string>background</string>
</property>
</widget>
</item>
<item>
<widget class="KPushButton" name="preview_save_button">
<property name="icon">
<iconset theme="document-save"/>
</property>
</widget>
</item>
<item>
<widget class="KPushButton" name="text_open_button">
<property name="icon">
<iconset theme="document-open"/>
</property>
</widget>
</item>
<item> <item>
<spacer name="horizontalSpacer_2"> <spacer name="horizontalSpacer_2">
<property name="orientation"> <property name="orientation">
@ -611,6 +322,11 @@
<extends>KTextEdit</extends> <extends>KTextEdit</extends>
<header>krichtextedit.h</header> <header>krichtextedit.h</header>
</customwidget> </customwidget>
<customwidget>
<class>KColorButton</class>
<extends>QPushButton</extends>
<header>kcolorbutton.h</header>
</customwidget>
<customwidget> <customwidget>
<class>KPushButton</class> <class>KPushButton</class>
<extends>QPushButton</extends> <extends>QPushButton</extends>

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'texter2.ui' # Form implementation generated from reading ui file 'texter2.ui'
# #
# Created: Sat Apr 12 09:29:22 2014 # Created: Sat Apr 12 14:47:10 2014
# by: PyQt4 UI code generator 4.10.3 # by: PyQt4 UI code generator 4.10.3
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
@ -26,143 +26,26 @@ except AttributeError:
class Ui_MainWindow(object): class Ui_MainWindow(object):
def setupUi(self, MainWindow): def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(1554, 636) MainWindow.resize(1554, 658)
palette = QtGui.QPalette() palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern) 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) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.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) brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush) 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 = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern) brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.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) brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush = QtGui.QBrush(QtGui.QColor(169, 167, 167))
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) brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) brush = QtGui.QBrush(QtGui.QColor(244, 244, 244))
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) brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush) 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) MainWindow.setPalette(palette)
icon = QtGui.QIcon() icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/texter/icon.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/texter/icon.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
@ -194,6 +77,14 @@ class Ui_MainWindow(object):
self.clear_live_button.setIcon(icon) self.clear_live_button.setIcon(icon)
self.clear_live_button.setObjectName(_fromUtf8("clear_live_button")) self.clear_live_button.setObjectName(_fromUtf8("clear_live_button"))
self.horizontalLayout_2.addWidget(self.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) spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem) self.horizontalLayout_2.addItem(spacerItem)
self.verticalLayout.addLayout(self.horizontalLayout_2) self.verticalLayout.addLayout(self.horizontalLayout_2)
@ -226,6 +117,34 @@ class Ui_MainWindow(object):
self.publish_button.setIcon(icon) self.publish_button.setIcon(icon)
self.publish_button.setObjectName(_fromUtf8("publish_button")) self.publish_button.setObjectName(_fromUtf8("publish_button"))
self.horizontalLayout.addWidget(self.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) spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem1) self.horizontalLayout.addItem(spacerItem1)
self.verticalLayout_2.addLayout(self.horizontalLayout) self.verticalLayout_2.addLayout(self.horizontalLayout)
@ -247,6 +166,7 @@ class Ui_MainWindow(object):
self.live_text.setToolTip(_translate("MainWindow", "live text", "tooltip1")) self.live_text.setToolTip(_translate("MainWindow", "live text", "tooltip1"))
self.clear_live_button.setToolTip(_translate("MainWindow", "clear live text", None)) self.clear_live_button.setToolTip(_translate("MainWindow", "clear live text", None))
self.clear_live_button.setShortcut(_translate("MainWindow", "F1", 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.preview_text.setToolTip(_translate("MainWindow", "preview text", None))
self.clear_preview_button.setToolTip(_translate("MainWindow", "clear 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.setStatusTip(_translate("MainWindow", "status tip2", None))
@ -254,6 +174,7 @@ class Ui_MainWindow(object):
self.clear_preview_button.setShortcut(_translate("MainWindow", "F2", None)) self.clear_preview_button.setShortcut(_translate("MainWindow", "F2", None))
self.publish_button.setToolTip(_translate("MainWindow", "go live with text", None)) self.publish_button.setToolTip(_translate("MainWindow", "go live with text", None))
self.publish_button.setShortcut(_translate("MainWindow", "F4", None)) self.publish_button.setShortcut(_translate("MainWindow", "F4", None))
self.preview_color.setText(_translate("MainWindow", "background", None))
from PyKDE4.kdeui import KPushButton, KRichTextWidget from PyKDE4.kdeui import KColorButton, KPushButton, KRichTextWidget
import texter_rc import texter_rc