tLoad resources across many platforms from the shared appdir - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 40a4bf3c913508e96439b7a6c228be56737b1a8b DIR parent 78a4edede4c28e2a04561af6fb83cfaad7052758 HTML Author: Amir Taaki <genjix@riseup.net> Date: Thu, 5 Jul 2012 01:59:57 +0200 Load resources across many platforms from the shared appdir Diffstat: M lib/gui_lite.py | 17 +++++++++-------- M setup.py | 1 + 2 files changed, 10 insertions(+), 8 deletions(-) --- DIR diff --git a/lib/gui_lite.py b/lib/gui_lite.py t@@ -1,6 +1,7 @@ from PyQt4.QtCore import * from PyQt4.QtGui import * from decimal import Decimal as D +from util import get_resource_path as rsrc from i18n import _ import decimal import exchange_rate t@@ -33,7 +34,8 @@ class ElectrumGui: def __init__(self, wallet): self.wallet = wallet self.app = QApplication(sys.argv) - with open("data/style.css") as style_file: + QDir.setCurrent(rsrc()) + with open(rsrc("style.css")) as style_file: self.app.setStyleSheet(style_file.read()) def main(self, url): t@@ -82,13 +84,13 @@ class MiniWindow(QDialog): self.actuator = actuator - accounts_button = IconButton("data/icons/accounts.png") + accounts_button = IconButton(rsrc("icons", "accounts.png")) accounts_button.setObjectName("accounts_button") self.accounts_selector = QMenu() accounts_button.setMenu(self.accounts_selector) - interact_button = IconButton("data/icons/interact.png") + interact_button = IconButton(rsrc("icons", "interact.png")) interact_button.setObjectName("interact_button") app_menu = QMenu(interact_button) t@@ -103,7 +105,7 @@ class MiniWindow(QDialog): self.connect(about_action, SIGNAL("triggered()"), self.show_about) self.connect(quit_action, SIGNAL("triggered()"), self.close) - expand_button = IconButton("data/icons/expand.png") + expand_button = IconButton(rsrc("icons", "expand.png")) expand_button.setObjectName("expand_button") self.connect(expand_button, SIGNAL("clicked()"), expand_callback) t@@ -136,7 +138,6 @@ class MiniWindow(QDialog): address_completer.setCaseSensitivity(False) address_completer.setModel(self.address_completions) self.address_input.setCompleter(address_completer) - self.address_completions.setStringList(["1brmlab", "hello"]) self.valid_address = QCheckBox() self.valid_address.setObjectName("valid_address") t@@ -354,10 +355,10 @@ class TextedLineEdit(QLineEdit): def ok_cancel_buttons(dialog): row_layout = QHBoxLayout() row_layout.addStretch(1) - ok_button = QPushButton("OK") + ok_button = QPushButton(_("OK")) row_layout.addWidget(ok_button) ok_button.clicked.connect(dialog.accept) - cancel_button = QPushButton("Cancel") + cancel_button = QPushButton(_("Cancel")) row_layout.addWidget(cancel_button) cancel_button.clicked.connect(dialog.reject) return row_layout t@@ -546,7 +547,7 @@ class MiniDriver(QObject): if __name__ == "__main__": app = QApplication(sys.argv) - with open("data/style.css") as style_file: + with open(rsrc("style.css")) as style_file: app.setStyleSheet(style_file.read()) mini = MiniWindow() sys.exit(app.exec_()) DIR diff --git a/setup.py b/setup.py t@@ -53,6 +53,7 @@ setup(name = "Electrum", 'electrum.pyqrnative', 'electrum.bmp', 'electrum.msqr', + 'electrum.util', 'electrum.i18n'], description = "Lightweight Bitcoin Wallet", author = "thomasv",