Beispiel #1
0
        def askSpan(orient="v"):
            win = Toplevel()
            pxmin = ParamItem(win)
            pxmin.pack()
            pxmin.labelText = "xmin" if orient == "v" else "ymin"
            pxmax = ParamItem(win)
            pxmax.pack()
            pxmax.labelText = "xmax" if orient == "v" else "ymax"

            def formatter(val):
                val = float(val)
                val /= 100.0
                return "{0:0.2f}".format(val)

            alphaScale = LabeledScale(win, from_=0, to=100, name="alpha", formatter=formatter)
            alphaScale.set(50.0)
            alphaScale.pack()
            win.protocol("WM_DELETE_WINDOW", win.quit)
            win.focus_set()
            win.grab_set()
            win.mainloop()
            xmin = pxmin.entry.get()
            xmax = pxmax.entry.get()
            alpha = alphaScale.get() / 100.0
            win.destroy()
            return map(float, (xmin, xmax, alpha))
Beispiel #2
0
        def askSpan(orient='v'):
            win = Toplevel()
            pxmin = ParamItem(win)
            pxmin.pack()
            pxmin.labelText = 'xmin' if orient == 'v' else 'ymin'
            pxmax = ParamItem(win)
            pxmax.pack()
            pxmax.labelText = 'xmax' if orient == 'v' else 'ymax'

            def formatter(val):
                val = float(val)
                val /= 100.
                return '{0:0.2f}'.format(val)

            alphaScale = LabeledScale(win,
                                      from_=0,
                                      to=100,
                                      name='alpha',
                                      formatter=formatter)
            alphaScale.set(50.0)
            alphaScale.pack()
            win.protocol('WM_DELETE_WINDOW', win.quit)
            win.focus_set()
            win.grab_set()
            win.mainloop()
            xmin = pxmin.entry.get()
            xmax = pxmax.entry.get()
            alpha = alphaScale.get() / 100.
            win.destroy()
            return map(float, (xmin, xmax, alpha))
Beispiel #3
0
 def __init__(self, *args, **kwargs):
     #self._app = app = Application.instance
     self.__topwin = kwargs.pop('topwin')
     Group.__init__(self, *args, **kwargs)
     Button(self, text='Load *.mat', command=self.onLoadClick).pack()
     paramX = ParamItem(self)
     paramX.labelText = 'x = '
     paramX.entryWidth = 6
     paramX.pack()
     self.__paramX = paramX
     paramY = ParamItem(self)
     paramY.labelText = 'y = '
     paramY.entryWidth = 6
     paramY.pack()
     self.__paramY = paramY
     self.name = 'Load'
Beispiel #4
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 #5
0
        def __init__(self, *args, **kwargs):
            timer = kwargs.pop('timer')
            self.__timer = timer

            Toplevel.__init__(self, *args, **kwargs)
            interval = ParamItem(self)
            interval.labelText = 'Interval (ms)'
            interval.entryText = str(timer.interval)
            interval.entryWidth = 5
            interval.pack(side=TOP)
            self.interval = interval

            self.active = IntVar(timer.active)
            Checkbutton(self,
                        text='Activate',
                        variable=self.active,
                        command=self.onActivateClick).pack(side=TOP)
            Button(self, text='OK', command=self.onOKClick).pack(side=TOP)

            def hide():
                self.visible = False

            self.protocol('WM_DELETE_WINDOW', hide)

            self.__visible = True
            self.visible = False
Beispiel #6
0
 def __init__(self, *args, **kwargs):
     #self._app = app = Application.instance
     self.__topwin = kwargs.pop('topwin')
     Group.__init__(self, *args, **kwargs)
     Button(self, text='Load *.mat', command=self.onLoadClick).pack()
     paramX = ParamItem(self)
     paramX.labelText = 'x = '
     paramX.entryWidth = 6
     paramX.pack()
     self.__paramX = paramX
     paramY = ParamItem(self)
     paramY.labelText = 'y = '
     paramY.entryWidth = 6
     paramY.pack()
     self.__paramY = paramY
     self.name = 'Load'
Beispiel #7
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 #8
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 #9
0
def askClassName():
    win = Toplevel()

    moduleName = StringVar()
    className = StringVar()

    moduleItem = ParamItem(win)
    moduleItem.labelText = 'Module Name'
    moduleItem.pack()
    moduleItem.entryVar = moduleName

    classItem = ParamItem(win)
    classItem.labelText = 'Class Name'
    classItem.pack()
    classItem.entryVar = className

    Button(win, text='OK', command=win.quit).pack()

    win.protocol('WM_DELETE_WINDOW', win.quit)
    win.focus_set()
    win.grab_set()
    win.mainloop()
    win.destroy()
    return moduleName.get(), className.get()
Beispiel #10
0
def askClassName():
    win = Toplevel()

    moduleName = StringVar()
    className = StringVar()

    moduleItem = ParamItem(win)
    moduleItem.labelText = "Module Name"
    moduleItem.pack()
    moduleItem.entryVar = moduleName

    classItem = ParamItem(win)
    classItem.labelText = "Class Name"
    classItem.pack()
    classItem.entryVar = className

    Button(win, text="OK", command=win.quit).pack()

    win.protocol("WM_DELETE_WINDOW", win.quit)
    win.focus_set()
    win.grab_set()
    win.mainloop()
    win.destroy()
    return moduleName.get(), className.get()
Beispiel #11
0
        def __init__(self, *args, **kwargs):
            timer       = kwargs.pop('timer')
            self.__timer    = timer
            
            Toplevel.__init__(self, *args, **kwargs)
            interval    = ParamItem(self)
            interval.labelText  = 'Interval (ms)'
            interval.entryText  = str(timer.interval)
            interval.entryWidth = 5
            interval.pack(side=TOP)
            self.interval   = interval
            
            self.active   = IntVar(timer.active)
            Checkbutton(self, text='Activate', variable=self.active, command=self.onActivateClick).pack(side=TOP)
            Button(self, text='OK', command=self.onOKClick).pack(side=TOP)
            
            def hide(): self.visible    = False
            self.protocol('WM_DELETE_WINDOW', hide)

            self.__visible  = True
            self.visible = False