def __init__(self): self.montage = Montages() self.choices = { "1": self.montage_dir, "2": self.montage_from_csv, "3": self.img_scatter, "4": self.image_hist_from_csv, "5": self.quit }
def initUI(self): # create a class object self.setStyleSheet('QPushButton {font-family: cursive, sans-serif; font-weight: 300; font-size: 14px; color: #CD853F; }') self.montage = Montages() # create buttons createPath = QPushButton(self) createPath.setText("Choose the directory of your photos") createPath.clicked.connect(self.cPath) savePath = QPushButton(self) savePath.setText("Choose the directory to save your plot") savePath.clicked.connect(self.sPath) create = QPushButton(self) create.setText("Create plot") create.clicked.connect(self.createPlot) # set layout sbox = QGridLayout(self) sbox.addWidget(createPath, 1, 0) sbox.addWidget(savePath, 2, 0) sbox.addWidget(create, 3, 1) self.setLayout(sbox) # set background as transparent palette = QPalette() palette.setBrush(QPalette.Background,QBrush(QPixmap())) self.setPalette(palette)
def __init__(self, parent=None): #Constructor super(ImageHistFromCSV, self).__init__(parent) self.montage = Montages() self.error = Error(self) self.createLabel = QPushButton( 'Provide full path to csv file for creating image histogram', self) QPushButtonStyleStr = 'QPushButton{ background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #eafaf1, stop: 1 #d5f5e3); } \ QPushButton:hover{ background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #b4e6ed, stop: 1 #a6e3ec); } \ QPushButton:pressed{ background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #b4e6ed, stop: 1 #60c1dc);}' self.createLabel.setStyleSheet(QPushButtonStyleStr) self.createLabel.setFixedWidth(350) self.createLabel.clicked.connect(self.showPathToCreate) self.orLabel1 = QLabel("or", self) self.orLabel1.setAlignment(QtCore.Qt.AlignCenter) self.browse1 = QPushButton("Browse", self) self.browse1.setStyleSheet(QPushButtonStyleStr) self.browse1.clicked.connect(self.getCSVPath) self.createPath = QLabel("Path: ", self) self.saveLabel = QPushButton( 'Provide full path and filename to save image histogram', self) self.saveLabel.setStyleSheet(QPushButtonStyleStr) self.saveLabel.setFixedWidth(350) self.saveLabel.clicked.connect(self.showPathToSave) self.orLabel2 = QLabel("or", self) self.orLabel2.setAlignment(QtCore.Qt.AlignCenter) self.browse2 = QPushButton("Browse", self) self.browse2.setStyleSheet(QPushButtonStyleStr) self.browse2.clicked.connect(self.getOutputPath) self.savePath = QLabel("Path: ", self) self.spacer = QLabel("", self) self.apply = QPushButton("Apply", self) self.apply.setStyleSheet(QPushButtonStyleStr) self.apply.setFixedWidth(200) self.apply.clicked.connect(self.createHist) self.backToMenu = QPushButton("Back To Menu", self) self.backToMenu.setStyleSheet(QPushButtonStyleStr) self.backToMenu.setFixedWidth(200) self.backToMenu.clicked.connect(self.close) self.message = QLabel(self) self.layout1 = QVBoxLayout(self) layout2 = QHBoxLayout() layout3 = QHBoxLayout() layout4 = QHBoxLayout() layout2.addWidget(self.createLabel) layout2.addWidget(self.orLabel1) layout2.addWidget(self.browse1) self.layout1.addLayout(layout2) self.layout1.addWidget(self.createPath) layout3.addWidget(self.saveLabel) layout3.addWidget(self.orLabel2) layout3.addWidget(self.browse2) self.layout1.addLayout(layout3) self.layout1.addWidget(self.savePath) self.layout1.addWidget(self.spacer) layout4.addWidget(self.apply) layout4.addWidget(self.backToMenu) self.layout1.addLayout(layout4) self.layout1.addWidget(self.message) self.setGeometry(590, 475, 350, 150) self.setWindowTitle('Option 4') self.inputPath = "" self.outputPath = ""