dialogs.py.bak
1 """ 2 Custom dialog classes 3 """ 4 # pylint: disable=too-few-public-methods 5 from PyQt4 import QtGui 6 7 import paths 8 import widgets 9 from address_dialogs import ( 10 AddAddressDialog, EmailGatewayDialog, NewAddressDialog, 11 NewSubscriptionDialog, RegenerateAddressesDialog, 12 SpecialAddressBehaviorDialog 13 ) 14 from newchandialog import NewChanDialog 15 from settings import SettingsDialog 16 from tr import _translate 17 from version import softwareVersion 18 19 20 __all__ = [ 21 "NewChanDialog", "AddAddressDialog", "NewAddressDialog", 22 "NewSubscriptionDialog", "RegenerateAddressesDialog", 23 "SpecialAddressBehaviorDialog", "EmailGatewayDialog", 24 "SettingsDialog" 25 ] 26 27 28 class AboutDialog(QtGui.QDialog): 29 """The `About` dialog""" 30 def __init__(self, parent=None): 31 super(AboutDialog, self).__init__(parent) 32 widgets.load('about.ui', self) 33 last_commit = paths.lastCommit() 34 version = softwareVersion 35 commit = last_commit.get('commit') 36 if commit: 37 version += '-' + commit[:7] 38 self.labelVersion.setText( 39 self.labelVersion.text().replace( 40 ':version:', version 41 ).replace(':branch:', commit or 'v%s' % version) 42 ) 43 self.labelVersion.setOpenExternalLinks(True) 44 45 try: 46 self.label_2.setText( 47 self.label_2.text().replace( 48 '2022', str(last_commit.get('time').year) 49 )) 50 except AttributeError: 51 pass 52 53 self.setFixedSize(QtGui.QWidget.sizeHint(self)) 54 55 56 class IconGlossaryDialog(QtGui.QDialog): 57 """The `Icon Glossary` dialog, explaining the status icon colors""" 58 def __init__(self, parent=None, config=None): 59 super(IconGlossaryDialog, self).__init__(parent) 60 widgets.load('iconglossary.ui', self) 61 62 # .. todo:: FIXME: check the window title visibility here 63 self.groupBox.setTitle('') 64 65 self.labelPortNumber.setText(_translate( 66 "iconGlossaryDialog", 67 "You are using TCP port %1. (This can be changed in the settings)." 68 ).arg(config.getint('bitmessagesettings', 'port'))) 69 self.setFixedSize(QtGui.QWidget.sizeHint(self)) 70 71 72 class HelpDialog(QtGui.QDialog): 73 """The `Help` dialog""" 74 def __init__(self, parent=None): 75 super(HelpDialog, self).__init__(parent) 76 widgets.load('help.ui', self) 77 self.setFixedSize(QtGui.QWidget.sizeHint(self)) 78 79 80 class ConnectDialog(QtGui.QDialog): 81 """The `Connect` dialog""" 82 def __init__(self, parent=None): 83 super(ConnectDialog, self).__init__(parent) 84 widgets.load('connect.ui', self) 85 self.setFixedSize(QtGui.QWidget.sizeHint(self))