Anonymous committed 7391bc8

Config: Flattr is shown, but not yet nice.

Comments (0)

Files changed (1)

 from PyQt4.QtGui import QWidget, QGridLayout, QVBoxLayout, QHBoxLayout, QCursor, QIcon, QLabel, QLineEdit, QPushButton, QKeySequence, QPolygon
 # basic definitions and datatypes
 from PyQt4.QtCore import Qt, QPointF, QPoint, SIGNAL, SLOT
+from PyQt4.QtWebKit import QWebView
 # Basics for KDE integration
 from PyKDE4.kdeui import KIconLoader, KAction, KActionCollection, KShortcut, KShapeGesture
         self.config_gestures = QPushButton("Gestures")
-        self.lay.addWidget(self.config_layout)
+        self.lay.addLayout(self.config_layout)
         # now a flattr line
+        self.flattr_layout = QHBoxLayout()
+        self.flattr_left = QLabel("""If you like
+        self.flattr_right = QLabel("""Why don’t you
+Flattr me? :)""")
         self.flattr_html = QWebView()
         # I use the flattr button from Wikimedia commons to avoid data retention hassles. TODO: ship our own flattr button to avoid the web access. 
-        self.flattr_html.setHtml("""<html><head><title>flattr me</title></head><body><table><tr><td>If you <br />
-        like pyRad</td><td><a href="" target="_blank">
+        self.flattr_html.setHtml("""<html><head><title>flattr me</title></head><body><table><tr><td style="text-align: right">If you like<br />
+        pyRad</td><td><a href="" target="_blank">
 <img src="" alt="Flattr this" title="Flattr this" border="0" /></a></td><td>Why don’t you <br />
 flattr me? :)</td></tr>
 <tr><td colspan=3><a href=""></a></td></tr></table></body></html>""")
+class ConfigEditor(KDialog):
+    """edit the base config"""
+    def __init__(self, parent=None):
+        QWidget.__init__(self, parent)
+        # Add the ConfigWidget
+        self.main = ConfigWidget(self)
+        self.setMainWidget(self.main)
+    def config(self):
+        """Show and raise the config dialog."""
+        self.raise_()
+        self.activateWindow()
+        # run it, but don’t do anything with the result. 
+        if self.exec_() == self.Accepted:
+            return
 class ItemEditWidget(QWidget):
         # Also we need an editor for the items. Call it with self.editor.exec(item).
         self.editor = ItemEditor(self)
+        # and a config editor
+        self.editor_config = ConfigEditor(self)
     def focusOutEvent(self, event):
 		elif event.button() == Qt.RightButton and i ==[0]:
 		    # TODO: right-click on the middle item should show the options. 
 		    # currently we just don't edit it. 
-                    break
+                    self.editor_config.config()
 		elif event.button() == Qt.MidButton: