Example #1
0
    def open(self):
        """
        Ouvre un document si son extension est valide.
        Appelle la fonction parent pour ouvrir un fichier.

        :rtype: None
        """
        path = self.model.filePath(self.currentIndex())
        name = self.model.fileName(self.currentIndex())
        ext = name.split(".")[-1]

        dir_ = stat.filemode(os.stat(path).st_mode)[0] == "d"
        executable = "x" in stat.filemode(os.stat(path).st_mode)[:4]

        if ext in [i[1:] for i in var.extension_by_language[self.fenetre.project_type]] + [i[1:] for i in var.txt_extentions]:
            self.fenetre.open(path)
        elif ext in [i[1:] for i in var.imgs_extentions]:
            self.fenetre.open_img(path)
        elif ext in [i[1:] for i in var.gif_extentions]:
            self.fenetre.open_gif(path)
        elif dir_:
            pass#temp
        elif executable:
            execute.exec_(path)
        else:
            QMessageBox.critical(self.fenetre, get_text("opening_fail"), get_text("opening_fail_text"))
Example #2
0
    def __init__(self):
        super().__init__()

        self.save = False

        layout = QVBoxLayout()

        self.setWindowTitle(get_text("close_without_save_title"))

        lbl = QLabel(text=get_text("close_without_save"))
        layout.addWidget(lbl)

        layout_btn = QHBoxLayout()

        btn_save = QPushButton(text=get_text("save"))
        btn_save.clicked.connect(self.save_cls)
        layout_btn.addWidget(btn_save)

        btn_dont_save = QPushButton(text=get_text("dont_save"))
        btn_dont_save.clicked.connect(self.dont_save_cls)
        layout_btn.addWidget(btn_dont_save)

        layout.addLayout(layout_btn)

        self.setLayout(layout)
Example #3
0
    def valider(self):

        if self.est_configuration_valide():
            self.est_valide = True
            self.done(0)
        else:
            QMessageBox.critical(self, get_text("text_erreur"), get_text("comp_enter_good"))
Example #4
0
def open_document(parent, chemin, secu=False):
    if parent.project_path != "":
        if not chemin:
            chemin = QFileDialog.getOpenFileName(parent, get_text("ouverture_2"), parent.project_path, var.file_by_language[parent.project_type] + ";;" + var.txt_extentions_filedialog)[0]
        if chemin != "" and parent.project_path in chemin:
            if not parent.deja_ouvert(chemin):
                title = chemin.split("/")[-1]
                parent.add_code(title, current_ext=chemin.split(".")[-1])
                parent.status_message(get_text("ouverture_de")+title, 2000)  # Message de status
                parent.docs += [Document(parent, parent.codes[-1], chemin, True)]
                
                parent.highlighters[-1].first_launch = False
                parent.highlighters[-1].cache_name = parent.docs[-1].chemin_enregistrement.replace("/", "_")
                parent.codes[-1].highlight_by_block()

                parent.tab_widget.setCurrentIndex(len(parent.codes) - 1)
                parent.defaut_info_message()
            else:
                for i in range(len(parent.docs)):
                    if parent.docs[i].chemin_enregistrement == chemin:
                        parent.tab_widget.setCurrentIndex(i)
                        break
        elif chemin != "":
            if not secu:
                open_project_and_document(parent, chemin)
    else:
        if not secu  and chemin:
            open_project_and_document(parent, chemin)
Example #5
0
def delete_project_cache(parent, project_path):
    if project_path != "":
        project_name = project_path.split("/")[-1]
        for file in os.listdir("cache/"):
            if project_name in file.split("_"):
                os.remove("cache/%s" % file)
        parent.status_message(get_text("cleared_local_cache"))
    else:
        parent.status_message(get_text("text_please_open_project"))
Example #6
0
 def pre_analyse(self):
     """
     Fonction appellée lors du clic sur le bouton analyse.
     Si un document est ouvert, on appelle la fonction analyse() de Editeur
     """
     index = self.get_idx()
     if index == -1:
         self.status_message(get_text("text_please_open_doc"))
     else:
         self.codes[index].analyse()
         self.status_message(get_text("status_fic_analys"))
Example #7
0
 def assist_voc(self):
     """
     Active ou désactive l'assistance vocale et écrit la configuration actuelle dans un fichier XML.
     """
     if "darwin" in sys.platform:
         configuration = open_xml("conf.xml")
         if configuration['assistance_vocale'] == 'True':
             self.status_message(get_text("status_voc_des"))
             write_xml("conf.xml", "assistance_vocale", "False")
         else:
             write_xml("conf.xml", "assistance_vocale", "True")
             self.status_message(get_text("status_voc_activ"))
Example #8
0
def new_document(parent):
    """
    Créé un nouveau document
    :type parent: QWidget
    :param parent: Le parent
    """
    new = get_text("nom_new_fic") + str(len(parent.docs) + 1)
    parent.status_message((get_text("new_file") + new), 2000)
    parent.defaut_info_message()
    parent.add_code(new, True, current_ext="")
    parent.docs += [Document(parent, parent.codes[-1], "")]
    parent.tab_widget.setCurrentIndex(len(parent.codes) - 1)
Example #9
0
    def __init__(self, parent):
        """
        Fonction permettant l'affichage de la fenêtre des informations de projet.
        """
        super().__init__()

        self.parent = parent

        self.valider = False
        self.cancel = False
        self.modification = False
        self.appliquer = False

        self.setWindowTitle(get_text("select_infos_project"))

        self.layout = QVBoxLayout()
        self.buttons_layout = QHBoxLayout()

        self.name = QLabel("")
        self.creation_date = QLabel("")
        self.language = QLabel("")
        self.location = QLabel("")
        self.number_files = QLabel("")

        self.project_name = QComboBox()
        for e in os.listdir(self.parent.workplace_path):
            if e != ".DS_Store" and e != ".conf":
                self.project_name.addItem(e)

        self.cancel_button = QPushButton(get_text("cancel"))
        self.valider_button = QPushButton(get_text("select"))
        self.modification_button = QPushButton(get_text("modify"))
        self.appliquer_button = QPushButton(get_text("apply"))

        self.cancel_button.clicked.connect(self.cancel_action)
        self.valider_button.clicked.connect(self.valider_action)
        self.modification_button.clicked.connect(self.modification_action)
        self.appliquer_button.clicked.connect(self.appliquer_action)

        self.layout.addWidget(self.project_name)

        self.buttons_layout.addWidget(self.cancel_button)
        self.buttons_layout.addWidget(self.valider_button)
        self.layout.addLayout(self.buttons_layout)

        self.setLayout(self.layout)

        self.activateWindow()
        self.valider_button.setFocus()
Example #10
0
 def show_cheminee(self):
     """
     Affiche ou masque la cheminée.
     """
     if self.cheminee.height() == 1:
         self.fire = QMovie("content/fireplace.gif")
         self.cheminee.setMovie(self.fire)
         self.cheminee.setFixedHeight(260)
         self.fire.start()
         self.status_message(get_text("status_cheminee_on"))
     else:
         self.cheminee.setFixedHeight(1)
         self.fire.stop()
         self.cheminee.clear()
         self.status_message(get_text("status_cheminee_off"))
Example #11
0
    def close_current_tab(self):
        """
        Fonction pour fermer l'onglet courant.

        :rtype: None
        """
        if self.count(
        ) != 0:  # On vérifie que la liste d'onglet n'est pas vide.

            idx = self.currentIndex()

            doc = self.parent.docs[idx]
            code = self.parent.codes[idx]
            highlighter = self.parent.highlighters[idx]

            if not doc.is_saved():
                close = CloseDialog()
                close.exec()
                if close.save:
                    document.save_document(self.parent)

            if self.parent.get_current_widget_used() in ("Inspecteur",
                                                         "Inspector"):
                self.parent.change_affichage(
                )  # On remplace l'Inspecteur par le navigateur si il était actif
            self.removeTab(idx)

            self.parent.docs.remove(doc)
            self.parent.codes.remove(code)
            self.parent.highlighters.remove(highlighter)

            self.parent.status_message(get_text("status_fic_closed"))
            self.parent.defaut_info_message()
Example #12
0
    def change_worplace_location(self):
        """
        Change l'emplacement du workplace
        """
        self.docs = []
        self.highlighters = []
        self.codes = []
        self.tab_widget.clear()
        self.project_path = ""

        widgets = [("Navigateur", "TreeView"), ("Inspecteur", "Inspector")]
        actual = self.bouton_change.text()

        if actual in widgets[1]:  # Affichage du navigateur de fichiers
            self.treeview.setMaximumHeight(
                self.ecran.screenGeometry().height())
            self.inspecteur.setMaximumHeight(1)

        chemin = QFileDialog.getExistingDirectory(
            self, get_text("chg_worplace"), self.workplace_path).replace(
                "\\", "/") + "/"
        print(chemin)
        if chemin != "/":
            self.treeview.change_worplace(chemin)
            self.workplace_path = chemin
            write_xml("conf.xml", "current_workplace", chemin)
Example #13
0
    def show_number_of_lines(self):
        """
        Affiche le nombre de lignes dans l'infoBar (ainsi que sur le côté du code si on le souhaite).

        Pour l'affichage sur le côté on utilise un Thread qui va envoyer un signal pour actualiser l'affichage.
        """
        prev = self.last
        self.last = 0
        idx = self.tab_widget.currentIndex()
        if idx in range(len(self.docs)) and len(
                self.docs) > 0:  # On affiche le nombre de lignes
            nblignes = self.docs[idx].get_nb_lignes()
            self.infobar.showMessage(
                str(nblignes) + get_text("infobar_line") + "s" *
                (nblignes != 1))

            self.nb_lignes.retirer_erreurs()

            if nblignes != prev:
                self.nb_lignes.clear()
                self.update_lines_number = parallele.LinesActualise(
                    self, nblignes, self.anim_line)
                self.update_lines_number.start()
            else:
                self.last = prev

        else:  # On efface le nombre de lignes
            self.infobar.clearMessage()
            self.nb_lignes.clear()
Example #14
0
    def __init__(self):
        super().__init__(get_text("comp_opt"))

        self.options = []
        layout = QGridLayout()

        pipe_option = QCheckBox("-pipe")
        layout.addWidget(pipe_option, 0, 0)
        self.options += [pipe_option]

        pas_lien_option = QCheckBox("-c")
        layout.addWidget(pas_lien_option, 0, 1)
        self.options += [pas_lien_option]

        supp_avert_option = QCheckBox("-w")
        layout.addWidget(supp_avert_option, 0, 2)
        self.options += [supp_avert_option]

        W_option = QCheckBox("-W")
        layout.addWidget(W_option, 0, 3)
        self.options += [W_option]

        Wall_option = QCheckBox("-Wall")
        layout.addWidget(Wall_option, 1, 0)
        self.options += [Wall_option]

        Werror_option = QCheckBox("-Werror")
        layout.addWidget(Werror_option, 1, 1)
        self.options += [Werror_option]

        verbose_option = QCheckBox("-v")
        layout.addWidget(verbose_option, 1, 2)
        self.options += [verbose_option]

        self.setLayout(layout)
Example #15
0
def open_project(parent, name=False):

    if not name:
        idx = parent.currentIndex()
        name = parent.model.fileName(parent.currentIndex())

    if QDir(parent.fenetre.workplace_path + name).exists():

        parent.collapseAll()
        parent.expand(parent.currentIndex())

        parent.fenetre.docs = []
        parent.fenetre.highlighters = []
        parent.fenetre.codes = []
        parent.fenetre.tab_widget.clear()

        parent.fenetre.show_progress_bar()

        parent.fenetre.project_path = parent.fenetre.workplace_path + name
        project_files = get_project_files(parent.fenetre.project_path + "/")

        if os.path.exists("%s/%s.xml" %
                          (parent.fenetre.project_path,
                           parent.fenetre.project_path.split("/")[-1])):
            parent.fenetre.project_type = project_language(
                "%s/%s.xml" % (parent.fenetre.project_path,
                               parent.fenetre.project_path.split("/")[-1]))
        else:
            QMessageBox.critical(parent, get_text("invalid_project"),
                                 get_text("please_import"))
            return

        memory = Mem()

        gdf = ProgressOpening(ProgressWin, project_files, memory, parent)
        gdf.start()  # Processing of the opening project function
        disp_gdf = ProgressDisp(memory, parent)
        disp_gdf.start()  # Displays of the files studied
        parent.fenetre.show_img()
        """
        # Problèmes de plantage du serveur graphique sur Linux lors de la modification du GUI via un Thread
        ProgressWin(project_files, memory)
        parent.function_declarations.emit(memory.res)
        """

    else:
        parent.open()
Example #16
0
    def __init__(self, name):
        super().__init__()

        self.setWindowTitle(get_text("rename_btn"))

        self.valid = False

        layout = QVBoxLayout()

        self.line_name = QLineEdit(text=name)
        layout.addWidget(self.line_name)

        btn_valider = QPushButton(text=get_text("rename_btn"))
        btn_valider.clicked.connect(self.validate)
        layout.addWidget(btn_valider)

        self.setLayout(layout)
Example #17
0
 def __change_language_to(self, l):
     """
     Change la langue actuelle
     :param l: nouvelle langue
     """
     if language.get_current_language() != l:
         write_xml("conf.xml", "language", l)
         self.master.status_message(get_text("chang_lang"))
Example #18
0
def save_document(parent):
    if parent.project_path != "":
        idx = parent.tab_widget.currentIndex()
        if idx != -1:
            if parent.docs[idx].chemin_enregistrement == "":
                chemin = \
                    QFileDialog.getSaveFileName(parent, get_text("save_file"), parent.project_path, var.file_by_language[parent.project_type] + ";;" + var.txt_extentions_filedialog)[0]
                if chemin != "" and parent.project_path in chemin:
                    parent.docs[idx].set_chemin_enregistrement(chemin)
                    parent.docs[idx].sauvegarde_document(chemin)
                    parent.docs[idx].maj_ext()
                    parent.tab_widget.setTabText(idx, parent.docs[idx].nom)

                    parent.status_message(parent.docs[idx].nom+get_text("save_complete"), 2000)
                    # Message de statut


                elif parent.project_path in chemin:
                    QMessageBox.critical(parent, get_text("save_failed"), get_text("save_fail_text"))
            else:
                parent.docs[idx].sauvegarde_document()
                parent.status_message(parent.docs[idx].nom+get_text("save_complete"), 2000)

    else:
        QMessageBox.critical(parent, get_text("no_project_on"), get_text("text_please_open_project"))
Example #19
0
def newproject(parent):
    """
    Fonction associée au bouton pour créer un nouveau projet.
    """
    np = NewProject()
    np.exec()
    project_name = np.get_project_name()
    project_lang = np.get_project_lang()
    cancel = np.cancel
    valider = np.valider

    while (project_name == ''
           or "/" in project_name) and not cancel and valider:
        QMessageBox.critical(parent, get_text("text_erreur"),
                             get_text("proj_name_fail"))
        np = NewProject()
        np.exec()
        project_name = np.get_project_name()
        project_lang = np.get_project_lang()
        cancel = np.cancel
        valider = np.valider

    if not QDir(parent.workplace_path + project_name).exists() and not cancel:
        QDir(parent.workplace_path).mkpath(project_name)

        create_xml(
            "%s/%s.xml" %
            (QDir(parent.workplace_path + project_name).path(), project_name))

        date = str(datetime.now())
        path = "%s/%s.xml" % (QDir(parent.workplace_path +
                                   project_name).path(), project_name)
        project_nb_files = get_nb_files(parent, project_name)

        update_infos(parent, path, project_name, date, project_lang,
                     project_nb_files)
        project_location = parent.workplace_path + project_name
        add_projects_xml(project_name, project_lang, project_location, date,
                         project_nb_files)

    # elif parent.project_path[1]:
    elif not cancel and valider:
        QMessageBox.critical(parent, get_text("text_erreur"),
                             get_text("proj_choose_other"))
        parent.new_project()
Example #20
0
    def __init__(self):
        """
        Créé l'affichage pour la fenêtre de création de projet.
        """
        super().__init__()

        self.cancel = False
        self.valider = False

        self.setWindowTitle(get_text("proj_choice"))

        self.layout = QVBoxLayout()
        self.buttons_layout = QHBoxLayout()

        self.lbl_line_edit = QLabel(get_text("proj_name"))

        self.line_edit = QLineEdit()

        self.project_name_lang = QComboBox()
        self.project_name_lang.addItem("Python")
        self.project_name_lang.addItem("C")
        self.project_name_lang.addItem("Arithmétique")

        self.cancel_button = QPushButton(get_text("cancel"))
        self.valider_button = QPushButton(get_text("create"))

        self.cancel_button.clearFocus()
        self.valider_button.setFocus()

        self.cancel_button.clicked.connect(self.cancel_action)
        self.valider_button.clicked.connect(self.valider_action)

        self.layout.addWidget(self.lbl_line_edit)
        self.layout.addWidget(self.line_edit)
        self.layout.addWidget(self.project_name_lang)

        self.buttons_layout.addWidget(self.cancel_button)
        self.buttons_layout.addWidget(self.valider_button)
        self.layout.addLayout(self.buttons_layout)

        self.setLayout(self.layout)

        self.activateWindow()
        self.valider_button.setFocus()
Example #21
0
 def show_nb_found(self, text):
     """
     Affiche le nombre de propositions trouvées au total lors de la recherche d'un terme
     :param text: Mot recherché
     :type text: str
     """
     n = self.codes[self.get_idx()].toPlainText().count(text)
     self.info_message(
         str(n) + " occurrence%s %s '%s'" %
         ("s" * (n != 1), get_text("infobar_de"), text))
Example #22
0
    def load_project(self, declarators):
        """
        Calls open_project() in workplace module using a thread.

        :return:
        """
        if declarators != (None, None, None):
            self.fenetre.def_functions, self.fenetre.def_structs, self.fenetre.def_vars = declarators
            self.fenetre.status_message(get_text("project_opened"))
            self.fenetre.hide_progress_bar()
Example #23
0
    def change_affichage(self):
        """
        Change l'outil affiché sur la zone de gauche

        0: Navigateur de fichiers
        1: Inspecteurs d'éléments.
        """
        if self.get_idx() == -1:
            self.status_message(get_text("text_please_open_doc"))
        else:
            widgets = [("Navigateur", "TreeView"), ("Inspecteur", "Inspector")]
            text_widgets = {
                "Navigateur": get_text("text_bout_insp"),
                "TreeView": get_text("text_bout_insp"),
                "Inspecteur": get_text("text_bout_nav"),
                "Inspector": get_text("text_bout_nav")
            }
            # On récupère le texte en fonction de la langue.

            actual = self.bouton_change.text()
            self.bouton_change.setText(text_widgets[actual])
            self.status_message(self.bouton_change.text() +
                                get_text("text_chang_bout") + actual)

            if actual in widgets[0]:  # Affichage de l'inspecteur
                self.get_definitions()
                self.inspecteur.setMaximumHeight(
                    self.ecran.screenGeometry().height())
                self.inspecteur.load()
                self.inspecteur.maj_style()
                self.treeview.setMaximumHeight(1)
            elif actual in widgets[1]:  # Affichage du navigateur de fichiers
                self.treeview.setMaximumHeight(
                    self.ecran.screenGeometry().height())
                self.inspecteur.setMaximumHeight(1)
Example #24
0
    def __init__(self, parent, chemin):
        """
        Fonction permettant l'affichage de la fenêtre des informations de projet dans le menu clic droit du navigateur de projets.
        """
        super().__init__()

        self.parent = parent
        self.setWindowTitle(get_text("info_project"))

        self.layout = QVBoxLayout()

        project_name = chemin.split("/")[-1]
        path = "%s/%s.xml" % (chemin, project_name)
        update_nb_files(parent, path, project_name)
        project = open_xml(path)
        self.name = QLabel(get_text("project_name") + project["name"])
        self.language = QLabel(
            get_text("project_language") + project["language"])
        self.location = QLabel(get_text("project_location") + chemin)
        self.creation_date = QLabel(
            get_text("project_creation_date") + project["creation_date"])
        self.number_files = QLabel(
            get_text("project_number_files") + project["number_files"])

        self.layout.addWidget(self.name)
        self.layout.addWidget(self.language)
        self.layout.addWidget(self.location)
        self.layout.addWidget(self.creation_date)
        self.layout.addWidget(self.number_files)

        self.setLayout(self.layout)

        self.activateWindow()

        def get_project(self):
            """
            Fonction permettant de récupérer le nom du projet.
            """
            return self.project_name.currentText()  #.replace("é","e").lower()

        def get_project_name(self):
            """
            Fonction permettant de récupérer le nom du projet.
            """
            return self.name.text()

        def get_project_lang(self):
            """
            Fonction permettant de récupérer le langage du projet.
            """
            return self.language.currentText()  #.replace("é","e").lower()

        def keyPressEvent(self, event):
            """
            Fonction associée au bouton échap.
            """
            if event.key() == 16777216:
                self.done(0)
            super().keyPressEvent(event)
Example #25
0
def compiler(parent):

    xml_path = "%s/%s.xml"%(parent.project_path, parent.project_path.split("/")[-1])

    configuration = xml.project_compil(xml_path)

    if configuration == "":
        configuration_compilation(parent)
        configuration = xml.project_compil(xml_path)
        if configuration == "":
            return False

    curt = os.getcwd()
    os.chdir(parent.project_path)

    if parent.project_type in var.inter_lang:

        execute.exec_(configuration, True)

    else:
        out, res = Popen(configuration, shell=True, stdout=PIPE, stderr=PIPE).communicate()
        out, res = out.decode("utf-8"), res.decode("utf-8")

    os.chdir(curt)

    if parent.project_type in var.compil_lang:
        if res != "":
            erreurs = get_erreurs(res, parent.project_path)
            afficher_erreurs(parent, erreurs)

            dialogErreur = DialogErreurs(erreurs)
            dialogErreur.exec()
        else:
            QMessageBox.about(parent, get_text("comp_res"), get_text("comp_ok"))
            config_json = json.loads(xml.project_compil_json(xml_path))
            if config_json[-1]: # lancer après la compilation ?
                name = "a.out" if config_json[4] == "" else config_json[4] # Nom du fichier
                os.system("%s/%s"%(parent.project_path, name))
Example #26
0
    def __init__(self, parent):
        """
        Creates a small window with a line to enter a word or an expression that you want to find if it exists in your
        code tab.
        It uses a signal "searchEvent" that is connected to a function not related with this class which will do the
        searching operation.

        :param parent: Object parent which is calling the function (Fenetre)
        :type parent: Fenetre
        :rtype: None
        """
        super().__init__(parent)

        self.parent = parent

        self.layout = QVBoxLayout()

        self.line_edit = QLineEdit()
        self.case_sensitive_checkbox = QCheckBox(text="Case sensitive")
        self.case_sensitive_checkbox.setChecked(True)
        self.prev_button = QPushButton(text=get_text("prev"))
        self.next_button = QPushButton(text=get_text("suiv"))

        self.setStyleSheet(style.get("buttons", "window", "check_box", "line_edit"))

        self.prev_button.clicked.connect(self.research_prev)
        self.next_button.clicked.connect(self.research_next)

        self.button_layout = QHBoxLayout()

        self.button_layout.addWidget(self.prev_button)
        self.button_layout.addWidget(self.next_button)

        self.layout.addWidget(self.line_edit)
        self.layout.addWidget(self.case_sensitive_checkbox)
        self.layout.addLayout(self.button_layout)

        self.setLayout(self.layout)
Example #27
0
    def mousePressEvent(self, event):
        """
        On crée un nouvel onglet de code lorsqu'on double-clique sur la page vide (si on n'a pas d'onglet déjà ouvert)
        et si on projet est ouvert.

        :param event: Contient les positions x et y de l'endroit où on a cliqué. NON UTILISÉ ICI.
        :rtype: None
        """
        if len(self.parent.docs) == 0:
            if self.parent.project_path != "":
                self.parent.new()
            else:
                self.parent.status_message(
                    get_text("text_please_open_project"))
Example #28
0
    def new(self):
        """
        Fonction de création de nouveau fichier reliée au sous-menu "Nouveau".
        On ajoute ici un nouvel onglet à nos codes déjà ouverts ( ou on créée un premier onglet )
        qui s'appelle par défaut "Sans nom" + le numéro courant dans la liste des onglets.
        On appelle la fonction self.addCode()

        :rtype: None
        """
        if self.project_path != "":
            document.new_document(self)
            self.show_img(False)
        else:
            self.status_message(get_text("text_please_open_project"), 1000)
Example #29
0
    def quit_func(self):
        """
        Fonction de fermeture de l'IDE.
        On affiche une petite boîte pour demander si l'on souhaite vraiment fermer l'IDE.
        Les touches "return" et "escape" sont respectivement reliées à "Fermer" et "Annuler".

        :rtype: None
        """
        self.status_message(get_text("status_exit"), -1,
                            False)  # Message de statut
        box = QMessageBox()
        box.setText(get_text("box_exit"))
        box.setStandardButtons(QMessageBox.Cancel | QMessageBox.Close)
        box.setDefaultButton(QMessageBox.Close)
        box.setEscapeButton(QMessageBox.Cancel)
        box.setStyleSheet(style.get("buttons", "window"))
        val = box.exec_()

        if val == QMessageBox.Close:
            self.restart = False
            self.close()
        else:
            self.status_message(get_text("status_not_exit"), 1000,
                                False)  # Message de statut
Example #30
0
    def __init__(self, parent):
        """
        Fonction permettant d'afficher la fenêtre pour supprimer un projet.
        """
        super().__init__()

        self.parent = parent

        self.valider = False

        self.setWindowTitle(get_text("select_delete_project"))

        self.layout = QVBoxLayout()
        self.buttons_layout = QHBoxLayout()

        self.project_name = QComboBox()
        for e in os.listdir(parent.workplace_path):
            if e != ".DS_Store" and e != ".conf":
                self.project_name.addItem(e)

        self.cancel_button = QPushButton(get_text("cancel"))
        self.valider_button = QPushButton(get_text("delete"))

        self.cancel_button.clicked.connect(self.cancel_action)
        self.valider_button.clicked.connect(self.valider_action)

        self.layout.addWidget(self.project_name)

        self.buttons_layout.addWidget(self.cancel_button)
        self.buttons_layout.addWidget(self.valider_button)
        self.layout.addLayout(self.buttons_layout)

        self.setLayout(self.layout)

        self.activateWindow()
        self.valider_button.setFocus()