Beispiel #1
0
 def appendAlgorithm(self, algorithm):
     #To do: when algo is reset, the frm should be removed
     for algoName in self.__frameDict:
         self.__frameDict[algoName]['frame'].pack_forget()
     frm = Frame(self)
     frm.pack()
     paramInfo   = {}
     params = algorithm['parameters']
     for idx, name in enumerate(params):
         param = params[name]
         paramitem = ParamItem(frm)
         paramitem.labelText = name
         paramitem.labelWidth = 5
         paramitem.entryWidth = 8
         if self.balloon:
             self.balloon.bind_widget(paramitem.label, balloonmsg=param.shortdesc)
         if param.type == 'int':
             paramitem.checkFunc = self._app.checkInt
         elif param.type == 'float':
             paramitem.checkFunc = self._app.checkFloat
         paramitem.grid(row=idx%self.__MAXROW, column=idx//self.__MAXROW)
         #self.__params[param.name] = {'gui':paramitem, 'meta':param}
         paramInfo[param.name] = {'gui':paramitem, 'meta':param}
     self.__algo = algorithm
     #self.__frameDict[algorithm.meta.name]   = frm
     self.__frameDict[algorithm['name']]   = dict(frame=frm, paramInfo=paramInfo)
     self.__params   = paramInfo
Beispiel #2
0
        def askgridprop():
            win = Toplevel()
            color = ['#000000', '#000000']

            propvars = [StringVar() for i in range(4)]
            guidata = (
                {
                    'linestyle': ('Major Line Style', propvars[0], None),
                    ########################################################################################################
                    'linewidth':
                    ('Major Line Width', propvars[1], checkPositiveFloat)
                },
                {
                    'linestyle': ('Minor Line Style', propvars[2], None),
                    'linewidth':
                    ('Minor Line Width', propvars[3], checkPositiveFloat)
                    #########################################################################################################
                })

            for d in guidata:
                for key in d:
                    pitem = ParamItem(win)
                    pitem.pack()
                    pitem.labelText = d[key][0]
                    pitem.entry['textvariable'] = d[key][1]
                    if d[key][2]:
                        pitem.checkFunc = d[key][2]

            def setmajorcolor():
                c = askcolor()
                color[0] = c[1]

            def setminorcolor():
                c = askcolor()
                color[1] = c[1]

            Button(win, text='Major Line Color', command=setmajorcolor).pack()
            Button(win, text='Minor Line Color', command=setminorcolor).pack()

            win.protocol('WM_DELETE_WINDOW', win.quit)
            win.focus_set()
            win.grab_set()
            win.mainloop()
            win.destroy()
            c_major = StringVar()
            c_major.set(color[0])
            c_minor = StringVar()
            c_minor.set(color[1])
            guidata[0]['color'] = ('Major Line Color', c_major, None)
            guidata[1]['color'] = ('Minor Line Color', c_minor, None)
            return guidata
Beispiel #3
0
        def askgridprop():
            win = Toplevel()
            color = ["#000000", "#000000"]

            propvars = [StringVar() for i in range(4)]
            guidata = (
                {
                    "linestyle": ("Major Line Style", propvars[0], None),
                    ########################################################################################################
                    "linewidth": ("Major Line Width", propvars[1], checkPositiveFloat),
                },
                {
                    "linestyle": ("Minor Line Style", propvars[2], None),
                    "linewidth": ("Minor Line Width", propvars[3], checkPositiveFloat)
                    #########################################################################################################
                },
            )

            for d in guidata:
                for key in d:
                    pitem = ParamItem(win)
                    pitem.pack()
                    pitem.labelText = d[key][0]
                    pitem.entry["textvariable"] = d[key][1]
                    if d[key][2]:
                        pitem.checkFunc = d[key][2]

            def setmajorcolor():
                c = askcolor()
                color[0] = c[1]

            def setminorcolor():
                c = askcolor()
                color[1] = c[1]

            Button(win, text="Major Line Color", command=setmajorcolor).pack()
            Button(win, text="Minor Line Color", command=setminorcolor).pack()

            win.protocol("WM_DELETE_WINDOW", win.quit)
            win.focus_set()
            win.grab_set()
            win.mainloop()
            win.destroy()
            c_major = StringVar()
            c_major.set(color[0])
            c_minor = StringVar()
            c_minor.set(color[1])
            guidata[0]["color"] = ("Major Line Color", c_major, None)
            guidata[1]["color"] = ("Minor Line Color", c_minor, None)
            return guidata