def makeCheckList(self):
        self.cl = Tix.CheckList(self.root, browsecmd=self.selectItem)
        self.cl.pack()
        count = 1
        self.cl.config(height=900)
        self.cl.config(width=1500)
        for i in lis:
            cn = self.dashcount(i)
            if cn in dicti:
                dicti[cn] = dicti[cn] + 1
            else:
                dicti[cn] = 1
            self.cl.hlist
            if 1 in dicti:
                s = "CL" + str(dicti[1])
                for j in range(cn - 1):
                    if j + 2 in dicti:
                        s = s + "." + str(dicti[j + 2])
                # print s
                dictall[s] = i
                foo = str(i)
                foo = foo.lstrip('-')

                tem = foo
                tem = tem.split('/')

                self.cl.hlist.add(s, text=tem[len(tem) - 1])  #TEXT HERE
                self.cl.setstatus(s, "off")
                self.cl.autosetmode()
Beispiel #2
0
    def makeCheckList(self):
        self.replacements = {'Cree': 'Créé le', 'Modifie': 'Modifié le'}
        self.element = ('ID', 'Description', 'Cree', 'Modifie', 'Nature',
                        'Type', 'Statut', 'Importance', 'Jalons', 'Pre-requis',
                        'Exigences')

        self.cl = Tix.CheckList(self.root, browsecmd=self.selectItem)
        self.cl.pack(fill=BOTH, expand=1)
        self.cl.hlist.add('general', text='general')

        for elem in self.element:
            self.cl.hlist.add('general.' + elem,
                              text=self.replace_all(elem, self.replacements))
            self.cl.setstatus('general.' + elem, "off")

        self.cl.setstatus('general.ID', "on")
        self.cl.setstatus('general.Description', "on")

        for fiche in self.dico['Fiches']:
            self.cl.hlist.add(fiche['Titre'], text=fiche['Titre'])
            self.cl.setstatus(fiche['Titre'], "on")
            for element in fiche:
                if (isinstance(element, basestring) and 'Titre' not in element
                        and not isinstance(fiche[element], list)):

                    self.cl.hlist.add(fiche['Titre'] + '.' + element,
                                      text=self.replace_all(
                                          element, self.replacements))
                    self.cl.setstatus(fiche['Titre'] + '.' + element,
                                      self.cl.getstatus('general.' + element))

            for etape in fiche['Etapes']:
                self.cl.hlist.add(fiche['Titre'] + '.Etape' + etape['Numero'],
                                  text='Etape ' + etape['Numero'])
                self.cl.setstatus(fiche['Titre'] + '.Etape' + etape['Numero'],
                                  'on')
        self.cl.autosetmode()
Beispiel #3
0
    def makeCheckList(self):
        """Créer l'arbre de contenu façon checkList pour séléctionner les
        éléments voulu dans le document final.
        """
        # On va remplacer le texte pour un  meilleur affichage
        self.replacements = {'Cree': 'Créé le', 'Modifie': 'Modifié le'}

        # Liste d'éléments pour faciliter le code avec des boucles
        self.element = ('ID', 'Description', 'Cree', 'Modifie', 'Nature',
                        'Type', 'Statut', 'Importance', 'Jalons', 'Etape'
                        )

        # Définition de la checkList, la méthode 'selectIten' est appelée
        # lors d'un clic sur la checkList
        self.cl = Tix.CheckList(self.root, browsecmd=self.selectItem)
        self.cl.pack(fill=BOTH, expand=1)

        # Ajout d'un élément père 'general'
        self.cl.hlist.add('general', text='géneral')

        # On va ajouter les éléments de la liste au parent 'general'
        for elem in self.element:
            self.cl.hlist.add('general.' + elem,
                              text=self.replace_all(elem, self.replacements))
            # On les décoches de base
            self.cl.setstatus('general.' + elem, "off")

        # On coche les éléments suivant
        self.cl.setstatus('general.ID', "on")
        self.cl.setstatus('general.Description', "on")
        self.cl.setstatus('general.Etape', "on")
        self.cl.setstatus('general.Statut', "on")

        self.cl.hlist.add('other', text='Autre')

        self.cl.hlist.add('other.Pre-requis', text='Pré-requis')
        self.cl.hlist.add('other.Exigences', text='Exigences')

        self.cl.setstatus('other.Pre-requis', "off")
        self.cl.setstatus('other.Exigences', "off")

        # On va ajouter les fiches ainsi que leurs éléments et étapes
        for fiche in self.dico['Fiches']:
            # Si la fiche contient un . dans son nom
            if '.' in fiche['Titre']:
                fiche['Titre'] = ''.join(fiche['Titre'].split('.')[1:])

            # Si la fiche a un dossier parent
            if fiche['Parent']:
                p = fiche['Parent']
                fiche['is_children'] = True
                # On va l'ajouter à l'ihm si le parent n'est pas présent.
                if p not in self.cl.hlist.info_children():
                    fiche['other_father'] = True
                    self.cl.hlist.add(p, text=p)
                    self.cl.setstatus(p, "on")
                    self.cl.hlist.add(p + '.' + fiche['Titre'], text=fiche['Titre'])
                    self.cl.setstatus(p + '.' + fiche['Titre'], "on")
                else:
                    fiche['other_father'] = False
                    self.cl.hlist.add(p + '.' + fiche['Titre'], text=fiche['Titre'])
                    self.cl.setstatus(p + '.' + fiche['Titre'], "on")
            else:
                fiche['is_children'] = False
                self.cl.hlist.add(fiche['Titre'], text=fiche['Titre'])
                self.cl.setstatus(fiche['Titre'], "on")

        # Permet de définir les éléments avec un status, des cases cochables
        self.cl.autosetmode()
Beispiel #4
0
def SemanticListWindow(project_name, rule_name, vClsIn):  #

    WhiteListWindow = Tix.Toplevel()
    WhiteListWindow.title("Edit Cue List")
    WhiteListWindow.geometry('{}x{}'.format(550, 400))
    itemsFrame = Tix.Frame(WhiteListWindow)
    itemsFrame.pack(side=Tix.LEFT)
    choiseFrame = Tix.Frame(WhiteListWindow, width=130)
    choiseFrame.pack(side=Tix.RIGHT)
    #type = ['WhiteList','BlackList']
    typeVar = Tix.StringVar()
    #typeVar.set(type[0])
    #TypeLabel = Label(choiseFrame,text="ListType").grid(row=0,column=0,sticky='w')
    #drop = OptionMenu(choiseFrame,typeVar,*type)
    #drop.grid(row=1,column=0,sticky='w')
    where_to_look = Tix.Label(
        choiseFrame,
        text="Where to look for white list variables?").grid(row=2,
                                                             column=0,
                                                             sticky='w')
    wl_look_head = Tix.IntVar()
    WLHeaderCB = Tix.Checkbutton(choiseFrame,
                                 text="Header",
                                 variable=wl_look_head).grid(row=3,
                                                             column=0,
                                                             sticky='w')
    wl_look_stub = Tix.IntVar()
    WLStubCB = Tix.Checkbutton(choiseFrame, text="Stub",
                               variable=wl_look_stub).grid(row=4,
                                                           column=0,
                                                           sticky='w')
    wl_look_super = Tix.IntVar()
    WLSuperRowCB = Tix.Checkbutton(choiseFrame,
                                   text="Super-row",
                                   variable=wl_look_super).grid(row=5,
                                                                column=0,
                                                                sticky='w')
    wl_look_data = Tix.IntVar()
    WLDataCB = Tix.Checkbutton(choiseFrame, text="Data",
                               variable=wl_look_data).grid(row=6,
                                                           column=0,
                                                           sticky='w')

    where_to_look2 = Tix.Label(
        choiseFrame,
        text="Where to look for black list variables?").grid(row=7,
                                                             column=0,
                                                             sticky='w')
    bl_look_head = Tix.IntVar()
    BLHeaderCB = Tix.Checkbutton(choiseFrame,
                                 text="Header",
                                 variable=bl_look_head).grid(row=8,
                                                             column=0,
                                                             sticky='w')
    bl_look_stub = Tix.IntVar()
    BLStubCB = Tix.Checkbutton(choiseFrame, text="Stub",
                               variable=bl_look_stub).grid(row=9,
                                                           column=0,
                                                           sticky='w')
    bl_look_super = Tix.IntVar()
    BLSuperRowCB = Tix.Checkbutton(choiseFrame,
                                   text="Super-row",
                                   variable=bl_look_super).grid(row=10,
                                                                column=0,
                                                                sticky='w')
    bl_look_data = Tix.IntVar()
    BLDataCB = Tix.Checkbutton(choiseFrame, text="Data",
                               variable=bl_look_data).grid(row=11,
                                                           column=0,
                                                           sticky='w')

    namerule_label = Tix.Label(
        itemsFrame, text="List of terms in whitelsit").grid(row=0, sticky='w')
    whitelist = Tix.CheckList(itemsFrame, width=350)
    whitelist.grid(row=1, sticky='w')
    createSemanticWhiteList(whitelist)
    whitelist.autosetmode()
    namerule_label2 = Tix.Label(
        itemsFrame, text="List of terms in blacklist").grid(row=2, sticky='w')
    blacklist = Tix.Text(itemsFrame, height=5, width=50)
    blacklist.grid(row=3, sticky='w')
    saveButton = Tix.Button(
        itemsFrame,
        text="Save",
        fg="black",
        command=lambda: SaveWhiteListSemantic(
            whitelist, blacklist.get("1.0", Tix.END), typeVar, wl_look_head,
            wl_look_stub, wl_look_super, wl_look_data, bl_look_head,
            bl_look_stub, bl_look_super, bl_look_data, WhiteListWindow,
            project_name, rule_name, vClsIn)).grid(row=4, sticky='w')

    pass
Beispiel #5
0
def SemanticListWindowEdit(project_name, rule_name, variable_name):  #
    WhiteListWindow = Tix.Toplevel()
    WhiteListWindow.title("Edit Cue List")
    WhiteListWindow.geometry('{}x{}'.format(550, 400))
    itemsFrame = Tix.Frame(WhiteListWindow)
    itemsFrame.pack(side=Tix.LEFT)
    choiseFrame = Tix.Frame(WhiteListWindow, width=130)
    choiseFrame.pack(side=Tix.RIGHT)
    #type = ['WhiteList','BlackList']
    typeVar = Tix.StringVar()
    #typeVar.set(type[0])
    #TypeLabel = Label(choiseFrame,text="ListType").grid(row=0,column=0,sticky='w')
    #drop = OptionMenu(choiseFrame,typeVar,*type)
    #drop.grid(row=1,column=0,sticky='w')
    where_to_look = Tix.Label(
        choiseFrame,
        text="Where to look for white list variables?").grid(row=2,
                                                             column=0,
                                                             sticky='w')
    wl_look_head = Tix.IntVar()
    WLHeaderCB = Tix.Checkbutton(choiseFrame,
                                 text="Header",
                                 variable=wl_look_head).grid(row=3,
                                                             column=0,
                                                             sticky='w')
    wl_look_stub = Tix.IntVar()
    WLStubCB = Tix.Checkbutton(choiseFrame, text="Stub",
                               variable=wl_look_stub).grid(row=4,
                                                           column=0,
                                                           sticky='w')
    wl_look_super = Tix.IntVar()
    WLSuperRowCB = Tix.Checkbutton(choiseFrame,
                                   text="Super-row",
                                   variable=wl_look_super).grid(row=5,
                                                                column=0,
                                                                sticky='w')
    wl_look_data = Tix.IntVar()
    WLDataCB = Tix.Checkbutton(choiseFrame, text="Data",
                               variable=wl_look_data).grid(row=6,
                                                           column=0,
                                                           sticky='w')

    where_to_look2 = Tix.Label(
        choiseFrame,
        text="Where to look for black list variables?").grid(row=7,
                                                             column=0,
                                                             sticky='w')
    bl_look_head = Tix.IntVar()
    BLHeaderCB = Tix.Checkbutton(choiseFrame,
                                 text="Header",
                                 variable=bl_look_head).grid(row=8,
                                                             column=0,
                                                             sticky='w')
    bl_look_stub = Tix.IntVar()
    BLStubCB = Tix.Checkbutton(choiseFrame, text="Stub",
                               variable=bl_look_stub).grid(row=9,
                                                           column=0,
                                                           sticky='w')
    bl_look_super = Tix.IntVar()
    BLSuperRowCB = Tix.Checkbutton(choiseFrame,
                                   text="Super-row",
                                   variable=bl_look_super).grid(row=10,
                                                                column=0,
                                                                sticky='w')
    bl_look_data = Tix.IntVar()
    BLDataCB = Tix.Checkbutton(choiseFrame, text="Data",
                               variable=bl_look_data).grid(row=11,
                                                           column=0,
                                                           sticky='w')

    namerule_label = Tix.Label(
        itemsFrame, text="List of terms in whitelsit").grid(row=0, sticky='w')
    whitelist = Tix.CheckList(itemsFrame, width=350)
    whitelist.grid(row=1, sticky='w')
    createSemanticWhiteList(whitelist)
    whitelist.autosetmode()
    namerule_label2 = Tix.Label(
        itemsFrame, text="List of terms in blacklist").grid(row=2, sticky='w')
    blacklist = Tix.Text(itemsFrame, height=5, width=50)
    blacklist.grid(row=3, sticky='w')

    whitelist_list = FileManipulationHelper.loadWhiteList(
        project_name, rule_name, variable_name)
    blacklist_list = FileManipulationHelper.loadBlackList(
        project_name, rule_name, variable_name)

    i = 1
    afterWordList = False
    for w in whitelist_list:
        w = w.replace('\n', '')
        splitted = w.split(':')
        #if splitted[0]=='Type':
        #    if splitted[1]=='WhiteList':
        #        typeVar.set(type[0])
        #    else:
        #        typeVar.set(type[1])
        if splitted[0] == 'Header':
            wl_look_head.set(int(splitted[1]))
        if splitted[0] == 'Stub':
            wl_look_stub.set(int(splitted[1]))
        if splitted[0] == 'Super-row':
            wl_look_super.set(int(splitted[1]))
        if splitted[0] == 'Data':
            wl_look_data.set(int(splitted[1]))
        #if splitted[0]=='All':
        #    look_all.set(int(splitted[1]))
        if w == "SemanticTypes:":
            afterWordList = True
            continue

        if afterWordList == True:
            cur = 0
            for item in semanticTypes:
                if (w == item.split('.')[-1]):
                    whitelist.setstatus(item, "on")
                cur = cur + 1
            i = i + 1

    afterWordList = False
    for w in blacklist_list:
        w = w.replace('\n', '')
        splitted = w.split(':')
        #if splitted[0]=='Type':
        #    if splitted[1]=='WhiteList':
        #        typeVar.set(type[0])
        #    else:
        #        typeVar.set(type[1])
        if splitted[0] == 'Header':
            bl_look_head.set(int(splitted[1]))
        if splitted[0] == 'Stub':
            bl_look_stub.set(int(splitted[1]))
        if splitted[0] == 'Super-row':
            bl_look_super.set(int(splitted[1]))
        if splitted[0] == 'Data':
            bl_look_data.set(int(splitted[1]))
        #if splitted[0]=='All':
        #    look_all.set(int(splitted[1]))
        if w == "WordList:":
            afterWordList = True
            continue

        if afterWordList == True:
            blacklist.insert(str(i) + '.0', w + '\n')
            i = i + 1

    saveButton = Tix.Button(
        itemsFrame,
        text="Save",
        fg="black",
        command=lambda: SaveWhiteListSemanticEdit(
            whitelist, blacklist.get("1.0", Tix.END), typeVar, wl_look_head,
            wl_look_stub, wl_look_super, wl_look_data, bl_look_head,
            bl_look_stub, bl_look_super, bl_look_data, WhiteListWindow,
            project_name, rule_name)).grid(row=4, sticky='w')

    pass