예제 #1
0
def test_install_primitives(install_path):
    installation_dir = get_installation_dir()
    custom_max_file = os.path.join(installation_dir, "custom_max.py")
    custom_mean_file = os.path.join(installation_dir, "custom_mean.py")
    custom_sum_file = os.path.join(installation_dir, "custom_sum.py")

    # make sure primitive files aren't there e.g from a failed run
    for p in [custom_max_file, custom_mean_file, custom_sum_file]:
        try:
            os.unlink(p)
        except Exception:
            pass

    # handle install via command line as a special case
    if install_path == "INSTALL_VIA_CLI":
        subprocess.check_output(['featuretools', 'install', '--no-prompt', primitives_to_install_dir(this_dir())])
    elif install_path == "INSTALL_VIA_MODULE":
        subprocess.check_output(['python', '-m', 'featuretools', 'install', '--no-prompt', primitives_to_install_dir(this_dir())])
    else:
        featuretools.primitives.install.install_primitives(install_path, prompt=False)

    # must reload submodule for it to work
    reload(featuretools.primitives.installed)
    from featuretools.primitives.installed import CustomMax, CustomSum, CustomMean  # noqa: F401

    files = list_primitive_files(installation_dir)
    assert set(files) == {custom_max_file, custom_mean_file, custom_sum_file}

    files = list_primitive_files(installation_dir)
    # then delete to clean up
    for f in files:
        os.unlink(f)
예제 #2
0
def reload(module, debug=False, lists=False, dicts=False):
    """Replacement for the builtin reload function:
    - Reloads the module as usual
    - Updates all old functions and class methods to use the new code
    - Updates all instances of each modified class to use the new class
    - Can update lists and dicts, but this is disabled by default
    - Requires that class and function names have not changed
    """
    if debug:
        print("Reloading %s" % str(module))

    ## make a copy of the old module dictionary, reload, then grab the new module dictionary for comparison
    oldDict = module.__dict__.copy()
    builtins.reload(module)
    newDict = module.__dict__

    ## Allow modules access to the old dictionary after they reload
    if hasattr(module, '__reload__'):
        module.__reload__(oldDict)

    ## compare old and new elements from each dict; update where appropriate
    for k in oldDict:
        old = oldDict[k]
        new = newDict.get(k, None)
        if old is new or new is None:
            continue

        if inspect.isclass(old):
            if debug:
                print("  Updating class %s.%s (0x%x -> 0x%x)" %
                      (module.__name__, k, id(old), id(new)))
            updateClass(old, new, debug)

        elif inspect.isfunction(old):
            depth = updateFunction(old, new, debug)
            if debug:
                extra = ""
                if depth > 0:
                    extra = " (and %d previous versions)" % depth
                print("  Updating function %s.%s%s" %
                      (module.__name__, k, extra))
        elif lists and isinstance(old, list):
            l = old.len()
            old.extend(new)
            for i in range(l):
                old.pop(0)
        elif dicts and isinstance(old, dict):
            old.update(new)
            for k in old:
                if k not in new:
                    del old[k]
예제 #3
0
    def __init__(self, parent=None):
        try:
            importlib.reload(PCBconf)
        except:
            builtins.reload(PCBconf)

        QtGui.QWidget.__init__(self, parent)
        freecadSettings = FreeCAD.ParamGet(
            "User parameter:BaseApp/Preferences/Mod/PCB")

        self.form = self
        self.form.setWindowTitle(u"Create PCB")
        self.form.setWindowIcon(QtGui.QIcon(":/data/img/board.png"))
        #
        self.gruboscPlytki = QtGui.QDoubleSpinBox(self)
        self.gruboscPlytki.setSingleStep(0.1)
        self.gruboscPlytki.setValue(
            freecadSettings.GetFloat("boardThickness", 1.5))
        self.gruboscPlytki.setSuffix(u" mm")
        #
        self.pcbBorder = QtGui.QLineEdit('')
        self.pcbBorder.setReadOnly(True)

        pickPcbBorder = pickSketch(self.pcbBorder)
        #
        self.pcbHoles = QtGui.QLineEdit('')
        self.pcbHoles.setReadOnly(True)

        pickPcbHoles = pickSketch(self.pcbHoles)
        #
        self.pcbColor = kolorWarstwy()
        self.pcbColor.setColor(self.pcbColor.PcbColorToRGB(PCBconf.PCB_COLOR))
        self.pcbColor.setToolTip(u"Click to change color")
        #
        lay = QtGui.QGridLayout()
        lay.addWidget(QtGui.QLabel(u'Border:'), 0, 0, 1, 1)
        lay.addWidget(self.pcbBorder, 0, 1, 1, 1)
        lay.addWidget(pickPcbBorder, 0, 2, 1, 1)
        lay.addWidget(QtGui.QLabel(u'Holes:'), 1, 0, 1, 1)
        lay.addWidget(self.pcbHoles, 1, 1, 1, 1)
        lay.addWidget(pickPcbHoles, 1, 2, 1, 1)
        lay.addWidget(QtGui.QLabel(u'Thickness:'), 2, 0, 1, 1)
        lay.addWidget(self.gruboscPlytki, 2, 1, 1, 2)
        lay.addWidget(QtGui.QLabel(u'Color:'), 3, 0, 1, 1)
        lay.addWidget(self.pcbColor, 3, 1, 1, 2)
        #
        self.setLayout(lay)
def test_install_primitives(install_path, primitives_to_install_dir):
    installation_dir = get_installation_dir()
    data_dir = featuretools.config.get("primitive_data_folder")
    custom_max_file = os.path.join(installation_dir, "custom_max.py")
    custom_mean_file = os.path.join(installation_dir, "custom_mean.py")
    custom_sum_file = os.path.join(installation_dir, "custom_sum.py")
    data_file = os.path.join(data_dir, "_pytest_test.csv")
    data_subfolder = os.path.join(data_dir, "pytest_folder")

    # make sure primitive files aren't there e.g from a failed run
    old_files = [
        custom_max_file, custom_mean_file, custom_sum_file, data_file,
        data_subfolder
    ]
    remove_test_files(old_files)

    # handle install via command line as a special case
    if install_path == "INSTALL_VIA_CLI":
        subprocess.check_output([
            'featuretools', 'install', '--no-prompt', primitives_to_install_dir
        ])
    elif install_path == "INSTALL_VIA_MODULE":
        subprocess.check_output([
            'python', '-m', 'featuretools', 'install', '--no-prompt',
            primitives_to_install_dir
        ])
    else:
        install_primitives(install_path, prompt=False)

    # must reload submodule for it to work
    reload(featuretools.primitives.installed)
    from featuretools.primitives.installed import CustomMax, CustomSum, CustomMean  # noqa: F401

    files = list_primitive_files(installation_dir)
    assert {custom_max_file, custom_mean_file,
            custom_sum_file}.issubset(set(files))
    assert os.path.exists(data_file)
    os.unlink(data_file)
    assert os.path.exists(data_subfolder)
    assert os.path.exists(os.path.join(data_subfolder, "hello.txt"))
    shutil.rmtree(data_subfolder)

    # then delete to clean up
    for f in [custom_max_file, custom_mean_file, custom_sum_file]:
        os.unlink(f)
예제 #5
0
 def reload(module):
     return builtins.reload(module)
def test_install_packages_from_requirements(primitives_to_install_dir):
    def pip_freeze():
        output = subprocess.check_output(['pip', 'freeze'])
        if not isinstance(output, str):
            output = output.decode()
        return output

    # make sure dummy module isn't installed
    if "featuretools-pip-tester" in pip_freeze():
        subprocess.check_call(
            ["pip", "uninstall", "-y", "featuretools-pip-tester"])
    assert "featuretools-pip-tester" not in pip_freeze()

    # generate requirements file with correct path
    requirements_path = os.path.join(primitives_to_install_dir,
                                     "requirements.txt")
    package_path = os.path.join(primitives_to_install_dir,
                                "featuretools_pip_tester")
    with open(requirements_path, 'w') as f:
        f.write(package_path)

    tar_path = os.path.join(os.path.dirname(primitives_to_install_dir),
                            "test_install_primitives.tar.gz")
    if os.path.exists(tar_path):
        os.unlink(tar_path)

    with tarfile.open(tar_path, "w:gz") as tar:
        tar.add(requirements_path, arcname="requirements.txt")
        tar.add(os.path.join(primitives_to_install_dir, "info.json"),
                arcname="info.json")
        tar.add(os.path.join(primitives_to_install_dir, "custom_max.py"),
                arcname="custom_max.py")
        tar.add(os.path.join(primitives_to_install_dir, "custom_mean.py"),
                arcname="custom_mean.py")
        tar.add(os.path.join(primitives_to_install_dir, "custom_sum.py"),
                arcname="custom_sum.py")
        tar.add(os.path.join(primitives_to_install_dir, "data"),
                arcname="data")

    installation_dir = get_installation_dir()
    data_dir = featuretools.config.get("primitive_data_folder")
    custom_max_file = os.path.join(installation_dir, "custom_max.py")
    custom_mean_file = os.path.join(installation_dir, "custom_mean.py")
    custom_sum_file = os.path.join(installation_dir, "custom_sum.py")
    data_file = os.path.join(data_dir, "_pytest_test.csv")
    data_subfolder = os.path.join(data_dir, "pytest_folder")

    # make sure primitive files aren't there e.g from a failed run
    old_files = [
        custom_max_file, custom_mean_file, custom_sum_file, data_file,
        data_subfolder
    ]
    remove_test_files(old_files)

    install_primitives(tar_path, prompt=False)

    # must reload submodule for it to work
    reload(featuretools.primitives.installed)
    from featuretools.primitives.installed import CustomMax, CustomSum, CustomMean  # noqa: F401

    files = list_primitive_files(installation_dir)
    assert {custom_max_file, custom_mean_file,
            custom_sum_file}.issubset(set(files))
    assert os.path.exists(data_file)
    os.unlink(data_file)
    os.unlink(requirements_path)
    assert os.path.exists(data_subfolder)
    assert os.path.exists(os.path.join(data_subfolder, "hello.txt"))
    shutil.rmtree(data_subfolder)
    os.unlink(tar_path)

    # then delete to clean up
    for f in [custom_max_file, custom_mean_file, custom_sum_file]:
        os.unlink(f)

    assert "featuretools-pip-tester" in pip_freeze()
    subprocess.check_call(
        ["pip", "uninstall", "-y", "featuretools-pip-tester"])
예제 #7
0
 def __init__(self, parent=None):
     try:
         importlib.reload(PCBconf)
     except:
         builtins.reload(PCBconf)
     
     QtGui.QWidget.__init__(self, parent)
     
     self.form = self
     self.form.setWindowTitle(u"Create glue path")
     self.form.setWindowIcon(QtGui.QIcon(":/data/img/gluePath.png"))
     #
     self.height = QtGui.QDoubleSpinBox(self)
     self.height.setSingleStep(0.1)
     self.height.setValue(1)
     self.height.setRange(0.1, 1000)
     self.height.setSuffix(u" mm")
     #
     self.width = QtGui.QDoubleSpinBox(self)
     self.width.setSingleStep(0.1)
     self.width.setValue(0.2)
     self.width.setRange(0.1, 1000)
     self.width.setSuffix(u" mm")
     #
     self.transparent = QtGui.QSpinBox(self)
     self.transparent.setSingleStep(1)
     self.transparent.setValue(0)
     self.transparent.setRange(0, 100)
     #
     self.wires = QtGui.QLineEdit('')
     self.wires.setReadOnly(True)
     pickWires = pickSketch(self.wires)
     
     if len(FreeCADGui.Selection.getSelection()):
         if FreeCADGui.Selection.getSelection()[0].isDerivedFrom("Sketcher::SketchObject"):
             self.wires.setText(FreeCADGui.Selection.getSelection()[0].Name)
     #
     self.flat = QtGui.QComboBox()
     self.flat.addItems(['True', 'False'])
     self.flat.setCurrentIndex(self.flat.findText('False'))
     #
     self.side = QtGui.QComboBox()
     self.side.addItems(['TOP', 'BOTTOM'])
     #
     self.pcbColor = kolorWarstwy()
     self.pcbColor.setColor(PCBconf.layersList['glueT']["color"])
     self.pcbColor.setToolTip(u"Click to change color")
     #
     lay = QtGui.QGridLayout(self)
     lay.addWidget(QtGui.QLabel(u'Sketcher:'), 0, 0, 1, 1)
     lay.addWidget(self.wires, 0, 1, 1, 1)
     lay.addWidget(pickWires, 0, 2, 1, 1)
     
     lay.addWidget(QtGui.QLabel(u'Side:'), 2, 0, 1, 1)
     lay.addWidget(self.side, 2, 1, 1, 2)
     lay.addWidget(QtGui.QLabel(u'Flat:'), 3, 0, 1, 1)
     lay.addWidget(self.flat, 3, 1, 1, 2)
     
     lay.addWidget(QtGui.QLabel(u'Height:'), 4, 0, 1, 1)
     lay.addWidget(self.height, 4, 1, 1, 2)
     lay.addWidget(QtGui.QLabel(u'Width:'), 5, 0, 1, 1)
     lay.addWidget(self.width, 5, 1, 1, 2)
     
     lay.addWidget(QtGui.QLabel(u'Color:'), 6, 0, 1, 1)
     lay.addWidget(self.pcbColor, 6, 1, 1, 2)
     lay.addWidget(QtGui.QLabel(u'Transparent:'), 7, 0, 1, 1)
     lay.addWidget(self.transparent, 7, 1, 1, 2)
예제 #8
0
    def __init__(self, filename=None, parent=None):
        try:
            importlib.reload(PCBconf)
        except:
            builtins.reload(PCBconf)

        QtGui.QDialog.__init__(self, parent)
        freecadSettings = FreeCAD.ParamGet(
            "User parameter:BaseApp/Preferences/Mod/PCB")

        self.setWindowTitle(u"PCB settings")
        self.setWindowIcon(QtGui.QIcon(":/data/img/assignModels.png"))
        #self.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        #
        self.plytkaPCB = QtGui.QCheckBox(u"Board")
        self.plytkaPCB.setDisabled(True)
        self.plytkaPCB.setChecked(True)

        plytkaPCBInfo = QtGui.QLabel(u"PCB Thickness")
        plytkaPCBInfo.setStyleSheet('margin-left:0px')

        #######
        self.gruboscPlytki = QtGui.QDoubleSpinBox()
        self.gruboscPlytki.setSingleStep(0.1)
        self.gruboscPlytki.setValue(
            freecadSettings.GetFloat("boardThickness", 1.5))
        self.gruboscPlytki.setSuffix(u" mm")
        #######
        self.plytkaPCB_otworyH = QtGui.QCheckBox(u"Holes")
        self.plytkaPCB_otworyH.setChecked(
            freecadSettings.GetBool("boardImportHoles", True))

        self.plytkaPCB_otworyV = QtGui.QCheckBox(u"Vias")
        self.plytkaPCB_otworyV.setChecked(
            freecadSettings.GetBool("boardImportHoles", True))

        self.plytkaPCB_otworyP = QtGui.QCheckBox(u"Pads")
        self.plytkaPCB_otworyP.setChecked(
            freecadSettings.GetBool("boardImportHoles", True))

        self.plytkaPCB_otworyIH = QtGui.QCheckBox(
            u"Omit intersected holes"
        )  # detecting collisions between holes - intersections
        self.plytkaPCB_otworyIH.setChecked(
            freecadSettings.GetBool("omitIntersectedHoles", True))

        self.plytkaPCB_cutHolesThroughAllLayers = QtGui.QCheckBox(
            u"Cut holes through all layers")
        self.plytkaPCB_cutHolesThroughAllLayers.setChecked(
            freecadSettings.GetBool("cutHolesThroughAllLayers", True))

        self.holesMin = QtGui.QDoubleSpinBox()
        self.holesMin.setSingleStep(0.1)
        self.holesMin.setValue(0)
        self.holesMin.setSuffix(u" mm")

        self.holesMax = QtGui.QDoubleSpinBox()
        self.holesMax.setSingleStep(0.1)
        self.holesMax.setValue(0)
        self.holesMax.setSuffix(u" mm")
        #######
        #self.plytkaPCB_PADS = QtGui.QCheckBox(u"Vias")
        #self.plytkaPCB_PADS.setChecked(True)
        #######
        self.plytkaPCB_plikER = QtGui.QCheckBox(u"Generate report")
        self.plytkaPCB_plikER.setChecked(
            freecadSettings.GetBool("partsReport", False))
        #self.plytkaPCB_plikER.setStyleSheet('margin-left:20px')
        self.plytkaPCB_plikER.setEnabled(
            freecadSettings.GetBool("partsImport", True))
        #######
        plytkaPCB_GP_TT = QtGui.QLabel("")
        plytkaPCB_GP_TT.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        plytkaPCB_GP_TT.setPixmap(QtGui.QPixmap(":/data/img/info_16x16.png"))
        plytkaPCB_GP_TT.setToolTip(
            '<b>Group parts</b><br><img src=":/data/img/groupParts.png">')

        self.plytkaPCB_grupujElementy = QtGui.QCheckBox(u"Group parts")
        self.plytkaPCB_grupujElementy.setChecked(
            freecadSettings.GetBool("groupParts", False))
        self.plytkaPCB_grupujElementy.setEnabled(
            freecadSettings.GetBool("partsImport", True))
        #######
        plytkaPCB_EK_TT = QtGui.QLabel("")
        plytkaPCB_EK_TT.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        plytkaPCB_EK_TT.setPixmap(QtGui.QPixmap(":/data/img/info_16x16.png"))
        plytkaPCB_EK_TT.setToolTip(
            '<b>Colorize elements</b><br><img src=":/data/img/colorizeModels.png">'
        )

        self.plytkaPCB_elementyKolory = QtGui.QCheckBox(u"Colorize elements")
        self.plytkaPCB_elementyKolory.setChecked(
            freecadSettings.GetBool("partsColorize", True))
        #self.plytkaPCB_elementyKolory.setStyleSheet('margin-left:20px')
        self.plytkaPCB_elementyKolory.setEnabled(
            freecadSettings.GetBool("partsImport", True))
        #######
        plytkaPCB_APNV_TT = QtGui.QLabel("")
        plytkaPCB_APNV_TT.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        plytkaPCB_APNV_TT.setPixmap(QtGui.QPixmap(":/data/img/info_16x16.png"))
        plytkaPCB_APNV_TT.setToolTip(
            '<b>Adjust part name/value</b><br><img src=":/data/img/adjustPartNameValue.png">'
        )

        self.adjustParts = QtGui.QCheckBox(u"Adjust part name/value")
        self.adjustParts.setChecked(
            freecadSettings.GetBool("adjustNameValue", False))
        #self.adjustParts.setStyleSheet('margin-left:20px')
        self.adjustParts.setEnabled(
            freecadSettings.GetBool("partsImport", True))
        #######
        self.partMinX = QtGui.QDoubleSpinBox()
        self.partMinX.setSingleStep(0.1)
        self.partMinX.setValue(0)
        self.partMinX.setSuffix(u" mm")
        self.partMinX.setEnabled(freecadSettings.GetBool("partsImport", True))

        self.partMinY = QtGui.QDoubleSpinBox()
        self.partMinY.setSingleStep(0.1)
        self.partMinY.setValue(0)
        self.partMinY.setSuffix(u" mm")
        self.partMinY.setEnabled(freecadSettings.GetBool("partsImport", True))

        self.partMinZ = QtGui.QDoubleSpinBox()
        self.partMinZ.setSingleStep(0.1)
        self.partMinZ.setValue(0)
        self.partMinZ.setSuffix(u" mm")
        self.partMinZ.setEnabled(freecadSettings.GetBool("partsImport", True))
        #######
        # buttons
        buttons = QtGui.QDialogButtonBox()
        buttons.addButton(u"Cancel", QtGui.QDialogButtonBox.RejectRole)
        buttons.addButton(u"Accept", QtGui.QDialogButtonBox.AcceptRole)
        self.connect(buttons, QtCore.SIGNAL("accepted()"), self,
                     QtCore.SLOT("accept()"))
        self.connect(buttons, QtCore.SIGNAL("rejected()"), self,
                     QtCore.SLOT("reject()"))
        #
        self.selectAll = QtGui.QCheckBox('de/select all layers')
        self.selectAll.setStyleSheet(
            '''border:1px solid rgb(237, 237, 237);''')
        self.connect(self.selectAll, QtCore.SIGNAL("clicked()"),
                     self.selectAllCategories)
        #
        self.debugImport = QtGui.QCheckBox('Debug import')

        self.copperImportPolygons = QtGui.QCheckBox(
            'Import polygons from copper layers')
        self.copperImportPolygons.setEnabled(False)

        self.skipEmptyLayers = QtGui.QCheckBox('Skip empty layers')
        self.skipEmptyLayers.setChecked(
            freecadSettings.GetBool("skipEmptyLayers", True))
        #
        self.spisWarstw = tabela()
        self.spisWarstw.setColumnCount(6)
        self.spisWarstw.setHorizontalHeaderLabels(
            ["", u"ID", "", "Side", "", u"Name"])
        self.spisWarstw.horizontalHeader().setResizeMode(
            0, QtGui.QHeaderView.Fixed)
        self.spisWarstw.horizontalHeader().setResizeMode(
            1, QtGui.QHeaderView.Fixed)
        self.spisWarstw.horizontalHeader().setResizeMode(
            2, QtGui.QHeaderView.Fixed)
        self.spisWarstw.horizontalHeader().setResizeMode(
            3, QtGui.QHeaderView.Fixed)
        self.spisWarstw.horizontalHeader().resizeSection(0, 25)
        self.spisWarstw.horizontalHeader().resizeSection(1, 35)
        self.spisWarstw.horizontalHeader().resizeSection(2, 35)
        self.spisWarstw.horizontalHeader().resizeSection(3, 85)
        self.spisWarstw.horizontalHeader().resizeSection(4, 95)
        self.spisWarstw.hideColumn(1)
        #######
        filterholesBox = QtGui.QGroupBox("Filter by diameter")
        filterholesBox.setFixedWidth(200)
        filterholesBoxLay = QtGui.QGridLayout(filterholesBox)
        filterholesBoxLay.addWidget(QtGui.QLabel(u"min."), 0, 0, 1, 1)
        filterholesBoxLay.addWidget(self.holesMin, 0, 1, 1, 1)
        filterholesBoxLay.addWidget(QtGui.QLabel(u"max."), 1, 0, 1, 1)
        filterholesBoxLay.addWidget(self.holesMax, 1, 1, 1, 1)
        filterholesBoxLay.addItem(QtGui.QSpacerItem(1, 10), 2, 1, 1, 1)
        filterholesBoxLay.addWidget(
            QtGui.QLabel(u"0mm -> skip parameter/limit"), 3, 0, 1, 2,
            QtCore.Qt.AlignCenter)

        holesBox = QtGui.QGroupBox("Holes")
        layHoles = QtGui.QGridLayout(holesBox)
        layHoles.addWidget(self.plytkaPCB_otworyH, 0, 0, 1, 1)
        layHoles.addWidget(self.plytkaPCB_otworyV, 1, 0, 1, 1)
        layHoles.addWidget(self.plytkaPCB_otworyP, 2, 0, 1, 1)
        layHoles.addWidget(self.plytkaPCB_otworyIH, 3, 0, 1, 1)
        layHoles.addWidget(self.plytkaPCB_cutHolesThroughAllLayers, 4, 0, 1, 1)
        layHoles.addWidget(filterholesBox, 0, 1, 5, 1)
        layHoles.setColumnStretch(0, 60)
        layHoles.setColumnStretch(1, 40)
        ####################
        filterPartsBox = QtGui.QGroupBox("Filter by size (3D models)")
        filterPartsBox.setFixedWidth(200)
        filterPartsBoxLay = QtGui.QGridLayout(filterPartsBox)
        filterPartsBoxLay.addWidget(QtGui.QLabel(u"Length"), 0, 0, 1, 1)
        filterPartsBoxLay.addWidget(self.partMinX, 0, 1, 1, 1)
        filterPartsBoxLay.addWidget(QtGui.QLabel(u"Width"), 1, 0, 1, 1)
        filterPartsBoxLay.addWidget(self.partMinY, 1, 1, 1, 1)
        filterPartsBoxLay.addWidget(QtGui.QLabel(u"Height"), 2, 0, 1, 1)
        filterPartsBoxLay.addWidget(self.partMinZ, 2, 1, 1, 1)
        filterPartsBoxLay.addItem(QtGui.QSpacerItem(1, 10), 3, 1, 1, 1)
        filterPartsBoxLay.addWidget(
            QtGui.QLabel(u"0mm -> skip parameter/limit"), 4, 0, 1, 2,
            QtCore.Qt.AlignCenter)

        self.partsBox = QtGui.QGroupBox("Parts")
        self.partsBox.setCheckable(True)
        self.partsBox.setChecked(freecadSettings.GetBool("partsImport", True))
        self.connect(self.partsBox, QtCore.SIGNAL("toggled (bool)"),
                     self.plytkaPCB_plikER.setEnabled)
        self.connect(self.partsBox, QtCore.SIGNAL("toggled (bool)"),
                     self.plytkaPCB_elementyKolory.setEnabled)
        self.connect(self.partsBox, QtCore.SIGNAL("toggled (bool)"),
                     self.adjustParts.setEnabled)
        self.connect(self.partsBox, QtCore.SIGNAL("toggled (bool)"),
                     self.plytkaPCB_grupujElementy.setEnabled)
        self.connect(self.partsBox, QtCore.SIGNAL("toggled (bool)"),
                     filterPartsBox.setEnabled)
        try:
            self.connect(self.partsBox, QtCore.SIGNAL("toggled (bool)"),
                         self.packageByDecal.setEnabled)  # IDF
        except:
            pass

        self.layParts = QtGui.QGridLayout(self.partsBox)
        self.layParts.addWidget(plytkaPCB_EK_TT, 0, 0, 1, 1)
        self.layParts.addWidget(self.plytkaPCB_elementyKolory, 0, 1, 1, 1)
        self.layParts.addWidget(plytkaPCB_APNV_TT, 1, 0, 1, 1)
        self.layParts.addWidget(self.adjustParts, 1, 1, 1, 1)
        self.layParts.addWidget(plytkaPCB_GP_TT, 2, 0, 1, 1)
        self.layParts.addWidget(self.plytkaPCB_grupujElementy, 2, 1, 1, 1)
        self.layParts.addWidget(self.plytkaPCB_plikER, 3, 1, 1, 1)
        #4 decals IDF
        self.layParts.addWidget(filterPartsBox, 0, 2, 6, 1)
        self.layParts.setColumnStretch(1, 60)
        self.layParts.setColumnStretch(2, 40)
        ####################
        self.razenBiblioteki = QtGui.QLineEdit('')

        self.tentedViasLimit = QtGui.QDoubleSpinBox()
        self.tentedViasLimit.setSingleStep(0.1)
        self.tentedViasLimit.setValue(0)
        self.tentedViasLimit.setSuffix(u" mm")

        tentedViasBox = QtGui.QGroupBox("Tented Vias")
        tentedViasBox.setFixedWidth(200)
        tentedViasBoxLay = QtGui.QGridLayout(tentedViasBox)
        tentedViasBoxLay.addWidget(QtGui.QLabel(u"Limit"), 0, 0, 1, 1)
        tentedViasBoxLay.addWidget(self.tentedViasLimit, 0, 1, 1, 1)
        tentedViasBoxLay.addWidget(
            QtGui.QLabel(u"0mm -> skip parameter/limit"), 3, 0, 1, 2,
            QtCore.Qt.AlignCenter)

        otherBox = QtGui.QGroupBox("Other settings")
        self.layOther = QtGui.QGridLayout(otherBox)
        #self.layOther.addWidget(QtGui.QLabel(u"Library"), 0, 0, 1, 1) # library
        #self.layOther.addWidget(self.razenBiblioteki, 0, 1, 1, 2) # library
        self.layOther.addWidget(self.debugImport, 1, 0, 1, 3)
        self.layOther.addWidget(self.copperImportPolygons, 2, 0, 1, 3)
        self.layOther.addWidget(tentedViasBox, 0, 2, 6, 1)
        ##############################################
        mainWidgetLeftSide = QtGui.QWidget()
        layLeftSide = QtGui.QGridLayout(mainWidgetLeftSide)
        layLeftSide.addWidget(self.spisWarstw, 0, 0, 1, 3)
        layLeftSide.addWidget(self.selectAll, 1, 0, 1, 1)
        layLeftSide.addWidget(self.skipEmptyLayers, 1, 1, 1, 1)
        layLeftSide.addItem(
            QtGui.QSpacerItem(1, 1, QtGui.QSizePolicy.Expanding), 1, 2, 1, 1)
        #
        mainWidgetRightSide = QtGui.QWidget()
        layRightSide = QtGui.QGridLayout(mainWidgetRightSide)
        layRightSide.addWidget(plytkaPCBInfo, 0, 0, 1, 1, QtCore.Qt.AlignLeft)
        layRightSide.addWidget(self.gruboscPlytki, 0, 1, 1, 1)
        layRightSide.addItem(QtGui.QSpacerItem(1, 10), 1, 0, 1, 1)
        layRightSide.addWidget(holesBox, 2, 0, 1, 2, QtCore.Qt.AlignTop)
        layRightSide.addWidget(self.partsBox, 3, 0, 1, 2, QtCore.Qt.AlignTop)
        layRightSide.addWidget(otherBox, 4, 0, 1, 2, QtCore.Qt.AlignTop)
        layRightSide.addItem(
            QtGui.QSpacerItem(1, 1, QtGui.QSizePolicy.Minimum,
                              QtGui.QSizePolicy.Expanding), 5, 1, 1, 1)
        #
        self.splitter = QtGui.QSplitter()
        #self.splitter.setStyleSheet('QSplitter::handle {background: rgba(31.8, 33.3, 33.7, 0.1); cursor: col-resize;} ')
        self.splitter.setChildrenCollapsible(False)
        self.splitter.addWidget(mainWidgetLeftSide)
        self.splitter.addWidget(mainWidgetRightSide)
        self.splitter.handle(1).setAttribute(QtCore.Qt.WA_Hover, True)
        self.splitter.setStyleSheet(
            "QSplitter::handle{background: rgba(31.8, 33.3, 33.7, 0.1); cursor: w-resize;}"
            "QSplitter::handle:hover{background: rgb(120, 120, 120); cursor: w-resize;}"
            "QSplitter::handle:pressed{background-color: rgb(120, 120, 120); cursor: w-resize;}"
        )
        self.splitter.handle(1).setCursor(
            QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        #
        mainLay = QtGui.QGridLayout()
        mainLay.addWidget(self.splitter, 0, 0, 1, 3)
        mainLay.addItem(QtGui.QSpacerItem(1, 1, QtGui.QSizePolicy.Expanding),
                        1, 0, 1, 1)
        mainLay.addWidget(buttons, 1, 1, 1, 1, QtCore.Qt.AlignRight)
        mainLay.addItem(
            QtGui.QSpacerItem(2, 1, QtGui.QSizePolicy.Minimum,
                              QtGui.QSizePolicy.Minimum), 1, 2, 1, 1)
        self.setLayout(mainLay)
        #
        self.readSize()
예제 #9
0
 def reload(module):
     return builtins.reload(module)