[Solved] Gateway desktop background notice message is god-awful

[quote=“Patrick, post:12, topic:196”]Nice! I would like to change the logic a bit.

Check if ~/.whonix folder exists, if not create it.

Check if ~/.whonix/gateway_first_use_notice_done exists (or a better file name for such a status file).

If status file does not not -> show popup.

If uses checks the “do not show again” box -> create ~/.whonix/gateway_first_use_notice.

If status file exists -> do nothing -> exit.[/quote]

Yes, there was no logic, the script was only for test. The following is more “whonixlike”.

#!/usr/bin/python
# -*- coding: utf-8 -*-

import sys
from PyQt4 import QtGui, QtCore
from subprocess import call


folder_return_code = call("ls ~/.whonix", shell=True)
if folder_return_code == 0:
    file_return_code = call("cat ~/.whonix/first_use_check.done", shell=True)
    if file_return_code == 0:
        sys.exit()
else:
    call("mkdir ~/.whonix", shell=True)


class Notice(QtGui.QDialog):

    def __init__(self):

        super(Notice, self).__init__()

        self.initUI()

    def initUI(self):

        cb = QtGui.QCheckBox('Do not show this message again', self)
        cb.move(25, 230)
        cb.stateChanged.connect(self.checkState)

        OKbtn = QtGui.QPushButton('OK', self)
        OKbtn.clicked.connect(QtCore.QCoreApplication.instance().quit)
        OKbtn.resize(OKbtn.sizeHint())
        OKbtn.move(265, 260)

        lb = QtGui.QLabel(
"""
The previous text is now obsolete. You can type lines of any length, it results as one paragraph per line. For example, you could write the story of you life in a single line (if you had a simple life).

Just enter a blank line

to separate the paragraphs.

Work in progress to automatically adjust the size of the window and the size of the text label depending on the text size.
$
23456

""", self)
        lb.setGeometry(0, 0, 550, 190)  # window vsize -110.
        lb.setWordWrap(True)
        lb.move(25, 20)

        self.resize(600, 300)
        #self.center()
        self.setWindowTitle('First use notice')
        self.show()

    def checkState(self, state):

        if (str(state)) == "2":
            f = open("/home/user/.whonix/first_use_check.done", "w")  # IOError if "~/.whonix"
            f.close()
        elif (str(state)) == "0":
            call("rm ~/.whonix/first_use_check.done", shell=True)

    def center(self):

        self.resize(False)
        qr = self.frameGeometry()
        cp = QtGui.QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())


def main():

    app = QtGui.QApplication(sys.argv)
    ex = Notice()
    sys.exit(app.exec_())

if __name__ == '__main__':
    main()

I’ll start again with the packaging, but I think it would be nice to try replacing the popups for whonixcheck and timesync too.