From 059bda49ab2caae893f109183e6c97788bf157b3 Mon Sep 17 00:00:00 2001 From: Vincent Texier <vit@free.fr> Date: Sun, 8 Feb 2015 20:35:09 +0100 Subject: [PATCH] add about popup window add about menu to open the about popup window --- res/ui/about.ui | 65 ++++++++++++++++++++++++++++++++++ res/ui/mainwindow.ui | 25 ++++++++++++- src/cutecoin/gui/mainwindow.py | 28 ++++++++++++++- 3 files changed, 116 insertions(+), 2 deletions(-) create mode 100644 res/ui/about.ui diff --git a/res/ui/about.ui b/res/ui/about.ui new file mode 100644 index 00000000..1b86b12f --- /dev/null +++ b/res/ui/about.ui @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>AboutPopup</class> + <widget class="QDialog" name="AboutPopup"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>297</width> + <height>264</height> + </rect> + </property> + <property name="windowTitle"> + <string>About</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string>TextLabel</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Ok</set> + </property> + <property name="centerButtons"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>AboutPopup</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>248</x> + <y>254</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/res/ui/mainwindow.ui b/res/ui/mainwindow.ui index 9a2dec6b..ada0cd67 100644 --- a/res/ui/mainwindow.ui +++ b/res/ui/mainwindow.ui @@ -33,7 +33,7 @@ <x>0</x> <y>0</y> <width>681</width> - <height>20</height> + <height>25</height> </rect> </property> <widget class="QMenu" name="menu_account"> @@ -53,6 +53,7 @@ <addaction name="action_export"/> <addaction name="action_import"/> <addaction name="separator"/> + <addaction name="actionAbout"/> <addaction name="action_quit"/> </widget> <widget class="QMenu" name="menu_contacts"> @@ -176,6 +177,11 @@ <string>Set as default</string> </property> </action> + <action name="actionAbout"> + <property name="text"> + <string>About</string> + </property> + </action> </widget> <resources/> <connections> @@ -323,6 +329,22 @@ </hint> </hints> </connection> + <connection> + <sender>actionAbout</sender> + <signal>triggered()</signal> + <receiver>MainWindow</receiver> + <slot>open_about_popup()</slot> + <hints> + <hint type="sourcelabel"> + <x>-1</x> + <y>-1</y> + </hint> + <hint type="destinationlabel"> + <x>340</x> + <y>274</y> + </hint> + </hints> + </connection> </connections> <slots> <slot>open_add_account_dialog()</slot> @@ -335,5 +357,6 @@ <slot>export_account()</slot> <slot>open_certification_dialog()</slot> <slot>set_as_default_account()</slot> + <slot>open_about_popup()</slot> </slots> </ui> diff --git a/src/cutecoin/gui/mainwindow.py b/src/cutecoin/gui/mainwindow.py index 675c4c4c..13e02f59 100644 --- a/src/cutecoin/gui/mainwindow.py +++ b/src/cutecoin/gui/mainwindow.py @@ -4,7 +4,7 @@ Created on 1 févr. 2014 @author: inso ''' from cutecoin.gen_resources.mainwindow_uic import Ui_MainWindow -from PyQt5.QtWidgets import QMainWindow, QAction, QFileDialog, QProgressBar, QMessageBox, QLabel +from PyQt5.QtWidgets import QMainWindow, QAction, QFileDialog, QProgressBar, QMessageBox, QLabel, QDialog from PyQt5.QtCore import QSignalMapper, QModelIndex, QObject, QThread, pyqtSlot, pyqtSignal from PyQt5.QtGui import QIcon from .process_cfg_account import ProcessConfigureAccount @@ -16,6 +16,7 @@ from .certification import CertificationDialog from .password_asker import PasswordAskerDialog from ..tools.exceptions import NoPeerAvailable from ..__init__ import __version__ +from cutecoin.gen_resources.about_uic import Ui_AboutPopup import logging import requests @@ -127,6 +128,31 @@ class MainWindow(QMainWindow, Ui_MainWindow): dialog.accepted.connect(self.refresh_communities) dialog.exec_() + def open_about_popup(self): + """ + Open about popup window + """ + aboutDialog = QDialog(self) + aboutUi = Ui_AboutPopup() + aboutUi.setupUi(aboutDialog) + text = """ + <h1>Cutecoin</h1> + + <p>Python/Qt uCoin client</p> + + <p>Version : {:}</p> + + <p>License : MIT</p> + + <p><b>Authors</b></p> + + <p>inso</p> + <p>vit</p> + <p>canercandan</p> + """.format(__version__) + aboutUi.label.setText(text) + aboutDialog.show() + def refresh_wallets(self): currency_tab = self.currencies_tabwidget.currentWidget() if currency_tab: -- GitLab