Moved helpDialog and connectDialog also into dialogs module

This commit is contained in:
Dmitri Bogomolov 2017-10-16 16:09:52 +03:00
parent e2e7e16ab7
commit c965a1d2aa
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13
5 changed files with 29 additions and 143 deletions

View File

@ -35,8 +35,6 @@ from emailgateway import *
from settings import * from settings import *
import settingsmixin import settingsmixin
import support import support
from help import *
from connect import *
import locale import locale
import sys import sys
import time import time
@ -1465,13 +1463,13 @@ class MyForm(settingsmixin.SMainWindow):
NewChanDialog(self) NewChanDialog(self)
def showConnectDialog(self): def showConnectDialog(self):
self.connectDialogInstance = connectDialog(self) dialog = dialogs.ConnectDialog(self)
if self.connectDialogInstance.exec_(): if dialog.exec_():
if self.connectDialogInstance.ui.radioButtonConnectNow.isChecked(): if dialog.radioButtonConnectNow.isChecked():
BMConfigParser().remove_option( BMConfigParser().remove_option(
'bitmessagesettings', 'dontconnect') 'bitmessagesettings', 'dontconnect')
BMConfigParser().save() BMConfigParser().save()
elif self.connectDialogInstance.ui.radioButtonConfigureNetwork.isChecked(): elif dialog.radioButtonConfigureNetwork.isChecked():
self.click_actionSettings() self.click_actionSettings()
def showMigrationWizard(self, level): def showMigrationWizard(self, level):
@ -1480,7 +1478,7 @@ class MyForm(settingsmixin.SMainWindow):
pass pass
else: else:
pass pass
def changeEvent(self, event): def changeEvent(self, event):
if event.type() == QtCore.QEvent.LanguageChange: if event.type() == QtCore.QEvent.LanguageChange:
self.ui.retranslateUi(self) self.ui.retranslateUi(self)
@ -2222,8 +2220,7 @@ class MyForm(settingsmixin.SMainWindow):
dialogs.IconGlossaryDialog(self, config=BMConfigParser()).exec_() dialogs.IconGlossaryDialog(self, config=BMConfigParser()).exec_()
def click_actionHelp(self): def click_actionHelp(self):
self.helpDialogInstance = helpDialog(self) dialogs.HelpDialog(self).exec_()
self.helpDialogInstance.exec_()
def click_actionSupport(self): def click_actionSupport(self):
support.createSupportMessage(self) support.createSupportMessage(self)
@ -3949,26 +3946,6 @@ class MyForm(settingsmixin.SMainWindow):
loadMethod = getattr(obj, "loadSettings", None) loadMethod = getattr(obj, "loadSettings", None)
if callable (loadMethod): if callable (loadMethod):
obj.loadSettings() obj.loadSettings()
class helpDialog(QtGui.QDialog):
def __init__(self, parent):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_helpDialog()
self.ui.setupUi(self)
self.parent = parent
self.ui.labelHelpURI.setOpenExternalLinks(True)
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
class connectDialog(QtGui.QDialog):
def __init__(self, parent):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_connectDialog()
self.ui.setupUi(self)
self.parent = parent
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
class regenerateAddressesDialog(QtGui.QDialog): class regenerateAddressesDialog(QtGui.QDialog):

View File

@ -1,64 +0,0 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'connect.ui'
#
# Created: Wed Jul 24 12:42:01 2013
# by: PyQt4 UI code generator 4.10
#
# 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_connectDialog(object):
def setupUi(self, connectDialog):
connectDialog.setObjectName(_fromUtf8("connectDialog"))
connectDialog.resize(400, 124)
self.gridLayout = QtGui.QGridLayout(connectDialog)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.label = QtGui.QLabel(connectDialog)
self.label.setObjectName(_fromUtf8("label"))
self.gridLayout.addWidget(self.label, 0, 0, 1, 2)
self.radioButtonConnectNow = QtGui.QRadioButton(connectDialog)
self.radioButtonConnectNow.setChecked(True)
self.radioButtonConnectNow.setObjectName(_fromUtf8("radioButtonConnectNow"))
self.gridLayout.addWidget(self.radioButtonConnectNow, 1, 0, 1, 2)
self.radioButtonConfigureNetwork = QtGui.QRadioButton(connectDialog)
self.radioButtonConfigureNetwork.setObjectName(_fromUtf8("radioButtonConfigureNetwork"))
self.gridLayout.addWidget(self.radioButtonConfigureNetwork, 2, 0, 1, 2)
self.radioButtonWorkOffline = QtGui.QRadioButton(connectDialog)
self.radioButtonWorkOffline.setObjectName(_fromUtf8("radioButtonWorkOffline"))
self.gridLayout.addWidget(self.radioButtonWorkOffline, 3, 0, 1, 2)
spacerItem = QtGui.QSpacerItem(185, 24, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout.addItem(spacerItem, 4, 0, 1, 1)
self.buttonBox = QtGui.QDialogButtonBox(connectDialog)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.gridLayout.addWidget(self.buttonBox, 4, 1, 1, 1)
self.retranslateUi(connectDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), connectDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), connectDialog.reject)
QtCore.QMetaObject.connectSlotsByName(connectDialog)
def retranslateUi(self, connectDialog):
connectDialog.setWindowTitle(_translate("connectDialog", "Bitmessage", None))
self.label.setText(_translate("connectDialog", "Bitmessage won\'t connect to anyone until you let it. ", None))
self.radioButtonConnectNow.setText(_translate("connectDialog", "Connect now", None))
self.radioButtonConfigureNetwork.setText(_translate("connectDialog", "Let me configure special network settings first", None))
self.radioButtonWorkOffline.setText(_translate("connectDialog", "Work offline", None))

View File

@ -38,7 +38,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="3" column="0" colspan="2">
<widget class="QRadioButton" name="radioButtonWorkOffline">
<property name="text">
<string>Work offline</string>
</property>
</widget>
</item>
<item row="4" column="0">
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -51,7 +58,7 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="3" column="1"> <item row="4" column="1">
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>

View File

@ -131,3 +131,17 @@ class IconGlossaryDialog(QtGui.QDialog, RetranslateMixin):
"You are using TCP port %1. (This can be changed in the settings)." "You are using TCP port %1. (This can be changed in the settings)."
).arg(config.getint('bitmessagesettings', 'port'))) ).arg(config.getint('bitmessagesettings', 'port')))
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self)) QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
class HelpDialog(QtGui.QDialog, RetranslateMixin):
def __init__(self, parent=None):
super(HelpDialog, self).__init__(parent)
widgets.load('help.ui', self)
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
class ConnectDialog(QtGui.QDialog, RetranslateMixin):
def __init__(self, parent=None):
super(ConnectDialog, self).__init__(parent)
widgets.load('connect.ui', self)
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))

View File

@ -1,48 +0,0 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'help.ui'
#
# Created: Wed Jan 14 22:42:39 2015
# by: PyQt4 UI code generator 4.9.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s
class Ui_helpDialog(object):
def setupUi(self, helpDialog):
helpDialog.setObjectName(_fromUtf8("helpDialog"))
helpDialog.resize(335, 96)
self.formLayout = QtGui.QFormLayout(helpDialog)
self.formLayout.setObjectName(_fromUtf8("formLayout"))
self.labelHelpURI = QtGui.QLabel(helpDialog)
self.labelHelpURI.setOpenExternalLinks(True)
self.labelHelpURI.setObjectName(_fromUtf8("labelHelpURI"))
self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.labelHelpURI)
self.label = QtGui.QLabel(helpDialog)
self.label.setWordWrap(True)
self.label.setObjectName(_fromUtf8("label"))
self.formLayout.setWidget(0, QtGui.QFormLayout.SpanningRole, self.label)
spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.formLayout.setItem(2, QtGui.QFormLayout.LabelRole, spacerItem)
self.buttonBox = QtGui.QDialogButtonBox(helpDialog)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.buttonBox)
self.retranslateUi(helpDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), helpDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), helpDialog.reject)
QtCore.QMetaObject.connectSlotsByName(helpDialog)
def retranslateUi(self, helpDialog):
helpDialog.setWindowTitle(QtGui.QApplication.translate("helpDialog", "Help", None, QtGui.QApplication.UnicodeUTF8))
self.labelHelpURI.setText(QtGui.QApplication.translate("helpDialog", "<a href=\"https://bitmessage.org/wiki/PyBitmessage_Help\">https://bitmessage.org/wiki/PyBitmessage_Help</a>", None, QtGui.QApplication.UnicodeUTF8))
self.label.setText(QtGui.QApplication.translate("helpDialog", "As Bitmessage is a collaborative project, help can be found online in the Bitmessage Wiki:", None, QtGui.QApplication.UnicodeUTF8))