Exemplo n.º 1
0
 def layout(self, view):
     BaseScene.layout(self, view)
     cur = view.frame.centeredSubrect(w=800, h=600)
     self.matrix.frame = cur
     self.type_label.frame = view.frame.topLeftSubrect(w=240,
                                                       h=24,
                                                       margins=Size(
                                                           40, 100))
     grid = Grid(frame=view.frame.bottomCenteredSubrect(w=600,
                                                        h=40,
                                                        margin=20),
                 itemSize=Size(120, 40),
                 columns=4,
                 rows=1,
                 spacing=Size(20, 0))
     grid.applyToViews(
         map(self.buttonWithKey, [
             'togglePlotType', 'toggleCounts', 'toggleNull', 'totalCounts'
         ]))
     grid = Grid(frame=view.frame.leftCenteredSubrect(w=120,
                                                      h=400,
                                                      margin=40),
                 itemSize=Size(120, 70),
                 columns=1,
                 rows=5,
                 spacing=Size(0, 10))
     grid.applyToViews(self.data_type_views)
     for dtv in self.data_type_views:
         self.layoutDataTypeView(dtv)
     return view
Exemplo n.º 2
0
 def layout(self, view):
     BaseScene.layout(self, view)
     cur = view.frame.centeredSubrect(w=800, h=view.frame.size.h - 100)
     left = cur.leftSubrect(w=400)
     self.scroller = layoutInScroller(self.tagViews, cur.leftover,
                                      Size(300, 40), 20, self.scroller)
     top = left.topSubrect(40)
     left = left.leftover
     self.query_label.frame = top.leftSubrect(200).centeredSubrect(w=200,
                                                                   h=16)
     self.buttonWithKey(
         'showMatches').frame = top.leftover.leftCenteredSubrect(
             size=buttonSize, margin=20)
     self.query_scroller = layoutInScroller(self.queryTagViews, left,
                                            Size(300, 40), 20,
                                            self.query_scroller)
     for tv in self.tagViews + self.queryTagViews:
         f = tv.frame.bounds()
         tv.name_label.frame = f.leftCenteredSubrect(w=212, h=16, margin=8)
         if tv.incl:
             tv.incl.frame = f.leftover.leftCenteredSubrect(w=36,
                                                            h=20,
                                                            margin=2)
         if tv.excl:
             tv.excl.frame = f.leftover.rightCenteredSubrect(w=36,
                                                             h=20,
                                                             margin=2)
     return view
Exemplo n.º 3
0
 def layout(self, view):
     BaseScene.layout(self, view)
     cur = view.frame.centeredSubrect(w = 1000, h = view.frame.size.h - 100)
     self.scroller = layoutInScroller(self.matchViews, cur, Size(1000, 14), 2, self.scroller)
     for v in self.matchViews:
         self.layoutMatch(v)
     self.filter_label.frame = view.frame.topLeftSubrect(w = 200, h = 20, margin = 20)
     return view
Exemplo n.º 4
0
 def layout(self, view):
     BaseScene.layout(self, view)
     cur = view.frame.centeredSubrect(w = 800, h = 600)
     self.matrix.frame = cur
     self.type_label.frame = view.frame.topLeftSubrect(w = 240, h = 24, margins = Size(40, 100))
     grid = Grid(frame = view.frame.bottomCenteredSubrect(w = 600, h = 40, margin = 20), itemSize = Size(120, 40), columns = 4, rows = 1, spacing = Size(20, 0))
     grid.applyToViews(map(self.buttonWithKey, [ 'togglePlotType', 'toggleCounts', 'toggleNull', 'totalCounts' ]))
     grid = Grid(frame = view.frame.leftCenteredSubrect(w = 120, h = 400, margin = 40), itemSize = Size(120, 70), columns = 1, rows = 5, spacing = Size(0, 10))
     grid.applyToViews(self.data_type_views)
     for dtv in self.data_type_views:
         self.layoutDataTypeView(dtv)
     return view
Exemplo n.º 5
0
 def layout(self, view):
     BaseScene.layout(self, view)
     cur = view.frame.centeredSubrect(w = 800, h = view.frame.size.h - 100)
     left = cur.leftSubrect(w = 400)
     self.scroller = layoutInScroller(self.tagViews, cur.leftover, Size(300, 40), 20, self.scroller)
     top = left.topSubrect(40)
     left = left.leftover
     self.query_label.frame = top.leftSubrect(200).centeredSubrect(w = 200, h = 16)
     self.buttonWithKey('showMatches').frame = top.leftover.leftCenteredSubrect(size = buttonSize, margin = 20)
     self.query_scroller = layoutInScroller(self.queryTagViews, left, Size(300, 40), 20, self.query_scroller)
     for tv in self.tagViews + self.queryTagViews:
         f = tv.frame.bounds()
         tv.name_label.frame = f.leftCenteredSubrect(w = 212, h = 16, margin = 8)
         if tv.incl:
             tv.incl.frame = f.leftover.leftCenteredSubrect(w = 36, h = 20, margin = 2)
         if tv.excl:
             tv.excl.frame = f.leftover.rightCenteredSubrect(w = 36, h = 20, margin = 2)
     return view
Exemplo n.º 6
0
    def layout(self, view):
        BaseScene.layout(self, view)
        self.buttonWithKey('dump').frame = view.frame.topLeftSubrect(size = buttonSize, margin = 20)
        cols = 100
        rows = 40
        frame = view.frame.centeredSubrect(self.nucSize.w * cols, self.nucSize.h * rows)
        grid = Grid(frame = frame, itemSize = self.nucSize, columns = cols, rows = rows)
        row_idx = 4

        def labelFrame(owner_parts, tag_parts):
            base_frame = tag_parts[0].frame.copy()
            base_frame.origin.x = owner_parts[0].frame.origin.x - 130
            base_frame.size = Size(80, base_frame.size.height)
            return base_frame

        for part_name in ( "r1", "r2" ):
            part_start = 32
            part = getattr(self.pair, part_name)
            if part_name == "r2":
                row_idx = 20
            grid.setLocation(part_start, row_idx)
            grid.applyToViews(self.parts[part_name])
            self.labels[part_name].frame = labelFrame(self.parts[part_name], self.parts[part_name])

            for tindex in range(len(part.tags)):
                tag = part.tags[tindex]
                tseq = self.tag_seqs[tag[0]]
                match_index = tag[3]
                tstart = max(0, match_index - 4)
                col = part_start + tag[1] - (match_index - tstart)
                row_idx += 1
                #print(part_name + tag[0] + ": {} , {}".format(col, row_idx))
                grid.setLocation(col, row_idx)
                grid.applyToViews(self.parts[part_name + str(tindex)])

                self.labels[part_name + str(tindex)].frame = labelFrame(self.parts[part_name], self.parts[part_name + str(tindex)])

        return view
Exemplo n.º 7
0
 def layout(self, view):
     BaseScene.layout(self, view)
     cur = view.frame.centeredSubrect(w = 300, h = view.frame.size.h - 100)
     self.scroller = layoutInScroller(self.targetViews, cur, Size(200, 40), 20, self.scroller)
     return view
Exemplo n.º 8
0
 def layout(self, view):
     BaseScene.layout(self, view)
     cur = view.frame.centeredSubrect(w=300, h=view.frame.size.h - 100)
     self.scroller = layoutInScroller(self.targetViews, cur, Size(200, 40),
                                      20, self.scroller)
     return view
Exemplo n.º 9
0
    def layout(self, view):
        BaseScene.layout(self, view)
        cols = 100
        rows = 40
        frame = view.frame.centeredSubrect(self.nucSize.w * cols, self.nucSize.h * rows)
        grid = Grid(frame = frame, itemSize = self.nucSize, columns = cols, rows = rows)

        skips = self._skips()
        def skipped(idx):
            ret_idx = idx
            for skip in skips:
                if idx > skip[0]:
                    ret_idx = ret_idx - skip[1] + 1 # +1 for spaces representing skips
            return ret_idx

        target = self.pair.target
        row_idx = 4
        skipped_len = skipped(target.n)
        start_col = int((cols - skipped_len) / 2)

        def labelFrame(tag_parts):
            return Rect(grid.frame(start_col).origin.x - 140, tag_parts[0].frame.origin.y, 80, tag_parts[0].frame.size.height)

        grid.setLocation(start_col, row_idx)
        curskip_idx = 0
        nucs = self.parts[target.name]
        for idx in range(len(nucs)):
            nv = nucs[idx]
            if nv:
                nv.frame = grid.nextFrame()
            elif curskip_idx < len(skips) and idx == skips[curskip_idx][0]:
                nv = self.addNucView(Nuc("/", None), [1.0, 1.0, 1.0, 0.0 ])
                nv.frame = grid.nextFrame() # skip a frame
                curskip_idx += 1
        self.labels[target.name].frame = labelFrame(self.parts[target.name])

        row_idx += (2 if self.expanded else 1)
        r2tagmap = { tag[0] : tag for tag in self.pair.r2.tags }
        r2match = r2tagmap.get(target.name, ("", 0, 0, 0))
        grid.setLocation(start_col + skipped(r2match[3] - r2match[1]), row_idx)
        grid.applyToViews(self.parts["r2"])
        self.labels["r2"].frame = labelFrame(self.parts["r2"])

        nucs = self.parts.get("r2" + "adapter_t_rc")
        if nucs:
            row_idx += 1
            atag = r2tagmap["adapter_t_rc"]
            grid.setLocation(start_col + skipped(r2match[3] - r2match[1] + atag[1] - atag[3]), row_idx)
            grid.applyToViews(nucs)
            self.labels["r2" + "adapter_t_rc"].frame = labelFrame(nucs)

        r1tagmap = { tag[0] : tag for tag in self.pair.r1.tags }
        r1match = r1tagmap.get(target.name + "_rc", ("", 0, 0, 0))
        r1start = target.n - r1match[3] - r1match[2]
        nucs = self.parts.get("r1" + target.name + "_rc")
        if nucs:
            row_idx += 1
            grid.setLocation(start_col + skipped(r1start), row_idx)
            grid.applyToViews(nucs)
            self.labels["r1" + target.name + "_rc"].frame = labelFrame(nucs)

        same_row = (not self.expanded) and (r1start >= r2match[3] + r2match[2])
        row_idx += (0 if same_row else 1)
        grid.setLocation(start_col + skipped(r1start - r1match[1]), row_idx)
        grid.applyToViews(self.parts["r1"])
        if same_row:
            self.labels["r2"].text = "R2 / R1"
            self.labels["r1"].alpha = 0
        else:
            self.labels["r1"].frame = labelFrame(self.parts["r1"])

        nucs = self.parts.get("r1" + "adapter_b")
        if nucs:
            row_idx += 1
            atag = r1tagmap["adapter_b"]
            grid.setLocation(start_col + skipped(r1start - r1match[1] + atag[1] - atag[3]), row_idx)
            grid.applyToViews(nucs)
            self.labels["r1" + "adapter_b"].frame = labelFrame(nucs)

        for handle in [ "YYYR", "RRRY" ]:
            nucs = self.parts.get("r1" + handle)
            if nucs:
                row_idx += 1
                grid.setLocation(start_col + skipped(r1start - r1match[1]), row_idx)
                grid.applyToViews(nucs)
                self.labels["r1" + handle].frame = labelFrame(nucs)
            
        return view