Beispiel #1
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        bld = LayoutBuilder(self)
        with bld.vbox() as layout:
            layout.addWidget(
                QtWidgets.QLabel(
                    _('Done. You can now unplug the Dualshock from this PC.'),
                    self))
            layout.addWidget(
                QtWidgets.QLabel(
                    _('To use it, first plug the Pi to the PS4 as shown here:'
                      ), self))

            img = QtWidgets.QLabel(self)
            img.setPixmap(QtGui.QPixmap(':images/rpi_ps4.jpg'))
            img.setAlignment(QtCore.Qt.AlignCenter | QtCore.Qt.AlignHCenter)
            layout.addWidget(img)

            layout.addWidget(
                QtWidgets.QLabel(
                    _('As shown in the photo, the RPi will be powered by the PS4. Beware of the port.'
                      ), self))
            layout.addWidget(
                QtWidgets.QLabel(
                    _('Then upload a configuration, power on the PS4 and press the PS button.'
                      ), self))
Beispiel #2
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        btnTry = QtWidgets.QPushButton(_('Try to detect avrdude again'), self)
        btnBrowse = QtWidgets.QPushButton(_('Browse'), self)

        if platform.system() == 'Darwin':
            install = QtWidgets.QLabel(
                _('You can install <b>avrdude</b> on mac OS using <a href="https://brew.sh">Homebrew</a>. After installing brew, launch a terminal and type<br /><pre>brew install avrdude</pre>'
                  ), self)
        elif platform.system() == 'Linux':
            install = QtWidgets.QLabel(
                _('You can install <b>avrdude</b> on Linux using your regular package manager, for instance<br /><pre>apt-get install avrdude</pre>'
                  ), self)
        elif platform.system() == 'Windows':
            install = QtWidgets.QLabel(
                _('You can install <b>avrdude</b> on Windows using <a href="https://sourceforge.net/projects/winavr/">WinAVR</a>'
                  ), self)
        else:
            raise RuntimeError('Unsupported platform')
        install.setOpenExternalLinks(True)

        bld = LayoutBuilder(self)
        with bld.vbox() as layout:
            layout.addWidget(btnTry)
            layout.addWidget(btnBrowse)
            layout.addWidget(install)
            layout.addStretch(1)

        btnTry.clicked.connect(self._tryAgain)
        btnBrowse.clicked.connect(self._browse)

        self._state = self.STATE_INIT
Beispiel #3
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        bld = LayoutBuilder(self)
        with bld.vbox() as layout:
            msg = QtWidgets.QLabel(
                _('Please enter the credentials for your Wifi network.\nThe Raspberry Pi will automatically connect to this network.\nIf left empty, you will have to configure it yourself after creating the SD card.'
                  ), self)
            layout.addWidget(msg)

            with bld.form() as form:
                self._ssid = QtWidgets.QLineEdit(self)
                self._pwd1 = QtWidgets.QLineEdit(self)
                self._pwd2 = QtWidgets.QLineEdit(self)
                for pwd in (self._pwd1, self._pwd2):
                    pwd.setEchoMode(pwd.Password)
                self._ssh = QtWidgets.QCheckBox(_('Enable SSH'), self)

                form.addRow(_('SSID'), self._ssid)
                form.addRow(_('Password'), self._pwd1)
                form.addRow(_('Confirm password'), self._pwd2)
                form.addRow(self._ssh)

                for widget in (self._ssid, self._pwd1, self._pwd2):
                    widget.textChanged.connect(self._checkComplete)

            layout.addStretch(1)
Beispiel #4
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        bld = LayoutBuilder(self)
        with bld.vbox() as layout:
            img = QtWidgets.QLabel(self)
            img.setPixmap(QtGui.QPixmap(':images/leonardo_reset.jpg'))
            img.setAlignment(QtCore.Qt.AlignCenter | QtCore.Qt.AlignHCenter)
            layout.addWidget(img)
Beispiel #5
0
    def __init__(self, *args, enumerator, **kwargs):
        super().__init__(*args, **kwargs)
        self._enumerator = enumerator

        bld = LayoutBuilder(self)
        with bld.vbox() as layout:
            img = QtWidgets.QLabel(self)
            img.setPixmap(QtGui.QPixmap(':images/dualshock_pc.jpg'))
            img.setAlignment(QtCore.Qt.AlignCenter | QtCore.Qt.AlignHCenter)
            layout.addWidget(img)
Beispiel #6
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._timer = QtCore.QTimer(self)
        self._timer.timeout.connect(self._tick)

        self._msg = QtWidgets.QLabel(self)
        self._msg.setWordWrap(True)
        bld = LayoutBuilder(self)
        with bld.vbox() as layout:
            layout.addWidget(self._msg)
Beispiel #7
0
    def __init__(self, *args, action, **kwargs):
        self._action = action
        super().__init__(*args, **kwargs)

        self._sci = Qsci.QsciScintilla(self)
        self._sci.setUtf8(True)
        self._sci.setEolMode(self._sci.EolUnix)
        self._sci.setIndentationsUseTabs(True)
        self._sci.setIndentationGuides(True)
        self._sci.setCaretLineVisible(True)
        self._sci.setMargins(1)
        self._sci.setMarginType(0, self._sci.NumberMargin)
        self._sci.setMarginWidth(0, '000')
        self._sci.setLexer(Qsci.QsciLexerCPP(self._sci))
        self._sci.setText(self._action.source())

        self._report = QtWidgets.QTreeWidget(self)
        self._report.setColumnCount(2)
        self._report.setHeaderHidden(True)
        self._report.itemClicked.connect(self._reportClicked)

        self._errorMarker = self._sci.markerDefine(self._sci.Background)
        self._sci.setMarkerBackgroundColor(QtCore.Qt.red, self._errorMarker)
        self._warningMarker = self._sci.markerDefine(self._sci.Background)
        self._sci.setMarkerBackgroundColor(QtCore.Qt.yellow, self._warningMarker)

        btnOK = QtWidgets.QPushButton(_('Done'), self)
        btnCancel = QtWidgets.QPushButton(_('Cancel'), self)

        bld = LayoutBuilder(self)
        with bld.vbox() as vbox:
            vbox.addWidget(self._sci, stretch=5)
            vbox.addWidget(self._report, stretch=1)
            with bld.hbox() as buttons:
                buttons.addStretch(1)
                buttons.addWidget(btnCancel)
                buttons.addWidget(btnOK)

        btnOK.clicked.connect(self.accept)
        btnCancel.clicked.connect(self.reject)

        with Settings().grouped('IDE') as settings:
            if settings.contains('WindowGeometry'):
                self.restoreGeometry(settings.value('WindowGeometry'))
            else:
                self.resize(1024, 768)

        self._timer = QtCore.QTimer(self)
        self._timer.timeout.connect(self._tryCompile)
        self._timer.setSingleShot(True)
        self._sci.textChanged.connect(self._onTextChanged)
        self._tryCompile()
Beispiel #8
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self._finished = False
        self._thread = None

        bld = LayoutBuilder(self)
        with bld.vbox() as layout:
            layout.addStretch(1)
            self._progress = QtWidgets.QProgressBar(self)
            layout.addWidget(self._progress)
            layout.addStretch(1)

        self.setCommitPage(True)
Beispiel #9
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self._nextId = -1

        bld = LayoutBuilder(self)
        with bld.vbox() as layout:
            layout.addStretch(1)
            self._addButton(layout, _('Arduino Leonardo'),
                            PageId.ArduinoAvrdude, True)
            self._addButton(layout, _('Raspberry Pi Zero W'),
                            PageId.PiZeroWifi)
            self._addButton(layout, _('Do that later'),
                            PageId.DeviceNotConfigured)
            layout.addStretch(1)
Beispiel #10
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._name = QtWidgets.QLabel(self)
        self._error = ErrorMessage(self)
        self._btn = QtWidgets.QPushButton(_('Edit'), self)

        bld = LayoutBuilder(self)
        with bld.vbox() as vbox:
            with bld.hbox() as hbox:
                hbox.addWidget(self._name, stretch=1)
                hbox.addWidget(self._btn)
            vbox.addWidget(self._error)

        self._btn.clicked.connect(self._editCode)
        self.reload()
Beispiel #11
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        bld = LayoutBuilder(self)
        with bld.vbox() as layout:
            layout.addStretch(1)
            msg = QtWidgets.QLabel(
                _('''
<p>The image file has been copied to your Downloads folder.</p>
<p>You can now use the <a href="https://www.raspberrypi.org/software/">Raspberry Pi Imager</a> to create the SD card for your Raspberry Pi Zero W, using the Custom image option.</p>
<p>Once you are done, insert the SD card in your Pi and power it on.</p>
<p>The first boot may take some time; wait until the device appears in the Device menu and then proceed with the pairing option.</p>
'''), self)  # pylint: disable=C0301
            msg.setWordWrap(True)
            msg.setTextFormat(QtCore.Qt.RichText)
            msg.setOpenExternalLinks(True)
            layout.addWidget(msg)
            layout.addStretch(1)
Beispiel #12
0
    def __init__(self, parent, *, path, **kwargs):
        super().__init__(parent, **kwargs)
        self._path = path
        self._state = self.STATE_MANIFEST
        self._manifest = Meta.manifest()
        self._downloader = None

        self._msg = QtWidgets.QLabel(self)
        self._progress = QtWidgets.QProgressBar(self)

        bld = LayoutBuilder(self)
        with bld.vbox() as vbox:
            vbox.setContentsMargins(5, 5, 5, 5)
            vbox.addWidget(self._msg)
            vbox.addWidget(self._progress)
            with bld.hbox() as hbox:
                self._btn = QtWidgets.QPushButton(_('Cancel'), self)
                hbox.addStretch(1)
                hbox.addWidget(self._btn)

        self._btn.clicked.connect(self._cancel)
Beispiel #13
0
    def __init__(self, parent, changelog):
        super().__init__(parent)

        self.setWindowTitle(_('New release available'))

        view = QtWidgets.QTextBrowser(self)
        view.setHtml(HTMLChangelogFormatter().format(
            changelog.changesSince(Meta.appVersion())))
        view.setOpenExternalLinks(True)

        btn = QtWidgets.QPushButton(_('OK'), self)
        btn.clicked.connect(self.accept)

        bld = LayoutBuilder(self)
        with bld.vbox() as vbox:
            vbox.addWidget(view)
            with bld.hbox() as hbox:
                hbox.addStretch(1)
                hbox.addWidget(btn)

        self.resize(640, 480)
Beispiel #14
0
 def doLayout(self, fmt, **kwargs):
     bld = LayoutBuilder(self)
     with bld.hbox() as layout:
         text = io.StringIO()
         state = 0
         for char in fmt:
             if state == 0:
                 if char == '{':
                     if text.tell():
                         label = QtWidgets.QLabel(text.getvalue())
                         layout.addWidget(label)
                     name = io.StringIO()
                     state = 1
                 else:
                     text.write(char)
             elif state == 1:
                 if char == '}':
                     name = name.getvalue()
                     layout.addWidget(kwargs.pop(name))
                     text = io.StringIO()
                     state = 0
                 else:
                     name.write(char)
         layout.addStretch(1)
Beispiel #15
0
    def __init__(self):
        super().__init__()
        self.setWindowTitle(_('Password needed'))

        self._pwd = QtWidgets.QLineEdit(self)
        self._pwd.setEchoMode(self._pwd.Password)

        bld = LayoutBuilder(self)
        with bld.vbox() as vbox:
            vbox.setContentsMargins(5, 5, 5, 5)
            vbox.addWidget(
                QtWidgets.QLabel(
                    _('You need to enter your password to setup groups and udev rules.'
                      ), self))
            vbox.addWidget(self._pwd)
            with bld.hbox() as hbox:
                hbox.addStretch(1)
                btn = QtWidgets.QPushButton(_('Cancel'), self)
                btn.clicked.connect(self.reject)
                hbox.addWidget(btn)
                btn = QtWidgets.QPushButton(_('OK'), self)
                btn.clicked.connect(self.accept)
                btn.setDefault(True)
                hbox.addWidget(btn)
Beispiel #16
-1
    def __init__(self, parent):
        super().__init__(parent)

        self.setWindowTitle(
            _('{appname} v{appversion}').format(appname=Meta.appName(),
                                                appversion=str(
                                                    Meta.appVersion())))

        iodev = QtCore.QFile(':/about.html')
        iodev.open(iodev.ReadOnly)
        try:
            about = bytes(iodev.readAll()).decode('utf-8')
        finally:
            iodev.close()
        about = about.format(author=Meta.appAuthor())

        text = QtWidgets.QTextBrowser(self)
        text.setHtml(about)
        text.setOpenExternalLinks(True)

        btn = QtWidgets.QPushButton(_('Done'), self)

        bld = LayoutBuilder(self)
        with bld.vbox() as vbox:
            vbox.addWidget(text)
            with bld.hbox() as buttons:
                buttons.addStretch(1)
                buttons.addWidget(btn)

        btn.clicked.connect(self.accept)

        self.resize(800, 600)