def __init__(self, parent, core): super(OutputVariableBox, self).__init__("Output variable", parent) self.__output_variable_tree = OutputVariableTree(self, core) connect(self.__output_variable_tree.itemSelectionChanged, self.onTreeItemSelectionChanged) self.__control_widget = SimulationSetsControl(self, core) self.__layout_accres = QtGui.QHBoxLayout() self.__button_accept = QtGui.QPushButton("Accept", self) connect(self.__button_accept.clicked, self.onAcceptButtonClicked) self.__button_accept.setEnabled(False) self.__button_reset = QtGui.QPushButton("Reset", self) connect(self.__button_reset.clicked, self.onResetButtonClicked) self.__button_reset.setEnabled(False) self.__layout_accres.addWidget(self.__button_accept) self.__layout_accres.addWidget(self.__button_reset) self.__layout_tree = QtGui.QVBoxLayout() self.__layout_tree.addWidget(self.__output_variable_tree) self.__layout_tree.addLayout(self.__layout_accres) self.__layout = QtGui.QHBoxLayout(self) self.__layout.addLayout(self.__layout_tree) self.__layout.addWidget(self.__control_widget) connect(self.__control_widget.finished, self.onFinished)
def __init__(self, parent, model, load_dialog): """ :param QtGui.QWidget parent: Widget parent :param QProcessStackModel model: GUI data model :param LoadMaterialDialog load_dialog: Material dialog loader """ QtGui.QGroupBox.__init__(self, "Process Stack", parent) self.setObjectName("QProcessStack") self.__data_model = model self.__load_material_dlg = load_dialog self.__header_layout = QtGui.QHBoxLayout() self.__add_button = self._create_button("icons/Plus", self.insert_layer) self.__remove_button = self._create_button("icons/Minus", self.remove_layer) self.__up_button = self._create_button("icons/ArrowUp", self.layer_upper) self.__down_button = self._create_button("icons/ArrowDown", self.layer_lower) self.__header_layout.addStretch(1) self.__process_table = QProcessStackTable(self, self.__data_model) # PySide crash if not create temporary variable selection_model = self.__process_table.selectionModel() connect(selection_model.selectionChanged, self._item_changed) # Even selection automatically changed when endMoveRows perform selectionChanged not emitted connect(self.__data_model.rowsMoved, self._item_changed) self.__layout = QtGui.QVBoxLayout(self) self.__layout.addLayout(self.__header_layout) self.__layout.addWidget(self.__process_table)
def __init__(self, design, sketches, layers, operations, jointop=None): super(MainWidget, self).__init__() self.design = design self.sketches = sketches self.layers = layers self.operations = operations self.designwidget = DesignListManager(design) self.input_table = Table(InputRow(self.get_subdesign_operations,self.get_operations),Delegate) self.sketch_table = Table(SketchRow(self.get_subdesign_sketches,self.get_sketches),Delegate) self.output_table = Table(OutputRow(self.get_subdesign_operations),Delegate) self.sketch_control = TableControl(self.sketch_table, self) self.input_control = TableControl(self.input_table, self) self.output_control = TableControl(self.output_table, self) button_ok = qg.QPushButton('Ok') button_cancel = qg.QPushButton('Cancel') button_ok.clicked.connect(self.accept) button_cancel.clicked.connect(self.reject) sublayout2 = qg.QHBoxLayout() sublayout2.addWidget(button_ok) sublayout2.addWidget(button_cancel) layout = qg.QVBoxLayout() layout.addWidget(self.designwidget) layout.addWidget(self.sketch_control) layout.addWidget(self.input_control) layout.addWidget(self.output_control) layout.addLayout(sublayout2) self.setLayout(layout) if jointop is not None: subdesign = design.subdesigns[jointop.design_links['source'][0]] for ii in range(self.designwidget.itemlist.count()): item = self.designwidget.itemlist.item(ii) if item.value == subdesign: item.setSelected(True) for item in jointop.sketch_list: self.sketch_table.row_add([subdesign.sketches[item.ref1]], [design.sketches[item.ref2]]) for item in jointop.input_list: index1 = self.subdesign().operation_index(item.ref1[0]) output1 = item.ref1[1] index2 = self.design.operation_index(item.ref2[0]) output2 = item.ref2[1] self.input_table.row_add([(index1, output1)], [(index2, output2)],item.shift) for item in jointop.output_list: index1 = self.subdesign().operation_index(item.ref1[0]) output1 = item.ref1[1] self.output_table.row_add([(index1, output1)],item.shift) self.designwidget.itemlist.itemSelectionChanged.connect( self.input_table.reset) self.designwidget.itemlist.itemSelectionChanged.connect( self.output_table.reset) self.designwidget.itemlist.itemSelectionChanged.connect( self.sketch_table.reset)
def __init__(self, design, operations, selectedop=None, outputref=0): super(Dialog, self).__init__() self.design = design self.le1 = DraggableTreeWidget() self.le1.linklist(operations) if selectedop is not None: self.le1.selectIndeces([(selectedop, outputref)]) layout = qg.QVBoxLayout() layout.addWidget(qg.QLabel('Operation to Flatten')) layout.addWidget(self.le1) button1 = qg.QPushButton('Ok') button2 = qg.QPushButton('Cancel') layout2 = qg.QHBoxLayout() layout2.addWidget(button1) layout2.addWidget(button2) layout.addLayout(layout2) self.setLayout(layout) button1.clicked.connect(self.accept) button2.clicked.connect(self.reject)
def __init__(self, *args, **kwargs): super(GLObjectViewer, self).__init__(*args, **kwargs) self.view = GLViewWidget(self) self.slider = qg.QSlider() self.slider.setMinimum(0) self.slider.setMaximum(1000) self.slider.setTickInterval(1) self.slider.setValue(self.view.z_zoom) self.slider.valueChanged.connect(self.view.update_zoom) self.slider2 = qg.QSlider() self.slider2.setMinimum(-1) self.slider2.setMaximum(1000) self.slider2.setTickInterval(1) self.slider2.setValue(self.view.transparency) self.slider2.valueChanged.connect(self.view.update_transparency) layout = qg.QHBoxLayout() layout.addWidget(self.view) layout.addWidget(self.slider) layout.addWidget(self.slider2) self.setLayout(layout)
def __init__(self, parent): """:type parent: QtGui.QWidget""" AbstractResistTab.__init__(self, parent) self._hlayout = QtGui.QHBoxLayout() self.__info_boxes = dict() """:type: dict from str to AbstractResistInfoBox""" self.__info_boxes["general"] = AbstractResistInfoTab.General(self) self.__info_boxes["exposure"] = AbstractResistInfoTab.Exposure(self) self.__info_boxes["development"] = AbstractResistInfoTab.Development( self) self.__info_layout = QtGui.QVBoxLayout() self.__info_layout.addWidget(self.__info_boxes["general"]) self.__info_layout.addWidget(self.__info_boxes["exposure"]) self.__info_layout.addWidget(self.__info_boxes["development"]) self.__info_layout.addStretch() self._hlayout.addLayout(self.__info_layout) self.__vlayout = QtGui.QVBoxLayout(self) self.__vlayout.addLayout(self._hlayout) self.__vlayout.addStretch()
def __init__(self, parent, peb_temp): """ :param QtGui.QWidget parent: Widget parent :param options.Variable peb_temp: PEB temperature options field """ AbstractResistTab.__init__(self, parent) self.__views = dict() """:type: dict from str to AbstractResistInfoBox""" self.__views["property"] = ResistExposureTab.PropertyView(self) self.__views["exposure"] = ResistExposureTab.ExposureView(self) self.__views["peb"] = ResistExposureTab.PebView(self, peb_temp) self.__vlayout = QtGui.QVBoxLayout() self.__vlayout.addWidget(self.__views["property"]) self.__vlayout.addWidget(self.__views["exposure"]) self.__vlayout.addStretch() self.__peb_layout = QtGui.QVBoxLayout() self.__peb_layout.addWidget(self.__views["peb"]) self.__peb_layout.addStretch() self.__layout = QtGui.QHBoxLayout(self) self.__layout.addLayout(self.__vlayout) self.__layout.addLayout(self.__peb_layout)
def _setupActions(self): actions = super(LayerManager, self)._setupActions() icon = QtGui.QIcon( ':/trolltech/styles/commonstyle/images/viewdetailed-128.png') QtGui.QAction(icon, self.tr('Select all'), actions, objectName='selectAllAction', statusTip=self.tr('Select all'), shortcut=self.tr('Ctrl-A'), triggered=self.view.selectAll) # connect actions action = actions.findChild(QtGui.QAction, 'moveToTopAction') action.triggered.connect(self.moveSelectionToTop) action = actions.findChild(QtGui.QAction, 'moveUpAction') action.triggered.connect(self.moveSelectionUp) action = actions.findChild(QtGui.QAction, 'moveDownAction') action.triggered.connect(self.moveSelectionDown) action = actions.findChild(QtGui.QAction, 'moveToBottomAction') action.triggered.connect(self.moveSelectionToBottom) action = actions.findChild(QtGui.QAction, 'removeLayerAction') action.triggered.connect(self.removeSelectedLayers) action = actions.findChild(QtGui.QAction, 'showLayerAction') action.triggered.connect(self.checkSelectedItems) action = actions.findChild(QtGui.QAction, 'hideLayerAction') action.triggered.connect(self.uncheckSelectedItems) return actions
def _setupMajorObjectItemActions(self, actionsgroup=None): if actionsgroup is None: actionsgroup = QtGui.QActionGroup(self) # open metadata view icon = qt4support.geticon('metadata.svg', __name__) QtGui.QAction(icon, self.tr('Open &Metadata View'), actionsgroup, objectName='actionOpenItemMetadataView', shortcut=self.tr('Ctrl+M'), toolTip=self.tr('Show metadata in a new window'), statusTip=self.tr('Show metadata in a new window'), triggered=self.openItemMatadataView, enabled=False) # @TODO: remove # show properties # @TODO: standard info icon from gdsview package icon = qt4support.geticon('info.svg', 'gsdview') QtGui.QAction(icon, self.tr('&Show Properties'), actionsgroup, objectName='actionShowItemProperties', shortcut=self.tr('Ctrl+S'), toolTip=self.tr('Show the property dialog for the ' 'cutent item'), statusTip=self.tr('Show the property dialog for the ' 'cutent item'), triggered=self.showItemProperties) return actionsgroup
def __init__(self, parent, exposure_focus, wafer_stack): """ :param QtGui.QWidget parent: Exposure and focus view widget parent :param options.structures.ExposureFocus exposure_focus: Exposure and focus options parameters :param options.structures.WaferProcess wafer_stack: Wafer stack """ QStackWidgetTab.__init__(self, parent) self.__exposure = ExposureDoseBox(self, exposure_focus) self.__calibration = DoseCalibrationBox(self, exposure_focus) self.__focus = WaferFocus(self, exposure_focus) self.__focus_graph = FocusGraph(self, exposure_focus, wafer_stack) self.__layout = QtGui.QVBoxLayout() self.__layout.addWidget(self.__exposure) self.__layout.addWidget(self.__calibration) self.__layout.addSpacing(10) self.__layout.addWidget(self.__focus) self.__layout.addStretch() self.__graph_layout = QtGui.QVBoxLayout() self.__graph_layout.addWidget(self.__focus_graph) self.__graph_layout.addStretch() self.__hlayout = QtGui.QHBoxLayout(self) self.__hlayout.addLayout(self.__layout) self.__hlayout.addSpacing(10) self.__hlayout.addLayout(self.__graph_layout) self.__hlayout.addStretch()
def paint(self, painter, option, widget): # main rounded rect thickness = self.model.edgeThickness() if self.isSelected(): standardPen = QtGui.QPen(self.model.selectedNodeColour(), thickness + 1) else: standardPen = QtGui.QPen(self.model.edgeColour(), thickness) rect = self.childrenBoundingRect() rect.setWidth(rect.width() + 2) rounded_rect = QtGui.QPainterPath() roundingY = int(150.0 * self.cornerRounding / rect.height()) rounded_rect.addRoundRect(rect, 0.0, roundingY) painter.setBrush(self.backgroundColour) painter.fillPath(rounded_rect, painter.brush()) # Title BG painter.setPen(QtGui.QPen(self.model.headerColor())) titleHeight = self.header.size().height() # painter.setBrush(self.model.headerColor()) painter.drawRect(0, 0, rect.width(), titleHeight) # outer node edge painter.strokePath(rounded_rect, standardPen) super(GraphicsNode, self).paint(painter, option, widget)
def tint(cls, pixmap, color=(255, 255, 255, 100), compositionMode=QtGui.QPainter.CompositionMode_Plus): """ Composite one pixmap over another :param pixmap: :param color: :param compositionMode: :return: """ # Set the color for the overlay color = QtGui.QColor(*color) overlayPixmap = QtGui.QPixmap(pixmap.width(), pixmap.height()) overlayPixmap.fill(color) overlayPixmap.setMask(pixmap.mask()) # Paint the overlay pixmap over the original painter = QtGui.QPainter(pixmap) painter.setCompositionMode(compositionMode) painter.drawPixmap(0, 0, overlayPixmap.width(), overlayPixmap.height(), overlayPixmap) painter.end()
def __init__(self, generic, *args, **kwargs): try: self.pen_color = kwargs.pop('pen_color ') except KeyError: pass try: self.brush_color = kwargs.pop('brush_color') except KeyError: pass self.generic = generic super(Static, self).__init__(*args, **kwargs) self.setZValue(self.z_value) self.setAcceptHoverEvents(True) self.setselectable(False) pen = qg.QPen(qg.QColor.fromRgbF(*self.pen_color), self.linewidth, self.style, self.capstyle, self.joinstyle) pen.setCosmetic(True) self.setPen(pen) brush = qg.QBrush(qg.QColor.fromRgbF(*self.brush_color), self.brushpattern) self.setBrush(brush) self.refreshview() self.updateshape()
def _setupActions(self): actions = QtGui.QActionGroup(self) # KML export icon = qt4support.geticon('area.svg', 'gsdview') QtGui.QAction(icon, self.tr('KML export'), actions, objectName='kmlExportAction', statusTip=self.tr('KML export'), triggered=self.exportKML) # Open in google earth icon = qt4support.geticon('earth.svg', __name__) QtGui.QAction(icon, self.tr('Open in Google Earth'), actions, objectName='openInGoogleEarthAction', statusTip=self.tr('Open in Google Earth'), triggered=self.openInGoogleEarth) # Open in google maps icon = qt4support.geticon('overview.svg', 'gsdview.gdalbackend') QtGui.QAction(icon, self.tr('Open in Google Maps'), actions, objectName='openInGoogleMapsAction', statusTip=self.tr('Open in Google Maps'), triggered=self.openInGoogleMaps) return actions
def __init__(self, searchPixmap=None, clearPixmap=None, parent=None): QtWidgets.QLineEdit.__init__(self, parent) if searchPixmap is None: searchPixmap = iconlib.iconColorized("magnifier", utils.dpiScale(16), (128,128,128)) # these should be in layouts if clearPixmap is None: clearPixmap = iconlib.iconColorized("close", utils.dpiScale(16), (128,128,128)) self.clearButton = QtWidgets.QToolButton(self) self.clearButton.setIcon(QtGui.QIcon(clearPixmap)) self.clearButton.setCursor(QtCore.Qt.ArrowCursor) self.clearButton.setStyleSheet("QToolButton { border: none; padding: 1px; }") self.clearButton.hide() self.clearButton.clicked.connect(self.clear) self.textChanged.connect(self.updateCloseButton) self.searchButton = QtWidgets.QToolButton(self) self.searchButton.setStyleSheet("QToolButton { border: none; padding: 0px; }") self.searchButton.setIcon(QtGui.QIcon(searchPixmap)) frameWidth = self.style().pixelMetric(QtWidgets.QStyle.PM_DefaultFrameWidth) self.setStyleSheet("QLineEdit { padding-left: %dpx; padding-right: %dpx; } "%( self.searchButton.sizeHint().width() + frameWidth + 1, self.clearButton.sizeHint().width() + frameWidth + 1)) msz = self.minimumSizeHint() self.setMinimumSize(max(msz.width(), self.searchButton.sizeHint().width() + self.clearButton.sizeHint().width() + frameWidth * 2 + 2), max(msz.height(), self.clearButton.sizeHint().height() + frameWidth * 2 + 2))
def __init__(self, design, operations, operation_index, sketch=None): super(Dialog, self).__init__() SketchListManager(design) self.optree = DraggableTreeWidget() self.optree.linklist(operations) self.sketchwidget = SketchListManager(design) 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(self.optree) layout.addWidget(self.sketchwidget) layout.addLayout(layout2) self.setLayout(layout) for ii in range(self.sketchwidget.itemlist.count()): item = self.sketchwidget.itemlist.item(ii) if item.value == sketch: item.setSelected(True) try: self.optree.selectIndeces([operation_index]) except NoOperation: pass
def __init__(self, parent, mask=None): """ :type parent: QtGui.QWidget :type mask: orm.Mask | orm.ConcretePluginMask | None """ super(MaskBackgroundBox, self).__init__("Mask Background", parent) self.__mask = None """:type: orm.Mask | orm.ConcretePluginMask | None""" self.__hlayout = QtGui.QHBoxLayout() self.__transmittance_label = QtGui.QLabel("Transmittance:", self) self.__transmittance_edit = self.edit() self.__phase_label = QtGui.QLabel("Phase (deg):", self) self.__phase_edit = self.edit() self.__hlayout.addWidget(self.__transmittance_label) self.__hlayout.addWidget(self.__transmittance_edit) self.__hlayout.addSpacing(20) self.__hlayout.addWidget(self.__phase_label) self.__hlayout.addWidget(self.__phase_edit) self.__hlayout.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) self.__layout = QtGui.QVBoxLayout(self) self.__layout.addLayout(self.__hlayout) self.__layout.addSpacing(5) if mask is not None: self.setObject(mask)
def __init__(self, source, destination=None, curveType=CUBIC, color=defaultColor): super(ConnectionEdge, self).__init__() self.curveType = curveType self._sourcePlug = source self._destinationPlug = destination self._sourcePoint = source.center() self._destinationPoint = destination.center( ) if destination is not None else None self.defaultPen = QtGui.QPen(color, 1.25, style=QtCore.Qt.DashLine) self.defaultPen.setDashPattern([1, 2, 2, 1]) self.selectedPen = QtGui.QPen(self.selectedColor, 1.7, style=QtCore.Qt.DashLine) self.selectedPen.setDashPattern([1, 2, 2, 1]) self.hoverPen = QtGui.QPen(self.hoverColor, 1.7, style=QtCore.Qt.DashLine) self.selectedPen.setDashPattern([1, 2, 2, 1]) self.hovering = False self.setPen(self.defaultPen) self.setZValue(-1) self.setFlags(self.ItemIsFocusable | self.ItemIsSelectable | self.ItemIsMovable) self.setCurveType(curveType) self.update()
def __init__(self, parent, temp): """ :type parent: QtGui.QWidget :type temp: options.Variable """ QtGui.QGroupBox.__init__(self, "Post Exposure Bake", parent) self.__peb_graph = ResistExposureTab.PebView.Graph(self, temp) self.__graph_layout = QtGui.QHBoxLayout() self.__graph_layout.addWidget(self.__peb_graph) self.__ln_ar = ResistExposureTab.Edit(self) self.__ea = ResistExposureTab.Edit(self) self.__values_layout = QtGui.QHBoxLayout() self.__values_layout.addWidget(QtGui.QLabel("Ln(Ar) (nm2/s):")) self.__values_layout.addWidget(self.__ln_ar) self.__values_layout.addStretch() self.__values_layout.addWidget(QtGui.QLabel("Ea (kcal/mole):")) self.__values_layout.addWidget(self.__ea) self.__layout = QtGui.QVBoxLayout(self) self.__layout.addLayout(self.__graph_layout) self.__layout.addLayout(self.__values_layout)
def showsyntaxerror(self, filename = None): self._outputBrush = QtGui.QBrush(QtGui.QColor('#ffcc63')) try: InteractiveInterpreter.showsyntaxerror(self, filename) finally: self._outputBrush = None
def build_toolbar(self, toolbar_structure, top_element, dictionary, icons): toolbars = [] toolbar_menus = [] for topitem in toolbar_structure[top_element]: toolbar = qg.QToolBar(topitem) toolbar.setIconSize( qc.QSize(popupcad.toolbar_icon_size, popupcad.toolbar_icon_size)) toolbar.setToolButtonStyle(qc.Qt.ToolButtonTextUnderIcon) for item in toolbar_structure[topitem]: if item in dictionary: subelement = dictionary[item] if isinstance(subelement, qg.QAction): toolbar.addAction(subelement) elif subelement == 'separator': #if isinstance(item,type([])): toolbar.addSeparator() else: submenu = self.build_menu_r2(item, toolbar_structure, dictionary, toolbar_menus) tb = qg.QToolButton() try: tb.setIcon( icons[self.toolbar_definitions[item]['icon']]) except KeyError: pass try: tb.setText(self.toolbar_definitions[item]['text']) except KeyError: pass tb.setMenu(submenu) tb.setPopupMode(tb.InstantPopup) tb.setToolButtonStyle(qc.Qt.ToolButtonTextUnderIcon) toolbar.addWidget(tb) toolbars.append(toolbar) return toolbars, toolbar_menus
def showtraceback(self): self._outputBrush = QtGui.QBrush(QtGui.QColor('#ff0000')) try: InteractiveInterpreter.showtraceback(self) finally: self._outputBrush = None
def setupUi(self, ColPrefsDialog): ColPrefsDialog.setObjectName("ColPrefsDialog") ColPrefsDialog.resize(225, 402) ColPrefsDialog.setModal(True) self.verticalLayout = QtGui.QVBoxLayout(ColPrefsDialog) self.verticalLayout.setObjectName("verticalLayout") self.label = QtGui.QLabel(ColPrefsDialog) self.label.setObjectName("label") self.verticalLayout.addWidget(self.label) self.list = QtGui.QListWidget(ColPrefsDialog) self.list.setObjectName("list") self.verticalLayout.addWidget(self.list) self.label_2 = QtGui.QLabel(ColPrefsDialog) self.label_2.setTextFormat(QtCore.Qt.PlainText) self.label_2.setWordWrap(True) self.label_2.setObjectName("label_2") self.verticalLayout.addWidget(self.label_2) self.buttonBox = QtGui.QDialogButtonBox(ColPrefsDialog) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.verticalLayout.addWidget(self.buttonBox) self.label.setBuddy(self.list) self.retranslateUi(ColPrefsDialog) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), ColPrefsDialog.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), ColPrefsDialog.reject) QtCore.QMetaObject.connectSlotsByName(ColPrefsDialog)
def write(self, text): 'Simulate stdin, stdout, and stderr.' # Move the cursor to the end of the document self.textEdit.moveCursor(QtGui.QTextCursor.End) # Clear any existing text format. We will explicitly set the format # later to something else if need be. self.textEdit.setCurrentCharFormat(QtGui.QTextCharFormat()) # Copy the textEdit's current cursor. cursor = self.textEdit.textCursor() try: # If there's a designated output brush, merge that character format # into the cursor's character format. if self.interpreter.GetOutputBrush(): cf = QtGui.QTextCharFormat() cf.setForeground(self.interpreter.GetOutputBrush()) cursor.mergeCharFormat(cf) # Write the text to the textEdit. cursor.insertText(text) finally: # Set the textEdit's cursor to the end of input self.textEdit.moveCursor(QtGui.QTextCursor.End)
class UIFonts(ConstantGroup): # Font constants. We use font in the prim browser to distinguish # "resolved" prim specifier # XXX - the use of weight here may need to be revised depending on font family BASE_POINT_SIZE = 10 ITALIC = QtGui.QFont() ITALIC.setWeight(QtGui.QFont.Light) ITALIC.setItalic(True) NORMAL = QtGui.QFont() NORMAL.setWeight(QtGui.QFont.Normal) BOLD = QtGui.QFont() BOLD.setWeight(QtGui.QFont.Bold) BOLD_ITALIC = QtGui.QFont() BOLD_ITALIC.setWeight(QtGui.QFont.Bold) BOLD_ITALIC.setItalic(True) OVER_PRIM = ITALIC DEFINED_PRIM = BOLD ABSTRACT_PRIM = NORMAL INHERITED = QtGui.QFont() INHERITED.setPointSize(BASE_POINT_SIZE * 0.8) INHERITED.setWeight(QtGui.QFont.Normal) INHERITED.setItalic(True)
def _setupFileActions(self): style = self.style() actions = QtGui.QActionGroup(self) icon = style.standardIcon(QtGui.QStyle.SP_DialogOpenButton) QtGui.QAction(icon, self.tr('Open Vector'), actions, objectName='openVectorAction', statusTip=self.tr('Open Vector'), triggered=self.onOpenVector) icon = style.standardIcon(QtGui.QStyle.SP_DialogResetButton) QtGui.QAction(icon, self.tr('Close All'), actions, objectName='claseAllAction', statusTip=self.tr('Close All'), triggered=self.reset) QtGui.QAction(actions).setSeparator(True) icon = style.standardIcon(QtGui.QStyle.SP_DialogCancelButton) QtGui.QAction(icon, self.tr('Exit'), actions, objectName='exitAction', statusTip=self.tr('Exit'), triggered=self.close) return actions
def __init__(self, parent, options): """ :type parent: QtGui.QWidget :param options.structures.Options options: Programs options """ QStackWidgetTab.__init__(self, parent) self.__options = options self.__calc_mode_combobox = QComboBoxEnum( self, self.__options.numerics.calculation_model) # TODO: Add vector model self.__calc_mode_combobox.setEnabled(False) self.__form_layout = QtGui.QFormLayout() self.__form_layout.addRow("Image calculation mode:", self.__calc_mode_combobox) self.__source_grid_groupbox = SourceGridView(self.__options.numerics, self) self.__target_grid_groupbox = TargetGridView(self.__options.numerics, self) self.__system_memory_groupbox = SystemMemoryView( self.__options.numerics, self.__options.mask, self.__options.wafer_process.resist, self) self.__grid_layout = QtGui.QGridLayout() self.__grid_layout.addLayout(self.__form_layout, 0, 0) self.__grid_layout.addWidget(self.__source_grid_groupbox, 1, 0) self.__grid_layout.addWidget(self.__target_grid_groupbox, 2, 0) self.__grid_layout.addWidget(self.__system_memory_groupbox, 1, 1, 2, 1) self.setUnstretchable(self.__grid_layout)
def paintEvent(self, event): currentMousePos = self.mapFromGlobal(QtGui.QCursor.pos()) clickPosition = self.mapFromGlobal(self._startPos) if self._startPos is not None else None painter = QtGui.QPainter(self) # monitor background color painter.setBrush(QtGui.QColor(self.backgroundColor.red(), self.backgroundColor.green(), self.backgroundColor.blue(), self._opacity)) painter.setPen(QtCore.Qt.NoPen) painter.drawRect(event.rect()) if clickPosition is not None: rect = QtCore.QRect(clickPosition, currentMousePos) painter.setCompositionMode(QtGui.QPainter.CompositionMode_Clear) painter.drawRect(rect) painter.setCompositionMode(QtGui.QPainter.CompositionMode_SourceOver) painter.drawLine(event.rect().left(), clickPosition.y(), event.rect().right(), clickPosition.y()) painter.drawLine(clickPosition.x(), event.rect().top(), clickPosition.x(), event.rect().bottom()) painter.setPen(self.cropPen) painter.drawLine(event.rect().left(), currentMousePos.y(), event.rect().right(), currentMousePos.y()) painter.drawLine(currentMousePos.x(), event.rect().top(), currentMousePos.x(), event.rect().bottom())
def printPreview(obj, printer=None, parent=None): if printer is None: printer = QtGui.QPrinter(QtGui.QPrinter.PrinterResolution) # @TODO: check if parent is None: try: parent = obj.window() except AttributeError: parent = None dialog = QtGui.QPrintPreviewDialog(printer, parent) dialog.paintRequested.connect(coreprint) ret = dialog.exec_() # @WARNING: duplicate code ret = QtGui.QPrintDialog(printer, parent).exec_() if ret == QtGui.QDialog.Accepted: if isinstance(obj, (QtGui.QTextDocument, QtGui.QTextEdit)): obj.print_(printer) elif hasattr(object, 'model'): model = obj.model() doc = modelToTextDocument(model) obj.print_(printer) elif isinstance(obj, QtCore.QAbstractItemModel): doc = modelToTextDocument(obj) doc.print_(printer) else: coreprint(obj, printer)
def __init__(self, parent, opts, appdb): """ :param QtGui.QWidget parent: Widget parent :param options.structures.Options opts: Current application options :param ApplicationDatabase appdb: Application database object """ super(ImagingView, self).__init__(parent) self.__objective_lens = ObjectiveLensBox(self, opts.imaging_tool) self.__immersion = ImmersionBox(self, opts.imaging_tool) self.__spectrum = SpectrumBox(self, opts.imaging_tool) self.__source_shape = SourceShapeBox(self, opts.imaging_tool, appdb) self.__pupil_filer = PupilFilterBox(self, opts.imaging_tool, appdb) self.__vlayout_left = QtGui.QVBoxLayout() self.__vlayout_left.addWidget(self.__spectrum) self.__vlayout_left.addWidget(self.__source_shape) self.__vlayout_left.addWidget(self.__immersion) self.__vlayout_left.addStretch() # self.__vlayout_middle = QtGui.QVBoxLayout() # self.__vlayout_middle.addStretch() self.__vlayout_right = QtGui.QVBoxLayout() self.__vlayout_right.addWidget(self.__objective_lens) self.__vlayout_right.addWidget(self.__pupil_filer) self.__vlayout_right.addStretch() self.__hlayout = QtGui.QHBoxLayout(self) self.__hlayout.addLayout(self.__vlayout_left) # self.__hlayout.addLayout(self.__vlayout_middle) self.__hlayout.addLayout(self.__vlayout_right) self.__hlayout.addStretch()