예제 #1
0
    def set_parent(self, parent):
        Widget.set_parent(self, parent)

        self.heights = []
        sum_height = 0
        no_heights = 0
        for c in self.children:
            h = c.get_height()
            self.heights.append(h)
            if h is None:
                no_heights += 1
            else:
                sum_height += h

        height_left = self.h - sum_height
        if height_left < no_heights:
            raise ValueError, "Not enough space for all widgets"

        if no_heights:
            for i in range(0, len(self.heights)):
                if self.heights[i] is None:
                    self.heights[i] = height_left / no_heights
                    height_left -= height_left / no_heights
                    no_heights -= 1

        t = 0
        for i in range(0, len(self.children)):
            b = t + self.heights[i]
            self.children_pos.append(t)
            t = b

        for c in self.children:
            c.set_parent(self)
예제 #2
0
파일: split.py 프로젝트: AdamPrzybyla/cjc
    def set_parent(self,parent):
        Widget.set_parent(self,parent)

        self.heights=[]
        sum_height=0
        no_heights=0
        for c in self.children:
            h=c.get_height()
            self.heights.append(h)
            if h is None:
                no_heights+=1
            else:
                sum_height+=h

        height_left=self.h-sum_height
        if height_left<no_heights:
            raise ValueError,"Not enough space for all widgets"

        if no_heights:
            for i in range(0,len(self.heights)):
                if self.heights[i] is None:
                    self.heights[i]=height_left/no_heights
                    height_left-=height_left/no_heights
                    no_heights-=1

        t=0
        for i in range(0,len(self.children)):
            b=t+self.heights[i]
            self.children_pos.append(t)
            t=b

        for c in self.children:
            c.set_parent(self)
예제 #3
0
파일: input.py 프로젝트: AdamPrzybyla/cjc
 def __init__(self):
     self.__logger=logging.getLogger("cjc.ui.Input")
     Widget.__init__(self)
     self.prompt_win=None
     self.input_win=None
     self.prompt=None
     self.command_line=None
     self.input_widget=None
     self.question_handler=None
     self.question_abort_handler=None
예제 #4
0
파일: window.py 프로젝트: AdamPrzybyla/cjc
 def __init__(self,title,lock=0):
     self.__logger=logging.getLogger("cjc.ui.Window")
     Widget.__init__(self)
     self.buffer=None
     self.title=title
     self.win=None
     self.locked=lock
     self.active=0
     d=self.get_status_dict()
     self.status_bar=StatusBar("window_status",d)
예제 #5
0
 def __init__(self, title, lock=0):
     self.__logger = logging.getLogger("cjc.ui.Window")
     Widget.__init__(self)
     self.buffer = None
     self.title = title
     self.win = None
     self.locked = lock
     self.active = 0
     d = self.get_status_dict()
     self.status_bar = StatusBar("window_status", d)
예제 #6
0
 def __init__(self):
     self.__logger = logging.getLogger("cjc.ui.Input")
     Widget.__init__(self)
     self.prompt_win = None
     self.input_win = None
     self.prompt = None
     self.command_line = None
     self.input_widget = None
     self.question_handler = None
     self.question_abort_handler = None
예제 #7
0
 def set_parent(self,parent):
     Widget.set_parent(self,parent)
     cjc_globals.screen.lock.acquire()
     try:
         self.win=curses.newwin(self.h,self.w,self.y,self.x)
         self.win.leaveok(1)
         attr=cjc_globals.theme_manager.attrs["bar"]
         if attr is not None:
             self.win.bkgdset(ord(" "),attr)
     finally:
         cjc_globals.screen.lock.release()
예제 #8
0
 def set_parent(self, parent):
     Widget.set_parent(self, parent)
     cjc_globals.screen.lock.acquire()
     try:
         self.win = curses.newwin(self.h, self.w, self.y, self.x)
         self.win.leaveok(1)
         attr = cjc_globals.theme_manager.attrs["bar"]
         if attr is not None:
             self.win.bkgdset(ord(" "), attr)
     finally:
         cjc_globals.screen.lock.release()
예제 #9
0
파일: window.py 프로젝트: AdamPrzybyla/cjc
    def set_parent(self,parent):
        Widget.set_parent(self,parent)
        self.iw=self.w
        self.ih=self.h-1
        cjc_globals.screen.lock.acquire()
        try:
            self.win=curses.newwin(self.ih,self.iw,self.y,self.x)
            self.win.idlok(1)
            self.win.scrollok(1)
            self.win.leaveok(1)
        finally:
            cjc_globals.screen.lock.release()
        self.status_bar.set_parent(self)
        if self.buffer:
            self.draw_buffer()

        if self not in cjc_globals.screen.windows:
            cjc_globals.screen.add_window(self)
예제 #10
0
    def set_parent(self, parent):
        Widget.set_parent(self, parent)
        self.iw = self.w
        self.ih = self.h - 1
        cjc_globals.screen.lock.acquire()
        try:
            self.win = curses.newwin(self.ih, self.iw, self.y, self.x)
            self.win.idlok(1)
            self.win.scrollok(1)
            self.win.leaveok(1)
        finally:
            cjc_globals.screen.lock.release()
        self.status_bar.set_parent(self)
        if self.buffer:
            self.draw_buffer()

        if self not in cjc_globals.screen.windows:
            cjc_globals.screen.add_window(self)
예제 #11
0
    def set_parent(self, parent):
        Widget.set_parent(self, parent)

        self.widths = []
        sum_width = 0
        no_widths = 0
        for c in self.children:
            w = c.get_width()
            self.widths.append(w)
            if w is None:
                no_widths += 1
            else:
                sum_width += w

        width_left = self.w - (len(self.children) - 1) - sum_width
        if width_left < no_widths:
            raise ValueError, "Not enough space for all widgets"

        if no_widths:
            for i in range(0, len(self.widths)):
                if self.widths[i] is None:
                    self.widths[i] = width_left / no_widths
                    width_left -= width_left / no_widths
                    no_widths -= 1

        l = 0
        for i in range(0, len(self.children)):
            r = l + self.widths[i]
            if i > 0:
                div = curses.newwin(self.h, 1, self.y, l - 1)
                div.leaveok(1)
                div.bkgdset(ord("|"), curses.A_STANDOUT)
                div.erase()
                self.divs.append(div)
            self.children_pos.append(l)
            l = r + 1

        for c in self.children:
            c.set_parent(self)
예제 #12
0
파일: split.py 프로젝트: AdamPrzybyla/cjc
    def set_parent(self,parent):
        Widget.set_parent(self,parent)

        self.widths=[]
        sum_width=0
        no_widths=0
        for c in self.children:
            w=c.get_width()
            self.widths.append(w)
            if w is None:
                no_widths+=1
            else:
                sum_width+=w

        width_left=self.w-(len(self.children)-1)-sum_width
        if width_left<no_widths:
            raise ValueError,"Not enough space for all widgets"

        if no_widths:
            for i in range(0,len(self.widths)):
                if self.widths[i] is None:
                    self.widths[i]=width_left/no_widths
                    width_left-=width_left/no_widths
                    no_widths-=1

        l=0
        for i in range(0,len(self.children)):
            r=l+self.widths[i]
            if i>0:
                div=curses.newwin(self.h,1,self.y,l-1)
                div.leaveok(1)
                div.bkgdset(ord("|"),curses.A_STANDOUT)
                div.erase()
                self.divs.append(div)
            self.children_pos.append(l)
            l=r+1

        for c in self.children:
            c.set_parent(self)
예제 #13
0
 def __init__(self, *children):
     if len(children) < 1:
         raise ValueError, "At least 2 children must be given"
     Widget.__init__(self)
     self.children = children
예제 #14
0
 def set_parent(self, parent):
     Widget.set_parent(self, parent)
     self.command_line = text_input.TextInput(self, 0, u"", 100)
     self.input_widget = self.command_line
     self.make_windows()
     cjc_globals.screen.set_input_handler(self)
예제 #15
0
파일: input.py 프로젝트: AdamPrzybyla/cjc
 def set_parent(self,parent):
     Widget.set_parent(self,parent)
     self.command_line=text_input.TextInput(self,0,u"",100)
     self.input_widget=self.command_line
     self.make_windows()
     cjc_globals.screen.set_input_handler(self)
예제 #16
0
파일: split.py 프로젝트: AdamPrzybyla/cjc
 def __init__(self,*children):
     if len(children)<1:
         raise ValueError,"At least 2 children must be given"
     Widget.__init__(self)
     self.children=children
예제 #17
0
 def __init__(self, format, dict):
     Widget.__init__(self)
     self.format=format
     self.dict=dict
     self.current_content=None
예제 #18
0
 def __init__(self, format, dict):
     Widget.__init__(self)
     self.format = format
     self.dict = dict
     self.current_content = None