mirror of
https://github.com/arsenetar/dupeguru.git
synced 2026-01-22 06:37:17 +00:00
Removed fairware
This commit is contained in:
@@ -15,17 +15,14 @@ from hscommon.trans import trget
|
||||
tr = trget('qtlib')
|
||||
|
||||
class AboutBox(QDialog):
|
||||
def __init__(self, parent, app, withreg=True):
|
||||
def __init__(self, parent, app):
|
||||
flags = Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.MSWindowsFixedSizeDialogHint
|
||||
QDialog.__init__(self, parent, flags)
|
||||
self.app = app
|
||||
self.withreg = withreg
|
||||
self._setupUi()
|
||||
|
||||
self.buttonBox.accepted.connect(self.accept)
|
||||
self.buttonBox.rejected.connect(self.reject)
|
||||
if self.withreg:
|
||||
self.buttonBox.clicked.connect(self.buttonClicked)
|
||||
|
||||
def _setupUi(self):
|
||||
self.setWindowTitle(tr("About {}").format(QCoreApplication.instance().applicationName()))
|
||||
@@ -59,23 +56,12 @@ class AboutBox(QDialog):
|
||||
font.setBold(True)
|
||||
self.label.setFont(font)
|
||||
self.verticalLayout.addWidget(self.label)
|
||||
self.registeredEmailLabel = QLabel(self)
|
||||
if self.withreg:
|
||||
self.registeredEmailLabel.setText(tr("UNREGISTERED"))
|
||||
self.verticalLayout.addWidget(self.registeredEmailLabel)
|
||||
self.buttonBox = QDialogButtonBox(self)
|
||||
self.buttonBox.setOrientation(Qt.Horizontal)
|
||||
self.buttonBox.setStandardButtons(QDialogButtonBox.Ok)
|
||||
if self.withreg:
|
||||
self.registerButton = self.buttonBox.addButton(tr("Register"), QDialogButtonBox.ActionRole)
|
||||
self.verticalLayout.addWidget(self.buttonBox)
|
||||
self.horizontalLayout.addLayout(self.verticalLayout)
|
||||
|
||||
#--- Events
|
||||
def buttonClicked(self, button):
|
||||
if button is self.registerButton:
|
||||
self.app.askForRegCode()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
|
||||
25
qtlib/reg.py
25
qtlib/reg.py
@@ -1,25 +0,0 @@
|
||||
# Created By: Virgil Dupras
|
||||
# Created On: 2009-05-09
|
||||
# Copyright 2013 Hardcoded Software (http://www.hardcoded.net)
|
||||
#
|
||||
# This software is licensed under the "BSD" 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/bsd_license
|
||||
|
||||
from PyQt4.QtGui import QDialog
|
||||
|
||||
from .reg_submit_dialog import RegSubmitDialog
|
||||
from .reg_demo_dialog import RegDemoDialog
|
||||
|
||||
class Registration:
|
||||
def __init__(self, app):
|
||||
self.app = app
|
||||
|
||||
def ask_for_code(self):
|
||||
dialog = RegSubmitDialog(None, self)
|
||||
return dialog.exec_() == QDialog.Accepted
|
||||
|
||||
def show_demo_nag(self, prompt):
|
||||
dialog = RegDemoDialog(None, self, prompt)
|
||||
dialog.exec_()
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
# Created By: Virgil Dupras
|
||||
# Created On: 2009-05-10
|
||||
# Copyright 2013 Hardcoded Software (http://www.hardcoded.net)
|
||||
#
|
||||
# This software is licensed under the "BSD" 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/bsd_license
|
||||
|
||||
import sys
|
||||
|
||||
from PyQt4.QtCore import Qt, QCoreApplication
|
||||
from PyQt4.QtGui import (QDialog, QApplication, QVBoxLayout, QHBoxLayout, QLabel,
|
||||
QFont, QSpacerItem, QSizePolicy, QPushButton)
|
||||
|
||||
from hscommon.plat import ISLINUX
|
||||
from hscommon.trans import trget
|
||||
|
||||
tr = trget('qtlib')
|
||||
|
||||
class RegDemoDialog(QDialog):
|
||||
def __init__(self, parent, reg, prompt):
|
||||
flags = Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint
|
||||
QDialog.__init__(self, parent, flags)
|
||||
self.reg = reg
|
||||
self._setupUi()
|
||||
self.descLabel.setText(prompt)
|
||||
|
||||
self.enterCodeButton.clicked.connect(self.enterCodeClicked)
|
||||
self.buyButton.clicked.connect(self.buyClicked)
|
||||
self.tryButton.clicked.connect(self.accept)
|
||||
self.moreInfoButton.clicked.connect(self.moreInfoClicked)
|
||||
|
||||
def _setupUi(self):
|
||||
appname = QCoreApplication.instance().applicationName()
|
||||
title = tr("$appname is Fairware")
|
||||
title = title.replace('$appname', appname)
|
||||
self.setWindowTitle(title)
|
||||
# Workaround for bug at http://bugreports.qt.nokia.com/browse/QTBUG-8212
|
||||
dlg_height = 370 if ISLINUX else 240
|
||||
self.resize(400, dlg_height)
|
||||
self.verticalLayout = QVBoxLayout(self)
|
||||
self.descLabel = QLabel(self)
|
||||
self.descLabel.setWordWrap(True)
|
||||
self.verticalLayout.addWidget(self.descLabel)
|
||||
spacerItem = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
|
||||
self.verticalLayout.addItem(spacerItem)
|
||||
self.horizontalLayout = QHBoxLayout()
|
||||
self.tryButton = QPushButton(self)
|
||||
self.tryButton.setText(tr("Try"))
|
||||
self.horizontalLayout.addWidget(self.tryButton)
|
||||
self.enterCodeButton = QPushButton(self)
|
||||
self.enterCodeButton.setText(tr("Enter Key"))
|
||||
self.horizontalLayout.addWidget(self.enterCodeButton)
|
||||
self.buyButton = QPushButton(self)
|
||||
self.buyButton.setText(tr("Buy"))
|
||||
self.horizontalLayout.addWidget(self.buyButton)
|
||||
self.moreInfoButton = QPushButton(tr("Fairware?"))
|
||||
self.horizontalLayout.addWidget(self.moreInfoButton)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout)
|
||||
|
||||
#--- Events
|
||||
def enterCodeClicked(self):
|
||||
if self.reg.ask_for_code():
|
||||
self.accept()
|
||||
|
||||
def buyClicked(self):
|
||||
self.reg.app.buy()
|
||||
|
||||
def moreInfoClicked(self):
|
||||
self.reg.app.about_fairware()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = QApplication([])
|
||||
app.unpaid_hours = 42.4
|
||||
class FakeReg:
|
||||
app = app
|
||||
dialog = RegDemoDialog(None, FakeReg(), "foo bar baz")
|
||||
dialog.show()
|
||||
sys.exit(app.exec_())
|
||||
@@ -1,102 +0,0 @@
|
||||
# Created By: Virgil Dupras
|
||||
# Created On: 2009-05-09
|
||||
# Copyright 2013 Hardcoded Software (http://www.hardcoded.net)
|
||||
#
|
||||
# This software is licensed under the "BSD" 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/bsd_license
|
||||
|
||||
import sys
|
||||
|
||||
from PyQt4.QtCore import Qt, QCoreApplication
|
||||
from PyQt4.QtGui import (QDialog, QApplication, QVBoxLayout, QHBoxLayout, QLabel, QFormLayout,
|
||||
QLayout, QLineEdit, QPushButton, QSpacerItem, QSizePolicy)
|
||||
|
||||
from hscommon.trans import trget
|
||||
|
||||
tr = trget('qtlib')
|
||||
|
||||
class RegSubmitDialog(QDialog):
|
||||
def __init__(self, parent, reg):
|
||||
flags = Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint
|
||||
QDialog.__init__(self, parent, flags)
|
||||
self._setupUi()
|
||||
self.reg = reg
|
||||
|
||||
self.submitButton.clicked.connect(self.submitClicked)
|
||||
self.contributeButton.clicked.connect(self.contributeClicked)
|
||||
self.cancelButton.clicked.connect(self.reject)
|
||||
|
||||
def _setupUi(self):
|
||||
self.setWindowTitle(tr("Enter your registration key"))
|
||||
self.resize(365, 126)
|
||||
self.verticalLayout = QVBoxLayout(self)
|
||||
self.promptLabel = QLabel(self)
|
||||
appname = str(QCoreApplication.instance().applicationName())
|
||||
prompt = tr("Type the key you received when you contributed to $appname, as well as the "
|
||||
"e-mail used as a reference for the purchase.").replace('$appname', appname)
|
||||
self.promptLabel.setText(prompt)
|
||||
self.promptLabel.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignTop)
|
||||
self.promptLabel.setWordWrap(True)
|
||||
self.verticalLayout.addWidget(self.promptLabel)
|
||||
self.formLayout = QFormLayout()
|
||||
self.formLayout.setSizeConstraint(QLayout.SetNoConstraint)
|
||||
self.formLayout.setFieldGrowthPolicy(QFormLayout.ExpandingFieldsGrow)
|
||||
self.formLayout.setLabelAlignment(Qt.AlignRight|Qt.AlignTrailing|Qt.AlignVCenter)
|
||||
self.formLayout.setFormAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignTop)
|
||||
self.label2 = QLabel(self)
|
||||
self.label2.setText(tr("Registration key:"))
|
||||
self.formLayout.setWidget(0, QFormLayout.LabelRole, self.label2)
|
||||
self.label3 = QLabel(self)
|
||||
self.label3.setText(tr("Registered e-mail:"))
|
||||
self.formLayout.setWidget(1, QFormLayout.LabelRole, self.label3)
|
||||
self.codeEdit = QLineEdit(self)
|
||||
self.formLayout.setWidget(0, QFormLayout.FieldRole, self.codeEdit)
|
||||
self.emailEdit = QLineEdit(self)
|
||||
self.formLayout.setWidget(1, QFormLayout.FieldRole, self.emailEdit)
|
||||
self.verticalLayout.addLayout(self.formLayout)
|
||||
self.horizontalLayout = QHBoxLayout()
|
||||
self.contributeButton = QPushButton(self)
|
||||
self.contributeButton.setText(tr("Contribute"))
|
||||
self.contributeButton.setAutoDefault(False)
|
||||
self.horizontalLayout.addWidget(self.contributeButton)
|
||||
spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
||||
self.horizontalLayout.addItem(spacerItem)
|
||||
self.cancelButton = QPushButton(self)
|
||||
sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.cancelButton.sizePolicy().hasHeightForWidth())
|
||||
self.cancelButton.setSizePolicy(sizePolicy)
|
||||
self.cancelButton.setText(tr("Cancel"))
|
||||
self.cancelButton.setAutoDefault(False)
|
||||
self.horizontalLayout.addWidget(self.cancelButton)
|
||||
self.submitButton = QPushButton(self)
|
||||
sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.submitButton.sizePolicy().hasHeightForWidth())
|
||||
self.submitButton.setSizePolicy(sizePolicy)
|
||||
self.submitButton.setText(tr("Submit"))
|
||||
self.submitButton.setAutoDefault(False)
|
||||
self.submitButton.setDefault(True)
|
||||
self.horizontalLayout.addWidget(self.submitButton)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout)
|
||||
|
||||
#--- Events
|
||||
def contributeClicked(self):
|
||||
self.reg.app.contribute()
|
||||
|
||||
def submitClicked(self):
|
||||
code = self.codeEdit.text()
|
||||
email = self.emailEdit.text()
|
||||
if self.reg.app.set_registration(code, email, False):
|
||||
self.accept()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = QApplication([])
|
||||
validate = lambda *args: True
|
||||
dialog = RegSubmitDialog(None, validate)
|
||||
dialog.show()
|
||||
sys.exit(app.exec_())
|
||||
Reference in New Issue
Block a user