def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkState',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Set information on case.\nCtrl+c to close applet.', temps=0, btype=1)
    Frame.bind('<Control-c>', hideApp)
    Frame.bind('<ButtonRelease-3>', displayFrameMenu)
    Frame.bind('<Enter>', lambda event: Frame.focus_set())
    Frame.columnconfigure(0, weight=1)
    WIDGETS['frame'] = Frame

    # - Frame menu -
    FrameMenu = TK.Menu(Frame, tearoff=0)
    FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp)
    CTK.addPinMenu(FrameMenu, 'tkState')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- Pb dim -
    V = TK.StringVar(win)
    V.set('3D')
    VARS.append(V)
    # -1- Model -
    V = TK.StringVar(win)
    V.set('Euler')
    VARS.append(V)
    # -2- Mach -
    V = TK.StringVar(win)
    V.set('0.5')
    VARS.append(V)
    # -3- Reinf -
    V = TK.StringVar(win)
    V.set('1.e8')
    VARS.append(V)
    # -4- Incidence/Z -
    V = TK.StringVar(win)
    V.set('0.')
    VARS.append(V)
    # -5- Incidence/Y -
    V = TK.StringVar(win)
    V.set('0.')
    VARS.append(V)
    # -6- Type de modele de turbulence
    V = TK.StringVar(win)
    V.set('SpalartAllmaras')
    VARS.append(V)
    # -7- Valeurs pour les grandeurs turbulentes
    V = TK.StringVar(win)
    V.set('1.e-6')
    VARS.append(V)
    # -8- Jeux de variables definissant l'etat de reference
    V = TK.StringVar(win)
    V.set('[adim1] ro,T,a')
    VARS.append(V)
    # -9- MutSMuInf
    V = TK.StringVar(win)
    V.set('0.2')
    VARS.append(V)
    # -10- TurbLevelInf
    V = TK.StringVar(win)
    V.set('1.e-4')
    VARS.append(V)
    # -11- Adim
    V = TK.StringVar(win)
    V.set('adim1(Ro,A,T)')
    VARS.append(V)

    # - Pb dim -
    F = TTK.Frame(Frame, borderwidth=2, relief=CTK.FRAMESTYLE)
    F.columnconfigure(0, weight=1)
    F.columnconfigure(1, weight=2)
    F.columnconfigure(1, weight=2)
    B = TTK.Label(F, text="Pb dim")
    B.grid(row=0, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Dimension of the problem.')
    B = TTK.OptionMenu(F, VARS[0], '3D', '2D', command=setDim)
    B.grid(row=0, column=1, sticky=TK.EW)
    B = TTK.Button(F, text="Set dim", command=setDim)
    BB = CTK.infoBulle(parent=B, text='Set dim in all bases.')
    B.grid(row=0, column=2, sticky=TK.EW)
    F.grid(row=0, column=0, sticky=TK.EW)

    F = TTK.Frame(Frame, borderwidth=2, relief=CTK.FRAMESTYLE)
    F.columnconfigure(0, weight=1)
    F.columnconfigure(1, weight=4)

    # - Modele de fluide -
    B = TTK.Label(F, text="GovEquations")
    B.grid(row=1, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Governing equations to solve.')
    B = TTK.OptionMenu(F, VARS[1], 'Euler', 'NSLaminar', 'NSTurbulent')
    B.grid(row=1, column=1, sticky=TK.EW)

    # - Jeu de grandeurs definissant l'etat de reference -
    #B = TK.Label(F, text="Variables")
    #B.grid(row=2, column=0, sticky=TK.EW)
    #BB = CTK.infoBulle(parent=B, text='Change the set of variables defining the reference state.')
    #B = TK.OptionMenu(F, VARS[8], '[adim1] ro,a,T', '[adim2] ro,u,T', '[dim1] U,T,P,L', '[dim2] ro,u,T,L', '[dim3] ro,u,P,L')
    #B.grid(row=2, column=1, sticky=TK.EW)

    # - Mach -
    B = TTK.Label(F, text="Mach")
    B.grid(row=2, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Reference (infinite) mach number.')
    B = TTK.Entry(F, textvariable=VARS[2], background='White')
    B.grid(row=2, column=1, sticky=TK.EW)

    # - Reynolds -
    B = TTK.Label(F, text="Reynolds")
    B.grid(row=3, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Reference (infinite) Reynolds number.')
    B = TTK.Entry(F, textvariable=VARS[3], background='White')
    B.grid(row=3, column=1, sticky=TK.EW)

    # - Incidence/Z -
    B = TTK.Label(F, text="Incidence/Z (deg)")
    BB = CTK.infoBulle(parent=B, text='Angle of incident flow around z axis.')
    B.grid(row=4, column=0, sticky=TK.EW)
    B = TTK.Entry(F, textvariable=VARS[4], background='White')
    B.grid(row=4, column=1, sticky=TK.EW)

    # - Incidence/Y -
    B = TTK.Label(F, text="Incidence/Y (deg)")
    B.grid(row=5, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Angle of incident flow around y axis.')
    B = TTK.Entry(F, textvariable=VARS[5], background='White')
    B.grid(row=5, column=1, sticky=TK.EW)

    # - Modele de turbulence -
    B = TTK.Label(F, text="TubulenceModel")
    B.grid(row=6, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Type of turbulence model.')
    B = TTK.OptionMenu(F, VARS[6], 'SpalartAllmaras', 'JonesLaunder(k-eps)',
                       'Wilcox(k-w)', 'MenterSST(k-w)')
    B.grid(row=6, column=1, sticky=TK.EW)

    # - Valeurs des grandeurs turbulentes -
    B = TTK.Label(F, text="MutSMu")
    B.grid(row=7, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(
        parent=B,
        text='Ratio between turbulent viscosity and molecular viscosity.')
    B = TTK.Entry(F, textvariable=VARS[9], background='White')
    B.grid(row=7, column=1, sticky=TK.EW)

    B = TTK.Label(F, text="TurbLevel")
    B.grid(row=8, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Level of turbulence.')
    B = TTK.Entry(F, textvariable=VARS[10], background='White')
    B.grid(row=8, column=1, sticky=TK.EW)

    # - Adim -
    B = TTK.Label(F, text="Adim")
    B.grid(row=9, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Type of adimensionalization.')
    B = TTK.OptionMenu(
        F, VARS[11], 'adim1(Ro,A,T)', 'adim2(Ro,U,T)'
    )  #,'dim1(real UInf,TInf,PInf,Rgp=287.053)', 'dim2(real UInf,TInf,RoInf,Rgp=287.053)','dim3(real UInf,PInf,RoInf,Rgp=287.053)')
    B.grid(row=9, column=1, sticky=TK.EW)

    # - get state, inutile a mon avis -
    B = TTK.Button(F, text="Get state", command=getState)
    B.grid(row=10, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Read state from pyTree.')

    # - set state -
    B = TTK.Button(F, text="Set state", command=setState)
    B.grid(row=10, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Write state to pyTree.')

    F.grid(row=1, column=0, sticky=TK.EW)
Exemple #2
0
def createApp(win):

    ttk = CTK.importTtk()

    # - Frame -
    Frame = TTK.LabelFrame(win, borderwidth=2, relief=CTK.FRAMESTYLE,
                           text='tkPerfo', font=CTK.FRAMEFONT, takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Improve performance of Cassiopee.\nCtrl+c to close applet.', temps=0, btype=1)
    Frame.bind('<Control-c>', hideApp)
    Frame.bind('<ButtonRelease-3>', displayFrameMenu)
    Frame.bind('<Enter>', lambda event : Frame.focus_set())
    Frame.columnconfigure(0, weight=1)
    Frame.columnconfigure(1, weight=4)
    Frame.columnconfigure(2, weight=1)

    WIDGETS['frame'] = Frame
    
    # - Frame menu -
    FrameMenu = TK.Menu(Frame, tearoff=0)
    FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp)
    FrameMenu.add_command(label='Save', command=saveApp)
    FrameMenu.add_command(label='Reset', command=resetApp)
    CTK.addPinMenu(FrameMenu, 'tkPerfo')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- Displayed field -
    V = TK.StringVar(win); V.set('All fields'); VARS.append(V)
    # -1- Oneovern -
    V = TK.StringVar(win); V.set('All points'); VARS.append(V)
    if 'tkPerfoPoints' in CTK.PREFS: V.set(CTK.PREFS['tkPerfoPoints'])
    # -2- Threads
    V = TK.StringVar(win); V.set('1'); VARS.append(V)
    
    # - Field transmission -
    B = TTK.Label(Frame, text="Display")
    B.grid(row=0, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Describe what part of the tree is displayed.\nCan fasten the display. In memory tree is not modified.')

    F = TTK.Frame(Frame, borderwidth=0)
    F.columnconfigure(0, weight=1)
    
    if ttk is None:
        B = TK.OptionMenu(F, VARS[0], 'All fields', 'No field')
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVarNameList)
        F.grid(row=0, column=1, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B, text='Display only certain fields.')
        WIDGETS['fields'] = B
    else:
        B = ttk.Combobox(F, textvariable=VARS[0], 
                         values=['All fields', 'No field'], 
                         state='readonly', width=10)
        B.grid(sticky=TK.EW)
        B.bind('<<ComboboxSelected>>', setViewMode2)
        F.bind('<Enter>', updateVarNameList2)
        F.grid(row=0, column=1, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B, text='Display only certain fields.')
        WIDGETS['fields'] = B

    # - Point transmission -
    B = TTK.OptionMenu(Frame, VARS[1], 'All points', 'One over 2', 'One over 3',
                       'One over 4', 'Exclusive', command=oneovern)
    B.grid(row=0, column=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Display less points.')

    # - OMP threads -
    B = TTK.Label(Frame, text="Threads")
    B.grid(row=1, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='The number of CPU cores used by Cassiopee.')
    F = TTK.Frame(Frame, borderwidth=0)
    F.grid(row=1, column=1, columnspan=1, sticky=TK.EW)
    B = TTK.Entry(F, textvariable=VARS[2], background='White', width=3)
    B.grid(row=0, column=0, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Number of threads\n(init value is OMP_NUM_THREADS).')
    B.bind('<Return>', setThreads)
    WIDGETS['threads'] = B
    mxProcs = getMaxProcs()
    B = TK.Label(F, text='/'+mxProcs)
    B.grid(row=0, column=1, columnspan=1, sticky=TK.EW)

    B = TTK.Button(Frame, text="Set", command=setThreads)
    B.grid(row=1, column=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Set the number of threads.')
Exemple #3
0
def createApp(win):

    ttk = CTK.importTtk()

    # - Frame -
    Frame = TTK.LabelFrame(win, borderwidth=2, relief=CTK.FRAMESTYLE,
                           text='tkExtractBC', font=CTK.FRAMEFONT, takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Extract boundary conditions.\nCtrl+c to close applet.', temps=0, btype=1)
    Frame.bind('<Control-c>', hideApp)
    Frame.bind('<ButtonRelease-3>', displayFrameMenu)
    Frame.bind('<Enter>', lambda event : Frame.focus_set())
    Frame.columnconfigure(0, weight=2)
    Frame.columnconfigure(1, weight=2)
    Frame.columnconfigure(2, weight=0)
    WIDGETS['frame'] = Frame
    
    # - Frame menu -
    FrameMenu = TK.Menu(Frame, tearoff=0)
    FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp)
    FrameMenu.add_command(label='Save', command=saveApp)
    FrameMenu.add_command(label='Reset', command=resetApp)
    CTK.addPinMenu(FrameMenu, 'tkExtractBC')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # - 0 - Type de BC -
    V = TK.StringVar(win); V.set('-All BC-'); VARS.append(V)
    if 'tkExtractBCType' in CTK.PREFS: 
        V.set(CTK.PREFS['tkExtractBCType'])
    # - 1 - List of zoneBCs to recover
    V = TK.StringVar(win); V.set(''); VARS.append(V)

    # - Extract type de BC -
    B = TTK.Button(Frame, text="Extract", command=extract)
    B.grid(row=0, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B,
                       text='Extract specified BC.\nTree is modified.')
    F = TTK.Frame(Frame, borderwidth=0)
    F.columnconfigure(0, weight=1)
    if ttk is None:
        B = TK.OptionMenu(F, VARS[0], *(Internal.KNOWNBCS))
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateFamilyBCNameList)
        F.grid(row=0, column=1, columnspan=2, sticky=TK.EW)
        WIDGETS['BC'] = B
    else:
        B = ttk.Combobox(F, textvariable=VARS[0], 
                         values=Internal.KNOWNBCS, 
                         state='readonly', width=10)
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateFamilyBCNameList2)
        F.grid(row=0, column=1, columnspan=2, sticky=TK.EW)
        WIDGETS['BC'] = B

    # - Recover BCs -
    B = TTK.Button(Frame, text="Recover", command=recover)
    B.grid(row=1, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B,
                       text='Recover BCs.\nTree is modified.')
    B = TTK.Button(Frame, command=setBC2Recover,
                   image=iconics.PHOTO[8], padx=0, pady=0)
    B.grid(row=1, column=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Set the BC (zones) to recover.')
    B = TTK.Entry(Frame, textvariable=VARS[1], background='White', width=8)
    B.grid(row=1, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='BCs to recover.')
Exemple #4
0
def createApp(win):
    ttk = CTK.importTtk()

    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkInteg',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Integrate fields.\nCtrl+c to close applet.', temps=0, btype=1)
    Frame.bind('<Control-c>', hideApp)
    Frame.bind('<ButtonRelease-3>', displayFrameMenu)
    Frame.bind('<Enter>', lambda event: Frame.focus_set())
    Frame.columnconfigure(0, weight=1)
    Frame.columnconfigure(1, weight=1)
    Frame.columnconfigure(2, weight=1)
    WIDGETS['frame'] = Frame

    # - Frame menu -
    FrameMenu = TK.Menu(Frame, tearoff=0)
    FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp)
    CTK.addPinMenu(FrameMenu, 'tkInteg')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- Integration type -
    V = TK.StringVar(win)
    V.set('INT(v1dS)')
    VARS.append(V)
    # -1- Moment center  -
    V = TK.StringVar(win)
    V.set('0;0;0')
    VARS.append(V)
    # -2- Var0 for integration -
    V = TK.StringVar(win)
    V.set('CoordinateX')
    VARS.append(V)
    # -3- Var1 for integration -
    V = TK.StringVar(win)
    V.set('CoordinateY')
    VARS.append(V)
    # -4- Var2 for integration -
    V = TK.StringVar(win)
    V.set('CoordinateZ')
    VARS.append(V)

    # - Menu des integrations -
    B = TTK.OptionMenu(Frame, VARS[0], \
                       'INT(v1dS)', 'INT(v1.ndS)', \
                       'INT((v1,v2,v3).ndS)', \
                       'INT((v1,v2,v3)^OMdS)', 'INT(v1n^OMdS)')
    B.grid(row=0, column=0, sticky=TK.EW)

    # - Centre des moments -
    B = TTK.Entry(Frame, textvariable=VARS[1], background='White', width=5)
    B.grid(row=0, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Moment center.')

    # - Bouton compute -
    B = TTK.Button(Frame, text="Compute", command=compute)
    B.grid(row=0, column=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B,
                       text='Compute integration on contour/surface.')

    # - Menu des variables -
    F = TTK.Frame(Frame, borderwidth=0)
    F.columnconfigure(0, weight=1)
    if ttk is None:
        B = TK.OptionMenu(F, VARS[2], '')
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVarNameList1)
        F.grid(row=1, column=0, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B, text='Variable 1.')
        WIDGETS['variable1'] = B
    else:
        B = ttk.Combobox(F,
                         textvariable=VARS[2],
                         values=[],
                         state='readonly',
                         width=10)
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVarNameList1_2)
        F.grid(row=1, column=0, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B, text='Variable 1.')
        WIDGETS['variable1'] = B

    F = TTK.Frame(Frame, borderwidth=0)
    F.columnconfigure(0, weight=1)
    if ttk is None:
        B = TK.OptionMenu(F, VARS[3], '')
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVarNameList2)
        F.grid(row=1, column=1, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B, text='Variable 2.')
        WIDGETS['variable2'] = B
    else:
        B = ttk.Combobox(F,
                         textvariable=VARS[3],
                         values=[],
                         state='readonly',
                         width=10)
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVarNameList2_2)
        F.grid(row=1, column=1, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B, text='Variable 2.')
        WIDGETS['variable2'] = B

    F = TTK.Frame(Frame, borderwidth=0)
    F.columnconfigure(0, weight=1)
    if ttk is None:
        B = TK.OptionMenu(F, VARS[4], '')
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVarNameList3)
        F.grid(row=1, column=2, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B, text='Variable 3.')
        WIDGETS['variable3'] = B
    else:
        B = ttk.Combobox(F,
                         textvariable=VARS[4],
                         values=[],
                         state='readonly',
                         width=10)
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVarNameList3_2)
        F.grid(row=1, column=2, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B, text='Variable 3.')
        WIDGETS['variable3'] = B
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkFastSolver',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    Frame.bind('<Control-c>', hideApp)
    Frame.bind('<ButtonRelease-3>', displayFrameMenu)
    Frame.bind('<Enter>', lambda event: Frame.focus_set())
    Frame.columnconfigure(0, weight=0)
    Frame.columnconfigure(1, weight=1)
    Frame.columnconfigure(2, weight=0)
    WIDGETS['frame'] = Frame

    # - Frame menu -
    FrameMenu = TK.Menu(Frame, tearoff=0)
    FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp)
    CTK.addPinMenu(FrameMenu, 'tkFastSolver')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- temporal_scheme -
    V = TK.StringVar(win)
    V.set('explicit')
    VARS.append(V)
    # -1- ss_iteration -
    V = TK.StringVar(win)
    V.set('20')
    VARS.append(V)
    # -2- modulo_verif -
    V = TK.StringVar(win)
    V.set('200')
    VARS.append(V)
    # -3- restart_fields -
    V = TK.StringVar(win)
    V.set('1')
    VARS.append(V)
    # -4- scheme -
    V = TK.StringVar(win)
    V.set('ausmpred')
    VARS.append(V)
    # -5- Time step -
    V = TK.DoubleVar(win)
    V.set(0.002)
    VARS.append(V)
    # -6- Snear -
    V = TK.DoubleVar(win)
    V.set(0.01)
    VARS.append(V)
    # -7- IBC type -
    V = TK.StringVar(win)
    V.set('Musker')
    VARS.append(V)
    # -8- dfar local -
    V = TK.DoubleVar(win)
    V.set(-1.)
    VARS.append(V)

    # - temporal scheme -
    B = TTK.Label(Frame, text="temporal_scheme")
    B.grid(row=0, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Time integration.')
    B = TTK.OptionMenu(Frame, VARS[0], 'explicit', 'implicit',
                       'implicit_local')
    B.grid(row=0, column=1, columnspan=2, sticky=TK.EW)

    # - ss_iteration -
    #B = TTK.Label(Frame, text="ss_iteration")
    #B.grid(row=1, column=0, sticky=TK.EW)
    #BB = CTK.infoBulle(parent=B, text='Nbre de sous iterations max.')
    #B = TTK.Entry(Frame, textvariable=VARS[1])
    #B.grid(row=1, column=1, columnspan=2, sticky=TK.EW)

    # - scheme -
    B = TTK.Label(Frame, text="scheme")
    B.grid(row=2, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Numerical scheme.')
    B = TTK.OptionMenu(Frame, VARS[4], 'ausmpred', 'roe_min')
    B.grid(row=2, column=1, columnspan=2, sticky=TK.EW)

    # - time_step -
    B = TTK.Label(Frame, text="time_step")
    B.grid(row=3, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Time step.')
    B = TTK.Entry(Frame, textvariable=VARS[5])
    B.grid(row=3, column=1, columnspan=2, sticky=TK.EW)

    #- Snear settings  -
    B = TTK.Label(Frame, text="snear")
    B.grid(row=4, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame, textvariable=VARS[6])
    B.grid(row=4, column=1, columnspan=2, sticky=TK.EW)

    #- dfar settings  -
    B = TTK.Label(Frame, text="dfar")
    B.grid(row=5, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame, textvariable=VARS[8])
    B.grid(row=5, column=1, columnspan=2, sticky=TK.EW)

    # - IBC type -
    B = TTK.Label(Frame, text="IBC type")
    B.grid(row=6, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Type of IBC.')
    B = TTK.OptionMenu(Frame, VARS[7], 'slip', 'noslip', 'Log', 'Musker',
                       'outpress', 'inj', 'TBLE')
    B.grid(row=6, column=1, columnspan=2, sticky=TK.EW)

    # - Set data -
    B = TTK.Button(Frame, text="Set data", command=setData)
    BB = CTK.infoBulle(parent=B, text='Set data into selected zone.')
    B.grid(row=7, column=0, columnspan=2, sticky=TK.EW)
    B = TTK.Button(Frame,
                   command=getData,
                   image=iconics.PHOTO[8],
                   padx=0,
                   pady=0,
                   compound=TK.RIGHT)
    BB = CTK.infoBulle(parent=B, text='Get data from selected zone.')
    B.grid(row=7, column=2, sticky=TK.EW)
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkDistributor',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Distribute blocks\nover processors.\nCtrl+c to close applet.', temps=0, btype=1)
    Frame.bind('<Control-c>', hideApp)
    Frame.bind('<ButtonRelease-3>', displayFrameMenu)
    Frame.bind('<Enter>', lambda event: Frame.focus_set())
    Frame.columnconfigure(0, weight=1)
    Frame.columnconfigure(1, weight=1)
    Frame.columnconfigure(2, weight=0)
    WIDGETS['frame'] = Frame

    # - Frame menu -
    FrameMenu = TK.Menu(Frame, tearoff=0)
    FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp)
    FrameMenu.add_command(label='Save', command=saveApp)
    FrameMenu.add_command(label='Reset', command=resetApp)
    CTK.addPinMenu(FrameMenu, 'tkDistributor')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- NProc -
    V = TK.StringVar(win)
    V.set('10')
    VARS.append(V)
    if 'tkDistributorNProc' in CTK.PREFS:
        V.set(CTK.PREFS['tkDistributorNProc'])
    # -1- ComSpeed -
    V = TK.StringVar(win)
    V.set('0.1')
    VARS.append(V)
    if 'tkDistributorComSpeed' in CTK.PREFS:
        V.set(CTK.PREFS['tkDistributorComSpeed'])
    # -2- Algorithm
    V = TK.StringVar(win)
    V.set('graph')
    VARS.append(V)
    if 'tkDistributorAlgorithm' in CTK.PREFS:
        V.set(CTK.PREFS['tkDistributorAlgorithm'])
    # -3- Communication types
    V = TK.StringVar(win)
    V.set('all')
    VARS.append(V)
    if 'tkDistributorComType' in CTK.PREFS:
        V.set(CTK.PREFS['tkDistributorComType'])
    # -4- Manual proc setting
    V = TK.StringVar(win)
    V.set('0')
    VARS.append(V)
    # -5- Multigrid level
    V = TK.StringVar(win)
    V.set('0')
    VARS.append(V)
    if 'tkDistributorMultigrid' in CTK.PREFS:
        V.set(CTK.PREFS['tkDistributorMultigrid'])

    # - NProc -
    B = TTK.Entry(Frame, textvariable=VARS[0], background='White', width=3)
    BB = CTK.infoBulle(parent=B, text='Number of processors.')
    B.grid(row=0, column=0, sticky=TK.EW)
    #B.bind('<Return>', distribute)

    # - ComSpeed -
    B = TTK.Entry(Frame, textvariable=VARS[1], background='White', width=3)
    BB = CTK.infoBulle(parent=B,
                       text='Weight of communication\ncompared to solver.')
    B.grid(row=0, column=1, sticky=TK.EW)

    # - Multigrid level for split -
    B = TTK.OptionMenu(Frame, VARS[5], '0', '1', '2')
    B.grid(row=0, column=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Multigrid level.')

    # - Algorithms -
    B = TTK.OptionMenu(Frame, VARS[2], 'graph', 'gradient0', 'gradient1',
                       'genetic', 'fast')
    B.grid(row=1, column=0, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Distribution algorithm.')

    # - Com types -
    B = TTK.OptionMenu(Frame, VARS[3], 'all', 'match', 'overlap', 'bbox',
                       'none')
    B.grid(row=1, column=1, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(
        parent=B,
        text='Communication types taken into account while distributing.')

    # - Distribute -
    B = TTK.Button(Frame, text="Distribute tree", command=distribute)
    B.grid(row=2, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(
        parent=B,
        text='Distribute tree over processors.\nAll zones are reassigned.')

    # - Split and distribute -
    B = TTK.Button(Frame,
                   text="Split and distribute",
                   command=splitAndDistribute)
    B.grid(row=2, column=1, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(
        parent=B,
        text=
        'Split and distribute tree over processors.\nAll zones are reassigned.'
    )

    # - ProcField -
    #B = TK.Button(Frame, text="Set proc field", command=setProcField)
    #B.grid(row=1, column=2, sticky=TK.EW)
    #BB = CTK.infoBulle(parent=B, text='Create a field with the attributed proc\nfor each block.')

    # - set proc manually -
    B = TTK.Button(Frame, text="Set proc", command=setProc)
    B.grid(row=3, column=0, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Set proc manually in selection.')

    B = TTK.Entry(Frame, textvariable=VARS[4], background='White', width=5)
    BB = CTK.infoBulle(parent=B, text='Processor number.')
    B.grid(row=3, column=1, columnspan=2, sticky=TK.EW)
    B.bind('<Return>', setProc)

    # -  Canvas -
    B = TK.Canvas(Frame, width=250, height=60, background='White')
    B.grid(row=4, column=0, columnspan=3, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Distribution stats.')
    WIDGETS['canvas'] = B
    WIDGETS['bulle'] = BB
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win, borderwidth=2, relief=CTK.FRAMESTYLE,
                           text='tkMapEdge', font=CTK.FRAMEFONT, takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Map distributions on edges.\nCtrl+c to close applet.', temps=0, btype=1)
    Frame.bind('<Control-c>', hideApp)
    Frame.bind('<ButtonRelease-3>', displayFrameMenu)
    Frame.bind('<Enter>', lambda event : Frame.focus_set())
    Frame.columnconfigure(0, weight=1)
    Frame.columnconfigure(1, weight=2)
    Frame.columnconfigure(2, weight=2)
    Frame.columnconfigure(3, weight=0)
    WIDGETS['frame'] = Frame
    
    # - Frame menu -
    FrameMenu = TK.Menu(Frame, tearoff=0)
    FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp)
    FrameMenu.add_command(label='Save', command=saveApp)
    FrameMenu.add_command(label='Reset', command=resetApp)
    CTK.addPinMenu(FrameMenu, 'tkMapEdge')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- Point density or Npts -
    V = TK.StringVar(win); V.set('1.'); VARS.append(V)
    # -1- Enforce height
    V = TK.StringVar(win); V.set('1.e-6'); VARS.append(V)
    if 'tkMapEdgeEnforceHeight' in CTK.PREFS:
        V.set(CTK.PREFS['tkMapEdgeEnforceHeight'])
    # -2- Option for uniformize
    V = TK.StringVar(win); V.set('Factor'); VARS.append(V)
    # -3- Source mesh for copy -
    V = TK.StringVar(win); V.set(''); VARS.append(V)
    # -4- Option for refine
    V = TK.StringVar(win); V.set('Factor'); VARS.append(V)
    # -5-  Number of points/factor for refine 
    V = TK.StringVar(win); V.set('1.'); VARS.append(V)
    # -6- Smoothing iterations
    V = TK.StringVar(win); V.set('5'); VARS.append(V)
    if 'tkMapEdgeSmoothIt' in CTK.PREFS:
        V.set(CTK.PREFS['tkMapEdgeSmoothIt'])
    # -7- Smoothing eps
    V = TK.StringVar(win); V.set('0.5'); VARS.append(V)
    if 'tkMapEdgeSmoothEps' in CTK.PREFS:
        V.set(CTK.PREFS['tkMapEdgeSmoothEps'])

    # - Uniformize -
    B = TTK.Button(Frame, text="Uniformize", command=uniformize)
    B.grid(row=0, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Uniformize an edge with regular spacing.')
    B = TTK.OptionMenu(Frame, VARS[2], 'Factor', 'Density', 'Npts')
    B.grid(row=0, column=1, sticky=TK.EW)
    B = TTK.Entry(Frame, textvariable=VARS[0], background='White', width=7)
    B.grid(row=0, column=2, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Point multiplication factor/point density/number of points.')
    B.bind('<Return>', uniformize)

    # - Enforce -
    B = TTK.Button(Frame, text="Enforce", command=enforce)
    B.grid(row=1, column=0, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Enforce given spacing in edge.')
    B = TTK.Entry(Frame, textvariable=VARS[1], background='White', width=7)
    B.grid(row=1, column=2, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Enforced spacing.')
    B.bind('<Return>', enforce)

    # - Refine edge -
    B = TTK.Button(Frame, text="Refine", command=refine)
    B.grid(row=2, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Refine an edge keeping distribution.')
    B = TTK.OptionMenu(Frame, VARS[4], 'Factor', 'Npts')
    B.grid(row=2, column=1, sticky=TK.EW)
    B = TTK.Entry(Frame, textvariable=VARS[5], background='White', width=7)
    B.grid(row=2, column=2, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Refinement factor or number of points.')
    B.bind('<Return>', refine)

    # - Copy distribution -
    B = TTK.Button(Frame, command=setSourceEdge,
                   image=iconics.PHOTO[8], padx=0, pady=0)
    B.grid(row=3, column=3, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Set source edge defining distribution to copy.')
    B = TTK.Entry(Frame, textvariable=VARS[3], background='White', width=10)
    B.grid(row=3, column=1, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Source edge for distribution copy.')
    B = TTK.Button(Frame, text="Copy", command=copyDistrib)
    B.grid(row=3, column=0, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Copy distribution from source edge.')

    # - Smooth edge -
    B = TTK.Button(Frame, text="Smooth", command=smooth)
    B.grid(row=4, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Smooth an edge distribution.')
    B = TTK.Entry(Frame, textvariable=VARS[7], background='White', width=7)
    B.grid(row=4, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Smoother power.')
    B = TTK.Entry(Frame, textvariable=VARS[6], background='White', width=7)
    B.grid(row=4, column=2, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Number of smoother iterations.')
    B.bind('<Return>', smooth)
Exemple #8
0
def createApp(win):

    ttk = CTK.importTtk()

    # - Frame -
    Frame = TTK.LabelFrame(win, borderwidth=2, relief=CTK.FRAMESTYLE,
                           text='tkContainers', font=CTK.FRAMEFONT, takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Manage container names.\nCtrl+c to close applet.', temps=0, btype=1)
    Frame.bind('<Control-c>', hideApp)
    Frame.bind('<ButtonRelease-3>', displayFrameMenu)
    Frame.bind('<Enter>', lambda event : Frame.focus_set())
    Frame.columnconfigure(0, weight=1)
    Frame.columnconfigure(1, weight=4)
    WIDGETS['frame'] = Frame

    # - Frame menu -
    FrameMenu = TK.Menu(Frame, tearoff=0)
    FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp)
    FrameMenu.add_command(label='Save', command=saveApp)
    FrameMenu.add_command(label='Reset', command=resetApp)
    CTK.addPinMenu(FrameMenu, 'tkContainers')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- GridCoordinates container -
    V = TK.StringVar(win); V.set('GridCoordinates'); VARS.append(V)
    if 'GridCoordinatesContainer' in CTK.PREFS:
        V.set(CTK.PREFS['GridCoordinatesContainer'])

    # -1- FlowSolutionNodes container -
    V = TK.StringVar(win); V.set('FlowSolution'); VARS.append(V)
    if 'FlowSolutionNodesContainer' in CTK.PREFS:
        V.set(CTK.PREFS['FlowSolutionNodesContainer'])
    # -2- FlowSolutionCenters container -
    V = TK.StringVar(win); V.set('FlowSolution#Centers'); VARS.append(V)
    if 'FlowSolutionCentersContainer' in CTK.PREFS:
        V.set(CTK.PREFS['FlowSolutionCentersContainer'])

    # - GridCoordinates -
    B = TTK.Label(Frame, text="GridCoordinates")
    B.grid(row=0, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='This name will be used to find coordinates node in zones.')
    F = TTK.Frame(Frame, borderwidth=0)
    F.columnconfigure(0, weight=1)
    if ttk is None:
        B = TK.Entry(F, textvariable=VARS[0], background='White')
        B.grid(sticky=TK.EW)
        F.bind('<Return>', setNames)
        F.grid(row=0, column=1, sticky=TK.EW)
        WIDGETS['GridCoordinates'] = B
    else:
        B = ttk.Combobox(F, textvariable=VARS[0],
                         values=[], state='normal')
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateGridCoordinates)
        B.bind('<Return>', setNames)
        F.grid(row=0, column=1, sticky=TK.EW)
        WIDGETS['GridCoordinates'] = B

    # - FlowSolutionNodes -
    B = TTK.Label(Frame, text="FlowSolutionNodes")
    B.grid(row=1, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='This name will be used to find solution node in zones.')
    F = TTK.Frame(Frame, borderwidth=0)
    F.columnconfigure(0, weight=1)
    if ttk is None:
        B = TK.Entry(F, textvariable=VARS[1], background='White')
        B.grid(sticky=TK.EW)
        F.bind('<Return>', setNames)
        F.grid(row=1, column=1, sticky=TK.EW)
        WIDGETS['FlowSolution'] = B
    else:
        B = ttk.Combobox(F, textvariable=VARS[1],
                         values=[], state='normal')
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateFlowSolution)
        B.bind('<Return>', setNames)
        F.grid(row=1, column=1, sticky=TK.EW)
        WIDGETS['FlowSolution'] = B

    # - FlowSolutionCenters -
    B = TTK.Label(Frame, text="FlowSolutionCenters")
    B.grid(row=2, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='This name will be used to find centers solution node in zones.')
    F = TTK.Frame(Frame, borderwidth=0)
    F.columnconfigure(0, weight=1)
    if ttk is None:
        B = TK.Entry(F, textvariable=VARS[2], background='White')
        B.grid(sticky=TK.EW)
        F.bind('<Return>', setNames)
        F.grid(row=2, column=1, sticky=TK.EW)
        WIDGETS['FlowSolutionCenters'] = B
    else:
        B = ttk.Combobox(F, textvariable=VARS[2],
                         values=[], state='normal')
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateFlowSolutionCenters)
        B.bind('<Return>', setNames)
        F.grid(row=2, column=1, sticky=TK.EW)
        WIDGETS['FlowSolutionCenters'] = B

    # - set -
    B = TTK.Button(Frame, text="Set", command=setNames)
    BB = CTK.infoBulle(parent=B, text='Change the container names used by Cassiopee functions.')
    B.grid(row=3, column=0, columnspan=2, sticky=TK.EW)
Exemple #9
0
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkLuxRender',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Export to LuxRender.\nCtrl+c to close applet.', temps=0, btype=1)
    Frame.bind('<Control-c>', hideApp)
    Frame.bind('<ButtonRelease-3>', displayFrameMenu)
    Frame.bind('<Enter>', lambda event: Frame.focus_set())
    Frame.columnconfigure(0, weight=1)
    Frame.columnconfigure(1, weight=1)
    WIDGETS['frame'] = Frame

    # - Frame menu -
    FrameMenu = TK.Menu(Frame, tearoff=0)
    FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp)
    FrameMenu.add_command(label='Save', command=saveApp)
    FrameMenu.add_command(label='Reset', command=resetApp)
    CTK.addPinMenu(FrameMenu, 'tkLuxRender')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- Image size
    V = TK.StringVar(win)
    V.set('800x600')
    VARS.append(V)
    if 'tkLuxRenderSize' in CTK.PREFS:
        V.set(CTK.PREFS['tkLuxRenderSize'])
    # -1- Rep name
    V = TK.StringVar(win)
    V.set('LuxRender')
    VARS.append(V)
    if 'tkLuxRenderOutput' in CTK.PREFS:
        V.set(CTK.PREFS['tkLuxRenderOutput'])
    # -2- Interior / exterior
    V = TK.StringVar(win)
    V.set('Exterior')
    VARS.append(V)
    if 'tkLuxRenderType' in CTK.PREFS:
        V.set(CTK.PREFS['tkLuxRenderType'])

    # - Type of scene
    B = TTK.OptionMenu(Frame, VARS[2], 'Exterior', 'Interior')
    B.grid(row=1, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Type of scene.')

    # - Rep -
    B = TTK.Entry(Frame, textvariable=VARS[1], background='White')
    B.grid(row=0, column=0, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Directory name for output.')

    # - Image size -
    B = TTK.OptionMenu(Frame, VARS[0], '320x200', '800x600', '1024x768',
                       '1600x1200')
    B.grid(row=1, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Output image resolution.')

    # - Export scene -
    B = TTK.Button(Frame, text="Export", command=createFiles)
    B.grid(row=2, column=0, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Create all lux render files.')
def createApp(win):
    ttk = CTK.importTtk()

    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkPlot',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='My personal applet.\nCtrl+c to close applet.', temps=0, btype=1)
    Frame.bind('<Control-c>', hideApp)
    Frame.bind('<ButtonRelease-3>', displayFrameMenu)
    Frame.bind('<Enter>', lambda event: Frame.focus_set())
    Frame.columnconfigure(0, weight=1)
    Frame.columnconfigure(1, weight=1)
    Frame.columnconfigure(2, weight=1)
    WIDGETS['frame'] = Frame

    # - Frame menu -
    FrameMenu = TK.Menu(Frame, tearoff=0)
    FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp)
    FrameMenu.add_command(label='Save', command=saveApp)
    FrameMenu.add_command(label='Reset', command=resetApp)
    CTK.addPinMenu(FrameMenu, 'tkPlot')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- Direction -
    V = TK.StringVar(win)
    V.set('None')
    VARS.append(V)
    if 'tkPlotDirection' in CTK.PREFS: V.set(CTK.PREFS['tkPlotDirection'])
    # -1- grid size -
    V = TK.StringVar(win)
    V.set('3;3')
    VARS.append(V)
    if 'tkPlotGridSize' in CTK.PREFS: V.set(CTK.PREFS['tkPlotGridSize'])
    # -2- grid pos -
    V = TK.StringVar(win)
    V.set('0;0')
    VARS.append(V)
    if 'tkPlotGridPos' in CTK.PREFS: V.set(CTK.PREFS['tkPlotGridPos'])
    # -3- Var1
    V = TK.StringVar(win)
    V.set('CoordinateX')
    VARS.append(V)
    # -4- Var2
    V = TK.StringVar(win)
    V.set('CoordinateX')
    VARS.append(V)
    # -5- Slot
    V = TK.StringVar(win)
    V.set('0')
    VARS.append(V)

    # - Slot -
    B = TTK.Entry(Frame, textvariable=VARS[5], width=2)
    BB = CTK.infoBulle(parent=B, text='Slot.')
    B.grid(row=0, column=0, columnspan=1, sticky=TK.EW)

    # - grid size -
    B = TTK.Entry(Frame, textvariable=VARS[1], width=2)
    BB = CTK.infoBulle(parent=B, text='Grid size (1;1).')
    B.grid(row=0, column=1, columnspan=1, sticky=TK.EW)

    # - grid pos -
    B = TTK.Entry(Frame, textvariable=VARS[2], width=2)
    BB = CTK.infoBulle(parent=B, text='Position of slot in grid (0;0).')
    B.grid(row=0, column=2, columnspan=1, sticky=TK.EW)

    # - Element 1D -
    B = TTK.OptionMenu(Frame, VARS[0], 'None', 'X (Y)', 'Y (X)', 'Z (X)',
                       'X (Z)', 'Y (Z)', 'Z (Y)', 'I', 'J', 'K', 'Elements')
    B.grid(row=1, column=0, columnspan=3, sticky=TK.EW)

    # Var1
    F = TTK.Frame(Frame, borderwidth=0)
    F.columnconfigure(0, weight=1)

    if ttk is None:
        B = TK.OptionMenu(F, VARS[3], '')
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVar1NameList)
        F.grid(row=2, column=1, columnspan=2, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B, text='Variable 1 (abcsiss).')
        WIDGETS['var1'] = B
    else:
        B = ttk.Combobox(F,
                         textvariable=VARS[3],
                         values=[],
                         state='readonly',
                         width=10)
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVar1NameList2)
        F.grid(row=2, column=1, columnspan=2, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B, text='Variable 1 (absciss).')
        WIDGETS['var1'] = B

    # Var2
    F = TTK.Frame(Frame, borderwidth=0)
    F.columnconfigure(0, weight=1)

    if ttk is None:
        B = TK.OptionMenu(F, VARS[4], '')
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVar2NameList)
        F.grid(row=2, column=0, columnspan=1, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B, text='Variable 2 (ordinates).')
        WIDGETS['var2'] = B
    else:
        B = ttk.Combobox(F,
                         textvariable=VARS[4],
                         values=[],
                         state='readonly',
                         width=10)
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVar2NameList2)
        F.grid(row=2, column=0, columnspan=1, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B, text='Variable 2 (ordinates).')
        WIDGETS['var2'] = B

    # - Ranges -
    B = TTK.Scale(Frame,
                  from_=0,
                  to=100,
                  orient=TK.HORIZONTAL,
                  showvalue=0,
                  borderwidth=1,
                  command=display1D,
                  value=50)
    WIDGETS['rangePos'] = B
    B.grid(row=3, column=0, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Move range.')
    B = TTK.Scale(Frame,
                  from_=0,
                  to=100,
                  orient=TK.HORIZONTAL,
                  showvalue=0,
                  borderwidth=1,
                  command=display1D,
                  value=0)
    WIDGETS['rangeZoom'] = B
    B.grid(row=3, column=1, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Zoom range.')

    # - Set in slot -
    B = TTK.Button(Frame, text="Set", command=display1D)
    B.grid(row=4, column=0, columnspan=3, sticky=TK.EW)
def createApp(win):

    ttk = CTK.importTtk()

    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkTreeOps',
                           font=CTK.FRAMEFONT,
                           takefocus=1)

    #BB = CTK.infoBulle(parent=Frame, text='Operations on pyTree.\nCtrl+c to close applet.', temps=0, btype=1)
    Frame.bind('<Control-c>', hideApp)
    Frame.bind('<ButtonRelease-3>', displayFrameMenu)
    Frame.bind('<Enter>', lambda event: Frame.focus_set())
    Frame.columnconfigure(0, weight=1)
    Frame.columnconfigure(1, weight=1)
    Frame.columnconfigure(2, weight=1)
    WIDGETS['frame'] = Frame

    # - Frame menu -
    FrameMenu = TK.Menu(Frame, tearoff=0)
    FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp)
    CTK.addPinMenu(FrameMenu, 'tkTreeOps')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- Base to move to -
    V = TK.StringVar(win)
    V.set('New Base')
    VARS.append(V)
    # -1- Displayed index
    V = TK.StringVar(win)
    V.set('0')
    VARS.append(V)
    # -2- Displayed node value
    V = TK.StringVar(win)
    V.set('')
    VARS.append(V)
    # -3- Displayed node type
    V = TK.StringVar(win)
    V.set('')
    VARS.append(V)
    # -4- Displayed node name
    V = TK.StringVar(win)
    V.set('')
    VARS.append(V)
    # -5- Name/Type to be deleted
    V = TK.StringVar(win)
    V.set('')
    VARS.append(V)
    # -6- Type of deletion
    V = TK.StringVar(win)
    V.set('Name')
    VARS.append(V)

    # - Move selection to base -
    B = TTK.Button(Frame, text="Move sel. to", command=moveSelection)
    BB = CTK.infoBulle(parent=B, text='Move selected zones to another base.')
    B.grid(row=0, column=0, sticky=TK.EW)

    F = TTK.Frame(Frame, borderwidth=0)
    F.columnconfigure(0, weight=1)
    if ttk is None:
        B = TK.OptionMenu(F, VARS[0], '')
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateBaseNameList)
    else:
        VARS[0].set('newBase')
        B = ttk.Combobox(F, textvariable=VARS[0], values=[], state='normal')
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateBaseNameList2)
    F.grid(row=0, column=1, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Destination Base name.')
    WIDGETS['base'] = B

    # - Move nodes up/down/import selection in tkTree
    B = TTK.Button(Frame, text="Node Up", command=moveNodeUp)
    BB = CTK.infoBulle(parent=B, text='Move selected node in tkTree up.')
    B.grid(row=1, column=0, sticky=TK.EW)
    B = TTK.Button(Frame, text="Node Down", command=moveNodeDown)
    BB = CTK.infoBulle(parent=B, text='Move selected node in tkTree down.')
    B.grid(row=1, column=1, columnspan=2, sticky=TK.EW)

    # - Rm Nodes -
    #B = TK.Button(Frame, text="Rm node(s)", command=rmNodes)
    #BB = CTK.infoBulle(parent=B, text='Remove nodes from tree.\nYou can also use the Suppr key.')
    #B.grid(row=2, column=0, sticky=TK.EW)
    #B = TK.OptionMenu(Frame, VARS[6], 'Name', 'Type', 'Value')
    #B.grid(row=2, column=1, sticky=TK.EW)
    #B = TK.Entry(Frame, textvariable=VARS[5], background='White', width=5)
    #BB = CTK.infoBulle(parent=B, text='Enter node name or types. Wildcards are accepted.')
    #B.grid(row=2, column=2, sticky=TK.EW)

    # - Small node editor -
    F = TTK.LabelFrame(Frame,
                       borderwidth=2,
                       relief=CTK.FRAMESTYLE,
                       text='Edit node',
                       takefocus=1)
    F.columnconfigure(0, weight=1)
    F.columnconfigure(1, weight=4)
    F.grid(row=3, column=0, columnspan=3, sticky=TK.EW)
    B = TTK.Entry(F, textvariable=VARS[4], background='White', width=5)
    B.grid(row=0, column=0, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(
        parent=B,
        text='Selected node name.\nYou can change this by pressing <Enter>.')
    B.bind('<Return>', setNodeName)

    B = TTK.Entry(F, textvariable=VARS[3], background='White', width=5)
    B.grid(row=0, column=1, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(
        parent=B,
        text='Selected node type.\nYou can change this by pressing <Enter>.')
    B.bind('<Return>', setNodeType)

    FrameA = TK.Frame(F)
    FrameA.columnconfigure(0, weight=0)
    FrameA.columnconfigure(1, weight=1)
    FrameA.columnconfigure(2, weight=0)
    FrameA.grid(row=1, column=0, sticky=TK.EW)
    B = TTK.Entry(FrameA, textvariable=VARS[1], background='White', width=5)
    B.grid(row=0, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Displayed index (start: 0).')
    B.bind('<Return>', showNodeValue)
    B = TTK.Button(FrameA, text="<", command=decreaseIndex, width=2)
    B.grid(row=0, column=0, sticky=TK.EW)
    B = TTK.Button(FrameA, text=">", command=increaseIndex, width=2)
    B.grid(row=0, column=2, sticky=TK.EW)

    B = TTK.Entry(F, textvariable=VARS[2], background='White', width=5)
    B.grid(row=1, column=1, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(
        parent=B,
        text=
        'Selected node value at given index.\nYou can change this by pressing <Enter>.'
    )
    B.bind('<Return>', setNodeValue)
Exemple #12
0
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkText',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    Frame.bind('<Control-c>', hideApp)
    Frame.bind('<ButtonRelease-3>', displayFrameMenu)
    Frame.bind('<Enter>', lambda event: Frame.focus_set())
    Frame.columnconfigure(0, weight=1)
    Frame.columnconfigure(1, weight=1)
    Frame.columnconfigure(2, weight=1)
    WIDGETS['frame'] = Frame

    # - Frame menu -
    FrameMenu = TK.Menu(Frame, tearoff=0)
    FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp)
    FrameMenu.add_command(label='Save', command=saveApp)
    FrameMenu.add_command(label='Reset', command=resetApp)
    CTK.addPinMenu(FrameMenu, 'tkText')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- corps du texte -
    V = TK.StringVar(win)
    V.set('')
    VARS.append(V)
    # -1- 1D/2D/3D -
    V = TK.StringVar(win)
    V.set('3D')
    VARS.append(V)
    if 'tkTextDim' in CTK.PREFS: V.set(CTK.PREFS['tkTextDim'])
    # -2-  Smoothness -
    V = TK.StringVar(win)
    V.set('Regular')
    VARS.append(V)
    if 'tkTextSmoothness' in CTK.PREFS:
        V.set(CTK.PREFS['tkTextSmoothness'])
    # -3- Font -
    V = TK.StringVar(win)
    V.set('text1')
    VARS.append(V)
    if 'tkTextFont' in CTK.PREFS: V.set(CTK.PREFS['tkTextFont'])

    # - 1D/2D/3D -
    B = TTK.OptionMenu(Frame, VARS[1], '3D', '2D', '1D')
    BB = CTK.infoBulle(parent=B, text='Text type.')
    B.grid(row=0, column=0, sticky=TK.EW)

    # - Font -
    B = TTK.OptionMenu(Frame, VARS[3], 'text1', 'vera', 'chancery', 'courier',
                       'nimbus')
    BB = CTK.infoBulle(parent=B, text='Font type.')
    B.grid(row=0, column=1, sticky=TK.EW)

    # - Smoothness -
    B = TTK.OptionMenu(Frame, VARS[2], 'Regular', 'Smooth', 'Very smooth')
    BB = CTK.infoBulle(parent=B, text='Font smoothness.')
    B.grid(row=0, column=2, sticky=TK.EW)

    # - Text -
    B = TTK.Entry(Frame, textvariable=VARS[0], background='White')
    B.bind('<Return>', createText)
    B.grid(row=1, column=0, columnspan=3, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Your text.')

    # - Create text -
    B = TTK.Button(Frame, text="Create text", command=createText)
    B.grid(row=2, column=0, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Create the text in TEXT basis.')

    # - Replace text -
    B = TTK.Button(Frame, text="Replace", command=replaceText)
    B.grid(row=2, column=2, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Replace selected text with new text.')
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkFind',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    Frame.bind('<Control-c>', hideApp)
    Frame.bind('<ButtonRelease-3>', displayFrameMenu)
    Frame.bind('<Enter>', lambda event: Frame.focus_set())
    Frame.columnconfigure(0, weight=1)
    Frame.columnconfigure(1, weight=4)
    WIDGETS['frame'] = Frame

    # - Frame menu -
    FrameMenu = TK.Menu(Frame, tearoff=0)
    FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp)
    FrameMenu.add_command(label='Save', command=saveApp)
    FrameMenu.add_command(label='Reset', command=resetApp)
    CTK.addPinMenu(FrameMenu, 'tkFind')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- type (node/elements/coordinates) -
    V = TK.StringVar(win)
    V.set('Node index')
    VARS.append(V)
    if 'tkFindDataType' in CTK.PREFS: V.set(CTK.PREFS['tkFindDataType'])
    # -1- value -
    V = TK.StringVar(win)
    V.set('0')
    VARS.append(V)

    # - Value -
    B = TTK.Entry(Frame, textvariable=VARS[1], background='White')
    B.bind('<Return>', find)
    B.grid(row=0, column=1, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(
        parent=B,
        text=
        'Index to find/extract in selected mesh.\nCan be a global index (0 starts)\nor (i,j,k) (1 starts) for structured grids.\nFor extraction, you can define a list of indices.'
    )

    # - type -
    B = TTK.OptionMenu(Frame, VARS[0], 'Node index', 'Element index',
                       'Coordinates')
    BB = CTK.infoBulle(parent=B, text='Type of data to be searched.')
    B.grid(row=0, column=0, sticky=TK.EW)

    # - Find -
    B = TTK.Button(Frame, text="Find", command=find)
    B.grid(row=1, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(
        parent=B, text='Find the given index/coordinates in selected mesh.')

    # - Extract -
    B = TTK.Button(Frame, text="Extract", command=extract)
    B.grid(row=1, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B,
                       text='Extract the given index/coordinates cells.')
def createApp(win):

    ttk = CTK.importTtk()

    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkVariable',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Manage field variables.\nCtrl+c to close applet.', temps=0, btype=1)
    Frame.bind('<Control-c>', hideApp)
    Frame.bind('<ButtonRelease-3>', displayFrameMenu)
    Frame.bind('<Enter>', lambda event: Frame.focus_set())
    Frame.columnconfigure(0, weight=1)
    Frame.columnconfigure(1, weight=4)
    WIDGETS['frame'] = Frame

    # - Frame menu -
    FrameMenu = TK.Menu(Frame, tearoff=0)
    FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp)
    FrameMenu.add_command(label='Save', command=saveApp)
    FrameMenu.add_command(label='Reset', command=resetApp)
    CTK.addPinMenu(FrameMenu, 'tkVariables')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- computeVariable name
    V = TK.StringVar(win)
    V.set('Pressure')
    VARS.append(V)
    if 'tkVariablesName' in CTK.PREFS:
        V.set(CTK.PREFS['tkVariablesName'])
    # -1- addVar
    V = TK.StringVar(win)
    V.set('Density')
    VARS.append(V)
    if 'tkVariablesAddVar' in CTK.PREFS:
        V.set(CTK.PREFS['tkVariablesAddVar'])
    # -2- computeGrad -
    V = TK.StringVar(win)
    V.set('CoordinateX')
    VARS.append(V)
    # -3- computeCurl -
    V = TK.StringVar(win)
    V.set('MomentumX;MomentumY;MomentumZ')
    VARS.append(V)
    # -4- importFile -
    V = TK.StringVar(win)
    V.set('output.plt')
    VARS.append(V)
    if 'tkVariablesImportFile' in CTK.PREFS:
        V.set(CTK.PREFS['tkVariablesImportFile'])
    # -5- Rm variable
    V = TK.StringVar(win)
    V.set('All')
    VARS.append(V)
    # -6- Var location
    V = TK.StringVar(win)
    V.set('nodes')
    VARS.append(V)
    if 'tkVariablesLoc' in CTK.PREFS:
        V.set(CTK.PREFS['tkVariablesLoc'])
    # -7- adim type
    V = TK.StringVar(win)
    V.set('Adim1 (ro,a,T)')
    VARS.append(V)
    if 'tkVariablesAdim' in CTK.PREFS:
        V.set(CTK.PREFS['tkVariablesAdim'])
    # -8- center2Node variable
    V = TK.StringVar(win)
    V.set('FlowSolutionCenters')
    VARS.append(V)
    # -9- node2Center variable
    V = TK.StringVar(win)
    V.set('FlowSolutionNodes')
    VARS.append(V)
    # -10- renameVar variable - new
    V = TK.StringVar(win)
    V.set('CoordinateX')
    VARS.append(V)
    # -11- renameVar variable - prev
    V = TK.StringVar(win)
    V.set('x')
    VARS.append(V)

    # - importFile -
    norow = 0
    B = TTK.Button(Frame, text="Import file", command=importFile)
    B.grid(row=norow, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B,
                       text='Import solution file into existing pyTree.')
    F = TTK.Frame(Frame, borderwidth=0)
    F.columnconfigure(0, weight=1)
    F.columnconfigure(1, weight=0)
    B = TTK.Entry(F, textvariable=VARS[4], background='White')
    B.bind('<Return>', importFile)
    B.grid(row=norow, column=0, sticky=TK.EW)
    B = TTK.Button(F, text="...", padx=0, command=chooseImportFile)
    BB = CTK.infoBulle(parent=B, text='Select solution file.')
    B.grid(row=norow, column=1, sticky=TK.EW)
    F.grid(row=norow, column=1, sticky=TK.EW)

    # - addVar -
    norow += 1
    B = TTK.Button(Frame, text="Add/modify variable", command=addVar)
    B.grid(row=norow, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(
        parent=B,
        text=
        'Add a new variable into pyTree. A formula of type: Density=3*{CoordinateX} can be specified.'
    )
    B = TTK.Entry(Frame, textvariable=VARS[1], background='White')
    B.bind('<Return>', addVar)
    B.grid(row=norow, column=1, sticky=TK.EW)

    # - rmVar -
    norow += 1
    B = TTK.Button(Frame, text="Rm variable", command=rmVar)
    B.grid(row=norow, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Rm variable from pyTree.')

    F = TTK.Frame(Frame, borderwidth=0)
    F.columnconfigure(0, weight=1)

    if ttk is None:
        B = TK.OptionMenu(F, VARS[5], '')
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVarNameList1)
        F.grid(row=norow, column=1, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B, text='Removed variable.')
        WIDGETS['var1'] = B
    else:
        B = ttk.Combobox(F, textvariable=VARS[5], values=[], state='readonly')
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVarNameList1_2)
        F.grid(row=norow, column=1, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B, text='Removed variable.')
        WIDGETS['var1'] = B

    # - renameVar -
    #norow+= 1
    #F = TTK.Frame(Frame, borderwidth=0)
    #F.columnconfigure(0, weight=1)
    #if ttk is None:
    #    B = TK.OptionMenu(F, VARS[11], '')
    #    B.grid(sticky=TK.EW)
    #    F.bind('<Enter>', updateVarNameList5)
    #    F.grid(row=norow, column=0, sticky=TK.EW)
    #    BB = CTK.infoBulle(parent=B, text='Renamed variable.')
    #    WIDGETS['var5'] = B
    #else:
    #    B = ttk.Combobox(F, textvariable=VARS[11],
    #                     values=[], state='readonly')
    #    B.grid(sticky=TK.EW)
    #    F.bind('<Enter>', updateVarNameList5_2)
    #    F.grid(row=norow, column=0, sticky=TK.EW)
    #    BB = CTK.infoBulle(parent=B, text='Renamed variable.')
    #    WIDGETS['var5'] = B
    #B = TK.Entry(Frame, textvariable=VARS[10], background='White')
    #B.bind('<Return>', renameVar)
    #B.grid(row=norow, column=1, sticky=TK.EW)
    #norow+=1
    #B = TK.Button(Frame, text="Rename variable", command=renameVar)
    #B.grid(row=norow, column=0, columnspan=2, sticky=TK.EW)
    #BB = CTK.infoBulle(parent=B, text='Rename variable from pyTree.')

    # - center2Node var -
    norow += 1
    B = TTK.Button(Frame, text="Center2Node", command=center2NodeVar)
    B.grid(row=norow, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B,
                       text='Put a center variable to nodes in pyTree.')
    F = TTK.Frame(Frame, borderwidth=0)
    F.columnconfigure(0, weight=1)

    if ttk is None:
        B = TK.OptionMenu(F, VARS[8], '')
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVarNameList3)
        F.grid(row=norow, column=1, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B,
                           text='Center variable to be set in nodes.')
        WIDGETS['var3'] = B
    else:
        B = ttk.Combobox(F, textvariable=VARS[8], values=[], state='readonly')
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVarNameList3_2)
        F.grid(row=norow, column=1, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B,
                           text='Center variable to be set in nodes.')
        WIDGETS['var3'] = B

    # - node2Center var -
    norow += 1
    B = TTK.Button(Frame, text="Node2Center", command=node2CenterVar)
    B.grid(row=norow, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B,
                       text='Put a node variable to centers in pyTree.')

    F = TTK.Frame(Frame, borderwidth=0)
    F.columnconfigure(0, weight=1)

    if ttk is None:
        B = TK.OptionMenu(F, VARS[9], '')
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVarNameList4)
        F.grid(row=norow, column=1, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B,
                           text='Node variable to be set in centers.')
        WIDGETS['var4'] = B
    else:
        B = ttk.Combobox(F, textvariable=VARS[9], values=[], state='readonly')
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVarNameList4_2)
        F.grid(row=norow, column=1, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B,
                           text='Node variable to be set in centers.')
        WIDGETS['var4'] = B

    # - computeGrad -
    norow += 1
    F = TTK.Frame(Frame, borderwidth=0)
    F.columnconfigure(0, weight=1)
    F.columnconfigure(1, weight=1)
    B = TTK.Button(F, text="Grad", command=computeGrad)
    BB = CTK.infoBulle(parent=B, text='Compute gradient of variables.')
    B.grid(row=0, column=0, sticky=TK.EW)
    B = TTK.Button(F, text="Norm", command=computeNormGrad)
    BB = CTK.infoBulle(parent=B, text='Compute gradient\' norm of variables.')
    B.grid(row=0, column=1, sticky=TK.EW)
    F.grid(row=norow, column=0, sticky=TK.EW)
    F = TTK.Frame(Frame, borderwidth=0)
    F.columnconfigure(0, weight=1)
    if ttk is None:
        B = TK.OptionMenu(F, VARS[2], '')
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVarNameList2)
        F.grid(row=norow, column=1, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B, text='Variable for gradient.')
        WIDGETS['var2'] = B
    else:
        B = ttk.Combobox(F, textvariable=VARS[2], values=[], state='readonly')
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVarNameList2_2)
        F.grid(row=norow, column=1, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B, text='Variable for gradient.')
        WIDGETS['var2'] = B

    # - computeCurl -
    norow += 1
    F = TTK.Frame(Frame, borderwidth=0)
    F.columnconfigure(0, weight=1)
    F.columnconfigure(1, weight=1)
    B = TTK.Button(F, text="Curl ", command=computeCurl)
    BB = CTK.infoBulle(parent=B, text='Compute curl of variables.')
    B.grid(row=0, column=0, sticky=TK.EW)
    B = TTK.Button(F, text="Norm", command=computeNormCurl)
    BB = CTK.infoBulle(parent=B, text='Compute gradient\' norm of variables.')
    B.grid(row=0, column=1, sticky=TK.EW)
    F.grid(row=norow, column=0, sticky=TK.EW)

    B = TTK.Entry(Frame, textvariable=VARS[3], background='White')
    BB = CTK.infoBulle(parent=B, text='Variables for curl.')
    B.grid(row=norow, column=1, sticky=TK.EW)

    # - computeVariables -
    norow += 1
    B = TTK.OptionMenu(Frame, VARS[7], 'Adim1 (ro,a,T)', 'Adim2 (ro,u,T)')
    B.grid(row=norow, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B,
                       text='Use this adimensioning for variable computation.')
    B = TTK.OptionMenu(Frame, VARS[6], 'nodes', 'centers')
    B.grid(row=norow, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B,
                       text='Computed variable will be localized here.')

    norow += 1
    B = TTK.Button(Frame, text="Compute variable", command=computeVariables)
    B.grid(row=norow, column=0, sticky=TK.EW)
    B = TTK.OptionMenu(Frame, VARS[0],'Pressure','Temperature',
                       'VelocityMagnitude','VelocityX',\
                       'VelocityY','VelocityZ','Enthalpy','Entropy','Mach',\
                       'ViscosityMolecular','PressureStagnation',\
                       'TemperatureStagnation', 'PressureDynamic',
                       'Vorticity', 'VorticityMagnitude', 'QCriterion',
                       'ShearStress', 'SkinFriction', 'SkinFrictionTangential')
    B.grid(row=norow, column=1, sticky=TK.EW)

    # fill missing variables
    norow += 1
    B = TTK.Button(Frame,
                   text="Fill missing variables",
                   command=fillMissingVariables)
    B.grid(row=norow, column=0, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B,
                       text='All zones will have the same variables.')
def createApp(win):
    ttk = CTK.importTtk()

    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkPrefs',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Set Cassiopee preferences.\nCtrl+c to close applet.', temps=0, btype=1)
    Frame.bind('<Control-c>', hideApp)
    Frame.bind('<ButtonRelease-3>', displayFrameMenu)
    Frame.bind('<Enter>', lambda event: Frame.focus_set())
    Frame.columnconfigure(0, weight=1)
    Frame.columnconfigure(1, weight=2)
    WIDGETS['frame'] = Frame

    # - Frame menu -
    FrameMenu = TK.Menu(Frame, tearoff=0)
    FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp)
    FrameMenu.add_command(label='Save', command=saveApp)
    #FrameMenu.add_command(label='Reset', command=resetApp)
    CTK.addPinMenu(FrameMenu, 'tkPrefs')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- Default mesh display style -
    V = TK.StringVar(win)
    V.set('Monocolor wires+solid')
    VARS.append(V)
    # -1- Undo
    V = TK.StringVar(win)
    V.set('Active')
    VARS.append(V)
    # -2- DisplayInfo
    V = TK.StringVar(win)
    V.set('Active')
    VARS.append(V)
    # -3- bgColor
    V = TK.StringVar(win)
    V.set('Black')
    VARS.append(V)
    # -4- auto open apps
    V = TK.StringVar(win)
    V.set('')
    VARS.append(V)
    # -5- Default solid display style -
    V = TK.StringVar(win)
    V.set('Monocolor/1-side')
    VARS.append(V)
    # -6- Default envmap
    V = TK.StringVar(win)
    V.set('windtunnel.png')
    VARS.append(V)
    # -7- Selection style
    V = TK.StringVar(win)
    V.set('Blue')
    VARS.append(V)
    # -8- Export resolution
    V = TK.StringVar(win)
    V.set('1120x820')
    VARS.append(V)
    # -9- GUI Theme
    V = TK.StringVar(win)
    V.set('default')
    VARS.append(V)

    # Init VARS par le fichier de preferences
    CTK.loadPrefFile()
    for i in CTK.PREFS:
        k1 = CTK.PREFS[i]
        if i == 'undo':
            if k1 == '1': VARS[1].set('Active')
            elif k1 == '0': VARS[1].set('Inactive')
        elif i == 'displayInfo':
            if k1 == '1': VARS[2].set('Active')
            elif k1 == '0': VARS[2].set('Inactive')
        elif i == 'bgColor':
            if k1 == '0': VARS[3].set('Black')
            elif k1 == '1': VARS[3].set('White')
            elif k1 == '2': VARS[3].set('Grey')
            elif k1 == '3': VARS[3].set('Yellow')
            elif k1 == '4': VARS[3].set('Blue')
            elif k1 == '5': VARS[3].set('Red')
            elif k1 == '6': VARS[3].set('Paper1')
            elif k1 == '7': VARS[3].set('Paper2')
            elif k1 == '8': VARS[3].set('Arch')
            elif k1 == '9': VARS[3].set('Jarvis')
            elif k1 == '10': VARS[3].set('Onera')
        elif i == 'auto': VARS[4].set(k1)
        elif i == 'envmap': VARS[6].set(k1)
        elif i == 'selectionStyle': VARS[7].set(k1)
        elif i == 'exportResolution': VARS[8].set(k1)
        elif i == 'guitheme': VARS[9].set(k1)

    r = 0
    # - gui theme -
    B = TTK.Label(Frame, text="GUI Theme")
    B.grid(row=r, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Style for GUI (buttons,...).')

    F = TTK.Frame(Frame, borderwidth=0)
    F.columnconfigure(0, weight=1)
    if ttk is None:
        B = TTK.OptionMenu(F, VARS[9], 'default')
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateThemeList)
        F.grid(row=r, column=1, sticky=TK.EW)
        WIDGETS['guitheme'] = B
    else:
        B = ttk.Combobox(F,
                         textvariable=VARS[9],
                         values=[],
                         state='readonly',
                         width=10)
        B.bind('<<ComboboxSelected>>', setTheme)
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateThemeList2)
        F.grid(row=r, column=1, sticky=TK.EW)
        WIDGETS['guitheme'] = B
    r += 1

    # - Default display info style -
    B = TTK.Label(Frame, text="Display Info")
    B.grid(row=r, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Default display info style.')
    B = TTK.OptionMenu(Frame,
                       VARS[2],
                       'Active',
                       'Inactive',
                       command=setDisplayInfo)
    B.grid(row=r, column=1, sticky=TK.EW)
    r += 1

    # - Default background color -
    B = TTK.Label(Frame, text="Background")
    B.grid(row=r, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Default background color or image.')
    B = TTK.OptionMenu(Frame,
                       VARS[3],
                       'Black',
                       'White',
                       'Grey',
                       'Yellow',
                       'Blue',
                       'Red',
                       'Paper1',
                       'Paper2',
                       'Arch',
                       'Jarvis',
                       'Onera',
                       command=setBgColor)
    B.grid(row=r, column=1, sticky=TK.EW)
    r += 1

    # - Undo -
    B = TTK.Label(Frame, text="Undo")
    B.grid(row=r, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Undo is active.')
    B = TTK.OptionMenu(Frame, VARS[1], 'Active', 'Inactive', command=setUndo)
    B.grid(row=r, column=1, sticky=TK.EW)
    r += 1

    # - selection style -
    B = TTK.Label(Frame, text="Selection")
    B.grid(row=r, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Selection style.')
    B = TTK.OptionMenu(Frame,
                       VARS[7],
                       'Blue',
                       'Alpha',
                       command=setSelectionStyle)
    B.grid(row=r, column=1, sticky=TK.EW)
    r += 1

    # - Envmap -
    B = TTK.Label(Frame, text="Envmap")
    B.grid(row=r, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Environment map (chrome/glass render).')
    B = TTK.OptionMenu(Frame,
                       VARS[6],
                       'windtunnel.png',
                       'sky.png',
                       'city.png',
                       'forest.png',
                       'house.png',
                       command=setEnvmap)
    B.grid(row=r, column=1, sticky=TK.EW)
    r += 1

    # - export resolution -
    B = TTK.Label(Frame, text="Export")
    B.grid(row=r, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Resolution for image export.')
    B = TTK.Entry(Frame, textvariable=VARS[8], background='White', width=5)
    B.bind('<Return>', setExportRes)
    BB = CTK.infoBulle(parent=B, text='Resolution for image export.')
    B.grid(row=r, column=1, sticky=TK.EW)
    r += 1

    # - Auto open apps -
    #B = TK.Button(Frame, text='Opened apps', command=getOpenedApps)
    #BB = CTK.infoBulle(parent=B, text='Keep currently opened apps for next restart.')
    #B.grid(row=r, column=0, sticky=TK.EW)
    #B = TK.Button(Frame, text='Classic apps', command=getClassicApps)
    #BB = CTK.infoBulle(parent=B, text='Keep a classic set of apps for next restart.')
    #B.grid(row=r, column=1, sticky=TK.EW)
    #r += 1
    #B = TK.Label(Frame, text="Auto open")
    #B.grid(row=r, column=0, sticky=TK.EW)
    #BB = CTK.infoBulle(parent=B, text='Open automatically these apps for next restart (tkTree;tkBC;...)')
    #B = TK.Entry(Frame, textvariable=VARS[4], background='White')
    #BB = CTK.infoBulle(parent=B, text='Apps opened for next restart (tkTree;tkBC;...)')
    #B.grid(row=r, column=1, sticky=TK.EW)
    #r += 1

    # - Set prefs -
    #B = TK.Button(Frame, text="Set prefs", command=setPrefs)
    #B.grid(row=r, column=0, columnspan=2, sticky=TK.EW)
    #BB = CTK.infoBulle(parent=B, text='Set prefs in Cassiopee.')
    #WIDGETS.append(B); r += 1

    # - Save prefs -
    B = TTK.Button(Frame, text="Save prefs", command=savePrefs)
    B.grid(row=r, column=0, columnspan=2, sticky=TK.EW)
    B = CTK.infoBulle(parent=B, text='Save pref file (.cassiopee).')
    r += 1
Exemple #16
0
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win, borderwidth=2, relief=CTK.FRAMESTYLE,
                           text='tkCollarMesh', font=CTK.FRAMEFONT, takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Generate collar meshes.\nCtrl+c to close applet.', temps=0, btype=1)
    Frame.bind('<Control-c>', hideApp)
    Frame.bind('<ButtonRelease-3>', displayFrameMenu)
    Frame.bind('<Enter>', lambda event : Frame.focus_set())
    Frame.columnconfigure(0, weight=2)
    Frame.columnconfigure(1, weight=2)
    Frame.columnconfigure(2, weight=1)
    Frame.columnconfigure(3, weight=1)
    WIDGETS['frame'] = Frame
    
    # - Frame menu -
    FrameMenu = TK.Menu(Frame, tearoff=0)
    FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp)
    FrameMenu.add_command(label='Save', command=saveApp)
    FrameMenu.add_command(label='Reset', command=resetApp)
    CTK.addPinMenu(FrameMenu, 'tkCollarMesh')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- Surface1- 
    V = TK.StringVar(win); V.set(''); VARS.append(V)
    # -1- Surface2- 
    V = TK.StringVar(win); V.set(''); VARS.append(V)
    # -2- hauteur de la maille dans la direction j
    V = TK.StringVar(win); V.set('1.e-1'); VARS.append(V)
    if 'tkCollarMeshHj' in CTK.PREFS: V.set(CTK.PREFS['tkCollarMeshHj'])
    # -3- nombre de layers a ajouter en j
    V = TK.StringVar(win); V.set('10'); VARS.append(V)
    if 'tkCollarMeshNj' in CTK.PREFS: V.set(CTK.PREFS['tkCollarMeshNj'])
    # -4- nombre d'iteration de lissage dans la direction j
    V = TK.StringVar(win); V.set('50'); VARS.append(V)
    if 'tkCollarMeshSj' in CTK.PREFS: V.set(CTK.PREFS['tkCollarMeshSj'])
    # -5- hauteur de la maille dans la direction k
    V = TK.StringVar(win); V.set('1.e-1'); VARS.append(V)
    if 'tkCollarMeshHk' in CTK.PREFS: V.set(CTK.PREFS['tkCollarMeshHk'])
    # -6- nombre de layers a ajouter en k
    V = TK.StringVar(win); V.set('10'); VARS.append(V)
    if 'tkCollarMeshNk' in CTK.PREFS: V.set(CTK.PREFS['tkCollarMeshNk'])
    # -7- nombre d'iteration de lissage dans la direction k
    V = TK.StringVar(win); V.set('50'); VARS.append(V)
    if 'tkCollarMeshSk' in CTK.PREFS: V.set(CTK.PREFS['tkCollarMeshSk'])
    # -8- Constraints for surface1
    V = TK.StringVar(win); V.set(''); VARS.append(V)
    # -9- Constraints for surface2
    V = TK.StringVar(win); V.set(''); VARS.append(V)
    
    # - Surface1 -
    B = TTK.Button(Frame, text="Surf1", command=setSurface1,
                   image=iconics.PHOTO[8], padx=0, pady=0, compound=TK.RIGHT)
    B.grid(row=0, column=2, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Set collar surfaces 1.')
    B = TTK.Entry(Frame, textvariable=VARS[0], background='White')
    B.grid(row=0, column=0, columnspan=2, sticky=TK.EW)
   
    # - Surface2 -
    B = TTK.Button(Frame, text="Surf2", command=setSurface2,
                   image=iconics.PHOTO[8], padx=0, pady=0, compound=TK.RIGHT)
    B.grid(row=1, column=2, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Set collar surfaces 2.')
    B = TTK.Entry(Frame, textvariable=VARS[1], background='White')
    B.grid(row=1, column=0, columnspan=2, sticky=TK.EW)
    
    # - Constraints1 -
    B = TTK.Button(Frame, text="Constr.1", command=setConstraintContour1,
                   image=iconics.PHOTO[8], padx=0, pady=0, compound=TK.RIGHT)
    B.grid(row=2, column=2, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Set constraint contours for Surf1.')
    B = TTK.Entry(Frame, textvariable=VARS[8], background='White')
    B.grid(row=2, column=0,  columnspan=2, sticky=TK.EW)
    
    # - Constraints2 -
    B = TTK.Button(Frame, text="Constr.2", command=setConstraintContour2,
                   image=iconics.PHOTO[8], padx=0, pady=0, compound=TK.RIGHT)
    B.grid(row=3, column=2, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Set constraint contours for Surf2.')
    B = TTK.Entry(Frame, textvariable=VARS[9], background='White')
    B.grid(row=3, column=0,  columnspan=2, sticky=TK.EW)
    
    # - Walk in j -
    B = TTK.Label(Frame, text="j-dir", width=2)
    B.grid(row=4, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame, textvariable=VARS[2], background='White', width=5)
    B.grid(row=4, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Height of each j-layer.')

    B = TTK.Entry(Frame, textvariable=VARS[3], background='White', width=5)
    B.grid(row=4, column=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Number of j-layers.')

    B = TTK.Entry(Frame, textvariable=VARS[4], background='White', width=5)
    B.grid(row=4, column=3, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Number of j-smoothing iterations.')
    
    # - Walk in k -
    B = TTK.Label(Frame, text="k-dir", width=2)
    B.grid(row=5, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame, textvariable=VARS[5], background='White', width=5)
    B.grid(row=5, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Height of each k-layer.')

    B = TTK.Entry(Frame, textvariable=VARS[6], background='White', width=5)
    B.grid(row=5, column=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Number of k-layers.')

    B = TTK.Entry(Frame, textvariable=VARS[7], background='White', width=5)
    B.grid(row=5, column=3, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Number of k-smoothing iterations.')
    
    # - Union -
    B = TTK.Button(Frame, text="Union", command=unionCollarMesh)
    B.grid(row=6, column=0, columnspan=2,sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Collar mesh for union assembly.')

    # - Difference -
    B = TTK.Button(Frame, text="Difference", command=differenceCollarMesh)
    B.grid(row=6, column=2, columnspan=2,sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Collar mesh for difference assembly.')
Exemple #17
0
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkCheckPyTree',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Check your pyTree.\nCtrl+c to close applet.', temps=0, btype=1)
    Frame.bind('<Control-c>', hideApp)
    Frame.bind('<ButtonRelease-3>', displayFrameMenu)
    Frame.bind('<Enter>', lambda event: Frame.focus_set())
    Frame.columnconfigure(0, weight=1)
    Frame.columnconfigure(1, weight=1)
    Frame.columnconfigure(2, weight=1)
    Frame.columnconfigure(3, weight=1)
    Frame.columnconfigure(4, weight=1)
    Frame.columnconfigure(5, weight=1)
    WIDGETS['frame'] = Frame

    # - Frame menu -
    FrameMenu = TK.Menu(Frame, tearoff=0)
    FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp)
    FrameMenu.add_command(label='Save', command=saveApp)
    FrameMenu.add_command(label='Reset', command=resetApp)
    CTK.addPinMenu(FrameMenu, 'tkCheckPyTree')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- MinPtsPerCoarseGrid -
    V = TK.StringVar(win)
    V.set('5')
    VARS.append(V)
    if 'tkCheckPyTree0' in CTK.PREFS: V.set(CTK.PREFS['tkCheckPyTree0'])
    # -1- MinPtsPerCoarseWin -
    V = TK.StringVar(win)
    V.set('3')
    VARS.append(V)
    if 'tkCheckPyTree1' in CTK.PREFS: V.set(CTK.PREFS['tkCheckPyTree1'])
    # -2- Multigrid level
    V = TK.StringVar(win)
    V.set('1')
    VARS.append(V)
    if 'tkCheckPyTree2' in CTK.PREFS: V.set(CTK.PREFS['tkCheckPyTree2'])
    # -3- global option menu -> things to check
    V = TK.StringVar(win)
    V.set('All conformity')
    VARS.append(V)

    # - MinPtsPerZone on coarse level -
    B = TTK.Entry(Frame, textvariable=VARS[0], background='White', width=5)
    BB = CTK.infoBulle(
        parent=B,
        text=
        'Checked maximum number of points per zone, \nif Maximum number of nodes is selected. \nChecked minimum number of points per direction on coarse grid \nwhen Multigrid compatibility is selected.'
    )
    B.grid(row=0, column=0, columnspan=2, sticky=TK.EW)

    # - MinPtsPerWin on coarse level -
    B = TTK.Entry(Frame, textvariable=VARS[1], background='White', width=5)
    BB = CTK.infoBulle(
        parent=B,
        text=
        'Checked minimum number of points per direction in BCs on coarse grid, \nwhen Multigrid compatibility is selected.'
    )
    B.grid(row=0, column=2, columnspan=2, sticky=TK.EW)

    # - Checked multigrid level -
    B = TTK.Entry(Frame, textvariable=VARS[2], background='White', width=5)
    BB = CTK.infoBulle(
        parent=B,
        text=
        'Checked multigrid level,\nwhen Multigrid compatibility is selected.')
    B.grid(row=0, column=4, columnspan=2, sticky=TK.EW)

    # Option menu
    B = TTK.OptionMenu(Frame, VARS[3], 'All conformity', ' > Node conformity',
                       ' > Unique base name', ' > Unique zone name',
                       ' > Unique BC name', ' > Valid BC ranges',
                       ' > Valid BC match', ' > Referenced families',
                       ' > Valid CGNS types', ' > Valid element nodes',
                       ' > Valid CGNS flowfield name',
                       'Multigrid compatibility', 'Maximum number of nodes')
    B.grid(row=1, column=0, columnspan=8, sticky=TK.EW)

    # - Buttons -
    B = TTK.Button(Frame, text="Check", command=runCheckPyTree)
    B.grid(row=2, column=0, columnspan=4, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Check pyTree.')
    B = TTK.Button(Frame, text="Correct", command=correctPyTree)
    B.grid(row=2, column=4, columnspan=4, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Attemp to correct pyTree.')
Exemple #18
0
def createApp(win):
    ttk = CTK.importTtk()

    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkIsoLine',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Compute isolines.\nCtrl+c to close applet.', temps=0, btype=1)
    Frame.bind('<Control-c>', hideApp)
    Frame.bind('<ButtonRelease-3>', displayFrameMenu)
    Frame.bind('<Enter>', lambda event: Frame.focus_set())
    Frame.columnconfigure(0, weight=1)
    Frame.columnconfigure(1, weight=1)
    Frame.columnconfigure(2, weight=1)
    WIDGETS['frame'] = Frame

    # - Frame menu -
    FrameMenu = TK.Menu(Frame, tearoff=0)
    FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp)
    FrameMenu.add_command(label='Save', command=saveApp)
    FrameMenu.add_command(label='Reset', command=resetApp)
    CTK.addPinMenu(FrameMenu, 'tkIsoLine')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- Field name -
    V = TK.StringVar(win)
    V.set('CoordinateX')
    VARS.append(V)
    # -1- nlevels -
    V = TK.StringVar(win)
    V.set('25')
    VARS.append(V)
    if 'tkIsoLineLevels' in CTK.PREFS:
        V.set(CTK.PREFS['tkIsoLineLevels'])
    # -2- value -
    V = TK.StringVar(win)
    V.set('1.')
    VARS.append(V)
    if 'tkIsoLineValue' in CTK.PREFS:
        V.set(CTK.PREFS['tkIsoLineValue'])
    # -3- min iso
    V = TK.StringVar(win)
    V.set('MIN')
    VARS.append(V)
    if 'tkIsoLineMin' in CTK.PREFS:
        V.set(CTK.PREFS['tkIsoLineMin'])
    # -4- max iso
    V = TK.StringVar(win)
    V.set('MAX')
    VARS.append(V)
    V = TK.StringVar(win)
    V.set('MIN')
    VARS.append(V)
    if 'tkIsoLineMax' in CTK.PREFS:
        V.set(CTK.PREFS['tkIsoLineMax'])

    # - field name -
    B = TTK.Label(Frame, text="Field:")
    B.grid(row=0, column=0, sticky=TK.EW)
    F = TTK.Frame(Frame, borderwidth=0)
    F.columnconfigure(0, weight=1)

    if ttk is None:
        B = TK.OptionMenu(F, VARS[0], '')
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVarNameList)
        F.grid(row=0, column=1, columnspan=2, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B, text='Extracted field.')
        WIDGETS['field'] = B
    else:
        B = ttk.Combobox(F, textvariable=VARS[0], values=[], state='readonly')
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVarNameList2)
        F.grid(row=0, column=1, columnspan=2, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B, text='Extracted field.')
        WIDGETS['field'] = B

    if CTK.t != []:
        vars = C.getVarNames(CTK.t)
        if (len(vars) > 0):
            if (len(vars[0]) > 0): VARS[0].set(vars[0][0])

    # - nlevels -
    #B = TK.Label(Frame, text="Nlevels:")
    #B.grid(row=1, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame, textvariable=VARS[1], background='White', width=7)
    BB = CTK.infoBulle(parent=B, text='Number of levels.')
    B.grid(row=1, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame, textvariable=VARS[3], background='White', width=7)
    BB = CTK.infoBulle(parent=B, text='Min value.')
    B.grid(row=1, column=1, sticky=TK.EW)
    B = TTK.Entry(Frame, textvariable=VARS[4], background='White', width=7)
    BB = CTK.infoBulle(parent=B, text='Max value.')
    B.grid(row=1, column=2, sticky=TK.EW)

    # - Draw all isolines -
    B = TTK.Button(Frame, text="Extract isolines", command=drawIsoLines)
    BB = CTK.infoBulle(parent=B, text='Extract isolines.')
    B.grid(row=2, column=0, columnspan=3, sticky=TK.EW)

    # - Value -
    B = TTK.Label(Frame, text="Value:")
    B.grid(row=3, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame, textvariable=VARS[2], background='White')
    B.grid(row=3, column=1, columnspan=2, sticky=TK.EW)

    # - Extract one isoline -
    B = TTK.Button(Frame, text="Extract isoline", command=extractIsoLine)
    B.grid(row=4, column=0, columnspan=3, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Extract one isoline to CONTOURS.')
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkBlader',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Automatic mesher for\nblades.\nCtrl+c to close applet.', temps=0, btype=1)
    Frame.bind('<Control-c>', hideApp)
    Frame.bind('<ButtonRelease-3>', displayFrameMenu)
    Frame.bind('<Enter>', lambda event: Frame.focus_set())
    Frame.columnconfigure(0, weight=0)
    Frame.columnconfigure(1, weight=1)
    WIDGETS['frame'] = Frame

    # - Frame menu -
    FrameMenu = TK.Menu(Frame, tearoff=0)
    FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp)
    FrameMenu.add_command(label='Save', command=saveApp)
    FrameMenu.add_command(label='Reset', command=resetApp)
    CTK.addPinMenu(FrameMenu, 'tkBlader')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- front split % -
    V = TK.StringVar(win)
    V.set('0.5')
    VARS.append(V)
    if 'tkBladerFrontSplit' in CTK.PREFS:
        V.set(CTK.PREFS['tkBladerFrontSplit'])
    # -1- front step -
    V = TK.StringVar(win)
    V.set('0.001')
    VARS.append(V)
    if 'tkBladerFrontStep' in CTK.PREFS:
        V.set(CTK.PREFS['tkBladerFrontStep'])
    # -2- other step -
    V = TK.StringVar(win)
    V.set('0.01')
    VARS.append(V)
    if 'tkBladerStep' in CTK.PREFS:
        V.set(CTK.PREFS['tkBladerStep'])
    # -3- delta line index -
    V = TK.StringVar(win)
    V.set('15')
    VARS.append(V)
    # -4- Dfar. Mesh height -
    V = TK.StringVar(win)
    V.set('0.3')
    VARS.append(V)
    if 'tkBladerHeight' in CTK.PREFS:
        V.set(CTK.PREFS['tkBladerHeight'])
    # -5- hp: step en envergure -
    V = TK.StringVar(win)
    V.set('0.02')
    VARS.append(V)
    if 'tkBladerSpanStep' in CTK.PREFS:
        V.set(CTK.PREFS['tkBladerSpanStep'])
    # -6- span: longeur de l'envergure -
    V = TK.StringVar(win)
    V.set('5.')
    VARS.append(V)
    if 'tkBladerSpan' in CTK.PREFS:
        V.set(CTK.PREFS['tkBladerSpan'])

    # - Step1 -
    B = TTK.Label(Frame, text='Front split %:')
    B.grid(row=0, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Split profile at %.')
    B = TTK.Entry(Frame, textvariable=VARS[0], background='White', width=5)
    B.grid(row=0, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Index for front split.')

    B = TTK.Label(Frame, text='Front step:')
    B.grid(row=1, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Front step.')
    B = TTK.Entry(Frame, textvariable=VARS[1], background='White', width=5)
    B.grid(row=1, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Step for front and back of profile.')

    B = TTK.Label(Frame, text='Profile step:')
    B.grid(row=2, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Profile step.')
    B = TTK.Entry(Frame, textvariable=VARS[2], background='White', width=5)
    B.grid(row=2, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Step on profile.')

    B = TTK.Label(Frame, text='Delta line index:')
    B.grid(row=3, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Index for delta line.')
    B = TTK.Entry(Frame, textvariable=VARS[3], background='White', width=5)
    B.grid(row=3, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Index for delta line.')

    B = TTK.Label(Frame, text='Mesh height:')
    B.grid(row=4, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Mesh height.')
    B = TTK.Entry(Frame, textvariable=VARS[4], background='White', width=5)
    B.grid(row=4, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Mesh height.')

    B = TTK.Button(Frame, text="Step 1", command=step1)
    B.grid(row=5, column=0, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Run step 1. Plane mesh.')

    B = TTK.Label(Frame, text='Span length:')
    B.grid(row=6, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Span length.')
    B = TTK.Entry(Frame, textvariable=VARS[6], background='White', width=5)
    B.grid(row=6, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Span length.')

    B = TTK.Label(Frame, text='Span step:')
    B.grid(row=7, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Step in span direction.')
    B = TTK.Entry(Frame, textvariable=VARS[5], background='White', width=5)
    B.grid(row=7, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Step in span direction.')

    B = TTK.Button(Frame, text="Step 2", command=step2)
    B.grid(row=8, column=0, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Run step 2. Volume mesh.')
Exemple #20
0
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkSlice',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Visualize/extract slices.\nCtrl+c to close applet.', btype=1)
    Frame.bind('<Control-c>', hideApp)
    Frame.bind('<ButtonRelease-3>', displayFrameMenu)
    Frame.bind('<Enter>', lambda event: Frame.focus_set())
    Frame.columnconfigure(0, weight=1)
    Frame.columnconfigure(1, weight=1)
    Frame.columnconfigure(2, weight=4)
    WIDGETS['frame'] = Frame

    # - Frame menu -
    FrameMenu = TK.Menu(Frame, tearoff=0)
    FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp)
    FrameMenu.add_command(label='Save', command=saveApp)
    FrameMenu.add_command(label='Reset', command=resetApp)
    CTK.addPinMenu(FrameMenu, 'tkSlice')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- Slice dir
    V = TK.StringVar(win)
    V.set('X')
    VARS.append(V)
    # -1- position
    V = TK.StringVar(win)
    V.set('0')
    VARS.append(V)
    #V.trace_add("write", unselect)
    V.trace("w", lambda name, index, mode, V=V: unselect(V))
    # -2- epsilon for 2D slices
    V = TK.StringVar(win)
    V.set('1.e-6')
    VARS.append(V)
    # -3- Order
    V = TK.StringVar(win)
    V.set('2')
    VARS.append(V)
    # -4- Delta pour le move
    V = TK.StringVar(win)
    V.set('0.1')
    VARS.append(V)
    if 'tkSliceStep' in CTK.PREFS: V.set(CTK.PREFS['tkSliceStep'])
    # -5- slice algorithm
    V = TK.StringVar(win)
    V.set('Slice1')
    VARS.append(V)

    # - Settings -
    #B = TK.Entry(Frame, textvariable=VARS[2], background='White', width=3)
    #B.grid(row=0, column=0, sticky=TK.EW)
    #BB = CTK.infoBulle(parent=B, text='Tolerance for surface slice.')
    #B = TK.Entry(Frame, textvariable=VARS[3], background='White', width=3)
    #B.grid(row=0, column=1, sticky=TK.EW)
    #BB = CTK.infoBulle(parent=B, text='Order for interpolation.')
    #B = TK.Button(Frame, text="Fit", command=fit)
    #B.grid(row=0, column=2, sticky=TK.EW)
    #BB = CTK.infoBulle(parent=B, text='Fit slice to selection.')

    # Move
    B = TTK.Button(Frame, text="+", command=movePlus)
    B.grid(row=0, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Move slice +.')
    B = TTK.Button(Frame, text="-", command=moveMoins)
    B.grid(row=0, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Move slice -.')
    B = TTK.Entry(Frame, textvariable=VARS[4], background='White', width=3)
    B.grid(row=0, column=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Move step.')

    # Slice algorithm
    B = TTK.OptionMenu(Frame, VARS[5], 'Slice1', 'Slice2', 'Select+',
                       'Select-', 'Select=')
    BB = CTK.infoBulle(parent=B, text='Type of slice.')
    B.grid(row=1, column=0, columnspan=1, sticky=TK.EW)

    # - Position / type -
    B = TTK.OptionMenu(Frame, VARS[0], 'Mesh', 'X', 'Y', 'Z')
    B.grid(row=1, column=1, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Slice direction.')
    B = TTK.Entry(Frame, textvariable=VARS[1], background='White', width=3)
    B.grid(row=1, column=2, sticky=TK.EW)
    B.bind('<Return>', unselect)
    BB = CTK.infoBulle(
        parent=B,
        text=
        'Plane position.\nTaken from selection or set it here with no selection.'
    )

    # - Extract / view -
    B = TTK.Button(Frame, text="View", command=view)
    B.grid(row=2, column=0, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='View a slice.')
    B = TTK.Button(Frame, text="Extract", command=extract)
    B.grid(row=2, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Extract a slice to pyTree.')
    B = TTK.Button(Frame, text="Fit", command=fit)
    B.grid(row=2, column=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Fit slice to selection.')
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkTime',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Manage time.\nCtrl+c to close applet.', temps=0, btype=1)
    Frame.bind('<Control-c>', hideApp)
    Frame.bind('<ButtonRelease-3>', displayFrameMenu)
    Frame.bind('<Enter>', lambda event: Frame.focus_set())
    Frame.columnconfigure(0, weight=1)
    Frame.columnconfigure(1, weight=1)
    Frame.columnconfigure(2, weight=1)
    WIDGETS['frame'] = Frame

    # - Frame menu -
    FrameMenu = TK.Menu(Frame, tearoff=0)
    FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp)
    FrameMenu.add_command(label='Save', command=saveApp)
    FrameMenu.add_command(label='Reset', command=resetApp)
    CTK.addPinMenu(FrameMenu, 'tkTime')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- t0 -
    V = TK.StringVar(win)
    V.set('0.')
    VARS.append(V)
    if 'tkTimeT0' in CTK.PREFS: V.set(CTK.PREFS['tkTimeT0'])
    # -1- t -
    V = TK.StringVar(win)
    V.set('0.5')
    VARS.append(V)
    # -2- tf -
    V = TK.StringVar(win)
    V.set('1.')
    VARS.append(V)
    if 'tkTimeTF' in CTK.PREFS: V.set(CTK.PREFS['tkTimeTF'])
    # -3- Show only BCWall
    V = TK.StringVar(win)
    V.set('0')
    VARS.append(V)
    if 'tkTimeWall' in CTK.PREFS: V.set(CTK.PREFS['tkTimeWall'])
    # -4- time info bulle
    V = TK.StringVar(win)
    V.set('Time.')
    VARS.append(V)

    # - Times -
    B = TTK.Entry(Frame, textvariable=VARS[0], background='White', width=5)
    B.grid(row=0, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Starting time.')
    B = TTK.Entry(Frame, textvariable=VARS[1], background='White', width=5)
    B.grid(row=0, column=1, sticky=TK.EW)
    B.bind('<Return>', setTime)
    BB = CTK.infoBulle(parent=B, text='Current time.')
    WIDGETS['time'] = B
    B = TTK.Entry(Frame, textvariable=VARS[2], background='White', width=5)
    B.grid(row=0, column=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Final time.')

    # - Slider -
    B = TTK.Scale(Frame,
                  from_=0,
                  to=100,
                  orient=TK.HORIZONTAL,
                  showvalue=0,
                  borderwidth=1,
                  command=setSlider,
                  value=0)
    WIDGETS['slider'] = B
    B.grid(row=1, columnspan=3, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, textVariable=VARS[4])

    # - Options -
    B = TTK.Checkbutton(Frame,
                        text='Walls',
                        variable=VARS[3],
                        command=setWalls)
    BB = CTK.infoBulle(parent=B, text='Show only BCWalls.')
    B.grid(row=2, column=0, sticky=TK.EW)

    # - Play, stop -
    B = TTK.Button(Frame, text=">", command=playForward)
    B.grid(row=3, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Play forward.')

    B = TTK.Button(Frame, text="||", command=stop)
    B.grid(row=3, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Stop playing.')

    B = TTK.Button(Frame, text="<", command=playBackward)
    B.grid(row=3, column=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Play backward.')
Exemple #22
0
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkFilter',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Display/select certain blocks.\nCtrl+c to close applet.', temps=0, btype=1)
    Frame.bind('<Control-c>', hideApp)
    Frame.bind('<ButtonRelease-3>', displayFrameMenu)
    Frame.bind('<Enter>', lambda event: Frame.focus_set())
    Frame.columnconfigure(0, weight=1)
    Frame.columnconfigure(1, weight=4)
    WIDGETS['frame'] = Frame

    # - Frame menu -
    FrameMenu = TK.Menu(Frame, tearoff=0)
    FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp)
    FrameMenu.add_command(label='Save', command=saveApp)
    FrameMenu.add_command(label='Reset', command=resetApp)
    CTK.addPinMenu(FrameMenu, 'tkFilter')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- filter value -
    V = TK.StringVar(win)
    V.set('')
    VARS.append(V)
    if 'tkFilterValue' in CTK.PREFS: V.set(CTK.PREFS['tkFilterValue'])
    # -1- filter type
    V = TK.StringVar(win)
    V.set('By name')
    VARS.append(V)
    if 'tkFilterName' in CTK.PREFS: V.set(CTK.PREFS['tkFilterName'])
    # -2- action
    V = TK.StringVar(win)
    V.set('Activate')
    VARS.append(V)
    if 'tkFilterAction' in CTK.PREFS: V.set(CTK.PREFS['tkFilterAction'])

    # - Options -
    B = TTK.OptionMenu(Frame, VARS[2], 'Activate', 'Deactivate', 'Select')
    BB = CTK.infoBulle(parent=B,
                       text='Action to be performed on filtered zones.')
    B.grid(row=0, column=0, sticky=TK.EW)

    B = TTK.OptionMenu(Frame, VARS[1], 'By name', 'By size >', 'By size <',
                       'By MG lvl =', 'By MG lvl !=', 'By proc', 'By priority',
                       'By number', 'By formula (or)', 'By formula (and)')
    BB = CTK.infoBulle(parent=B, text='Filter criteria.')
    B.grid(row=0, column=1, sticky=TK.EW)

    # - Set filter -
    B = TTK.Button(Frame, text="Filter", command=setFilter)
    B.grid(row=1, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Apply filter.')

    B = TTK.Entry(Frame, textvariable=VARS[0], background='White', width=20)
    BB = CTK.infoBulle(parent=B, text='Matching string.')
    B.grid(row=1, column=1, sticky=TK.EW)
    B.bind('<Return>', setFilter)
def createApp(win):
    ttk = CTK.importTtk()

    # - Frame -
    Frame = TTK.LabelFrame(win, borderwidth=2, relief=CTK.FRAMESTYLE,
                           text='tkMeshInfo', font=CTK.FRAMEFONT, takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Display mesh informations.\nCtrl+c to close applet.', temps=0, btype=1)
    Frame.bind('<Control-c>', hideApp)
    Frame.bind('<ButtonRelease-3>', displayFrameMenu)
    Frame.bind('<Enter>', lambda event : Frame.focus_set())
    Frame.columnconfigure(0, weight=1)
    Frame.columnconfigure(1, weight=2)
    WIDGETS['frame'] = Frame
    
    # - Frame menu -
    FrameMenu = TK.Menu(Frame, tearoff=0)
    FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp)
    CTK.addPinMenu(FrameMenu, 'tkMeshInfo')
    WIDGETS['frameMenu'] = FrameMenu

    #- VARS -
    # -0- Npts -
    V = TK.StringVar(win); V.set(''); VARS.append(V)
    # -1- Var min -
    V = TK.StringVar(win); V.set(''); VARS.append(V)
    # -2- Var max -
    V = TK.StringVar(win); V.set(''); VARS.append(V)
    # -3- Selected block name
    V = TK.StringVar(win); V.set(''); VARS.append(V)
    # -4- Selected block type
    V = TK.StringVar(win); V.set(''); VARS.append(V)
    # -5- Selected variable
    V = TK.StringVar(win); V.set('CoordinateX'); VARS.append(V)
    # -6- NCells -
    V = TK.StringVar(win); V.set(''); VARS.append(V)
    # -7- NFaces -
    V = TK.StringVar(win); V.set(''); VARS.append(V)
    

    # - selected block name -
    B = TTK.Entry(Frame, textvariable=VARS[3], background='White', width=15)
    B.grid(row=0, column=0, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Currently selected zone name.')

    # - selected block type -
    B = TTK.Entry(Frame, textvariable=VARS[4], background='White')
    B.grid(row=0, column=1, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Currently selected zone type.')
    
    # - Npts -
    B = TTK.Label(Frame, text="Npts")
    B.grid(row=1, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Number of points in selection.')
    B = TTK.Entry(Frame, textvariable=VARS[0], background='White',
                  width=10)
    B.grid(row=1, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Number of points in selection.')

    # - Ncells -
    B = TTK.Label(Frame, text="NCells")
    B.grid(row=2, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Number of cells in selection.')
    B = TTK.Entry(Frame, textvariable=VARS[6], background='White',
                  width=10)
    B.grid(row=2, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Number of cells in selection.')

    # - NFaces -
    B = TTK.Label(Frame, text="NFaces")
    B.grid(row=3, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Number of faces in selection.')
    B = TTK.Entry(Frame, textvariable=VARS[7], background='White',
                  width=10)
    B.grid(row=3, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Number of faces in selection.')

    # - Variable -
    B = TTK.Label(Frame, text="Variable: ")
    B.grid(row=4, column=0, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Selected var name.')
    F = TTK.Frame(Frame, borderwidth=0)
    F.columnconfigure(0, weight=1)

    if ttk is None:
        B = TK.OptionMenu(F, VARS[5], '')
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVarNameList)
        F.grid(row=4, column=1, columnspan=1, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B, text='Selected var name.')
        WIDGETS['variable'] = B
    else: 
        B = ttk.Combobox(F, textvariable=VARS[5], 
                         values=[], state='readonly')
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVarNameList2)
        F.grid(row=4, column=1, columnspan=1, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B, text='Selected var name.')
        WIDGETS['variable'] = B
    
    # - Min de la variable - 
    B = TTK.Label(Frame, text="Min:")
    B.grid(row=5, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Min of variable.')
    B = TTK.Entry(Frame, textvariable=VARS[1], background='White',
                  width=10)
    B.grid(row=5, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Min of variable.')
    
    # - Max de la variable -    
    B = TTK.Label(Frame, text="Max:")
    B.grid(row=6, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Max of variable.')
    B = TTK.Entry(Frame, textvariable=VARS[2], background='White',
                  width=10)
    B.grid(row=6, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Max of variable.')
    
    # - update -
    B = TTK.Button(Frame, text="Update info", command=updateInfo)
    B.grid(row=7, column=0, columnspan=2, sticky=TK.EW)
Exemple #24
0
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkSculpt',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Sculpt surfaces by deformations.', temps=0, btype=1)
    Frame.bind('<Control-c>', hideApp)
    Frame.bind('<ButtonRelease-3>', displayFrameMenu)
    Frame.bind('<Enter>', lambda event: Frame.focus_set())
    Frame.columnconfigure(0, weight=1)
    Frame.columnconfigure(1, weight=1)
    WIDGETS['frame'] = Frame

    # - Frame menu -
    FrameMenu = TK.Menu(Frame, tearoff=0)
    FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp)
    CTK.addPinMenu(FrameMenu, 'tkSculpt')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- depth -
    V = TK.StringVar(win)
    V.set('1.')
    VARS.append(V)
    # -1- width -
    V = TK.StringVar(win)
    V.set('1.')
    VARS.append(V)
    # -2- Brush
    V = TK.StringVar(win)
    V.set('Deform')
    VARS.append(V)
    # -3- Negative/positive depth
    V = TK.StringVar(win)
    V.set('0')
    VARS.append(V)
    # -4- Depth info bulle
    V = TK.StringVar(win)
    V.set('Depth.')
    VARS.append(V)
    # -5- Width info bulle
    V = TK.StringVar(win)
    V.set('Width.')
    VARS.append(V)

    # - Depth -
    B = TTK.Scale(Frame,
                  from_=0,
                  to=100,
                  orient=TK.HORIZONTAL,
                  showvalue=0,
                  command=setDepth,
                  borderwidth=1,
                  value=50)
    WIDGETS['depth'] = B
    B.grid(row=0, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, textVariable=VARS[4])
    #B = TK.Checkbutton(Frame, text='', variable=VARS[3])
    #BB = CTK.infoBulle(parent=B, text='Check for additive depth.')
    #B.grid(row=0, column=1, sticky=TK.EW)

    # - Width -
    B = TTK.Scale(Frame,
                  from_=0,
                  to=100,
                  orient=TK.HORIZONTAL,
                  showvalue=0,
                  command=setWidth,
                  borderwidth=1,
                  value=50)
    WIDGETS['width'] = B
    B.grid(row=1, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, textVariable=VARS[5])

    # - Brush -
    B = TTK.OptionMenu(Frame, VARS[2], 'Deform', 'Sphere')
    B.grid(row=2, column=0, sticky=TK.EW)

    # - Sculpt mode -
    B = TTK.Button(Frame, text="Sculpt mode", command=sculpt)
    BB = CTK.infoBulle(parent=B, text='Enter sculpt mode.')
    B.grid(row=2, column=1, columnspan=1, sticky=TK.EW)
    WIDGETS['sculpt'] = B
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkPaint',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Paint fields.\nCtrl+c to close applet.', temps=0, btype=1)
    Frame.bind('<Control-c>', hideApp)
    Frame.bind('<ButtonRelease-3>', displayFrameMenu)
    Frame.bind('<Enter>', lambda event: Frame.focus_set())
    Frame.columnconfigure(0, weight=2)
    Frame.columnconfigure(1, weight=0)
    Frame.columnconfigure(2, weight=1)
    WIDGETS['frame'] = Frame

    # - Frame menu -
    FrameMenu = TK.Menu(Frame, tearoff=0)
    FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp)
    CTK.addPinMenu(FrameMenu, 'tkPaint')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- value -
    V = TK.StringVar(win)
    V.set('1.')
    VARS.append(V)
    # -1- width -
    V = TK.StringVar(win)
    V.set('1.')
    VARS.append(V)
    # -2- Brush
    V = TK.StringVar(win)
    V.set('Sphere')
    VARS.append(V)

    # - Value -
    B = TTK.Entry(Frame, textvariable=VARS[0], background='White', width=5)
    B.grid(row=0, column=0, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Value.')
    WIDGETS['value'] = B
    B = TTK.Button(Frame,
                   command=getValue,
                   image=iconics.PHOTO[8],
                   padx=0,
                   pady=0)
    B.grid(row=0, column=1, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Get value from mouse pointer.')

    # - Width -
    #B = TTK.Entry(Frame, textvariable=VARS[1], background='White', width=5)
    #B.grid(row=0, column=1, columnspan=1, sticky=TK.EW)
    #BB = CTK.infoBulle(parent=B, text='Width.')
    #WIDGETS['width'] = B

    # - Brush -
    #B = TTK.OptionMenu(Frame, VARS[2], 'Sphere')
    #BB = CTK.infoBulle(parent=B, text='Brush shape.')
    #B.grid(row=1, column=0, sticky=TK.EW)

    # - Paint mode -
    B = TTK.Button(Frame, text="Paint mode", command=paint)
    BB = CTK.infoBulle(
        parent=B,
        text='Enter paint mode.\nValue of field (scalar mode) is modified.')
    B.grid(row=0, column=2, columnspan=1, sticky=TK.EW)
    WIDGETS['paint'] = B
Exemple #26
0
def createApp(win):
    ttk = CTK.importTtk()

    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkStream',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Compute stream lines/surfaces.\nCtrl+c to close applet.', temps=0, btype=1)
    Frame.bind('<Control-c>', hideApp)
    Frame.bind('<ButtonRelease-3>', displayFrameMenu)
    Frame.bind('<Enter>', lambda event: Frame.focus_set())
    Frame.columnconfigure(0, weight=1)
    Frame.columnconfigure(1, weight=1)
    Frame.columnconfigure(2, weight=1)
    WIDGETS['frame'] = Frame

    # - Frame menu -
    FrameMenu = TK.Menu(Frame, tearoff=0)
    FrameMenu.add_command(label='Close', accelerator='Ctrl+c', command=hideApp)
    FrameMenu.add_command(label='Save', command=saveApp)
    FrameMenu.add_command(label='Reset', command=resetApp)
    CTK.addPinMenu(FrameMenu, 'tkStream')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- nptsmax -
    V = TK.StringVar(win)
    V.set('2000')
    VARS.append(V)
    if 'tkStreamNpts' in CTK.PREFS:
        V.set(CTK.PREFS['tkStreamNpts'])
    # -1- Var0 for vector -
    V = TK.StringVar(win)
    V.set('CoordinateX')
    VARS.append(V)
    # -2- Var1 for vector -
    V = TK.StringVar(win)
    V.set('CoordinateY')
    VARS.append(V)
    # -3- Var2 for vector -
    V = TK.StringVar(win)
    V.set('CoordinateZ')
    VARS.append(V)

    # - Menu des variables -
    F = TTK.Frame(Frame, borderwidth=0)
    F.columnconfigure(0, weight=1)
    if ttk is None:
        B = TK.OptionMenu(F, VARS[1], '')
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVarNameList1)
        F.grid(row=0, column=0, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B, text='Variable 1.')
        WIDGETS['variable1'] = B
    else:
        B = ttk.Combobox(F,
                         textvariable=VARS[1],
                         values=[],
                         state='readonly',
                         width=10)
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVarNameList1_2)
        F.grid(row=0, column=0, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B, text='Variable 1.')
        WIDGETS['variable1'] = B

    F = TTK.Frame(Frame, borderwidth=0)
    F.columnconfigure(0, weight=1)
    if ttk is None:
        B = TK.OptionMenu(F, VARS[2], '')
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVarNameList2)
        F.grid(row=0, column=1, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B, text='Variable 2.')
        WIDGETS['variable2'] = B
    else:
        B = ttk.Combobox(F,
                         textvariable=VARS[2],
                         values=[],
                         state='readonly',
                         width=10)
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVarNameList2_2)
        F.grid(row=0, column=1, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B, text='Variable 2.')
        WIDGETS['variable2'] = B

    F = TTK.Frame(Frame, borderwidth=0)
    F.columnconfigure(0, weight=1)
    if ttk is None:
        B = TK.OptionMenu(F, VARS[3], '')
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVarNameList3)
        F.grid(row=0, column=2, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B, text='Variable 3.')
        WIDGETS['variable3'] = B
    else:
        B = ttk.Combobox(F,
                         textvariable=VARS[3],
                         values=[],
                         state='readonly',
                         width=10)
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateVarNameList3_2)
        F.grid(row=0, column=2, sticky=TK.EW)
        BB = CTK.infoBulle(parent=B, text='Variable 3.')
        WIDGETS['variable3'] = B

    # - nptsmax -
    B = TTK.Label(Frame, text="nptsmax")
    B.grid(row=1, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Max number of points of streams.')
    B = TTK.Entry(Frame, textvariable=VARS[0], background='White', width=5)
    BB = CTK.infoBulle(parent=B, text='Max number of points of streams.')
    B.grid(row=1, column=1, columnspan=2, sticky=TK.EW)

    # - Stream line -
    B = TTK.Button(Frame, text="Line", command=streamLine)
    B.grid(row=2, column=0, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Draw a stream line.')

    # - Stream ribbon -
    B = TTK.Button(Frame, text="Ribbon", command=streamRibbon)
    B.grid(row=2, column=1, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Draw a stream ribbon.')

    # - Stream surface -
    B = TTK.Button(Frame, text="Surface", command=streamSurface)
    B.grid(row=2, column=2, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Draw a stream surface from a BAR.')