Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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.')
Ejemplo n.º 3
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
Ejemplo n.º 4
0
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkChimera',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Chimera connectivity.\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)
    Frame.columnconfigure(2, weight=1)
    Frame.columnconfigure(3, weight=1)
    Frame.columnconfigure(4, 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, 'tkChimera')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- double wall: active ? -
    V = TK.StringVar(win)
    V.set('inactive')
    VARS.append(V)
    # -1- delta XRay -
    V = TK.StringVar(win)
    V.set('1.e-10')
    VARS.append(V)
    # -2- tolerance XRay -
    V = TK.StringVar(win)
    V.set('1.e-8')
    VARS.append(V)
    # -3- Base name 1
    V = TK.StringVar(win)
    V.set('')
    VARS.append(V)
    # -4- Relation
    V = TK.StringVar(win)
    V.set('+')
    VARS.append(V)
    # -5- Base name 2
    V = TK.StringVar(win)
    V.set('')
    VARS.append(V)
    # -6- Blanking surface
    V = TK.StringVar(win)
    V.set('')
    VARS.append(V)
    # -7- depth
    V = TK.StringVar(win)
    V.set('2')
    VARS.append(V)
    # -8- Blanking type
    V = TK.StringVar(win)
    V.set('cell_intersect')
    VARS.append(V)
    # -9- Priorite
    V = TK.StringVar(win)
    V.set('0')
    VARS.append(V)

    r = 0  # row
    # - Number of layers (depth) -
    B = TTK.Label(Frame, text="Depth")
    B.grid(row=r, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Number of interpolated layers.')
    B = TTK.Entry(Frame, textvariable=VARS[7], background='White', width=2)
    B.grid(row=r, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Number of interpolated layers.')

    # - Blanking type -
    B = TTK.OptionMenu(Frame, VARS[8], 'cell_intersect', 'cell_intersect_opt',
                       'center_in', 'node_in')
    B.grid(row=r, column=2, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Blanking type.')
    r += 1

    # - initCellN -
    B = TTK.Button(Frame, text="Init cellN", command=initCellN)
    B.grid(row=r, column=0, columnspan=4, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B,
                       text='Init the cellN to 1. in the tree or selection.')
    r += 1

    # - applyBCOverlap -
    B = TTK.Button(Frame, text="ApplyBCOverlaps", command=applyOverlap)
    B.grid(row=r, column=0, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(
        parent=B,
        text='Modify the cellN (=2) near BCOverlaps and doubly defined BCs.')

    # - setHoleInterpolatedPoints -
    B = TTK.Button(Frame,
                   text="SetHoleInterpPoints",
                   command=setHoleInterpolatedPoints)
    B.grid(row=r, column=2, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Modify the cellN (=2) near holes.')
    r += 1

    # - XRay delta  -
    B = TTK.Label(Frame, text="XRay delta")
    B.grid(row=r, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B,
                       text='The created holes will expand of this value.')
    B = TTK.Entry(Frame, textvariable=VARS[1], background='White', width=5)
    B.grid(row=r, column=1, sticky=TK.EW)

    # - Xray tol -
    B = TTK.Label(Frame, text="Tol")
    B.grid(row=r, column=2, sticky=TK.EW)
    BB = CTK.infoBulle(
        parent=B,
        text=
        'Two surface points separated of this value\nwill be considered as identical.'
    )
    B = TTK.Entry(Frame, textvariable=VARS[2], background='White', width=5)
    B.grid(row=r, column=3, sticky=TK.EW)
    r += 1

    # - Surface -
    B = TTK.Button(Frame,
                   text="Surf",
                   command=setSurface,
                   image=iconics.PHOTO[8],
                   padx=0,
                   pady=0,
                   compound=TK.RIGHT)
    B.grid(row=r, column=3, sticky=TK.EW)
    BB = CTK.infoBulle(
        parent=B,
        text='Set blanking surfaces.\nThey must define ONE closed body.')
    B = TTK.Entry(Frame, textvariable=VARS[6], background='White')
    BB = CTK.infoBulle(parent=B, text='Blanking surfaces.')
    B.grid(row=r, column=0, columnspan=3, sticky=TK.EW)
    r += 1

    # - blanking -
    B = TTK.Button(Frame, text="Blank cells", command=blank)
    B.grid(row=r, column=0, columnspan=4, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Blank cells with with surface.')
    r += 1

    # - set priority -
    B = TTK.Button(Frame, text="Set Priority", command=setPriority)
    B.grid(row=r, column=0, columnspan=3, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Set a priority to a base.')
    B = TTK.OptionMenu(Frame, VARS[9], '0', '1', '2', '3')
    B.grid(row=r, column=3, sticky=TK.EW)
    r += 1

    # - double wall active ? for optimizeOverlap
    B = TTK.Label(Frame, text="DoubleWall")
    B.grid(row=r, column=0, sticky=TK.EW)
    B = TTK.OptionMenu(Frame, VARS[0], 'inactive', 'active')
    B.grid(row=r, column=3, sticky=TK.EW)

    # - optimizeOverlap -
    B = TTK.Button(Frame, text="Optimize overlap", command=optimize)
    B.grid(row=r, column=0, columnspan=4, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Optimize the overlapping')
    r += 1

    # - createOversetHoles -
    B = TTK.Button(Frame,
                   text="Create OversetHoles nodes",
                   command=createOversetHoles)
    B.grid(row=r, column=0, columnspan=4, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B,
                       text='Create the nodes OversetHoles in pyTree.')
    r += 1
Ejemplo n.º 5
0
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkDist2Walls',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Compute wall distance.\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, 'tkDist2Walls')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- Type de distance -
    V = TK.StringVar(win)
    V.set('ortho')
    VARS.append(V)
    if 'tkDist2WallsType' in CTK.PREFS:
        V.set(CTK.PREFS['tkDist2WallsType'])
    # -1- Surfaces -
    V = TK.StringVar(win)
    V.set('')
    VARS.append(V)
    # -2- Signed ou absolute -
    V = TK.StringVar(win)
    V.set('absolute')
    VARS.append(V)
    if 'tkDist2WallsSigned' in CTK.PREFS:
        V.set(CTK.PREFS['tkDist2WallsSigned'])
    # -3- Vars location -
    V = TK.StringVar(win)
    V.set('nodes')
    VARS.append(V)
    if 'tkVariablesLoc' in CTK.PREFS:
        V.set(CTK.PREFS['tkVariablesLoc'])

    # - Surfaces -
    B = TTK.Button(Frame, text="Surfaces", command=setSurfaces)
    B.grid(row=0, column=0, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(
        parent=B,
        text=
        'Set surfaces for distances computation.\nIf not set, BCWalls are used.'
    )
    B = TTK.Entry(Frame, textvariable=VARS[1], background='White')
    B.grid(row=0, column=1, columnspan=1, sticky=TK.EW)

    # - Algorithm -
    B = TTK.OptionMenu(Frame, VARS[0], 'ortho', 'mininterf')
    B.grid(row=1, column=1, sticky=TK.EW)
    B = TTK.OptionMenu(Frame, VARS[2], 'absolute', 'signed')
    B.grid(row=1, column=0, sticky=TK.EW)

    # - Compute -
    B = TTK.Button(Frame, text="Compute", command=compute)
    B.grid(row=2, column=0, sticky=TK.EW)
    B = TTK.OptionMenu(Frame, VARS[3], 'nodes', 'centers')
    B.grid(row=2, column=1, sticky=TK.EW)

    C = CTK.infoBulle(parent=B,
                      text='Compute the wall distance.\nTree is modified.')
Ejemplo n.º 6
0
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win, borderwidth=2, relief=CTK.FRAMESTYLE,
                           text='tkSmooth', font=CTK.FRAMEFONT, takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Smooth 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=1)
    Frame.columnconfigure(1, weight=0)
    Frame.columnconfigure(2, weight=0)
    Frame.columnconfigure(3, weight=0)
    Frame.columnconfigure(4, 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, 'tkSmooth')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- Smoother niter -
    V = TK.StringVar(win); V.set('10'); VARS.append(V)
    if 'tkSmoothIter' in CTK.PREFS: V.set(CTK.PREFS['tkSmoothIter'])
    # -1- Constraint
    V = TK.StringVar(win); V.set(''); VARS.append(V)
    # -2- Constraint strength
    V = TK.StringVar(win); V.set('0.1'); VARS.append(V)
    if 'tkSmoothConsStrength' in CTK.PREFS: 
        V.set(CTK.PREFS['tkSmoothConsStrength'])
    # -3- Constraint external faces
    V = TK.IntVar(win); V.set(1); VARS.append(V)
    # -4- smooth eps
    V = TK.StringVar(win); V.set('0.5'); VARS.append(V)
    if 'tkSmoothEps' in CTK.PREFS: 
        V.set(CTK.PREFS['tkSmoothEps'])
    # -5- Constraint sharp edges
    V = TK.IntVar(win); V.set(0); VARS.append(V)
    # -6- Sharp edges detection angle
    V = TK.StringVar(win); V.set('30.'); VARS.append(V)
    if 'tkSmoothSharpAngle' in CTK.PREFS: 
        V.set(CTK.PREFS['tkSmoothSharpAngle'])
    # -7- Project on surface
    V = TK.IntVar(win); V.set(0); VARS.append(V)
    # -8- Type de smoothing
    V = TK.StringVar(win); V.set('Volume'); VARS.append(V)
    if 'tkSmoothType' in CTK.PREFS: 
        V.set(CTK.PREFS['tkSmoothType'])

    # - Smoother power -
    #B = TTK.Label(Frame, text="Eps")
    #B.grid(row=0, column=0, sticky=TK.EW)
    B = TTK.OptionMenu(Frame, VARS[8], 'Volume', 'Scale', 'Taubin')
    BB = CTK.infoBulle(parent=B, text='Smoothing algorithm.')
    B.grid(row=0, column=0, columnspan=2, sticky=TK.EW)
    B = TTK.Entry(Frame, textvariable=VARS[4], background='White', width=4)
    B.grid(row=0, column=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Smoother power.')
    B = TTK.Label(Frame, text="Iter")
    B.grid(row=0, column=3, sticky=TK.EW)
    B = TTK.Entry(Frame, textvariable=VARS[0], background='White', width=4)
    B.grid(row=0, column=4, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Number of smoother iterations.')

    # - Constraint strength -
    B = TTK.Entry(Frame, textvariable=VARS[2], background='White', width=4)
    B.grid(row=1, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Strength of constraints.')

    # - Keep external faces -
    B = TTK.Checkbutton(Frame, text='EF', variable=VARS[3])
    B.grid(row=1, column=1, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Keep external faces.')

    # - Keep sharp edges faces -
    B = TTK.Checkbutton(Frame, text='SE', variable=VARS[5])
    B.grid(row=1, column=2, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Keep sharp edges.')

    # - Project on surface
    B = TTK.Checkbutton(Frame, text='PJ', variable=VARS[7])
    B.grid(row=1, column=3, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Project on surface.')

    # - Sharp edges detection
    B = TTK.Entry(Frame, textvariable=VARS[6], background='White', width=4)
    B.grid(row=1, column=4, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Sharp edges detection angle.')

    # - Smoother constraint -
    B = TTK.Button(Frame, command=setConstraint,
                   image=iconics.PHOTO[8], padx=0, pady=0)
    BB = CTK.infoBulle(parent=B, text='Set constraint curves for smoother (points dont move).')
    B.grid(row=2, column=4, columnspan=1, sticky=TK.EW)
    B = TTK.Entry(Frame, textvariable=VARS[1], background='White', width=8)
    B.grid(row=2, column=0, columnspan=4, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Constraint curves for smoother (points dont move).')
    
    # - Smooth -
    B = TTK.Button(Frame, text="Smooth", command=smooth)
    BB = CTK.infoBulle(parent=B, text='Smooth mesh.')
    B.grid(row=3, column=0, columnspan=5, sticky=TK.EW)
Ejemplo n.º 7
0
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkBackground',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Create a background.\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=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, 'tkBackground')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- Type de background -
    V = TK.StringVar(win)
    V.set('None')
    VARS.append(V)
    if 'tkBackgroundType' in CTK.PREFS:
        V.set(CTK.PREFS['tkBackgroundType'])
    # -1- Border
    V = TK.StringVar(win)
    V.set('2')
    VARS.append(V)
    if 'tkBackgroundBorder' in CTK.PREFS:
        V.set(CTK.PREFS['tkBackgroundBorder'])

    # - Type de background -
    B = TTK.OptionMenu(Frame,
                       VARS[0],
                       'None',
                       'Half-Box',
                       'Box',
                       'Z-Half-Box',
                       'Z-Box',
                       'Z-Ellipse',
                       'Z-Plane',
                       'Z-Square-Ground',
                       command=setBackground)
    B.grid(row=0, column=0, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Type of background.')

    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='Borders N or (Ni;Nj;Nk) or (Ni-;Nj-;Nk-;Ni+;Nj+;Nk+).')
    B.bind('<Return>', setBackground)

    B = TTK.Button(Frame, text="Set", command=setBackground)
    B.grid(row=0, column=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Set or reset the background.')
Ejemplo n.º 8
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)
Ejemplo n.º 9
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
Ejemplo n.º 10
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.')
Ejemplo n.º 11
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.')
Ejemplo n.º 12
0
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)
Ejemplo n.º 13
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.')
Ejemplo n.º 14
0
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.')
Ejemplo n.º 15
0
def createApp(win):
    ttk = CTK.importTtk()

    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkBC',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Manage boundary conditions.\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=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, 'tkBC')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # - 0 - Type de BC -
    V = TK.StringVar(win)
    V.set('Mesh')
    VARS.append(V)
    # - 1 - Type de cas (2D/3D) -
    V = TK.StringVar(win)
    V.set('3D')
    VARS.append(V)
    # - 2 - tol pour ConnectMatch -
    V = TK.StringVar(win)
    V.set('1.e-6')
    VARS.append(V)
    if 'tkBCMatchTol' in CTK.PREFS: V.set(CTK.PREFS['tkBCMatchTol'])
    # - 3 - ratio pour ConnectNearMatch -
    V = TK.StringVar(win)
    V.set('2')
    VARS.append(V)
    # - 4 - Type de BC pour fillEmptyBCWith -
    V = TK.StringVar(win)
    V.set('BCWall')
    VARS.append(V)
    # - 5 - Type de BC pour rmBCOfType -
    V = TK.StringVar(win)
    V.set('-All BC-')
    VARS.append(V)
    # - 6 - Type de BC pour setBCWith -
    V = TK.StringVar(win)
    V.set('BCWall')
    VARS.append(V)
    # - 7 - Edges des zones du calcul
    V = TK.StringVar(win)
    V.set('0')
    VARS.append(V)
    if 'tkBCEdges' in CTK.PREFS: V.set(CTK.PREFS['tkBCEdges'])
    # -8- SplitFactor info bulle
    V = TK.StringVar(win)
    V.set(
        'Split more or less undefined BCs. \nUsefull only for unstructured grids.'
    )
    VARS.append(V)
    # -9- Periodicity? in connectMatch
    V = TK.StringVar(win)
    V.set('Not periodic')
    VARS.append(V)
    # -10- Periodicity field (0;0;0...)
    V = TK.StringVar(win)
    V.set('0;0;0;0;0;0')
    VARS.append(V)
    if 'tkBCMatchPer' in CTK.PREFS: V.set(CTK.PREFS['tkBCMatchPer'])

    # - View mesh -
    B = TTK.Button(Frame, text="View Mesh", command=viewMesh)
    B.grid(row=0, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='View mesh.\nTree is NOT modified.')

    # - Edges -
    B = TTK.Checkbutton(Frame, text='Edges', variable=VARS[7])
    BB = CTK.infoBulle(parent=B, text='Show edges of zones of the tree.')
    B.grid(row=0, column=1, sticky=TK.EW)

    # - View type de BC -
    B = TTK.Button(Frame, text="View BC", command=view)
    B.grid(row=1, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B,
                       text='View specified BC.\nTree is NOT modified.')

    # - Type of BC - ListBox Frame -
    LBFrame = TTK.Frame(Frame)
    LBFrame.grid(row=1, column=1, rowspan=4, sticky=TK.EW)
    LBFrame.rowconfigure(0, weight=1)
    LBFrame.columnconfigure(0, weight=1)
    LBFrame.columnconfigure(1, weight=0)
    SB = TTK.Scrollbar(LBFrame)
    LB = TTK.Listbox(LBFrame, selectmode=TK.EXTENDED, height=6)
    LB.bind('<Double-1>', view)
    LB.bind('<Enter>', updateBCNameList)
    # LB.bind('<ButtonRelease-1>', view)
    for i, value in enumerate(['-All BC-'] + getAllDefinedBC(CTK.t)):
        LB.insert(i, value)
    SB.config(command=LB.yview)
    LB.config(yscrollcommand=SB.set)
    LB.grid(row=0, column=0, sticky=TK.NSEW)
    SB.grid(row=0, column=1, sticky=TK.NSEW)
    LBFrame.bind('<Enter>', updateFamilyBCNameList1_2)
    WIDGETS['BCLB'] = LB

    # - View undefined BCs -
    B = TTK.Button(Frame,
                   text="View undefined BC",
                   command=displayUndefinedBoundaries)
    B.grid(row=2, column=0, columnspan=1, sticky=TK.EW)
    WIDGETS['undefinedBC'] = B
    BB = CTK.infoBulle(
        parent=B,
        text='View undefined BC in ALL tree.\nUse this to setBC or fillEmptyBC.'
    )

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

    # - rmBCOfType -
    B = TTK.Button(Frame, text="rm BC", command=rmBCOfType)
    B.grid(row=4, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B,
                       text='Remove the BCs of given type from tree.')

    # - setBCWith -
    B = TTK.Button(Frame, text="setBCWith", command=setBCWith)
    B.grid(row=5, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(
        parent=B, text='Set the BC with specified type.\nAdded to pyTree.')
    F = TTK.Frame(Frame, borderwidth=0)
    F.columnconfigure(0, weight=1)
    if ttk is None:
        B = TK.OptionMenu(F, VARS[6], *(Internal.KNOWNBCS))
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateFamilyBCNameList3)
        F.grid(row=6, column=1, sticky=TK.EW)
        WIDGETS['BCs2'] = B
    else:
        B = ttk.Combobox(F,
                         textvariable=VARS[6],
                         values=Internal.KNOWNBCS,
                         state='readonly',
                         width=10)
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateFamilyBCNameList3_2)
        F.grid(row=5, column=1, sticky=TK.EW)
        WIDGETS['BCs2'] = B

    # - FillEmptyBCWith -
    B = TTK.Button(Frame, text="FillEmptyBCWith", command=fillEmptyBCWith)
    B.grid(row=6, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(
        parent=B, text='Fill empty BCs with given type.\nAdded to pyTree.')
    F = TTK.Frame(Frame, borderwidth=0)
    F.columnconfigure(0, weight=1)
    if ttk is None:
        B = TK.OptionMenu(F, VARS[4], *(Internal.KNOWNBCS))
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateFamilyBCNameList4)
        F.grid(row=6, column=1, sticky=TK.EW)
        WIDGETS['BCs4'] = B
    else:
        B = ttk.Combobox(F,
                         textvariable=VARS[4],
                         values=Internal.KNOWNBCS,
                         state='readonly',
                         width=10)
        B.grid(sticky=TK.EW)
        F.bind('<Enter>', updateFamilyBCNameList4_2)
        F.grid(row=6, column=1, sticky=TK.EW)
        WIDGETS['BCs4'] = B

    # - setDegeneratedBC -
    B = TTK.Button(Frame, text="SetDegeneratedBC", command=setDegeneratedBC)
    B.grid(row=7, column=0, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B,
                       text='Find the degenerated BCs\nAdded to pyTree.')

    # - ConnectMatch -
    B = TTK.Button(Frame, text="ConnectMatch", command=connectMatch)
    B.grid(row=8, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B,
                       text='Find the matching BCs\nAdded to pyTree.')
    B = TTK.Entry(Frame, textvariable=VARS[2], background='White')
    B.grid(row=8, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Tolerance for matching.')

    # - Periodicity management -
    B = TTK.OptionMenu(Frame, VARS[9], 'Not periodic', 'Translation',
                       'Rotation (Degree)')
    B.grid(row=9, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame, textvariable=VARS[10], background='White')
    B.grid(row=9, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(
        parent=B,
        text=
        'Periodic translation: tx;ty;tz\nPeriodic rotation: cx;cy;cz;ax;ay;az\nangles in degrees.'
    )

    # - ConnectNearMatch -
    B = TTK.Button(Frame, text="ConnectNearMatch", command=connectNearMatch)
    B.grid(row=10, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B,
                       text='Find the matching BCs\nAdded to pyTree.')
    B = TTK.Entry(Frame, textvariable=VARS[3], background='White')
    B.grid(row=10, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Nearmatch ratio (2 or 2;1;2).')
Ejemplo n.º 16
0
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)
Ejemplo n.º 17
0
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkTransform',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='General block transformations.\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=4)
    WIDGETS['frame'] = Frame

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

    # - VARS -
    # -0- Translation vector -
    V = TK.StringVar(win)
    V.set('0;0;0')
    VARS.append(V)
    # -1- Scale factors -
    V = TK.StringVar(win)
    V.set('1;1;1')
    VARS.append(V)
    # -2- Rotate axis
    V = TK.StringVar(win)
    V.set('around X')
    VARS.append(V)
    # -3- Rotation angle
    V = TK.StringVar(win)
    V.set('0.')
    VARS.append(V)
    # -4- Symetry axis
    V = TK.StringVar(win)
    V.set('around XY-')
    VARS.append(V)
    # -5- Scale axis
    V = TK.StringVar(win)
    V.set('along XYZ')
    VARS.append(V)
    # -6- Translation axis
    V = TK.StringVar(win)
    V.set('along XYZ')
    VARS.append(V)
    # -7- cart2Cyl or cyl2Cart
    V = TK.StringVar(win)
    V.set('cart2Cyl')
    VARS.append(V)
    # -8- Origin and axis for cart2Cyl or cyl2Cart
    V = TK.StringVar(win)
    V.set('(0.,0.,0.); (1.,0.,0.)')
    VARS.append(V)

    # - Translate -
    B = TTK.Button(Frame, text="Translate", command=translate)
    B.grid(row=0, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Translate zone(s) of pyTree.')
    B = TTK.OptionMenu(Frame, VARS[6], 'along XYZ', 'along view')
    B.grid(row=0, column=1, sticky=TK.EW)
    B = TTK.Entry(Frame, textvariable=VARS[0], background='White', width=5)
    B.grid(row=0, column=2, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Translation vector.')

    # - Translate from here to here -
    B = TTK.Button(Frame, text="Translate by clicking", command=translateClick)
    B.grid(row=1, column=0, columnspan=3, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B,
                       text='Translate zone(s) of pyTree \nby clicking.')
    WIDGETS['translate'] = B

    # - Scale -
    B = TTK.Button(Frame, text="Scale", command=scale)
    B.grid(row=2, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Scale zone(s) of pyTree.')
    B = TTK.OptionMenu(Frame, VARS[5], 'along XYZ', 'along view')
    B.grid(row=2, column=1, sticky=TK.EW)
    B = TTK.Entry(Frame, textvariable=VARS[1], background='White', width=5)
    B.grid(row=2, column=2, sticky=TK.EW)
    BB = CTK.infoBulle(
        parent=B,
        text=
        'Scale factors (+ optionally center for scaling): uniform f value or fx;fy;fz (+ optionally cx;cy;cz)\nFor automatic adimensioning, use 0.'
    )

    # - Rotate -
    B = TTK.Button(Frame, text="Rotate", command=rotate)
    B.grid(row=3, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Rotate zone(s) of pyTree.')
    B = TTK.OptionMenu(Frame, VARS[2], 'around X', 'around Y', 'around Z',
                       'around view')
    B.grid(row=3, column=1, sticky=TK.EW)
    B = TTK.Entry(Frame, textvariable=VARS[3], background='White', width=5)
    B.grid(row=3, column=2, sticky=TK.EW)
    BB = CTK.infoBulle(
        parent=B,
        text=
        'angle (degrees) or \nangle; Xc;Yc;Zc (angle+rotation center)\nIf center is not specified, rotate around barycenter of zones.'
    )

    # - Symetrize -
    B = TTK.Button(Frame, text="Mirror", command=symetrize)
    B.grid(row=4, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Symetrize zone(s) of pyTree.')
    B = TTK.OptionMenu(Frame, VARS[4], 'around XY-', 'around XY+',
                       'around YZ-', 'around YZ+', 'around XZ-', 'around XZ+',
                       'around view')
    B.grid(row=4, column=1, columnspan=2, sticky=TK.EW)

    # - cart2Cyl and cyl2Cart -
    B = TTK.Button(Frame, text="Apply", command=changeFrame)
    B.grid(row=5, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(
        parent=B,
        text=
        'Convert grid coordinates from cartesian->cylindrical or cylindrical->cartesian frame.\nTree is modified.'
    )
    B = TTK.OptionMenu(Frame, VARS[7], 'cart2Cyl', 'cyl2Cart')
    B.grid(row=5, column=1, sticky=TK.EW)
    B = TTK.Entry(Frame, textvariable=VARS[8], background='White')
    B.grid(row=5, column=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Origin: x0;y0;z0\nAxis: tx;ty;tz.')
Ejemplo n.º 18
0
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
Ejemplo n.º 19
0
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkOctree',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Create octrees.\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, 'tkOctree')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- Snears -
    V = TK.StringVar(win)
    V.set('0.1')
    VARS.append(V)
    if 'tkOctreeSnear' in CTK.PREFS: V.set(CTK.PREFS['tkOctreeSnear'])
    # -1- Dfar -
    V = TK.StringVar(win)
    V.set('10.')
    VARS.append(V)
    if 'tkOctreeDfar' in CTK.PREFS: V.set(CTK.PREFS['tkOctreeDfar'])
    # -2- Balanced/unbalanced -
    V = TK.StringVar(win)
    V.set('Balanced')
    VARS.append(V)
    if 'tkOctreeBalance' in CTK.PREFS: V.set(CTK.PREFS['tkOctreeBalance'])
    # -3- Vmins
    V = TK.StringVar(win)
    V.set('10')
    VARS.append(V)
    if 'tkOctreeVmin' in CTK.PREFS: V.set(CTK.PREFS['tkOctreeVmin'])
    # -4- Level to expand
    V = TK.StringVar(win)
    V.set('0')
    VARS.append(V)
    if 'tkOctreeExpand' in CTK.PREFS: V.set(CTK.PREFS['tkOctreeExpand'])
    # -5- Type of body fitting
    V = TK.StringVar(win)
    V.set('Snap')
    VARS.append(V)
    # -6- Body surfaces for body fitting
    V = TK.StringVar(win)
    V.set('')
    VARS.append(V)
    # -7- Vmin (number of points for each structured block -
    V = TK.StringVar(win)
    V.set('10')
    VARS.append(V)
    # -8- Type of extension between structured blocks -
    V = TK.StringVar(win)
    V.set('Overlap2')
    VARS.append(V)

    # - Dfar -
    rown = 0
    B = TTK.Entry(Frame, textvariable=VARS[1], background='White', width=3)
    B.grid(row=rown, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Distance to far boundaries.')

    # - Snears -
    B = TTK.Entry(Frame, textvariable=VARS[0], background='White', width=3)
    B.grid(row=rown, column=1, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B,
                       text='Local size near bodies (global or list).')

    # - Balanced/unbalanced -
    B = TTK.OptionMenu(Frame, VARS[2], 'Balanced', 'Unbalanced')
    B.grid(row=rown, column=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Make a balanced octree or not.')

    # - Create hexa octree -
    rown += 1
    B = TTK.Button(Frame, text="Create hexa octree", command=hexaOctree)
    B.grid(row=rown, column=0, columnspan=3, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Create an hexa octree around surfaces.')

    # - Adapt hexa octree -
    rown += 1
    B = TTK.Button(Frame,
                   text="Surfaces",
                   command=setSurface,
                   image=iconics.PHOTO[8],
                   padx=0,
                   pady=0,
                   compound=TK.RIGHT)
    B.grid(row=rown, column=2, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Define refinement surfaces.')
    B = TTK.Entry(Frame, textvariable=VARS[6], background='White')
    B.grid(row=rown, column=0, columnspan=2, sticky=TK.EW)
    rown += 1
    B = TTK.Button(Frame,
                   text="Adapt octree inside surfaces",
                   command=adaptInsideOctree)
    B.grid(row=rown, column=0, columnspan=3, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Adapt octree inside surfaces.')

    # - Expand layer -
    rown += 1
    B = TTK.Button(Frame, text="Expand layer", command=expandLayer)
    B.grid(row=rown, column=0, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Expand one level.')
    B = TTK.Entry(Frame, textvariable=VARS[4], background='White', width=5)
    B.grid(row=rown, column=2, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Level to expand.')

    # - octree2Struct -
    rown += 1
    B = TTK.Button(Frame, text="Octree2Struct", command=octree2Struct)
    B.grid(row=rown, column=0, columnspan=1, sticky=TK.EW)
    B = TK.Entry(Frame, textvariable=VARS[7], background='White', width=5)
    B.grid(row=rown, column=1, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B,
                       text='Number of points in each structured blocs.')
    B = TTK.OptionMenu(Frame, VARS[8], 'Match', 'Overlap1', 'Overlap2', 'AMR0',
                       'AMR1', 'AMR2')
    B.grid(row=rown, column=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Type of structured blocks.')

    # - Body surfaces -
    rown += 1
    B = TTK.Button(Frame,
                   text="Bodies",
                   command=setSurface,
                   image=iconics.PHOTO[8],
                   padx=0,
                   pady=0,
                   compound=TK.RIGHT)
    B.grid(row=rown, column=2, columnspan=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Define bodies.')
    B = TTK.Entry(Frame, textvariable=VARS[6], background='White')
    B.grid(row=rown, column=0, columnspan=2, sticky=TK.EW)

    # - Adapt to body
    rown += 1
    B = TTK.Button(Frame, text="Body fit", command=bodyFit)
    B.grid(row=rown, column=0, columnspan=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Fit the octree to bodies.')
    B = TTK.OptionMenu(Frame, VARS[5], 'Snap')
    B.grid(row=rown, column=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Type of body fitting.')
Ejemplo n.º 20
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.')
Ejemplo n.º 21
0
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkRigidMotion',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Define block rigid motions.\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)
    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, 'tkRigidMotion')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- motion name -
    V = TK.StringVar(win)
    V.set('New')
    VARS.append(V)
    #---------------------
    # -- Motion strings --
    #---------------------
    # -1- tx -
    V = TK.StringVar(win)
    V.set('0')
    VARS.append(V)
    # -2- ty -
    V = TK.StringVar(win)
    V.set('0')
    VARS.append(V)
    # -3- tz -
    V = TK.StringVar(win)
    V.set('0')
    VARS.append(V)
    # -4- cx -
    V = TK.StringVar(win)
    V.set('0')
    VARS.append(V)
    # -5- cy -
    V = TK.StringVar(win)
    V.set('0')
    VARS.append(V)
    # -6- cz -
    V = TK.StringVar(win)
    V.set('0')
    VARS.append(V)
    # -7- ex -
    V = TK.StringVar(win)
    V.set('0')
    VARS.append(V)
    # -8- ey -
    V = TK.StringVar(win)
    V.set('0')
    VARS.append(V)
    # -9- ez -
    V = TK.StringVar(win)
    V.set('0')
    VARS.append(V)
    # -10- angle -
    V = TK.StringVar(win)
    V.set('0')
    VARS.append(V)
    # -11- motion type
    V = TK.StringVar(win)
    V.set('1:MotionStrings')
    VARS.append(V)
    #-----------------------------
    # -- Cassiopee Motion rotor --
    #-----------------------------
    # -12- psi0 -
    V = TK.DoubleVar(win)
    V.set(0.)
    VARS.append(V)
    # -13- psi0_b -
    V = TK.DoubleVar(win)
    V.set(0.)
    VARS.append(V)
    # -14- alp_pnt -
    V = TK.StringVar(win)
    V.set('0.; 0.; 0.')
    VARS.append(V)
    # -15- alp_vct -
    V = TK.StringVar(win)
    V.set('0.; 1.; 0.')
    VARS.append(V)
    # -16- alp0 -
    V = TK.DoubleVar(win)
    V.set(0.)
    VARS.append(V)
    # -17- transl_speed -
    V = TK.StringVar(win)
    V.set('0.; 0.; 0.')
    VARS.append(V)
    # -18- rot_pnt -
    V = TK.StringVar(win)
    V.set('0.; 0.; 0.')
    VARS.append(V)
    # -19- rot_vct -
    V = TK.StringVar(win)
    V.set('0.; 0.; 1.')
    VARS.append(V)
    # -20- rot_omg -
    V = TK.DoubleVar(win)
    V.set(0.)
    VARS.append(V)
    # -21- del_pnt -
    V = TK.StringVar(win)
    V.set('0.; 0.; 0.')
    VARS.append(V)
    # -22- del_vct -
    V = TK.StringVar(win)
    V.set('0.; 0.; 1.')
    VARS.append(V)
    # -23- del0 -
    V = TK.DoubleVar(win)
    V.set(0.)
    VARS.append(V)
    # -24- delc -
    V = TK.StringVar(win)
    V.set('0.; 0.; 0.')
    VARS.append(V)
    # -25- dels -
    V = TK.StringVar(win)
    V.set('0.; 0.; 0.')
    VARS.append(V)
    # -26- bet_pnt -
    V = TK.StringVar(win)
    V.set('0.; 0.; 0.')
    VARS.append(V)
    # -27- bet_vct -
    V = TK.StringVar(win)
    V.set('0.; 0.; 1.')
    VARS.append(V)
    # -28- bet0 -
    V = TK.DoubleVar(win)
    V.set(0.)
    VARS.append(V)
    # -29- betc -
    V = TK.StringVar(win)
    V.set('0.; 0.; 0.')
    VARS.append(V)
    # -30- bets -
    V = TK.StringVar(win)
    V.set('0.; 0.; 0.')
    VARS.append(V)
    # -31- tet_pnt -
    V = TK.StringVar(win)
    V.set('0.; 0.; 0.')
    VARS.append(V)
    # -32- tet_vct -
    V = TK.StringVar(win)
    V.set('1.; 0.; 0.')
    VARS.append(V)
    # -33- tet0 -
    V = TK.DoubleVar(win)
    V.set(0.)
    VARS.append(V)
    # -34- tetc -
    V = TK.StringVar(win)
    V.set('0.')
    VARS.append(V)
    # -35- tets -
    V = TK.StringVar(win)
    V.set('0.')
    VARS.append(V)
    # -36- span_vct -
    V = TK.StringVar(win)
    V.set('1.; 0.; 0.')
    VARS.append(V)
    # -37- pre_lag_pnt -
    V = TK.StringVar(win)
    V.set('0.; 0.; 0.')
    VARS.append(V)
    # -38- pre_lag_vct -
    V = TK.StringVar(win)
    V.set('1.; 0.; 0.')
    VARS.append(V)
    # -39- pre_lag_ang -
    V = TK.DoubleVar(win)
    V.set(0.)
    VARS.append(V)
    # -40- pre_con_pnt -
    V = TK.StringVar(win)
    V.set('0.; 0.; 0.')
    VARS.append(V)
    # -41- pre_con_vct -
    V = TK.StringVar(win)
    V.set('1.; 0.; 0.')
    VARS.append(V)
    # -42- pre_con_ang -
    V = TK.DoubleVar(win)
    V.set(0.)
    VARS.append(V)
    #----------------------
    # -- Constant motion --
    #----------------------
    # -43- transl_speed -
    V = TK.StringVar(win)
    V.set('0.; 0.; 0.')
    VARS.append(V)
    # -44- axis_pnt -
    V = TK.StringVar(win)
    V.set('0.; 0.; 0.')
    VARS.append(V)
    # -45- axis_vct -
    V = TK.StringVar(win)
    V.set('0.; 0.; 1.')
    VARS.append(V)
    # -46- omega -
    V = TK.DoubleVar(win)
    V.set(0.)
    VARS.append(V)

    # - Settings -
    B = TTK.OptionMenu(Frame,
                       VARS[11],
                       '1:MotionStrings',
                       '2:KMotionRotor',
                       '3:ConstantMotion',
                       command=changeMotionType)
    B.grid(row=0, column=0, columnspan=3, sticky=TK.EW)

    B = TTK.Label(Frame, text="Name:")
    BB = CTK.infoBulle(parent=B, text='Name of motion.')
    B.grid(row=1, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame, textvariable=VARS[0], background='White')
    B.grid(row=1, column=1, columnspan=2, sticky=TK.EW)

    # - Set/Get -
    B = TTK.Button(Frame, text="Get", command=getVars)
    B.grid(row=3, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Get motion from zone (if exists).')
    B = TTK.Button(Frame, text="Set", command=setVars)
    B.grid(row=3, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Set motion in zone.')
    B = TTK.Button(Frame, text="Reset", command=resetVars)
    B.grid(row=3, column=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Reset all to default.')

    # Frame pour chaque type de motion
    Frame1 = TTK.Frame(Frame, borderwidth=0)
    Frame1.columnconfigure(0, weight=0)
    Frame1.columnconfigure(1, weight=1)
    WIDGETS['frame1'] = Frame1
    Frame2 = TTK.Frame(Frame, borderwidth=0)
    Frame2.columnconfigure(0, weight=0)
    Frame2.columnconfigure(1, weight=1)
    WIDGETS['frame2'] = Frame2
    Frame3 = TTK.Frame(Frame, borderwidth=0)
    Frame3.columnconfigure(0, weight=0)
    Frame3.columnconfigure(1, weight=1)
    WIDGETS['frame3'] = Frame3

    # - Motion Type1: motion strings -
    B = TTK.Label(Frame1, text="tx:")
    BB = CTK.infoBulle(parent=B,
                       text='Translation of origin.\nCan depend on {t}.')
    B.grid(row=0, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame1, textvariable=VARS[1], background='White')
    BB = CTK.infoBulle(parent=B,
                       text='Translation of origin.\nCan depend on {t}.')
    B.grid(row=0, column=1, sticky=TK.EW)
    B.bind('<Return>', setVars1)

    B = TTK.Label(Frame1, text="ty:")
    BB = CTK.infoBulle(parent=B,
                       text='Translation of origin.\nCan depend on {t}.')
    B.grid(row=1, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame1, textvariable=VARS[2], background='White')
    BB = CTK.infoBulle(parent=B,
                       text='Translation of origin.\nCan depend on {t}.')
    B.grid(row=1, column=1, sticky=TK.EW)
    B.bind('<Return>', setVars1)

    B = TTK.Label(Frame1, text="tz:")
    BB = CTK.infoBulle(parent=B,
                       text='Translation of origin.\nCan depend on {t}.')
    B.grid(row=2, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame1, textvariable=VARS[3], background='White')
    BB = CTK.infoBulle(parent=B,
                       text='Translation of origin.\nCan depend on {t}.')
    B.grid(row=2, column=1, sticky=TK.EW)
    B.bind('<Return>', setVars1)

    B = TTK.Button(Frame1, text="Set", command=setTransOrigin)
    B.grid(row=1, column=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Set trans origin from mouse.')

    B = TTK.Label(Frame1, text="cx:")
    BB = CTK.infoBulle(parent=B,
                       text='Center of rotation.\nCan depend on {t}.')
    B.grid(row=4, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame1, textvariable=VARS[4], background='White')
    BB = CTK.infoBulle(parent=B,
                       text='Center of rotation.\nCan depend on {t}.')
    B.grid(row=4, column=1, sticky=TK.EW)
    B.bind('<Return>', setVars1)

    B = TTK.Label(Frame1, text="cy:")
    BB = CTK.infoBulle(parent=B,
                       text='Center of rotation.\nCan depend on {t}.')
    B.grid(row=5, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame1, textvariable=VARS[5], background='White')
    BB = CTK.infoBulle(parent=B,
                       text='Center of rotation.\nCan depend on {t}.')
    B.grid(row=5, column=1, sticky=TK.EW)
    B.bind('<Return>', setVars1)

    B = TTK.Label(Frame1, text="cz:")
    BB = CTK.infoBulle(parent=B,
                       text='Center of rotation.\nCan depend on {t}.')
    B.grid(row=6, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame1, textvariable=VARS[6], background='White')
    B.grid(row=6, column=1, sticky=TK.EW)
    B.bind('<Return>', setVars1)

    B = TTK.Button(Frame1, text="Set", command=setCenterRotation)
    B.grid(row=5, column=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Set rotation center from mouse.')

    B = TTK.Label(Frame1, text="ex:")
    BB = CTK.infoBulle(parent=B,
                       text='Second rot axis point.\nCan depend on {t}.')
    B.grid(row=7, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame1, textvariable=VARS[7], background='White')
    BB = CTK.infoBulle(parent=B,
                       text='Second rot axis point.\nCan depend on {t}.')
    B.grid(row=7, column=1, sticky=TK.EW)
    B.bind('<Return>', setVars1)

    B = TTK.Label(Frame1, text="ey:")
    BB = CTK.infoBulle(parent=B,
                       text='Second rot axis point.\nCan depend on {t}.')
    B.grid(row=8, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame1, textvariable=VARS[8], background='White')
    BB = CTK.infoBulle(parent=B,
                       text='Second rot axis point.\nCan depend on {t}.')
    B.grid(row=8, column=1, sticky=TK.EW)
    B.bind('<Return>', setVars1)

    B = TTK.Label(Frame1, text="ez:")
    BB = CTK.infoBulle(parent=B,
                       text='Second rot axis point.\nCan depend on {t}.')
    B.grid(row=9, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame1, textvariable=VARS[9], background='White')
    BB = CTK.infoBulle(parent=B,
                       text='Second rot axis point.\nCan depend on {t}.')
    B.grid(row=9, column=1, sticky=TK.EW)
    B.bind('<Return>', setVars1)

    B = TTK.Button(Frame1, text="Set", command=set2Axis)
    B.grid(row=8, column=2, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Set rot axis from mouse.')

    B = TTK.Label(Frame1, text="angle:")
    BB = CTK.infoBulle(parent=B,
                       text='Rotation angle.\Can depend on {t}. In degrees.')
    B.grid(row=10, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame1, textvariable=VARS[10], background='White')
    BB = CTK.infoBulle(parent=B,
                       text='Rotation angle.\Can depend on {t}. In degrees.')
    B.grid(row=10, column=1, sticky=TK.EW)
    B.bind('<Return>', setVars1)

    # - Motion Type2: KMotionRotor -
    B = TTK.Label(Frame2, text="transl_speed:")
    BB = CTK.infoBulle(parent=B, text='Translation speed and span_vect.')
    B.grid(row=0, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame2, textvariable=VARS[17], background='White', width=10)
    BB = CTK.infoBulle(parent=B, text='transl_speed.')
    B.grid(row=0, column=1, sticky=TK.EW)
    B.bind('<Return>', setVars2)

    B = TTK.Entry(Frame2, textvariable=VARS[36], background='White', width=10)
    BB = CTK.infoBulle(parent=B, text='span vector.')
    B.grid(row=0, column=2, sticky=TK.EW)
    B.bind('<Return>', setVars2)

    B = TTK.Label(Frame2, text="psi0:")
    BB = CTK.infoBulle(parent=B, text='Azymuth at t=0.')
    B.grid(row=1, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame2, textvariable=VARS[12], background='White', width=10)
    BB = CTK.infoBulle(parent=B, text='psi0. In degrees.')
    B.grid(row=1, column=1, sticky=TK.EW)
    B.bind('<Return>', setVars2)
    B = TTK.Entry(Frame2, textvariable=VARS[13], background='White', width=10)
    BB = CTK.infoBulle(parent=B, text='psi0_b. In degrees.')
    B.grid(row=1, column=2, sticky=TK.EW)
    B.bind('<Return>', setVars2)

    B = TTK.Label(Frame2, text="alp:")
    BB = CTK.infoBulle(parent=B, text='Shaft angle.')
    B.grid(row=2, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame2, textvariable=VARS[14], background='White', width=10)
    BB = CTK.infoBulle(parent=B, text='alp_pnt.')
    B.grid(row=2, column=1, sticky=TK.EW)
    B.bind('<Return>', setVars2)
    B = TTK.Entry(Frame2, textvariable=VARS[15], background='White', width=10)
    BB = CTK.infoBulle(parent=B, text='alp_vct.')
    B.grid(row=2, column=2, sticky=TK.EW)
    B.bind('<Return>', setVars2)
    B = TTK.Entry(Frame2, textvariable=VARS[16], background='White', width=4)
    BB = CTK.infoBulle(parent=B, text='alp0. In degrees.')
    B.grid(row=2, column=3, sticky=TK.EW)
    B.bind('<Return>', setVars2)

    B = TTK.Label(Frame2, text="rot:")
    BB = CTK.infoBulle(parent=B, text='Rotation.')
    B.grid(row=3, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame2, textvariable=VARS[18], background='White', width=10)
    BB = CTK.infoBulle(parent=B, text='rot_pnt.')
    B.grid(row=3, column=1, sticky=TK.EW)
    B.bind('<Return>', setVars2)
    B = TTK.Entry(Frame2, textvariable=VARS[19], background='White', width=10)
    BB = CTK.infoBulle(parent=B, text='rot_vct.')
    B.grid(row=3, column=2, sticky=TK.EW)
    B.bind('<Return>', setVars2)
    B = TTK.Entry(Frame2, textvariable=VARS[20], background='White', width=4)
    BB = CTK.infoBulle(parent=B, text='rot_omg. In rad/time unit.')
    B.grid(row=3, column=3, sticky=TK.EW)
    B.bind('<Return>', setVars2)

    B = TTK.Label(Frame2, text="del:")
    BB = CTK.infoBulle(parent=B, text='..')
    B.grid(row=4, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame2, textvariable=VARS[21], background='White', width=10)
    BB = CTK.infoBulle(parent=B, text='del_pnt.')
    B.grid(row=4, column=1, sticky=TK.EW)
    B.bind('<Return>', setVars2)
    B = TTK.Entry(Frame2, textvariable=VARS[22], background='White', width=10)
    BB = CTK.infoBulle(parent=B, text='del_vct.')
    B.grid(row=4, column=2, sticky=TK.EW)
    B.bind('<Return>', setVars2)
    B = TTK.Entry(Frame2, textvariable=VARS[23], background='White', width=4)
    B.grid(row=4, column=3, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='del0. In degrees.')
    B.bind('<Return>', setVars2)
    B = TTK.Label(Frame2, text="delc,s:")
    BB = CTK.infoBulle(parent=B, text='del modes.')
    B.grid(row=5, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame2, textvariable=VARS[24], background='White', width=10)
    BB = CTK.infoBulle(parent=B, text='delc.')
    B.grid(row=5, column=1, sticky=TK.EW)
    B.bind('<Return>', setVars2)
    B = TTK.Entry(Frame2, textvariable=VARS[25], background='White', width=10)
    BB = CTK.infoBulle(parent=B, text='dels.')
    B.grid(row=5, column=2, sticky=TK.EW)
    B.bind('<Return>', setVars2)

    B = TTK.Label(Frame2, text="bet:")
    BB = CTK.infoBulle(parent=B, text='..')
    B.grid(row=6, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame2, textvariable=VARS[26], background='White', width=10)
    BB = CTK.infoBulle(parent=B, text='bet_pnt.')
    B.grid(row=6, column=1, sticky=TK.EW)
    B.bind('<Return>', setVars2)
    B = TTK.Entry(Frame2, textvariable=VARS[27], background='White', width=10)
    BB = CTK.infoBulle(parent=B, text='bet_vct.')
    B.grid(row=6, column=2, sticky=TK.EW)
    B.bind('<Return>', setVars2)
    B = TTK.Entry(Frame2, textvariable=VARS[28], background='White', width=4)
    B.grid(row=6, column=3, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='bet0. In degrees.')
    B.bind('<Return>', setVars2)
    B = TTK.Label(Frame2, text="betc,s:")
    BB = CTK.infoBulle(parent=B, text='bet modes.')
    B.grid(row=7, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame2, textvariable=VARS[29], background='White', width=10)
    BB = CTK.infoBulle(parent=B, text='betc.')
    B.grid(row=7, column=1, sticky=TK.EW)
    B.bind('<Return>', setVars2)
    B = TTK.Entry(Frame2, textvariable=VARS[30], background='White', width=10)
    BB = CTK.infoBulle(parent=B, text='bets.')
    B.grid(row=7, column=2, sticky=TK.EW)
    B.bind('<Return>', setVars2)

    B = TTK.Label(Frame2, text="tet:")
    BB = CTK.infoBulle(parent=B, text='..')
    B.grid(row=8, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame2, textvariable=VARS[31], background='White', width=10)
    BB = CTK.infoBulle(parent=B, text='tet_pnt.')
    B.grid(row=8, column=1, sticky=TK.EW)
    B.bind('<Return>', setVars2)
    B = TTK.Entry(Frame2, textvariable=VARS[32], background='White', width=10)
    BB = CTK.infoBulle(parent=B, text='tet_vct.')
    B.grid(row=8, column=2, sticky=TK.EW)
    B.bind('<Return>', setVars2)
    B = TTK.Entry(Frame2, textvariable=VARS[33], background='White', width=4)
    B.grid(row=8, column=3, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='tet0. In degrees.')
    B.bind('<Return>', setVars2)
    B = TTK.Label(Frame2, text="tetc,s:")
    BB = CTK.infoBulle(parent=B, text='tet modes.')
    B.grid(row=9, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame2, textvariable=VARS[34], background='White', width=10)
    BB = CTK.infoBulle(parent=B, text='tetc.')
    B.grid(row=9, column=1, sticky=TK.EW)
    B.bind('<Return>', setVars2)
    B = TTK.Entry(Frame2, textvariable=VARS[35], background='White', width=10)
    BB = CTK.infoBulle(parent=B, text='tets.')
    B.grid(row=9, column=2, sticky=TK.EW)
    B.bind('<Return>', setVars2)

    B = TTK.Label(Frame2, text="pre_lag:")
    BB = CTK.infoBulle(parent=B, text='..')
    B.grid(row=10, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame2, textvariable=VARS[37], background='White', width=10)
    BB = CTK.infoBulle(parent=B, text='pre_lag_pnt.')
    B.grid(row=10, column=1, sticky=TK.EW)
    B.bind('<Return>', setVars2)
    B = TTK.Entry(Frame2, textvariable=VARS[38], background='White', width=10)
    BB = CTK.infoBulle(parent=B, text='pre_lag_vct.')
    B.grid(row=10, column=2, sticky=TK.EW)
    B.bind('<Return>', setVars2)
    B = TTK.Entry(Frame2, textvariable=VARS[39], background='White', width=4)
    B.grid(row=10, column=3, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='pre_lag_ang. In degrees.')
    B.bind('<Return>', setVars2)

    B = TTK.Label(Frame2, text="pre_con:")
    BB = CTK.infoBulle(parent=B, text='..')
    B.grid(row=11, column=0, sticky=TK.EW)
    B = TK.Entry(Frame2, textvariable=VARS[40], background='White', width=10)
    BB = CTK.infoBulle(parent=B, text='pre_con_pnt.')
    B.grid(row=11, column=1, sticky=TK.EW)
    B.bind('<Return>', setVars2)
    B = TK.Entry(Frame2, textvariable=VARS[41], background='White', width=10)
    BB = CTK.infoBulle(parent=B, text='pre_con_vct.')
    B.grid(row=11, column=2, sticky=TK.EW)
    B.bind('<Return>', setVars2)
    B = TK.Entry(Frame2, textvariable=VARS[42], background='White', width=4)
    B.grid(row=11, column=3, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='pre_con_ang. In degrees.')
    B.bind('<Return>', setVars2)

    # - Motion Type3: ConstantMotion -
    B = TTK.Label(Frame3, text="transl_speed:")
    BB = CTK.infoBulle(parent=B, text='Translation speed.')
    B.grid(row=0, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame3, textvariable=VARS[43], background='White')
    BB = CTK.infoBulle(parent=B, text='Translation speed.')
    B.grid(row=0, column=1, sticky=TK.EW)
    B.bind('<Return>', setVars3)
    B = TTK.Label(Frame3, text="axis_pnt:")
    BB = CTK.infoBulle(parent=B, text='Rotation center.')
    B.grid(row=1, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame3, textvariable=VARS[44], background='White')
    BB = CTK.infoBulle(parent=B, text='Rotation center.')
    B.grid(row=1, column=1, sticky=TK.EW)
    B.bind('<Return>', setVars3)
    B = TTK.Label(Frame3, text="axis_vct:")
    BB = CTK.infoBulle(parent=B, text='Rotation axis.')
    B.grid(row=2, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame3, textvariable=VARS[45], background='White')
    BB = CTK.infoBulle(parent=B, text='Rotation axis.')
    B.grid(row=2, column=1, sticky=TK.EW)
    B.bind('<Return>', setVars3)
    B = TTK.Label(Frame3, text="omega:")
    BB = CTK.infoBulle(parent=B, text='Rotation speed. In rad/time unit.')
    B.grid(row=3, column=0, sticky=TK.EW)
    B = TTK.Entry(Frame3, textvariable=VARS[46], background='White')
    BB = CTK.infoBulle(parent=B, text='Rotation speed. In rad/time unit.')
    B.grid(row=3, column=1, sticky=TK.EW)
    B.bind('<Return>', setVars3)

    changeMotionType()
Ejemplo n.º 22
0
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
Ejemplo n.º 23
0
def createApp(win):
    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkCellN',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Chimera cellN analysis.\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, 'tkCellN')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- cellN filter -
    norow = 0
    V = TK.StringVar(win)
    V.set('cellN=0')
    VARS.append(V)
    if 'tkCellNFilter' in CTK.PREFS: V.set(CTK.PREFS['tkCellNFilter'])

    # Filter
    B = TTK.OptionMenu(Frame, VARS[0], 'Mesh', 'cellN=0', 'cellN=-99999',
                       'cellN=2', 'cellN<0', '0<cellN<1', 'cellN=1', 'cf>1',
                       'Orphan points', 'Extrapolated points',
                       'Interpolated points')
    B.grid(row=norow, column=0, columnspan=2, sticky=TK.EW)

    # - View cellN -
    norow += 1
    B = TTK.Button(Frame, text="View", command=view)
    B.grid(row=norow, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(
        parent=B,
        text='View the location of specified cellN.\nTree is NOT modified.')

    # - Extract cellN -
    B = TTK.Button(Frame, text="Extract", command=extract)
    B.grid(row=norow, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(
        parent=B,
        text='Extract the location of specified cellN.\nTree is modified.')

    # - chimeraInfo
    # -1- chimeraInfo type
    norow += 1
    V = TK.StringVar(win)
    V.set('interpolated')
    VARS.append(V)
    if 'tkChimeraInfoType' in CTK.PREFS: V.set(CTK.PREFS['tkChimeraInfoType'])

    # Filter
    B = TTK.Button(Frame, text="Chimera info", command=chimeraInfo)
    B.grid(row=norow, column=0, sticky=TK.EW)
    B = TTK.OptionMenu(Frame, VARS[1], 'interpolated', 'extrapolated',
                       'orphan', 'cellRatio', 'donorAspect')
    B.grid(row=norow, column=1, sticky=TK.EW)
Ejemplo n.º 24
0
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)
Ejemplo n.º 25
0
def createApp(win):
    ttk = CTK.importTtk()

    # - Frame -
    Frame = TTK.LabelFrame(win,
                           borderwidth=2,
                           relief=CTK.FRAMESTYLE,
                           text='tkBasicSurfs',
                           font=CTK.FRAMEFONT,
                           takefocus=1)
    #BB = CTK.infoBulle(parent=Frame, text='Create basic surfaces.\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(0, 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, 'tkBasicSurfs')
    WIDGETS['frameMenu'] = FrameMenu

    # - VARS -
    # -0- NPts -
    V = TK.StringVar(win)
    V.set('10')
    VARS.append(V)
    if 'tkBasicSurfsNpts' in CTK.PREFS:
        V.set(CTK.PREFS['tkBasicSurfsNpts'])
    # -1- Type d'elements
    V = TK.StringVar(win)
    V.set('TRI')
    VARS.append(V)
    if 'tkBasicSurfsElts' in CTK.PREFS:
        V.set(CTK.PREFS['tkBasicSurfsElts'])
    # -2- Type de surface
    V = TK.StringVar(win)
    V.set('Sphere')
    VARS.append(V)
    if 'tkBasicSurfsType' in CTK.PREFS:
        V.set(CTK.PREFS['tkBasicSurfsType'])

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

    # - Type d'elements: TRI ou STRUCT -
    B = TTK.OptionMenu(Frame, VARS[1], 'TRI', 'QUAD', 'STRUCT')
    B.grid(row=0, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Surface element type.')

    # - Type de surface -
    SURFTYPES = [
        'Sphere', 'Cube', 'Tetra', 'Pyramid', 'Cylinder', 'Plane', 'Cone'
    ]
    SURFTYPES += base.keys()
    if ttk is None:
        B = TK.OptionMenu(Frame, VARS[2], *SURFTYPES)
    else:
        B = ttk.Combobox(Frame,
                         textvariable=VARS[2],
                         values=SURFTYPES,
                         state='readonly',
                         width=10)
    B.grid(row=1, column=0, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Type of generated surface.')
    B = TTK.Button(Frame, text="Generate", command=generate)
    B.grid(row=1, column=1, sticky=TK.EW)
    BB = CTK.infoBulle(parent=B, text='Generate surface.')
Ejemplo n.º 26
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.')