From aff2820217940053e9ab4b7cf55dd1d088323747 Mon Sep 17 00:00:00 2001 From: Amir Taaki Date: Mon, 23 Jul 2012 20:59:11 +0200 Subject: [PATCH 01/14] Added Tachikoma and coblee. --- AUTHORS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/AUTHORS b/AUTHORS index 24cbe9d01..0ee8cd471 100644 --- a/AUTHORS +++ b/AUTHORS @@ -2,4 +2,6 @@ ThomasV - authored Electrum flatfly - windows build author genjix - worked on server and parts of the gui Julian Tosh (Tuxavant) - various changes +Tachikoma - Mac version, and various fixes to the gui +coblee - Litecoin support in the server. From 04300ea54594a791c96f879d0d7e67e893b9d68d Mon Sep 17 00:00:00 2001 From: Amir Taaki Date: Mon, 23 Jul 2012 21:00:45 +0200 Subject: [PATCH 02/14] updated coblee description. --- AUTHORS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 0ee8cd471..5a4a69a3a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -3,5 +3,5 @@ flatfly - windows build author genjix - worked on server and parts of the gui Julian Tosh (Tuxavant) - various changes Tachikoma - Mac version, and various fixes to the gui -coblee - Litecoin support in the server. +coblee - Litecoin support in the server, Mac installer. From 53a5adde5dbb1e5fbf4aab62a877bc12be7059bd Mon Sep 17 00:00:00 2001 From: Maran Date: Tue, 24 Jul 2012 13:31:47 +0200 Subject: [PATCH 03/14] Added lighter theme --- lib/gui_lite.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/gui_lite.py b/lib/gui_lite.py index 758257608..80d4b0a2a 100644 --- a/lib/gui_lite.py +++ b/lib/gui_lite.py @@ -56,7 +56,7 @@ class ElectrumGui: # change the behaviour of rsrc(...) self.old_path = QDir.currentPath() cd_data_dir() - with open(rsrc("style.css")) as style_file: + with open(rsrc("lighter.css")) as style_file: self.app.setStyleSheet(style_file.read()) def main(self, url): @@ -344,7 +344,7 @@ class BalanceLabel(QLabel): def set_balance_text(self, btc_balance, quote_text): if self.state == self.SHOW_CONNECTING: self.state = self.SHOW_BALANCE - self.balance_text = "%s BTC %s" % (btc_balance, quote_text) + self.balance_text = "%s BTC %s" % (btc_balance, quote_text) if self.state == self.SHOW_BALANCE: self.setText(self.balance_text) From 56bb63ab925dc4b109f82b95adffc02fe8cf8b39 Mon Sep 17 00:00:00 2001 From: Maran Date: Tue, 24 Jul 2012 13:35:51 +0200 Subject: [PATCH 04/14] Added style sheet --- data/lighter.css | 64 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 data/lighter.css diff --git a/data/lighter.css b/data/lighter.css new file mode 100644 index 000000000..490fc332f --- /dev/null +++ b/data/lighter.css @@ -0,0 +1,64 @@ +#main_window +{ + background: qlineargradient(x1: 0, y1: 0, x2:0,y2:1, stop: 0 white , stop: 1 #E8E8E8); +} + +QPushButton { + color: #777; + border: 1px solid #CCC; + border-radius: 0px; + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 white, stop: 1 #E6E6E6); + min-height: 20px; + min-width: 30px; +} + + +#send_button{ + color: #E5F2FF; + border: 1px solid #3786E6; + border-radius: 4px; + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #72B2F8, stop: 1 #3484E6); + min-width: 80px; + min-height: 20px; +} + +#address_input[readOnly=true], #amount_input[readOnly=true] +{ + color: #ABABAB; + padding: 5px; + border-radius: 4px; + border: 1px solid #AAA9A9; + width: 225px; +} +#address_input[readOnly=false], #amount_input[readOnly=false] +{ + padding: 2px; + border: 1px solid #AAA9A9; + font: normal; + color: #424242; + border-radius: 4px; + font-size: 95%; + width: 225px; +} + +#valid_address::indicator +{ + width: 24px; + height: 24px; +} +#valid_address::indicator:checked +{ + image: url(icons/confirmed.png); +} +#valid_address::indicator:unchecked +{ + image: url(icons/unconfirmed.png); +} + +#balance_label +{ + color: #333; +} + From 9619cef342dd20af66de42f135c99a976427a3cd Mon Sep 17 00:00:00 2001 From: Maran Date: Tue, 24 Jul 2012 14:19:51 +0200 Subject: [PATCH 05/14] Cleaned up the layout a bit more --- data/lighter.css | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/data/lighter.css b/data/lighter.css index 490fc332f..4138d8510 100644 --- a/data/lighter.css +++ b/data/lighter.css @@ -3,13 +3,13 @@ background: qlineargradient(x1: 0, y1: 0, x2:0,y2:1, stop: 0 white , stop: 1 #E8E8E8); } -QPushButton { +MiniWindow QPushButton { color: #777; border: 1px solid #CCC; border-radius: 0px; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 white, stop: 1 #E6E6E6); - min-height: 20px; + min-height: 25px; min-width: 30px; } @@ -21,7 +21,8 @@ QPushButton { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #72B2F8, stop: 1 #3484E6); min-width: 80px; - min-height: 20px; + min-height: 23px; + padding: 2px; } #address_input[readOnly=true], #amount_input[readOnly=true] @@ -31,6 +32,7 @@ QPushButton { border-radius: 4px; border: 1px solid #AAA9A9; width: 225px; + margin-top: 4px; } #address_input[readOnly=false], #amount_input[readOnly=false] { @@ -41,12 +43,14 @@ QPushButton { border-radius: 4px; font-size: 95%; width: 225px; + margin-top: 4px; } #valid_address::indicator { width: 24px; height: 24px; + margin-top: 2px; } #valid_address::indicator:checked { @@ -61,4 +65,3 @@ QPushButton { { color: #333; } - From 7ba5f07629d11efa69df30234e44390a99a89755 Mon Sep 17 00:00:00 2001 From: Maran Date: Tue, 24 Jul 2012 14:58:10 +0200 Subject: [PATCH 06/14] Reworked the logic for the send button, you can only press it when the amount and a valid address is given --- data/lighter.css | 11 +++++++++++ lib/gui_lite.py | 19 +++++++++++++++---- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/data/lighter.css b/data/lighter.css index 4138d8510..2f3a3f280 100644 --- a/data/lighter.css +++ b/data/lighter.css @@ -25,6 +25,17 @@ MiniWindow QPushButton { padding: 2px; } +#send_button:disabled{ + color: #D3E8FE; + border: 1px solid #6DAEF7; + border-radius: 4px; + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #A5CFFA, stop: 1 #72B2F8); + min-width: 80px; + min-height: 23px; + padding: 2px; +} + #address_input[readOnly=true], #amount_input[readOnly=true] { color: #ABABAB; diff --git a/lib/gui_lite.py b/lib/gui_lite.py index 80d4b0a2a..f38f44111 100644 --- a/lib/gui_lite.py +++ b/lib/gui_lite.py @@ -191,9 +191,10 @@ class MiniWindow(QDialog): amount_layout.addWidget(self.amount_input) amount_layout.addStretch() - send_button = QPushButton(_("&Send")) - send_button.setObjectName("send_button") - self.connect(send_button, SIGNAL("clicked()"), self.send) + self.send_button = QPushButton(_("&Send")) + self.send_button.setObjectName("send_button") + self.send_button.setDisabled(True); + self.connect(self.send_button, SIGNAL("clicked()"), self.send) main_layout = QGridLayout(self) main_layout.addWidget(accounts_button, 0, 0) @@ -206,7 +207,7 @@ class MiniWindow(QDialog): main_layout.addLayout(address_layout, 1, 1, 1, -1) main_layout.addLayout(amount_layout, 2, 1) - main_layout.addWidget(send_button, 2, 2) + main_layout.addWidget(self.send_button, 2, 2) quit_shortcut = QShortcut(QKeySequence("Ctrl+Q"), self) self.connect(quit_shortcut, SIGNAL("activated()"), self.close) @@ -272,6 +273,8 @@ class MiniWindow(QDialog): quote_text)) def amount_input_changed(self, amount_text): + self.check_button_status() + try: amount = D(str(amount_text)) except decimal.InvalidOperation: @@ -300,11 +303,19 @@ class MiniWindow(QDialog): self.address_input.become_inactive() self.amount_input.become_inactive() + def check_button_status(self): + if self.amount_input.text() != _("... and amount") and len(self.amount_input.text()) != 0: + self.send_button.setDisabled(False) + else: + self.send_button.setDisabled(True) + def address_field_changed(self, address): if self.actuator.is_valid(address): self.valid_address.setChecked(True) + self.check_button_status() else: self.valid_address.setChecked(False) + self.send_button.setDisabled(True) def copy_address(self): receive_popup = ReceivePopup(self.receive_button) From f4218d441e3a3309d95e03e4bb7ae3056e23fbf0 Mon Sep 17 00:00:00 2001 From: Maran Date: Tue, 24 Jul 2012 14:59:41 +0200 Subject: [PATCH 07/14] Removed lighter.css and moved it to the default layout --- data/lighter.css | 78 ------------------------------------------------ data/style.css | 55 ++++++++++++++++++++++++++++++---- lib/gui_lite.py | 2 +- 3 files changed, 50 insertions(+), 85 deletions(-) delete mode 100644 data/lighter.css diff --git a/data/lighter.css b/data/lighter.css deleted file mode 100644 index 2f3a3f280..000000000 --- a/data/lighter.css +++ /dev/null @@ -1,78 +0,0 @@ -#main_window -{ - background: qlineargradient(x1: 0, y1: 0, x2:0,y2:1, stop: 0 white , stop: 1 #E8E8E8); -} - -MiniWindow QPushButton { - color: #777; - border: 1px solid #CCC; - border-radius: 0px; - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, - stop: 0 white, stop: 1 #E6E6E6); - min-height: 25px; - min-width: 30px; -} - - -#send_button{ - color: #E5F2FF; - border: 1px solid #3786E6; - border-radius: 4px; - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, - stop: 0 #72B2F8, stop: 1 #3484E6); - min-width: 80px; - min-height: 23px; - padding: 2px; -} - -#send_button:disabled{ - color: #D3E8FE; - border: 1px solid #6DAEF7; - border-radius: 4px; - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, - stop: 0 #A5CFFA, stop: 1 #72B2F8); - min-width: 80px; - min-height: 23px; - padding: 2px; -} - -#address_input[readOnly=true], #amount_input[readOnly=true] -{ - color: #ABABAB; - padding: 5px; - border-radius: 4px; - border: 1px solid #AAA9A9; - width: 225px; - margin-top: 4px; -} -#address_input[readOnly=false], #amount_input[readOnly=false] -{ - padding: 2px; - border: 1px solid #AAA9A9; - font: normal; - color: #424242; - border-radius: 4px; - font-size: 95%; - width: 225px; - margin-top: 4px; -} - -#valid_address::indicator -{ - width: 24px; - height: 24px; - margin-top: 2px; -} -#valid_address::indicator:checked -{ - image: url(icons/confirmed.png); -} -#valid_address::indicator:unchecked -{ - image: url(icons/unconfirmed.png); -} - -#balance_label -{ - color: #333; -} diff --git a/data/style.css b/data/style.css index 61a86e658..2f3a3f280 100644 --- a/data/style.css +++ b/data/style.css @@ -1,23 +1,67 @@ #main_window { - background-image: url(background.png); + background: qlineargradient(x1: 0, y1: 0, x2:0,y2:1, stop: 0 white , stop: 1 #E8E8E8); +} + +MiniWindow QPushButton { + color: #777; + border: 1px solid #CCC; + border-radius: 0px; + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 white, stop: 1 #E6E6E6); + min-height: 25px; + min-width: 30px; +} + + +#send_button{ + color: #E5F2FF; + border: 1px solid #3786E6; + border-radius: 4px; + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #72B2F8, stop: 1 #3484E6); + min-width: 80px; + min-height: 23px; + padding: 2px; +} + +#send_button:disabled{ + color: #D3E8FE; + border: 1px solid #6DAEF7; + border-radius: 4px; + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #A5CFFA, stop: 1 #72B2F8); + min-width: 80px; + min-height: 23px; + padding: 2px; } #address_input[readOnly=true], #amount_input[readOnly=true] { - font: italic; - color: gray; + color: #ABABAB; + padding: 5px; + border-radius: 4px; + border: 1px solid #AAA9A9; + width: 225px; + margin-top: 4px; } #address_input[readOnly=false], #amount_input[readOnly=false] { + padding: 2px; + border: 1px solid #AAA9A9; font: normal; - color: black; + color: #424242; + border-radius: 4px; + font-size: 95%; + width: 225px; + margin-top: 4px; } #valid_address::indicator { width: 24px; height: 24px; + margin-top: 2px; } #valid_address::indicator:checked { @@ -30,6 +74,5 @@ #balance_label { - color: white; + color: #333; } - diff --git a/lib/gui_lite.py b/lib/gui_lite.py index f38f44111..93fcd6b3c 100644 --- a/lib/gui_lite.py +++ b/lib/gui_lite.py @@ -56,7 +56,7 @@ class ElectrumGui: # change the behaviour of rsrc(...) self.old_path = QDir.currentPath() cd_data_dir() - with open(rsrc("lighter.css")) as style_file: + with open(rsrc("style.css")) as style_file: self.app.setStyleSheet(style_file.read()) def main(self, url): From 05dc59a5c9c7a60dc645fe7da0117c829b2e51dc Mon Sep 17 00:00:00 2001 From: Amir Taaki Date: Mon, 30 Jul 2012 20:34:59 -0300 Subject: [PATCH 08/14] Replaced left buttons with a menubar. --- data/icons/accounts.png | Bin 921 -> 0 bytes data/icons/expand.png | Bin 657 -> 0 bytes data/icons/interact.png | Bin 968 -> 0 bytes lib/gui_lite.py | 62 +++++++++++++++++++++------------------- 4 files changed, 32 insertions(+), 30 deletions(-) delete mode 100644 data/icons/accounts.png delete mode 100644 data/icons/expand.png delete mode 100644 data/icons/interact.png diff --git a/data/icons/accounts.png b/data/icons/accounts.png deleted file mode 100644 index b932d91946715587e19ad57e1c4d760bd77d3fad..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 921 zcmV;K17`e*P)$+_^Jzn@naViOEzZC2^8q66_<1 z9TK4~DvD4=6cj|MA|kH3l62)#6m?TK>Z-Mig5sl!p`-*gO>2FmnkY6glj)e}yfVq1 z_nrH9)0Ak$4?Z|&@g2^``HqlMvKzsJ>gYf$`f@g%TU@xdex|S_*Z3c3yPN$Fxn6(q z)HA0$5A>?O29xpMK6y0|Q;%h@)MvtB;e9mfdU`fl`(kQAZtQ53ok9rV>gaBN)(q`a zYo0PCW1FEv{r-DKIQi6J(RFcbWd6*XV;`J*_qqAgPl|{43@|$w$@^9g4)X`^=o{4$NJ6{f``TN!AE+}87{BiO8vR4tIgiV&S1;TyE>lC>r_vB=B-`cY*TfP|J&B`P zNLPin7T=%{Lel_R!hxfh65FU!(k&dVhOLybsp2>`{zxO={Qec);Rv#pgTe+iSyll> z5kiQHrx5+CzR0$|iPW;V#0G|%!K>vdyHaHJ4dQHJyKYeT-NI=sb7P%JDP>iYQp(O( z)WjmQttD%Y3NBi714YR6!JlzccT>-F=&o#2-ye8WSuG64F?x2!dEC z+G$}Qg8mu7#=+?TH(0&)2m!3oDyQV&4)ZX=G~pao@!G zo9~vJ_+Zf4>bjo3ij$C;aq9N;%;53S@jRFXWM)PPW+t(f`Lx+Te7czh1av;WdSuPj zH}$huW?HYGUylKfjhq-iIW~6A2g8>k`Cv5K8Q*?y(DgGq7vWYhlMGpUC@on?zok=VEzV`CL6QIbzz`ThZqX5B|ziqmu zSQ3iehV3#m|3eIbH{pTCcE+!*j3|nz#*VZiLK^KFatx3o%dLO}#L{|)v=UKIL|SpA ziRje#03eyCaCgqACPrUU0+Qkft=jG*6Bl}jBT;p*9Ri1YV$#yRfQY2N2cVY7>Qxat z$TQ<;Z&UzE_j=->wnquA<)wwy)L9&vwYyy(LY8N-P$Dc6dE#g^PT z0Mzl?H3?d6luD)2Vve8)As-JE#WR)OeVMNNQhuuNtT}W+2(45qmI_27)@HN4y;oj- zvht4#WB%?v`v~yQl?&(Z{;L51AWo!2Ws!WfkT9Sy>z9 zJv~-?(dkp_<|gwX<2w!^h}NYfgQjWRe^AxaXR|%@xZNYmHJSp6R2rO`p_jLJc6i!a zT7GVBG7oz1&D($I$PfDu9{#ShtbDw;{}m}b_hWmgRO;syN|TTncBc6I2lr|ki1C-p z!vI9HB5D$o;&vGf->hA`?m%Q@q+sy%Fln|tIyy8k;Pf&y{r%S~`_SNRhM}=cr3%(% z=)dw}JU*Z8D>0eAt*ftVr6>yTr=55+GTi%LwQH&#*1B9S55q9XGwdwBdb_k{)w;~j znYur#h5#H~ri$6LVg35wL_#4I9ji_Q(Bj)5Rj>bAC=~KM9uLCgasf@#$-{R0^sEm? zM;+CT=B6=!)(^3<>b-e}g3X_vm(rzYq$j1U+{Z8sERBs_=ZcEbeli-@JhnXQqX;2L z(WQ#FT9Zd;uDjiwrtx`sa&*3-fFR!ZGFAfLBSzx?$)h)1ww%yz%d{5{QoDp_UoOt zhL)!!J0~}@yStkvgy6v8BLypTsbb%{Su5M^cDA##^Ruq5u0X5R8ZhbPvPA&_Vci{V z*JU!!Hl7 Date: Tue, 31 Jul 2012 13:00:55 -0300 Subject: [PATCH 09/14] Added menubar. --- lib/gui_lite.py | 40 ++++++---------------------------------- 1 file changed, 6 insertions(+), 34 deletions(-) diff --git a/lib/gui_lite.py b/lib/gui_lite.py index af4fcafa8..4316e58cb 100644 --- a/lib/gui_lite.py +++ b/lib/gui_lite.py @@ -109,34 +109,6 @@ class MiniWindow(QDialog): self.actuator = actuator - #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(rsrc("icons", "interact.png")) - #interact_button.setObjectName("interact_button") - - #app_menu = QMenu(interact_button) - #acceptbit_action = app_menu.addAction(_("A&cceptBit")) - #report_action = app_menu.addAction(_("&Report Bug")) - #about_action = app_menu.addAction(_("&About Electrum")) - #app_menu.addSeparator() - #quit_action = app_menu.addAction(_("&Quit")) - #interact_button.setMenu(app_menu) - - #self.connect(acceptbit_action, SIGNAL("triggered()"), - # self.acceptbit) - #self.connect(report_action, SIGNAL("triggered()"), - # self.show_report_bug) - #self.connect(about_action, SIGNAL("triggered()"), self.show_about) - #self.connect(quit_action, SIGNAL("triggered()"), self.close) - - #expand_button = IconButton(rsrc("icons", "expand.png")) - #expand_button.setObjectName("expand_button") - #self.connect(expand_button, SIGNAL("clicked()"), expand_callback) - self.btc_balance = None self.quote_currencies = ["EUR", "USD", "GBP"] self.actuator.set_configured_currency(self.set_quote_currency) @@ -208,6 +180,11 @@ class MiniWindow(QDialog): menubar = QMenuBar() file_menu = menubar.addMenu(_("&File")) file_menu.addAction(_("Open")) + view_menu = menubar.addMenu(_("&View")) + view_menu.addMenu(_("&Themes")) + view_menu.addAction(_("Show History")) + menubar.addMenu(_("&Settings")) + menubar.addMenu(_("&Help")) main_layout.setMenuBar(menubar) quit_shortcut = QShortcut(QKeySequence("Ctrl+Q"), self) @@ -266,12 +243,7 @@ class MiniWindow(QDialog): quote_text = "(%s)" % quote_text btc_balance = "%.2f" % (btc_balance / bitcoin(1)) self.balance_label.set_balance_text(btc_balance, quote_text) - main_account_info = \ - "Checking - %s BTC" % btc_balance - self.setWindowTitle("Electrum - %s" % main_account_info) - self.accounts_selector.clear() - self.accounts_selector.addAction("%s %s" % (main_account_info, - quote_text)) + self.setWindowTitle("Electrum - %s BTC" % btc_balance) def amount_input_changed(self, amount_text): try: From 7682f00fb559ae41b8fa397ade7fb19d91ba2251 Mon Sep 17 00:00:00 2001 From: Maran Date: Tue, 31 Jul 2012 18:13:37 +0200 Subject: [PATCH 10/14] Removed the valid icon and make the text green or red instead --- data/style.css | 18 ++++++------------ lib/gui_lite.py | 18 ++++++++++-------- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/data/style.css b/data/style.css index 2f3a3f280..2ce441dc7 100644 --- a/data/style.css +++ b/data/style.css @@ -56,20 +56,14 @@ MiniWindow QPushButton { width: 225px; margin-top: 4px; } +#address_input[isValid=true] +{ + color: #4D9948 +} -#valid_address::indicator +#address_input[isValid=false] { - width: 24px; - height: 24px; - margin-top: 2px; -} -#valid_address::indicator:checked -{ - image: url(icons/confirmed.png); -} -#valid_address::indicator:unchecked -{ - image: url(icons/unconfirmed.png); + color: #CE4141 } #balance_label diff --git a/lib/gui_lite.py b/lib/gui_lite.py index 93fcd6b3c..321fd8625 100644 --- a/lib/gui_lite.py +++ b/lib/gui_lite.py @@ -167,14 +167,8 @@ class MiniWindow(QDialog): address_completer.setModel(self.address_completions) self.address_input.setCompleter(address_completer) - self.valid_address = QCheckBox() - self.valid_address.setObjectName("valid_address") - self.valid_address.setEnabled(False) - self.valid_address.setChecked(False) - address_layout = QHBoxLayout() address_layout.addWidget(self.address_input) - address_layout.addWidget(self.valid_address) self.amount_input = TextedLineEdit(_("... and amount")) self.amount_input.setObjectName("amount_input") @@ -220,6 +214,10 @@ class MiniWindow(QDialog): self.layout().setSizeConstraint(QLayout.SetFixedSize) self.setObjectName("main_window") self.show() + + def recompute_style(self): + qApp.style().unpolish(self) + qApp.style().polish(self) def closeEvent(self, event): super(MiniWindow, self).closeEvent(event) @@ -311,11 +309,15 @@ class MiniWindow(QDialog): def address_field_changed(self, address): if self.actuator.is_valid(address): - self.valid_address.setChecked(True) self.check_button_status() + self.address_input.setProperty("isValid", True) + self.style().unpolish(self.address_input) + self.style().polish(self.address_input) else: - self.valid_address.setChecked(False) self.send_button.setDisabled(True) + self.address_input.setProperty("isValid", False) + self.style().unpolish(self.address_input) + self.style().polish(self.address_input) def copy_address(self): receive_popup = ReceivePopup(self.receive_button) From 2d77c9992048e814d1309fcd7b80af7fcded1235 Mon Sep 17 00:00:00 2001 From: Maran Date: Tue, 31 Jul 2012 18:51:43 +0200 Subject: [PATCH 11/14] Tweaked style a bit --- data/style.css | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/data/style.css b/data/style.css index 2ce441dc7..1ed560823 100644 --- a/data/style.css +++ b/data/style.css @@ -13,7 +13,6 @@ MiniWindow QPushButton { min-width: 30px; } - #send_button{ color: #E5F2FF; border: 1px solid #3786E6; @@ -38,32 +37,32 @@ MiniWindow QPushButton { #address_input[readOnly=true], #amount_input[readOnly=true] { - color: #ABABAB; + color: #CCC; padding: 5px; border-radius: 4px; border: 1px solid #AAA9A9; width: 225px; margin-top: 4px; } -#address_input[readOnly=false], #amount_input[readOnly=false] + +#address_input[isValid=true], #address_input[readOnly=false] { - padding: 2px; - border: 1px solid #AAA9A9; - font: normal; - color: #424242; - border-radius: 4px; - font-size: 95%; - width: 225px; - margin-top: 4px; -} -#address_input[isValid=true] -{ - color: #4D9948 + color: #4D9948; + padding: 5px; + border-radius: 4px; + border: 1px solid #AAA9A9; + width: 225px; + margin-top: 4px; } -#address_input[isValid=false] +#address_input[isValid=false], #address_input[readOnly=false] { - color: #CE4141 + color: #CE4141; + padding: 5px; + border-radius: 4px; + border: 1px solid #AAA9A9; + width: 225px; + margin-top: 4px; } #balance_label From 1eab36621826fb73f345d7faaaa0acba48da629d Mon Sep 17 00:00:00 2001 From: Maran Date: Tue, 31 Jul 2012 19:31:06 +0200 Subject: [PATCH 12/14] Added the expand option to the settings menu --- lib/gui_lite.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/gui_lite.py b/lib/gui_lite.py index e1013ff0f..ea74fd051 100644 --- a/lib/gui_lite.py +++ b/lib/gui_lite.py @@ -178,7 +178,11 @@ class MiniWindow(QDialog): view_menu = menubar.addMenu(_("&View")) view_menu.addMenu(_("&Themes")) view_menu.addAction(_("Show History")) - menubar.addMenu(_("&Settings")) + + settings_menu = menubar.addMenu(_("&Settings")) + expert_gui = settings_menu.addAction(_("&Expert GUI")) + self.connect(expert_gui, SIGNAL("triggered()"), expand_callback) + menubar.addMenu(_("&Help")) main_layout.setMenuBar(menubar) From 2c5445e19f752d36ac86796c17b292b32316e6ef Mon Sep 17 00:00:00 2001 From: Maran Date: Tue, 31 Jul 2012 19:31:46 +0200 Subject: [PATCH 13/14] Renamed menu item --- lib/gui_lite.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gui_lite.py b/lib/gui_lite.py index ea74fd051..1773472dc 100644 --- a/lib/gui_lite.py +++ b/lib/gui_lite.py @@ -180,7 +180,7 @@ class MiniWindow(QDialog): view_menu.addAction(_("Show History")) settings_menu = menubar.addMenu(_("&Settings")) - expert_gui = settings_menu.addAction(_("&Expert GUI")) + expert_gui = settings_menu.addAction(_("&Switch to expert GUI")) self.connect(expert_gui, SIGNAL("triggered()"), expand_callback) menubar.addMenu(_("&Help")) From 57cc413edc23cd8a357aeb248b27198000ac367c Mon Sep 17 00:00:00 2001 From: Maran Date: Tue, 31 Jul 2012 21:38:34 +0200 Subject: [PATCH 14/14] Further tweaks to the layout --- data/style.css | 17 +++++++--- lib/gui_lite.py | 85 ++++++++++++++++--------------------------------- 2 files changed, 41 insertions(+), 61 deletions(-) diff --git a/data/style.css b/data/style.css index 1ed560823..9c9755c9d 100644 --- a/data/style.css +++ b/data/style.css @@ -35,9 +35,9 @@ MiniWindow QPushButton { padding: 2px; } -#address_input[readOnly=true], #amount_input[readOnly=true] +#address_input, #amount_input { - color: #CCC; + color: #000; padding: 5px; border-radius: 4px; border: 1px solid #AAA9A9; @@ -45,7 +45,7 @@ MiniWindow QPushButton { margin-top: 4px; } -#address_input[isValid=true], #address_input[readOnly=false] +#address_input[isValid=true] { color: #4D9948; padding: 5px; @@ -55,7 +55,7 @@ MiniWindow QPushButton { margin-top: 4px; } -#address_input[isValid=false], #address_input[readOnly=false] +#address_input[isValid=false] { color: #CE4141; padding: 5px; @@ -65,6 +65,15 @@ MiniWindow QPushButton { margin-top: 4px; } +#address_input[isValid=placeholder] +{ + color: blue; + padding: 5px; + border-radius: 4px; + border: 1px solid #AAA9A9; + width: 225px; + margin-top: 4px; +} #balance_label { color: #333; diff --git a/lib/gui_lite.py b/lib/gui_lite.py index 1773472dc..c28f4eedd 100644 --- a/lib/gui_lite.py +++ b/lib/gui_lite.py @@ -123,15 +123,16 @@ class MiniWindow(QDialog): self.receive_button = QPushButton(_("&Receive")) self.receive_button.setObjectName("receive_button") self.receive_button.setDefault(True) - self.connect(self.receive_button, SIGNAL("clicked()"), - self.copy_address) + self.connect(self.receive_button, SIGNAL("clicked()"), self.copy_address) - self.address_input = TextedLineEdit(_("Enter a Bitcoin address...")) + # Bitcoin address code + self.address_input = QLineEdit() + self.address_input.setPlaceholderText(_("Enter a Bitcoin address...")) self.address_input.setObjectName("address_input") - self.connect(self.address_input, SIGNAL("textEdited(QString)"), - self.address_field_changed) - resize_line_edit_width(self.address_input, - "1BtaFUr3qVvAmwrsuDuu5zk6e4s2rxd2Gy") + + + self.connect(self.address_input, SIGNAL("textEdited(QString)"), self.address_field_changed) + resize_line_edit_width(self.address_input, "1BtaFUr3qVvAmwrsuDuu5zk6e4s2rxd2Gy") self.address_completions = QStringListModel() address_completer = QCompleter(self.address_input) @@ -142,7 +143,8 @@ class MiniWindow(QDialog): address_layout = QHBoxLayout() address_layout.addWidget(self.address_input) - self.amount_input = TextedLineEdit(_("... and amount")) + self.amount_input = QLineEdit() + self.amount_input.setPlaceholderText(_("... and amount")) self.amount_input.setObjectName("amount_input") # This is changed according to the user's displayed balance self.amount_validator = QDoubleValidator(self.amount_input) @@ -150,6 +152,10 @@ class MiniWindow(QDialog): self.amount_validator.setDecimals(8) self.amount_input.setValidator(self.amount_validator) + # This removes the very ugly OSX highlighting, please leave this in :D + self.address_input.setAttribute(Qt.WA_MacShowFocusRect, 0) + self.amount_input.setAttribute(Qt.WA_MacShowFocusRect, 0) + self.connect(self.amount_input, SIGNAL("textChanged(QString)"), self.amount_input_changed) @@ -207,10 +213,8 @@ class MiniWindow(QDialog): qApp.quit() def set_payment_fields(self, dest_address, amount): - self.address_input.become_active() self.address_input.setText(dest_address) self.address_field_changed(dest_address) - self.amount_input.become_active() self.amount_input.setText(amount) def activate(self): @@ -274,13 +278,12 @@ class MiniWindow(QDialog): return quote_text def send(self): - if self.actuator.send(self.address_input.text(), - self.amount_input.text(), self): - self.address_input.become_inactive() - self.amount_input.become_inactive() + if self.actuator.send(self.address_input.text(), self.amount_input.text(), self): + self.address_input.setText("") + self.amount_input.setText("") def check_button_status(self): - if self.amount_input.text() != _("... and amount") and len(self.amount_input.text()) != 0: + if self.address_input.property("isValid") == True and len(self.amount_input.text()) != 0: self.send_button.setDisabled(False) else: self.send_button.setDisabled(True) @@ -289,13 +292,19 @@ class MiniWindow(QDialog): if self.actuator.is_valid(address): self.check_button_status() self.address_input.setProperty("isValid", True) - self.style().unpolish(self.address_input) - self.style().polish(self.address_input) + self.recompute_style(self.address_input) else: self.send_button.setDisabled(True) self.address_input.setProperty("isValid", False) - self.style().unpolish(self.address_input) - self.style().polish(self.address_input) + self.recompute_style(self.address_input) + + if len(address) == 0: + self.address_input.setProperty("isValid", None) + self.recompute_style(self.address_input) + + def recompute_style(self, element): + self.style().unpolish(element) + self.style().polish(element) def copy_address(self): receive_popup = ReceivePopup(self.receive_button) @@ -354,44 +363,6 @@ class BalanceLabel(QLabel): self.state = self.SHOW_AMOUNT self.setText(self.amount_text) -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() - QLineEdit.mousePressEvent(self, event) - - def focusOutEvent(self, event): - if self.text() == "": - self.become_inactive() - QLineEdit.focusOutEvent(self, event) - - def focusInEvent(self, event): - if self.isReadOnly(): - self.become_active() - QLineEdit.focusInEvent(self, event) - - def become_inactive(self): - self.setReadOnly(True) - self.recompute_style() - self.setText(self.inactive_text) - - def become_active(self): - self.setReadOnly(False) - self.recompute_style() - self.setText("") - - def recompute_style(self): - qApp.style().unpolish(self) - qApp.style().polish(self) - # also possible but more expensive: - #qApp.setStyleSheet(qApp.styleSheet()) - def ok_cancel_buttons(dialog): row_layout = QHBoxLayout() row_layout.addStretch(1)