예제 #1
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.setFixedSize(QtCore.QSize(600, 400))
     w = QtGui.QWidget()
     self.setCentralWidget(w)
     vlayout = QtGui.QVBoxLayout()
     w.setLayout(vlayout)
     self.htmlView = QtWidgets.QTextBrowser(self)
     font = QtGui.QFont()
     font.setFamily('Arial')
     self.htmlView.setReadOnly(True)
     self.htmlView.setFont(font)
     self.htmlView.setOpenExternalLinks(True)
     self.htmlView.setObjectName('Help information')
     html_help_path = get_source_name('docs/help.html')
     ret = self.htmlView.setSource(QtCore.QUrl(html_help_path))
     print('load result:', ret)
     #         self.htmlView.append(ret)
     vlayout.addWidget(self.htmlView)
예제 #2
0
 def openUrl_help(self):
     url = QtCore.QUrl('https://github.com/fredvol/paralogger')
     if not QtGui.QDesktopServices.openUrl(url):
         QtGui.QMessageBox.warning(self, 'Open Url', 'Could not open url')
예제 #3
0
    def initUI(self):
        """
        This method instantiates every widget and arranges them all inside the main window. This is where the
        puzzle pieces are assembled.
        """
        # General window properties
        # self.setWindowTitle('MuControl v1.0.3')
        self.resize(1280, 720)  # Non- maximized size
        self.setWindowState(QtCore.Qt.WindowMaximized)

        # Make menu bar at the top of the window
        mainMenu = self.menuBar()
        # mainMenu.setStyleSheet("""QMenuBar { background-color: #F0F0F0; }""")  # Makes the menu bar grey-ish
        fileMenu = mainMenu.addMenu('File')  # Adds the file button
        helpMenu = mainMenu.addMenu('Help')

        # Settings button
        settingsButton = QtGui.QAction("&Settings", self)
        settingsButton.setShortcut('Ctrl+Alt+S')
        settingsButton.triggered.connect(
            self.config.show
        )  # when the settings button is clicked, window is shown
        fileMenu.addAction(
            settingsButton)  # Adds the settings button to the file menu

        # Exit Button
        exitButton = QtWidgets.QAction('Exit', self)
        exitButton.setShortcut('Ctrl+Q')
        exitButton.triggered.connect(self.close)
        fileMenu.addAction(exitButton)

        # User Guide button in help menu
        userguideButton = QtGui.QAction("Open User Guide", self)
        userguideButton.setShortcut('Ctrl+H')
        userguideButton.triggered.connect(
            lambda: QtGui.QDesktopServices.openUrl(
                QtCore.QUrl(
                    "https://czimm79.github.io/mucontrol-userguide/index.html")
            ))
        helpMenu.addAction(userguideButton)

        # Create an empty box to hold all the following widgets
        self.mainbox = QtGui.QWidget()
        self.setCentralWidget(
            self.mainbox)  # Put it in the center of the main window
        layout = QtWidgets.QGridLayout(
        )  # All the widgets will be in a grid in the main box
        self.mainbox.setLayout(layout)  # set the layout

        # Instantiate the plots from plots.py
        self.p1 = SignalPlot()
        self.p1.setYRange(-self.config.defaults['vmulti'],
                          self.config.defaults['vmulti'])
        self.p2 = ThreeDPlot(
            funcg_rate=self.config.funcg_rate,
            writechunksize=self.config.writechunksize,
            vmulti=self.config.defaults['vmulti'],
            freq=self.config.defaults['freq'],
            camber=self.config.defaults['camber'],
            zphase=self.config.defaults['zphase'],
        )
        self.p2.setSizePolicy(
            self.p1.sizePolicy())  # 2D plot size = 3D plot size

        # Create control descriptions
        self.keyboardlbl = QtWidgets.QLabel('<h3> Keyboard Controls </h3>\
            <span style="font-size: 10pt;">To enable keyboard controls, left click once anywhere on the signal plot. </span> \
            <p> <strong> Toggle Output:  </strong> T; <strong> +Voltage Multiplier: </strong> W; <strong> -Voltage Multiplier: </strong> Q </p> \
            <p> <strong> +Frequency: </strong> G, <strong> -Frequency: </strong> F; <strong> +Camber: </strong> B; \
            <strong> -Camber: </strong> V </p>')
        self.gamepadlbl = QtWidgets.QLabel('<h3> Gamepad Controls </h3>\
            <span style="font-size: 10pt;">To enable gamepad controls, plug in the controller before starting the program. </span> \
            <p> <strong> Toggle Output:  </strong> Left Thumb Click; <strong> +Voltage Multiplier: </strong> RB; <strong> -Voltage Multiplier: </strong> LB </p> \
            <p> <strong> +Frequency: </strong> Y, <strong> -Frequency: </strong> X; <strong> +Camber: </strong> B; \
            <strong> -Camber: </strong> A </p>')
        # self.keyboardlbl.setFont(QtGui.QFont("Default", 11))  # Optionally, change font size
        # self.gamepadlbl.setFont(QtGui.QFont("Default", 11))

        # Create plot labels
        self.p1lbl = QtWidgets.QLabel('<b><u>Live Signal Plot</u></b>')
        self.p2lbl = QtWidgets.QLabel(
            '<b><u>Parametrized Output Visualization</u></b>')

        # Parameter Tree widget
        self.t = MyParamTree(self.config)  # From ParameterTree.py
        self.t.paramChange.connect(
            self.change
        )  # Connect the output signal from changes in the param tree to change

        # Add widgets to the layout in their proper positions
        layout.addWidget(self.p1lbl, 0, 0)
        layout.addWidget(self.p2lbl, 0, 1)
        layout.addWidget(self.t, 3, 0, 1, 2)  # row, col, rowspan, colspan
        layout.addWidget(self.p1, 1, 0)
        layout.addWidget(self.keyboardlbl, 2, 0, 1, 3)
        layout.addWidget(self.gamepadlbl, 2, 1, 1, 3)
        layout.addWidget(self.p2, 1, 1)
예제 #4
0
 def view_github(self):
     QtGui.QDesktopServices.openUrl(QtCore.QUrl("https://github.com/pyControl/pyControl"))
예제 #5
0
 def view_forum(self):
     QtGui.QDesktopServices.openUrl(QtCore.QUrl("https://groups.google.com/forum/#!forum/pycontrol"))
예제 #6
0
 def view_docs(self):
     QtGui.QDesktopServices.openUrl(QtCore.QUrl("https://pycontrol.readthedocs.io/en/latest/"))