From 6adce9bf0386d3dd4eccbaba33be982f1399c4eb Mon Sep 17 00:00:00 2001 From: hsoft Date: Fri, 30 Oct 2009 11:41:14 +0000 Subject: [PATCH] dgbase qt: Now uses qtlib's about_box and reg. --HG-- extra : convert_revision : svn%3Ac306627e-7827-47d3-bdf0-9a457c9553a1/trunk%40229 --- base/qt/about_box.py | 37 --------- base/qt/about_box.ui | 133 ------------------------------- base/qt/app.py | 5 +- base/qt/reg.py | 36 --------- base/qt/reg_demo_dialog.py | 47 ----------- base/qt/reg_demo_dialog.ui | 140 -------------------------------- base/qt/reg_submit_dialog.py | 49 ------------ base/qt/reg_submit_dialog.ui | 149 ----------------------------------- 8 files changed, 3 insertions(+), 593 deletions(-) delete mode 100644 base/qt/about_box.py delete mode 100644 base/qt/about_box.ui delete mode 100644 base/qt/reg.py delete mode 100644 base/qt/reg_demo_dialog.py delete mode 100644 base/qt/reg_demo_dialog.ui delete mode 100644 base/qt/reg_submit_dialog.py delete mode 100644 base/qt/reg_submit_dialog.ui diff --git a/base/qt/about_box.py b/base/qt/about_box.py deleted file mode 100644 index c72a7dfb..00000000 --- a/base/qt/about_box.py +++ /dev/null @@ -1,37 +0,0 @@ -# Created By: Virgil Dupras -# Created On: 2009-05-09 -# $Id$ -# Copyright 2009 Hardcoded Software (http://www.hardcoded.net) -# -# This software is licensed under the "HS" License as described in the "LICENSE" file, -# which should be included with this package. The terms are also available at -# http://www.hardcoded.net/licenses/hs_license - -from PyQt4.QtCore import Qt, QCoreApplication, SIGNAL -from PyQt4.QtGui import QDialog, QDialogButtonBox, QPixmap - -from about_box_ui import Ui_AboutBox - -class AboutBox(QDialog, Ui_AboutBox): - def __init__(self, parent, app): - flags = Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.MSWindowsFixedSizeDialogHint - QDialog.__init__(self, parent, flags) - self.app = app - self._setupUi() - - self.connect(self.buttonBox, SIGNAL('clicked(QAbstractButton*)'), self.buttonClicked) - - def _setupUi(self): - self.setupUi(self) - # Stuff that can't be done in the Designer - self.setWindowTitle(u"About %s" % QCoreApplication.instance().applicationName()) - self.nameLabel.setText(QCoreApplication.instance().applicationName()) - self.versionLabel.setText('Version ' + QCoreApplication.instance().applicationVersion()) - self.logoLabel.setPixmap(QPixmap(':/%s_big' % self.app.LOGO_NAME)) - self.registerButton = self.buttonBox.addButton("Register", QDialogButtonBox.ActionRole) - - #--- Events - def buttonClicked(self, button): - if button is self.registerButton: - self.app.ask_for_reg_code() - diff --git a/base/qt/about_box.ui b/base/qt/about_box.ui deleted file mode 100644 index aa9c5ce5..00000000 --- a/base/qt/about_box.ui +++ /dev/null @@ -1,133 +0,0 @@ - - - AboutBox - - - - 0 - 0 - 400 - 190 - - - - - 0 - 0 - - - - About dupeGuru - - - - - - - - - :/logo_me_big - - - - - - - - - - 75 - true - - - - dupeGuru - - - - - - - Version - - - - - - - Copyright Hardcoded Software 2009 - - - - - - - - 75 - true - - - - Registered To: - - - - - - - UNREGISTERED - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Ok - - - - - - - - - - - - - buttonBox - accepted() - AboutBox - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - AboutBox - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/base/qt/app.py b/base/qt/app.py index 93a5e293..2d214cf1 100644 --- a/base/qt/app.py +++ b/base/qt/app.py @@ -23,14 +23,14 @@ from dupeguru import fs from dupeguru.app import (DupeGuru as DupeGuruBase, JOB_SCAN, JOB_LOAD, JOB_MOVE, JOB_COPY, JOB_DELETE) +from qtlib.about_box import AboutBox from qtlib.progress import Progress +from qtlib.reg import Registration from . import platform from .main_window import MainWindow from .directories_dialog import DirectoriesDialog -from .about_box import AboutBox -from .reg import Registration JOBID2TITLE = { JOB_SCAN: "Scanning for duplicates", @@ -54,6 +54,7 @@ class DupeGuru(DupeGuruBase, QObject): LOGO_NAME = '' NAME = '' DELTA_COLUMNS = frozenset() + DEMO_LIMIT_DESC = "In the demo version, only 10 duplicates per session can be sent to the recycle bin, moved or copied." def __init__(self, data_module, appid): appdata = unicode(QDesktopServices.storageLocation(QDesktopServices.DataLocation)) diff --git a/base/qt/reg.py b/base/qt/reg.py deleted file mode 100644 index 79653f08..00000000 --- a/base/qt/reg.py +++ /dev/null @@ -1,36 +0,0 @@ -# Created By: Virgil Dupras -# Created On: 2009-05-09 -# $Id$ -# Copyright 2009 Hardcoded Software (http://www.hardcoded.net) -# -# This software is licensed under the "HS" License as described in the "LICENSE" file, -# which should be included with this package. The terms are also available at -# http://www.hardcoded.net/licenses/hs_license - -from hashlib import md5 - -from PyQt4.QtGui import QDialog - -from reg_submit_dialog import RegSubmitDialog -from reg_demo_dialog import RegDemoDialog - -class Registration(object): - def __init__(self, app): - self.app = app - - def ask_for_code(self): - dialog = RegSubmitDialog(self.app.main_window, self.app.is_code_valid) - result = dialog.exec_() - code = unicode(dialog.codeEdit.text()) - email = unicode(dialog.emailEdit.text()) - dialog.setParent(None) # free it - if result == QDialog.Accepted and self.app.is_code_valid(code, email): - self.app.set_registration(code, email) - return True - return False - - def show_nag(self): - dialog = RegDemoDialog(self.app.main_window, self) - dialog.exec_() - dialog.setParent(None) # free it - diff --git a/base/qt/reg_demo_dialog.py b/base/qt/reg_demo_dialog.py deleted file mode 100644 index a038f7c5..00000000 --- a/base/qt/reg_demo_dialog.py +++ /dev/null @@ -1,47 +0,0 @@ -# Created By: Virgil Dupras -# Created On: 2009-05-10 -# $Id$ -# Copyright 2009 Hardcoded Software (http://www.hardcoded.net) -# -# This software is licensed under the "HS" License as described in the "LICENSE" file, -# which should be included with this package. The terms are also available at -# http://www.hardcoded.net/licenses/hs_license - -from PyQt4.QtCore import SIGNAL, Qt, QUrl, QCoreApplication -from PyQt4.QtGui import QDialog, QMessageBox, QDesktopServices - -from reg_demo_dialog_ui import Ui_RegDemoDialog - -class RegDemoDialog(QDialog, Ui_RegDemoDialog): - def __init__(self, parent, reg): - flags = Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint - QDialog.__init__(self, parent, flags) - self.reg = reg - self._setupUi() - - self.connect(self.enterCodeButton, SIGNAL('clicked()'), self.enterCodeClicked) - self.connect(self.purchaseButton, SIGNAL('clicked()'), self.purchaseClicked) - - def _setupUi(self): - self.setupUi(self) - # Stuff that can't be setup in the Designer - appname = QCoreApplication.instance().applicationName() - title = self.windowTitle() - title = title.replace('$appname', appname) - self.setWindowTitle(title) - title = self.titleLabel.text() - title = title.replace('$appname', appname) - self.titleLabel.setText(title) - desc = self.demoDescLabel.text() - desc = desc.replace('$appname', appname) - self.demoDescLabel.setText(desc) - - #--- Events - def enterCodeClicked(self): - if self.reg.ask_for_code(): - self.accept() - - def purchaseClicked(self): - url = QUrl('http://www.hardcoded.net/purchase.htm') - QDesktopServices.openUrl(url) - diff --git a/base/qt/reg_demo_dialog.ui b/base/qt/reg_demo_dialog.ui deleted file mode 100644 index ef918225..00000000 --- a/base/qt/reg_demo_dialog.ui +++ /dev/null @@ -1,140 +0,0 @@ - - - RegDemoDialog - - - - 0 - 0 - 387 - 161 - - - - $appname Demo Version - - - - - - - 75 - true - - - - $appname Demo Version - - - - - - - You are currently running a demo version of $appname. This version has limited functionalities, and you need to buy it to have access to these functionalities. - - - true - - - - - - - In the demo version, only 10 duplicates per session can be sent to the recycle bin, moved or copied. - - - true - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 110 - 0 - - - - Try Demo - - - - - - - - 110 - 0 - - - - Enter Code - - - - - - - - 110 - 0 - - - - Purchase - - - - - - - - - - - tryButton - clicked() - RegDemoDialog - accept() - - - 112 - 161 - - - 201 - 94 - - - - - diff --git a/base/qt/reg_submit_dialog.py b/base/qt/reg_submit_dialog.py deleted file mode 100644 index 2befc08f..00000000 --- a/base/qt/reg_submit_dialog.py +++ /dev/null @@ -1,49 +0,0 @@ -# Created By: Virgil Dupras -# Created On: 2009-05-09 -# $Id$ -# Copyright 2009 Hardcoded Software (http://www.hardcoded.net) -# -# This software is licensed under the "HS" License as described in the "LICENSE" file, -# which should be included with this package. The terms are also available at -# http://www.hardcoded.net/licenses/hs_license - -from PyQt4.QtCore import SIGNAL, Qt, QUrl, QCoreApplication -from PyQt4.QtGui import QDialog, QMessageBox, QDesktopServices - -from reg_submit_dialog_ui import Ui_RegSubmitDialog - -class RegSubmitDialog(QDialog, Ui_RegSubmitDialog): - def __init__(self, parent, is_valid_func): - flags = Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint - QDialog.__init__(self, parent, flags) - self._setupUi() - self.is_valid_func = is_valid_func - - self.connect(self.submitButton, SIGNAL('clicked()'), self.submitClicked) - self.connect(self.purchaseButton, SIGNAL('clicked()'), self.purchaseClicked) - - def _setupUi(self): - self.setupUi(self) - # Stuff that can't be setup in the Designer - appname = QCoreApplication.instance().applicationName() - prompt = self.promptLabel.text() - prompt = prompt.replace('$appname', appname) - self.promptLabel.setText(prompt) - - #--- Events - def purchaseClicked(self): - url = QUrl('http://www.hardcoded.net/purchase.htm') - QDesktopServices.openUrl(url) - - def submitClicked(self): - code = unicode(self.codeEdit.text()) - email = unicode(self.emailEdit.text()) - title = "Registration" - if self.is_valid_func(code, email): - msg = "This code is valid. Thanks!" - QMessageBox.information(self, title, msg) - self.accept() - else: - msg = "This code is invalid" - QMessageBox.warning(self, title, msg) - diff --git a/base/qt/reg_submit_dialog.ui b/base/qt/reg_submit_dialog.ui deleted file mode 100644 index 06de4191..00000000 --- a/base/qt/reg_submit_dialog.ui +++ /dev/null @@ -1,149 +0,0 @@ - - - RegSubmitDialog - - - - 0 - 0 - 365 - 134 - - - - Enter your registration code - - - - - - Please enter your $appname registration code and registered e-mail (the e-mail you used for the purchase), then press "Submit". - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - - - - - QLayout::SetNoConstraint - - - QFormLayout::ExpandingFieldsGrow - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - Registration code: - - - - - - - Registered e-mail: - - - - - - - - - - - - - - - - - Purchase - - - false - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - Cancel - - - false - - - - - - - - 0 - 0 - - - - Submit - - - false - - - true - - - - - - - - - - - cancelButton - clicked() - RegSubmitDialog - reject() - - - 260 - 159 - - - 198 - 97 - - - - -