def __init__(self): global version self.version = version self.tha = Thread(None, self.chargement) self.app = QApplication(sys.argv) self.win = QMainWindow() x, y = 800, 350 self.pos = center(x, y) self.win.setGeometry(self.pos[0], self.pos[1], x, y) self.win.setWindowTitle("TD2 Projects") self.win.setWindowFlag(Qt.FramelessWindowHint) self.win.show() self.label = QLabel(self.win) self.pixmap = QPixmap('.\\bin\\intro.png') self.label.setPixmap(self.pixmap) self.win.setCentralWidget(self.label) self.win.setWindowIcon(QIcon("./bin/icon.png")) # self.win.resize(self.pixmap.width(), self.pixmap.height()) self.label2 = QLabel(self.win) self.label2.setFont(QFont('Mangal', 11)) self.label2.setStyleSheet("color: white; font-weight: bold;") self.label2.setText("Ouverture en cours... Veuillez Patienter") self.label2.move(10, 295) self.label2.adjustSize() self.label2.show() self.tha.start() self.app.exec_()
def __init__(self, win: QMainWindow, winParent: QWidget, open: QWidget) -> None: """ Tous les utilitaires pour PTProject """ self.win = win self.winParent = winParent self.open = open self.online = Online() self.winParent.setVisible(False) self.win.setWindowTitle("Python Together") self.a, self.b = 1280, 720 self.x, self.y = center(self.a, self.b) self.win.setGeometry(self.x, self.y, self.a, self.b) self.win.show() self.label = QLabel(self.win) self.label.setText("Python Together 0.1") self.label.setFont(QFont('Mangal', 50)) self.label.adjustSize() self.label.show() self.label.move(20,10) self.bouton1 = QPushButton(self.win) self.bouton1.setText("Revenir en arrière") self.bouton1.move(20, 100) self.bouton1.adjustSize() self.bouton1.clicked.connect( lambda: (self.winParent.setVisible(True), self.win.close())) self.bouton1.show() self.winEdit = QWidget(self.win) self.winEdit.setGeometry(0, 120, 1260, 600) self.winEdit.adjustSize() self.winEdit.show() self.layout = QVBoxLayout(self.winEdit) self.textEdit = QTextEdit() # self.text.move(20, 120) self.textEdit.setFont(QFont('Mangal', 15)) self.textEdit.show() self.layout.addWidget(self.textEdit) self.winEdit.setLayout(self.layout) self.menuBar = QMenuBar(self.win) self.win.setMenuBar(self.menuBar) # Menu Bar self.fileMenu = QMenu("&Fichier", self.win) self.openAction = QAction("&Ouvrir", self.win) self.openAction.triggered.connect(self.openproject) self.openAction.setShortcut("Ctrl+O") self.saveAction = QAction("&Sauvegarder", self.win) self.saveAction.triggered.connect(self.saveFile) self.saveAction.setShortcut("Ctrl+S") self.saveOnlineAction = QAction("&Sauver en ligne", self.win) self.saveOnlineAction.triggered.connect(self.saveOnline) self.saveOnlineAction.setShortcut("Ctrl+Shift+S") self.loadOnlineAction = QAction("&Charger en ligne (Soon)", self.win) self.loadOnlineAction.triggered.connect(self.loadOnline) self.loadOnlineAction.setShortcut("Ctrl+Shift+O") self.fileMenu.addAction(self.openAction) self.fileMenu.addAction(self.saveAction) if Donnees.online: self.fileMenu.addAction(self.saveOnlineAction) self.fileMenu.addAction(self.loadOnlineAction) self.menuBar.addMenu(self.fileMenu)
def __init__(self): ##Variables autres global version self.version = version self.files_enregistrement = None self.connected_one = None try: with open("./bin/comptes.spi", "rb") as file: depickle = pickle.Unpickler(file) self.files_enregistrement = depickle.load() except: with open("./bin/comptes.spi", "wb") as file: self.files_enregistrement = {"uadmin": "padmin"} pickler = pickle.Pickler(file) pickler.dump(self.files_enregistrement) ## APPLICATION self.app = QApplication(sys.argv) self.win = QWidget() x, y = 550, 320 self.posx, self.posy = center(x, y) self.win.setGeometry(self.posx, self.posy, x, y) self.win.setWindowTitle("Page de Connexion") self.win.setWindowFlag(Qt.FramelessWindowHint) self.win.setWindowIcon(QIcon("./bin/icon1.png")) self.win.show() self.label1 = QLabel(self.win) self.label1.setText("Connexion") self.label1.move(20, 20) self.label1.setFont(QFont('Mangal', 80)) self.label1.adjustSize() self.label1.show() self.label2 = QLabel(self.win) self.label2.setText("Mauvais identifiants, réessayez.") self.label2.move(260, 150) self.label2.setFont(QFont('Mangal', 11)) self.label2.adjustSize() # self.label2.show() self.label3 = QLabel(self.win) self.label3.setText("Vérification de version en cours...") self.label3.move(260, 190) self.label3.setFont(QFont('Mangal', 11)) self.label3.adjustSize() self.label3.show() self.threadLabel3 = Thread(None, self.version_search) self.threadLabel3.start() self.champ1 = QLineEdit(self.win) self.champ1.move(20, 140) self.champ1.resize(220, 30) self.champ1.show() self.champ2 = QLineEdit(self.win) self.champ2.setEchoMode(QLineEdit.Password) self.champ2.move(20, 180) self.champ2.resize(220, 30) self.champ2.show() self.bouton1 = QPushButton(self.win) self.bouton1.setText(" Se connecter ") self.bouton1.move(20, 220) self.bouton1.setFont(QFont('Mangal', 20)) self.bouton1.clicked.connect(self.connection) self.bouton1.show() self.bouton2 = QPushButton(self.win) self.bouton2.setText(" S'enregistrer ") self.bouton2.move(220, 220) self.bouton2.setFont(QFont('Mangal', 20)) self.bouton2.clicked.connect(self.register_window) self.bouton2.show() self.bouton3 = QPushButton(self.win) self.bouton3.setText("Fermer") self.bouton3.move(20, 270) self.bouton3.setFont(QFont('Mangal', 11)) self.bouton3.clicked.connect(self.quitter) self.bouton3.show() self.bouton4 = QPushButton(self.win) self.bouton4.setText("Télécharger ?") self.bouton4.move(400, 220) self.bouton4.setFont(QFont('Mangal', 20)) self.bouton4.clicked.connect(self.updateDownload) # --------------- Page d'enregistrement -------------- self.win2 = QWidget() x2, y2 = 270, 400 self.posx2, self.posy2 = center(x2, y2) self.win2.setGeometry(self.posx2, self.posy2, x2, y2) self.win2.setWindowTitle("S'enregistrer") self.win2.setWindowIcon(QIcon("./bin/icon1.png")) self.labelWin21 = QLabel(self.win2) self.labelWin21.setText("S'enregistrer") self.labelWin21.move(20, 10) self.labelWin21.setFont(QFont('Mangal', 30)) self.labelWin21.adjustSize() self.labelWin21.show() self.labelWin22 = QLabel(self.win2) self.labelWin22.setText("Nouveau nom d'utilisateur") self.labelWin22.move(20, 70) self.labelWin22.setFont(QFont('Mangal', 12)) self.labelWin22.adjustSize() self.labelWin22.show() self.champWin21 = QLineEdit(self.win2) self.champWin21.setText("username") self.champWin21.move(20, 90) self.champWin21.resize(220, 30) self.champWin21.show() self.labelWin23 = QLabel(self.win2) self.labelWin23.setText("Mot de passe") self.labelWin23.move(20, 130) self.labelWin23.setFont(QFont('Mangal', 12)) self.labelWin23.adjustSize() self.labelWin23.show() self.champWin22 = QLineEdit(self.win2) self.champWin22.setEchoMode(QLineEdit.Password) self.champWin22.move(20, 150) self.champWin22.resize(220, 30) self.champWin22.show() self.labelWin24 = QLabel(self.win2) self.labelWin24.setText("Retapez le mot de passe") self.labelWin24.move(20, 190) self.labelWin24.setFont(QFont('Mangal', 12)) self.labelWin24.adjustSize() self.labelWin24.show() self.champWin23 = QLineEdit(self.win2) self.champWin23.setEchoMode(QLineEdit.Password) self.champWin23.move(20, 210) self.champWin23.resize(220, 30) self.champWin23.show() self.labelWin25 = QLabel(self.win2) self.labelWin25.setText("Retapez le mot de passe") self.labelWin25.move(20, 250) self.labelWin25.setFont(QFont('Mangal', 12)) self.labelWin25.adjustSize() self.boutonWin21 = QPushButton(self.win2) self.boutonWin21.setText("S'enregistrer") self.boutonWin21.move(20, 300) self.boutonWin21.setFont(QFont('Mangal', 13)) self.boutonWin21.clicked.connect(self.register) self.boutonWin21.show() self.app.exec_()
def parameters(self): """ Module des paramètres """ if choicedBackgroundColor() == 1: self.colorText = "color: white;" else: self.colorText = "color: black;" self.win2 = QWidget() x, y = 450, 720 self.x, self.y = center(x, y) self.win2.setGeometry(self.x, self.y, x, y) if not self.isAdmin: self.win2.setWindowTitle(f"Paramètres — {self.user}") elif self.isAdmin: self.win2.setWindowTitle(f"Paramètres — {self.user} (Administrateur)") self.win2.setWindowIcon(QIcon("./bin/icon1")) self.win2.show() self.label02 = QLabel(self.win2) self.label02.move(0, 0) self.label02.resize(x, y) self.label02.setStyleSheet(getBackgroundColor()) self.label02.show() self.label12 = QLabel(self.win2) self.label12.setText("Thème") self.label12.move(20, 20) self.label12.setFont(QFont('Mangal', 15)) self.label12.setStyleSheet(self.colorText) self.label12.adjustSize() self.label12.show() self.radio1 = QRadioButton(self.win2) self.radio1.setText("Mode Sombre") self.radio1.toggled.connect(lambda: setBackgroundColor(1)) self.radio1.setStyleSheet(self.colorText) self.radio1.move(20, 60) if choicedBackgroundColor() == 1: self.radio1.setChecked(True) self.radio1.show() self.radio2 = QRadioButton(self.win2) self.radio2.setText("Mode Clair") self.radio2.toggled.connect(lambda: setBackgroundColor(2)) self.radio2.setStyleSheet(self.colorText) self.radio2.move(20, 80) if choicedBackgroundColor() == 2: self.radio2.setChecked(True) self.radio2.show() self.label22 = QLabel(self.win2) self.label22.setText("Serveur") self.label22.move(20, 110) self.label22.setFont(QFont('Mangal', 15)) self.label22.setStyleSheet(self.colorText) self.label22.adjustSize() self.label22.show() self.champ12 = QLineEdit(self.win2) try: self.champ12.setText(Donnees.serveur_project) except: pass self.champ12.move(20, 140) self.champ12.resize(120, 30) self.champ12.show() self.champ22 = QLineEdit(self.win2) try: self.champ22.setText(str(Donnees.server_ip_port)) except: pass self.champ22.move(150, 140) self.champ22.resize(30, 30) self.champ22.show() self.bouton12 = QPushButton(self.win2) self.bouton12.setText("Appliquer") self.bouton12.move(20, 180) self.bouton12.clicked.connect(self.changeServer) self.bouton12.show() self.label32 = QLabel(self.win2) self.label32.move(110, 180) self.label32.setStyleSheet(self.colorText) self.label32.adjustSize() self.label42 = QLabel(self.win2) self.label42.setText("Vider le dossier log") self.label42.move(20, 220) self.label42.setFont(QFont('Mangal', 15)) self.label42.setStyleSheet(self.colorText) self.label42.adjustSize() self.label42.show() self.bouton22 = QPushButton(self.win2) self.bouton22.setText("Appliquer") self.bouton22.move(20, 250) self.bouton22.clicked.connect(self.supprLogs) self.bouton22.show() self.label52 = QLabel(self.win2) self.label52.move(110, 255) self.label52.setStyleSheet(self.colorText) self.label52.adjustSize()
def __init__(self): self.colorText = "color: black;" if choicedBackgroundColor() == 1: self.colorText = "color: white;" try: self.user = Donnees.current_user['user'] except: self.user = "******" try: self.version = Donnees.version except: self.version = version try: self.isAdmin = Donnees.current_user['admin'] except: self.isAdmin = False self.app = QApplication(sys.argv) self.win = QWidget() x, y = 1280, 720 self.x, self.y = center(x, y) self.win.setGeometry(self.x, self.y, x, y) self.win.setFixedSize(x, y) if not self.isAdmin: self.win.setWindowTitle(f"Projets SPI — {self.user} — {self.version}") elif self.isAdmin: self.win.setWindowTitle(f"Projets SPI — {self.user} — {self.version} (Administrateur)") self.win.setWindowIcon(QIcon("./bin/icon1")) self.win.show() self.label0 = QLabel(self.win) self.label0.move(0, 0) self.label0.resize(x, y) self.label0.setStyleSheet(getBackgroundColor()) self.label0.show() self.v_box = QVBoxLayout() self.v_box.addWidget(self.label0) self.v_box.setSpacing(0) self.v_box.setContentsMargins(QMargins(0,0,0,0)) self.win.setLayout(self.v_box) self.label1 = QLabel(self.win) if self.user != "Hors Ligne": self.label1.setText(f"Bonjour {self.user}") else: self.label1.setText(f"Vous êtes {self.user}") self.label1.setStyleSheet(self.colorText) self.label1.move(20, 20) self.label1.setFont(QFont('Mangal', 50)) self.label1.adjustSize() self.label1.show() self.label2 = QLabel(self.win) if self.user != "Hors Ligne": self.label2.setText(f"Choisissez un projet {self.user}") else: self.label2.setText("Choissisez un projet") self.label2.move(20, 140) self.label2.setFont(QFont('Mangal', 15)) self.label2.setStyleSheet(self.colorText) self.label2.adjustSize() self.label2.show() self.bouton1 = QPushButton(self.win) self.bouton1.setText("Paramètres") self.bouton1.move(900, 20) self.bouton1.clicked.connect(self.parameters) self.bouton1.show() if self.isAdmin: self.boutonadmin = QPushButton(self.win) self.boutonadmin.setText("Gestions Utilisateurs") self.boutonadmin.move(900, 60) self.boutonadmin.clicked.connect(self.management) self.boutonadmin.adjustSize() self.boutonadmin.show() self.bouton2 = QPushButton(self.win) self.bouton2.setText("Python Together") self.bouton2.setFont(QFont('Mangal', 20)) self.bouton2.move(40, 210) self.bouton2.clicked.connect(self.pythonTogether) self.bouton2.adjustSize() self.bouton2.show() self.bouton3 = QPushButton(self.win) self.bouton3.setText("Voiture télécommandée") self.bouton3.setEnabled(False) self.bouton3.setFont(QFont('Mangal', 20)) self.bouton3.move(40, 260) self.bouton3.clicked.connect(self.pythonTogether) self.bouton3.adjustSize() self.bouton3.show() self.label3 = QLabel(self.win) self.label3.setText("Projets en cours :\n * Python Together (Projet à ses débuts)\n * Voiture télécommandée") self.label3.move(40, 320) self.label3.setFont(QFont('Mangal', 15)) self.label3.setStyleSheet(self.colorText) self.label3.adjustSize() self.label3.show() self.label4 = QLabel(self.win) if Donnees.online: self.label4.setText(Recver.monIp()) self.label4.move(1050, 20) self.label4.setStyleSheet(self.colorText) self.label4.show() sys.exit(self.app.exec_())
def __init__(self): ## Variables autres ----------------------- global version self.colorText = "" if sys.platform == "win32": self.colorText = "color: #334d9b" if choicedBackgroundColor() == 1: self.colorText = "color: white;" self.version = version self.files_enregistrement = None self.connected_one = None self.ftp = Online() # self.ftp.downloadftp("comptes.spi") self.ftp.downloadftp("admin.spi") try: with open("./bin/comptes.spi", "rb") as file: depickle = pickle.Unpickler(file) self.files_enregistrement = depickle.load() Donnees.comptes = self.files_enregistrement except: with open("./bin/comptes.spi", "wb") as file: pickler = pickle.Pickler(file) pickler.dump({"uadmin": "padmin"}) Donnees.comptes, self.files_enregistrement = { "uadmin": "padmin" } ## APPLICATION ---------------------------- self.app = QApplication(sys.argv) self.win = QWidget() x, y = 650, 320 self.posx, self.posy = center(x, y) self.win.setGeometry(self.posx, self.posy, x, y) self.win.setWindowTitle("Page de Connexion") self.win.setWindowFlag(Qt.FramelessWindowHint) self.win.setWindowIcon(QIcon("./bin/icon1.png")) self.win.show() self.label0 = QLabel(self.win) self.label0.move(0, 0) self.label0.resize(x, y) self.label0.setStyleSheet(getBackgroundColor()) self.label0.show() self.label1 = QLabel(self.win) self.label1.setText("Choix") self.label1.move(20, 10) self.label1.setFont(QFont('Mangal', 80)) self.label1.setStyleSheet(self.colorText) self.label1.adjustSize() self.label1.show() self.label2 = QLabel(self.win) self.label2.setText("Mauvais identifiants, réessayez.") self.label2.move(260, 150) self.label2.setFont(QFont('Mangal', 11)) self.label2.adjustSize() # self.label2.show() self.label3 = QLabel(self.win) self.label3.setText("Vérification de version en cours...") self.label3.move(20, 190) self.label3.setFont(QFont('Mangal', 11)) self.label3.setStyleSheet(self.colorText) self.label3.adjustSize() self.label3.show() self.threadLabel3 = Thread(None, self.version_search) self.threadLabel3.start() self.champ1 = QLineEdit(self.win) self.champ1.move(20, 140) self.champ1.resize(220, 30) self.champ1.setFont(QFont('Mangal', 15)) # self.champ1.show() self.champ2 = QLineEdit(self.win) self.champ2.setEchoMode(QLineEdit.Password) self.champ2.move(20, 180) self.champ2.setFont(QFont('Mangal', 15)) self.champ2.resize(220, 30) # self.champ2.show() self.bouton1 = QPushButton(self.win) self.bouton1.setText(" Se connecter ") self.bouton1.move(20, 220) self.bouton1.setFont(QFont('Mangal', 20)) self.bouton1.clicked.connect(self.connection) self.openAction = QAction("&ouvrir", self.win) self.openAction.setShortcut("Return") self.openAction.triggered.connect(self.connection) self.win.addAction(self.openAction) # self.bouton1.show() self.bouton2 = QPushButton(self.win) self.bouton2.setText(" S'enregistrer ") self.bouton2.move(220, 220) self.bouton2.setFont(QFont('Mangal', 20)) self.bouton2.clicked.connect(self.register_window) # self.bouton2.show() self.bouton3 = QPushButton(self.win) self.bouton3.setText("Fermer") self.bouton3.move(20, 270) self.bouton3.setFont(QFont('Mangal', 11)) self.bouton3.clicked.connect(self.quitterNet) self.bouton3.show() self.bouton4 = QPushButton(self.win) self.bouton4.setText("Télécharger ?") self.bouton4.move(400, 220) self.bouton4.setFont(QFont('Mangal', 20)) self.bouton4.setStyleSheet(self.colorText) self.bouton4.clicked.connect(self.updateDownload) self.radio1 = QRadioButton(self.win) self.radio1.setText("En Ligne") self.radio1.move(120, 275) self.radio1.setStyleSheet(self.colorText) self.radio1.adjustSize() self.radio1.toggled.connect(self.onlineOrNot) self.radio1.show() self.radio2 = QRadioButton(self.win) self.radio2.setText("Hors Ligne") self.radio2.move(200, 275) self.radio2.setStyleSheet(self.colorText) self.radio2.adjustSize() self.radio2.toggled.connect(self.onlineOrNot) self.radio2.show() # --------------- Page d'enregistrement -------------- self.win2 = QWidget() x2, y2 = 270, 400 self.posx2, self.posy2 = center(x2, y2) self.win2.setGeometry(self.posx2, self.posy2, x2, y2) self.win2.setWindowTitle("S'enregistrer") self.win2.setWindowIcon(QIcon("./bin/icon1.png")) self.labelWin21 = QLabel(self.win2) self.labelWin21.setText("S'enregistrer") self.labelWin21.move(20, 10) self.labelWin21.setFont(QFont('Mangal', 30)) self.labelWin21.adjustSize() self.labelWin21.show() self.labelWin22 = QLabel(self.win2) self.labelWin22.setText("Nouveau nom d'utilisateur") self.labelWin22.move(20, 70) self.labelWin22.setFont(QFont('Mangal', 12)) self.labelWin22.adjustSize() self.labelWin22.show() self.champWin21 = QLineEdit(self.win2) self.champWin21.setText("username") self.champWin21.move(20, 90) self.champWin21.resize(220, 30) self.champWin21.show() self.labelWin23 = QLabel(self.win2) self.labelWin23.setText("Mot de passe") self.labelWin23.move(20, 130) self.labelWin23.setFont(QFont('Mangal', 12)) self.labelWin23.adjustSize() self.labelWin23.show() self.champWin22 = QLineEdit(self.win2) self.champWin22.setEchoMode(QLineEdit.Password) self.champWin22.move(20, 150) self.champWin22.resize(220, 30) self.champWin22.show() self.labelWin24 = QLabel(self.win2) self.labelWin24.setText("Retapez le mot de passe") self.labelWin24.move(20, 190) self.labelWin24.setFont(QFont('Mangal', 12)) self.labelWin24.adjustSize() self.labelWin24.show() self.champWin23 = QLineEdit(self.win2) self.champWin23.setEchoMode(QLineEdit.Password) self.champWin23.move(20, 210) self.champWin23.resize(220, 30) self.champWin23.show() self.labelWin25 = QLabel(self.win2) self.labelWin25.setText("Retapez le mot de passe") self.labelWin25.move(20, 250) self.labelWin25.setFont(QFont('Mangal', 12)) self.labelWin25.adjustSize() self.boutonWin21 = QPushButton(self.win2) self.boutonWin21.setText("S'enregistrer") self.boutonWin21.move(20, 300) self.boutonWin21.setFont(QFont('Mangal', 13)) self.boutonWin21.clicked.connect(self.register) self.boutonWin21.show() self.app.exec_()
def __init__(self): self.colorText = "color: black;" if choicedBackgroundColor() == 1: self.colorText = "color: white;" try: self.user = Donnees.current_user['user'] except: self.user = "******" try: self.version = Donnees.version except: self.version = version try: self.isAdmin = Donnees.current_user['admin'] except: self.isAdmin = False self.app = QApplication(sys.argv) self.win = QWidget() x, y = 1280, 720 self.x, self.y = center(x, y) self.win.setGeometry(self.x, self.y, x, y) if not self.isAdmin: self.win.setWindowTitle( f"Projets SPI — {self.user} — {self.version}") elif self.isAdmin: self.win.setWindowTitle( f"Projets SPI — {self.user} — {self.version} (Administrateur)" ) self.win.setWindowIcon(QIcon("./bin/icon1")) self.win.show() self.boutonBckColor = "" if choicedBackgroundColor() == 1: self.colorText = "color: white;" self.win.setStyleSheet(getBackgroundColor()) self.boutonBckColor = "background-color: #202729;" self.label1 = QLabel(f"Vous êtes {self.user}", self.win) self.label1.setStyleSheet(self.colorText) self.label1.setFont(QFont('Mangal', 50)) self.label2 = QLabel("Choissisez un projet", self.win) if self.user != "Hors Ligne": self.label2.setText(f"Choisissez un projet {self.user}") self.label1.setText(f"Bonjour {self.user}") self.label2.setFont(QFont('Mangal', 15)) self.label2.setStyleSheet(self.colorText) self.bouton1 = QPushButton("Paramètres", self.win) self.bouton1.setStyleSheet(self.colorText + self.boutonBckColor) self.bouton1.clicked.connect(self.parameters) self.bouton1.setFixedWidth(100) if self.isAdmin: self.boutonadmin = QPushButton(self.win) self.boutonadmin.setText("Gestions Utilisateurs") self.boutonadmin.move(900, 60) self.boutonadmin.setStyleSheet(self.colorText + self.boutonBckColor) self.boutonadmin.clicked.connect(self.management) #self.boutonadmin.adjustSize() self.boutonadmin.setFixedWidth(100) #self.boutonadmin.show() self.bouton2 = QPushButton("Python Together", self.win) self.bouton2.setFont(QFont('Mangal', 20)) self.bouton2.setStyleSheet(self.colorText + self.boutonBckColor) self.bouton2.clicked.connect(self.pythonTogether) self.bouton2.setFixedWidth(400) self.bouton3 = QPushButton("Voiture Télécommandée", self.win) self.bouton3.setEnabled(False) self.bouton3.setFont(QFont('Mangal', 20)) self.bouton3.setStyleSheet("color: gray;" + self.boutonBckColor) # self.bouton3.clicked.connect(self.pythonTogether) self.bouton3.setFixedWidth(400) self.label3 = QLabel( "Projets en cours :\n * Python Together (Projet à ses débuts)\n * Voiture télécommandée", self.win) self.label3.setFont(QFont('Mangal', 15)) self.label3.setStyleSheet(self.colorText) self.label4 = QLabel(self.win) if Donnees.online: self.label4.setText(Recver.monIp()) self.label4.setStyleSheet(self.colorText) grid_layout = QGridLayout() self.win.setLayout(grid_layout) grid_layout.addWidget(self.label1, 0, 0, 1, 4) grid_layout.addWidget(self.label2, 2, 0, 1, 1) grid_layout.addWidget(self.bouton1, 0, 5, 1, 1) grid_layout.addWidget(self.bouton2, 4, 0, 1, 1) grid_layout.addWidget(self.bouton3, 5, 0, 1, 1) grid_layout.addWidget(self.label3, 6, 0, 1, 1) if self.isAdmin: grid_layout.addWidget(self.boutonadmin, 1, 5, 1, 1) grid_layout.addWidget(self.label4, 0, 4, 1, 1) grid_layout.setContentsMargins(40, 20, 20, 20) sys.exit(self.app.exec_())
def parameters(self): """ Module des paramètres """ self.win2 = QWidget() x, y = 450, 720 self.x, self.y = center(x, y) self.win2.setGeometry(self.x, self.y, x, y) if not self.isAdmin: self.win2.setWindowTitle(f"Paramètres — {self.user}") elif self.isAdmin: self.win2.setWindowTitle( f"Paramètres — {self.user} (Administrateur)") self.win2.setWindowIcon(QIcon("./bin/icon1")) self.win2.show() self.label12 = QLabel("Thème", self.win2) self.label12.setFont(QFont('Mangal', 15)) self.radio1 = QRadioButton("Mode Sombre", self.win2) self.radio1.toggled.connect(lambda: setBackgroundColor(1)) self.radio2 = QRadioButton("Mode Clair", self.win2) self.radio2.toggled.connect(lambda: setBackgroundColor(2)) self.label22 = QLabel("Serveur", self.win2) self.label22.setFont(QFont('Mangal', 15)) self.champ12 = QLineEdit(self.win2) try: self.champ12.setText(Donnees.serveur_project) except: pass self.champ12.setFixedWidth(120) self.champ22 = QLineEdit(self.win2) try: self.champ22.setText(str(Donnees.server_ip_port)) except: pass self.champ22.setFixedWidth(30) self.bouton12 = QPushButton("Appliquer", self.win2) self.bouton12.clicked.connect(self.changeServer) self.bouton12.setFixedWidth(100) self.label32 = QLabel(self.win2) self.label42 = QLabel("Vider le dossier log", self.win2) self.label42.setFont(QFont('Mangal', 15)) self.bouton22 = QPushButton("Appliquer", self.win2) self.bouton22.clicked.connect(self.supprLogs) self.bouton22.setFixedWidth(100) self.label52 = QLabel(self.win2) if choicedBackgroundColor() == 1: self.colorText = "color: white;" self.win2.setStyleSheet(getBackgroundColor()) self.radio1.setChecked(True) else: self.colorText = "color: black;" self.radio2.setChecked(True) self.label12.setStyleSheet(self.colorText) self.radio1.setStyleSheet(self.colorText) self.radio2.setStyleSheet(self.colorText) self.label22.setStyleSheet(self.colorText) self.champ12.setStyleSheet(self.colorText) self.champ22.setStyleSheet(self.colorText) self.bouton12.setStyleSheet(self.colorText + self.boutonBckColor) self.label42.setStyleSheet(self.colorText) self.bouton22.setStyleSheet(self.colorText + self.boutonBckColor) self.label52.setStyleSheet(self.colorText) self.label32.setStyleSheet(self.colorText) self.h_box1 = QHBoxLayout() self.h_box1.addWidget(self.champ12) self.h_box1.addWidget(self.champ22) self.h_box1.addStretch() self.h_box2 = QHBoxLayout() self.h_box2.addWidget(self.bouton12) self.h_box2.addWidget(self.label32) self.h_box2.addStretch() self.h_box3 = QHBoxLayout() self.h_box3.addWidget(self.bouton22) self.h_box3.addWidget(self.label52) self.h_box3.addStretch() self.v_box = QVBoxLayout() self.v_box.addWidget(self.label12) self.v_box.addWidget(self.radio1) self.v_box.addWidget(self.radio2) self.v_box.addWidget(self.label22) self.v_box.addLayout(self.h_box1) self.v_box.addLayout(self.h_box2) self.v_box.addWidget(self.label42) self.v_box.addLayout(self.h_box3) self.v_box.addStretch() self.win2.setLayout(self.v_box)