implemented real model/view interface
This commit is contained in:
parent
80b31ecaf2
commit
ae53e8e3ef
|
@ -1,2 +1,2 @@
|
||||||
pykdeuic4-python2.7 -o texter_ui.py texter3.ui
|
# pykdeuic4-python2.7 -o texter_ui.py texter3.ui
|
||||||
pykdeuic4-python2.7 -o text_sorter_ui.py text_sorter.ui
|
pykdeuic4-python2.7 -o text_sorter_ui.py texter4.ui
|
||||||
|
|
|
@ -12,10 +12,11 @@ from operator import itemgetter
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from PyKDE4.kdecore import ki18n, KCmdLineArgs, KAboutData
|
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 PyKDE4.kdeui import KDialog, KActionCollection, KRichTextWidget, KComboBox, KPushButton, KRichTextWidget, KMainWindow, KToolBar, KApplication, KAction, KToolBarSpacerAction, KSelectAction, KToggleAction, KShortcut
|
||||||
|
|
||||||
from texter_ui import Ui_MainWindow, _fromUtf8
|
from texter_ui import Ui_MainWindow, _fromUtf8
|
||||||
from text_sorter_ui import Ui_text_sorter_dialog
|
from text_sorter_ui import Ui_TextSorterDialog
|
||||||
|
from text_model import TextModel
|
||||||
|
|
||||||
appName = "texter"
|
appName = "texter"
|
||||||
catalog = "448texter"
|
catalog = "448texter"
|
||||||
|
@ -36,21 +37,24 @@ for path in QtGui.QIcon.themeSearchPaths():
|
||||||
# in your local icon directory:
|
# in your local icon directory:
|
||||||
# ln -s /your/icon/theme/directory $HOME/.icons/hicolor
|
# ln -s /your/icon/theme/directory $HOME/.icons/hicolor
|
||||||
|
|
||||||
class TextSorterDialog(QtGui.QDialog, Ui_text_sorter_dialog):
|
class TextSorterDialog(QtGui.QWidget, Ui_TextSorterDialog):
|
||||||
def __init__(self, parent = None):
|
def __init__(self, parent = None):
|
||||||
super(TextSorterDialog, self).__init__(parent)
|
super(TextSorterDialog, self).__init__(parent)
|
||||||
|
|
||||||
# setup the ui
|
## setup the ui
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
self.setModal(False)
|
#self.setModal(False)
|
||||||
self.fill_list()
|
self.fill_list()
|
||||||
|
|
||||||
self.text_list.listView().clicked.connect(self.slot_show_text)
|
self.text_list.clicked.connect(self.slot_show_text)
|
||||||
self.accepted.connect(self.slot_saveToDb)
|
#self.accepted.connect(self.slot_saveToDb)
|
||||||
|
self.remove_button.clicked.connect(self.slot_removeItem)
|
||||||
|
|
||||||
def fill_list(self):
|
def fill_list(self):
|
||||||
for preview, text in self.parent().text_db:
|
self.model = self.parent().parent().model
|
||||||
self.text_list.insertItem(preview)
|
self.text_list.setModel(self.model)
|
||||||
|
#for preview, text in self.parent().text_db:
|
||||||
|
#self.text_list.insertItem(preview)
|
||||||
|
|
||||||
def slot_text_up(self):
|
def slot_text_up(self):
|
||||||
pass
|
pass
|
||||||
|
@ -59,21 +63,19 @@ class TextSorterDialog(QtGui.QDialog, Ui_text_sorter_dialog):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def slot_show_text(self, model_index):
|
def slot_show_text(self, model_index):
|
||||||
self.text_preview.setTextOrHtml(self.parent().text_db[model_index.row()][1])
|
self.text_preview.setTextOrHtml(self.parent().parent().model.text_db[model_index.row()][1])
|
||||||
|
|
||||||
def slot_saveToDb(self):
|
def slot_saveToDb(self):
|
||||||
data = list()
|
data = list()
|
||||||
self.parent().text_combo.clear()
|
pass
|
||||||
parent = self.parent()
|
|
||||||
for preview in self.text_list.items():
|
|
||||||
pre, text = parent.text_by_preview(preview)
|
def slot_removeItem(self):
|
||||||
data.append((preview, text))
|
index = self.text_list.currentIndex().row()
|
||||||
parent.text_combo.addAction(preview)
|
print "remote index", index
|
||||||
parent.text_combo.setCurrentItem(0)
|
self.model.removeRows(index, 1)
|
||||||
parent.text_db = data
|
|
||||||
parent.slot_load_preview_text(0)
|
|
||||||
parent.slot_set_live_defaults()
|
|
||||||
parent.slot_set_preview_defaults()
|
|
||||||
|
|
||||||
|
|
||||||
class MainWindow(KMainWindow, Ui_MainWindow):
|
class MainWindow(KMainWindow, Ui_MainWindow):
|
||||||
|
@ -94,7 +96,8 @@ class MainWindow(KMainWindow, Ui_MainWindow):
|
||||||
self.preview_actions = list()
|
self.preview_actions = list()
|
||||||
self.live_actions = list()
|
self.live_actions = list()
|
||||||
self.current = 0
|
self.current = 0
|
||||||
self.text_db = list()
|
self.model = TextModel(self)
|
||||||
|
|
||||||
self.is_auto_publish = False
|
self.is_auto_publish = False
|
||||||
|
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
|
@ -107,8 +110,10 @@ class MainWindow(KMainWindow, Ui_MainWindow):
|
||||||
self.toolbar.setMovable(False)
|
self.toolbar.setMovable(False)
|
||||||
self.toolbar.setFloatable(False)
|
self.toolbar.setFloatable(False)
|
||||||
self.addToolBar(QtCore.Qt.BottomToolBarArea, self.toolbar)
|
self.addToolBar(QtCore.Qt.BottomToolBarArea, self.toolbar)
|
||||||
|
|
||||||
self.createLiveActions()
|
self.createLiveActions()
|
||||||
self.createPreviewActions()
|
self.createPreviewActions()
|
||||||
|
self.slot_load()
|
||||||
|
|
||||||
|
|
||||||
self.preview_text.document().setDefaultFont(self.font)
|
self.preview_text.document().setDefaultFont(self.font)
|
||||||
|
@ -144,7 +149,7 @@ class MainWindow(KMainWindow, Ui_MainWindow):
|
||||||
self.streaming_action.triggered.connect(self.slot_toggle_streaming)
|
self.streaming_action.triggered.connect(self.slot_toggle_streaming)
|
||||||
self.auto_publish_action.toggled.connect(self.slot_auto_publish)
|
self.auto_publish_action.toggled.connect(self.slot_auto_publish)
|
||||||
|
|
||||||
self.slot_load()
|
|
||||||
self.next_action.triggered.connect(self.slot_next_item)
|
self.next_action.triggered.connect(self.slot_next_item)
|
||||||
self.previous_action.triggered.connect(self.slot_previous_item)
|
self.previous_action.triggered.connect(self.slot_previous_item)
|
||||||
|
|
||||||
|
@ -363,14 +368,7 @@ class MainWindow(KMainWindow, Ui_MainWindow):
|
||||||
|
|
||||||
|
|
||||||
def get_preview_text(self, text):
|
def get_preview_text(self, text):
|
||||||
return re.sub(" +", " ", text.replace("\n", " "))[:20]
|
return re.sub(" +", " ", text.replace("\n", " ")).strip()[: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):
|
def title_by_index(self, ix):
|
||||||
|
@ -381,13 +379,13 @@ class MainWindow(KMainWindow, Ui_MainWindow):
|
||||||
|
|
||||||
|
|
||||||
def slot_next_item(self):
|
def slot_next_item(self):
|
||||||
self.current = (self.text_combo.currentItem() + 1) % len(self.text_db)
|
self.current = (self.text_combo.currentItem() + 1) % len(self.model.text_db)
|
||||||
self.text_combo.setCurrentItem(self.current)
|
self.text_combo.setCurrentItem(self.current)
|
||||||
self.slot_load_preview_text(self.current)
|
self.slot_load_preview_text(self.current)
|
||||||
|
|
||||||
|
|
||||||
def slot_previous_item(self):
|
def slot_previous_item(self):
|
||||||
self.current = (self.text_combo.currentItem() - 1) % len(self.text_db)
|
self.current = (self.text_combo.currentItem() - 1) % len(self.model.text_db)
|
||||||
self.text_combo.setCurrentItem(self.current)
|
self.text_combo.setCurrentItem(self.current)
|
||||||
self.slot_load_preview_text(self.current)
|
self.slot_load_preview_text(self.current)
|
||||||
|
|
||||||
|
@ -447,6 +445,15 @@ class MainWindow(KMainWindow, Ui_MainWindow):
|
||||||
self.preview_text.clear()
|
self.preview_text.clear()
|
||||||
self.slot_set_preview_defaults()
|
self.slot_set_preview_defaults()
|
||||||
|
|
||||||
|
def fill_combo_box(self):
|
||||||
|
print "fill_combo_box"
|
||||||
|
self.text_combo.clear()
|
||||||
|
for preview, text in self.model.text_db:
|
||||||
|
self.text_combo.addAction(preview)
|
||||||
|
|
||||||
|
self.text_combo.setCurrentItem(0)
|
||||||
|
self.slot_load_preview_text(0)
|
||||||
|
|
||||||
|
|
||||||
def slot_removeItem(self):
|
def slot_removeItem(self):
|
||||||
text = self.edit_item_selection.currentText()
|
text = self.edit_item_selection.currentText()
|
||||||
|
@ -461,8 +468,12 @@ class MainWindow(KMainWindow, Ui_MainWindow):
|
||||||
self.item_title.clear()
|
self.item_title.clear()
|
||||||
self.item_position_input.setValue(0)
|
self.item_position_input.setValue(0)
|
||||||
|
|
||||||
|
|
||||||
def slot_load_preview_text(self, index):
|
def slot_load_preview_text(self, index):
|
||||||
preview, text = self.text_db[index]
|
try:
|
||||||
|
preview, text = self.model.text_db[index]
|
||||||
|
except IndexError:
|
||||||
|
return
|
||||||
self.preview_text.setTextOrHtml(text)
|
self.preview_text.setTextOrHtml(text)
|
||||||
if self.is_auto_publish:
|
if self.is_auto_publish:
|
||||||
self.live_text.setTextOrHtml(text)
|
self.live_text.setTextOrHtml(text)
|
||||||
|
@ -473,19 +484,20 @@ class MainWindow(KMainWindow, Ui_MainWindow):
|
||||||
preview = self.get_preview_text(unicode(self.live_text.toPlainText()))
|
preview = self.get_preview_text(unicode(self.live_text.toPlainText()))
|
||||||
if not preview:
|
if not preview:
|
||||||
return
|
return
|
||||||
old_item = self.text_by_preview(preview)
|
old_item = self.model.text_by_preview(preview)
|
||||||
if old_item is not None:
|
if old_item is not None:
|
||||||
suffix = 1
|
suffix = 1
|
||||||
while 1:
|
while 1:
|
||||||
tmp_preview = "%s_%d" % (preview, suffix)
|
tmp_preview = "%s_%d" % (preview, suffix)
|
||||||
tmp = self.text_by_preview(tmp_preview)
|
tmp = self.model.text_by_preview(tmp_preview)
|
||||||
if tmp is None:
|
if tmp is None:
|
||||||
preview = tmp_preview
|
preview = tmp_preview
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
suffix += 1
|
suffix += 1
|
||||||
|
|
||||||
self.text_db.append((preview, text))
|
self.model.text_db.append([preview, text])
|
||||||
|
self.model.modelReset.emit()
|
||||||
action = self.text_combo.addAction(preview)
|
action = self.text_combo.addAction(preview)
|
||||||
self.text_combo.setCurrentAction(action)
|
self.text_combo.setCurrentAction(action)
|
||||||
|
|
||||||
|
@ -495,7 +507,7 @@ class MainWindow(KMainWindow, Ui_MainWindow):
|
||||||
|
|
||||||
if not preview:
|
if not preview:
|
||||||
return
|
return
|
||||||
old_item = self.text_by_preview(preview)
|
old_item = self.model.text_by_preview(preview)
|
||||||
if old_item is not None:
|
if old_item is not None:
|
||||||
suffix = 1
|
suffix = 1
|
||||||
while 1:
|
while 1:
|
||||||
|
@ -507,9 +519,10 @@ class MainWindow(KMainWindow, Ui_MainWindow):
|
||||||
else:
|
else:
|
||||||
suffix += 1
|
suffix += 1
|
||||||
|
|
||||||
self.text_db.append((preview, text))
|
self.model.text_db.append([preview, text])
|
||||||
action = self.text_combo.addAction(preview)
|
self.model.modelReset.emit()
|
||||||
self.text_combo.setCurrentAction(action)
|
#action = self.text_combo.addAction(preview)
|
||||||
|
#self.text_combo.setCurrentAction(action)
|
||||||
|
|
||||||
def slot_save(self):
|
def slot_save(self):
|
||||||
path = os.path.expanduser("~/.texter")
|
path = os.path.expanduser("~/.texter")
|
||||||
|
@ -520,7 +533,7 @@ class MainWindow(KMainWindow, Ui_MainWindow):
|
||||||
except IOError:
|
except IOError:
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
cPickle.dump(self.text_db, f, cPickle.HIGHEST_PROTOCOL)
|
cPickle.dump(self.model.text_db, f, cPickle.HIGHEST_PROTOCOL)
|
||||||
|
|
||||||
def slot_valign(self):
|
def slot_valign(self):
|
||||||
fn = QtGui.QFontMetrics(self.font)
|
fn = QtGui.QFontMetrics(self.font)
|
||||||
|
@ -533,8 +546,12 @@ class MainWindow(KMainWindow, Ui_MainWindow):
|
||||||
self.statusBar().showMessage("text lines = %d, line height = %d, max lines = %d" % (lines, h, max_lines))
|
self.statusBar().showMessage("text lines = %d, line height = %d, max lines = %d" % (lines, h, max_lines))
|
||||||
|
|
||||||
def slot_open_dialog(self):
|
def slot_open_dialog(self):
|
||||||
self.dialog = TextSorterDialog(self)
|
self.dialog = KDialog(self)
|
||||||
self.dialog.open()
|
self.dialog_widget = TextSorterDialog(self.dialog)
|
||||||
|
self.dialog.setMainWidget(self.dialog_widget)
|
||||||
|
self.dialog.move(800, 0)
|
||||||
|
self.dialog.exec_()
|
||||||
|
self.fill_combo_box()
|
||||||
|
|
||||||
def slot_load(self):
|
def slot_load(self):
|
||||||
path = os.path.expanduser("~/.texter")
|
path = os.path.expanduser("~/.texter")
|
||||||
|
@ -546,17 +563,14 @@ class MainWindow(KMainWindow, Ui_MainWindow):
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.text_db = cPickle.load(f)
|
self.model.text_db = [list(i) for i in cPickle.load(f)]
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print e
|
print e
|
||||||
|
|
||||||
data = list()
|
self.fill_combo_box()
|
||||||
for title, text in self.text_db:
|
|
||||||
data.append((title, text))
|
|
||||||
self.text_combo.addAction(title)
|
|
||||||
|
|
||||||
self.text_combo.setCurrentItem(0)
|
self.text_combo.setCurrentItem(0)
|
||||||
self.slot_load_preview_text(0)
|
self.slot_load_preview_text(0)
|
||||||
|
self.slot_load_preview_text(0)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
|
@ -2,25 +2,71 @@
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>text_sorter_dialog</class>
|
<class>text_sorter_dialog</class>
|
||||||
<widget class="QDialog" name="text_sorter_dialog">
|
<widget class="QDialog" name="text_sorter_dialog">
|
||||||
<property name="geometry">
|
<property name="sizePolicy">
|
||||||
<rect>
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<x>0</x>
|
<horstretch>0</horstretch>
|
||||||
<y>0</y>
|
<verstretch>0</verstretch>
|
||||||
<width>612</width>
|
</sizepolicy>
|
||||||
<height>280</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>Dialog</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="KEditListWidget" name="text_list">
|
<widget class="QListView" name="text_list">
|
||||||
<property name="buttons">
|
<property name="minimumSize">
|
||||||
<set>KEditListWidget::Remove|KEditListWidget::UpDown</set>
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>576</height>
|
||||||
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>576</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="KButtonGroup" name="kbuttongroup">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="KPushButton" name="remove_button">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remove</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="edit-delete"/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="KArrowButton" name="move_up_button"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="KArrowButton" name="move_down_button">
|
||||||
|
<property name="arrowType" stdset="0">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -42,15 +88,26 @@
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>KEditListWidget</class>
|
<class>KArrowButton</class>
|
||||||
<extends>QWidget</extends>
|
<extends>QPushButton</extends>
|
||||||
<header>keditlistwidget.h</header>
|
<header>karrowbutton.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>KRichTextEdit</class>
|
<class>KRichTextEdit</class>
|
||||||
<extends>KTextEdit</extends>
|
<extends>KTextEdit</extends>
|
||||||
<header>krichtextedit.h</header>
|
<header>krichtextedit.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>KButtonGroup</class>
|
||||||
|
<extends>QGroupBox</extends>
|
||||||
|
<header>kbuttongroup.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>KPushButton</class>
|
||||||
|
<extends>QPushButton</extends>
|
||||||
|
<header>kpushbutton.h</header>
|
||||||
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>KTextEdit</class>
|
<class>KTextEdit</class>
|
||||||
<extends>QTextEdit</extends>
|
<extends>QTextEdit</extends>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# coding=UTF-8
|
# coding=UTF-8
|
||||||
#
|
#
|
||||||
# Generated by pykdeuic4 from text_sorter.ui on Mon Apr 14 08:37:13 2014
|
# Generated by pykdeuic4 from texter4.ui on Tue Apr 15 17:09:47 2014
|
||||||
#
|
#
|
||||||
# WARNING! All changes to this file will be lost.
|
# WARNING! All changes to this file will be lost.
|
||||||
from PyKDE4 import kdecore
|
from PyKDE4 import kdecore
|
||||||
|
@ -22,34 +22,47 @@ except AttributeError:
|
||||||
def _translate(context, text, disambig):
|
def _translate(context, text, disambig):
|
||||||
return QtGui.QApplication.translate(context, text, disambig)
|
return QtGui.QApplication.translate(context, text, disambig)
|
||||||
|
|
||||||
class Ui_text_sorter_dialog(object):
|
class Ui_TextSorterDialog(object):
|
||||||
def setupUi(self, text_sorter_dialog):
|
def setupUi(self, TextSorterDialog):
|
||||||
text_sorter_dialog.setObjectName(_fromUtf8("text_sorter_dialog"))
|
TextSorterDialog.setObjectName(_fromUtf8("TextSorterDialog"))
|
||||||
text_sorter_dialog.resize(612, 280)
|
TextSorterDialog.resize(588, 584)
|
||||||
self.verticalLayout = QtGui.QVBoxLayout(text_sorter_dialog)
|
self.horizontalLayout = QtGui.QHBoxLayout(TextSorterDialog)
|
||||||
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
|
|
||||||
self.horizontalLayout = QtGui.QHBoxLayout()
|
|
||||||
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
|
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
|
||||||
self.text_list = KEditListWidget(text_sorter_dialog)
|
self.text_list = QtGui.QListView(TextSorterDialog)
|
||||||
self.text_list.setButtons(KEditListWidget.Buttons(KEditListWidget.Remove|KEditListWidget.UpDown))
|
self.text_list.setMinimumSize(QtCore.QSize(0, 576))
|
||||||
|
self.text_list.setMaximumSize(QtCore.QSize(16777215, 576))
|
||||||
self.text_list.setObjectName(_fromUtf8("text_list"))
|
self.text_list.setObjectName(_fromUtf8("text_list"))
|
||||||
self.horizontalLayout.addWidget(self.text_list)
|
self.horizontalLayout.addWidget(self.text_list)
|
||||||
self.text_preview = KRichTextWidget(text_sorter_dialog)
|
self.kbuttongroup = KButtonGroup(TextSorterDialog)
|
||||||
|
self.kbuttongroup.setObjectName(_fromUtf8("kbuttongroup"))
|
||||||
|
self.verticalLayout = QtGui.QVBoxLayout(self.kbuttongroup)
|
||||||
|
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
|
||||||
|
self.remove_button = KPushButton(self.kbuttongroup)
|
||||||
|
icon = QtGui.QIcon.fromTheme(_fromUtf8("edit-delete"))
|
||||||
|
self.remove_button.setIcon(icon)
|
||||||
|
self.remove_button.setObjectName(_fromUtf8("remove_button"))
|
||||||
|
self.verticalLayout.addWidget(self.remove_button)
|
||||||
|
self.move_up_button = KArrowButton(self.kbuttongroup)
|
||||||
|
self.move_up_button.setObjectName(_fromUtf8("move_up_button"))
|
||||||
|
self.verticalLayout.addWidget(self.move_up_button)
|
||||||
|
self.move_down_button = KArrowButton(self.kbuttongroup)
|
||||||
|
self.move_down_button.setProperty("arrowType", 2)
|
||||||
|
self.move_down_button.setObjectName(_fromUtf8("move_down_button"))
|
||||||
|
self.verticalLayout.addWidget(self.move_down_button)
|
||||||
|
spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||||
|
self.verticalLayout.addItem(spacerItem)
|
||||||
|
self.horizontalLayout.addWidget(self.kbuttongroup)
|
||||||
|
self.text_preview = KRichTextWidget(TextSorterDialog)
|
||||||
|
self.text_preview.setMinimumSize(QtCore.QSize(0, 576))
|
||||||
|
self.text_preview.setMaximumSize(QtCore.QSize(16777215, 576))
|
||||||
self.text_preview.setObjectName(_fromUtf8("text_preview"))
|
self.text_preview.setObjectName(_fromUtf8("text_preview"))
|
||||||
self.horizontalLayout.addWidget(self.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)
|
self.retranslateUi(TextSorterDialog)
|
||||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), text_sorter_dialog.accept)
|
QtCore.QMetaObject.connectSlotsByName(TextSorterDialog)
|
||||||
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):
|
def retranslateUi(self, TextSorterDialog):
|
||||||
text_sorter_dialog.setWindowTitle(kdecore.i18n(_fromUtf8("Dialog")))
|
TextSorterDialog.setWindowTitle(kdecore.i18n(_fromUtf8("Form")))
|
||||||
|
self.remove_button.setText(kdecore.i18n(_fromUtf8("Remove")))
|
||||||
|
|
||||||
from PyKDE4.kdeui import KEditListWidget, KRichTextWidget
|
from PyKDE4.kdeui import KButtonGroup, KArrowButton, KPushButton, KRichTextWidget
|
||||||
|
|
|
@ -0,0 +1,126 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>TextSorterDialog</class>
|
||||||
|
<widget class="QWidget" name="TextSorterDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>588</width>
|
||||||
|
<height>584</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QListView" name="text_list">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>576</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>576</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="KButtonGroup" name="kbuttongroup">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="KPushButton" name="remove_button">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remove</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="edit-delete">
|
||||||
|
<normaloff>../../../../</normaloff>../../../../</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="KArrowButton" name="move_up_button"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="KArrowButton" name="move_down_button">
|
||||||
|
<property name="arrowType" stdset="0">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="KRichTextWidget" name="text_preview">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>576</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>576</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>KArrowButton</class>
|
||||||
|
<extends>QPushButton</extends>
|
||||||
|
<header>karrowbutton.h</header>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>KRichTextEdit</class>
|
||||||
|
<extends>KTextEdit</extends>
|
||||||
|
<header>krichtextedit.h</header>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>KButtonGroup</class>
|
||||||
|
<extends>QGroupBox</extends>
|
||||||
|
<header>kbuttongroup.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>KPushButton</class>
|
||||||
|
<extends>QPushButton</extends>
|
||||||
|
<header>kpushbutton.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/>
|
||||||
|
</ui>
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# coding=UTF-8
|
# coding=UTF-8
|
||||||
#
|
#
|
||||||
# Generated by pykdeuic4 from texter3.ui on Mon Apr 14 08:37:12 2014
|
# Generated by pykdeuic4 from texter3.ui on Tue Apr 15 16:21:39 2014
|
||||||
#
|
#
|
||||||
# WARNING! All changes to this file will be lost.
|
# WARNING! All changes to this file will be lost.
|
||||||
from PyKDE4 import kdecore
|
from PyKDE4 import kdecore
|
||||||
|
@ -67,7 +67,7 @@ class Ui_MainWindow(object):
|
||||||
self.live_text.setAutoFillBackground(False)
|
self.live_text.setAutoFillBackground(False)
|
||||||
self.live_text.setAcceptRichText(True)
|
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.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.setRichTextSupport(KRichTextWidget.RichTextSupportValues(KRichTextWidget.SupportAlignment|KRichTextWidget.SupportChangeListStyle|KRichTextWidget.SupportFontFamily|KRichTextWidget.SupportFontSize|KRichTextWidget.SupportTextForegroundColor))
|
||||||
self.live_text.setObjectName(_fromUtf8("live_text"))
|
self.live_text.setObjectName(_fromUtf8("live_text"))
|
||||||
self.horizontalLayout.addWidget(self.live_text)
|
self.horizontalLayout.addWidget(self.live_text)
|
||||||
self.preview_text = KRichTextWidget(self.centralwidget)
|
self.preview_text = KRichTextWidget(self.centralwidget)
|
||||||
|
|
Loading…
Reference in New Issue