Virgil Dupras avatar Virgil Dupras committed 3b17b47

Added a "withreg" arg to AboutBox().

When set to True, the about box doesn't have registration-related elements.

Comments (0)

Files changed (1)

 tr = trget('qtlib')
 
 class AboutBox(QDialog):
-    def __init__(self, parent, app):
+    def __init__(self, parent, app, withreg=True):
         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)
-        self.buttonBox.clicked.connect(self.buttonClicked)
+        if self.withreg:
+            self.buttonBox.clicked.connect(self.buttonClicked)
     
     def _setupUi(self):
         self.setWindowTitle(tr("About {}").format(QCoreApplication.instance().applicationName()))
         self.label.setFont(font)
         self.verticalLayout.addWidget(self.label)
         self.registeredEmailLabel = QLabel(self)
-        self.registeredEmailLabel.setText(tr("UNREGISTERED"))
+        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)
-        self.registerButton = self.buttonBox.addButton(tr("Register"), QDialogButtonBox.ActionRole)
+        if self.withreg:
+            self.registerButton = self.buttonBox.addButton(tr("Register"), QDialogButtonBox.ActionRole)
         self.verticalLayout.addWidget(self.buttonBox)
         self.horizontalLayout.addLayout(self.verticalLayout)
     
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.