GUI mockup for lite mode.
authorAmir Taaki <genjix@riseup.net>
Wed, 27 Jun 2012 20:15:52 +0000 (22:15 +0200)
committerAmir Taaki <genjix@riseup.net>
Wed, 27 Jun 2012 20:15:52 +0000 (22:15 +0200)
data/background.png [new file with mode: 0644]
data/icons/accounts.png [new file with mode: 0644]
data/icons/confirmed.png [new file with mode: 0644]
data/icons/expand.png [new file with mode: 0644]
data/icons/interact.png [new file with mode: 0644]
data/icons/unconfirmed.png [new file with mode: 0644]
data/style.css [new file with mode: 0644]
gui_new.py [new file with mode: 0644]

diff --git a/data/background.png b/data/background.png
new file mode 100644 (file)
index 0000000..d106c09
Binary files /dev/null and b/data/background.png differ
diff --git a/data/icons/accounts.png b/data/icons/accounts.png
new file mode 100644 (file)
index 0000000..b932d91
Binary files /dev/null and b/data/icons/accounts.png differ
diff --git a/data/icons/confirmed.png b/data/icons/confirmed.png
new file mode 100644 (file)
index 0000000..901be18
Binary files /dev/null and b/data/icons/confirmed.png differ
diff --git a/data/icons/expand.png b/data/icons/expand.png
new file mode 100644 (file)
index 0000000..379e745
Binary files /dev/null and b/data/icons/expand.png differ
diff --git a/data/icons/interact.png b/data/icons/interact.png
new file mode 100644 (file)
index 0000000..acc65b7
Binary files /dev/null and b/data/icons/interact.png differ
diff --git a/data/icons/unconfirmed.png b/data/icons/unconfirmed.png
new file mode 100644 (file)
index 0000000..fd9a0d2
Binary files /dev/null and b/data/icons/unconfirmed.png differ
diff --git a/data/style.css b/data/style.css
new file mode 100644 (file)
index 0000000..2014c09
--- /dev/null
@@ -0,0 +1,35 @@
+QDialog
+{
+    background-image: url(data/background.png);
+}
+
+#address_input[readOnly=true], #amount_input[readOnly=true]
+{
+    font: italic;
+    color: gray;
+}
+#address_input[readOnly=false], #amount_input[readOnly=false]
+{
+    font: normal;
+    color: black;
+}
+
+#valid_address::indicator
+{
+    width: 24px;
+    height: 24px;
+}
+#valid_address::indicator:checked
+{
+    image: url(data/icons/confirmed.png);
+}
+#valid_address::indicator:unchecked
+{
+    image: url(data/icons/unconfirmed.png);
+}
+
+#balance_label
+{
+    color: white;
+}
+
diff --git a/gui_new.py b/gui_new.py
new file mode 100644 (file)
index 0000000..56c9814
--- /dev/null
@@ -0,0 +1,136 @@
+from PyQt4.QtCore import *
+from PyQt4.QtGui import *
+import sys
+
+_ = lambda trtext: trtext
+
+def IconButton(filename, parent=None):
+    pixmap = QPixmap(filename)
+    icon = QIcon(pixmap)
+    return QPushButton(icon, "", parent)
+
+class MiniWindow(QDialog):
+    def __init__(self):
+        super(MiniWindow, self).__init__()
+
+        accounts_button = IconButton("data/icons/accounts.png")
+        accounts_button.setObjectName("accounts_button")
+
+        accounts_selector = QMenu()
+        accounts_selector.addAction("Normal (80.00 BTC)")
+        accounts_selector.addAction("Drugs (7.50 BTC)")
+        accounts_selector.addAction("Reddit Girls (3.50 BTC)")
+        accounts_button.setMenu(accounts_selector)
+
+        interact_button = IconButton("data/icons/interact.png")
+        interact_button.setObjectName("interact_button")
+
+        app_menu = QMenu()
+        app_menu.addAction("Blaa")
+        file_menu = QMenu("File", app_menu)
+        file_menu.addAction("Foo")
+        file_menu.addAction("Bar")
+        app_menu.addMenu(file_menu)
+        app_menu.addAction("Other")
+        interact_button.setMenu(app_menu)
+
+        expand_button = IconButton("data/icons/expand.png")
+        expand_button.setObjectName("expand_button")
+
+        balance_label = BalanceLabel("80.00", "60.00", "EUR")
+        balance_label.setObjectName("balance_label")
+
+        copy_button = QPushButton(_("&Copy Address"))
+        copy_button.setObjectName("copy_button")
+        copy_button.setDefault(True)
+
+        # Use QCompleter
+        address_input = TextedLineEdit(_("Enter a Bitcoin address..."))
+        address_input.setObjectName("address_input")
+        valid_address = QCheckBox()
+        valid_address.setObjectName("valid_address")
+        valid_address.setEnabled(False)
+        #valid_address.setChecked(True)
+
+        address_layout = QHBoxLayout()
+        address_layout.addWidget(address_input)
+        address_layout.addWidget(valid_address)
+
+        amount_input = TextedLineEdit(_("... and amount"))
+        amount_input.setObjectName("amount_input")
+
+        amount_layout = QHBoxLayout()
+        amount_layout.addWidget(amount_input)
+        amount_layout.addStretch()
+
+        send_button = QPushButton(_("&Send"))
+        send_button.setObjectName("send_button")
+
+        main_layout = QGridLayout(self)
+        main_layout.addWidget(accounts_button, 0, 0)
+        main_layout.addWidget(interact_button, 1, 0)
+        main_layout.addWidget(expand_button, 2, 0)
+
+        main_layout.addWidget(balance_label, 0, 1)
+        main_layout.addWidget(copy_button, 0, 2)
+
+        main_layout.addLayout(address_layout, 1, 1, 1, -1)
+
+        main_layout.addLayout(amount_layout, 2, 1)
+        main_layout.addWidget(send_button, 2, 2)
+
+        self.setWindowTitle("Electrum - Normal (80.00 BTC)")
+        self.setWindowFlags(Qt.Window|Qt.MSWindowsFixedSizeDialogHint)
+        self.layout().setSizeConstraint(QLayout.SetFixedSize)
+        self.setObjectName("main_window")
+        self.show()
+
+    def closeEvent(self, event):
+        super(MiniWindow, self).closeEvent(event)
+        qApp.quit()
+
+class BalanceLabel(QLabel):
+    def __init__(self, btc_balance,
+                 quote_balance, quote_currency, parent=None):
+        label_text = "<span style='font-size: 16pt'>%s</span> <span style='font-size: 10pt'>BTC</span> <span style='font-size: 10pt'>(%s %s)</span>"%(btc_balance, quote_balance, quote_currency)
+        super(QLabel, self).__init__(label_text, parent)
+
+class TextedLineEdit(QLineEdit):
+    def __init__(self, inactive_text, parent=None):
+        super(QLineEdit, self).__init__(parent)
+        self.inactive_text = inactive_text
+        self.become_inactive()
+
+    def mousePressEvent(self, event):
+        if self.isReadOnly():
+            self.become_active()
+        return super(QLineEdit, self).mousePressEvent(event)
+
+    def focusOutEvent(self, event):
+        if self.text() == "":
+            self.become_inactive()
+        return super(QLineEdit, self).focusOutEvent(event)
+
+    def become_inactive(self):
+        self.setText(self.inactive_text)
+        self.setReadOnly(True)
+        self.recompute_style()
+
+    def become_active(self):
+        self.setText("")
+        self.setReadOnly(False)
+        self.recompute_style()
+
+    def recompute_style(self):
+        qApp.style().unpolish(self)
+        qApp.style().polish(self)
+        # also possible but more expensive:
+        #qApp.setStyleSheet(qApp.styleSheet())
+
+if __name__ == "__main__":
+    app = QApplication(sys.argv)
+    with open("data/style.css") as style_file:
+        app.setStyleSheet(style_file.read())
+    mini = MiniWindow()
+    sys.exit(app.exec_())
+