示例#1
0
 def __init__(self, platform, display):
     Frame.__init__(self, display.boundary, platform, display)
     self += VolumeSourceFrame(display.boundary, platform, display, 0.3,
                               'right')
     self += SpectrumStereoFrame(display.boundary, platform, display, 0.7,
                                 'left')
     self.check()
示例#2
0
    def __init__(self, bounds, platform, display, scale,
                 H):  # size is a scaling factor
        Frame.__init__(self,
                       platform=platform,
                       bounds=bounds,
                       display=display,
                       scalers=(scale, 1.0),
                       Valign='middle',
                       Halign=H)
        self.files = {}  # dictionary of files to images
        self.icons = {}  # dictionary of images, sources as keys

        #Build a dict of all the icon files to be used
        sources = self.platform.sourcesAvailable
        for s in sources:
            self.files.update({s: self.platform.getSourceIconFiles(s)})

        # print("source files>", self.files)
        #Build a dict of all the images, sized, positioned, ready to go
        for s in self.files:
            images = []
            for f in self.files[s]:
                img_path = os.path.abspath(
                    os.path.join(os.path.dirname(__file__), 'icons', f))
                img = scaleImage(img_path, self)
                # if img.width > self.w:
                #     self.w = img.width
                images.append(img)
            self.icons.update({s: images})
示例#3
0
 def __init__(self, platform, display):
     Frame.__init__(self, display.boundary, platform, display)
     self += TextFrame(display.boundary, platform, display, 'top', 0.5,
                       'Recording saved to')
     self += RecordEndFrame(display.boundary, platform, display, 'bottom',
                            0.5)
     self.check()
示例#4
0
 def __init__(self, platform, display):
     Frame.__init__(self, display.boundary, platform, display)
     self += dbVolumeSourceFrame(display.boundary, platform, display, 0.4,
                                 'right')
     self += SourceIconFrame(display.boundary, platform, display, 0.6,
                             'left')
     self.check()
示例#5
0
    def __init__(self, platform, display):
        Frame.__init__(self, display.boundary, platform, display)
        self += VolumeSourceFrame(display.boundary, platform, display, 0.3, 'right')

        self += VUV2chFrame(display.boundary, platform, display, 0.3, 'centre')
        self += SourceIconFrame(display.boundary, platform, display, 0.4, 'left')
        self.check()
示例#6
0
    def __init__(self, platform, display):
        Frame.__init__(self, display.boundary, platform, display)
        self += SpectrumFrame(self.coords, platform, display, 'left', 0.3 )
        self += dbVolumeSourceFrame(display.boundary, platform, display, 0.4, 'centre')
        self += SpectrumFrame(self.coords, platform, display, 'right', 0.3 )

        self.check()
示例#7
0
    def __init__(self,
                 bounds,
                 platform,
                 display,
                 V,
                 Y,
                 text='',
                 X=1.0,
                 H='centre'):
        Frame.__init__(self,
                       bounds=bounds,
                       platform=platform,
                       display=display,
                       scalers=(X, Y),
                       Valign=V,
                       Halign=H)
        # scale the font so the widest fits
        self.text = text
        self.rawtext = text

        if text != '':
            self.font, self.fontwh = scalefont(display, self.wh, text,
                                               "arial.ttf")
            self.charw = int(
                self.w / (self.fontwh[0] / len(text))
            ) - 1  #  be safe as rounds down how many characters wide will fit?
        else:
            self.font = make_font("arial.ttf", self.h / 2)
            self.fontwh = display.textsize('2', self.font)
            self.charw = int(
                self.w / self.fontwh[0]
            ) - 1  # be safe as rounds down how many characters wide will fit?
示例#8
0
    def __init__(self, platform, display):
        Frame.__init__(self, display.boundary, platform, display)


        self += TextFrame(display.boundary, platform, display, 'middle', 1.0, "Welcome to \npreDAC preamp")
        # self += MenuFrame(display.boundary, platform, display)

        self.check()
示例#9
0
 def __init__(self, bounds, platform, display, scale):
     Frame.__init__(self,
                    display=display,
                    platform=platform,
                    bounds=bounds,
                    scalers=(scale, 0.5),
                    Valign='middle',
                    Halign='left')
示例#10
0
 def __init__(self, bounds, platform, display,
              channel):  # size is a horz scaling factor
     self.channel = channel
     Frame.__init__(self,
                    platform=platform,
                    bounds=bounds,
                    display=display,
                    scalers=(1.0, 1.0),
                    Valign='top',
                    Halign=channel)
示例#11
0
 def __init__(self, bounds, platform, display, scale, Halign='right'):
     Frame.__init__(self, display.boundary, platform, display, (scale, 1.0),
                    'middle', Halign)
     self += VolumeTextFrame(self.coords, platform, display, "top", 0.7,
                             "22")  # this are the widest number
     self += SourceTextFrame(
         self.coords, platform, display, 'bottom', 0.3,
         self.platform.longestSourceText)  # this are the widest source text
     # self += OutlineFrame(self.coords, platform, display)
     self.check()
示例#12
0
 def __init__(self, bounds, platform, display, scale, H):
     Frame.__init__(self,
                    bounds,
                    platform,
                    display,
                    scalers=(scale, 1.0),
                    Halign=H)
     limits = ((0.6, "red"), (0.8, "grey"), (0.8, "white"))
     self += VUVFrame(self.coords, platform, display, 'left', limits)
     self += VUVFrame(self.coords, platform, display, 'right', limits)
     # self += OutlineFrame(self.coords, platform, display)
     self.check()
示例#13
0
    def __init__(self, bounds, platform, display,
                 channel):  # size is a horizontal scaling factor
        self.channel = channel

        Frame.__init__(self,
                       platform=platform,
                       bounds=bounds,
                       display=display,
                       scalers=(1.0, 1.0),
                       Valign='top',
                       Halign=channel)
        self.font = make_font("arial.ttf", self.h * VUMeterBackground.FONTH)
示例#14
0
 def __init__(self, bounds, platform, display, scale):
     Frame.__init__(self, display.boundary, platform, display, (scale, 1.0),
                    'middle', 'left')
     self += TextFrame(display.boundary,
                       platform,
                       display,
                       'middle',
                       1.0,
                       'Recording',
                       X=0.6,
                       H='left')
     # self += OutlineFrame(self.coords, platform, display)
     self.check()
示例#15
0
    def __init__(self, bounds, platform, display, scale, H):
        one_line = " SOME FAT STUFF"
        Frame.__init__(self,
                       bounds,
                       platform,
                       display,
                       scalers=(scale, 1.0),
                       Halign=H)
        self += AlbumArtistFrame(self.coords, platform, display, 'bottom',
                                 (scale, 0.4))
        self += TrackFrame(self.coords, platform, display, 'top', 0.6,
                           one_line)

        self.check()
示例#16
0
 def __init__(self, bounds, platform, display, V, scale):
     one_line = 'LONG WITH FAT CHARS'
     Frame.__init__(self,
                    bounds,
                    platform,
                    display,
                    scalers=scale,
                    Valign=V,
                    Halign='centre')
     self += ArtistFrame(self.coords, platform, display, 'top', 0.5,
                         one_line)
     self += AlbumFrame(self.coords, platform, display, 'bottom', 0.5,
                        one_line)
     self.check()
示例#17
0
    def __init__(self, bounds, platform, display, channel,
                 limits):  # size is a scaling factor
        self.limits = limits
        self.channel = channel

        Frame.__init__(self,
                       platform=platform,
                       bounds=bounds,
                       display=display,
                       scalers=(VUVFrame.XSCALE, 1.0),
                       Valign='bottom',
                       Halign=channel)
        self.barwidth = int(self.w * VUVFrame.BARWIDTH)
        self.maxh = self.h * VUVFrame.BARHEIGHT
示例#18
0
    def __init__(self, bounds, platform, display, channel,
                 size):  # size is a scaling factor
        self.channel = channel

        Frame.__init__(self,
                       platform=platform,
                       bounds=bounds,
                       display=display,
                       scalers=(size, 1.0),
                       Valign='top',
                       Halign=channel)
        self += VUMeterABackground(self.coords, platform, display, channel)
        self += VUMeterNeedle(self.coords, platform, display, channel)
        self.check()
示例#19
0
 def __init__(self, bounds, platform, display, scale, H):
     Frame.__init__(self,
                    bounds,
                    platform,
                    display,
                    scalers=(scale, 1.0),
                    Halign=H)
     self += SpectrumFrame(self.coords, platform, display, 'left', 0.5)
     self += SpectrumFrame(self.coords,
                           platform,
                           display,
                           'right',
                           0.5,
                           colour='white')
     self.check()
示例#20
0
    def __init__(self,
                 bounds,
                 platform,
                 display,
                 channel,
                 scale,
                 right_offset=0,
                 colour='white'):
        self.channel = channel
        self.right_offset = right_offset
        self.colour = colour

        if channel == 'left':
            self.ch_text = 'L'
        elif channel == 'right':
            self.ch_text = 'R'
        else:
            raise ValueError('SpectrumFrame.__init__> unknown channel',
                             channel)

        Frame.__init__(self,
                       platform=platform,
                       bounds=bounds,
                       display=display,
                       scalers=(scale, 1.0),
                       Valign="top",
                       Halign=channel)

        # Calculate how many bars can be drawn in the width available
        # Go down the bar widths to see what will fit
        # Determine the max octave fraction that can be accomodated
        # Set up the number function to pack the samples

        for spacing in (
                6, 3, 2, 1
        ):  #go down from the finest to the coarsest to find one that fits
            self.bar_freqs = platform.createBands(spacing)
            self.bars = len(self.bar_freqs)
            for barw in range(SpectrumFrame.BARWMAX, SpectrumFrame.BARWMIN,
                              -1):
                self.bar_gap = int(barw * SpectrumFrame.BARGAP)
                self.max_bars = int(self.w / (self.bar_gap + barw))
                if self.bars <= self.max_bars: break
            if self.bars <= self.max_bars: break
        self.barw = barw
        print(
            "SpectrumFrame.__init__> Selected spectrum: max bars=%d, octave spacing=1/%d, num bars=%d, width=%d, gap=%d"
            % (self.max_bars, spacing, self.bars, self.barw, self.bar_gap))
示例#21
0
    def __init__(self, bounds, platform, display, channel,
                 limits):  # size is a scaling factor
        self.limits = limits
        self.channel = channel
        if channel == 'left':
            self.ch_text = 'L'
            V = 'top'
        elif channel == 'right':
            self.ch_text = 'R'
            V = 'bottom'
        else:
            raise ValueError('VUFrame.__init__> unknown channel', channel)

        Frame.__init__(self,
                       platform=platform,
                       bounds=bounds,
                       display=display,
                       scalers=(1.0, 0.5),
                       Valign=V,
                       Halign='left')
        self.font = make_font("arial.ttf", self.h * VUFrame.BARHEIGHT)
示例#22
0
 def __init__(self, bounds, platform, display, scale, Halign='right'):
     Frame.__init__(self,
                    display.boundary,
                    platform,
                    display,
                    scalers=(scale, 1.0),
                    Halign=Halign)
     self += dbVolumeTextFrame(self.coords,
                               platform,
                               display,
                               V='top',
                               Y=0.7,
                               text='-64.0dB')  # this are the widest number
     self += SourceTextFrame(self.coords,
                             platform,
                             display,
                             V='bottom',
                             Y=0.3,
                             text=self.platform.longestSourceText
                             )  # this are the widest source text
     # self += OutlineFrame(self.coords, platform, display)
     self.check()
示例#23
0
 def __init__(self, platform, display):
     Frame.__init__(self, display.boundary, platform, display)
     self += RecordFrame(display.boundary, platform, display, 0.3)
     self += VolumeSourceFrame(display.boundary, platform, display, 0.4,
                               'right')
     self.check()
示例#24
0
 def __init__(self, platform, display):
     Frame.__init__(self, display.boundary, platform, display, scalers= (0.5,1.0), Halign="right", Valign="bottom")
     print("TestScreen>", self)
     self += Frame_1(self.abcd, platform, display, V='bottom', H='left')
     self += Frame_2(self.abcd, platform, display, V='bottom', H='left')
     self.check()
示例#25
0
 def __init__(self, bounds, platform, display, V, H):
     Frame.__init__(self,platform=platform, bounds=bounds, display=display, scalers=(0.5,0.5), Valign='bottom', Halign='centre')
     self.font   = make_font("arial.ttf", self.h*0.5)
示例#26
0
 def __init__(self, platform, display):
     Frame.__init__(self, display.boundary, platform, display)
     self += MetaDataFrame(display.boundary, platform, display, 1.0, 'left')
     self.check()
示例#27
0
 def __init__(self, platform, display):
     Frame.__init__(self, display.boundary, platform, display)
     self += VolumeSourceFrame(display.boundary, platform, display, 0.2,
                               'right')
     self += MetaDataFrame(display.boundary, platform, display, 0.8, 'left')
     self.check()
示例#28
0
 def __init__(self, platform, display):
     Frame.__init__(self, display.boundary, platform, display)
     self += dbVolumeSourceFrame(display.boundary, platform, display, 0.5,
                                 'right')
     self += VUV2chFrame(display.boundary, platform, display, 0.5, 'left')
     self.check()
示例#29
0
 def __init__(self, platform, display):
     Frame.__init__(self, display.boundary, platform, display)
     self += TextFrame(display.boundary, platform, display, 'top', 1.0,
                       ShutdownScreen.text)
示例#30
0
 def __init__(self, platform, display):
     Frame.__init__(self, display.boundary, platform, display)
     self += TextFrame(display.boundary, platform, display, 'top', 1.0, '')