コード例 #1
0
ファイル: window.py プロジェクト: vogt420/terminator-1
    def create_layout(self, layout):
        """Apply any config items from our layout"""
        if not layout.has_key('children'):
            err('layout describes no children: %s' % layout)
            return
        children = layout['children']
        if len(children) != 1:
            # We're a Window, we can only have one child
            err('incorrect number of children for Window: %s' % layout)
            return

        child = children[children.keys()[0]]
        terminal = self.get_children()[0]
        dbg('Making a child of type: %s' % child['type'])
        if child['type'] == 'VPaned':
            self.split_axis(terminal, True)
        elif child['type'] == 'HPaned':
            self.split_axis(terminal, False)
        elif child['type'] == 'Notebook':
            self.tab_new()
            i = 2
            while i < len(child['children']):
                self.tab_new()
                i = i + 1
        elif child['type'] == 'Terminal':
            pass
        else:
            err('unknown child type: %s' % child['type'])
            return

        self.get_children()[0].create_layout(child)

        if layout.has_key('last_active_term'
                          ) and layout['last_active_term'] not in ['', None]:
            self.last_active_term = make_uuid(layout['last_active_term'])

        if layout.has_key('last_active_window'
                          ) and layout['last_active_window'] == 'True':
            self.terminator.last_active_window = self.uuid
コード例 #2
0
ファイル: window.py プロジェクト: albfan/terminator
    def create_layout(self, layout):
        """Apply any config items from our layout"""
        if not layout.has_key('children'):
            err('layout describes no children: %s' % layout)
            return
        children = layout['children']
        if len(children) != 1:
            # We're a Window, we can only have one child
            err('incorrect number of children for Window: %s' % layout)
            return

        child = children[children.keys()[0]]
        terminal = self.get_children()[0]
        dbg('Making a child of type: %s' % child['type'])
        if child['type'] == 'VPaned':
            self.split_axis(terminal, True)
        elif child['type'] == 'HPaned':
            self.split_axis(terminal, False)
        elif child['type'] == 'Notebook':
            self.tab_new()
            i = 2
            while i < len(child['children']):
                self.tab_new()
                i = i + 1
        elif child['type'] == 'Terminal':
            pass
        else:
            err('unknown child type: %s' % child['type'])
            return

        self.get_children()[0].create_layout(child)

        if layout.has_key('last_active_term') and layout['last_active_term'] not in ['', None]:
            self.last_active_term = make_uuid(layout['last_active_term'])

        if layout.has_key('last_active_window') and layout['last_active_window'] == 'True':
            self.terminator.last_active_window = self.uuid
コード例 #3
0
ファイル: notebook.py プロジェクト: dannywillems/terminator
    def create_layout(self, layout):
        """Apply layout configuration"""
        def child_compare(a, b):
            order_a = children[a]['order']
            order_b = children[b]['order']

            if (order_a == order_b):
                return 0
            if (order_a < order_b):
                return -1
            if (order_a > order_b):
                return 1

        if not layout.has_key('children'):
            err('layout specifies no children: %s' % layout)
            return

        children = layout['children']
        if len(children) <= 1:
            #Notebooks should have two or more children
            err('incorrect number of children for Notebook: %s' % layout)
            return

        num = 0
        keys = children.keys()
        keys.sort(child_compare)

        for child_key in keys:
            child = children[child_key]
            dbg('Making a child of type: %s' % child['type'])
            if child['type'] == 'Terminal':
                pass
            elif child['type'] == 'VPaned':
                page = self.get_nth_page(num)
                self.split_axis(page, True)
            elif child['type'] == 'HPaned':
                page = self.get_nth_page(num)
                self.split_axis(page, False)
            num = num + 1

        num = 0
        for child_key in keys:
            page = self.get_nth_page(num)
            if not page:
                # This page does not yet exist, so make it
                self.newtab(children[child_key])
                page = self.get_nth_page(num)
            if layout.has_key('labels'):
                labeltext = layout['labels'][num]
                if labeltext and labeltext != "None":
                    label = self.get_tab_label(page)
                    label.set_custom_label(labeltext)
            page.create_layout(children[child_key])

            if  layout.get('last_active_term',  None):
                self.last_active_term[page] = make_uuid(layout['last_active_term'][num])
            num = num + 1

        if layout.has_key('active_page'):
            # Need to do it later, or layout changes result
            gobject.idle_add(self.set_current_page, int(layout['active_page']))
        else:
            self.set_current_page(0)
コード例 #4
0
    def create_layout(self, layout):
        """Apply layout configuration"""
        def child_compare(a, b):
            order_a = children[a]['order']
            order_b = children[b]['order']

            if (order_a == order_b):
                return 0
            if (order_a < order_b):
                return -1
            if (order_a > order_b):
                return 1

        if not layout.has_key('children'):
            err('layout specifies no children: %s' % layout)
            return

        children = layout['children']
        if len(children) <= 1:
            #Notebooks should have two or more children
            err('incorrect number of children for Notebook: %s' % layout)
            return

        num = 0
        keys = children.keys()
        keys.sort(child_compare)

        for child_key in keys:
            child = children[child_key]
            dbg('Making a child of type: %s' % child['type'])
            if child['type'] == 'Terminal':
                pass
            elif child['type'] == 'VPaned':
                page = self.get_nth_page(num)
                self.split_axis(page, True)
            elif child['type'] == 'HPaned':
                page = self.get_nth_page(num)
                self.split_axis(page, False)
            num = num + 1

        num = 0
        for child_key in keys:
            page = self.get_nth_page(num)
            if not page:
                # This page does not yet exist, so make it
                self.newtab(children[child_key])
                page = self.get_nth_page(num)
            if layout.has_key('labels'):
                labeltext = layout['labels'][num]
                if labeltext and labeltext != "None":
                    label = self.get_tab_label(page)
                    label.set_custom_label(labeltext)
            page.create_layout(children[child_key])

            if layout.get('last_active_term', None):
                self.last_active_term[page] = make_uuid(
                    layout['last_active_term'][num])
            num = num + 1

        if layout.has_key('active_page'):
            # Need to do it later, or layout changes result
            GObject.idle_add(self.set_current_page, int(layout['active_page']))
        else:
            self.set_current_page(0)
コード例 #5
0
                                       "term": {
                                           "run_id": str(run_id),
                                       },
                                   },
                               })

        for xb in chunk.exposure_blocks:
            # try to find the runconfig for this XB
            try:
                rc = es.get(index='cf-runconfig',
                            doc_type='runconfig',
                            id=uuid.UUID(int=xb.run_id))
            except NotFoundError:
                rc = None

            xb_id = util.make_uuid("%s%d" % (msg.device_id, xb.start_time))
            result = es.index(index='cf-exposure',
                              doc_type='exposure',
                              id=xb_id,
                              body=messages.xb_to_doc(msg, xb, rc))
            if ifile < 20:
                print "Inserted XB:"
                print result
                print
            elif ifile == 20:
                print "Squelching further output."
                sys.stdout.flush()

            if do_create_events:
                for evt in xb.events:
                    event_id = util.make_uuid("%s%d" % (xb_id, evt.timestamp))