First draft for a gui

This commit is contained in:
BoySka 2011-10-24 04:04:50 +02:00 committed by boyska
parent 6f0bc82e07
commit 92e776c6d6
9 changed files with 785 additions and 0 deletions

1
src/gui/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.*.swp

12
src/gui/HACKING.txt Normal file
View File

@ -0,0 +1,12 @@
### Code organization:
* tomblib: a library that wraps on tomb. Meant to be used by various scripts, and every UI
* qt / wx / whatever: directory for different gui implementations
### QT project:
status: only create wizard
the graphical part is done through create.ui, which can be edited by designer
The UI should be (if possible) completely autocontained in this .ui file, and no code (or very few) should be added to make it work.
* ATM, some code has been added for the "password don't match" part.
* Some code need to be added to make the filedialog work

29
src/gui/qt/create.py Executable file
View File

@ -0,0 +1,29 @@
import sys, os
from PyQt4.QtGui import QApplication, QWizard
from PyQt4 import QtCore
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
app = QApplication(sys.argv)
window = QWizard()
ui = Ui_Wizard()
ui.setupUi(window)
def create_tomb(*args, **kwargs):
print 'creating'
wrapper.Tomb.create(1,2,3)
print 'created!'
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s
QtCore.QObject.connect(window, QtCore.SIGNAL(_fromUtf8('finished(int)')), create_tomb)
window.show()
sys.exit(app.exec_())

481
src/gui/qt/create.ui Executable file
View File

@ -0,0 +1,481 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Wizard</class>
<widget class="QWizard" name="Wizard">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>710</width>
<height>368</height>
</rect>
</property>
<property name="windowTitle">
<string>Wizard</string>
</property>
<property name="options">
<set>QWizard::HaveHelpButton|QWizard::IndependentPages</set>
</property>
<widget class="QWizardPage" name="wizardPage_intro">
<property name="title">
<string>Tomb</string>
</property>
<property name="subTitle">
<string>tomb creation</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>This wizard will guide you to the creation of a tomb.&lt;br&gt; It will be fun!</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWizardPage" name="wizardPage_tomb_size">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Please enter tomb size. Digging the tomb will require some time: usually, one minute per GB, but your mileage may vary. &lt;br&gt;Keep in mind that resizing it in the future is still NOT implemented</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Enter tomb size, in MB. 1GB=1000MB)</string>
</property>
<property name="buddy">
<cstring>spinBox</cstring>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox">
<property name="maximum">
<number>100000</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWizardPage" name="wizardPage_tomb_location">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Where do you want your tomb to be digged?</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="buddy">
<cstring>lineEdit</cstring>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="lineEdit"/>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Open file</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWizardPage" name="wizardPage_key_location">
<property name="title">
<string>Key creation</string>
</property>
<property name="subTitle">
<string>Choose the location for your key</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Now, you have to decide where to put the &lt;span style=&quot; font-weight:600;&quot;&gt;key&lt;/span&gt; for your tomb&lt;br /&gt;You should not leave your key at the door, as this will lower security A LOT&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Also, the keyfile is very small (less than a KB), so disk space is not an issue&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QRadioButton" name="radioButton">
<property name="text">
<string>On a USB pen (best security)</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Maximum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>If you choose to do so, do not insert it NOW. Do it when you are asked to do so</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QRadioButton" name="radioButton_2">
<property name="toolTip">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;It will be created as a regular file in the same directory of your tomb.&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;It is much easier to use, but also much more &lt;span style=&quot; font-style:italic;&quot;&gt;insecure&lt;/span&gt;: all your security will be guaranteed by your &lt;span style=&quot; font-weight:600;&quot;&gt;password&lt;/span&gt;. If you really want to do this, choose a strong password (lot of random/non-dictionary words, spaces, numbers, odd characters)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Near to the tomb itself (this is BAD)</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_3">
<property name="text">
<string>Specify location</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Maximum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_2">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Choose location</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_11">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Help: &lt;/span&gt;the key file is very small, so disk usage is not an issue&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="WizardPage_pass" name="wizardPage_pass">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="title">
<string>Key</string>
</property>
<property name="subTitle">
<string>Password</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Choose a &lt;b&gt;strong&lt;/b&gt; 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>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Warning: password doesn't match&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWizardPage" name="wizardPage_end">
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<widget class="QLabel" name="label_10">
<property name="text">
<string>You successfully created the tomb!</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox">
<property name="text">
<string>Open the just-created tomb NOW!</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
</item>
</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>
<sender>radioButton_3</sender>
<signal>toggled(bool)</signal>
<receiver>lineEdit_2</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>62</x>
<y>212</y>
</hint>
<hint type="destinationlabel">
<x>164</x>
<y>243</y>
</hint>
</hints>
</connection>
<connection>
<sender>radioButton_3</sender>
<signal>toggled(bool)</signal>
<receiver>pushButton_2</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>118</x>
<y>212</y>
</hint>
<hint type="destinationlabel">
<x>677</x>
<y>246</y>
</hint>
</hints>
</connection>
<connection>
<sender>Wizard</sender>
<signal>currentIdChanged(int)</signal>
<receiver>label_11</receiver>
<slot>hide()</slot>
<hints>
<hint type="sourcelabel">
<x>181</x>
<y>335</y>
</hint>
<hint type="destinationlabel">
<x>77</x>
<y>267</y>
</hint>
</hints>
</connection>
<connection>
<sender>Wizard</sender>
<signal>helpRequested()</signal>
<receiver>label_11</receiver>
<slot>show()</slot>
<hints>
<hint type="sourcelabel">
<x>135</x>
<y>356</y>
</hint>
<hint type="destinationlabel">
<x>117</x>
<y>267</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>339</x>
<y>105</y>
</hint>
<hint type="destinationlabel">
<x>99</x>
<y>85</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>85</y>
</hint>
<hint type="destinationlabel">
<x>117</x>
<y>152</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>289</x>
<y>126</y>
</hint>
<hint type="destinationlabel">
<x>49</x>
<y>70</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>check_passwords_equal()</slot>
</slots>
</ui>

226
src/gui/qt/ui_create.py Executable file
View File

@ -0,0 +1,226 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'create.ui'
#
# Created: Mon Oct 24 03:26:55 2011
# by: PyQt4 UI code generator 4.8.5
#
# 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_Wizard(object):
def setupUi(self, Wizard):
Wizard.setObjectName(_fromUtf8("Wizard"))
Wizard.resize(710, 368)
Wizard.setWindowTitle(QtGui.QApplication.translate("Wizard", "Wizard", None, QtGui.QApplication.UnicodeUTF8))
Wizard.setWizardStyle(QtGui.QWizard.ModernStyle)
Wizard.setOptions(QtGui.QWizard.HaveHelpButton|QtGui.QWizard.IndependentPages)
self.wizardPage_intro = QtGui.QWizardPage()
self.wizardPage_intro.setTitle(QtGui.QApplication.translate("Wizard", "Tomb", None, QtGui.QApplication.UnicodeUTF8))
self.wizardPage_intro.setSubTitle(QtGui.QApplication.translate("Wizard", "tomb creation", None, QtGui.QApplication.UnicodeUTF8))
self.wizardPage_intro.setObjectName(_fromUtf8("wizardPage_intro"))
self.verticalLayout = QtGui.QVBoxLayout(self.wizardPage_intro)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.label = QtGui.QLabel(self.wizardPage_intro)
self.label.setText(QtGui.QApplication.translate("Wizard", "This wizard will guide you to the creation of a tomb.<br> It will be fun!", None, QtGui.QApplication.UnicodeUTF8))
self.label.setTextFormat(QtCore.Qt.RichText)
self.label.setWordWrap(True)
self.label.setObjectName(_fromUtf8("label"))
self.verticalLayout.addWidget(self.label)
Wizard.addPage(self.wizardPage_intro)
self.wizardPage_tomb_size = QtGui.QWizardPage()
self.wizardPage_tomb_size.setObjectName(_fromUtf8("wizardPage_tomb_size"))
self.verticalLayout_2 = QtGui.QVBoxLayout(self.wizardPage_tomb_size)
self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
self.label_2 = QtGui.QLabel(self.wizardPage_tomb_size)
self.label_2.setText(QtGui.QApplication.translate("Wizard", "Please enter tomb size. Digging the tomb will require some time: usually, one minute per GB, but your mileage may vary. <br>Keep in mind that resizing it in the future is still NOT implemented", None, QtGui.QApplication.UnicodeUTF8))
self.label_2.setWordWrap(True)
self.label_2.setObjectName(_fromUtf8("label_2"))
self.verticalLayout_2.addWidget(self.label_2)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.label_3 = QtGui.QLabel(self.wizardPage_tomb_size)
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.verticalLayout_2.addLayout(self.horizontalLayout)
Wizard.addPage(self.wizardPage_tomb_size)
self.wizardPage_tomb_location = QtGui.QWizardPage()
self.wizardPage_tomb_location.setObjectName(_fromUtf8("wizardPage_tomb_location"))
self.verticalLayout_3 = QtGui.QVBoxLayout(self.wizardPage_tomb_location)
self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3"))
self.label_4 = QtGui.QLabel(self.wizardPage_tomb_location)
self.label_4.setText(QtGui.QApplication.translate("Wizard", "Where do you want your tomb to be digged?", None, QtGui.QApplication.UnicodeUTF8))
self.label_4.setWordWrap(True)
self.label_4.setObjectName(_fromUtf8("label_4"))
self.verticalLayout_3.addWidget(self.label_4)
self.horizontalLayout_2 = QtGui.QHBoxLayout()
self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
self.lineEdit = QtGui.QLineEdit(self.wizardPage_tomb_location)
self.lineEdit.setObjectName(_fromUtf8("lineEdit"))
self.horizontalLayout_2.addWidget(self.lineEdit)
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.verticalLayout_3.addLayout(self.horizontalLayout_2)
Wizard.addPage(self.wizardPage_tomb_location)
self.wizardPage_key_location = QtGui.QWizardPage()
self.wizardPage_key_location.setTitle(QtGui.QApplication.translate("Wizard", "Key creation", None, QtGui.QApplication.UnicodeUTF8))
self.wizardPage_key_location.setSubTitle(QtGui.QApplication.translate("Wizard", "Choose the location for your key", None, QtGui.QApplication.UnicodeUTF8))
self.wizardPage_key_location.setObjectName(_fromUtf8("wizardPage_key_location"))
self.verticalLayout_6 = QtGui.QVBoxLayout(self.wizardPage_key_location)
self.verticalLayout_6.setObjectName(_fromUtf8("verticalLayout_6"))
self.label_5 = QtGui.QLabel(self.wizardPage_key_location)
self.label_5.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;\">Now, you have to decide where to put the <span style=\" font-weight:600;\">key</span> for your tomb<br />You should not leave your key at the door, as this will lower security A LOT</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Also, the keyfile is very small (less than a KB), so disk space is not an issue</p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
self.label_5.setTextFormat(QtCore.Qt.RichText)
self.label_5.setWordWrap(True)
self.label_5.setObjectName(_fromUtf8("label_5"))
self.verticalLayout_6.addWidget(self.label_5)
self.verticalLayout_5 = QtGui.QVBoxLayout()
self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5"))
self.verticalLayout_4 = QtGui.QVBoxLayout()
self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4"))
self.radioButton = QtGui.QRadioButton(self.wizardPage_key_location)
self.radioButton.setText(QtGui.QApplication.translate("Wizard", "On a USB pen (best security)", None, QtGui.QApplication.UnicodeUTF8))
self.radioButton.setChecked(True)
self.radioButton.setObjectName(_fromUtf8("radioButton"))
self.verticalLayout_4.addWidget(self.radioButton)
self.horizontalLayout_4 = QtGui.QHBoxLayout()
self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4"))
spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Minimum)
self.horizontalLayout_4.addItem(spacerItem)
self.label_6 = QtGui.QLabel(self.wizardPage_key_location)
self.label_6.setText(QtGui.QApplication.translate("Wizard", "If you choose to do so, do not insert it NOW. Do it when you are asked to do so", None, QtGui.QApplication.UnicodeUTF8))
self.label_6.setObjectName(_fromUtf8("label_6"))
self.horizontalLayout_4.addWidget(self.label_6)
self.verticalLayout_4.addLayout(self.horizontalLayout_4)
self.verticalLayout_5.addLayout(self.verticalLayout_4)
self.radioButton_2 = QtGui.QRadioButton(self.wizardPage_key_location)
self.radioButton_2.setToolTip(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;\">It will be created as a regular file in the same directory of your tomb.</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">It is much easier to use, but also much more <span style=\" font-style:italic;\">insecure</span>: all your security will be guaranteed by your <span style=\" font-weight:600;\">password</span>. If you really want to do this, choose a strong password (lot of random/non-dictionary words, spaces, numbers, odd characters)</p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
self.radioButton_2.setText(QtGui.QApplication.translate("Wizard", "Near to the tomb itself (this is BAD)", None, QtGui.QApplication.UnicodeUTF8))
self.radioButton_2.setObjectName(_fromUtf8("radioButton_2"))
self.verticalLayout_5.addWidget(self.radioButton_2)
self.radioButton_3 = QtGui.QRadioButton(self.wizardPage_key_location)
self.radioButton_3.setText(QtGui.QApplication.translate("Wizard", "Specify location", None, QtGui.QApplication.UnicodeUTF8))
self.radioButton_3.setObjectName(_fromUtf8("radioButton_3"))
self.verticalLayout_5.addWidget(self.radioButton_3)
self.verticalLayout_6.addLayout(self.verticalLayout_5)
self.horizontalLayout_3 = QtGui.QHBoxLayout()
self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Minimum)
self.horizontalLayout_3.addItem(spacerItem1)
self.lineEdit_2 = QtGui.QLineEdit(self.wizardPage_key_location)
self.lineEdit_2.setEnabled(False)
self.lineEdit_2.setObjectName(_fromUtf8("lineEdit_2"))
self.horizontalLayout_3.addWidget(self.lineEdit_2)
self.pushButton_2 = QtGui.QPushButton(self.wizardPage_key_location)
self.pushButton_2.setEnabled(False)
self.pushButton_2.setText(QtGui.QApplication.translate("Wizard", "Choose location", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_2.setObjectName(_fromUtf8("pushButton_2"))
self.horizontalLayout_3.addWidget(self.pushButton_2)
self.verticalLayout_6.addLayout(self.horizontalLayout_3)
self.label_11 = QtGui.QLabel(self.wizardPage_key_location)
self.label_11.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;\">Help: </span>the key file is very small, so disk usage is not an issue</p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
self.label_11.setWordWrap(True)
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.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.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.wizardPage_end = QtGui.QWizardPage()
self.wizardPage_end.setObjectName(_fromUtf8("wizardPage_end"))
self.verticalLayout_8 = QtGui.QVBoxLayout(self.wizardPage_end)
self.verticalLayout_8.setObjectName(_fromUtf8("verticalLayout_8"))
self.label_10 = QtGui.QLabel(self.wizardPage_end)
self.label_10.setText(QtGui.QApplication.translate("Wizard", "You successfully created the tomb!", None, QtGui.QApplication.UnicodeUTF8))
self.label_10.setObjectName(_fromUtf8("label_10"))
self.verticalLayout_8.addWidget(self.label_10)
self.checkBox = QtGui.QCheckBox(self.wizardPage_end)
self.checkBox.setText(QtGui.QApplication.translate("Wizard", "Open the just-created tomb NOW!", None, QtGui.QApplication.UnicodeUTF8))
self.checkBox.setChecked(True)
self.checkBox.setTristate(False)
self.checkBox.setObjectName(_fromUtf8("checkBox"))
self.verticalLayout_8.addWidget(self.checkBox)
Wizard.addPage(self.wizardPage_end)
self.label_3.setBuddy(self.spinBox)
self.label_4.setBuddy(self.lineEdit)
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

31
src/gui/qt/wizardpage_pass.py Executable file
View File

@ -0,0 +1,31 @@
'''
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()

BIN
src/gui/tomblib/.wrapper.py.swp Executable file

Binary file not shown.

0
src/gui/tomblib/__init__.py Executable file
View File

5
src/gui/tomblib/wrapper.py Executable file
View File

@ -0,0 +1,5 @@
class Tomb(object):
@staticmethod
def create(tombpath, size, keypath):
print 'I am not implemented'
raise NotImplementedError