示例#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
示例#2
0
    def __init__(self, *args, **kwargs):
        #        app = Application.instance
        if "valueChecker" in kwargs:
            valueChecker = kwargs.pop("valueChecker")
            checkFloat = valueChecker.checkFloat
        else:
            checkFloat = None

        if "balloon" in kwargs:
            balloonBindWidget = kwargs.pop("balloon").bind_widget
        else:
            balloonBindWidget = lambda *args, **kwargs: None

        super(AxisGroup, self).__init__(*args, **kwargs)
        self.__params = [StringVar() for i in range(8)]
        paramfrm = Frame(self)
        paramfrm.pack()
        names = ["xmin", "xmax", "ymin", "ymax", "major xtick", "major ytick", "minor xtick", "minor ytick"]
        images = [
            "ViewTab_XMin.png",
            "ViewTab_XMax.png",
            "ViewTab_YMin.png",
            "ViewTab_YMax.png",
            "ViewTab_MajorXTick.png",
            "ViewTab_MajorYTick.png",
            "ViewTab_MinorXTick.png",
            "ViewTab_MinorYTick.png",
        ]
        for c in range(4):
            for r in range(2):
                temp = ParamItem(paramfrm)
                image = ImageTk.PhotoImage(file=uiImagePath(images[c * 2 + r]))
                setMultiAttr(
                    temp,
                    checkFunc=checkFloat,
                    # labelText   = names[c*2+r],
                    labelImage=image,
                    labelWidth=5 if c * 2 + r < 4 else 10,
                    entryWidth=5,
                    entryVar=self.__params[c * 2 + r],
                )
                temp.entry.bind("<Return>", self.onConfirmClick)
                temp.grid(row=r, column=c)
                balloonBindWidget(temp, balloonmsg=names[c * 2 + r])

        btnfrm = Frame(self)
        btnfrm.pack()
        Button(btnfrm, text="Confirm", command=self.onConfirmClick).pack(side=LEFT)
        Button(btnfrm, text="Auto", command=self.onAutoClick).pack(side=RIGHT)
        self.name = "Axis"
        self.__figureObserver = self.FigureObserver(self)
示例#3
0
    def __init__(self, *args, **kwargs):
        #        app = Application.instance
        if 'valueChecker' in kwargs:
            valueChecker = kwargs.pop('valueChecker')
            checkFloat = valueChecker.checkFloat
        else:
            checkFloat = None

        if 'balloon' in kwargs:
            balloonBindWidget = kwargs.pop('balloon').bind_widget
        else:
            balloonBindWidget = lambda *args, **kwargs: None

        super(AxisGroup, self).__init__(*args, **kwargs)
        self.__params = [StringVar() for i in range(8)]
        paramfrm = Frame(self)
        paramfrm.pack()
        names = [
            'xmin', 'xmax', 'ymin', 'ymax', 'major xtick', 'major ytick',
            'minor xtick', 'minor ytick'
        ]
        images = [
            'ViewTab_XMin.png', 'ViewTab_XMax.png', 'ViewTab_YMin.png',
            'ViewTab_YMax.png', 'ViewTab_MajorXTick.png',
            'ViewTab_MajorYTick.png', 'ViewTab_MinorXTick.png',
            'ViewTab_MinorYTick.png'
        ]
        for c in range(4):
            for r in range(2):
                temp = ParamItem(paramfrm)
                image = ImageTk.PhotoImage(file=uiImagePath(images[c * 2 + r]))
                setMultiAttr(
                    temp,
                    checkFunc=checkFloat,
                    #labelText   = names[c*2+r],
                    labelImage=image,
                    labelWidth=5 if c * 2 + r < 4 else 10,
                    entryWidth=5,
                    entryVar=self.__params[c * 2 + r])
                temp.entry.bind('<Return>', self.onConfirmClick)
                temp.grid(row=r, column=c)
                balloonBindWidget(temp, balloonmsg=names[c * 2 + r])

        btnfrm = Frame(self)
        btnfrm.pack()
        Button(btnfrm, text='Confirm',
               command=self.onConfirmClick).pack(side=LEFT)
        Button(btnfrm, text='Auto', command=self.onAutoClick).pack(side=RIGHT)
        self.name = 'Axis'
        self.__figureObserver = self.FigureObserver(self)