def __init__(self, parent=None): ToolWidget.__init__(self, 'Fit', parent) QtCore.QAbstractTableModel.__init__(self) self.setupUi(self) self.HKL=[] self.scores=[] self.runParams={} self.paramModel=ParamModel(self) self.fitModel=FitModel(self) self.paramView.setModel(self.paramModel) self.markerView.setModel(self.fitModel) self.markerView.verticalHeader().setDefaultSectionSize(self.markerView.fontMetrics().height()) #self.paramView.horizontalHeader().setResizeMode(QtGui.QHeaderView.Stretch) #self.markerView.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents) self.markerView.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents) for n in (6, 7): self.markerView.horizontalHeader().setResizeMode(n, QtGui.QHeaderView.Stretch) self.connect(self.paramModel, QtCore.SIGNAL('modelReset()'), self.paramView.expandAll) self.connect(self.indexButton, QtCore.SIGNAL('pressed()'), self.doIndexing) self.connect(self.fitButton, QtCore.SIGNAL('pressed()'), self.doFit)
def __init__(self, parent): ToolWidget.__init__(self, 'Image Transver Curve', parent) self.setupUi(self) self.connect(self.ColorSelector, QtCore.SIGNAL('activated(int)'), self.colorSelChanged) self.toDelete=[] # PlotDisplay Setup self.gs=QtGui.QGraphicsScene() self.gs.setSceneRect(0, 0, 1, 1) self.gs.setItemIndexMethod(QtGui.QGraphicsScene.NoIndex) self.gv.setScene(self.gs) #self.gv.translate(0, -1) self.gv.scale(1, -1) self.gv.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.gv.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.gv.setRenderHints(QtGui.QPainter.Antialiasing|QtGui.QPainter.SmoothPixmapTransform) self.gv.setCacheMode(QtGui.QGraphicsView.CacheBackground) self.gv.setTransformationAnchor(QtGui.QGraphicsView.AnchorUnderMouse) linePen=QtGui.QPen(QtCore.Qt.DashLine) linePen.setColor(QtCore.Qt.gray) for d in (0.0, 0.25, 0.5, 0,.75, 1.0): self.gs.addLine(0, d, 1, d, linePen) self.gs.addLine(d, 0, d, 1, linePen) self.gv.fitInView(0, 0, 1, 1) self.toolBar.addAction(QtGui.QIcon(':/fileopen.png'), 'Load Curve', self.loadCurves) self.toolBar.addAction(QtGui.QIcon(':/filesave.png'), 'Save Curve', self.saveCurves) self.toolBar.addAction(QtGui.QIcon(':/flip_horizontal.png'), 'Flip Horizontal', self.flipH) self.toolBar.addAction(QtGui.QIcon(':/flip_vertical.png'), 'Flip Vertical', self.flipV) self.toolBar.addAction(QtGui.QIcon(':/rotate_right.png'), 'Rotate Clockwise', self.rotCW) self.toolBar.addAction(QtGui.QIcon(':/rotate_left.png'), 'Rotate Anti-Clockwise', self.rotCCW) self.transferCurves=[] self.transferCurveMarkers=[[], [], [], []] self.bezierCurves=[] for i, c in enumerate([QtCore.Qt.black, QtCore.Qt.red, QtCore.Qt.green, QtCore.Qt.blue]): tc=self.gs.addPath(QtGui.QPainterPath()) p=QtGui.QPen(c) p.setCosmetic(True) tc.setPen(p) self.transferCurves.append(tc) self.transferCurveMarkers[i].append(self.newMarker(0, 0)) self.transferCurveMarkers[i].append(self.newMarker(1, 1)) self.bezierCurves.append(BezierCurve()) for m in self.transferCurveMarkers[i]: m.setBoundingBox(QtCore.QRectF(m.pos().x(), 0, 0, 1)) m.setCursor(QtGui.QCursor(QtCore.Qt.SizeVerCursor)) self.updateTransferCurve(i) self.renewTransferCurveMarkers() self.makeScales() QtCore.QTimer.singleShot(0, self.doResize)
def __init__(self, parent=None): super(FileTableView, self).__init__(parent) self.setAcceptDrops(True) self.model_data = [[]] self.valid_ext = get_valid_ext() main_layout = QHBoxLayout(self) main_layout.setSpacing(0) main_layout.setContentsMargins(0, 0, 0, 0) group_box = QGroupBox() main_layout.addWidget(group_box) group_layout = QVBoxLayout(group_box) group_layout.setSpacing(0) group_layout.setContentsMargins(0, 0, 0, 0) self.tool_widget = ToolWidget(self) self.table_view = QTableView() self.table_view.verticalHeader().hide() self.table_view.horizontalHeader().hide() self.table_view.setSelectionMode(QListWidget.ExtendedSelection) self.table_view.setSelectionBehavior(QAbstractItemView.SelectColumns) self.remove_action = QAction("remove", self) self.add_action = QAction("add", self) self.table_view.setContextMenuPolicy(Qt.ActionsContextMenu) self.table_view.addAction(self.remove_action) self.table_view.addAction(self.add_action) group_layout.addWidget(self.tool_widget) group_layout.addWidget(self.table_view) self.resize(500, 80) self.set_signals()
def __init__(self, parent=None): ToolWidget.__init__(self, 'Rotate', parent) self.setupUi(self) self.connect(self.axisChooser, QtCore.SIGNAL('activated(int)'), self.indexChanged) self.connect(self.axisEdit, QtCore.SIGNAL('editingFinished()'), self.indexChanged) self.indexChanged() bgroup=QtGui.QButtonGroup(self) bgroup.setExclusive(False) bgroup.addButton(self.butArbPos, 10) bgroup.addButton(self.but5Pos, 5) bgroup.addButton(self.but1Pos, 1) bgroup.addButton(self.but1Neg, -1) bgroup.addButton(self.but5Neg, -5) bgroup.addButton(self.butArbNeg, -10) self.connect(bgroup, QtCore.SIGNAL('buttonClicked(int)'), self.addRotation) self.connect(self.resetButton, QtCore.SIGNAL('clicked()'), self.resetSum) self.angSum=0.0 self.lastcrystal=None self.indexChanged()
def __init__(self, parent=None): super(FileListView, self).__init__(parent) self.model = FileListModel([], self) main_layout = QVBoxLayout(self) main_layout.setSpacing(0) main_layout.setContentsMargins(0, 0, 0, 0) group_box = QGroupBox() main_layout.addWidget(group_box) group_layout = QVBoxLayout(group_box) group_layout.setSpacing(0) group_layout.setContentsMargins(0, 0, 0, 0) self.tool_widget = ToolWidget(self) self.list_view = QListView() self.list_view.setSelectionMode(QListWidget.ExtendedSelection) self.list_view.setModel(self.model) self.setAcceptDrops(True) group_layout.addWidget(self.tool_widget) group_layout.addWidget(self.list_view) self.set_signals()
def __init__(self, parent=None): ToolWidget.__init__(self, 'Reflexinfo', parent) self.setupUi(self)