def __init__(self, parent, table, document): DialogBase.__init__(self, "Find", ok=False, cancel=True, modal=False, parent=parent) self.table = table self.document = document self.cancelButton.setText("Close") findBox = QtWidgets.QGroupBox("Find") findLayout = QtWidgets.QGridLayout() findBox.setLayout(findLayout) findLayout.addWidget(QtWidgets.QLabel("Search For:"), 0, 0) self.findText = QtWidgets.QLineEdit() findLayout.addWidget(self.findText, 0, 1) self.next = QtWidgets.QPushButton("Next") self.next.released.connect(self.slotNext) self.previous = QtWidgets.QPushButton("Previous") self.previous.released.connect(self.slotPrevious) findLayout.addWidget(self.next, 0, 2) findLayout.addWidget(self.previous, 1, 2) self.caseCheck = QtWidgets.QCheckBox("Case sensitive") findLayout.addWidget(self.caseCheck, 1, 0) self.addWidget(findBox) self.lastC = None self.lastRow = None self.lastText = None
def __init__(self, view): DialogBase.__init__(self, "Adjust Contrast", parent=view, cancel=True, ok=True, modal=False, apply=True, user1=True) self.view = view curDoc = self.view.getCurrentDocument() self.setWindowTitle("Adjust Contrast - " + str(curDoc.getURL().getFileName())) brightRange = curDoc.getBrightRange() histograms = curDoc.getHistogram() self.tabWidget = QtGui.QTabWidget() self.addWidget(self.tabWidget) self.redChooser = ContrastChooser(None, "Red", histograms[0], brightRange[0]) self.greenChooser = ContrastChooser(None, "Green", histograms[1], brightRange[1]) self.blueChooser = ContrastChooser(None, "Blue", histograms[2], brightRange[2]) self.tabWidget.addTab(self.redChooser, "Red") self.tabWidget.addTab(self.greenChooser, "Green") self.tabWidget.addTab(self.blueChooser, "Blue") self.setUser1ButtonText("Auto")
def __init__(self, parent, document, model): DialogBase.__init__(self, "New/Edit", ok=True, cancel=True, modal=True, parent=parent) self.document = document self.model = model entryBox = QtWidgets.QGroupBox("Entry") boxLayout = QtWidgets.QGridLayout() entryBox.setLayout(boxLayout) boxLayout.addWidget(QtWidgets.QLabel("Name:"), 0, 0) self.name = QtWidgets.QLineEdit() boxLayout.addWidget(self.name, 0, 1) boxLayout.addWidget(QtWidgets.QLabel("Username:"******"Password:"******"Show") self.showCheck.toggled.connect(self.slotShowCheck) boxLayout.addWidget(self.showCheck, 3, 0) self.generateButton = QtWidgets.QPushButton("Generate") self.generateButton.released.connect(self.slotGenerate) boxLayout.addWidget(self.generateButton, 3, 1) boxLayout.addWidget(QtWidgets.QLabel("Comment:"), 4, 0) self.comment = QtWidgets.QLineEdit() boxLayout.addWidget(self.comment, 4, 1) self.addWidget(entryBox) self.row = None
def __init__(self, parent): DialogBase.__init__(self, "Settings", ok=True, cancel=True, apply=True, parent=parent, modal=True) tabWidget = QtGui.QTabWidget() self.general = GeneralSettingsWidget() tabWidget.addTab(self.general, "General") self.addWidget(tabWidget)
def __init__(self, parent, document): DialogBase.__init__(self, "Delete Entry", ok=True, cancel=True, modal=True, parent=parent) self.document = document self.okButton.setText("Yes") self.cancelButton.setText("No") self.label = QtWidgets.QLabel( "Are you sure you want to remove \"Entryname\"?") self.addWidget(self.label)
def __init__(self, view, currentIndex, otherIndex): DialogBase.__init__(self, "Align Image(2)", parent=view, cancel=True, user2=True, user1=True, modal=True) self.view = view self.step = 0 self.currentIndex = currentIndex self.otherIndex = otherIndex print "AlignDialog2 docindex=" + str(otherIndex) self.setUser1ButtonText("Next") self.setUser2ButtonText("Back") self.enableUser1Button(False) w = QtGui.QWidget() layout = QtGui.QVBoxLayout() w.setLayout(layout) self.instructions = QtGui.QLabel( "Select the first star from each image.") layout.addWidget(self.instructions) hlayout = QtGui.QHBoxLayout() layout.addLayout(hlayout) self.scrollArea1 = QtGui.QScrollArea(self) self.scrollView1 = AlignScrollWidget(w, self.view, currentIndex) self.scrollArea1.setWidget(self.scrollView1) hlayout.addWidget(self.scrollArea1) self.scrollArea2 = QtGui.QScrollArea(self) self.scrollView2 = AlignScrollWidget(w, self.view, otherIndex) self.scrollArea2.setWidget(self.scrollView2) hlayout.addWidget(self.scrollArea2) self.scrollView1.mouseRelease.connect(self.release1) self.scrollView2.mouseRelease.connect(self.release2) hlayout = QtGui.QHBoxLayout() layout.addLayout(hlayout) hlayout.setSpacing(3) radiusLabel = QtGui.QLabel("Radius:") hlayout.addWidget(radiusLabel) self.radiusBox = QtGui.QSpinBox() self.radiusBox.setMinimum(1) self.radiusBox.setMaximum(100) self.radiusBox.setValue(3) hlayout.addWidget(self.radiusBox) self.addWidget(w)
def __init__(self, parent): DialogBase.__init__(self, "About AstroBuffer", cancel=True, parent=parent, modal=True) w = QtGui.QWidget() layout = QtGui.QVBoxLayout(w) label1 = QtGui.QLabel("AstroBuffer 0.13") label1.font().setPointSize(label1.font().pointSize() * 2) label1.font().setBold(True) layout.addWidget(label1) tabWidget = QtGui.QTabWidget() layout.addWidget(tabWidget) aboutLabel = QtGui.QLabel( "\n\nAstrophotography software\n\nCopyright (C) 2007,2008 Russell Valentine\n\[email protected]") aboutLabel.setAlignment(QtCore.Qt.AlignHCenter) tabWidget.addTab(aboutLabel, "About") licenseWidget = LicenseWidget() tabWidget.addTab(licenseWidget, "License") self.addWidget(w) self.setCancelButtonText("Close")
def __init__(self, view): DialogBase.__init__(self, "RGB Image", ok=True, cancel=True, modal=True, parent=view) self.view = view w = QtGui.QWidget() grid = QtGui.QGridLayout(w) # Red redGroup = QtGui.QGroupBox("Red") redLayout = QtGui.QVBoxLayout() self.rDocChooser = ChooseDocScrollView(view) redLayout.addWidget(self.rDocChooser) redGroup.setLayout(redLayout) grid.addWidget(redGroup, 0, 0) # Green greenGroup = QtGui.QGroupBox("Green") greenLayout = QtGui.QVBoxLayout() self.gDocChooser = ChooseDocScrollView(view) greenLayout.addWidget(self.gDocChooser) greenGroup.setLayout(greenLayout) grid.addWidget(greenGroup, 0, 1) # Blue blueGroup = QtGui.QGroupBox("Blue") blueLayout = QtGui.QVBoxLayout() self.bDocChooser = ChooseDocScrollView(view) blueLayout.addWidget(self.bDocChooser) blueGroup.setLayout(blueLayout) grid.addWidget(blueGroup, 1, 0) # Luminance luminanceGroup = QtGui.QGroupBox("Luminance") luminanceLayout = QtGui.QVBoxLayout() luminanceGroup.setLayout(luminanceLayout) self.lDocChooser = ChooseDocScrollView(view) luminanceLayout.addWidget(self.lDocChooser) self.useLuminance = QtGui.QCheckBox("Use Luminance") luminanceLayout.addWidget(self.useLuminance) grid.addWidget(luminanceGroup, 1, 1) self.addWidget(w)
def __init__(self, parent): DialogBase.__init__(self, "Config", ok=True, cancel=True, modal=False, parent=parent) tabWidget = QtWidgets.QTabWidget() self.genTab = GeneralConfigWidget() tabWidget.addTab(self.genTab, "General") self.advTab = AdvancedConfigWidget() tabWidget.addTab(self.advTab, "Advanced") self.addWidget(tabWidget) self.parent = parent self.rejected.connect(self.slotRej) self.genTab.readConfig() self.advTab.readConfig()
def __init__(self, parent, document, model): DialogBase.__init__(self, "Import without saving?", ok=True, cancel=True, modal=True, parent=parent) self.document = document self.model = model self.okButton.setText("Yes") self.cancelButton.setText("No") self.label = QtWidgets.QLabel( "Import file without saving current document?") self.addWidget(self.label) self.file = None self.delim = None self.quote = None
def __init__(self, parent, document, model): DialogBase.__init__(self, "Import CSV", ok=True, cancel=True, modal=True, parent=parent) self.document = document self.model = model csvBox = QtWidgets.QGroupBox("CSV") cboxLayout = QtWidgets.QGridLayout() csvBox.setLayout(cboxLayout) cboxLayout.addWidget(QtWidgets.QLabel("Delimiter:"), 0, 0) delimiterButtonGroup = QtWidgets.QButtonGroup() self.delimiterTab = QtWidgets.QRadioButton("Tab") self.delimiterTab.toggled.connect(self.slotDelimiterTab) cboxLayout.addWidget(self.delimiterTab, 0, 1, 1, 2) self.delimiterOther = QtWidgets.QRadioButton("Other") self.delimiterOther.setChecked(True) cboxLayout.addWidget(self.delimiterOther, 1, 1) delimiterButtonGroup.addButton(self.delimiterTab) delimiterButtonGroup.addButton(self.delimiterOther) self.delimiter = QtWidgets.QLineEdit() self.delimiter.setText(",") cboxLayout.addWidget(self.delimiter, 1, 2) self.quoteCheck = QtWidgets.QCheckBox("Quote:") self.quoteCheck.setChecked(True) self.quoteCheck.toggled.connect(self.slotQuoteCheck) cboxLayout.addWidget(self.quoteCheck, 2, 0) self.quote = QtWidgets.QLineEdit() self.quote.setText("\"") cboxLayout.addWidget(self.quote, 2, 1, 1, 2) self.file = None self.addWidget(csvBox) self.importConfirmDialog = ImportCSVConfirmDialog( self, document, model)
def __init__(self, view): DialogBase.__init__(self, "Align Image (1)", cancel=True, user1=True, modal=True, parent=view) self.view = view self.setUser1ButtonText("Next") w = QtGui.QWidget() layout = QtGui.QVBoxLayout() w.setLayout(layout) infoLabel = QtGui.QLabel("Select an image to align against.") layout.addWidget(infoLabel) self.scrollView = ChooseDocScrollView(view, [view.getCurrentDocIndex()]) layout.addWidget(self.scrollView) self.addWidget(w)
def __init__(self, view): DialogBase.__init__(self, "Align Image (2) - Make Center", cancel=True, user1=True, modal=True, parent=view) self.view = view self.step = 0 self.currentIndex = self.view.getCurrentDocIndex() self.setUser1ButtonText("Center") self.enableUser1Button(False) w = QtGui.QWidget() layout = QtGui.QVBoxLayout() w.setLayout(layout) self.instructions = QtGui.QLabel("Select an object to center.") layout.addWidget(self.instructions) hlayout = QtGui.QHBoxLayout() layout.addLayout(hlayout) self.scrollView1 = AlignScrollWidget(w, self.view, self.currentIndex) self.scrollArea1 = QtGui.QScrollArea(self) self.scrollArea1.setWidget(self.scrollView1) hlayout.addWidget(self.scrollArea1) self.scrollView1.mouseRelease.connect(self.release1) hlayout = QtGui.QHBoxLayout() layout.addLayout(hlayout) hlayout.setSpacing(3) hlayout.addWidget(QtGui.QLabel("Radius:")) self.radiusBox = QtGui.QSpinBox() self.radiusBox.setMinimum(1) self.radiusBox.setMaximum(100) self.radiusBox.setValue(3) hlayout.addWidget(self.radiusBox) self.addWidget(w)
def __init__(self, parent): DialogBase.__init__(self, "About PasswordManager", cancel=True, parent=parent, modal=True) w = QtWidgets.QWidget() layout = QtWidgets.QVBoxLayout(w) label1 = QtWidgets.QLabel("PasswordManager 0.05") label1.font().setPointSize(label1.font().pointSize() * 2) label1.font().setBold(True) layout.addWidget(label1) tabWidget = QtWidgets.QTabWidget() layout.addWidget(tabWidget) aboutLabel = QtWidgets.QLabel( "\n\nPasswordManager software\n\nCopyright (C) 2010,2020,2022 Russell Valentine\n\[email protected]" ) aboutLabel.setAlignment(QtCore.Qt.AlignHCenter) tabWidget.addTab(aboutLabel, "About") licenseWidget = LicenseWidget() tabWidget.addTab(licenseWidget, "License") self.addWidget(w) self.setCancelButtonText("Close")
def __init__(self, view): DialogBase.__init__(self, "Adjust Contrast", parent=view, cancel=True, ok=True, modal=False, apply=True, user1=True) self.view = view curDoc = self.view.getCurrentDocument() self.setWindowTitle("Adjust Contrast - " + str(curDoc.getURL().getFileName())) brightRange = curDoc.getBrightRange() histogram = curDoc.getHistogram() tabWidget = QtGui.QTabWidget() self.addWidget(tabWidget) self.chooser = ContrastChooser(None, "Selection", histogram, brightRange) tabWidget.addTab(self.chooser, "Contrast") self.setUser1ButtonText("Auto")
def __init__(self, parent): DialogBase.__init__(self, "Key Selector", ok=True, cancel=True, modal=True, parent=parent) self.parent = parent keyBox = QtWidgets.QGroupBox("Select Key") keyLayout = QtWidgets.QGridLayout() keyBox.setLayout(keyLayout) self.model = KeyTableModel(self) self.table = QtWidgets.QTableView() self.table.setModel(self.model) self.table.setSortingEnabled(False) self.table.setCornerButtonEnabled(False) self.table.setSelectionMode( QtWidgets.QAbstractItemView.SingleSelection) self.table.horizontalHeader().setSectionResizeMode( QtWidgets.QHeaderView.Stretch) keyLayout.addWidget(self.table, 0, 0) self.addWidget(keyBox)
def __init__(self, view): DialogBase.__init__(self, "Convolution Dialog", cancel=True, ok=True, modal=True, parent=view) # XXX: Fix infinite set radius loop self.view = view w = QtGui.QWidget() hbox = QtGui.QHBoxLayout(w) self.lbox = QtGui.QListWidget() hbox.addWidget(self.lbox) self.lbox.addItem(GaussianBlurItem()) self.lbox.addItem(LoGItem()) self.lbox.addItem(ZerosItem()) hbox.addWidget(self.lbox) bcustom = BlankCustomItem() self.lbox.addItem(bcustom) self.lboxpopup = QtGui.QMenu(self.lbox) delete = QtGui.QAction("Delete", self.lboxpopup, triggered=self.slotDeleteItem) self.lboxpopup.addAction(delete) self.customItems = self.readItemsConfig() for item in self.customItems: self.lbox.addItem(item) # XXX: Load items from config self.lbox.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.lbox.itemSelectionChanged.connect(self.selectionChanged) self.lbox.customContextMenuRequested.connect(self.doLboxPopup) vbox = QtGui.QVBoxLayout() hbox.addLayout(vbox) # table self.table = MatrixTable() vbox.addWidget(self.table) self.table.radiusChanged.connect(self.selectionChanged) # Radius hbox2 = QtGui.QHBoxLayout() vbox.addLayout(hbox2) hbox2.addWidget(QtGui.QLabel("Radius:")) self.radius = QtGui.QSpinBox() self.radius.setMinimum(1) self.radius.setMaximum(50) hbox2.addWidget(self.radius) self.radius.valueChanged.connect(self.table.setRadius) # Stddev hbox3 = QtGui.QHBoxLayout() vbox.addLayout(hbox3) self.stddevLabel = QtGui.QLabel("Standard Deviation:") hbox3.addWidget(self.stddevLabel) self.stddev = QtGui.QDoubleSpinBox() self.stddev.setMinimum(0.0) self.stddev.setMaximum(100.0) self.stddev.setSingleStep(0.01) self.stddev.setValue(1.0) hbox3.addWidget(self.stddev) self.stddev.valueChanged.connect(self.selectionChanged) # Sum=1 self.sumCheckBox = QtGui.QCheckBox("Make sum of matrix equal one") vbox.addWidget(self.sumCheckBox) # Label hbox3 = QtGui.QHBoxLayout() vbox.addLayout(hbox3) hbox3.addWidget(QtGui.QLabel("Label:")) self.label = QtGui.QLineEdit() hbox3.addWidget(self.label) self.saveButton = QtGui.QPushButton() self.saveButton.setText("Save") hbox3.addWidget(self.saveButton) self.saveButton.clicked.connect(self.saveItem) self.addWidget(w) # Set to custom self.lbox.setCurrentItem(bcustom)
def __init__(self, parent): DialogBase.__init__(self, "Adjust Contrast", ok=True, apply=True, cancel=True, user1=True, modal=False, parent=parent) self.parent = parent curDoc = self.parent.getCurrentDocument() # TESTING if curDoc.getURL == None: print "url is none" print curDoc.getURL() print curDoc.getURL().getFileName() # END TEST self.setWindowTitle("Adjust Contrast - " + str(curDoc.getURL().getFileName())) max = curDoc.getHistogram().shape[0] brightRange = curDoc.getBrightRange() self.setUser1ButtonText("Auto") w = QtGui.QWidget() layout = QtGui.QVBoxLayout() w.setLayout(layout) page = self.makeVBoxMainWidget() self.qhist1 = Qwt5.QwtPlot(Qwt5.QwtText("Entire Image")) layout.addWidget(self.qhist1) self.curve1 = Qwt5.QwtPlotCurve("Entire Image") self.curve1.attach(self.qhist1) self.curve1.setData( range(len(curDoc.getHistogram())), numpy.clip(curDoc.getHistogram(), 1, curDoc.getHistogram().max())) # set data and set zeros to ones because the logarithmic graphing does weird stuff with the zeros self.qhist1.setAxisTitle(Qwt5.QwtPlot.xBottom, "Pixel Value") self.qhist1.setAxisTitle(Qwt5.QwtPlot.yLeft, "Number of Pixels") self.qhist1.setAxisScaleEngine(Qwt5.QwtPlot.yLeft, Qwt5.QwtLog10ScaleEngine()) self.qhist1.replot() self.qhist2 = Qwt5.QwtPlot(Qwt5.QwtText("Selection")) layout.addWidget(self.qhist2) self.curve2 = Qwt5.QwtPlotCurve("Selection") self.curve2.attach(self.qhist2) tmpHist = curDoc.getHistogram() t2m = int(brightRange[0]) t2ma = int(brightRange[1] + 1) self.curve2.setData( range(t2m, t2ma), numpy.clip(tmpHist[t2m:t2ma], 1, tmpHist[t2m:t2ma].max())) self.qhist2.setAxisTitle(Qwt5.QwtPlot.xBottom, "Pixel Value") self.qhist2.setAxisTitle(Qwt5.QwtPlot.yLeft, "Number of Pixels") self.qhist2.setAxisScaleEngine(Qwt5.QwtPlot.yLeft, Qwt5.QwtLog10ScaleEngine()) self.qhist2.replot() # Blue marker historgram 1 self.blue1min = Qwt5.QwtPlotMarker() self.blue1min.setLineStyle(Qwt5.QwtPlotMarker.VLine) self.blue1min.setLinePen(QtGui.QPen(Qt.blue, 1, Qt.DashDotLine)) self.blue1min.setValue(t2m, 1) self.blue1min.attach(self.qhist1) self.blue1max = Qwt5.QwtPlotMarker() self.blue1max.setLineStyle(Qwt5.QwtPlotMarker.VLine) self.blue1max.setLinePen(QtGui.QPen(Qt.blue, 1, Qt.DashDotLine)) self.blue1max.setValue(t2ma, 1) self.blue1max.attach(self.qhist1) self.qhist1.replot() # Bluemarker histogram 2 self.blue2min = Qwt5.QwtPlotMarker() self.blue2min.setLineStyle(Qwt5.QwtPlotMarker.VLine) self.blue2min.setLinePen(QtGui.QPen(Qt.blue, 1, Qt.DashDotLine)) self.blue2min.setValue(t2m, 1) self.blue2min.attach(self.qhist2) self.blue2max = Qwt5.QwtPlotMarker() self.blue2max.setLineStyle(Qwt5.QwtPlotMarker.VLine) self.blue2max.setLinePen(QtGui.QPen(Qt.blue, 1, Qt.DashDotLine)) self.blue2max.setValue(t2ma, 1) self.blue2max.attach(self.qhist2) self.qhist2.replot() hlayout = QtGUI.QHBoxLayout() layout.addLayout(hlayout) minLabel = QtGui.QLabel("Min:") hlayout.addWidget(minLabel) self.minSlider = QtGui.QSlider() self.minSlider.setMinimum(0) self.minSlider.setMaximum(max) self.minSlider.setValue(brightRange[0]) self.minSlider.setOrientation(Qt.Horizontal) hlayout.addWidget(self.minSlider) layout.addWidget(w1) hlayout = QtGui.QHBoxLayout() layout.addLayout(hlayout) hlayout.addWidget(QtGui.QLabel("Max:")) self.maxSlider = QtGui.QSlider() self.maxSlider.setMinimum(0) self.maxSlider.setMaximum(max) self.maxSlider.setValue(brightRange[1]) self.maxSlider.setOrientation(Qt.Horizontal) hlayout.addWidget(self.maxSlider) hlayout = QtGui.QHBoxLayout() layout.addLayout(hlayout) self.allCheck = QtGui.QCheckBox("Changes Effect All Images") hlayout.addWidget(self.allCheck) # QLabel("Changes Effect All Images", bottomBox) hlayout = QtGui.QGridLayout() layout.addLayout(hlayout) hlayout.addWidget(QtGui.QLabel("Min:"), 0, 0) self.minSpinBox = QtGui.QSpinBox() self.minSpinBox.setMinimum(0) self.minSpinBox.setMaximum(max) self.minSpinBox.setValue(brightRange[0]) hlayout.addWidget(self.minSpinBox, 0, 1) hlayout.addWidget(QtGui.QLabel("Max:"), 1, 0) self.maxSpinBox = QSpinBox() self.maxSpinBox.setMinimum(0) self.maxSpinBox.setMaximum(max) self.maxSpinBox.setValue(brightRange[1]) self.minSlider.sliderMoved.connect(self.minSpinBox.setValue) self.maxSlider.sliderMoved.connect(self.maxSpinBox.setValue) self.minSpinBox.valueChanged.connect(self.minSlider.setValue) self.maxSpinBox.valueChanged.connect(self.maxSlider.setValue) self.minSpinBox.valueChanged.connect(self.slotChangeHist) self.maxSpinBox.valueChanged.connect(self.slotChangeHist) self.addWidget(w)