Esempio n. 1
0
import numpy as np
from numpy import pi, log10
import scipy.signal as sig

import pyfda.filterbroker as fb  # importing filterbroker initializes all its globals
import pyfda.filter_factory as ff  # importing filterbroker initializes all its globals
from pyfda.libs.pyfda_lib import lin2unit, mod_version, to_html, safe_eval
from pyfda.input_widgets.input_info_about import AboutWindow
from pyfda.pyfda_rc import params

import logging
logger = logging.getLogger(__name__)

# TODO: Passband and stopband info should show min / max values for each band

if mod_version('docutils') is not None:
    from docutils.core import publish_string
    HAS_DOCUTILS = True
else:
    HAS_DOCUTILS = False

classes = {'Input_Info': 'Info'}  #: Dict containing class name : display name


# ------------------------------------------------------------------------------
class Input_Info(QWidget):
    """
    Create widget for displaying infos about filter specs and filter design method
    """
    sig_rx = pyqtSignal(object)  # incoming signals from input_tab_widgets
    sig_tx = pyqtSignal(object)
Esempio n. 2
0
    def collect_info(self):
        """
        Collect information about version, imported modules in strings:

        `self.info_str` : General info, copyright, version, link to readthedocs
                          This info is always visible.

        `self.about_str`: OS, user name, directories, versions of installed software
        """


        self.info_str = ("<b><a href=https://www.github.com/chipmuenk/pyfda>pyfda</a> "
        "Version {0} (c) 2013 - 2020 Christian Münker</b><br />"
        "Design, analyze and synthesize digital filters. Docs @ "
        "<a href=https://pyfda.rtfd.org>pyfda.rtfd.org</a>"
        " (<a href=https://media.readthedocs.org/pdf/pyfda/latest/pyfda.pdf>pdf</a>)<br />"\
        .format(version.__version__))

        # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

        user_dirs_str = ""
        if dirs.USER_DIRS:
            for d in dirs.USER_DIRS:
                user_dirs_str += d + '<br />'
        else:
            user_dirs_str = "None<br />"

        # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

        os_str = ("<b>OS:</b> {0} {1}<br><b>User Name:</b> {2}".format(
            dirs.OS, dirs.OS_VER, dirs.USER_NAME))

        # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

        dirs_md = ("### Directories ###\n"
                      "| *Function*    | *Path*|\n"#"|  <!-- -->     |  <!-- -->  |\n"
                      "|:  ----        |:  ----     |\n"
                      "| **Install Dir **  | `{install_dir}` |\n"
                      "| **User Module Dir ** | `{user_dir}` |\n"
                      "| **Home Dir**  |   `{home_dir}` |\n"
                      "| **Temp Dir ** | `{temp_dir}` |\n"
                      "| **Config Dir ** | `{conf_dir}` |\n"
                      "| - - - - - - -  | - - - - - - - - -|\n"
                      "| **pyFDA Config ** | `{pyfda_conf}` |\n"
                      "| **Log. Config ** | `{log_conf}` |\n"
                      "| **Logfile **  | `{log_file}` |"\
                      .format(home_dir=dirs.HOME_DIR, install_dir=dirs.INSTALL_DIR,
                              conf_dir=dirs.CONF_DIR, user_dir=user_dirs_str[:-6],
                              temp_dir=dirs.TEMP_DIR, pyfda_conf=dirs.USER_CONF_DIR_FILE,
                              log_conf=dirs.USER_LOG_CONF_DIR_FILE, log_file=dirs.LOG_DIR_FILE))

        dirs_str = markdown.markdown(dirs_md,
                                     output_format='html5',
                                     extensions=['tables'])

        # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

        ver_str = pyfda_lib.mod_version()
        # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

        if False:  #dirs.PYINSTALLER:
            self.lic_str = ""
        else:
            with open(os.path.join(dirs.INSTALL_DIR, "license_info.md"),
                      'r') as f:
                self.lic_str = markdown.markdown(f.read(),
                                                 output_format='html5',
                                                 extensions=['tables'])

        self.about_str = os_str + dirs_str + ver_str
Esempio n. 3
0
    def about_window(self):
        """
        Display an "About" window with copyright and version infos
        """
        def to_clipboard(my_string):
            """
            Copy version info to clipboard
            """
            mapping = [
                ('<br>', '\n'),
                ('<br />', '\n'),
                ('</tr>', '\n'),
                ('</th>', '\n==============\n'),
                ('</table>', '\n'),
                ('<hr>', '\n---------\n'),
                ('<b>', ''),
                ('</b>', ''),
                ('<tr>', ''),
                ('<td>', ''),
                ('</td>', '\t'),
                ('<th>', ''),
                ('&emsp;', ' '),
                ('<table>', ''),  # ('</a>',''),
                ("<th style='font-size:large;'>", "\n")
            ]
            for k, v in mapping:
                my_string = my_string.replace(k, v)
            fb.clipboard.setText(my_string)

        user_dirs_str = ""
        if dirs.USER_DIRS:
            for d in dirs.USER_DIRS:
                user_dirs_str += d + '<br />'

        info_string = ("<b><a href=https://www.github.com/chipmuenk/pyfda>pyfda</a> "
        "Version {0} (c) 2013 - 2020 Christian Münker</b><br />"
        "Design, analyze and synthesize digital filters. Docs @ "
        "<a href=https://pyfda.rtfd.org>pyfda.rtfd.org</a>"
        " (<a href=https://media.readthedocs.org/pdf/pyfda/latest/pyfda.pdf>pdf</a>)<hr>"\
        .format(version.__version__))

        versions_string = (
            "<b>OS:</b> {0} {1}<br><b>User Name:</b> {2}<br>".format(
                dirs.OS, dirs.OS_VER, dirs.USER_NAME))

        #         dir_string = ("<table><th style='font-size:large;'>Imported Modules</th>"
        #                           "<tr><td>&nbsp;&emsp;{0}</td></tr>"\
        #                           .format( pyfda_lib.mod_version().replace("\n", "<br>&nbsp;&emsp;")))

        dir_string = (
            "<table><th style='font-size:large;'>Software Versions</th>")
        dir_string += pyfda_lib.mod_version()
        dir_string += "</table>"

        dir_string += ("<table><th style='font-size:large;'>Directories</th>"
                        "<tr><td><b>Home:</b></td><td>{0}</td></tr>"
                        "<tr><td><b>Install:&emsp;</b></td><td>{1}</td></tr>"
                         "<tr><td><b>Config:&emsp;</b></td><td>{2}</td></tr>"
                         "<tr><td><b>User:&emsp;</b></td><td>{3}</td></tr>"
                         "<tr><td><b>Temp:</b></td><td>{4}</td></tr>"\
                        .format( dirs.HOME_DIR, dirs.INSTALL_DIR, dirs.CONF_DIR,
                                user_dirs_str[:-6], dirs.TEMP_DIR))
        dir_string += ("<th style='font-size:large;'>Logging Files</th>"
                        "<tr><td><b>Config:</b></td><td>{0}</td></tr>"
                        "<tr><td><b>Output:&emsp;</b></td><td>{1}</td></tr>"
                        "</table>"\
                       .format(dirs.USER_LOG_CONF_DIR_FILE, dirs.LOG_DIR_FILE))

        about_string = info_string + versions_string + dir_string

        #msg = QMessageBox.about(self, "About pyFDA", info_string)
        butClipboard = QPushButton(self)
        butClipboard.setIcon(QIcon(':/clipboard.svg'))
        butClipboard.setToolTip("Copy text to clipboard.")
        # butClipboard.adjustSize()
        # butClipboard.setFixedSize(self.checkLayout.sizeHint())
        msg = QMessageBox(self)
        msg.setIconPixmap(
            QPixmap(':/pyfda_icon.svg').scaledToHeight(
                32, Qt.SmoothTransformation))
        msg.addButton(butClipboard, QMessageBox.ActionRole)
        msg.setText(about_string)
        # msg.setInformativeText("This is additional information")
        #msg.setDetailedText(versions_string) # adds a button that opens another textwindow

        msg.setWindowTitle("About pyFDA")
        msg.setStandardButtons(QMessageBox.Ok)  # | QMessageBox.Cancel
        # close Message box with close event triggered by "x" icon
        msg.closeEvent = self.closeEvent

        butClipboard.clicked.connect(lambda: to_clipboard(about_string))

        retval = msg.exec_()
Esempio n. 4
0
import pyfda.filterbroker as fb
from pyfda.pyfda_rc import params
from pyfda.libs.pyfda_lib import H_mag, mod_version, safe_eval, to_html
from pyfda.libs.pyfda_qt_lib import qget_cmb_box, PushButton
from pyfda.plot_widgets.mpl_widget import MplWidget

from matplotlib import cm  # Colormap
from matplotlib.pyplot import colormaps
from matplotlib.colors import LightSource

import logging
logger = logging.getLogger(__name__)

classes = {'Plot_3D': '3D'}  #: Dict containing class name : display name

if mod_version('mayavi'):
    from mayavi import mlab
    MLAB = True
else:
    MLAB = False

if mod_version('vispy'):
    from vispy import plot  # (?)
    HAS_VISPY = True
else:
    HAS_VISPY = False


class Plot_3D(QWidget):
    """
    Class for various 3D-plots:
Esempio n. 5
0
import pyfda.libs.pyfda_lib as pyfda_lib
import pyfda.libs.pyfda_dirs as dirs
import pyfda.filterbroker as fb
from pyfda.pyfda_rc import params
from pyfda.libs.pyfda_io_lib import extract_file_ext

from pyfda import qrc_resources  # contains all icons

import numpy as np

try:
    import cPickle as pickle
except:
    import pickle

if pyfda_lib.mod_version('xlwt') == None:
    XLWT = False
else:
    XLWT = True
    import xlwt

if pyfda_lib.mod_version('xlsxwriter') == None:
    XLSX = False
else:
    XLSX = True
    import xlsxwriter as xlsx

#try:
#    import xlrd
#except ImportError:
#    XLRD = False