Example #1
0
    def __init__(self,
                 operations,
                 index,
                 shift=0,
                 flip=False,
                 rotate=False,
                 outputref=0):
        super(Dialog, self).__init__()

        self.operations = operations
        self.le1 = DraggableTreeWidget()
        self.le1.linklist(self.operations)
        self.le1.selectIndeces([(index, outputref)])
        #        self.le1.addItems([str(op) for op in operations])

        layout5 = qg.QHBoxLayout()
        layout5.addWidget(qg.QLabel('Flip Layers'))
        self.flip = qg.QCheckBox()
        self.flip.setChecked(flip)
        layout5.addWidget(self.flip)

        layout6 = qg.QHBoxLayout()
        layout6.addWidget(qg.QLabel('Rotate Layers'))
        self.rotate = qg.QCheckBox()
        self.rotate.setChecked(rotate)
        layout6.addWidget(self.rotate)

        layout4 = qg.QHBoxLayout()
        layout4.addWidget(qg.QLabel('Shift Layers'))
        self.sb = qg.QSpinBox()
        self.sb.setRange(popupcad.gui_negative_infinity,
                         popupcad.gui_positive_infinity)
        self.sb.setSingleStep(1)
        self.sb.setValue(shift)
        layout4.addWidget(self.sb)

        button1 = qg.QPushButton('Ok')
        button2 = qg.QPushButton('Cancel')

        layout2 = qg.QHBoxLayout()
        layout2.addWidget(button1)
        layout2.addWidget(button2)

        layout = qg.QVBoxLayout()
        layout.addWidget(qg.QLabel('Parent Operation'))
        layout.addWidget(self.le1)
        layout.addLayout(layout5)
        layout.addLayout(layout6)
        layout.addLayout(layout4)
        layout.addLayout(layout2)

        self.setLayout(layout)

        button1.clicked.connect(self.accept)
        button2.clicked.connect(self.reject)
Example #2
0
    def __init__(self, folder=None):
        if folder is None:
            folder = popupcad.exportdir
        super(DxfExportWidget, self).__init__()

        button_accept = qg.QPushButton('Ok')
        button_reject = qg.QPushButton('Cancel')

        self.separate_layers = qg.QCheckBox('One layer per file')

        self.dirbox = qg.QLineEdit()
        self.dirbox.setText(folder)
        self.dirbutton = qg.QPushButton('...')
        layout0 = qg.QHBoxLayout()
        layout0.addWidget(self.dirbox)
        layout0.addWidget(self.dirbutton)
        layout2 = qg.QHBoxLayout()
        layout2.addWidget(button_accept)
        layout2.addWidget(button_reject)
        layout3 = qg.QVBoxLayout()
        layout3.addLayout(layout0)
        layout3.addWidget(self.separate_layers)
        layout3.addLayout(layout2)

        self.dirbutton.clicked.connect(self.selectExport)
        button_accept.clicked.connect(self.accept)
        button_reject.clicked.connect(self.reject)
        self.setLayout(layout3)
Example #3
0
        def __init__(self, parent, stage, options):
            """
            :param QtGui.QWidget parent: Resist simulation view widget parent
            """
            super(_AbstractSimulationsView, self).__init__(parent)

            self.__options = options
            self.__stage = stage

            self.__metrology_label = QtGui.QLabel("Metrology results:", self)

            self._parameters = QMetrologyTable(self, stage.metrics)

            self.__x_axis_label = QtGui.QLabel("X Axis:", self)
            self._x_axis_edit = QtGui.QLineEdit(self)
            self._x_axis_edit.setEnabled(False)
            self._x_axis_edit.setFixedWidth(self._parameters.width())

            self.__y_axis_label = QtGui.QLabel("Y Axis:", self)
            self._y_axis_edit = QtGui.QLineEdit(self)
            self._y_axis_edit.setEnabled(False)
            self._y_axis_edit.setFixedWidth(self._parameters.width())

            self._draw_mask_chkbox = QtGui.QCheckBox("Draw original mask",
                                                     self)
            connect(self._draw_mask_chkbox.toggled,
                    self.on_draw_mask_chkbox_toggled)
            self._draw_mask_chkbox.setChecked(False)

            self.__parameters_layout = QtGui.QVBoxLayout()
            self.__parameters_layout.addWidget(self.__x_axis_label)
            self.__parameters_layout.addWidget(self._x_axis_edit)
            self.__parameters_layout.addSpacing(10)
            self.__parameters_layout.addWidget(self.__y_axis_label)
            self.__parameters_layout.addWidget(self._y_axis_edit)
            self.__parameters_layout.addSpacing(30)
            self.__parameters_layout.addWidget(self.__metrology_label)
            self.__parameters_layout.addWidget(self._parameters)
            self.__parameters_layout.addWidget(self._draw_mask_chkbox)
            self.__parameters_layout.addStretch()

            self._graph = graph_class(self, options)
            self._toolbar = NavigationToolbar(self._graph, self)

            self.__graph_layout = QtGui.QVBoxLayout()
            # self.__graph_layout.setAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignHCenter)
            self.__graph_layout.addWidget(self._toolbar)
            self.__graph_layout.addWidget(self._graph)
            self.__graph_layout.addStretch()

            self.__layout = QtGui.QHBoxLayout(self)
            self.__layout.addLayout(self.__parameters_layout)
            self.__layout.addLayout(self.__graph_layout)
Example #4
0
    def __init__(self, parent, simulation):
        """
        :param QtGui.QWidget parent: Diffraction pattern view widget parent
        :param core.Core simulation: Simulation Core
        """
        super(DiffractionPatternView, self).__init__(parent)
        self.__simulation = simulation

        self.__type_label = QtGui.QLabel("Display:", self)
        self.__type_combo = QtGui.QComboBox(self)
        for type_index in sorted(DiffractionPatternGraph.type_map):
            self.__type_combo.addItem(
                DiffractionPatternGraph.type_map[type_index])
        self.__show_zero_chkbox = QtGui.QCheckBox("Draw (0, 0) order term",
                                                  self)
        self.__show_zero_chkbox.setChecked(True)
        self.__kx_spinbox = QtGui.QSpinBox(self)
        self.__kx_spinbox.setFixedWidth(80)
        self.__ky_spinbox = QtGui.QSpinBox(self)
        self.__ky_spinbox.setFixedWidth(80)

        self.__graph = DiffractionPatternGraph(self, simulation.options)

        self.__options_layout = QtGui.QVBoxLayout()
        self.__options_layout.addWidget(self.__type_label)
        self.__options_layout.addWidget(self.__type_combo)

        self.__options_layout.addSpacing(15)

        self.__options_layout.addWidget(self.__show_zero_chkbox)

        self.__options_layout.addSpacing(15)

        self.__kxy_layout = QtGui.QFormLayout()
        self.__kxy_layout.addRow("X-Axis at:", self.__kx_spinbox)
        self.__kxy_layout.addRow("Y-Axis at:", self.__ky_spinbox)
        self.__options_layout.addLayout(self.__kxy_layout)

        self.__options_layout.addStretch()

        self.__graph_layout = QtGui.QVBoxLayout()
        self.__graph_layout.addWidget(self.__graph)

        self.__layout = QtGui.QHBoxLayout(self)
        self.__layout.addLayout(self.__options_layout)
        self.__layout.addLayout(self.__graph_layout)

        connect(self.__type_combo.currentIndexChanged,
                self.on_combobox_changed)
        connect(self.__show_zero_chkbox.stateChanged, self.on_chkbox_toggled)
        connect(self.__kx_spinbox.valueChanged, self.on_kx_spin_changed)
        connect(self.__ky_spinbox.valueChanged, self.on_ky_spin_changed)
Example #5
0
    def __init__(self, parent, appdb):
        """
        :type parent: QtGui.QMainWindow
        :type appdb: ApplicationDatabase
        """
        QtGui.QDialog.__init__(self, parent)

        self.setWindowTitle("Load Material")
        self.setWindowIcon(parent.windowIcon())

        self.__appdb = appdb

        self.__select_group = QtGui.QGroupBox("Select Material", self)
        self.__select_group_layout = QtGui.QHBoxLayout(self.__select_group)
        self.__material_list = QtGui.QListWidget(self.__select_group)
        self.__select_group_layout.addWidget(self.__material_list)

        self.__material_plot = MaterialPlot(self)

        self.__buttons_layout = QtGui.QHBoxLayout()
        self.__parametric_checkbox = QtGui.QCheckBox("Parametric", self)
        self.__load_button = QtGui.QPushButton("Load material", self)
        self.__load_button.setFixedWidth(config.MAXIMUM_DIALOG_BUTTON_WIDTH)
        self.__cancel_button = QtGui.QPushButton("Cancel", self)
        self.__cancel_button.setFixedWidth(config.MAXIMUM_DIALOG_BUTTON_WIDTH)

        self.__buttons_layout.addWidget(self.__parametric_checkbox)
        self.__buttons_layout.addStretch()
        self.__buttons_layout.addWidget(self.__load_button)
        self.__buttons_layout.addWidget(self.__cancel_button)

        connect(self.__load_button.clicked, self.accept)
        connect(self.__cancel_button.clicked, self.reject)
        connect(self.__parametric_checkbox.stateChanged,
                self._accept_state_handler)
        connect(self.__material_list.itemSelectionChanged,
                self._accept_state_handler)
        connect(self.__material_list.itemSelectionChanged,
                self._change_material)

        self.__layout = QtGui.QVBoxLayout(self)
        self.__layout.addWidget(self.__select_group)
        self.__layout.addWidget(self.__material_plot)
        self.__layout.addLayout(self.__buttons_layout)

        self.__parametric_checkbox.setCheckState(QtCore.Qt.Unchecked)
        self._accept_state_handler()
Example #6
0
        def __init__(self, parent, appdb):
            """
            :type parent: QtGui.QWidget
            :type appdb: ApplicationDatabase
            """
            QStackWidgetTab.__init__(self, parent)

            self.__appdb = appdb
            self.__resist = None
            """:type: options.structures.Resist"""

            self.__dev_rate_graph = DevelopmentGraph(self)

            self.__group = QtGui.QGroupBox("Parameters", self)

            self.__views = dict()
            self.__parameters_widgets = QtGui.QStackedWidget(self.__group)
            self.__dev_models = QtGui.QComboBox(self.__group)

            for model in self.__appdb[orm.DevelopmentModel]:
                self.__dev_models.addItem(model.name)
                self.__views[
                    model.
                    name] = ResistDevelopmentTab.DevRateExprView.ModelView(
                        self, model, self.__dev_rate_graph)
                self.__parameters_widgets.addWidget(self.__views[model.name])
            self.__dev_models.setFixedWidth(200)
            connect(self.__dev_models.currentIndexChanged,
                    self.__onIndexChanged)

            self.__temporary_check_box = QtGui.QCheckBox(
                "Coupled", self.__group)
            connect(self.__temporary_check_box.stateChanged,
                    self._temporary_box_unchecked)

            self.__group_layout = QtGui.QVBoxLayout(self.__group)
            self.__group_layout.addWidget(self.__dev_models)
            self.__group_layout.addWidget(self.__temporary_check_box)
            self.__group_layout.addWidget(self.__parameters_widgets)
            self.__group_layout.addStretch()

            self.__layout = QtGui.QHBoxLayout(self)
            self.__layout.addWidget(self.__group)
            self.__layout.addStretch()
            self.__layout.addWidget(self.__dev_rate_graph)
Example #7
0
    def __init__(self, parent, imaging_tool):
        """:type imaging_tool: options.structures.ImagingTool"""
        super(ImmersionBox, self).__init__("Immersion Lithography", parent)

        self.__imaging_tool = imaging_tool

        self.__immersion_enable_checkbox = QtGui.QCheckBox("Enable Immersion", self)
        connect(self.__immersion_enable_checkbox.stateChanged, self.immersionStateChanged)
        # TODO: Add immersion calculation
        self.__immersion_enable_checkbox.setEnabled(False)

        self.__refraction_index_label = QtGui.QLabel("Refractive Index:")
        self.__refraction_index_edit = self.edit(self.__imaging_tool.immersion)

        self.__hlayout = QtGui.QHBoxLayout(self)
        self.__hlayout.addWidget(self.__immersion_enable_checkbox)
        self.__hlayout.addStretch()
        self.__hlayout.addWidget(self.__refraction_index_label)
        self.__hlayout.addWidget(self.__refraction_index_edit)

        self.immersionStateChanged(self.__imaging_tool.immersion_enabled)
Example #8
0
    def __init__(self, design, prioroperations, placeop=None):
        super(Dialog, self).__init__()

        if placeop is None:
            self.placeop = TransformExternal(
                None, None, None, None, TransformExternal.transformtypes.scale,
                TransformExternal.transformtypes.scale, 0, False, 1., 1.)
        else:
            self.placeop = placeop

        self.prioroperations = prioroperations
        self.design = design

        self.designwidget = DesignListManager(design)

        self.operation_list = DraggableTreeWidget()
        self.operation_list.linklist(prioroperations)

        self.sketchwidget_from = SketchListViewer(design, name='From Line')
        self.sketchwidget_to = SketchListManager(design, name='To Lines')

        self.radiobox_scale_x = qg.QRadioButton('Scale X')
        self.radiobox_custom_x = qg.QRadioButton('Custom X')
        self.radiobox_scale_y = qg.QRadioButton('Scale Y')
        self.radiobox_custom_y = qg.QRadioButton('Custom Y')

        self.x_scale_option = qg.QButtonGroup()
        self.x_scale_option.addButton(self.radiobox_scale_x)
        self.x_scale_option.addButton(self.radiobox_custom_x)

        self.y_scale_option = qg.QButtonGroup()
        self.y_scale_option.addButton(self.radiobox_scale_y)
        self.y_scale_option.addButton(self.radiobox_custom_y)

        self.scalex = qg.QLineEdit()
        self.scaley = qg.QLineEdit()

        templayout1 = qg.QHBoxLayout()
        templayout1.addStretch()
        templayout1.addWidget(self.radiobox_scale_x)
        templayout1.addWidget(self.radiobox_custom_x)
        templayout1.addWidget(self.scalex)
        templayout1.addStretch()
        templayout2 = qg.QHBoxLayout()
        templayout2.addStretch()
        templayout2.addWidget(self.radiobox_scale_y)
        templayout2.addWidget(self.radiobox_custom_y)
        templayout2.addWidget(self.scaley)
        templayout2.addStretch()

        layout5 = qg.QHBoxLayout()
        layout5.addWidget(qg.QLabel('Flip Layers'))
        self.flip = qg.QCheckBox()
        layout5.addWidget(self.flip)

        layout4 = qg.QHBoxLayout()
        layout4.addWidget(qg.QLabel('Shift Layers'))
        self.sb = qg.QSpinBox()
        self.sb.setRange(popupcad.gui_negative_infinity,
                         popupcad.gui_positive_infinity)
        self.sb.setSingleStep(1)
        layout4.addWidget(self.sb)

        button1 = qg.QPushButton('Ok')
        button1.clicked.connect(self.accept)
        button2 = qg.QPushButton('Cancel')
        button2.clicked.connect(self.reject)

        layout2 = qg.QHBoxLayout()
        layout2.addWidget(button1)
        layout2.addWidget(button2)

        layout3 = qg.QHBoxLayout()
        layout3.addWidget(self.sketchwidget_from)
        layout3.addWidget(self.sketchwidget_to)

        layout = qg.QVBoxLayout()
        layout.addWidget(self.designwidget)
        layout.addWidget(qg.QLabel('Operations'))
        layout.addWidget(self.operation_list)
        layout.addLayout(layout3)
        layout.addLayout(templayout1)
        layout.addLayout(templayout2)
        layout.addLayout(layout5)
        layout.addLayout(layout4)
        layout.addLayout(layout2)
        self.setLayout(layout)

        self.radiobox_scale_x.setChecked(False)
        self.radiobox_custom_x.setChecked(False)
        self.radiobox_scale_y.setChecked(False)
        self.radiobox_custom_y.setChecked(False)

        if self.placeop.transformtype_x == TransformExternal.transformtypes.scale:
            self.radiobox_scale_x.setChecked(True)
        elif self.placeop.transformtype_x == TransformExternal.transformtypes.custom:
            self.radiobox_custom_x.setChecked(True)

        if self.placeop.transformtype_y == TransformExternal.transformtypes.scale:
            self.radiobox_scale_y.setChecked(True)
        elif self.placeop.transformtype_y == TransformExternal.transformtypes.custom:
            self.radiobox_custom_y.setChecked(True)

        self.designwidget.itemlist.itemSelectionChanged.connect(
            self.loadoperations)

        if self.placeop.sketch_links is not None:
            sketch_to = self.design.sketches[
                self.placeop.sketch_links['sketch_to'][0]]

            for ii in range(self.sketchwidget_to.itemlist.count()):
                item = self.sketchwidget_to.itemlist.item(ii)
                if item.value == sketch_to:
                    item.setSelected(True)

        self.loadoperations()

        try:
            subdesign = design.subdesigns[
                self.placeop.design_links['subdesign'][0]]
            for ii in range(self.designwidget.itemlist.count()):
                item = self.designwidget.itemlist.item(ii)
                if item.value == subdesign:
                    item.setSelected(True)

            if self.placeop.subopref is not None:
                id, jj = self.placeop.subopref
                ii = subdesign.operation_index(id)
                self.operation_list.selectIndeces([(ii, jj)])

            sketch_from = subdesign.sketches[self.placeop.sub_sketch_id]
            for ii in range(self.sketchwidget_from.itemlist.count()):
                item = self.sketchwidget_from.itemlist.item(ii)
                if item.value == sketch_from:
                    item.setSelected(True)
        except TypeError:
            pass

        self.scalex.setText(str(self.placeop.scalex))
        self.scaley.setText(str(self.placeop.scaley))
        self.flip.setChecked(self.placeop.flip)
        self.sb.setValue(self.placeop.shift)
Example #9
0
class PluginManagerGui(QtGui.QWidget, PluginManagerGuiBase):

    # @TODO: emit signal for ???

    def __init__(self,
                 pluginmanager,
                 parent=None,
                 flags=QtCore.Qt.WindowFlags(0),
                 **kwargs):
        super(PluginManagerGui, self).__init__(parent, flags, **kwargs)
        self.setupUi(self)

        # Set icons
        geticon = qt4support.geticon
        self.addButton.setIcon(geticon('add.svg', __name__))
        self.removeButton.setIcon(geticon('remove.svg', __name__))
        self.editButton.setIcon(geticon('edit.svg', __name__))
        self.upButton.setIcon(geticon('go-up.svg', __name__))
        self.downButton.setIcon(geticon('go-down.svg', __name__))

        # Set plugin manager attribute
        self.pluginmanager = pluginmanager

        # Context menu
        qt4support.setViewContextActions(self.pathListWidget)
        qt4support.setViewContextActions(self.pluginsTableWidget)

        # @TODO: check edit triggers
        #int(self.pathListWidget.editTriggers() &
        #                                   self.pathListWidget.DoubleClicked)

        self.pathListWidget.itemSelectionChanged.connect(
            self.pathSelectionChanged)

        self.addButton.clicked.connect(self.addPathItem)
        self.removeButton.clicked.connect(self.removeSelectedPathItem)
        self.upButton.clicked.connect(self.moveSelectedPathItemsUp)
        self.downButton.clicked.connect(self.moveSelectedPathItemsDown)
        self.editButton.clicked.connect(self.editSelectedPathItem)

    @QtCore.Slot()
    def pathSelectionChanged(self):
        enabled = bool(self.pathListWidget.selectedItems())
        self.editButton.setEnabled(enabled)
        self.removeButton.setEnabled(enabled)
        self.upButton.setEnabled(enabled)
        self.downButton.setEnabled(enabled)

    @QtCore.Slot()
    def addPathItem(self):
        # @TODO: don't directly use _app attribute
        filedialog = self.pluginmanager._app.filedialog
        filedialog.setFileMode(filedialog.Directory)
        if (filedialog.exec_()):
            dirs = filedialog.selectedFiles()
            existingdirs = [
                str(self.pathListWidget.item(row).text())
                for row in range(self.pathListWidget.count())
            ]
            for dir_ in dirs:
                if dir_ not in existingdirs:
                    self.pathListWidget.addItem(dir_)

    @QtCore.Slot()
    def removeSelectedPathItem(self):
        model = self.pathListWidget.model()
        for item in self.pathListWidget.selectedItems():
            model.removeRow(self.pathListWidget.row(item))

    @QtCore.Slot()
    def editSelectedPathItem(self):
        items = self.pathListWidget.selectedItems()
        if items:
            item = items[0]

            # @TODO: don't directly use _app attribute
            filedialog = self.pluginmanager._app.filedialog
            filedialog.setFileMode(filedialog.Directory)
            filedialog.selectFile(item.text())
            if (filedialog.exec_()):
                dirs = filedialog.selectedFiles()
                if dirs:
                    dir_ = dirs[0]
                    item.setText(dir_)

    def _movePathItem(self, item, offset):
        if offset == 0:
            return

        listwidget = self.pathListWidget
        row = listwidget.row(item)

        if (row + offset) < 0:
            offset = -row
        elif (row + offset) >= listwidget.count():
            offset = listwidget.count() - 1 - row

        if offset == 0:
            return

        selected = item.isSelected()
        item = listwidget.takeItem(row)
        listwidget.insertItem(row + offset, item)
        item.setSelected(selected)

    @QtCore.Slot()
    def moveSelectedPathItemsUp(self):
        selected = sorted(self.pathListWidget.selectedItems(),
                          key=self.pathListWidget.row)

        if self.pathListWidget.row(selected[0]) == 0:
            return

        for item in selected:
            self._movePathItem(item, -1)

    @QtCore.Slot()
    def moveSelectedPathItemsDown(self):
        selected = sorted(self.pathListWidget.selectedItems(),
                          key=self.pathListWidget.row,
                          reverse=True)

        if (self.pathListWidget.row(
                selected[0]) == self.pathListWidget.count() - 1):
            return

        for item in selected:
            self._movePathItem(item, 1)

    def update_view(self):
        self.pathListWidget.clear()

        for item in self.pluginmanager.paths:
            self.pathListWidget.addItem(item)

        self.pluginmanager.load(self.pluginmanager.allplugins, info_only=True)

        tablewidget = self.pluginsTableWidget
        tablewidget.clear()
        tablewidget.setRowCount(0)
        tablewidget.setHorizontalHeaderLabels([
            self.tr('Name'),
            self.tr('Description'),
            self.tr('Info'),
            self.tr('Active'),
            self.tr('Load on startup')
        ])

        for plugin in self.pluginmanager.allplugins:
            name = plugin
            short_description = tablewidget.tr('NOT AVAILABLE')
            disabled = False
            for dict_ in (self.pluginmanager.plugins, sys.modules):
                try:
                    module = dict_[name]
                    name = module.name
                    short_description = module.short_description
                    break
                except AttributeError, e:
                    msg = str(e)
                    if (not "'name'" in msg
                            and not "'short_description'" in msg):
                        raise
                    disabled = True
                except KeyError:
                    disabled = True

            index = tablewidget.rowCount()
            tablewidget.insertRow(index)

            # name/description
            tablewidget.setItem(index, 0, QtGui.QTableWidgetItem(name))
            tablewidget.setItem(index, 1,
                                QtGui.QTableWidgetItem(short_description))

            # info
            icon = qt4support.geticon('info.svg', __name__)
            w = QtGui.QPushButton(icon,
                                  '',
                                  tablewidget,
                                  toolTip=self.tr('Show plugin info.'),
                                  clicked=functools.partial(
                                      self.showPluginInfo, index))
            #clicked=lambda index=index:
            #              self.showPluginInfo(index))
            tablewidget.setCellWidget(index, 2, w)

            # active
            checked = bool(plugin in self.pluginmanager.plugins)
            w = QtGui.QCheckBox(tablewidget, checked=checked)
            tablewidget.setCellWidget(index, 3, w)

            # TODO: remove this block when plugins unloading will be
            #       available
            if w.isChecked():
                w.setEnabled(False)

            # autoload
            checked = bool(plugin in self.pluginmanager.autoload)
            w = QtGui.QCheckBox(tablewidget,
                                checked=checked,
                                toolTip=self.tr('Load on startup'))
            tablewidget.setCellWidget(index, 4, w)

            if disabled:
                for col in range(tablewidget.columnCount() - 1):
                    item = tablewidget.item(index, col)
                    if item:
                        item.setFlags(item.flags() ^ QtCore.Qt.ItemIsEnabled)
                        msg = tablewidget.tr("Plugin don't seems to be "
                                             "compatible with GSDView.")
                        item.setToolTip(msg)
                    else:
                        w = tablewidget.cellWidget(index, col)
                        w.setEnabled(False)
Example #10
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 545)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayout_3 = QtGui.QVBoxLayout(self.centralwidget)
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.cSplit = Splitter(self.centralwidget)
        self.cSplit.setOrientation(QtCore.Qt.Horizontal)
        self.cSplit.setObjectName("cSplit")
        self.layoutWidget = QtGui.QWidget(self.cSplit)
        self.layoutWidget.setObjectName("layoutWidget")
        self.verticalLayout = QtGui.QVBoxLayout(self.layoutWidget)
        self.verticalLayout.setMargin(0)
        self.verticalLayout.setObjectName("verticalLayout")
        self.tbtree = QtGui.QWidget(self.layoutWidget)
        self.tbtree.setObjectName("tbtree")
        self.horizontalLayout = QtGui.QHBoxLayout(self.tbtree)
        self.horizontalLayout.setMargin(0)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.toolButton = QtGui.QToolButton(self.tbtree)
        self.toolButton.setObjectName("toolButton")
        self.horizontalLayout.addWidget(self.toolButton)
        self.toolButton_2 = QtGui.QToolButton(self.tbtree)
        self.toolButton_2.setObjectName("toolButton_2")
        self.horizontalLayout.addWidget(self.toolButton_2)
        spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.verticalLayout.addWidget(self.tbtree)
        self.tree = LoggerTree(self.layoutWidget)
        self.tree.setObjectName("tree")
        self.verticalLayout.addWidget(self.tree)
        self.verticalLayout.setStretch(1, 1)
        self.mSplit = Splitter(self.cSplit)
        self.mSplit.setOrientation(QtCore.Qt.Vertical)
        self.mSplit.setObjectName("mSplit")
        self.layoutWidget1 = QtGui.QWidget(self.mSplit)
        self.layoutWidget1.setObjectName("layoutWidget1")
        self.verticalLayout_2 = QtGui.QVBoxLayout(self.layoutWidget1)
        self.verticalLayout_2.setMargin(0)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.tbmaster = QtGui.QWidget(self.layoutWidget1)
        self.tbmaster.setEnabled(True)
        self.tbmaster.setObjectName("tbmaster")
        self.gridLayout = QtGui.QGridLayout(self.tbmaster)
        self.gridLayout.setMargin(0)
        self.gridLayout.setObjectName("gridLayout")
        self.wantDebug = QtGui.QCheckBox(self.tbmaster)
        self.wantDebug.setChecked(True)
        self.wantDebug.setObjectName("wantDebug")
        self.gridLayout.addWidget(self.wantDebug, 0, 0, 1, 1)
        self.wantInfo = QtGui.QCheckBox(self.tbmaster)
        self.wantInfo.setChecked(True)
        self.wantInfo.setObjectName("wantInfo")
        self.gridLayout.addWidget(self.wantInfo, 1, 0, 1, 1)
        self.clearAll = QtGui.QToolButton(self.tbmaster)
        self.clearAll.setEnabled(False)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.clearAll.sizePolicy().hasHeightForWidth())
        self.clearAll.setSizePolicy(sizePolicy)
        self.clearAll.setObjectName("clearAll")
        self.gridLayout.addWidget(self.clearAll, 0, 3, 1, 1)
        self.colprefs = QtGui.QToolButton(self.tbmaster)
        self.colprefs.setObjectName("colprefs")
        self.gridLayout.addWidget(self.colprefs, 1, 3, 1, 1)
        self.wantCritical = QtGui.QCheckBox(self.tbmaster)
        self.wantCritical.setChecked(True)
        self.wantCritical.setObjectName("wantCritical")
        self.gridLayout.addWidget(self.wantCritical, 0, 2, 1, 1)
        self.wantAll = QtGui.QCheckBox(self.tbmaster)
        self.wantAll.setChecked(True)
        self.wantAll.setObjectName("wantAll")
        self.gridLayout.addWidget(self.wantAll, 1, 2, 1, 1)
        self.wantError = QtGui.QCheckBox(self.tbmaster)
        self.wantError.setChecked(True)
        self.wantError.setObjectName("wantError")
        self.gridLayout.addWidget(self.wantError, 1, 1, 1, 1)
        self.wantWarning = QtGui.QCheckBox(self.tbmaster)
        self.wantWarning.setChecked(True)
        self.wantWarning.setObjectName("wantWarning")
        self.gridLayout.addWidget(self.wantWarning, 0, 1, 1, 1)
        self.search = QtGui.QToolButton(self.tbmaster)
        self.search.setEnabled(False)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.search.sizePolicy().hasHeightForWidth())
        self.search.setSizePolicy(sizePolicy)
        self.search.setObjectName("search")
        self.gridLayout.addWidget(self.search, 4, 3, 1, 1)
        self.match = QtGui.QLineEdit(self.tbmaster)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.match.sizePolicy().hasHeightForWidth())
        self.match.setSizePolicy(sizePolicy)
        self.match.setObjectName("match")
        self.gridLayout.addWidget(self.match, 4, 1, 1, 1)
        self.matchlabel = QtGui.QLabel(self.tbmaster)
        self.matchlabel.setObjectName("matchlabel")
        self.gridLayout.addWidget(self.matchlabel, 4, 0, 1, 1)
        self.useRegexp = QtGui.QCheckBox(self.tbmaster)
        self.useRegexp.setObjectName("useRegexp")
        self.gridLayout.addWidget(self.useRegexp, 4, 2, 1, 1)
        self.line = QtGui.QFrame(self.tbmaster)
        self.line.setFrameShape(QtGui.QFrame.HLine)
        self.line.setFrameShadow(QtGui.QFrame.Sunken)
        self.line.setObjectName("line")
        self.gridLayout.addWidget(self.line, 3, 0, 1, 4)
        self.verticalLayout_2.addWidget(self.tbmaster)
        self.master = MasterTable(self.layoutWidget1)
        self.master.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu)
        self.master.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
        self.master.setObjectName("master")
        self.verticalLayout_2.addWidget(self.master)
        self.verticalLayout_2.setStretch(1, 1)
        self.detail = DetailTable(self.mSplit)
        self.detail.setSelectionMode(QtGui.QAbstractItemView.NoSelection)
        self.detail.setObjectName("detail")
        self.verticalLayout_3.addWidget(self.cSplit)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 25))
        self.menubar.setObjectName("menubar")
        self.menu_Help = QtGui.QMenu(self.menubar)
        self.menu_Help.setObjectName("menu_Help")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.action_About = QtGui.QAction(MainWindow)
        self.action_About.setObjectName("action_About")
        self.menu_Help.addAction(self.action_About)
        self.menubar.addAction(self.menu_Help.menuAction())
        self.matchlabel.setBuddy(self.match)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        MainWindow.setTabOrder(self.toolButton, self.toolButton_2)
        MainWindow.setTabOrder(self.toolButton_2, self.tree)
        MainWindow.setTabOrder(self.tree, self.wantDebug)
        MainWindow.setTabOrder(self.wantDebug, self.wantWarning)
        MainWindow.setTabOrder(self.wantWarning, self.wantCritical)
        MainWindow.setTabOrder(self.wantCritical, self.wantInfo)
        MainWindow.setTabOrder(self.wantInfo, self.wantError)
        MainWindow.setTabOrder(self.wantError, self.wantAll)
        MainWindow.setTabOrder(self.wantAll, self.clearAll)
        MainWindow.setTabOrder(self.clearAll, self.colprefs)
        MainWindow.setTabOrder(self.colprefs, self.match)
        MainWindow.setTabOrder(self.match, self.useRegexp)
        MainWindow.setTabOrder(self.useRegexp, self.search)
        MainWindow.setTabOrder(self.search, self.master)
        MainWindow.setTabOrder(self.master, self.detail)
Example #11
0
    def __init__(self,
                 design,
                 prioroperations,
                 sketch=None,
                 subdesign=None,
                 subopref=None,
                 transformtype_x=None,
                 transformtype_y=None,
                 shift=0,
                 flip=False,
                 scalex=1.,
                 scaley=1.):
        super(Dialog, self).__init__()

        if transformtype_x is None:
            self.transformtype_x = PlaceOperation8.transformtypes.scale
        else:
            self.transformtype_x = transformtype_x

        if transformtype_y is None:
            self.transformtype_y = PlaceOperation8.transformtypes.scale
        else:
            self.transformtype_y = transformtype_y

        self.prioroperations = prioroperations
        self.design = design

        self.designwidget = DesignListManager(design)

        self.optree = DraggableTreeWidget()

        self.sketchwidget = SketchListManager(design)

        self.radiobox_scale_x = qg.QRadioButton('Scale X')
        self.radiobox_custom_x = qg.QRadioButton('Custom X')
        self.radiobox_scale_y = qg.QRadioButton('Scale Y')
        self.radiobox_custom_y = qg.QRadioButton('Custom Y')

        self.x_scale_option = qg.QButtonGroup()
        self.x_scale_option.addButton(self.radiobox_scale_x)
        self.x_scale_option.addButton(self.radiobox_custom_x)

        self.y_scale_option = qg.QButtonGroup()
        self.y_scale_option.addButton(self.radiobox_scale_y)
        self.y_scale_option.addButton(self.radiobox_custom_y)

        #        custom_layout = qg.QVBoxLayout()
        self.scalex = qg.QLineEdit()
        self.scaley = qg.QLineEdit()
        self.scalex.setText(str(scalex))
        self.scaley.setText(str(scaley))
        #        custom_layout.addWidget(self.scalex)
        #        custom_layout.addWidget(self.scaley)

        templayout1 = qg.QHBoxLayout()
        templayout1.addStretch()
        templayout1.addWidget(self.radiobox_scale_x)
        templayout1.addWidget(self.radiobox_custom_x)
        templayout1.addWidget(self.scalex)
        templayout1.addStretch()
        templayout2 = qg.QHBoxLayout()
        templayout2.addStretch()
        templayout2.addWidget(self.radiobox_scale_y)
        templayout2.addWidget(self.radiobox_custom_y)
        templayout2.addWidget(self.scaley)
        templayout2.addStretch()

        layout5 = qg.QHBoxLayout()
        layout5.addWidget(qg.QLabel('Flip Layers'))
        self.flip = qg.QCheckBox()
        self.flip.setChecked(flip)
        layout5.addWidget(self.flip)

        layout4 = qg.QHBoxLayout()
        layout4.addWidget(qg.QLabel('Shift Layers'))
        self.sb = qg.QSpinBox()
        self.sb.setRange(popupcad.gui_negative_infinity,
                         popupcad.gui_positive_infinity)
        self.sb.setSingleStep(1)
        self.sb.setValue(shift)
        layout4.addWidget(self.sb)

        #        layout3 = qg.QHBoxLayout()
        #        layout3.addWidget(self.lineedit)
        #        layout3.addWidget(button3)

        button1 = qg.QPushButton('Ok')
        button1.clicked.connect(self.accept)
        button2 = qg.QPushButton('Cancel')
        button2.clicked.connect(self.reject)

        layout2 = qg.QHBoxLayout()
        layout2.addWidget(button1)
        layout2.addWidget(button2)

        layout = qg.QVBoxLayout()
        #        layout.addWidget(qg.QLabel('Design'))
        layout.addWidget(self.designwidget)
        layout.addWidget(qg.QLabel('Sub-Design Operations'))
        layout.addWidget(self.optree)
        #        layout.addWidget(qg.QLabel('Sketch'))
        layout.addWidget(self.sketchwidget)
        layout.addLayout(templayout1)
        layout.addLayout(templayout2)
        layout.addLayout(layout5)
        layout.addLayout(layout4)
        layout.addLayout(layout2)
        self.setLayout(layout)

        self.radiobox_scale_x.setChecked(False)
        self.radiobox_custom_x.setChecked(False)
        self.radiobox_scale_y.setChecked(False)
        self.radiobox_custom_y.setChecked(False)

        if self.transformtype_x == PlaceOperation8.transformtypes.scale:
            self.radiobox_scale_x.setChecked(True)
        elif self.transformtype_x == PlaceOperation8.transformtypes.custom:
            self.radiobox_custom_x.setChecked(True)

        if self.transformtype_y == PlaceOperation8.transformtypes.scale:
            self.radiobox_scale_y.setChecked(True)
        elif self.transformtype_y == PlaceOperation8.transformtypes.custom:
            self.radiobox_custom_y.setChecked(True)

        self.designwidget.itemlist.itemSelectionChanged.connect(
            self.loadoperations)

        for ii in range(self.designwidget.itemlist.count()):
            item = self.designwidget.itemlist.item(ii)
            if item.value == subdesign:
                item.setSelected(True)

        for ii in range(self.sketchwidget.itemlist.count()):
            item = self.sketchwidget.itemlist.item(ii)
            if item.value == sketch:
                item.setSelected(True)

        self.loadoperations()
        try:
            if subopref is not None:
                id, jj = subopref
                if subdesign is not None:
                    ii = subdesign.operation_index(id)
                    self.optree.selectIndeces([(ii, jj)])
        except NoOperation:
            pass