Moved aboutDialog and iconGlossaryDialog also into dialogs module

This commit is contained in:
Dmitri Bogomolov 2017-10-13 01:36:54 +03:00
parent d9d9f9d787
commit e2e7e16ab7
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13
6 changed files with 113 additions and 311 deletions

View File

@ -35,9 +35,7 @@ from emailgateway import *
from settings import * from settings import *
import settingsmixin import settingsmixin
import support import support
from about import *
from help import * from help import *
from iconglossary import *
from connect import * from connect import *
import locale import locale
import sys import sys
@ -62,6 +60,7 @@ from helper_generic import powQueueSize
from inventory import ( from inventory import (
Inventory, PendingDownloadQueue, PendingUpload, Inventory, PendingDownloadQueue, PendingUpload,
PendingUploadDeadlineException) PendingUploadDeadlineException)
from uisignaler import UISignaler
import knownnodes import knownnodes
import paths import paths
from proofofwork import getPowType from proofofwork import getPowType
@ -70,9 +69,9 @@ import shutdown
import state import state
from statusbar import BMStatusBar from statusbar import BMStatusBar
from network.asyncore_pollchoose import set_rates from network.asyncore_pollchoose import set_rates
from version import softwareVersion
import sound import sound
try: try:
from plugins.plugin import get_plugin, get_plugins from plugins.plugin import get_plugin, get_plugins
except ImportError: except ImportError:
@ -2220,10 +2219,7 @@ class MyForm(settingsmixin.SMainWindow):
)) ))
def click_pushButtonStatusIcon(self): def click_pushButtonStatusIcon(self):
logger.debug('click_pushButtonStatusIcon') dialogs.IconGlossaryDialog(self, config=BMConfigParser()).exec_()
self.iconGlossaryInstance = iconGlossaryDialog(self)
if self.iconGlossaryInstance.exec_():
pass
def click_actionHelp(self): def click_actionHelp(self):
self.helpDialogInstance = helpDialog(self) self.helpDialogInstance = helpDialog(self)
@ -2233,8 +2229,7 @@ class MyForm(settingsmixin.SMainWindow):
support.createSupportMessage(self) support.createSupportMessage(self)
def click_actionAbout(self): def click_actionAbout(self):
self.aboutDialogInstance = aboutDialog(self) dialogs.AboutDialog(self).exec_()
self.aboutDialogInstance.exec_()
def click_actionSettings(self): def click_actionSettings(self):
self.settingsDialogInstance = settingsDialog(self) self.settingsDialogInstance = settingsDialog(self)
@ -3975,16 +3970,6 @@ class connectDialog(QtGui.QDialog):
self.parent = parent self.parent = parent
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self)) QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
class aboutDialog(QtGui.QDialog):
def __init__(self, parent):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_aboutDialog()
self.ui.setupUi(self)
self.parent = parent
self.ui.label.setText("PyBitmessage " + softwareVersion)
self.ui.labelVersion.setText(paths.lastCommit())
class regenerateAddressesDialog(QtGui.QDialog): class regenerateAddressesDialog(QtGui.QDialog):
@ -4312,18 +4297,6 @@ class NewAddressDialog(QtGui.QDialog):
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self)) QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
class iconGlossaryDialog(QtGui.QDialog):
def __init__(self, parent):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_iconGlossaryDialog()
self.ui.setupUi(self)
self.parent = parent
self.ui.labelPortNumber.setText(_translate(
"MainWindow", "You are using TCP port %1. (This can be changed in the settings).").arg(str(BMConfigParser().getint('bitmessagesettings', 'port'))))
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
# In order for the time columns on the Inbox and Sent tabs to be sorted # In order for the time columns on the Inbox and Sent tabs to be sorted
# correctly (rather than alphabetically), we need to overload the < # correctly (rather than alphabetically), we need to overload the <
# operator and use this class instead of QTableWidgetItem. # operator and use this class instead of QTableWidgetItem.
@ -4332,8 +4305,6 @@ class myTableWidgetItem(QTableWidgetItem):
def __lt__(self, other): def __lt__(self, other):
return int(self.data(33).toPyObject()) < int(other.data(33).toPyObject()) return int(self.data(33).toPyObject()) < int(other.data(33).toPyObject())
from uisignaler import UISignaler
app = None app = None
myapp = None myapp = None

View File

@ -1,74 +0,0 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'about.ui'
#
# Created: Tue Jan 21 22:29:38 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_aboutDialog(object):
def setupUi(self, aboutDialog):
aboutDialog.setObjectName(_fromUtf8("aboutDialog"))
aboutDialog.resize(360, 315)
self.buttonBox = QtGui.QDialogButtonBox(aboutDialog)
self.buttonBox.setGeometry(QtCore.QRect(20, 280, 311, 32))
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.label = QtGui.QLabel(aboutDialog)
self.label.setGeometry(QtCore.QRect(10, 106, 341, 20))
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.label.setFont(font)
self.label.setAlignment(QtCore.Qt.AlignCenter|QtCore.Qt.AlignVCenter)
self.label.setObjectName(_fromUtf8("label"))
self.labelVersion = QtGui.QLabel(aboutDialog)
self.labelVersion.setGeometry(QtCore.QRect(10, 116, 341, 41))
self.labelVersion.setObjectName(_fromUtf8("labelVersion"))
self.labelVersion.setAlignment(QtCore.Qt.AlignCenter|QtCore.Qt.AlignVCenter)
self.label_2 = QtGui.QLabel(aboutDialog)
self.label_2.setGeometry(QtCore.QRect(10, 150, 341, 41))
self.label_2.setAlignment(QtCore.Qt.AlignCenter)
self.label_2.setObjectName(_fromUtf8("label_2"))
self.label_3 = QtGui.QLabel(aboutDialog)
self.label_3.setGeometry(QtCore.QRect(20, 200, 331, 71))
self.label_3.setWordWrap(True)
self.label_3.setOpenExternalLinks(True)
self.label_3.setObjectName(_fromUtf8("label_3"))
self.label_5 = QtGui.QLabel(aboutDialog)
self.label_5.setGeometry(QtCore.QRect(10, 190, 341, 20))
self.label_5.setAlignment(QtCore.Qt.AlignCenter)
self.label_5.setObjectName(_fromUtf8("label_5"))
self.retranslateUi(aboutDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), aboutDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), aboutDialog.reject)
QtCore.QMetaObject.connectSlotsByName(aboutDialog)
def retranslateUi(self, aboutDialog):
aboutDialog.setWindowTitle(_translate("aboutDialog", "About", None))
self.label.setText(_translate("aboutDialog", "PyBitmessage", None))
self.labelVersion.setText(_translate("aboutDialog", "version ?", None))
self.label_2.setText(_translate("aboutDialog", "<html><head/><body><p>Copyright &copy; 2012-2016 Jonathan Warren<br/>Copyright &copy; 2013-2016 The Bitmessage Developers</p></body></html>", None))
self.label_3.setText(_translate("aboutDialog", "<html><head/><body><p>Distributed under the MIT/X11 software license; see <a href=\"http://www.opensource.org/licenses/mit-license.php\"><span style=\" text-decoration: underline; color:#0000ff;\">http://www.opensource.org/licenses/mit-license.php</span></a></p></body></html>", None))
self.label_5.setText(_translate("aboutDialog", "This is Beta software.", None))

View File

@ -6,38 +6,32 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>360</width> <width>430</width>
<height>315</height> <height>340</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>About</string> <string>About</string>
</property> </property>
<widget class="QDialogButtonBox" name="buttonBox"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="geometry"> <item alignment="Qt::AlignHCenter">
<rect> <widget class="QLabel" name="label_4">
<x>20</x> <property name="text">
<y>280</y> <string notr="true"/>
<width>311</width>
<height>32</height>
</rect>
</property> </property>
<property name="orientation"> <property name="pixmap">
<enum>Qt::Horizontal</enum> <pixmap resource="bitmessage_icons.qrc">:/newPrefix/images/can-icon-24px.png</pixmap>
</property> </property>
<property name="standardButtons"> <property name="scaledContents">
<set>QDialogButtonBox::Ok</set> <bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label"> </item>
<property name="geometry"> <item alignment="Qt::AlignHCenter">
<rect> <widget class="QLabel" name="labelVersion">
<x>70</x>
<y>126</y>
<width>111</width>
<height>20</height>
</rect>
</property>
<property name="font"> <property name="font">
<font> <font>
<weight>75</weight> <weight>75</weight>
@ -45,50 +39,35 @@
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>PyBitmessage</string> <string notr="true">PyBitmessage</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="labelVersion"> </item>
<property name="geometry"> <item alignment="Qt::AlignLeft">
<rect> <widget class="QLabel" name="label_2">
<x>190</x>
<y>126</y>
<width>161</width>
<height>20</height>
</rect>
</property>
<property name="text"> <property name="text">
<string>version ?</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Copyright © 2012-2016 Jonathan Warren&lt;br/&gt;Copyright © 2013-2017 The Bitmessage Developers&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeft</set>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label_2"> </item>
<property name="geometry"> <item>
<rect> <widget class="QLabel" name="label_5">
<x>10</x>
<y>150</y>
<width>341</width>
<height>41</height>
</rect>
</property>
<property name="text"> <property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Copyright © 2012-2014 Jonathan Warren&lt;br/&gt;Copyright © 2013-2014 The Bitmessage Developers&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>This is Beta software.</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item>
<item>
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>20</x>
<y>200</y>
<width>331</width>
<height>71</height>
</rect>
</property>
<property name="text"> <property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Distributed under the MIT/X11 software license; see &lt;a href=&quot;http://www.opensource.org/licenses/mit-license.php&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://www.opensource.org/licenses/mit-license.php&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Distributed under the MIT/X11 software license; see &lt;a href=&quot;http://www.opensource.org/licenses/mit-license.php&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://www.opensource.org/licenses/mit-license.php&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
@ -99,24 +78,22 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label_5"> </item>
<property name="geometry"> <item>
<rect> <widget class="QDialogButtonBox" name="buttonBox">
<x>10</x> <property name="orientation">
<y>190</y> <enum>Qt::Horizontal</enum>
<width>341</width>
<height>20</height>
</rect>
</property> </property>
<property name="text"> <property name="standardButtons">
<string>This is Beta software.</string> <set>QDialogButtonBox::Ok</set>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item>
</layout>
</widget> </widget>
<resources/> <resources>
<include location="bitmessage_icons.qrc"/>
</resources>
<connections> <connections>
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>

View File

@ -5,7 +5,9 @@ from retranslateui import RetranslateMixin
import widgets import widgets
import hashlib import hashlib
import paths
from inventory import Inventory from inventory import Inventory
from version import softwareVersion
class AddressCheckMixin(object): class AddressCheckMixin(object):
@ -105,3 +107,27 @@ class NewSubscriptionDialog(
"MainWindow", "MainWindow",
"Display the %1 recent broadcast(s) from this address." "Display the %1 recent broadcast(s) from this address."
).arg(count)) ).arg(count))
class AboutDialog(QtGui.QDialog, RetranslateMixin):
def __init__(self, parent=None):
super(AboutDialog, self).__init__(parent)
widgets.load('about.ui', self)
commit = paths.lastCommit()[:7]
label = "PyBitmessage " + softwareVersion
if commit:
label += '-' + commit
self.labelVersion.setText(label)
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
class IconGlossaryDialog(QtGui.QDialog, RetranslateMixin):
def __init__(self, parent=None, config=None):
super(IconGlossaryDialog, self).__init__(parent)
widgets.load('iconglossary.ui', self)
self.labelPortNumber.setText(_translate(
"iconGlossaryDialog",
"You are using TCP port %1. (This can be changed in the settings)."
).arg(config.getint('bitmessagesettings', 'port')))
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))

View File

@ -1,98 +0,0 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'iconglossary.ui'
#
# Created: Thu Jun 13 20:15:48 2013
# by: PyQt4 UI code generator 4.10.1
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_iconGlossaryDialog(object):
def setupUi(self, iconGlossaryDialog):
iconGlossaryDialog.setObjectName(_fromUtf8("iconGlossaryDialog"))
iconGlossaryDialog.resize(424, 282)
self.gridLayout = QtGui.QGridLayout(iconGlossaryDialog)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.groupBox = QtGui.QGroupBox(iconGlossaryDialog)
self.groupBox.setObjectName(_fromUtf8("groupBox"))
self.gridLayout_2 = QtGui.QGridLayout(self.groupBox)
self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
self.label = QtGui.QLabel(self.groupBox)
self.label.setText(_fromUtf8(""))
self.label.setPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/redicon.png")))
self.label.setObjectName(_fromUtf8("label"))
self.gridLayout_2.addWidget(self.label, 0, 0, 1, 1)
self.label_2 = QtGui.QLabel(self.groupBox)
self.label_2.setObjectName(_fromUtf8("label_2"))
self.gridLayout_2.addWidget(self.label_2, 0, 1, 1, 1)
self.label_3 = QtGui.QLabel(self.groupBox)
self.label_3.setText(_fromUtf8(""))
self.label_3.setPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/yellowicon.png")))
self.label_3.setObjectName(_fromUtf8("label_3"))
self.gridLayout_2.addWidget(self.label_3, 1, 0, 1, 1)
self.label_4 = QtGui.QLabel(self.groupBox)
self.label_4.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
self.label_4.setWordWrap(True)
self.label_4.setObjectName(_fromUtf8("label_4"))
self.gridLayout_2.addWidget(self.label_4, 1, 1, 2, 1)
spacerItem = QtGui.QSpacerItem(20, 73, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridLayout_2.addItem(spacerItem, 2, 0, 2, 1)
self.labelPortNumber = QtGui.QLabel(self.groupBox)
self.labelPortNumber.setObjectName(_fromUtf8("labelPortNumber"))
self.gridLayout_2.addWidget(self.labelPortNumber, 3, 1, 1, 1)
self.label_5 = QtGui.QLabel(self.groupBox)
self.label_5.setText(_fromUtf8(""))
self.label_5.setPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/greenicon.png")))
self.label_5.setObjectName(_fromUtf8("label_5"))
self.gridLayout_2.addWidget(self.label_5, 4, 0, 1, 1)
self.label_6 = QtGui.QLabel(self.groupBox)
self.label_6.setWordWrap(True)
self.label_6.setObjectName(_fromUtf8("label_6"))
self.gridLayout_2.addWidget(self.label_6, 4, 1, 1, 1)
self.gridLayout.addWidget(self.groupBox, 0, 0, 1, 1)
self.buttonBox = QtGui.QDialogButtonBox(iconGlossaryDialog)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.gridLayout.addWidget(self.buttonBox, 1, 0, 1, 1)
self.retranslateUi(iconGlossaryDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), iconGlossaryDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), iconGlossaryDialog.reject)
QtCore.QMetaObject.connectSlotsByName(iconGlossaryDialog)
def retranslateUi(self, iconGlossaryDialog):
iconGlossaryDialog.setWindowTitle(_translate("iconGlossaryDialog", "Icon Glossary", None))
self.groupBox.setTitle(_translate("iconGlossaryDialog", "Icon Glossary", None))
self.label_2.setText(_translate("iconGlossaryDialog", "You have no connections with other peers. ", None))
self.label_4.setText(_translate("iconGlossaryDialog", "You have made at least one connection to a peer using an outgoing connection but you have not yet received any incoming connections. Your firewall or home router probably isn\'t configured to forward incoming TCP connections to your computer. Bitmessage will work just fine but it would help the Bitmessage network if you allowed for incoming connections and will help you be a better-connected node.", None))
self.labelPortNumber.setText(_translate("iconGlossaryDialog", "You are using TCP port ?. (This can be changed in the settings).", None))
self.label_6.setText(_translate("iconGlossaryDialog", "You do have connections with other peers and your firewall is correctly configured.", None))
import bitmessage_icons_rc
if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
iconGlossaryDialog = QtGui.QDialog()
ui = Ui_iconGlossaryDialog()
ui.setupUi(iconGlossaryDialog)
iconGlossaryDialog.show()
sys.exit(app.exec_())

View File

@ -76,7 +76,7 @@
<item row="3" column="1"> <item row="3" column="1">
<widget class="QLabel" name="labelPortNumber"> <widget class="QLabel" name="labelPortNumber">
<property name="text"> <property name="text">
<string>You are using TCP port ?. (This can be changed in the settings).</string> <string notr="true">You are using TCP port ?. (This can be changed in the settings).</string>
</property> </property>
</widget> </widget>
</item> </item>