Esempio n. 1
0
    def gui_addMarkerInGui(self,row):
        gm=[]
        M=self.GM.Marker
        M.equalize()
        gm.append(Tkinter.Checkbutton(self.f,variable=self.guiVar[row][0]))
        gm.append(Tkinter.Label(self.f,text=string.zfill(row+1,3)))
        gm.append(Tkinter.Checkbutton(self.f,variable=self.guiVar[row][1]))
        if M.status[row]=='on' : gm[-1].select()
        s=M.symbol[row]
        syms=["dot", "plus", "star", "circle", "cross", "diamond",
              "triangle_up", "triangle_down", "triangle_left", "triangle_right", "square",
              "diamond_fill",
              "triangle_up_fill", "triangle_down_fill", "triangle_left_fill", "triangle_right_fill",
              "square_fill"]
        if type(s)==type(1):
            s=s+1
        for j in range(len(syms)):
            if s==syms[j] : s=j
        gm.append(Pmw.OptionMenu(self.f,items=syms,initialitem=s))
        cols=colors.cols.keys()
        cols.sort()
        cols.insert(0,'Same')
        gm.append(Pmw.ComboBox(self.f,scrolledlist_items=cols,entry_width=10))
        c=M.color[row]
        if type(c)==type(6):
            c=self.x.getcolorcell(c)
            c=colors.rgb2str(c[0]*2.55,c[1]*2.55,c[2]*2.55)
        elif type(c)==type([]):
            c=colors.rgb2str(c)
        gm[-1].selectitem(c)
        gm.append(Tkinter.Text(self.f,width=3,height=1))
        gm[-1].insert(Tkinter.END,str(M.size[row]))
        gm.append(Tkinter.Text(self.f,width=5,height=1))
        gm[-1].insert(Tkinter.END,str(M.id[row]))
        gm.append(Tkinter.Text(self.f,width=4,height=1))
        gm[-1].insert(Tkinter.END,M.id_size[row])
        gm.append(Tkinter.Text(self.f,width=4,height=1))
        gm[-1].insert(Tkinter.END,M.xoffset[row])
        gm.append(Tkinter.Text(self.f,width=4,height=1))
        gm[-1].insert(Tkinter.END,M.yoffset[row])
        gm.append(Pmw.ComboBox(self.f,scrolledlist_items=cols,entry_width=10))
        c=M.id_color[row]
        if type(c)==type(6):
            c=self.x.getcolorcell(c)
            c=colors.rgb2str(c[0]*2.55,c[1]*2.55,c[2]*2.55)
        elif type(c)==type([]):
            c=colors.rgb2str(c)
        gm[-1].selectitem(c)
        gm.append(Pmw.OptionMenu(self.f,items=['1','2','3','4','5','6','7','8','9'],initialitem=str(M.id_font[row])))
        iitem=M.line[row]
        if isinstance(iitem,str):
            iitem=string.capitalize(iitem)
        gm.append(Pmw.OptionMenu(self.f,items=['None','Tail','Head','Line'],initialitem=iitem))
        gm.append(Pmw.OptionMenu(self.f,items=["solid", "dash", "dot", "dash-dot", "long-dash"],initialitem=M.line_type[row]))
        gm.append(Tkinter.Text(self.f,width=4,height=1))
        gm[-1].insert(Tkinter.END,'1.')
        gm.append(Pmw.ComboBox(self.f,scrolledlist_items=cols,entry_width=10))
        c=M.line_color[row]
        if type(c)==type(6):
            c=self.x.getcolorcell(c)
            c=colors.rgb2str(c[0]*2.55,c[1]*2.55,c[2]*2.55)
        elif type(c)==type([]):
            c=colors.rgb2str(c)
        gm[-1].selectitem(c)

        for j in range(len(gm)):
            gm[j].grid(column=j,row=row+1)
        return gm
Esempio n. 2
0
    def gui_generateInterfaceGui(self):
        root=self.notebook.page('Interface')
        Frame=Pmw.ScrolledFrame(root,
                                labelpos = 'n',
                                label_text = 'Interface Editor',
##                                 hull_width=500,
                                )
##         Frame.pack(side='left',fill='both',expand=1)
        Frame.pack(fill = 'both', expand = 1,side='top')
        Frame=Frame.interior()
        #Frame=root
        gen=Pmw.Group(Frame,
                      tag_text='General Aspect',
                      tag_font=('times',14,'bold'),
                      )
        gen.pack(fill = 'both', expand = 1,side='top')
        gen=gen.interior()
        self.detail=Tkinter.Scale(gen,
                                  label='Detail',
                                  from_=50,
                                  to=500,
                                  orient='horizontal',
                                  resolution=5,
                                  tickinterval=50,
                                  length=350,
                                  )
        val=self.GM.detail
        if val<50:
            self.detail.configure(from_=val)
        if val>500:
            self.detail.configure(to=val)
        self.detail.pack(side='top')
        self.detail.set(val)

        self.maxvalue=Pmw.EntryField(gen,
                                     labelpos = 'w',
                                     label_text='Maximum Value',
                                     )
        self.maxvalue.pack(side='top')
        self.maxvalue.setentry(str(self.GM.max))
        self.quadran=Pmw.RadioSelect(gen,
                                     buttontype = 'radiobutton',
                                     orient=Tkinter.HORIZONTAL,
                                     labelpos = 'w',
                                     label_text='Quadran',
                                     )
        self.quadran.pack(side='top')
        self.quadran.add('1')
        self.quadran.add('2')
        self.quadran.invoke(self.GM.quadrans-1)

        self.refval=Pmw.EntryField(gen,
                                       labelpos = 'w',
                                       label_text='Reference Value',
                                       validate='real',
                                     )
        self.refval.pack(side='top')
        self.refval.setentry(self.GM.referencevalue)

        ## Skill related things
        skillFrame=Pmw.Group(Frame,
                             tag_text='Skill',
                             tag_font=('times',14,'bold'),
                             )
        skillFrame.pack(fill = 'both', expand = 1, side='top')
        skillFrame=skillFrame.interior()
        self.skillvalues=Pmw.EntryField(skillFrame,
                                     labelpos = 'w',
                                     label_text='Skill Values',
                                     )
        self.skillvalues.pack(side='top')
        self.skillvalues.setentry(str(self.GM.skillValues))
        
        cols=colors.cols.keys()
        cols.sort()
        self.skillcolor=Pmw.ComboBox(skillFrame,
                                     scrolledlist_items=cols,
                                     labelpos='w',
                                     label_text='Skill Lines Color',
                                     entry_width=10)
        self.skillcolor.pack(side='top')
        c=self.GM.skillColor
        if type(c)==type(6):
            c=self.x.getcolorcell(c)
            c=colors.rgb2str(c[0]*2.55,c[1]*2.55,c[2]*2.55)
        elif type(c)==type([]):
            c=colors.rgb2str(c)
        elif type(c)==type(''):
            r,g,b=colors.str2rgb(c)
            c=colors.rgb2str(r,g,b)
        self.skillcolor.selectitem(c)

        self.drawSkillVar=Tkinter.Variable()
        self.drawSkill=Tkinter.Checkbutton(skillFrame,
                                           text='Draw Skill Contour Lables',
                                           variable=self.drawSkillVar,
                                           )
        self.drawSkill.pack(side='top')
        
        if self.GM.skillDrawLabels=='y' :
            self.drawSkill.select()
        else:
            self.drawSkill.deselect()
                
        self.skillcoeff=Pmw.EntryField(skillFrame,
                                     labelpos = 'w',
                                     label_text='Skill Coefficients',
                                     )
        self.skillcoeff.pack(side='top')
        self.skillcoeff.setentry(str(self.GM.skillCoefficient))


        arrowframe=Pmw.Group(Frame,
                             tag_text='Arrows',
                             tag_font=('times',14,'bold'),
                             )
        arrowframe.pack(side='top')
        arrowframe=arrowframe.interior()
        
        self.length=Tkinter.Scale(arrowframe,
                                  label='Length',
                                  from_=0,
                                  to=100,
                                  orient='horizontal',
                                  resolution=1,
                                  tickinterval=10,
                                  length=350,
##                                   command=self.updatearrow,
                                  )
        self.length.pack(side='top')
        self.length.set(self.GM.arrowlength*100.)
        
        self.angle=Tkinter.Scale(arrowframe,
                                 label='Angle',
                                 from_=0,
                                 to=90,
                                 orient='horizontal',
                                 resolution=1,
                                 tickinterval=15,
                                 length=350,
                                 command=self.updatearrow,
                                 )
        self.angle.pack(side='top')
        self.angle.set(self.GM.arrowangle)
        
        self.base=Tkinter.Scale(arrowframe,
                                label='Base',
                                from_=0,
                                to=100,
                                orient='horizontal',
                                resolution=1,
                                tickinterval=10,
                                length=350,
                                command=self.updatearrow,
                                )
        self.base.pack(side='top')
        self.base.set(self.GM.arrowbase*100.)

        self.arrowcanvaswidth=75
        self.arrowCanvas=Tkinter.Canvas(arrowframe,
                                        width=self.arrowcanvaswidth,
                                        height=self.arrowcanvaswidth*2,
                                        )
        self.arrowCanvas.pack(side='top')
        self.arrowCanvas.create_rectangle(self.arrowcanvaswidth*.02,2*self.arrowcanvaswidth*.49,self.arrowcanvaswidth*.96,2*self.arrowcanvaswidth*.51,fill='black')
        self.arrow=self.arrowCanvas.create_polygon(196.0, 50.0, 186.0, 46.0, 191.0, 48.0, 186.0, 46.0, 196.0, 50.0,fill='black')