mirror of
https://github.com/Llewellynvdm/Tomb.git
synced 2025-01-11 01:32:07 +00:00
Working draft (works bad)
Password input is removed: not secure, tomb provides pinentry key location option is actually ignored. USB support is yet to come
This commit is contained in:
parent
2a962d788d
commit
4f1bb64010
@ -1,11 +1,12 @@
|
||||
import sys, os
|
||||
from PyQt4.QtGui import QApplication, QWizard
|
||||
from PyQt4 import QtCore
|
||||
from PyQt4 import QtGui
|
||||
from ui_create import Ui_Wizard
|
||||
|
||||
parentdir = sys.path[0].split(os.sep)[:-1]
|
||||
sys.path.append(os.sep.join(parentdir))
|
||||
from tomblib import wrapper
|
||||
from tomblib import tomb
|
||||
|
||||
try:
|
||||
_fromUtf8 = QtCore.QString.fromUtf8
|
||||
@ -19,13 +20,23 @@ class TombCreateWizard(QWizard):
|
||||
ui.setupUi(self)
|
||||
|
||||
ui.wizardPage_tomb_location.registerField('tombpath*', ui.lineEdit_tombpath) #required field, note the *
|
||||
ui.wizardPage_key_location.setCommitPage(True)
|
||||
|
||||
QtCore.QObject.connect(self, QtCore.SIGNAL(_fromUtf8('finished(int)')), self.create_tomb)
|
||||
QtCore.QObject.connect(ui.button_tombpath, QtCore.SIGNAL(_fromUtf8('clicked()')), self.on_tomb_location_clicked)
|
||||
QtCore.QObject.connect(self, QtCore.SIGNAL(_fromUtf8('currentIdChanged(int)')), self.on_change_page)
|
||||
|
||||
def on_tomb_location_clicked(self, *args, **kwargs):
|
||||
filename = QtGui.QFileDialog.getSaveFileName(self, 'Create Tomb', filter="*.tomb")
|
||||
print filename
|
||||
self.ui.lineEdit_tombpath.setText(filename)
|
||||
def on_change_page(self, pagenumber):
|
||||
if self.currentPage() == self.ui.wizardPage_progress:
|
||||
self.create_tomb()
|
||||
def create_tomb(self, *args, **kwargs):
|
||||
print 'creating'
|
||||
wrapper.Tomb.create(1,2,3)
|
||||
print 'created!'
|
||||
#FIXME: this will lock up the GUI
|
||||
#FIXME: no support for other keypath than "next to tomb"
|
||||
tomb.Tomb.create(self.ui.lineEdit_tombpath.text(), str(self.ui.spinBox_size.value()), None)
|
||||
self.ui.progressBar.setValue(100)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -59,12 +59,12 @@
|
||||
<string>Enter tomb size, in MB. 1GB=1000MB)</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spinBox</cstring>
|
||||
<cstring>spinBox_size</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox">
|
||||
<widget class="QSpinBox" name="spinBox_size">
|
||||
<property name="maximum">
|
||||
<number>100000</number>
|
||||
</property>
|
||||
@ -105,7 +105,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<widget class="QPushButton" name="button_tombpath">
|
||||
<property name="text">
|
||||
<string>Open file</string>
|
||||
</property>
|
||||
@ -261,74 +261,49 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="WizardPage_pass" name="wizardPage_pass">
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QWizardPage" name="wizardPage_progress">
|
||||
<property name="title">
|
||||
<string>Key</string>
|
||||
<string>Creating</string>
|
||||
</property>
|
||||
<property name="subTitle">
|
||||
<string>Password</string>
|
||||
<string>Please wait</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Choose a <b>strong</b> password now</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Password</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lineEdit_pass</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_pass">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Password (again, for confirmation)</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lineEdit_pass_again</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_pass_again">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_pwd_match">
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Warning: password doesn't match</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>30</y>
|
||||
<width>276</width>
|
||||
<height>52</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="textVisible">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="invertedAppearance">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Creating tomb, please wait...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWizardPage" name="wizardPage_end">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
@ -355,18 +330,6 @@ p, li { white-space: pre-wrap; }
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>WizardPage_pass</class>
|
||||
<extends>QWizardPage</extends>
|
||||
<header>wizardpage_pass.h</header>
|
||||
<container>1</container>
|
||||
<slots>
|
||||
<signal>password_not_match(bool)</signal>
|
||||
<slot>check_password_match()</slot>
|
||||
</slots>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
@ -376,12 +339,12 @@ p, li { white-space: pre-wrap; }
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>62</x>
|
||||
<y>29</y>
|
||||
<x>81</x>
|
||||
<y>212</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>99</x>
|
||||
<y>29</y>
|
||||
<x>164</x>
|
||||
<y>243</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
@ -392,12 +355,12 @@ p, li { white-space: pre-wrap; }
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>99</x>
|
||||
<y>29</y>
|
||||
<x>118</x>
|
||||
<y>212</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>99</x>
|
||||
<y>29</y>
|
||||
<x>677</x>
|
||||
<y>246</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
@ -412,8 +375,8 @@ p, li { white-space: pre-wrap; }
|
||||
<y>335</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>77</x>
|
||||
<y>29</y>
|
||||
<x>95</x>
|
||||
<y>267</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
@ -428,56 +391,8 @@ p, li { white-space: pre-wrap; }
|
||||
<y>356</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>99</x>
|
||||
<y>29</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>lineEdit_pass</sender>
|
||||
<signal>textChanged(QString)</signal>
|
||||
<receiver>wizardPage_pass</receiver>
|
||||
<slot>check_password_match()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>99</x>
|
||||
<y>29</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>99</x>
|
||||
<y>29</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>wizardPage_pass</sender>
|
||||
<signal>password_match(bool)</signal>
|
||||
<receiver>label_pwd_match</receiver>
|
||||
<slot>setVisible(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>99</x>
|
||||
<y>29</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>99</x>
|
||||
<y>29</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>lineEdit_pass_again</sender>
|
||||
<signal>textChanged(QString)</signal>
|
||||
<receiver>wizardPage_pass</receiver>
|
||||
<slot>check_password_match()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>99</x>
|
||||
<y>29</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>49</x>
|
||||
<y>14</y>
|
||||
<x>117</x>
|
||||
<y>267</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
|
9
src/gui/qt/notes.txt
Normal file
9
src/gui/qt/notes.txt
Normal file
@ -0,0 +1,9 @@
|
||||
Some conventions:
|
||||
.ui files are designers files
|
||||
Sometimes it's necessary to create custom widget to extend the functionality
|
||||
given by designer in a clean way. These files should be called ui_whatever.py
|
||||
|
||||
.ui files must be "compiled" using pyuic4. This should be done with make, but
|
||||
won't be right now. So, for the moment, I'll keep compiled files directly in
|
||||
the sources, for easiness.
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'create.ui'
|
||||
#
|
||||
# Created: Mon Oct 24 18:27:59 2011
|
||||
# Created: Thu Oct 27 01:57:45 2011
|
||||
# by: PyQt4 UI code generator 4.8.5
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
@ -48,11 +48,11 @@ class Ui_Wizard(object):
|
||||
self.label_3.setText(QtGui.QApplication.translate("Wizard", "Enter tomb size, in MB. 1GB=1000MB)", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_3.setObjectName(_fromUtf8("label_3"))
|
||||
self.horizontalLayout.addWidget(self.label_3)
|
||||
self.spinBox = QtGui.QSpinBox(self.wizardPage_tomb_size)
|
||||
self.spinBox.setMaximum(100000)
|
||||
self.spinBox.setProperty("value", 100)
|
||||
self.spinBox.setObjectName(_fromUtf8("spinBox"))
|
||||
self.horizontalLayout.addWidget(self.spinBox)
|
||||
self.spinBox_size = QtGui.QSpinBox(self.wizardPage_tomb_size)
|
||||
self.spinBox_size.setMaximum(100000)
|
||||
self.spinBox_size.setProperty("value", 100)
|
||||
self.spinBox_size.setObjectName(_fromUtf8("spinBox_size"))
|
||||
self.horizontalLayout.addWidget(self.spinBox_size)
|
||||
self.verticalLayout_2.addLayout(self.horizontalLayout)
|
||||
Wizard.addPage(self.wizardPage_tomb_size)
|
||||
self.wizardPage_tomb_location = QtGui.QWizardPage()
|
||||
@ -71,10 +71,10 @@ class Ui_Wizard(object):
|
||||
self.lineEdit_tombpath.setPlaceholderText(QtGui.QApplication.translate("Wizard", "/path/to/file.tomb", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.lineEdit_tombpath.setObjectName(_fromUtf8("lineEdit_tombpath"))
|
||||
self.horizontalLayout_2.addWidget(self.lineEdit_tombpath)
|
||||
self.pushButton = QtGui.QPushButton(self.wizardPage_tomb_location)
|
||||
self.pushButton.setText(QtGui.QApplication.translate("Wizard", "Open file", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.pushButton.setObjectName(_fromUtf8("pushButton"))
|
||||
self.horizontalLayout_2.addWidget(self.pushButton)
|
||||
self.button_tombpath = QtGui.QPushButton(self.wizardPage_tomb_location)
|
||||
self.button_tombpath.setText(QtGui.QApplication.translate("Wizard", "Open file", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.button_tombpath.setObjectName(_fromUtf8("button_tombpath"))
|
||||
self.horizontalLayout_2.addWidget(self.button_tombpath)
|
||||
self.verticalLayout_3.addLayout(self.horizontalLayout_2)
|
||||
Wizard.addPage(self.wizardPage_tomb_location)
|
||||
self.wizardPage_key_location = QtGui.QWizardPage()
|
||||
@ -152,45 +152,30 @@ class Ui_Wizard(object):
|
||||
self.label_11.setObjectName(_fromUtf8("label_11"))
|
||||
self.verticalLayout_6.addWidget(self.label_11)
|
||||
Wizard.addPage(self.wizardPage_key_location)
|
||||
self.wizardPage_pass = WizardPage_pass()
|
||||
self.wizardPage_pass.setAutoFillBackground(False)
|
||||
self.wizardPage_pass.setTitle(QtGui.QApplication.translate("Wizard", "Key", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.wizardPage_pass.setSubTitle(QtGui.QApplication.translate("Wizard", "Password", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.wizardPage_pass.setObjectName(_fromUtf8("wizardPage_pass"))
|
||||
self.verticalLayout_7 = QtGui.QVBoxLayout(self.wizardPage_pass)
|
||||
self.wizardPage_progress = QtGui.QWizardPage()
|
||||
self.wizardPage_progress.setTitle(QtGui.QApplication.translate("Wizard", "Creating", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.wizardPage_progress.setSubTitle(QtGui.QApplication.translate("Wizard", "Please wait", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.wizardPage_progress.setObjectName(_fromUtf8("wizardPage_progress"))
|
||||
self.widget = QtGui.QWidget(self.wizardPage_progress)
|
||||
self.widget.setGeometry(QtCore.QRect(30, 30, 276, 52))
|
||||
self.widget.setObjectName(_fromUtf8("widget"))
|
||||
self.verticalLayout_7 = QtGui.QVBoxLayout(self.widget)
|
||||
self.verticalLayout_7.setMargin(0)
|
||||
self.verticalLayout_7.setObjectName(_fromUtf8("verticalLayout_7"))
|
||||
self.label_7 = QtGui.QLabel(self.wizardPage_pass)
|
||||
self.label_7.setText(QtGui.QApplication.translate("Wizard", "Choose a <b>strong</b> password now", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.progressBar = QtGui.QProgressBar(self.widget)
|
||||
self.progressBar.setProperty("value", 0)
|
||||
self.progressBar.setTextVisible(True)
|
||||
self.progressBar.setInvertedAppearance(False)
|
||||
self.progressBar.setObjectName(_fromUtf8("progressBar"))
|
||||
self.verticalLayout_7.addWidget(self.progressBar)
|
||||
self.horizontalLayout_5 = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5"))
|
||||
self.label_7 = QtGui.QLabel(self.widget)
|
||||
self.label_7.setText(QtGui.QApplication.translate("Wizard", "Creating tomb, please wait...", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_7.setObjectName(_fromUtf8("label_7"))
|
||||
self.verticalLayout_7.addWidget(self.label_7)
|
||||
self.formLayout = QtGui.QFormLayout()
|
||||
self.formLayout.setObjectName(_fromUtf8("formLayout"))
|
||||
self.label_8 = QtGui.QLabel(self.wizardPage_pass)
|
||||
self.label_8.setText(QtGui.QApplication.translate("Wizard", "Password", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_8.setObjectName(_fromUtf8("label_8"))
|
||||
self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.label_8)
|
||||
self.lineEdit_pass = QtGui.QLineEdit(self.wizardPage_pass)
|
||||
self.lineEdit_pass.setEchoMode(QtGui.QLineEdit.Password)
|
||||
self.lineEdit_pass.setObjectName(_fromUtf8("lineEdit_pass"))
|
||||
self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.lineEdit_pass)
|
||||
self.label_9 = QtGui.QLabel(self.wizardPage_pass)
|
||||
self.label_9.setText(QtGui.QApplication.translate("Wizard", "Password (again, for confirmation)", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_9.setObjectName(_fromUtf8("label_9"))
|
||||
self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.label_9)
|
||||
self.lineEdit_pass_again = QtGui.QLineEdit(self.wizardPage_pass)
|
||||
self.lineEdit_pass_again.setEchoMode(QtGui.QLineEdit.Password)
|
||||
self.lineEdit_pass_again.setObjectName(_fromUtf8("lineEdit_pass_again"))
|
||||
self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.lineEdit_pass_again)
|
||||
self.verticalLayout_7.addLayout(self.formLayout)
|
||||
self.label_pwd_match = QtGui.QLabel(self.wizardPage_pass)
|
||||
self.label_pwd_match.setText(QtGui.QApplication.translate("Wizard", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
||||
"p, li { white-space: pre-wrap; }\n"
|
||||
"</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">Warning: password doesn\'t match</span></p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_pwd_match.setObjectName(_fromUtf8("label_pwd_match"))
|
||||
self.verticalLayout_7.addWidget(self.label_pwd_match)
|
||||
Wizard.addPage(self.wizardPage_pass)
|
||||
self.horizontalLayout_5.addWidget(self.label_7)
|
||||
self.verticalLayout_7.addLayout(self.horizontalLayout_5)
|
||||
Wizard.addPage(self.wizardPage_progress)
|
||||
self.wizardPage_end = QtGui.QWizardPage()
|
||||
self.wizardPage_end.setObjectName(_fromUtf8("wizardPage_end"))
|
||||
self.verticalLayout_8 = QtGui.QVBoxLayout(self.wizardPage_end)
|
||||
@ -206,22 +191,16 @@ class Ui_Wizard(object):
|
||||
self.checkBox.setObjectName(_fromUtf8("checkBox"))
|
||||
self.verticalLayout_8.addWidget(self.checkBox)
|
||||
Wizard.addPage(self.wizardPage_end)
|
||||
self.label_3.setBuddy(self.spinBox)
|
||||
self.label_3.setBuddy(self.spinBox_size)
|
||||
self.label_4.setBuddy(self.lineEdit_tombpath)
|
||||
self.label_8.setBuddy(self.lineEdit_pass)
|
||||
self.label_9.setBuddy(self.lineEdit_pass_again)
|
||||
|
||||
self.retranslateUi(Wizard)
|
||||
QtCore.QObject.connect(self.radioButton_3, QtCore.SIGNAL(_fromUtf8("toggled(bool)")), self.lineEdit_2.setEnabled)
|
||||
QtCore.QObject.connect(self.radioButton_3, QtCore.SIGNAL(_fromUtf8("toggled(bool)")), self.pushButton_2.setEnabled)
|
||||
QtCore.QObject.connect(Wizard, QtCore.SIGNAL(_fromUtf8("currentIdChanged(int)")), self.label_11.hide)
|
||||
QtCore.QObject.connect(Wizard, QtCore.SIGNAL(_fromUtf8("helpRequested()")), self.label_11.show)
|
||||
QtCore.QObject.connect(self.lineEdit_pass, QtCore.SIGNAL(_fromUtf8("textChanged(QString)")), self.wizardPage_pass.check_password_match)
|
||||
QtCore.QObject.connect(self.wizardPage_pass, QtCore.SIGNAL(_fromUtf8("password_match(bool)")), self.label_pwd_match.setVisible)
|
||||
QtCore.QObject.connect(self.lineEdit_pass_again, QtCore.SIGNAL(_fromUtf8("textChanged(QString)")), self.wizardPage_pass.check_password_match)
|
||||
QtCore.QMetaObject.connectSlotsByName(Wizard)
|
||||
|
||||
def retranslateUi(self, Wizard):
|
||||
pass
|
||||
|
||||
from wizardpage_pass import WizardPage_pass
|
||||
|
@ -1,31 +0,0 @@
|
||||
'''
|
||||
This module provide some methods to enhance the password page
|
||||
of the wizard. It could have been avoided, but this way make
|
||||
it easier to do things from the designer.
|
||||
|
||||
Indeed, it's possible to use password_match(bool) signal
|
||||
and check_password_match(slot) from the designer.
|
||||
'''
|
||||
|
||||
from PyQt4.QtGui import QWizardPage
|
||||
from PyQt4 import QtCore, QtGui
|
||||
try:
|
||||
_fromUtf8 = QtCore.QString.fromUtf8
|
||||
except AttributeError:
|
||||
_fromUtf8 = lambda s: s
|
||||
class WizardPage_pass(QWizardPage):
|
||||
password_match = QtCore.pyqtSignal(bool)
|
||||
def __init__(self, *args, **kwargs):
|
||||
QWizardPage.__init__(self, *args, **kwargs)
|
||||
def _password_match(self):
|
||||
pass1 = self.findChild(QtGui.QLineEdit, _fromUtf8('lineEdit_pass')).text()
|
||||
pass2 = self.findChild(QtGui.QLineEdit, _fromUtf8('lineEdit_pass_again')).text()
|
||||
return pass1 == pass2
|
||||
def check_password_match(self):
|
||||
self.password_match.emit(not self._password_match())
|
||||
self.completeChanged.emit()
|
||||
def isComplete(self): #this will make the "Next" button disabled if password doesn't match
|
||||
return self._password_match()
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user